diff options
702 files changed, 51010 insertions, 8524 deletions
@@ -1,3 +1,1340 @@ +2005-03-12 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/StringSeqHelper.java, + org/omg/CORBA/WStringSeqHelper.java: New files. + +2005-03-12 Mark Wielaard <mark@klomp.org> + + * doc/www.gnu.org/events/escape_fosdem05.wml: Add links to + presentations. + +2005-03-11 Chris Burdess <dog@gnu.org> + + * gnu/xml/dom/html2/DomHTMLButtonElement.java, + gnu/xml/dom/html2/DomHTMLCollection.java, + gnu/xml/dom/html2/DomHTMLDocument.java, + gnu/xml/dom/html2/DomHTMLElement.java: Extensions for new element + types. + * gnu/xml/dom/html2/DomHTMLDListElement.java, + gnu/xml/dom/html2/DomHTMLDirectoryElement.java, + gnu/xml/dom/html2/DomHTMLDivElement.java, + gnu/xml/dom/html2/DomHTMLFieldSetElement.java, + gnu/xml/dom/html2/DomHTMLFontElement.java, + gnu/xml/dom/html2/DomHTMLFormElement.java, + gnu/xml/dom/html2/DomHTMLFrameElement.java, + gnu/xml/dom/html2/DomHTMLFrameSetElement.java, + gnu/xml/dom/html2/DomHTMLHRElement.java, + gnu/xml/dom/html2/DomHTMLHeadElement.java, + gnu/xml/dom/html2/DomHTMLHeadingElement.java, + gnu/xml/dom/html2/DomHTMLHtmlElement.java, + gnu/xml/dom/html2/DomHTMLIFrameElement.java, + gnu/xml/dom/html2/DomHTMLImageElement.java, + gnu/xml/dom/html2/DomHTMLInputElement.java, + gnu/xml/dom/html2/DomHTMLIsIndexElement.java, + gnu/xml/dom/html2/DomHTMLLIElement.java, + gnu/xml/dom/html2/DomHTMLLabelElement.java, + gnu/xml/dom/html2/DomHTMLLegendElement.java, + gnu/xml/dom/html2/DomHTMLLinkElement.java, + gnu/xml/dom/html2/DomHTMLMapElement.java, + gnu/xml/dom/html2/DomHTMLMenuElement.java, + gnu/xml/dom/html2/DomHTMLMetaElement.java, + gnu/xml/dom/html2/DomHTMLModElement.java, + gnu/xml/dom/html2/DomHTMLOListElement.java, + gnu/xml/dom/html2/DomHTMLObjectElement.java, + gnu/xml/dom/html2/DomHTMLOptGroupElement.java, + gnu/xml/dom/html2/DomHTMLOptionElement.java, + gnu/xml/dom/html2/DomHTMLParagraphElement.java, + gnu/xml/dom/html2/DomHTMLParamElement.java, + gnu/xml/dom/html2/DomHTMLPreElement.java, + gnu/xml/dom/html2/DomHTMLQuoteElement.java, + gnu/xml/dom/html2/DomHTMLScriptElement.java, + gnu/xml/dom/html2/DomHTMLSelectElement.java, + gnu/xml/dom/html2/DomHTMLStyleElement.java, + gnu/xml/dom/html2/DomHTMLTableCaptionElement.java, + gnu/xml/dom/html2/DomHTMLTableCellElement.java, + gnu/xml/dom/html2/DomHTMLTableColElement.java, + gnu/xml/dom/html2/DomHTMLTableElement.java, + gnu/xml/dom/html2/DomHTMLTableRowElement.java, + gnu/xml/dom/html2/DomHTMLTableSectionElement.java, + gnu/xml/dom/html2/DomHTMLTextAreaElement.java, + gnu/xml/dom/html2/DomHTMLTitleElement.java, + gnu/xml/dom/html2/DomHTMLUListElement.java: New files. + +2005-03-11 Chris Burdess <dog@gnu.org> + + * gnu/xml/aelfred2/SAXDriver.java: Corrected bug handling URI + warnings. + +2005-03-11 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/portable/InputStream.java (read_Context): + following API, this must be concrete and unimplemented. + +2005-03-11 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/BooleanSeqHelper.java, + org/omg/CORBA/CharSeqHelper.java, + org/omg/CORBA/DoubleSeqHelper.java, + org/omg/CORBA/FloatSeqHelper.java, + org/omg/CORBA/LongLongSeqHelper.java, + org/omg/CORBA/LongSeqHelper.java, + org/omg/CORBA/OctetSeqHelper.java, + org/omg/CORBA/ShortSeqHelper.java, + org/omg/CORBA/ULongLongSeqHelper.java, + org/omg/CORBA/ULongSeqHelper.java, + org/omg/CORBA/UShortSeqHelper.java, + org/omg/CORBA/WCharSeqHelper.java, + org/omg/CORBA/StringSeqHelper.java, + org/omg/CORBA/WStringSeqHelper.java: + New sequence holders. + * org/omg/CORBA/StringSeqHelper.java, + org/omg/CORBA/WStringSeqHelper.java: New helpers. + +2005-03-11 Archie Cobbs <archie@dellroad.org> + + * native/jni/java-lang/java_lang_VMProcess.c: Fix segfault + in the case that a zero length command array is passed. + +2005-03-11 Andreas Tobler <a.tobler@schweiz.ch> + + * native/fdlibm/ieeefp.h: Merge m32r bits from libgcj to keep the diff + minimal. + +2005-03-11 Roman Kennke <roman@kennke.org> + + * java/awt/Compmonent.java + (setComponentOrientation): The variable oldOrientation is initialized + too early. This is fixed. + +2005-03-11 Roman Kennke <roman@kennke.org> + + * java/awt/Compmonent.java + (setComponentOrientation): Made this property firing a + PropertyChangeEvent. + +2005-03-11 Robert Schuster <thebohemian@gmx.net> + + * java/beans/EventHandler.java: Reworked documentation. + (invoke): Fixed behavior to match spec. + +2005-03-11 Jeroen Frijters <jeroen@frijters.net> + + * java/lang/Class.java (newInstance): Fixed previous patch. + +2005-03-11 Jeroen Frijters <jeroen@frijters.net> + + * java/lang/Class.java (newInstance): Fix bug related to package + private classes. + +2005-03-10 Andrew Haley <aph@redhat.com> + + * gnu/java/nio/channels/FileChannelImpl.java (smallTransferFrom): + New. + (smallTransferTo): New. + (transferFrom): Loop around smallTransferFrom, copying pageSize + bytes each time. + (transferTo): Likewise. + +2005-03-10 Tom Tromey <tromey@redhat.com> + + * java/io/InputStreamReader.java: Indentation fixlets. Added + '@since' markers. + +2005-03-10 Chris Burdess <dog@bluezoo.org> + + * gnu/xml/dom/ls/SAXEventSink.java: Ignore element declarations if + not currently parsing the DTD. + +2005-03-10 Audrius Meskauskas <audriusa@bluewin.ch> + + * testsuite/javax.swing.text.html.parser/ + AllParserTests.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/HTML_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/AttributeList_test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/DTD_test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/Element_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/Entity_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/HTML_parsing.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/HTML_randomTable.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/parameterDefaulter_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/Parser_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/ParserEntityResolverTest.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/ParserTest.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/supplementaryNotifications.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/TagElement_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/TestCase.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/Text.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/textPreProcessor_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/Token_locations.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/low/Buffer_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/low/Constants_Test.java, + testsuite/javax.swing.text.html.parser/ + test/gnu/javax/swing/text/html/parser/low/ReaderTokenizer_Test.java: + New Classpath specific tests for the parser classes in gnu namespace. + +2005-03-10 Audrius Meskauskas <audriusa@bluewin.ch> + + * javax/swing/text/ChangedCharSetException.java, + javax/swing/text/html/HTMLEditorKit.java, + javax/swing/text/html/HTMLFrameHyperlinkEvent.java, + javax/swing/text/html/parser/AttributeList.java, + javax/swing/text/html/parser/ContentModel.java, + javax/swing/text/html/parser/DocumentParser.java, + javax/swing/text/html/parser/DTD.java, + javax/swing/text/html/parser/DTDConstants.java, + javax/swing/text/html/parser/Element.java, + javax/swing/text/html/parser/Entity.java, + javax/swing/text/html/parser/Parser.java, + javax/swing/text/html/parser/TagElement.java, + gnu/javax/swing/text/html/package.html, + gnu/javax/swing/text/html/parser/gnuDTD.java, + gnu/javax/swing/text/html/parser/HTML_401F.java, + gnu/javax/swing/text/html/parser/htmlAttributeSet.java, + gnu/javax/swing/text/html/parser/htmlValidator.java, + gnu/javax/swing/text/html/parser/package.html, + gnu/javax/swing/text/html/parser/models/list.java, + gnu/javax/swing/text/html/parser/models/node.java, + gnu/javax/swing/text/html/parser/models/noTagModel.java, + gnu/javax/swing/text/html/parser/models/package.html, + gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java, + gnu/javax/swing/text/html/parser/models/TableRowContentModel.java, + gnu/javax/swing/text/html/parser/models/transformer.java, + gnu/javax/swing/text/html/parser/support/gnuStringIntMapper.java, + gnu/javax/swing/text/html/parser/support/package.html, + gnu/javax/swing/text/html/parser/support/parameterDefaulter.java, + gnu/javax/swing/text/html/parser/support/Parser.java, + gnu/javax/swing/text/html/parser/support/textPreProcessor.java, + gnu/javax/swing/text/html/parser/support/low/Buffer.java, + gnu/javax/swing/text/html/parser/support/low/Constants.java, + gnu/javax/swing/text/html/parser/support/low/Location.java, + gnu/javax/swing/text/html/parser/support/low/node.java, + gnu/javax/swing/text/html/parser/support/low/package.html, + gnu/javax/swing/text/html/parser/support/low/ParseException.java, + gnu/javax/swing/text/html/parser/support/low/pattern.java, + gnu/javax/swing/text/html/parser/support/low/Queue.java, + gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java: + New files. + * javax/swing/text/html/HTML.java, + javax/swing/text/html/parser/ParserDelegator.java: + New files (replacing). + * javax/swing/text/html/package.html, + javax/swing/text/html/parser/package.html: Documenting the + packages. + +2005-03-09 Sven de Marothy <sven@physto.se> + + * java/util/Calendar.java + (set): Use starting day of week when one is needed if none is given. + * java/text/SimpleDateFormat.java + (parse): Handle 1-12 and 1-24 timestamps correctly. + * java/util/GregorianCalendar + (computeTime, computeFields): HOUR should be in 0-11 format. + (nonLeniencyCheck): Adjust leniency checking to that fact. + +2005-03-09 Sven de Marothy <sven@physto.se> + + * gnu/java/locale/Calendar.java, + gnu/java/locale/Calendar_nl.java, + gnu/java/locale/Calendar_de.java, + gnu/java/locale/Calendar_en.java: + Removed. + +2005-03-09 Sven de Marothy <sven@physto.se> + + * java/util/Calendar.java: + Updated to use gnu.java.locale.LocaleInformation for locale info. + * java/util/GregorianCalendar.java: + Made gregorianCutover a hard-coded constant. It is not localized. + +2005-03-09 Chris Burdess <dog@gnu.org> + + * gnu/xml/dom/html2/DomHTMLAnchorElement.java, + gnu/xml/dom/html2/DomHTMLAppletElement.java, + gnu/xml/dom/html2/DomHTMLAreaElement.java, + gnu/xml/dom/html2/DomHTMLBaseElement.java, + gnu/xml/dom/html2/DomHTMLBaseFontElement.java, + gnu/xml/dom/html2/DomHTMLBodyElement.java, + gnu/xml/dom/html2/DomHTMLBRElement.java, + gnu/xml/dom/html2/DomHTMLButtonElement.java, + gnu/xml/dom/html2/DomHTMLCollection.java, + gnu/xml/dom/html2/DomHTMLDocument.java, + gnu/xml/dom/html2/DomHTMLElement.java: New files. + +2005-03-09 Michael Koch <konqueror@gmx.de> + + * gnu/java/locale/LocaleInformation.java, + gnu/java/locale/LocaleInformation_aa.java, + gnu/java/locale/LocaleInformation_aa_DJ.java, + gnu/java/locale/LocaleInformation_aa_ER.java, + gnu/java/locale/LocaleInformation_aa_ER_SAAHO.java, + gnu/java/locale/LocaleInformation_aa_ET.java, + gnu/java/locale/LocaleInformation_af.java, + gnu/java/locale/LocaleInformation_af_ZA.java, + gnu/java/locale/LocaleInformation_am.java, + gnu/java/locale/LocaleInformation_am_ET.java, + gnu/java/locale/LocaleInformation_ar.java, + gnu/java/locale/LocaleInformation_ar_DZ.java, + gnu/java/locale/LocaleInformation_ar_IN.java, + gnu/java/locale/LocaleInformation_ar_IQ.java, + gnu/java/locale/LocaleInformation_ar_JO.java, + gnu/java/locale/LocaleInformation_ar_KW.java, + gnu/java/locale/LocaleInformation_ar_LB.java, + gnu/java/locale/LocaleInformation_ar_LY.java, + gnu/java/locale/LocaleInformation_ar_MA.java, + gnu/java/locale/LocaleInformation_ar_QA.java, + gnu/java/locale/LocaleInformation_ar_SA.java, + gnu/java/locale/LocaleInformation_ar_SY.java, + gnu/java/locale/LocaleInformation_ar_TN.java, + gnu/java/locale/LocaleInformation_ar_YE.java, + gnu/java/locale/LocaleInformation_as.java, + gnu/java/locale/LocaleInformation_as_IN.java, + gnu/java/locale/LocaleInformation_az_Cyrl.java, + gnu/java/locale/LocaleInformation_be.java, + gnu/java/locale/LocaleInformation_be_BY.java, + gnu/java/locale/LocaleInformation_bg.java, + gnu/java/locale/LocaleInformation_bg_BG.java, + gnu/java/locale/LocaleInformation_bn.java, + gnu/java/locale/LocaleInformation_bn_IN.java, + gnu/java/locale/LocaleInformation_ca.java, + gnu/java/locale/LocaleInformation_ca_ES.java, + gnu/java/locale/LocaleInformation_cs.java, + gnu/java/locale/LocaleInformation_cs_CZ.java, + gnu/java/locale/LocaleInformation_cy.java, + gnu/java/locale/LocaleInformation_cy_GB.java, + gnu/java/locale/LocaleInformation_da.java, + gnu/java/locale/LocaleInformation_da_DK.java, + gnu/java/locale/LocaleInformation_de.java, + gnu/java/locale/LocaleInformation_de_AT.java, + gnu/java/locale/LocaleInformation_de_BE.java, + gnu/java/locale/LocaleInformation_de_CH.java, + gnu/java/locale/LocaleInformation_de_DE.java, + gnu/java/locale/LocaleInformation_de_LI.java, + gnu/java/locale/LocaleInformation_de_LU.java, + gnu/java/locale/LocaleInformation_dv.java, + gnu/java/locale/LocaleInformation_dv_MV.java, + gnu/java/locale/LocaleInformation_dz.java, + gnu/java/locale/LocaleInformation_dz_BT.java, + gnu/java/locale/LocaleInformation_el.java, + gnu/java/locale/LocaleInformation_el_GR.java, + gnu/java/locale/LocaleInformation_en.java, + gnu/java/locale/LocaleInformation_en_AS.java, + gnu/java/locale/LocaleInformation_en_AU.java, + gnu/java/locale/LocaleInformation_en_BE.java, + gnu/java/locale/LocaleInformation_en_BW.java, + gnu/java/locale/LocaleInformation_en_BZ.java, + gnu/java/locale/LocaleInformation_en_CA.java, + gnu/java/locale/LocaleInformation_en_GB.java, + gnu/java/locale/LocaleInformation_en_GU.java, + gnu/java/locale/LocaleInformation_en_HK.java, + gnu/java/locale/LocaleInformation_en_IE.java, + gnu/java/locale/LocaleInformation_en_IN.java, + gnu/java/locale/LocaleInformation_en_MH.java, + gnu/java/locale/LocaleInformation_en_MP.java, + gnu/java/locale/LocaleInformation_en_MT.java, + gnu/java/locale/LocaleInformation_en_NZ.java, + gnu/java/locale/LocaleInformation_en_PH.java, + gnu/java/locale/LocaleInformation_en_PK.java, + gnu/java/locale/LocaleInformation_en_SG.java, + gnu/java/locale/LocaleInformation_en_UM.java, + gnu/java/locale/LocaleInformation_en_US.java, + gnu/java/locale/LocaleInformation_en_US_POSIX.java, + gnu/java/locale/LocaleInformation_en_VI.java, + gnu/java/locale/LocaleInformation_en_ZA.java, + gnu/java/locale/LocaleInformation_en_ZW.java, + gnu/java/locale/LocaleInformation_eo.java, + gnu/java/locale/LocaleInformation_es.java, + gnu/java/locale/LocaleInformation_es_AR.java, + gnu/java/locale/LocaleInformation_es_BO.java, + gnu/java/locale/LocaleInformation_es_CL.java, + gnu/java/locale/LocaleInformation_es_CO.java, + gnu/java/locale/LocaleInformation_es_CR.java, + gnu/java/locale/LocaleInformation_es_DO.java, + gnu/java/locale/LocaleInformation_es_EC.java, + gnu/java/locale/LocaleInformation_es_ES.java, + gnu/java/locale/LocaleInformation_es_GT.java, + gnu/java/locale/LocaleInformation_es_HN.java, + gnu/java/locale/LocaleInformation_es_MX.java, + gnu/java/locale/LocaleInformation_es_NI.java, + gnu/java/locale/LocaleInformation_es_PA.java, + gnu/java/locale/LocaleInformation_es_PE.java, + gnu/java/locale/LocaleInformation_es_PR.java, + gnu/java/locale/LocaleInformation_es_PY.java, + gnu/java/locale/LocaleInformation_es_SV.java, + gnu/java/locale/LocaleInformation_es_US.java, + gnu/java/locale/LocaleInformation_es_UY.java, + gnu/java/locale/LocaleInformation_es_VE.java, + gnu/java/locale/LocaleInformation_et.java, + gnu/java/locale/LocaleInformation_et_EE.java, + gnu/java/locale/LocaleInformation_eu.java, + gnu/java/locale/LocaleInformation_eu_ES.java, + gnu/java/locale/LocaleInformation_fa.java, + gnu/java/locale/LocaleInformation_fa_AF.java, + gnu/java/locale/LocaleInformation_fa_IR.java, + gnu/java/locale/LocaleInformation_fi.java, + gnu/java/locale/LocaleInformation_fi_FI.java, + gnu/java/locale/LocaleInformation_fo.java, + gnu/java/locale/LocaleInformation_fo_FO.java, + gnu/java/locale/LocaleInformation_fr.java, + gnu/java/locale/LocaleInformation_fr_BE.java, + gnu/java/locale/LocaleInformation_fr_CA.java, + gnu/java/locale/LocaleInformation_fr_CH.java, + gnu/java/locale/LocaleInformation_fr_LU.java, + gnu/java/locale/LocaleInformation_ga.java, + gnu/java/locale/LocaleInformation_ga_IE.java, + gnu/java/locale/LocaleInformation_gl.java, + gnu/java/locale/LocaleInformation_gl_ES.java, + gnu/java/locale/LocaleInformation_gu.java, + gnu/java/locale/LocaleInformation_gu_IN.java, + gnu/java/locale/LocaleInformation_gv.java, + gnu/java/locale/LocaleInformation_gv_GB.java, + gnu/java/locale/LocaleInformation_he.java, + gnu/java/locale/LocaleInformation_he_IL.java, + gnu/java/locale/LocaleInformation_hi.java, + gnu/java/locale/LocaleInformation_hi_IN.java, + gnu/java/locale/LocaleInformation_hr.java, + gnu/java/locale/LocaleInformation_hu.java, + gnu/java/locale/LocaleInformation_hu_HU.java, + gnu/java/locale/LocaleInformation_hy.java, + gnu/java/locale/LocaleInformation_hy_AM.java, + gnu/java/locale/LocaleInformation_hy_AM_REVISED.java, + gnu/java/locale/LocaleInformation_id.java, + gnu/java/locale/LocaleInformation_id_ID.java, + gnu/java/locale/LocaleInformation_is.java, + gnu/java/locale/LocaleInformation_is_IS.java, + gnu/java/locale/LocaleInformation_it.java, + gnu/java/locale/LocaleInformation_it_CH.java, + gnu/java/locale/LocaleInformation_it_IT.java, + gnu/java/locale/LocaleInformation_iu.java, + gnu/java/locale/LocaleInformation_ja.java, + gnu/java/locale/LocaleInformation_ja_JP.java, + gnu/java/locale/LocaleInformation_ka.java, + gnu/java/locale/LocaleInformation_kk.java, + gnu/java/locale/LocaleInformation_kk_KZ.java, + gnu/java/locale/LocaleInformation_kl.java, + gnu/java/locale/LocaleInformation_kl_GL.java, + gnu/java/locale/LocaleInformation_km.java, + gnu/java/locale/LocaleInformation_km_KH.java, + gnu/java/locale/LocaleInformation_kn.java, + gnu/java/locale/LocaleInformation_kn_IN.java, + gnu/java/locale/LocaleInformation_ko.java, + gnu/java/locale/LocaleInformation_ko_KR.java, + gnu/java/locale/LocaleInformation_kw.java, + gnu/java/locale/LocaleInformation_kw_GB.java, + gnu/java/locale/LocaleInformation_ky.java, + gnu/java/locale/LocaleInformation_lo.java, + gnu/java/locale/LocaleInformation_lo_LA.java, + gnu/java/locale/LocaleInformation_lt.java, + gnu/java/locale/LocaleInformation_lt_LT.java, + gnu/java/locale/LocaleInformation_lv.java, + gnu/java/locale/LocaleInformation_lv_LV.java, + gnu/java/locale/LocaleInformation_mk.java, + gnu/java/locale/LocaleInformation_ml.java, + gnu/java/locale/LocaleInformation_ml_IN.java, + gnu/java/locale/LocaleInformation_mn.java, + gnu/java/locale/LocaleInformation_mn_MN.java, + gnu/java/locale/LocaleInformation_mr.java, + gnu/java/locale/LocaleInformation_mr_IN.java, + gnu/java/locale/LocaleInformation_ms.java, + gnu/java/locale/LocaleInformation_ms_BN.java, + gnu/java/locale/LocaleInformation_ms_MY.java, + gnu/java/locale/LocaleInformation_mt.java, + gnu/java/locale/LocaleInformation_mt_MT.java, + gnu/java/locale/LocaleInformation_nb.java, + gnu/java/locale/LocaleInformation_nb_NO.java, + gnu/java/locale/LocaleInformation_nl.java, + gnu/java/locale/LocaleInformation_nl_BE.java, + gnu/java/locale/LocaleInformation_nl_NL.java, + gnu/java/locale/LocaleInformation_nn.java, + gnu/java/locale/LocaleInformation_nn_NO.java, + gnu/java/locale/LocaleInformation_om.java, + gnu/java/locale/LocaleInformation_om_ET.java, + gnu/java/locale/LocaleInformation_om_KE.java, + gnu/java/locale/LocaleInformation_or.java, + gnu/java/locale/LocaleInformation_or_IN.java, + gnu/java/locale/LocaleInformation_pa.java, + gnu/java/locale/LocaleInformation_pa_IN.java, + gnu/java/locale/LocaleInformation_pl.java, + gnu/java/locale/LocaleInformation_pl_PL.java, + gnu/java/locale/LocaleInformation_ps.java, + gnu/java/locale/LocaleInformation_ps_AF.java, + gnu/java/locale/LocaleInformation_pt.java, + gnu/java/locale/LocaleInformation_pt_BR.java, + gnu/java/locale/LocaleInformation_pt_PT.java, + gnu/java/locale/LocaleInformation_ro.java, + gnu/java/locale/LocaleInformation_ro_RO.java, + gnu/java/locale/LocaleInformation_ru.java, + gnu/java/locale/LocaleInformation_ru_RU.java, + gnu/java/locale/LocaleInformation_ru_UA.java, + gnu/java/locale/LocaleInformation_sa.java, + gnu/java/locale/LocaleInformation_sa_IN.java, + gnu/java/locale/LocaleInformation_sk.java, + gnu/java/locale/LocaleInformation_sk_SK.java, + gnu/java/locale/LocaleInformation_sl.java, + gnu/java/locale/LocaleInformation_so.java, + gnu/java/locale/LocaleInformation_so_DJ.java, + gnu/java/locale/LocaleInformation_so_ET.java, + gnu/java/locale/LocaleInformation_so_KE.java, + gnu/java/locale/LocaleInformation_so_SO.java, + gnu/java/locale/LocaleInformation_sq.java, + gnu/java/locale/LocaleInformation_sq_AL.java, + gnu/java/locale/LocaleInformation_sr.java, + gnu/java/locale/LocaleInformation_sr_Latn.java, + gnu/java/locale/LocaleInformation_sv.java, + gnu/java/locale/LocaleInformation_sv_FI.java, + gnu/java/locale/LocaleInformation_sv_SE.java, + gnu/java/locale/LocaleInformation_sw.java, + gnu/java/locale/LocaleInformation_sw_KE.java, + gnu/java/locale/LocaleInformation_sw_TZ.java, + gnu/java/locale/LocaleInformation_ta.java, + gnu/java/locale/LocaleInformation_ta_IN.java, + gnu/java/locale/LocaleInformation_te.java, + gnu/java/locale/LocaleInformation_te_IN.java, + gnu/java/locale/LocaleInformation_th.java, + gnu/java/locale/LocaleInformation_th_TH.java, + gnu/java/locale/LocaleInformation_ti.java, + gnu/java/locale/LocaleInformation_ti_ER.java, + gnu/java/locale/LocaleInformation_ti_ET.java, + gnu/java/locale/LocaleInformation_tr.java, + gnu/java/locale/LocaleInformation_tr_TR.java, + gnu/java/locale/LocaleInformation_tt.java, + gnu/java/locale/LocaleInformation_tt_RU.java, + gnu/java/locale/LocaleInformation_uk.java, + gnu/java/locale/LocaleInformation_uk_UA.java, + gnu/java/locale/LocaleInformation_ur.java, + gnu/java/locale/LocaleInformation_uz.java, + gnu/java/locale/LocaleInformation_uz_AF.java, + gnu/java/locale/LocaleInformation_vi.java, + gnu/java/locale/LocaleInformation_zh.java, + gnu/java/locale/LocaleInformation_zh_CN_Hans.java, + gnu/java/locale/LocaleInformation_zh_HK_Hant.java, + gnu/java/locale/LocaleInformation_zh_Hant.java, + gnu/java/locale/LocaleInformation_zh_MO_Hant.java, + gnu/java/locale/LocaleInformation_zh_SG_Hans.java, + gnu/java/locale/LocaleInformation_zh_TW_Hant.java: + Regenerated with current gnu.localegen. + +2005-03-09 Tom Tromey <tromey@redhat.com> + + * java/net/URLClassLoader.java (addURLImpl): Reset 'thisString'. + (toString): Synchronize. + +2005-03-09 Michael Koch <konqueror@gmx.de> + + * org/omg/CORBA/ARG_IN.java, + org/omg/CORBA/ARG_INOUT.java, + org/omg/CORBA/ARG_OUT.java, + org/omg/CORBA/Any.java, + org/omg/CORBA/AnyHolder.java, + org/omg/CORBA/BAD_CONTEXT.java, + org/omg/CORBA/BAD_INV_ORDER.java, + org/omg/CORBA/BAD_OPERATION.java, + org/omg/CORBA/BAD_PARAM.java, + org/omg/CORBA/BAD_TYPECODE.java, + org/omg/CORBA/BooleanHolder.java, + org/omg/CORBA/BooleanSeqHolder.java, + org/omg/CORBA/Bounds.java, + org/omg/CORBA/ByteHolder.java, + org/omg/CORBA/COMM_FAILURE.java, + org/omg/CORBA/CharHolder.java, + org/omg/CORBA/CharSeqHolder.java, + org/omg/CORBA/CompletionStatus.java, + org/omg/CORBA/Context.java, + org/omg/CORBA/ContextList.java, + org/omg/CORBA/DATA_CONVERSION.java, + org/omg/CORBA/DoubleHolder.java, + org/omg/CORBA/DoubleSeqHolder.java, + org/omg/CORBA/FREE_MEM.java, + org/omg/CORBA/FixedHolder.java, + org/omg/CORBA/FloatHolder.java, + org/omg/CORBA/FloatSeqHolder.java, + org/omg/CORBA/IDLEntity.java, + org/omg/CORBA/IMP_LIMIT.java, + org/omg/CORBA/INITIALIZE.java, + org/omg/CORBA/INTERNAL.java, + org/omg/CORBA/INTF_REPOS.java, + org/omg/CORBA/INVALID_TRANSACTION.java, + org/omg/CORBA/INV_FLAG.java, + org/omg/CORBA/INV_IDENT.java, + org/omg/CORBA/INV_OBJREF.java, + org/omg/CORBA/INV_POLICY.java, + org/omg/CORBA/IntHolder.java, + org/omg/CORBA/LongHolder.java, + org/omg/CORBA/LongLongSeqHolder.java, + org/omg/CORBA/LongSeqHolder.java, + org/omg/CORBA/MARSHAL.java, + org/omg/CORBA/NO_IMPLEMENT.java, + org/omg/CORBA/NO_MEMORY.java, + org/omg/CORBA/NO_PERMISSION.java, + org/omg/CORBA/NO_RESPONSE.java, + org/omg/CORBA/NamedValue.java, + org/omg/CORBA/OBJECT_NOT_EXIST.java, + org/omg/CORBA/OBJ_ADAPTER.java, + org/omg/CORBA/ORB.java, + org/omg/CORBA/Object.java, + org/omg/CORBA/OctetSeqHolder.java, + org/omg/CORBA/PERSIST_STORE.java, + org/omg/CORBA/Principal.java, + org/omg/CORBA/ShortHolder.java, + org/omg/CORBA/ShortSeqHolder.java, + org/omg/CORBA/StringHolder.java, + org/omg/CORBA/SystemException.java, + org/omg/CORBA/TCKind.java, + org/omg/CORBA/TRANSACTION_REQUIRED.java, + org/omg/CORBA/TRANSACTION_ROLLEDBACK.java, + org/omg/CORBA/TRANSIENT.java, + org/omg/CORBA/TypeCode.java, + org/omg/CORBA/TypeCodeHolder.java, + org/omg/CORBA/TypeCodePackage/BadKind.java, + org/omg/CORBA/TypeCodePackage/Bounds.java, + org/omg/CORBA/ULongLongSeqHolder.java, + org/omg/CORBA/ULongSeqHolder.java, + org/omg/CORBA/UNKNOWN.java, + org/omg/CORBA/UShortSeqHolder.java, + org/omg/CORBA/UserException.java, + org/omg/CORBA/WCharSeqHolder.java, + org/omg/CORBA/portable/IDLEntity.java, + org/omg/CORBA/portable/InputStream.java, + org/omg/CORBA/portable/OutputStream.java, + org/omg/CORBA/portable/Streamable.java: + Use our standard copyright header. + +2005-03-09 Michael Koch <konqueror@gmx.de> + + * org/omg/CORBA/AnyHolder.java: Added missing import. + +2005-03-09 Robert Schuster <thebohemian@gmx.net> + + * java/awt/AWTEvent.java (toString): Added case + for source not being an AWT component. + +2005-03-08 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/BooleanHolder.java, + org/omg/CORBA/ByteHolder.java, + org/omg/CORBA/CharHolder.java, + org/omg/CORBA/DoubleHolder.java, + org/omg/CORBA/FixedHolder.java, + org/omg/CORBA/FloatHolder.java, + org/omg/CORBA/IntHolder.java, + org/omg/CORBA/LongHolder.java, + org/omg/CORBA/ShortHolder.java, + org/omg/CORBA/StringHolder.java, + org/omg/CORBA/TypeCodeHolder.java: + Fixing the _read method. + +2005-03-08 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/NamedValue.java, + org/omg/CORBA/ARG_IN.java, + org/omg/CORBA/ARG_OUT.java, + org/omg/CORBA/ARG_INOUT.java: + New files. + +2005-03-08 Audrius Meskauskas <audriusa@bluewin.ch> + * org/omg/CORBA/AnyHolder.java: New file. + +2005-03-08 David Gilbert <david.gilbert@object-refinery.com> + + * java/awt/Font.java (decode): Handle null argument and allow + space as delimiter. + +2005-03-07 Chris Burdess <dog@gnu.org> + + * gnu/java/net/protocol/https/Handler.java: New file. + +2005-03-07 Jeroen Frijters <jeroen@frijters.net> + + * java/io/DataInputStream.java (ignoreInitialNewline): Removed + (readLine): Changed newline handling. + +2005-03-07 Jeroen Frijters <jeroen@frijters.net> + + * java/net/URI.java (AUTHORITY_REGEXP): Corrected regexp. + (AUTHORITY_USERINFO_GROUP,AUTHORITY_HOST_GROUP,AUTHORITY_PORT_GROUP): + Adjusted to match new regexp. + +2005-03-06 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * gnu/CORBA/primitiveArrayTypeCode.java: + Moved from org.omg.CORBA. + * gnu/CORBA/primitiveTypeCode.java: Likewise. + * org/omg/CORBA/BooleanHolder.java, + org/omg/CORBA/ByteHolder.java, + org/omg/CORBA/CharHolder.java, + org/omg/CORBA/DoubleHolder.java, + org/omg/CORBA/FixedHolder.java, + org/omg/CORBA/FloatHolder.java, + org/omg/CORBA/IntHolder.java, + org/omg/CORBA/LongHolder.java, + org/omg/CORBA/ShortHolder.java, + org/omg/CORBA/StringHolder.java, + org/omg/CORBA/TypeCodeHolder.java: + Added necessary imports. + * org/omg/CORBA/BooleanSeqHolder.java, + org/omg/CORBA/CharSeqHolder.java, + org/omg/CORBA/DoubleSeqHolder.java, + org/omg/CORBA/FloatSeqHolder.java, + org/omg/CORBA/LongLongSeqHolder.java, + org/omg/CORBA/LongSeqHolder.java, + org/omg/CORBA/OctetSeqHolder.java, + org/omg/CORBA/ShortSeqHolder.java, + org/omg/CORBA/ULongLongSeqHolder.java, + org/omg/CORBA/ULongSeqHolder.java, + org/omg/CORBA/UShortSeqHolder.java, + org/omg/CORBA/WCharSeqHolder.java: + Likewise and changed direct value + assignments to setValue calls. + +2005-03-06 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * org/omg/CORBA/CompletionStatus.java, + org/omg/CORBA/TypeCode.java, + org/omg/CORBA/primitiveTypeCode.java: + Fix references to Bounds and add implementations + of IDLEntity. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + * org/omg/CORBA/TypeCodePackage/BadKind.java, + org/omg/CORBA/SystemException.java, + org/omg/CORBA/TypeCode.java, + org/omg/CORBA/UserException.java, + org/omg/CORBA/CompletionStatus.java: + Documenting that serialVersionUID is from v1.4. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + * org/omg/CORBA/Context.java, + org/omg/CORBA/ContextList.java: New files. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + * org/omg/CORBA/TCKind.java: Making fields final. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/Any.java, + org/omg/CORBA/Principal.java, + org/omg/CORBA/TypeCodePackage/Bounds.java, + org/omg/CORBA/TypeCodePackage/package.html: New files. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/ULongSeqHolder.java, + org/omg/CORBA/UShortSeqHolder.java, + org/omg/CORBA/WCharSeqHolder.java, + org/omg/CORBA/BooleanSeqHolder.java, + org/omg/CORBA/CharSeqHolder.java, + org/omg/CORBA/DoubleSeqHolder.java, + org/omg/CORBA/FloatSeqHolder.java, + org/omg/CORBA/LongLongSeqHolder.java, + org/omg/CORBA/LongSeqHolder.java, + org/omg/CORBA/OctetSeqHolder.java, + org/omg/CORBA/ShortSeqHolder.java, + org/omg/CORBA/ULongLongSeqHolder.java: New files. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/IntHolder.java, + org/omg/CORBA/LongHolder.java, + org/omg/CORBA/ShortHolder.java, + org/omg/CORBA/StringHolder.java, + org/omg/CORBA/TypeCodeHolder.java, + org/omg/CORBA/BooleanHolder.java, + org/omg/CORBA/ByteHolder.java, + org/omg/CORBA/CharHolder.java, + org/omg/CORBA/DoubleHolder.java, + org/omg/CORBA/FixedHolder.java, + org/omg/CORBA/FloatHolder.java, + org/omg/CORBA/primitiveTypeCode.java, + org/omg/CORBA/primitiveArrayTypeCode.java: New files. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/portable/InputStream.java, + org/omg/CORBA/portable/OutputStream.java, + org/omg/CORBA/portable/IDLEntity.java, + org/omg/CORBA/portable/Streamable.java: New files. + * org/omg/CORBA/Object.java, + org/omg/CORBA/ORB.java: New files (just to keep code compilable). + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + * org/omg/CORBA/TypeCodePackage/BadKind.java, + org/omg/CORBA/SystemException.java, + org/omg/CORBA/TypeCode.java, + org/omg/CORBA/UserException.java, + org/omg/CORBA/CompletionStatus.java: + Replacing serialVersionUID v1.2 into v1.4. + +2005-03-06 Audrius Meskauskas <audriusa@bluewin.ch> + * org/omg/CORBA/TypeCodePackage/BadKind.java, + org/omg/CORBA/SystemException.java, + org/omg/CORBA/TypeCode.java, + org/omg/CORBA/UserException.java, + org/omg/CORBA/CompletionStatus.java: Adding serialVersionUID. + +2005-03-05 Andreas Tobler <a.tobler@schweiz.ch> + + * native/fdlibm/dtoa.c (_dtoa_r): Initialize variables ilim, ilim1 + and spec_case. Initialize pointer mlo. + * native/fdlibm/strtod.c (_strtod_r): Initialize pointers bb, bd, + ds and delta. + * native/fdlibm/e_asin.c (__ieee754_asin): Initialize variable t. + * native/fdlibm/e_exp.c (__ieee754_exp): Initialize variables hi, + lo and k. + * native/fdlibm/e_rem_pio2.c (__ieee754_rem_pio2): Initialize + uninitialized variable z. + +2005-03-05 Audrius Meskauskas <audriusa@bluewin.ch> + * org/omg/CORBA/BAD_OPERATION.java: Formatting change + (replacing CR CR LF by CR LF). + +2005-03-04 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * org/omg/CORBA/Bounds.java: New file. + * org/omg/CORBA/TypeCode.java: Commented + out Any to fix build. + From Audrius Meskauskas: + * org/omg/CORBA/BAD_OPERATION.java: New file. + +2005-03-05 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/INV_POLICY.java, + org/omg/CORBA/NO_PERMISSION.java, + org/omg/CORBA/BAD_INV_ORDER.java, + org/omg/CORBA/INTF_REPOS.java, + org/omg/CORBA/INV_IDENT.java, + org/omg/CORBA/NO_IMPLEMENT.java, + org/omg/CORBA/UNKNOWN.java, + org/omg/CORBA/INV_FLAG.java, + org/omg/CORBA/BAD_TYPECODE.java, + org/omg/CORBA/NO_MEMORY.java, + org/omg/CORBA/INVALID_TRANSACTION.java, + org/omg/CORBA/INTERNAL.java, + org/omg/CORBA/COMM_FAILURE.java, + org/omg/CORBA/PERSIST_STORE.java, + org/omg/CORBA/BAD_CONTEXT.java, + org/omg/CORBA/INV_OBJREF.java, + org/omg/CORBA/TRANSACTION_REQUIRED.java, + org/omg/CORBA/TRANSACTION_ROLLEDBACK.java, + org/omg/CORBA/FREE_MEM.java, + org/omg/CORBA/OBJECT_NOT_EXIST.java, + org/omg/CORBA/TRANSIENT.java, + org/omg/CORBA/OBJ_ADAPTER.java, + org/omg/CORBA/IMP_LIMIT.java, + org/omg/CORBA/INITIALIZE.java, + org/omg/CORBA/NO_RESPONSE.java, + org/omg/CORBA/DATA_CONVERSION.java, + org/omg/CORBA/MARSHAL.java: New files. + +2005-03-04 Roman Kennke <roman@ontographics.com> + + * javax/swing/text/rtf/ControlWordToken.java: New file. + * javax/swing/text/rtf/RTFEditorKit.java: New file. + * javax/swing/text/rtf/RTFParseException.java: New file. + * javax/swing/text/rtf/RTFParser.java: New file. + * javax/swing/text/rtf/RTFScanner.java: New file. + * javax/swing/text/rtf/TextToken.java: New file. + * javax/swing/text/rtf/Token.java: New file. + +2005-03-02 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/TypeCode.java, + org/omg/CORBA/UserException.java, + org/omg/CORBA/TypeCodePackage/BadKind.java: New files. + +2005-03-02 Audrius Meskauskas <audriusa@bluewin.ch> + + * org/omg/CORBA/TCKind.java, + org/omg/CORBA/BAD_PARAM.java, + org/omg/CORBA/CompletionStatus.java, + org/omg/CORBA/IDLEntity.java, + org/omg/CORBA/SystemException.java: New files. + +2005-03-03 Roman Kennke <roman@ontographics.com> + + * javax/swing/BoxLayout.java: + (preferredLayoutSize,minimumLayoutSize,maximumLayoutSize, + layoutContainer): Make these methods and thereby the + BoxLayout respect the insets (like borders) of the + component that is laid out. + +2005-03-03 Jeroen Frijters <jeroen@frijters.net> + + * java/lang/InheritableThreadLocal.java + (threadMap): Removed. + (InheritableThreadLocal): Removed code. + (newChildThread): Changed to use locals map in Thread. + * java/lang/Thread.java + (locals): New field. + (die): Clear locals field. + (getThreadLocals): New method. + * java/lang/ThreadLocal.java + (value): Removed. + (valueMap): Removed. + (get,set): Changed to use locals map in Thread. + +2005-03-03 Jeroen Frijters <jeroen@frijters.net> + + * java/io/FileInputStream.java (FileInputStream(File)), + java/io/FileOutputStream.java (FileOutputStream(File)): + Removed unnecessary File.isDirectory() check. + +2005-03-02 Michael Koch <konqueror@gmx.de> + + * doc/hacking.texinfo: Improved explanation of our coding style + regarding import statements. + +2005-03-02 Michael Koch <konqueror@gmx.de> + + * gnu/java/security/OID.java, + gnu/java/security/der/DERReader.java, + gnu/java/security/provider/CollectionCertStoreImpl.java, + gnu/java/security/provider/DSAParameterGenerator.java, + gnu/java/security/provider/DefaultPolicy.java, + gnu/java/security/provider/EncodedKeyFactory.java, + gnu/java/security/provider/GnuDHPublicKey.java, + gnu/java/security/provider/GnuDSAPrivateKey.java, + gnu/java/security/provider/GnuDSAPublicKey.java, + gnu/java/security/provider/GnuRSAPrivateKey.java, + gnu/java/security/provider/GnuRSAPublicKey.java, + gnu/java/security/provider/PKIXCertPathValidatorImpl.java, + gnu/java/security/provider/RSA.java, + gnu/java/security/provider/SHA1PRNG.java, + gnu/java/security/provider/SHA1withRSA.java, + gnu/java/security/provider/X509CertificateFactory.java, + gnu/java/security/x509/GnuPKIExtension.java, + gnu/java/security/x509/X500DistinguishedName.java, + gnu/java/security/x509/X509CRL.java, + gnu/java/security/x509/X509CRLEntry.java, + gnu/java/security/x509/X509CertPath.java, + gnu/java/security/x509/X509CertSelectorImpl.java, + gnu/java/security/x509/X509Certificate.java, + gnu/java/security/x509/ext/AuthorityKeyIdentifier.java, + gnu/java/security/x509/ext/BasicConstraints.java, + gnu/java/security/x509/ext/CRLNumber.java, + gnu/java/security/x509/ext/CertificatePolicies.java, + gnu/java/security/x509/ext/ExtendedKeyUsage.java, + gnu/java/security/x509/ext/Extension.java, + gnu/java/security/x509/ext/GeneralNames.java, + gnu/java/security/x509/ext/IssuerAlternativeNames.java, + gnu/java/security/x509/ext/KeyUsage.java, + gnu/java/security/x509/ext/PolicyConstraint.java, + gnu/java/security/x509/ext/PolicyMappings.java, + gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java, + gnu/java/security/x509/ext/ReasonCode.java, + gnu/java/security/x509/ext/SubjectAlternativeNames.java, + gnu/java/security/x509/ext/SubjectKeyIdentifier.java: + Reworked import statments to match our style. + +2005-03-02 Michael Koch <konqueror@gmx.de> + + * gnu/java/awt/Buffers.java, + gnu/java/awt/ComponentDataBlitOp.java, + gnu/java/awt/EmbeddedWindowSupport.java, + gnu/java/awt/image/ImageDecoder.java, + gnu/java/awt/image/XBMDecoder.java, + gnu/java/awt/peer/ClasspathFontPeer.java, + gnu/java/beans/IntrospectionIncubator.java, + gnu/java/io/EncodingManager.java, + gnu/java/io/decode/DecoderUTF8.java, + gnu/java/io/encode/EncoderEightBitLookup.java, + gnu/java/io/encode/EncoderUTF8.java, + gnu/java/lang/ClassHelper.java, + gnu/java/lang/MainThread.java, + gnu/java/lang/reflect/TypeSignature.java, + gnu/java/locale/LocaleHelper.java, + gnu/java/net/CRLFInputStream.java, + gnu/java/net/EmptyX509TrustManager.java, + gnu/java/net/HeaderFieldHelper.java, + gnu/java/net/LineInputStream.java, + gnu/java/net/PlainSocketImpl.java, + gnu/java/net/URLParseError.java, + gnu/java/net/protocol/file/Connection.java, + gnu/java/net/protocol/file/Handler.java, + gnu/java/net/protocol/ftp/ActiveModeDTP.java, + gnu/java/net/protocol/ftp/BlockInputStream.java, + gnu/java/net/protocol/ftp/CompressedInputStream.java, + gnu/java/net/protocol/ftp/DTP.java, + gnu/java/net/protocol/ftp/DTPInputStream.java, + gnu/java/net/protocol/ftp/FTPConnection.java, + gnu/java/net/protocol/ftp/FTPURLConnection.java, + gnu/java/net/protocol/ftp/PassiveModeDTP.java, + gnu/java/net/protocol/ftp/StreamInputStream.java, + gnu/java/net/protocol/http/ChunkedInputStream.java, + gnu/java/net/protocol/http/HTTPConnection.java, + gnu/java/net/protocol/http/HTTPURLConnection.java, + gnu/java/net/protocol/http/Headers.java, + gnu/java/net/protocol/http/Request.java, + gnu/java/net/protocol/jar/Connection.java, + gnu/java/net/protocol/jar/Handler.java, + gnu/java/nio/ChannelInputStream.java, + gnu/java/nio/ChannelOutputStream.java, + gnu/java/nio/InputStreamChannel.java, + gnu/java/nio/OutputStreamChannel.java, + gnu/java/nio/SelectorProviderImpl.java, + gnu/java/rmi/RMIMarshalledObjectInputStream.java, + gnu/java/rmi/RMIMarshalledObjectOutputStream.java, + gnu/java/rmi/dgc/DGCImpl.java, + gnu/java/rmi/registry/RegistryImpl.java, + gnu/java/rmi/server/ProtocolConstants.java, + gnu/java/rmi/server/RMIDefaultSocketFactory.java, + gnu/java/rmi/server/RMIIncomingThread.java, + gnu/java/rmi/server/RMIObjectInputStream.java, + gnu/java/rmi/server/RMIObjectOutputStream.java, + gnu/java/rmi/server/RMIVoidValue.java, + gnu/java/rmi/server/UnicastConnectionManager.java, + gnu/java/rmi/server/UnicastRef.java, + gnu/java/rmi/server/UnicastRemoteCall.java, + gnu/java/rmi/server/UnicastRemoteStub.java, + gnu/java/rmi/server/UnicastServerRef.java: + Reorganized import statments and fixed some @author tags and html + usage in javadocs. + +2005-03-02 Michael Koch <konqueror@gmx.de> + + * gnu/java/awt/color/package.html, + gnu/java/awt/image/package.html, + gnu/java/awt/package.html, + gnu/java/awt/peer/package.html, + gnu/java/beans/decoder/package.html, + gnu/java/beans/editors/package.html, + gnu/java/beans/package.html, + gnu/java/io/decode/package.html, + gnu/java/io/encode/package.html, + gnu/java/io/package.html, + gnu/java/lang/package.html, + gnu/java/lang/reflect/package.html, + gnu/java/locale/package.html, + gnu/java/math/package.html, + gnu/java/net/package.html, + gnu/java/net/protocol/file/package.html, + gnu/java/net/protocol/http/event/package.html, + gnu/java/net/protocol/jar/package.html, + gnu/java/nio/channels/package.html, + gnu/java/nio/charset/package.html, + gnu/java/nio/package.html, + gnu/java/rmi/dgc/package.html, + gnu/java/rmi/package.html, + gnu/java/rmi/registry/package.html, + gnu/java/rmi/server/package.html, + gnu/java/security/action/package.html, + gnu/java/security/ber/package.html, + gnu/java/security/der/package.html, + gnu/java/security/package.html, + gnu/java/security/pkcs/package.html, + gnu/java/security/provider/package.html, + gnu/java/security/util/package.html, + gnu/java/security/x509/ext/package.html, + gnu/java/security/x509/package.html, + gnu/java/text/package.html, + gnu/java/util/package.html, + gnu/java/util/prefs/package.html, + java/lang/annotation/package.html: + New files. + +2005-03-02 Michael Koch <konqueror@gmx.de> + + * gnu/java/awt/color/CieXyzConverter.java, + gnu/java/awt/color/ClutProfileConverter.java, + gnu/java/awt/color/ColorLookUpTable.java, + gnu/java/awt/color/ColorSpaceConverter.java, + gnu/java/awt/color/GrayProfileConverter.java, + gnu/java/awt/color/GrayScaleConverter.java, + gnu/java/awt/color/LinearRGBConverter.java, + gnu/java/awt/color/ProfileHeader.java, + gnu/java/awt/color/PyccConverter.java, + gnu/java/awt/color/RgbProfileConverter.java, + gnu/java/awt/color/SrgbConverter.java, + gnu/java/awt/color/TagEntry.java, + gnu/java/awt/color/ToneReproductionCurve.java: + Use standard copyright header. + +2005-03-02 Mark Wielaard <mark@klomp.org> + + * doc/www.gnu.org/cp-tools/cp-tools.wml: Fix createlink to + texidoclet.html. + +2005-03-02 Michael Koch <konqueror@gmx.de> + + * doc/api/Makefile.am: Remove gjdoc_rawcomment.cache if neccesary. + +2005-02-28 Roman Kennke <roman@ontographics.com> + + * examples/gnu/classpath/examples/swing/Demo.java + (mkListPanel,mkButtonBar): Changed JList example so that + the newly added support for JList.HORIZONTAL_WRAP and + JList.VERTICAL_WRAP is shown. + +2005-02-27 Roman Kennke <roman@ontographics.com> + + * javax/swing/JList.java + (getPreferredScrollableViewportSize): + The previous implementation was merely guessing the size, + now it respects layoutOrientation, visibleRowCount + and preferredSize. + (getScrollableTracksViewportHeight): + Reimplemented so that layoutOrientation, visibleRowCount + and preferred size are respected. + (getScrollableTracksViewportWidth): + Reimplemented so that layoutOrientation, visibleRowCount + and preferred size are respected. + * javax/swing/plaf/basic/BasicListUI.java + (getPreferredSize): + Improved calculation of preferredSize when JList is + set to HORIZONTAL_WRAP or VERTICAL_WRAP. + (getCellBounds): + The previous implementation assumed a layoutOrientation of + JList.VERTICAL, now also ok with JList.HORIZONTAL_WRAP and + JList.VERTICAL_WRAP. + +2005-02-27 Roman Kennke <roman@ontographics.com> + + * javax/swing/CellRendererPane.java: + implemented all methods of this class. + reformatted all wrong formatted code. + * javax/swing/plaf/basic/BasicListUI.java + (paintCell): use CellRendererPane for painting the cells. + +2005-02-27 Audrius Meskauskas <audriusa@bluewin.ch> + + * javax/swing/JComboBox.java (constructors): selecting the + first item if the box was constructed from the provided + non - empty array or vector. + +2005-02-27 Roman Kennke <roman@ontographics.com> + + * javax/swing/plaf/basic/BasicListUI: + fixed modifiers of several fields, methods and inner + classes to match the 'spec'. + (getMaximumSize): removed. It's not in the spec and the + implementations was superfluous. + +2005-02-27 Chris Burdess <dog@gnu.org> + + * gnu/java/net/protocol/file/Connection.java: Return correct content + length for directory listing. + * java/net/URLClassLoader.java: Correction for URLClassLoader, bug + #11285: return valid URLs for directories. + +2005-02-27 Chris Burdess <dog@gnu.org> + + * gnu/xml/aelfred2/JAXPFactory.java, + gnu/xml/aelfred2/SAXDriver.java, + gnu/xml/aelfred2/XmlParser.java, + gnu/xml/aelfred2/XmlReader.java: Applied GNU Classpath source code + formatting conventions. Replaced arrays of Object with struct-like + classes for easier maintainability. Made SAXDriver.stringInterning + package private to allow access from XmlParser inside the loop without + a method call overhead. + +2005-02-27 Roman Kennke <roman@ontographics.com> + + * javax/swing/plaf/basic/BasicListUI: + make BasicListUI capable of wrapping lists + (layoutOrientation property of javax.swing.JList) + +2005-02-26 Audrius Meskauskas <audriusa@bluewin.ch> + + * javax/swing/Timer.java: documenting and some + formatting. + +2005-02-26 Audrius Meskauskas <audriusa@bluewin.ch> + + * javax/swing/JTextArea.java (replaceRange): + Fixing doc.remove(start, length) misinterpretation. + +2005-02-26 Roman Kennke <roman@ontographics.com> + + * javax/swing/plaf/basic/BasicListUI + (updateLayoutState,paint): make BasicListUI aware of the + width of the rendered JList + +2005-02-25 Mark Wielaard <mark@klomp.org> + + * NEWS: Add 0.14 release date. + * configure.ac: Set version to 0.14. + +2005-02-25 Sven de Marothy <sven@physto.se> + + * java/net/InetAddress.java + (toString): Don't print empty hostnames. + Fixes bug #11956 + +2005-02-24 Mark Wielaard <mark@klomp.org> + + * doc/www.gnu.org/Makefile (SUBDIRS): Add cp-tools. + * doc/www.gnu.org/cp-tools/Makefile: New file. + * doc/www.gnu.org/cp-tools/cp-tools.wml: Likewise. + * doc/www.gnu.org/cp-tools/texidoclet.html: Likewise. + +2005-02-24 Audrius Meskauskas <audriusa@bluewin.ch> + + * javax/swing/Timer.java (constructor): assigning initialDelay + +2005-02-24 Audrius Meskauskas <audriusa@bluewin.ch> + + * javax/swing/Timer.java (Waker.run): firing the first action + event. + +2005-02-24 Chris Burdess <dog@gnu.org> + + * BASE64.java: Truncate encoded byte array. + +2005-02-24 David Gilbert <david.gilbert@object-refinery.com> + + * java/awt/font/TextAttribute.java: changed names to lower case; + (readResolve): implemented. + Added doc comments all over. + +2005-02-22 Andrew John Hughes <gnu_andrew@member.fsf.org> + + * java/text/SimpleDateFormat.java: + Substitute StringBuilder for the original + StringBuffer. + +2005-02-22 Michael Koch <konqueror@gmx.de> + + * gnu/java/security/PolicyFile.java, + gnu/java/security/pkcs/PKCS7SignedData.java, + gnu/java/security/pkcs/SignerInfo.java: + Fixed copyright header. + +2005-02-22 Roman Kennke <roman@ontographics.com> + + * javax/swing/plaf/basic/BasicLookAndFeel.java + (initComponentDefaults): Fixed Button left and right margin + +2005-02-22 Thomas Fitzsimmons <fitzsim@redhat.com> + + * native/jni/gtk-peer/gthread-jni.c (throw): + Call g_snprintf instead of snprintf. + +2005-02-22 Thomas Fitzsimmons <fitzsim@redhat.com> + + * native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c + (button_to_awt_mods): Return BUTTON masks, not BUTTON_DOWN masks. + +2005-02-22 Thomas Fitzsimmons <fitzsim@redhat.com> + + * gnu/java/awt/peer/gtk/GtkWindowPeer.java, + jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c + (getWidth): New method. + (getHeight): Likewise. + (create): Remove width, height and insets parameters. Move size + setup ... + (realize_cb): ... here. New function. + (connectSignals): Connect realize_cb. + (request_frame_extents): Remove FIXME. Move + postInsetsChangedEvent lookup ... + * jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c (gtkInit): + ... here. Look up GtkWindowPeer getWidth and getHeight methods. + * jni/gtk-peer/gtkpeer.h (postInsetsChangedEventID): Declare + jmethodID. + (windowGetWidthID): Likewise. + (windowGetHeightID): Likewise. + +2005-02-22 Michael Koch <konqueror@gmx.de> + + * include/gnu_java_awt_peer_gtk_GtkWindowPeer.h: + Regenerated. + +2005-02-22 Thomas Fitzsimmons <fitzsim@redhat.com> + + * java/awt/Robot.java (waitForIdle): Call invokeAndWait on an + empty Runnable. + +2005-02-21 Bryce McKinlay <mckinlay@redhat.com> + + * java/io/ObjectInputStream.java (readClassDescriptor): Cache result + of currentLoader() in callersClassLoader field. Check for primitive + type Class names if resolveClass throws a ClassNotFoundException. + (resolveClass): Call currentLoader() only if callersClassLoader is + not set. Cache result of currentLoader(). Don't check for primitive + type Class names here. + (callersClassLoader): New field. + * java/io/ObjectOutputStream.java (writeObject, callWriteMethod): + Whitespace fixes. + +2005-02-22 Robert Schuster <thebohemian@gmx.net> + + * java/io/InputStreamReader.java: Fixed compilation + problem. + +2005-02-21 Michael Koch <konqueror@gmx.de> + + * java/awt/Checkbox.java + (next_checkbox_number): New static variable. + (generateName): New method. + (getUniqueLong): Likewise. + * java/awt/Window.java + (next_window_number): New static variable. + (generateName): New method. + (getUniqueLong): Likewise. + +2005-02-21 Mark Wielaard <mark@klomp.org> + + * java/util/jar/JarFile.java (verifyHashes): Check whether ZipEntry + exists. + +2005-02-21 Robert Schuster <thebohemian@gmx.net> + + * gnu/java/nio/ChannelReader: Fixed comments. + +2005-02-21 Robert Schuster <thebohemian@gmx.net> + + * java/nio/channels/Channels: Added FIXMEs about + stub method implementation. + (newReader): Implemented. + * java/io/InputStreamReader: + (InputStreamReader(InputStream, Charset)): Implemented. + (InputStreamReader(InputStream, CharsetDecoder)): Implemented. + * gnu/java/nio/ChannelReader: New class. + +2005-02-21 Michael Koch <konqueror@gmx.de> + + * include/gnu_java_nio_channels_FileChannelImpl.h: + Regenerated. + +2005-02-21 Michael Koch <konqueror@gmx.de> + + * java/lang/Class.java, + java/lang/SecurityManager.java, + java/net/URL.java: + Formatting cleanups. + +2005-02-21 Michael Koch <konqueror@gmx.de> + + * java/awt/Button.java, + java/awt/Container.java, + java/awt/Font.java, + java/awt/Frame.java, + java/text/CollationElementIterator.java, + java/text/RuleBasedCollator.java, + java/util/PropertyPermission.java: + Fixed formatting issues all over. + +2005-02-21 Anthony Green <green@redhat.com> + + * gnu/java/rmi/registry/RegistryImpl.java: + Change year for '--version' to 2005. + 2005-02-20 Andrew John Hughes <gnu_andrew@member.fsf.org> * java/io/Closeable.java: Documented. @@ -1,17 +1,21 @@ -New in release 0.14 +New in release 0.14 (Feb 25, 2005) * Character encoders and decoders have been added for: iso-8859-6 (arabic), iso-8859-7 (greek), iso-8859-8 (hebrew), iso-8859-9 (latin-5), iso-8859-13, iso-8859-15 (latin-9), cp1047 (ebcdic), ebcdic-xml-us,ascii, windows-1250, windows-1252, UTF-16BE (Big Endian), UTF-16LE (Little Endian), UTF-32BE (Big Endian), UTF-32LE (Little Endian). +* Full documentation for all classes can be generated (again) by using + the --with-gjdoc configure option. +* javax.awt.imageio support through gdkpixbuf. + +Runtime interface changes: + * VMSecurityManager has been replaced by gnu.classpath.VMStackWalker. currentClassLoader() is no longer needed, and there are also two new methods with non-native implementations. VM implementors are encouraged to provide more efficient versions. * VMRuntime.nativeLoad() now takes an additional ClassLoader parameter. -* Full documentation for all classes can be generated (again) by using - the --with-gjdoc configure option. New in release 0.13 (Jan 6, 2005) diff --git a/configure.ac b/configure.ac index 0d0aaf926..dd3c49f7d 100644 --- a/configure.ac +++ b/configure.ac @@ -6,7 +6,7 @@ dnl ----------------------------------------------------------- dnl define([AC_CACHE_LOAD], )dnl dnl define([AC_CACHE_SAVE], )dnl -AC_INIT([GNU Classpath],[0.13+cvs],[classpath@gnu.org],[classpath]) +AC_INIT([GNU Classpath],[0.14],[classpath@gnu.org],[classpath]) AC_CONFIG_SRCDIR(java/lang/System.java) AC_CANONICAL_TARGET diff --git a/doc/api/Makefile.am b/doc/api/Makefile.am index 3cdf04a6a..8ec875806 100644 --- a/doc/api/Makefile.am +++ b/doc/api/Makefile.am @@ -30,7 +30,7 @@ uninstall-local: html: create_html clean: - -rm -rf html create_html + -rm -rf html create_html gjdoc_rawcomment.cache create_html: -$(MKDIR) html > /dev/null 2>&1 diff --git a/doc/hacking.texinfo b/doc/hacking.texinfo index f9cddd6f7..90bd86b07 100644 --- a/doc/hacking.texinfo +++ b/doc/hacking.texinfo @@ -501,7 +501,20 @@ conventions): @item If possible, generate specific imports (expand) over java.io.* type -imports. Order by gnu, java, javax, org. +imports. Order by gnu, java, javax, org. There must be one blank line +between each group. The imports themselves are ordered alphabetically by +package name. Classes and interfaces occur before sub-packages. The +classes/interfaces are then also sorted alphabetical. Note that uppercase +characters occur before lowercase characters. + +@example +import gnu.java.awt.EmbeddedWindow; + +import java.io.IOException; +import java.io.InputStream; + +import javax.swing.JFrame; +@end example @item Blank line after package statement, last import statement, classes, diff --git a/doc/www.gnu.org/Makefile b/doc/www.gnu.org/Makefile index 7556f182e..2724a1810 100644 --- a/doc/www.gnu.org/Makefile +++ b/doc/www.gnu.org/Makefile @@ -1,4 +1,4 @@ -SUBDIRS := announce downloads docs faq events +SUBDIRS := announce downloads docs faq events cp-tools ifndef WMK export WMK=wmk diff --git a/doc/www.gnu.org/cp-tools/Makefile b/doc/www.gnu.org/cp-tools/Makefile new file mode 100644 index 000000000..93ec48c62 --- /dev/null +++ b/doc/www.gnu.org/cp-tools/Makefile @@ -0,0 +1,32 @@ +ifndef WMK + export WMK=wmk +endif +ifndef WML + export WML=wml +endif + +WML_SRC = $(wildcard *.wml) +WML_OBJS = $(patsubst %.wml,%.html,$(WML_SRC)) + +%.html: %.wml ../include/macros.wml ../include/layout.wml + $(WML) -o $@ $< +# -rm -f $(patsubst %.wml,%.html,$<) + +all : $(WML_OBJS) subdirs + +.PHONY : clean +clean : + $(foreach dir, $(SUBDIRS), sh -c "cd $(dir) && $(MAKE) clean";) + -rm -f *.html + +.PHONY : subdirs +subdirs : + $(foreach dir, $(SUBDIRS), sh -c "cd $(dir) && $(MAKE)";) + +.PHONY : publish +publish : + @sh -c "if [ "$(CLASSPATH_WEBROOT)x" = x ]; then echo 'You must set CLASSPATH_WEBROOT in your environment first'; exit 1; fi" + @sh -c "if [ ! -d $(CLASSPATH_WEBROOT) ]; then echo 'You must set CLASSPATH_WEBROOT in your environment first'; exit 1; fi" + $(foreach dir, $(SUBDIRS), sh -c "cd $(dir) && $(MAKE) publish";) + -cp -f *.html $(CLASSPATH_WEBROOT)/cp-tools/ + diff --git a/doc/www.gnu.org/cp-tools/cp-tools.wml b/doc/www.gnu.org/cp-tools/cp-tools.wml new file mode 100755 index 000000000..902544fbe --- /dev/null +++ b/doc/www.gnu.org/cp-tools/cp-tools.wml @@ -0,0 +1,59 @@ +#!wml --include=..
+
+#include "include/layout.wml"
+
+<set-var last-modified-author="mjw">
+<subject "GNU Classpath Tools">
+
+<box>
+<boxtitle><a name="Tools">GNU Classpath::Tools</a></boxtitle>
+<boxitem>
+GNU Classpath Tools is a collection of tools for programmers using the
+GNU Classpath library including a byte code disassembler, a JNI C header
+file generator, serial version uid calculator, character converter, remote
+method invocation tools and a documentation generation framework for java
+source files. Plus tools specific to GNU Classpath development for generating
+locale, currency and timezone information.
+</boxitem>
+</box>
+
+<box>
+<boxtitle><a name="Programs">GNU Classpath::Tools::Programs</a></boxtitle>
+<boxitem>
+GNU Classpath Tools contains the following tools. Some have their own
+page describing them in more detail:
+<ul>
+<li><b>gjdoc</b>
+ A documentation generation framework for java source files.</li>
+<li><b><createlink url="cp-tools/texidoclet.html" name="texidoclet"/></b>
+ A "doclet" for converting comments into GNU TexInfo source.</li>
+<li>RMI tools such as rmic and rmiregistry.</li>
+<li>Miscellaneous tools such as javap, javah, serialver and native2ascii/</a>
+<li>GNU Classpath specific tools localgen and currencygen.</li>
+</lu>
+</boxitem>
+</box>
+
+<box>
+<boxtitle><a name="Development">GNU Classpath::Tools::Development</a></boxtitle>
+<boxitem>
+GNU Classpath Tools is part of the GNU Classpath project which is hosted at
+Savannah. The project page is
+<createlink url="http://savannah.gnu.org/projects/classpath/"/>.
+From there you can submit bug reports, check the latest news, find tasks
+yet to be done, and most importantly submit patches!
+<p>
+There is one general discussion list for Classpath-tools. You may
+<createlink url="" name="subscribe"/> to the mailing list via the web.
+However, you may also just send an email message with a subject of "subscribe"
+to <createlink url="mailto:cp-tools-discuss-request@gnu.org"/>.
+You may <createlink url="" name="unsubscribe"/> from the mailing list via the
+web as well.
+</boxitem>
+
+<boxtitle><a name="License">GNU Classpath::Tools::Distribution Terms</a></boxtitle>
+<boxitem>
+All GNU Classpath Tools are distributed under the terms of the
+<createlink url="/copyleft/gpl.html" name="GNU General Public License">.
+</boxitem>
+</box>
diff --git a/doc/www.gnu.org/cp-tools/texidoclet.html b/doc/www.gnu.org/cp-tools/texidoclet.html new file mode 100644 index 000000000..5f772d251 --- /dev/null +++ b/doc/www.gnu.org/cp-tools/texidoclet.html @@ -0,0 +1,597 @@ +<!DOCTYPE html PUBLIC "-//IETF//DTD HTML 2.0//EN"> +<HTML> +<HEAD> +<TITLE>GNU texidoclet - GNU Project - Free Software Foundation (FSF)</TITLE> +<A HREF=""></A> +</HEAD> +<BODY BGCOLOR="#ffffff" TEXT="#000000" LINK="#1F00FF" ALINK="#FF0000" VLINK="#9900DD"> +<H1>GNU texidoclet</H1> + +<h2>Table Of Contents</h2> +<ol> + </li><li><a href="#Introduction">Introduction</a> + + <ul> + <li><a href="#whatis">What is TexiDoclet?</a> + </li><li><a href="#whyuse">Why use the info format?</a> + </li><li><a href="#howstart">How do I get started?</a> + </li></ul> + + </li><li><a href="#Requirements">Requirements</a> + + </li><li><a href="#Download">Download</a> + + </li><li><a href="#Installation">Installation</a> + + </li><li><a href="#configure">Configure</a> + + </li><li><a href="#Usage">Usage</a> + </li><li><a href="#Bugs">BUGS</a> + </li><li><a href="#History">History</a> + </li><li><a href="#Todo">TODO</a> + </li> +</ol> + +<hr> + +<a name="Introduction"></a> <h2>1. Introduction</h2> + +<h3><a name="whatis"></a>What is GNU TexiDoclet?</h3> + +GNU TexiDoclet is a system for creating <b>info</b> pages from Java +source documentation. It is part of the <a +href="/software/classpath/">GNU Classpath</a> project, however it can +also be used as standalone doclet used with any Java-compatible +platform. + +<p>You can use TexiDoclet to create API documentation in <b>info</b> +format for any set of Java packages (including classpath). The latter +will reproduce the full Java API documentation for use on text-only +displays, or for integrating it into the GNU Emacs online help +facility. </p><p>TexiDoclet also includes an Elisp package which adds +context-sensitive help features to GNU Emacs. +</p> + +<table bgcolor="#cccccc" border="0" cols="1" width="100%"> + <tbody> + <tr> + <td><b>Note:</b> This is alpha software. You should not use + TexiDoclet in a production environment, because it has not yet + been tested for reliability. Also, see <a href="#Bugs">Bugs</a> + for a list of currently missing + features.</td></tr></tbody></table> <h3><a name="whyuse"></a>Why + use the <b>info</b> format?</h3>Although the <b>info</b> format + is raw text with nearly no formatting or highlighting, using the + <b>info</b> version of the Java API documentation can have a + number of advantages even on graphical displays - especially if + you are using GNU Emacs: + +<ul> + <li>Because it is text-only, <b>info</b> is pretty fast. + </li><li>You can easily navigate through <b>info</b> pages using only the keyboard + - which doesn't hold true for most HTML browsers available today, where you + always have to grab the mouse or tab the focus. + </li><li>You can use all the powerful Emacs facilities to browse the documentation + (e.g. incremental search, regular expressions, bookmarks). + </li><li>You can copy documentation fragments (like the definition of a method you + want to overload) easily using the keyboard, again having all Emacs facilities + right at hand, such as the ring buffer. + </li><li>You have no frames in <b>info</b>, but you can use the Speedbar contained + in recent Emacs distributions for the same purpose [not tested as yet]. + </li></ul> + +<h3><a name="howstart"></a>How do I get started?</h3> +<ul> + <li>Check the <a href="#Requirements">Requirements</a> + section and download/install any missing tools. + </li><li><a href="#Download">Download</a> + and <a href="#Installation">unpack</a> + the TexiDoclet package. + </li><li>See section <a href="#configure">Configure</a> + for further instructions. </li></ul> + +<h3>Thanks!</h3> +<p>TexiDoclet was originally written as a standalone doclet by <a +href="http://savannah.gnu.org/users/julian/">Julian Scheid</a> and was +contributed to the GNU Project as part of GNU Classpath.</a> +</p> + + +<hr> + +<a name="Requirements"></a> + +<h2>2. Requirements</h2>In order to use TexiDoclet, you need the +following software installed: + +<ul> + <li>A Java platform 1.2 or better. The intention is to be able have + TexiDoclet work first and foremost with <a + href="/software/classpath/">GNU Classpath</a> and other completely + free toolchains (<em>with <a href="gjdoc.en.html">gjdoc</a> we are + 99% there!</em>) although it can be used with non-free VMs.</li> + + <li>GNU Make and GNU makeinfo. Note: makeinfo is contained in the GNU + texinfo package. </li> + + <li>A Unix environment: + <ul> + <li><tt>bash</tt> and the standard commands like <tt>cp</tt> are essential + </li><li><tt>which</tt> and <tt>awk</tt> are required for checking the setup + </li><li><tt>gzip</tt> is used to compress the <b>info</b> pages. </li> + </ul> + +<!-- + </li><li>The Java Community source code, if you want to reproduce + documentation for the Java core API. <strong>Note: this is + <em>not</em> distributed with TexiDoclet because it is released + under a non-free software license, the SCSL, which is incompatible + with the GNU GPL. If you wish to create the Java API documentation + you must download and agree to it's terms (we cannot do + this).</strong></li> +--> + + </ul> + + Makeinfo is required to convert the texinfo source into the + <b>info</b> format. If you only need the texinfo source, you don't + need makeinfo. Unix users will probably find a makeinfo preinstalled + on their system. Windows users can find free precompiled binaries + on the Internet (look for the Texinfo package). <br> + +<table bgcolor="#cccccc" border="0" cols="1" width="100%"> + <tbody> + <tr> + <td><b>Note:</b> There are some 16-bit makeinfo binaries available online, + but they won't work. You need to look for an up-to-date 32-bit + binary.</td></tr></tbody> +</table> + +<p>GNU Make is required because if you want to generate the full +standard Java API documentation, each package must be processed +individually. The Makefile works with patterns to process the packages +individually and merge the results.</p> + +<p>Again, Unix users will find Make preinstalled. Windows users can +find precompiled binaries on the Internet for free. <br> +</p> + +<table bgcolor="#cccccc" border="0" cols="1" width="100%"> + <tbody> + <tr> + <td><b>Note:</b> Use only GNU Make - you will probably get into + trouble if you try to use a different Make tool, because the + TexiDoclet Makefile uses some GNU-specific + features.</td></tr> + </tbody> +</table> + +<!-- +<p>You need the Java community source code if you want to reproduce the full +core API documentation. Get it from <a href="http://developer.java.sun.com/">Sun's Java Developer Website</a>. Having +the source at hand is generally recommended. <br> +</p> +--> + +<table bgcolor="#cccccc" border="0" cols="1" width="100%"> + <tbody> + <tr> + <td><b>Tip:</b> Configuring TexiDoclet is much easier if you make sure + that all utilities (including the Java tools) are on your system search + path.</td></tr></tbody></table> + +<p> +TexiDoclet has been tested on the following systems: +</p><p> + +</p><table border="1" cols="3" width="100%"> + <tbody> + <tr> + <td><b>Operating System</b></td> + <td><b>JDK</b></td> + <td><b>Other</b></td></tr> + +<!-- Windows untested at the moment + <tr> + <td>Windows 98</td> + <td>Sun JDK 1.3 RC2</td> + <td>Cygwin B-20 (GNU bash 2.02.1) <br>GNU Make 3.78.1 <br>GNU makeinfo + 1.68 (GNU texinfo 3.12) <br>GNU Emacs 20.6.1</td> + </tr> +--> + <tr> + <td>Linux kernel 2.2.16 on Intel / Red Hat 7.0 distribution</td> + <td>Sun JDK 1.2.2</td> + + <td>GNU bash 2.04.11 <br>GNU Make 3.79.1 <br>GNU makeinfo 4.0 + <br>GNU Emacs 20.3.1</td></tr> + + <tr> + <td>Linux kernel 2.2.9-27mdk / Mandrake distribution + <em>(thanks to Owen Lydiard for the report)</em></td> + <td>JDK 1.3</td> + <td> GNU make 3.77<br> + makeinfo (GNU texinfo) 4.0<br> + GNU Emacs 20.3.1</td> + </tr> + + <tr> + + <td colspan="3">As of the date of this document, no other + configurations have been tested. If you install TexiDoclet on a + different system, be it successful or not, please contact the <a + href="http://savannah.gnu.org/project/memberlist.php?group_id=508">developers</a> + so that this list can be extended.</td></tr></tbody> +</table> + + +<h3>3.1 Tool download locations for Windows users [untested]</h3> + +<p>Although the present version of TexiDoclet has not been tested on +Windows, a previous incarnation was working using the following: +Windows 98 / Sun JDK 1.3 RC2 / Cygwin B-20 (GNU bash 2.02.1) / GNU +Make 3.78.1 / GNU makeinfo 1.68 (GNU texinfo 3.12) / GNU Emacs +20.6.1</p> + +<p>Here are a few URLs for getting the Windows ports of the required +software:</p> + +<ul> +<li><a href="http://sourceware.cygnus.com/cygwin/">The Cygwin project</a> offers the most + sophisticated port of Unix utilities for free download. Their "full" package + includes a Bash and a full-featured Unix environment (including <tt>grep</tt>, <tt>less</tt>, <tt>awk</tt> and other + useful commands.) With regard to TexiDoclet, only GNU <tt>make</tt> and <tt>makeinfo</tt> + are missing. + +</li><li><a href="http://www.tertius.com/projects/library/#cygwin32">tertius.com</a> contains a + link to a Windows port of the texinfo package, + including the required <tt>makeinfo</tt> tool. It also includes a standalone <b>info</b> viewer. + +</li> + +<li>Refer to the <a +href="http://www.gnu.org/software/make/make.html">GNU Make +homepage</a> and to <a +href="http://ftp.gnu.org/pub/gnu/">http://ftp.gnu.org</a> for +downloading the GNU Make binaries for Windows. </li></ul> + +<hr> + +<a name="Download"></a> + +<a name="Download"> +<h2>3. Download</a></h2> + +The old (pre-GNU) version of TexiDoclet is still located at our old +development site on sourceforge and is available from <a +href="http://sourceforge.net/project/showfiles.php?group_id=7984">SourceForge</a>. +This (old) 0.5 version is provided purely as a convenience, and will +soon be replaced by a new version . Subsequent releases will be made +available at via the GNU ftp site (<a +href="http://ftp.gnu.org/pub/gnu/">http://ftp.gnu.org/pub/gnu/).</a> + +<p>The package includes an autoconfiguration system, the full source +code, and additional Emacs add-ons. It unpacks into a separate +directory named "<tt>texidoclet-(version)</tt>". </p> + +<p>If you want to take a look at TexiDoclet's output first, here is a +<a +href="http://texidoclet.sf.net/texidoclet-api-info-0.5.tar.gz">sample +(32 K gzipped tar)</a>. It's the converted `info' docs for the +TexiDoclet API (please note that the package name +<tt>gnu.texidoclet</tt> is now obsoleted by +<tt>gnu.classpath.tools.doclets.texidoclet</tt>) itself. [To view run +the standalone <tt>info</tt> viewer: <tt>info -f +texidoclet.info</tt>.] +</p> + +<hr> + +<a name="Installation"></a> + +<h2>4. Installation</h2> + + +<p><strong>Please note the following instructions relate purely to the +old 0.5 version of GNU texidoclet, which is currently the only +release</strong></p> + +<p>In order to install TexiDoclet, you should unpack it to a location +of your choice. TexiDoclet will unpack into a separate subdirectory, +which contains the following files and directories:</p> + +<table> + <tbody> + <tr> + <td><tt>Makefile </tt></td> + <td></td> + <td>the TexiDoclet main Makefile.</td></tr> + <tr> + <td><tt>COPYING </tt></td> + <td> </td> + <td>the GNU public license (Version 2)</td></tr> + <tr> + <td><tt>etc/ </tt></td> <td></td> + + <td>contains Makefile template for generating the docs for Sun's + code.</td></tr> + <tr> + <td><tt>lisp/ </tt></td> + <td></td> + <td>contains add-ons for enabling context-sensitive help in Emacs.</td></tr> + <tr> + <td><tt>source/ </tt></td> + <td></td> + <td>contains the full Java source code for TexiDoclet</td></tr> +</tbody></table> + +<p>After you have unpacked the archive, you should configure TexiDoclet as +described in the following section, <a href="#configure">Configure</a>.</p> + +<hr> + +<a name="configure"></a> + +<h2>6. Configure</h2> + +<p><strong>Please note the following instructions relate purely to the +old 0.5 version of GNU texidoclet, which is currently the only +release</strong></p> + +[Taken from the <tt>README</tt> file in the distribution] + +<pre> +Installation: +============ + +1. The usual GNU autoconf procedure applies: + + ./configure + make + + Read the generic INSTALL file for the details. + +2. Extra texidoclet-specific options for `configure': + + `--with-jdkdir=DIR' + + DIR specifies the location of the JDK (if it's not on the PATH) + + `--with-javadocjar=FILE' + + Use FILE as jar file with javadoc support. + +3. This will generate the jar file in source/TexiDoclet.jar. You can + choose to run "make install" at this point, although this is not, + strictly speaking, necessary. + +4. To see an example of the invocation of TexiDoclet, type "make + check". This will build the `info' docs for texidoclet itself in + the "source" subdirectory. +</pre> + +<hr> + +<a name="Usage"></a> + +<h2>8. Usage</h2> + +<p><strong>Please note the following instructions relate purely to the +old 0.5 version of GNU texidoclet, which is currently the only +release</strong></p> + +[Taken from the <tt>README</tt> file in the distribution] + +<pre> +Usage: +===== + +1. TexiDoclet now works like any other doclet [Consult + http://java.sun.com/j2se/javadoc/ for further information on + Javadoc and the Javadoc API], it can be invoked with default + options by merely supplying the path the doclet and the doclet + invocation class (which is `gnu.texidoclet.Driver'): + +javadoc -docletpath TexiDoclet.jar -doclet gnu.texidoclet.Driver <filename> ... + +2. It also accepts all the Standard Sun doclet options, in addition + to some TexiDoclet-specific ones, which are listed if you invoke + javadoc without any Java source files or packages. Here are those + options: + +-d <directory> Destination directory for output files +-tocbase <base> Prefix for all package-level texi files (default 'packages' +-indexbase <base> Prefix for package index +-allclassesbase <base> Prefix for all class list +-treebase <base> Prefix for tree output +-etagsname <base> Prefix for package etags +-tocheader <text> Header for each texi file +-tocfooter <text> Footer for each texi file +-copyrightnotice <text> Copyright information on each texi page +-wordwrappos <chars> Number of columns at which to wrap +-firstlineindent <chars> Number of columns to indent +-includeauthor Include author information? +-fulltreealignment <type> 'replace' or null +-heritagealignment <type> 'replace' or null + + Most of these options are self-explanatory and all have + `reasonable' defaults, and are in the process of being more fully + documented. + +3. To generate the `info' documentation, invoke `makeinfo' on the + resultant `.texi' file. See the documentation accompanying your + texinfo installation for more details. [Note you can use texinfo + to also generate printed and HTML documentation from the `.texi' + files, but note that there are more specialised doclets for that + purpose]. +</pre> + +<hr> + +<a name="Bugs"></a> + +<h2>7. Bugs</h2> + +<p><strong>Please note the following instructions relate purely to the +old 0.5 version of GNU texidoclet, which is currently the only +release</strong></p> + +[Taken from <tt>BUGS</tt> in the distribution] + +<pre>Known Bugs, or "features not yet implemented", in roughly the order +they will be attacked. New versions of this software implementing all +or part of the missing features can be expected soon. + +* No cross-links for parameter types, return types, and thrown exceptions. + +* No support for {@link}. + +* Not very configurable at the time. + +* Various small improvements on Info page layout pending. + +* Elisp scripts for context sensitive help are preliminary. (Can + anyone help me out here? I am new to Lisp and would need some + advice.) + +* Autoconf support for the Cygnus environment (simply untested at the + moment).</pre> + +<hr> + +<a name="History"></a> + +<h2>8. History</h2> + + [Taken from <tt>NEWS</tt> in the distribution] + +<pre> + +2002-01-24 -- CVS + +* now a GNU project (part of classpath) +* all copyright changed to FSF. +* distribution now based at http://savannah.gnu.org/projects/cp-tools/ + +2001-04-02 -- 0.5 + +* complete overhaul of distribution +* distribution now based at SourceForge. +* rewrote Makefile system to use GNU automake/autoconf +* added a new Driver class to generate the .texi in one pass + +2000.04.02 -- 0.4.1 + +* features full information - all documentation nodes are implemented +* added "implements" information +* added post-processing to include information about derived and + implementing classes. +* removed self-reference in heritage tree +* improved node reference formatting ("(package) class" instead of + "(package)class") +* added switch to control inclusion of author information +* added caption to index, all classes, and full tree node +* added "abstract" keyword and class prototype to class node +* added serialization node +* added ability to split the full index into 27 parts (A-Z|_) + (not configurable yet) + +2000.04.01 -- 0.3.3 + +* index is now sorted case-insensitive +* major revision of configuration file structure +* added preliminary version of inherited fields and methods +* took preparations for adding derivation information after generating + the texi files. + +2000.04.01 -- 0.3.2 + +* improved front page layout +* added copyright messages as requested by Sun Microsystems Inc. so + that the core API docs +* can be distributed in converted format. +* removed heritage chart from interfaces +* added "extends" line to class node +* added @author tag to all nodes + +2000.03.30 -- 0.3.1 + +* added Interfaces, Exceptions and Errors to package node +* fixed bug: bad layout when HTML paragraph ends with <br> +* added @deprecated and @since info to all nodes +* added support for multiple source paths + +2000.03.29 -- 0.2.1 + +* fixed bug: class node only displayed first description line. +* added @since tag for all nodes. +* fixed bug: generated text displayed bogus texi tags. +* corrected/finished full tree layout. +* fixed bug: field prototype was missing. +* <sup> is now translated to ^ (caret) for denoting powers. +* Method listing in class node is now sorted. +* added "see also" for classes + +2000.03.28 -- 0.1.2 + +* Source code structure significantly improved. +* added "all classes", full index, and full tree. +* added preliminary emacs .el-script for context-sensitive help. + +2000.03.27 -- 0.1.1 + +* Initial non-public pre-alpha release. +</pre> + +<hr> + +<a name="Todo"></a> + +<h2>9. TODO</h2> + +[Taken from <tt>TODO</tt> in distribution] + +<pre> +* Check bug list. + +* Improve source code documentation and this page. + +* Check Speedbar compatibility. + +* Look for a way to add a link to the corresponding Java source code + into all Info nodes. + +* Same for original HTML documentation (using browse-url) + +* Perhaps integrate XML/XSL support when it becomes part of the Java + standard. Currently, the user would have had to download a package + of some MB and install it, if an XML library would have been + employed for TexiDoclet. +</pre> + +<BR> +<HR> + +Return to <A HREF="/home.html">GNU's home page</A>. +<P> +Please send FSF & GNU inquiries & questions to +<A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>. +There are also <A HREF="/home.html#ContactInfo">other ways to +contact</A> the FSF. +<P> +Please send comments on these web pages to +<A HREF="mailto:webmasters@www.gnu.org"><EM>webmasters@www.gnu.org</EM></A>, +send other questions to +<A HREF="mailto:gnu@gnu.org"><EM>gnu@gnu.org</EM></A>. +<P> +Copyright (C) 1999 Free Software Foundation, Inc., +59 Temple Place - Suite 330, Boston, MA 02111, USA +<P> +Verbatim copying and distribution of this entire article is +permitted in any medium, provided this notice is preserved.<P> +Updated: + +$Date: 2005-03-13 14:38:24 $ by $Author: gnu_andrew $ +<HR> +</BODY> +</HTML> diff --git a/doc/www.gnu.org/events/escape_fosdem05.wml b/doc/www.gnu.org/events/escape_fosdem05.wml index c097ecd78..b90067339 100644 --- a/doc/www.gnu.org/events/escape_fosdem05.wml +++ b/doc/www.gnu.org/events/escape_fosdem05.wml @@ -11,6 +11,8 @@ <i>Fosdem, Saturday/Sunday 26/27 February 2005, Brussels, Belgium</i> <p> +<b>UPDATE: Presentations are now linked below!</b> +<p> The Fosdem organisation has generously offered the developers of various projects around GNU classpath the opportunity to meet face to face in their own developer room. @@ -47,18 +49,21 @@ href="http://www.fosdem.org/2005/index/dev_room_classpath/schedule">http://www.f learn from and work together with others? </p> <p> - <b>14:00 - 14:50</b> <i>Jeroen Frijters</i> IKVM.NET -- Motivation and Architecture. + <b>14:00 - 14:50</b> <i>Jeroen Frijters</i> + <a href="http://www.frijters.net/fosdem2005.sxi">IKVM.NET -- Motivation and Architecture</a> (sxi) </p> <p> - <b>15:00 - 15:50</b> <i>Leo Simons</i> Apache Gump -- Continuous integration on steroids + <b>15:00 - 15:50</b> <i>Leo Simons</i> + <a href="http://www.apache.org/~leosimons/presentations/fosdem2005/gump@fosdem.pdf">Apache Gump -- Continuous integration on steroids</a> (pdf) </p> <p> - <b>16:00 - 16:50</b> <i>Jeffrey Morgan</i> Liberation through Binding! -- Using java-gnome to build desktop applications. + <b>16:00 - 16:50</b> <i>Jeffrey Morgan</i> + <a href="http://java-gnome.sourceforge.net/presentations/fosdem05/img0.html">Liberation through Binding! -- Using java-gnome to build desktop applications</a> (html) </p> <p> - <b>17:00 - 17:30</b> <i>Christian Thalinger</i> CACAO - -- From the fastest JIT to a JVM + <b>17:00 - 17:30</b> <i>Christian Thalinger</i> + <a href="http://www.complang.tuwien.ac.at/cacaojvm/papers/fosdem2005.ps">CACAO -- From the fastest JIT to a JVM</a> (ps) </p> <p> </boxitem> @@ -71,18 +76,19 @@ href="http://www.fosdem.org/2005/index/dev_room_classpath/schedule">http://www.f </p> <p> <b>10:00 - 10:50</b> - <i>Thomas Fitzsimmons</i> Free AWT and Swing - -- The GUI parts of GNU Classpath. + <i>Thomas Fitzsimmons</i> + <a href="http://people.redhat.com/fitzsim/fosdem-2005/html/fosdem-2005-presentation.html">Free AWT and Swing -- The GUI parts of GNU Classpath</a> (html) + (<a href="http://people.redhat.com/fitzsim/fosdem-2005/fosdem-2005-presentation.sxi">sxi</a>) </p> <p> <b>11:00 - 11:50</b> - <i>Tom Tromey</i> GCJX - -- Writing a new GCC front end. + <i>Tom Tromey</i> + <a href="http://www.peakpeak.com/~tromey/fosdem-2005.sxi">GCJX -- Writing a new GCC front end</a> (sxi) </p> <p> <b>12:00 - 12:50</b> - <i>Dalibor Topic</i> Kaffe - -- Past, Present and Future. + <i>Dalibor Topic</i> + Kaffe -- Past, Present and Future. </p> <p> <boxitem> diff --git a/examples/gnu/classpath/examples/swing/Demo.java b/examples/gnu/classpath/examples/swing/Demo.java index c9edf4462..52b74a86a 100644 --- a/examples/gnu/classpath/examples/swing/Demo.java +++ b/examples/gnu/classpath/examples/swing/Demo.java @@ -626,7 +626,11 @@ public class Demo { final DefaultListModel mod = new DefaultListModel(); final JList list1 = new JList(mod); + list1.setLayoutOrientation(JList.VERTICAL_WRAP); + list1.setVisibleRowCount(4); final JList list2 = new JList(mod); + list2.setLayoutOrientation(JList.VERTICAL_WRAP); + list2.setVisibleRowCount(4); list2.setSelectionModel(list1.getSelectionModel()); for (int i = 0; i < elts.length; ++i) @@ -740,7 +744,10 @@ public class Demo "this", "is", "a", - "list"}), + "list", + "that", + "wraps", + "over"}), panel); new PopUpAction("Scrollbar", diff --git a/gnu/CORBA/primitiveArrayTypeCode.java b/gnu/CORBA/primitiveArrayTypeCode.java new file mode 100644 index 000000000..b028073da --- /dev/null +++ b/gnu/CORBA/primitiveArrayTypeCode.java @@ -0,0 +1,244 @@ +/* primitiveArrayTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + + GNU Classpath 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 2, or (at your option) + any later version. + + GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. */ + + +package gnu.CORBA; + +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; + +/** + * A TypeCode for arrays. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class primitiveArrayTypeCode + extends primitiveTypeCode +{ + /** + * The array components. + */ + TypeCode of; + + /** + * The length of the array, must be updated when setting + * a new value. + */ + private int length; + + public primitiveArrayTypeCode(TCKind array_of) + { + super(TCKind.tk_sequence); + of = new primitiveTypeCode(array_of); + } + + /** + * Return the array component type. + * @return the array component type + * @throws org.omg.CORBA.TypeCodePackage.BadKind + */ + public TypeCode content_type() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + return of; + } + + /** + * Return true if the other TypeCode defines the array, having elements + * of the same type. The sizes of arrays are not taken into + * consideration. + * + * @param other the other TypeCode + * @return true if <code>other</code> is an array with the same + * component type. + */ + public boolean equal(TypeCode other) + { + try + { + return kind() == other.kind() && + content_type() == other.content_type(); + } + catch (BadKind ex) + { + // Should not be thrown. + return false; + } + } + + /** + * Returns the agreed Id in the form of + * <code>IDL:omg.org/CORBA/ {type name} Seq:1.0</code>. + * + * @return the Id of this TypeCode. + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind if the content type + * is not one of the constants, defined in {@link TCKind}. + * This package class should not be used as TypeCode for the arrays, + * holding the user defined components. + */ + public String id() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + switch (content_type().kind().value()) + { + case TCKind._tk_null : + return "IDL:omg.org/CORBA/NullSeq:1.0"; + + case TCKind._tk_void : + return "IDL:omg.org/CORBA/VoidSeq:1.0"; + + case TCKind._tk_short : + return "IDL:omg.org/CORBA/ShortSeq:1.0"; + + case TCKind._tk_long : + return "IDL:omg.org/CORBA/LongSeq:1.0"; + + case TCKind._tk_ushort : + return "IDL:omg.org/CORBA/UShortSeq:1.0"; + + case TCKind._tk_ulong : + return "IDL:omg.org/CORBA/ULongSeq:1.0"; + + case TCKind._tk_float : + return "IDL:omg.org/CORBA/FloatSeq:1.0"; + + case TCKind._tk_double : + return "IDL:omg.org/CORBA/DoubleSeq:1.0"; + + case TCKind._tk_boolean : + return "IDL:omg.org/CORBA/BooleanSeq:1.0"; + + case TCKind._tk_char : + return "IDL:omg.org/CORBA/CharSeq:1.0"; + + case TCKind._tk_octet : + return "IDL:omg.org/CORBA/OctetSeq:1.0"; + + case TCKind._tk_any : + return "IDL:omg.org/CORBA/AnySeq:1.0"; + + case TCKind._tk_TypeCode : + return "IDL:omg.org/CORBA/TypeCodeSeq:1.0"; + + case TCKind._tk_Principal : + return "IDL:omg.org/CORBA/PrincipalSeq:1.0"; + + case TCKind._tk_objref : + return "IDL:omg.org/CORBA/ObjrefSeq:1.0"; + + case TCKind._tk_struct : + return "IDL:omg.org/CORBA/StructSeq:1.0"; + + case TCKind._tk_union : + return "IDL:omg.org/CORBA/UnionSeq:1.0"; + + case TCKind._tk_enum : + return "IDL:omg.org/CORBA/EnumSeq:1.0"; + + case TCKind._tk_string : + return "IDL:omg.org/CORBA/StringSeq:1.0"; + + case TCKind._tk_sequence : + return "IDL:omg.org/CORBA/SequenceSeq:1.0"; + + case TCKind._tk_array : + return "IDL:omg.org/CORBA/ArraySeq:1.0"; + + case TCKind._tk_alias : + return "IDL:omg.org/CORBA/AliasSeq:1.0"; + + case TCKind._tk_except : + return "IDL:omg.org/CORBA/ExceptSeq:1.0"; + + case TCKind._tk_longlong : + return "IDL:omg.org/CORBA/LongLongSeq:1.0"; + + case TCKind._tk_ulonglong : + return "IDL:omg.org/CORBA/ULongLongSeq:1.0"; + + case TCKind._tk_longdouble : + return "IDL:omg.org/CORBA/LongDoubleSeq:1.0"; + + case TCKind._tk_wchar : + return "IDL:omg.org/CORBA/WCharSeq:1.0"; + + case TCKind._tk_wstring : + return "IDL:omg.org/CORBA/WStringSeq:1.0"; + + case TCKind._tk_fixed : + return "IDL:omg.org/CORBA/FixedSeq:1.0"; + + case TCKind._tk_value : + return "IDL:omg.org/CORBA/ValueSeq:1.0"; + + case TCKind._tk_value_box : + return "IDL:omg.org/CORBA/Value_boxSeq:1.0"; + + case TCKind._tk_native : + return "IDL:omg.org/CORBA/NativeSeq:1.0"; + + case TCKind._tk_abstract_interface : + return "IDL:omg.org/CORBA/Abstract_interfaceSeq:1.0"; + + default : + throw new BadKind(); + } + } + + /** + * Return the array length. + * @return the length of the array. + * @throws org.omg.CORBA.TypeCodePackage.BadKind + */ + public int length() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + return length; + } + + /** + * Sets the array length to the supplied value. + * + * @param l the new length. + */ + public void setLength(int l) + { + this.length = l; + } + +} diff --git a/gnu/CORBA/primitiveTypeCode.java b/gnu/CORBA/primitiveTypeCode.java new file mode 100644 index 000000000..e9ad67192 --- /dev/null +++ b/gnu/CORBA/primitiveTypeCode.java @@ -0,0 +1,197 @@ +/* primitiveTypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + + GNU Classpath 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 2, or (at your option) + any later version. + + GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. */ + + +package gnu.CORBA; + +import org.omg.CORBA.Any; +import org.omg.CORBA.IDLEntity; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.TCKind; +import org.omg.CORBA.TypeCode; +import org.omg.CORBA.TypeCodePackage.BadKind; + +import java.io.Serializable; + +/** + * An information about a primitive CORBA data type + * (boolean, char, wchar, octet and also signed or unsigned short, long, + * long long, float and double). + * This class only implements the methods {@link #kind() } + * and {@link equal() } that are valid for + * all TypeCode kinds. Other methods are implemented in derived + * subclasses. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class primitiveTypeCode + extends TypeCode + implements IDLEntity, Serializable +{ + /** + * The kind of this TypeCode. + */ + protected final TCKind kind; + + public primitiveTypeCode(TCKind a_kind) + { + kind = a_kind; + } + + public TypeCode concrete_base_type() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public TypeCode content_type() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public int default_index() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public TypeCode discriminator_type() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + /** + * Test two types for equality. The default implementation + * returs true of the types of the same kind. + * @param other the other type to compere with + * @return true if the types are interchangeable. + */ + public boolean equal(TypeCode other) + { + return kind() == other.kind(); + } + + public boolean equivalent(TypeCode parm1) + { + throw new NO_IMPLEMENT(); + } + + public short fixed_digits() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public short fixed_scale() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public TypeCode get_compact_typecode() + { + throw new NO_IMPLEMENT(); + } + + public String id() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + /** + * Return the kind of this type code object. + * @return one of the <code>TCKind.t_..</code> fields. + */ + public TCKind kind() + { + return kind; + } + + public int length() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public int member_count() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public Any member_label(int index) + throws org.omg.CORBA.TypeCodePackage.BadKind, + org.omg.CORBA.TypeCodePackage.Bounds + { + throw new BadKind(); + } + + public String member_name(int index) + throws BadKind + { + throw new BadKind(); + } + + public TypeCode member_type(int index) + throws org.omg.CORBA.TypeCodePackage.BadKind, + org.omg.CORBA.TypeCodePackage.Bounds + { + throw new BadKind(); + } + + public short member_visibility(int index) + throws org.omg.CORBA.TypeCodePackage.BadKind, + org.omg.CORBA.TypeCodePackage.Bounds + { + throw new BadKind(); + } + + public String name() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } + + public short type_modifier() + throws org.omg.CORBA.TypeCodePackage.BadKind + { + throw new BadKind(); + } +} diff --git a/gnu/java/awt/Buffers.java b/gnu/java/awt/Buffers.java index 3f254749e..22fc1f8ab 100644 --- a/gnu/java/awt/Buffers.java +++ b/gnu/java/awt/Buffers.java @@ -1,4 +1,5 @@ -/* Copyright (C) 2000, 2002, 2004 Free Software Foundation +/* Buffers.java -- + Copyright (C) 2000, 2002, 2004 Free Software Foundation This file is part of GNU Classpath. @@ -34,9 +35,16 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package gnu.java.awt; -import java.awt.image.*; +import java.awt.image.DataBuffer; +import java.awt.image.DataBufferByte; +import java.awt.image.DataBufferDouble; +import java.awt.image.DataBufferFloat; +import java.awt.image.DataBufferInt; +import java.awt.image.DataBufferShort; +import java.awt.image.DataBufferUShort; /** * Utility class for creating and accessing data buffers of arbitrary diff --git a/gnu/java/awt/ComponentDataBlitOp.java b/gnu/java/awt/ComponentDataBlitOp.java index aabfb7e78..3401a8063 100644 --- a/gnu/java/awt/ComponentDataBlitOp.java +++ b/gnu/java/awt/ComponentDataBlitOp.java @@ -53,7 +53,7 @@ import java.awt.image.WritableRaster; * @throws java.lang.ClassCastException if the sample models of the * rasters are not of type ComponentSampleModel. * - * @author Rolf W. Rasmussen <rolfwr@ii.uib.no> + * @author Rolf W. Rasmussen (rolfwr@ii.uib.no) */ public class ComponentDataBlitOp implements RasterOp { diff --git a/gnu/java/awt/EmbeddedWindowSupport.java b/gnu/java/awt/EmbeddedWindowSupport.java index 9d48499e0..3018f469f 100644 --- a/gnu/java/awt/EmbeddedWindowSupport.java +++ b/gnu/java/awt/EmbeddedWindowSupport.java @@ -51,7 +51,7 @@ import gnu.java.awt.peer.EmbeddedWindowPeer; * @see gnu.java.awt.EmbeddedWindow * @see java.awt.Toolkit * - * @author Michael Koch <konqueror@gmx.de> + * @author Michael Koch (konqueror@gmx.de) */ public interface EmbeddedWindowSupport { diff --git a/gnu/java/awt/color/CieXyzConverter.java b/gnu/java/awt/color/CieXyzConverter.java index ee183cd64..4078ffa51 100644 --- a/gnu/java/awt/color/CieXyzConverter.java +++ b/gnu/java/awt/color/CieXyzConverter.java @@ -1,40 +1,39 @@ /* CieXyzConverter.java -- CieXyz conversion class Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. +This file is part of GNU Classpath. - GNU Classpath 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 2, or (at your option) - any later version. +GNU Classpath 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 2, or (at your option) +any later version. - GNU Classpath 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. +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/ClutProfileConverter.java b/gnu/java/awt/color/ClutProfileConverter.java index 5b06f48ee..471a47932 100644 --- a/gnu/java/awt/color/ClutProfileConverter.java +++ b/gnu/java/awt/color/ClutProfileConverter.java @@ -1,40 +1,39 @@ /* ClutProfileConverter.java -- Conversion routines for CLUT-Based profiles Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/ColorLookUpTable.java b/gnu/java/awt/color/ColorLookUpTable.java index 138d27adb..bf128907d 100644 --- a/gnu/java/awt/color/ColorLookUpTable.java +++ b/gnu/java/awt/color/ColorLookUpTable.java @@ -1,40 +1,39 @@ /* ColorLookUpTable.java -- ICC v2 CLUT Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/ColorSpaceConverter.java b/gnu/java/awt/color/ColorSpaceConverter.java index 1fee74925..20bb89b7a 100644 --- a/gnu/java/awt/color/ColorSpaceConverter.java +++ b/gnu/java/awt/color/ColorSpaceConverter.java @@ -1,40 +1,39 @@ /* ColorSpaceConverter.java -- an interface for colorspace conversion Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. +This file is part of GNU Classpath. - GNU Classpath 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 2, or (at your option) - any later version. +GNU Classpath 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 2, or (at your option) +any later version. - GNU Classpath 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. +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/GrayProfileConverter.java b/gnu/java/awt/color/GrayProfileConverter.java index 22dd49360..94ab3db5d 100644 --- a/gnu/java/awt/color/GrayProfileConverter.java +++ b/gnu/java/awt/color/GrayProfileConverter.java @@ -1,47 +1,46 @@ /* GrayProfileConverter.java -- Gray profile conversion class Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + package gnu.java.awt.color; -import java.awt.color.ProfileDataException; import java.awt.color.ICC_Profile; import java.awt.color.ICC_ProfileGray; - +import java.awt.color.ProfileDataException; /** * GrayProfileConverter - converts Grayscale profiles (ICC_ProfileGray) diff --git a/gnu/java/awt/color/GrayScaleConverter.java b/gnu/java/awt/color/GrayScaleConverter.java index 446c3f6e5..6ac3e6d38 100644 --- a/gnu/java/awt/color/GrayScaleConverter.java +++ b/gnu/java/awt/color/GrayScaleConverter.java @@ -1,40 +1,39 @@ /* GrayScaleConverter.java -- Linear grayscale conversion class Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. +This file is part of GNU Classpath. - GNU Classpath 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 2, or (at your option) - any later version. +GNU Classpath 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 2, or (at your option) +any later version. - GNU Classpath 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. +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/LinearRGBConverter.java b/gnu/java/awt/color/LinearRGBConverter.java index b40c2f029..20ba56dbf 100644 --- a/gnu/java/awt/color/LinearRGBConverter.java +++ b/gnu/java/awt/color/LinearRGBConverter.java @@ -1,39 +1,39 @@ /* LinearRGBConverter.java -- conversion to a linear RGB color space Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. +This file is part of GNU Classpath. - GNU Classpath 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 2, or (at your option) - any later version. +GNU Classpath 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 2, or (at your option) +any later version. - GNU Classpath 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. +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. */ +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/ProfileHeader.java b/gnu/java/awt/color/ProfileHeader.java index fc4c0c3c9..759400540 100644 --- a/gnu/java/awt/color/ProfileHeader.java +++ b/gnu/java/awt/color/ProfileHeader.java @@ -1,40 +1,39 @@ /* ProfileHeader.java -- Encapsules ICC Profile header data Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/PyccConverter.java b/gnu/java/awt/color/PyccConverter.java index 638d944a5..b3607af6d 100644 --- a/gnu/java/awt/color/PyccConverter.java +++ b/gnu/java/awt/color/PyccConverter.java @@ -1,40 +1,39 @@ /* PyccConverter.java -- PhotoYCC conversion class Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. +This file is part of GNU Classpath. - GNU Classpath 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 2, or (at your option) - any later version. +GNU Classpath 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 2, or (at your option) +any later version. - GNU Classpath 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. +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. +You should have received a copy of the GNU General Public License +along with GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/RgbProfileConverter.java b/gnu/java/awt/color/RgbProfileConverter.java index 0482b3fe6..a52e80a2d 100644 --- a/gnu/java/awt/color/RgbProfileConverter.java +++ b/gnu/java/awt/color/RgbProfileConverter.java @@ -1,47 +1,46 @@ /* RgbProfileConverter.java -- RGB Profile conversion class Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + package gnu.java.awt.color; -import java.awt.color.ProfileDataException; import java.awt.color.ICC_Profile; import java.awt.color.ICC_ProfileRGB; - +import java.awt.color.ProfileDataException; /** * RgbProfileConverter - converts RGB profiles (ICC_ProfileRGB) @@ -49,7 +48,7 @@ import java.awt.color.ICC_ProfileRGB; * This type of profile contains a matrix and three * tone reproduction curves (TRCs). * - * Device RGB --> CIE XYZ is done through first multiplying with + * Device RGB --> CIE XYZ is done through first multiplying with * a matrix, then each component is looked-up against it's TRC. * * The opposite transform is done using the inverse of the matrix, diff --git a/gnu/java/awt/color/SrgbConverter.java b/gnu/java/awt/color/SrgbConverter.java index 65123e230..f94ee674a 100644 --- a/gnu/java/awt/color/SrgbConverter.java +++ b/gnu/java/awt/color/SrgbConverter.java @@ -1,40 +1,39 @@ /* SrgbConverter.java -- sRGB conversion class Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/TagEntry.java b/gnu/java/awt/color/TagEntry.java index 7726e45d3..1e67dc2b6 100644 --- a/gnu/java/awt/color/TagEntry.java +++ b/gnu/java/awt/color/TagEntry.java @@ -1,40 +1,39 @@ /* TagEntry.java -- A utility class used for storing the tags in ICC_Profile Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/ToneReproductionCurve.java b/gnu/java/awt/color/ToneReproductionCurve.java index a29598c4b..f3b59b2ae 100644 --- a/gnu/java/awt/color/ToneReproductionCurve.java +++ b/gnu/java/awt/color/ToneReproductionCurve.java @@ -1,40 +1,39 @@ /* ToneReproductionCurve.java -- Representation of an ICC 'curv' type TRC Copyright (C) 2004 Free Software Foundation - This file is part of GNU Classpath. - - GNU Classpath 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 2, or (at your option) - any later version. - - GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the - Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA - 02111-1307 USA. - - Linking this library statically or dynamically with other modules is - making a combined work based on this library. Thus, the terms and - conditions of the GNU General Public License cover the whole - combination. - - As a special exception, the copyright holders of this library give you - permission to link this library with independent modules to produce an - executable, regardless of the license terms of these independent - modules, and to copy and distribute the resulting executable under - terms of your choice, provided that you also meet, for each linked - independent module, the terms and conditions of the license of that - module. An independent module is a module which is not derived from - or based on this library. If you modify this library, you may extend - this exception to your version of the library, but you are not - obligated to do so. If you do not wish to do so, delete this - exception statement from your version. -*/ +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ package gnu.java.awt.color; diff --git a/gnu/java/awt/color/package.html b/gnu/java/awt/color/package.html new file mode 100644 index 000000000..209002146 --- /dev/null +++ b/gnu/java/awt/color/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.awt.color package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.awt.color</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/awt/image/ImageDecoder.java b/gnu/java/awt/image/ImageDecoder.java index d279d5674..63d3937bf 100644 --- a/gnu/java/awt/image/ImageDecoder.java +++ b/gnu/java/awt/image/ImageDecoder.java @@ -1,4 +1,4 @@ -/* ImageDecoder.java +/* ImageDecoder.java -- Copyright (C) 1999, 2000, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,8 +41,8 @@ import java.awt.image.ImageConsumer; import java.awt.image.ImageProducer; import java.io.ByteArrayInputStream; import java.io.FileInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.net.URL; import java.util.Vector; diff --git a/gnu/java/awt/image/XBMDecoder.java b/gnu/java/awt/image/XBMDecoder.java index da58dbbcf..54bfd6cb0 100644 --- a/gnu/java/awt/image/XBMDecoder.java +++ b/gnu/java/awt/image/XBMDecoder.java @@ -1,4 +1,4 @@ -/* XBMDecoder -- Decodes X-bitmaps +/* XBMDecoder.java -- Decodes X-bitmaps Copyright (C) 1999, 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,9 +41,9 @@ package gnu.java.awt.image; import java.awt.image.ColorModel; import java.awt.image.ImageConsumer; import java.io.BufferedReader; +import java.io.IOException; import java.io.InputStream; import java.io.InputStreamReader; -import java.io.IOException; import java.io.Reader; import java.net.URL; import java.util.StringTokenizer; @@ -121,7 +121,7 @@ public class XBMDecoder extends ImageDecoder } } - static public int[] getScanline (Reader in, int len) throws IOException + public static int[] getScanline (Reader in, int len) throws IOException { char byteStr[] = new char[2]; int scanline[] = new int[len]; diff --git a/gnu/java/awt/image/package.html b/gnu/java/awt/image/package.html new file mode 100644 index 000000000..2aa55c40f --- /dev/null +++ b/gnu/java/awt/image/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.awt.image package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.awt.image</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/awt/package.html b/gnu/java/awt/package.html new file mode 100644 index 000000000..d23292649 --- /dev/null +++ b/gnu/java/awt/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.awt package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.awt</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/awt/peer/ClasspathFontPeer.java b/gnu/java/awt/peer/ClasspathFontPeer.java index 79b1adf18..d34e86300 100644 --- a/gnu/java/awt/peer/ClasspathFontPeer.java +++ b/gnu/java/awt/peer/ClasspathFontPeer.java @@ -38,14 +38,24 @@ exception statement from your version. */ package gnu.java.awt.peer; -import java.awt.*; -import java.awt.peer.*; -import java.awt.font.*; -import java.awt.geom.*; -import java.text.*; -import java.util.*; -import gnu.java.awt.*; - +import gnu.java.awt.ClasspathToolkit; + +import java.awt.Font; +import java.awt.FontMetrics; +import java.awt.Toolkit; +import java.awt.font.FontRenderContext; +import java.awt.font.GlyphVector; +import java.awt.font.LineMetrics; +import java.awt.font.TextAttribute; +import java.awt.font.TransformAttribute; +import java.awt.geom.AffineTransform; +import java.awt.geom.Rectangle2D; +import java.awt.peer.FontPeer; +import java.text.AttributedCharacterIterator; +import java.text.CharacterIterator; +import java.util.HashMap; +import java.util.Locale; +import java.util.Map; /** * A peer for fonts that are used inside Classpath. The purpose of diff --git a/gnu/java/awt/peer/gtk/GtkWindowPeer.java b/gnu/java/awt/peer/gtk/GtkWindowPeer.java index 353bc94ae..eabe59140 100644 --- a/gnu/java/awt/peer/gtk/GtkWindowPeer.java +++ b/gnu/java/awt/peer/gtk/GtkWindowPeer.java @@ -63,30 +63,27 @@ public class GtkWindowPeer extends GtkContainerPeer native void gtkWindowSetResizable (boolean resizable); native void gtkWindowSetModal (boolean modal); - native void create (int type, boolean decorated, - int width, int height, - GtkWindowPeer parent, - int[] insets); + int getWidth () + { + return awtComponent.getWidth(); + } + + int getHeight () + { + return awtComponent.getHeight(); + } + + native void create (int type, boolean decorated, GtkWindowPeer parent); void create (int type, boolean decorated) { GtkWindowPeer parent_peer = null; Component parent = awtComponent.getParent(); - int[] insets = new int [] { 0, 0, 0, 0 }; if (parent != null) parent_peer = (GtkWindowPeer) awtComponent.getParent().getPeer(); - create (type, decorated, - awtComponent.getWidth(), - awtComponent.getHeight(), - parent_peer, - insets); - - this.insets.top = insets [0]; - this.insets.left = insets [1]; - this.insets.bottom = insets [2]; - this.insets.right = insets [3]; + create (type, decorated, parent_peer); } void create () diff --git a/gnu/java/awt/peer/package.html b/gnu/java/awt/peer/package.html new file mode 100644 index 000000000..458edc52c --- /dev/null +++ b/gnu/java/awt/peer/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.awt.peer package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.awt.peer</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/beans/IntrospectionIncubator.java b/gnu/java/beans/IntrospectionIncubator.java index 21bf984d2..0d78e8d1e 100644 --- a/gnu/java/beans/IntrospectionIncubator.java +++ b/gnu/java/beans/IntrospectionIncubator.java @@ -82,14 +82,14 @@ public class IntrospectionIncubator { /** Examines the given method and files it in a suitable collection. * It files the method as a property method if it finds: - * <lu> + * <ul> * <li>boolean "is" getter</li> * <li>"get" style getter</li> * <li>single argument setter</li> * <li>indiced setter and getter</li> * </ul> * It files the method as a listener method if all of these rules apply: - * <lu> + * <ul> * <li>the method name starts with "add" or "remove"</li> * <li>there is only a single argument</li> * <li>the argument type is a subclass of <code>java.util.EventListener</code></li> diff --git a/gnu/java/beans/decoder/package.html b/gnu/java/beans/decoder/package.html new file mode 100644 index 000000000..573e70767 --- /dev/null +++ b/gnu/java/beans/decoder/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.beans.decoder package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.beans.decoder</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/beans/editors/package.html b/gnu/java/beans/editors/package.html new file mode 100644 index 000000000..3d7ac222b --- /dev/null +++ b/gnu/java/beans/editors/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.beans.editors package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.beans.editors</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/beans/package.html b/gnu/java/beans/package.html new file mode 100644 index 000000000..108185b1c --- /dev/null +++ b/gnu/java/beans/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.beans package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.beans</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/io/EncodingManager.java b/gnu/java/io/EncodingManager.java index 0b56ac0b2..b05eefc1b 100644 --- a/gnu/java/io/EncodingManager.java +++ b/gnu/java/io/EncodingManager.java @@ -42,10 +42,10 @@ import gnu.classpath.SystemProperties; import gnu.java.io.decode.Decoder; import gnu.java.io.encode.Encoder; -import java.lang.reflect.Constructor; import java.io.InputStream; import java.io.OutputStream; import java.io.UnsupportedEncodingException; +import java.lang.reflect.Constructor; import java.util.Hashtable; import java.util.StringTokenizer; diff --git a/gnu/java/io/decode/DecoderUTF8.java b/gnu/java/io/decode/DecoderUTF8.java index b4f7c25df..30749d8c3 100644 --- a/gnu/java/io/decode/DecoderUTF8.java +++ b/gnu/java/io/decode/DecoderUTF8.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.io.decode; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; /** * This class implements character decoding in the UCS Transformation diff --git a/gnu/java/io/decode/package.html b/gnu/java/io/decode/package.html new file mode 100644 index 000000000..cf753c8b6 --- /dev/null +++ b/gnu/java/io/decode/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.io.decode package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.io.decode</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/io/encode/EncoderEightBitLookup.java b/gnu/java/io/encode/EncoderEightBitLookup.java index f1f24953a..865675620 100644 --- a/gnu/java/io/encode/EncoderEightBitLookup.java +++ b/gnu/java/io/encode/EncoderEightBitLookup.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.io.encode; -import java.io.OutputStream; import java.io.IOException; +import java.io.OutputStream; /** * Numerous character encodings utilize only eight bits. These can diff --git a/gnu/java/io/encode/EncoderUTF8.java b/gnu/java/io/encode/EncoderUTF8.java index ff2bc84f7..a200b6591 100644 --- a/gnu/java/io/encode/EncoderUTF8.java +++ b/gnu/java/io/encode/EncoderUTF8.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.io.encode; -import java.io.OutputStream; import java.io.IOException; +import java.io.OutputStream; /** * This class implements an encoder for the UCS Transformation Format 8 diff --git a/gnu/java/io/encode/package.html b/gnu/java/io/encode/package.html new file mode 100644 index 000000000..be4e75137 --- /dev/null +++ b/gnu/java/io/encode/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.io.encode package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.io.encode</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/io/package.html b/gnu/java/io/package.html new file mode 100644 index 000000000..465525025 --- /dev/null +++ b/gnu/java/io/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.io package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.io</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/lang/ClassHelper.java b/gnu/java/lang/ClassHelper.java index 3bd2cf021..604c9087a 100644 --- a/gnu/java/lang/ClassHelper.java +++ b/gnu/java/lang/ClassHelper.java @@ -51,7 +51,7 @@ import java.util.Set; * ClassHelper has various methods that ought to have been in Class. * * @author John Keiser - * @author Eric Blake <ebb9@email.byu.edu> + * @author Eric Blake (ebb9@email.byu.edu) */ public class ClassHelper { diff --git a/gnu/java/lang/MainThread.java b/gnu/java/lang/MainThread.java index c4d5edb49..a7665da26 100644 --- a/gnu/java/lang/MainThread.java +++ b/gnu/java/lang/MainThread.java @@ -1,5 +1,5 @@ -/* gnu.java.lang.MainThread - Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004 +/* MainThread.java -- + Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -39,7 +39,8 @@ exception statement from your version. */ package gnu.java.lang; -import java.lang.reflect.*; +import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; /** * MainThread is a Thread which uses the main() method of some class. diff --git a/gnu/java/lang/package.html b/gnu/java/lang/package.html new file mode 100644 index 000000000..4f105c67f --- /dev/null +++ b/gnu/java/lang/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.lang package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.lang</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/lang/reflect/TypeSignature.java b/gnu/java/lang/reflect/TypeSignature.java index 714160c18..248b3dd8c 100644 --- a/gnu/java/lang/reflect/TypeSignature.java +++ b/gnu/java/lang/reflect/TypeSignature.java @@ -51,7 +51,7 @@ import java.lang.reflect.Method; * <code>Method</code>s. Methods are also provided to go in the * reverse direction. * - * @author Eric Blake <ebb9@email.byu.edu> + * @author Eric Blake (ebb9@email.byu.edu) */ public class TypeSignature { diff --git a/gnu/java/lang/reflect/package.html b/gnu/java/lang/reflect/package.html new file mode 100644 index 000000000..e8effbab7 --- /dev/null +++ b/gnu/java/lang/reflect/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.lang.reflect package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.lang.reflect</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/locale/Calendar.java b/gnu/java/locale/Calendar.java deleted file mode 100644 index 6edc86781..000000000 --- a/gnu/java/locale/Calendar.java +++ /dev/null @@ -1,123 +0,0 @@ -/* Calendar.java -- Default Calendar locale data - Copyright (C) 1999 Free Software Foundation, Inc. - -This file is part of GNU Classpath. - -GNU Classpath 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 2, or (at your option) -any later version. - -GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the -Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA -02111-1307 USA. - -Linking this library statically or dynamically with other modules is -making a combined work based on this library. Thus, the terms and -conditions of the GNU General Public License cover the whole -combination. - -As a special exception, the copyright holders of this library give you -permission to link this library with independent modules to produce an -executable, regardless of the license terms of these independent -modules, and to copy and distribute the resulting executable under -terms of your choice, provided that you also meet, for each linked -independent module, the terms and conditions of the license of that -module. An independent module is a module which is not derived from -or based on this library. If you modify this library, you may extend -this exception to your version of the library, but you are not -obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ - - -package gnu.java.locale; - -import java.util.Date; -import java.util.ListResourceBundle; -import java.util.Locale; - -/** - * This class contains locale data for java.util.Calendar.<br> - * - * If you localize this to another language only set fields, that - * you change. See Calendar_de for an example. Also add your - * locale to this list of availableLocales below in this(!) file. - * - * @author Jochen Hoenicke - */ -public class Calendar extends ListResourceBundle -{ - /** - * The locales for which Calendar is localized. - */ - private static final Locale[] availableLocales = { - Locale.GERMAN, Locale.ENGLISH, new Locale("nl", "") - }; - - /** - * This is the default calendar class, that is returned on - * java.util.Calendar.getInstance(). - * @see java.util.Calendar#getInstance() - */ - private static final String calendarClass = "java.util.GregorianCalendar"; - - /** - * This is used by java.util.Calendar. - * @see java.util.Calendar#getFirstDayOfWeek() - */ - private static final Integer firstDayOfWeek - = new Integer(java.util.Calendar.SUNDAY); - /** - * This is used by java.util.Calendar. - * @see java.util.Calendar#getMinimalDaysInFirstWeek() - */ - private static final Integer minimalDaysInFirstWeek = new Integer(1); - - /** - * The point at which the Gregorian calendar rules were used. - * The default for most catholic - * countries is midnight (UTC) on October 5, 1582 (Julian), - * or October 15, 1582 (Gregorian). - * @see java.util.GregorianCalendar#getGregorianCutOver - */ - /* If you change this date be aware, that this formular does only - * work for months from MARCH to DECEMBER and doesn't work in - * leap years (look in java.util.GregorianCalendar.getDayOfYear for - * more info). - */ - private static final Date gregorianCutOver = new Date - ((24*60*60*1000L) * - (((1582*(365*4+1))/4 + - (java.util.Calendar.OCTOBER*(31+30+31+30+31) - 9) / 5 + 5) - - ((1970*(365*4+1))/4 + 1 - 13))); - - /** - * This is the object array used to hold the keys and values - * for this bundle - */ - private static final Object[][] contents = - { - { "availableLocales", availableLocales }, - { "calendarClass", calendarClass }, - { "firstDayOfWeek", firstDayOfWeek }, - { "minimalDaysInFirstWeek", minimalDaysInFirstWeek }, - { "gregorianCutOver", gregorianCutOver } - }; - - /** - * This method returns the object array of key, value pairs containing - * the data for this bundle. - * - * @return The key, value information. - */ - public Object[][] getContents() - { - return(contents); - } -} diff --git a/gnu/java/locale/LocaleHelper.java b/gnu/java/locale/LocaleHelper.java index 036c868e9..0bf77a6c6 100644 --- a/gnu/java/locale/LocaleHelper.java +++ b/gnu/java/locale/LocaleHelper.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.locale; -import java.util.Locale; import java.util.Hashtable; +import java.util.Locale; import java.util.MissingResourceException; import java.util.ResourceBundle; @@ -48,18 +48,18 @@ import java.util.ResourceBundle; * for handling localized data. * * @author Andrew John Hughes (gnu_andrew@member.fsf.org) + * * @see java.util.Locale * @see java.util.ResourceBundle */ public class LocaleHelper { - /** * This method is used by the localized name lookup methods to retrieve * the localized name of a particular piece of locale data. * If the display name can not be localized to the supplied * locale, it will fall back on other output in the following order: - * </p> + * * <ul> * <li>the localized name in the default locale</li> * <li>the localized name in English (optional)</li> diff --git a/gnu/java/locale/LocaleInformation.java b/gnu/java/locale/LocaleInformation.java index 016e46652..84fb65d22 100644 --- a/gnu/java/locale/LocaleInformation.java +++ b/gnu/java/locale/LocaleInformation.java @@ -1,5 +1,5 @@ /* LocaleInformation.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -169,6 +169,8 @@ public class LocaleInformation extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "1" }, + { "firstDayOfWeek", "sun" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "yy/MM/dd" }, diff --git a/gnu/java/locale/LocaleInformation_aa.java b/gnu/java/locale/LocaleInformation_aa.java index c59b62f05..a556e6700 100644 --- a/gnu/java/locale/LocaleInformation_aa.java +++ b/gnu/java/locale/LocaleInformation_aa.java @@ -1,5 +1,5 @@ /* LocaleInformation_aa.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -191,6 +191,7 @@ public class LocaleInformation_aa extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "dd/MM/yy" }, diff --git a/gnu/java/locale/LocaleInformation_aa_DJ.java b/gnu/java/locale/LocaleInformation_aa_DJ.java index e6e56db1f..9db342a84 100644 --- a/gnu/java/locale/LocaleInformation_aa_DJ.java +++ b/gnu/java/locale/LocaleInformation_aa_DJ.java @@ -1,5 +1,5 @@ /* LocaleInformation_aa_DJ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_aa_ER.java b/gnu/java/locale/LocaleInformation_aa_ER.java index ae9895854..be4b58202 100644 --- a/gnu/java/locale/LocaleInformation_aa_ER.java +++ b/gnu/java/locale/LocaleInformation_aa_ER.java @@ -1,5 +1,5 @@ /* LocaleInformation_aa_ER.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_aa_ER_SAAHO.java b/gnu/java/locale/LocaleInformation_aa_ER_SAAHO.java index 565cfebe1..eefcb1bd0 100644 --- a/gnu/java/locale/LocaleInformation_aa_ER_SAAHO.java +++ b/gnu/java/locale/LocaleInformation_aa_ER_SAAHO.java @@ -1,5 +1,5 @@ /* LocaleInformation_aa_ER_SAAHO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_aa_ET.java b/gnu/java/locale/LocaleInformation_aa_ET.java index 799e71f9a..f8fd87dad 100644 --- a/gnu/java/locale/LocaleInformation_aa_ET.java +++ b/gnu/java/locale/LocaleInformation_aa_ET.java @@ -1,5 +1,5 @@ /* LocaleInformation_aa_ET.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_af.java b/gnu/java/locale/LocaleInformation_af.java index af4eb61b2..e25bb56fe 100644 --- a/gnu/java/locale/LocaleInformation_af.java +++ b/gnu/java/locale/LocaleInformation_af.java @@ -1,5 +1,5 @@ /* LocaleInformation_af.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_af_ZA.java b/gnu/java/locale/LocaleInformation_af_ZA.java index d0107b204..4f6c2fc09 100644 --- a/gnu/java/locale/LocaleInformation_af_ZA.java +++ b/gnu/java/locale/LocaleInformation_af_ZA.java @@ -1,5 +1,5 @@ /* LocaleInformation_af_ZA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_am.java b/gnu/java/locale/LocaleInformation_am.java index 46bb03165..b10eaaa36 100644 --- a/gnu/java/locale/LocaleInformation_am.java +++ b/gnu/java/locale/LocaleInformation_am.java @@ -1,5 +1,5 @@ /* LocaleInformation_am.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -149,6 +149,7 @@ public class LocaleInformation_am extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "territories", territories }, { "languages", languages }, diff --git a/gnu/java/locale/LocaleInformation_am_ET.java b/gnu/java/locale/LocaleInformation_am_ET.java index f0880f48e..16e58af01 100644 --- a/gnu/java/locale/LocaleInformation_am_ET.java +++ b/gnu/java/locale/LocaleInformation_am_ET.java @@ -1,5 +1,5 @@ /* LocaleInformation_am_ET.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar.java b/gnu/java/locale/LocaleInformation_ar.java index 9871b7e33..7a5b83e12 100644 --- a/gnu/java/locale/LocaleInformation_ar.java +++ b/gnu/java/locale/LocaleInformation_ar.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -198,6 +198,7 @@ public class LocaleInformation_ar extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "d/M/yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ar_DZ.java b/gnu/java/locale/LocaleInformation_ar_DZ.java index 443bfb78a..c6390e592 100644 --- a/gnu/java/locale/LocaleInformation_ar_DZ.java +++ b/gnu/java/locale/LocaleInformation_ar_DZ.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_DZ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_IN.java b/gnu/java/locale/LocaleInformation_ar_IN.java index 6754b2981..dbf02fa79 100644 --- a/gnu/java/locale/LocaleInformation_ar_IN.java +++ b/gnu/java/locale/LocaleInformation_ar_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_ar_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ar_IQ.java b/gnu/java/locale/LocaleInformation_ar_IQ.java index c8780e462..67e82c280 100644 --- a/gnu/java/locale/LocaleInformation_ar_IQ.java +++ b/gnu/java/locale/LocaleInformation_ar_IQ.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_IQ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_JO.java b/gnu/java/locale/LocaleInformation_ar_JO.java index be3b979b9..a808a3246 100644 --- a/gnu/java/locale/LocaleInformation_ar_JO.java +++ b/gnu/java/locale/LocaleInformation_ar_JO.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_JO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_KW.java b/gnu/java/locale/LocaleInformation_ar_KW.java index daff4a99f..1081accd3 100644 --- a/gnu/java/locale/LocaleInformation_ar_KW.java +++ b/gnu/java/locale/LocaleInformation_ar_KW.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_KW.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_LB.java b/gnu/java/locale/LocaleInformation_ar_LB.java index 7a4cbb29f..db817c3a2 100644 --- a/gnu/java/locale/LocaleInformation_ar_LB.java +++ b/gnu/java/locale/LocaleInformation_ar_LB.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_LB.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_LY.java b/gnu/java/locale/LocaleInformation_ar_LY.java index 8d729437d..131ccb400 100644 --- a/gnu/java/locale/LocaleInformation_ar_LY.java +++ b/gnu/java/locale/LocaleInformation_ar_LY.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_LY.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_MA.java b/gnu/java/locale/LocaleInformation_ar_MA.java index a775e0ef5..d41ecd5be 100644 --- a/gnu/java/locale/LocaleInformation_ar_MA.java +++ b/gnu/java/locale/LocaleInformation_ar_MA.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_MA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_QA.java b/gnu/java/locale/LocaleInformation_ar_QA.java index 480c11172..c882e617b 100644 --- a/gnu/java/locale/LocaleInformation_ar_QA.java +++ b/gnu/java/locale/LocaleInformation_ar_QA.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_QA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_SA.java b/gnu/java/locale/LocaleInformation_ar_SA.java index 3d86307f9..58c5aeed0 100644 --- a/gnu/java/locale/LocaleInformation_ar_SA.java +++ b/gnu/java/locale/LocaleInformation_ar_SA.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_SA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_SY.java b/gnu/java/locale/LocaleInformation_ar_SY.java index e57c18c82..db6a45d32 100644 --- a/gnu/java/locale/LocaleInformation_ar_SY.java +++ b/gnu/java/locale/LocaleInformation_ar_SY.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_SY.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -96,6 +96,7 @@ public class LocaleInformation_ar_SY extends ListResourceBundle { "shortMonths", shortMonths }, { "months", months }, { "shortWeekdays", shortWeekdays }, + { "firstDayOfWeek", "thu" }, }; public Object[][] getContents() { return contents; } diff --git a/gnu/java/locale/LocaleInformation_ar_TN.java b/gnu/java/locale/LocaleInformation_ar_TN.java index 96a97052a..1a224e838 100644 --- a/gnu/java/locale/LocaleInformation_ar_TN.java +++ b/gnu/java/locale/LocaleInformation_ar_TN.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_TN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ar_YE.java b/gnu/java/locale/LocaleInformation_ar_YE.java index 5d9bcea52..1b472a9e7 100644 --- a/gnu/java/locale/LocaleInformation_ar_YE.java +++ b/gnu/java/locale/LocaleInformation_ar_YE.java @@ -1,5 +1,5 @@ /* LocaleInformation_ar_YE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_as.java b/gnu/java/locale/LocaleInformation_as.java index 8b71550e7..23b2dfb1c 100644 --- a/gnu/java/locale/LocaleInformation_as.java +++ b/gnu/java/locale/LocaleInformation_as.java @@ -1,5 +1,5 @@ /* LocaleInformation_as.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_as_IN.java b/gnu/java/locale/LocaleInformation_as_IN.java index 60fc760a3..3f3568bdb 100644 --- a/gnu/java/locale/LocaleInformation_as_IN.java +++ b/gnu/java/locale/LocaleInformation_as_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_as_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_az_Cyrl.java b/gnu/java/locale/LocaleInformation_az_Cyrl.java index dd639f429..bd72ff38a 100644 --- a/gnu/java/locale/LocaleInformation_az_Cyrl.java +++ b/gnu/java/locale/LocaleInformation_az_Cyrl.java @@ -1,5 +1,5 @@ /* LocaleInformation_az_Cyrl.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_be.java b/gnu/java/locale/LocaleInformation_be.java index 9e17d0eea..ddddcf4fb 100644 --- a/gnu/java/locale/LocaleInformation_be.java +++ b/gnu/java/locale/LocaleInformation_be.java @@ -1,5 +1,5 @@ /* LocaleInformation_be.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_be extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "d.M.yy" }, { "mediumDateFormat", "d.M.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_be_BY.java b/gnu/java/locale/LocaleInformation_be_BY.java index a168b5aee..a634aa3d9 100644 --- a/gnu/java/locale/LocaleInformation_be_BY.java +++ b/gnu/java/locale/LocaleInformation_be_BY.java @@ -1,5 +1,5 @@ /* LocaleInformation_be_BY.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_bg.java b/gnu/java/locale/LocaleInformation_bg.java index 1b7b17392..93d44a2dc 100644 --- a/gnu/java/locale/LocaleInformation_bg.java +++ b/gnu/java/locale/LocaleInformation_bg.java @@ -1,5 +1,5 @@ /* LocaleInformation_bg.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -210,6 +210,7 @@ public class LocaleInformation_bg extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yy" }, { "mediumDateFormat", "dd.MM.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_bg_BG.java b/gnu/java/locale/LocaleInformation_bg_BG.java index ddbec4884..92606001f 100644 --- a/gnu/java/locale/LocaleInformation_bg_BG.java +++ b/gnu/java/locale/LocaleInformation_bg_BG.java @@ -1,5 +1,5 @@ /* LocaleInformation_bg_BG.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_bn.java b/gnu/java/locale/LocaleInformation_bn.java index 0f5c40d9d..c38c2df44 100644 --- a/gnu/java/locale/LocaleInformation_bn.java +++ b/gnu/java/locale/LocaleInformation_bn.java @@ -1,5 +1,5 @@ /* LocaleInformation_bn.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_bn_IN.java b/gnu/java/locale/LocaleInformation_bn_IN.java index 39274b6fa..f760b7055 100644 --- a/gnu/java/locale/LocaleInformation_bn_IN.java +++ b/gnu/java/locale/LocaleInformation_bn_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_bn_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_bn_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ca.java b/gnu/java/locale/LocaleInformation_ca.java index 3ca996de4..2bc64be93 100644 --- a/gnu/java/locale/LocaleInformation_ca.java +++ b/gnu/java/locale/LocaleInformation_ca.java @@ -1,5 +1,5 @@ /* LocaleInformation_ca.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -184,6 +184,7 @@ public class LocaleInformation_ca extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "dd/MM/yyyy" }, { "longDateFormat", "d 'd\u2019'MMMM 'de' yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ca_ES.java b/gnu/java/locale/LocaleInformation_ca_ES.java index a55b712cf..b4c83462d 100644 --- a/gnu/java/locale/LocaleInformation_ca_ES.java +++ b/gnu/java/locale/LocaleInformation_ca_ES.java @@ -1,5 +1,5 @@ /* LocaleInformation_ca_ES.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_cs.java b/gnu/java/locale/LocaleInformation_cs.java index 249aaf0a2..310e064d1 100644 --- a/gnu/java/locale/LocaleInformation_cs.java +++ b/gnu/java/locale/LocaleInformation_cs.java @@ -1,5 +1,5 @@ /* LocaleInformation_cs.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -215,6 +215,7 @@ public class LocaleInformation_cs extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "d.M.yy" }, diff --git a/gnu/java/locale/LocaleInformation_cs_CZ.java b/gnu/java/locale/LocaleInformation_cs_CZ.java index 0f0aa5f9c..2a255bba1 100644 --- a/gnu/java/locale/LocaleInformation_cs_CZ.java +++ b/gnu/java/locale/LocaleInformation_cs_CZ.java @@ -1,5 +1,5 @@ /* LocaleInformation_cs_CZ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_cy.java b/gnu/java/locale/LocaleInformation_cy.java index 5ae20d175..0c45cc21d 100644 --- a/gnu/java/locale/LocaleInformation_cy.java +++ b/gnu/java/locale/LocaleInformation_cy.java @@ -1,5 +1,5 @@ /* LocaleInformation_cy.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_cy_GB.java b/gnu/java/locale/LocaleInformation_cy_GB.java index 0de12b1f2..cc091ac55 100644 --- a/gnu/java/locale/LocaleInformation_cy_GB.java +++ b/gnu/java/locale/LocaleInformation_cy_GB.java @@ -1,5 +1,5 @@ /* LocaleInformation_cy_GB.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ public class LocaleInformation_cy_GB extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "\u00a4#,##0.00;-\u00a4#,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yyyy" }, { "mediumDateFormat", "d MMM yyyy" }, { "longDateFormat", "dd MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_da.java b/gnu/java/locale/LocaleInformation_da.java index fdb73a70b..3998a9ecc 100644 --- a/gnu/java/locale/LocaleInformation_da.java +++ b/gnu/java/locale/LocaleInformation_da.java @@ -1,5 +1,5 @@ /* LocaleInformation_da.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -210,6 +210,8 @@ public class LocaleInformation_da extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd-MM-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_da_DK.java b/gnu/java/locale/LocaleInformation_da_DK.java index a4cfc21c9..da2c716d0 100644 --- a/gnu/java/locale/LocaleInformation_da_DK.java +++ b/gnu/java/locale/LocaleInformation_da_DK.java @@ -1,5 +1,5 @@ /* LocaleInformation_da_DK.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_de.java b/gnu/java/locale/LocaleInformation_de.java index da4c22a54..ab0e02b81 100644 --- a/gnu/java/locale/LocaleInformation_de.java +++ b/gnu/java/locale/LocaleInformation_de.java @@ -1,5 +1,5 @@ /* LocaleInformation_de.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -217,6 +217,8 @@ public class LocaleInformation_de extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "dd.MM.yy" }, diff --git a/gnu/java/locale/LocaleInformation_de_AT.java b/gnu/java/locale/LocaleInformation_de_AT.java index 52f44cf27..c0d111797 100644 --- a/gnu/java/locale/LocaleInformation_de_AT.java +++ b/gnu/java/locale/LocaleInformation_de_AT.java @@ -1,5 +1,5 @@ /* LocaleInformation_de_AT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_de_BE.java b/gnu/java/locale/LocaleInformation_de_BE.java index 40fcd91fa..51f61eb30 100644 --- a/gnu/java/locale/LocaleInformation_de_BE.java +++ b/gnu/java/locale/LocaleInformation_de_BE.java @@ -1,5 +1,5 @@ /* LocaleInformation_de_BE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_de_CH.java b/gnu/java/locale/LocaleInformation_de_CH.java index a9a117fa1..f82fee0a6 100644 --- a/gnu/java/locale/LocaleInformation_de_CH.java +++ b/gnu/java/locale/LocaleInformation_de_CH.java @@ -1,5 +1,5 @@ /* LocaleInformation_de_CH.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_de_DE.java b/gnu/java/locale/LocaleInformation_de_DE.java index f356c72a6..5b462dfee 100644 --- a/gnu/java/locale/LocaleInformation_de_DE.java +++ b/gnu/java/locale/LocaleInformation_de_DE.java @@ -1,5 +1,5 @@ /* LocaleInformation_de_DE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_de_LI.java b/gnu/java/locale/LocaleInformation_de_LI.java index 3b7c5044b..dd42ba0d2 100644 --- a/gnu/java/locale/LocaleInformation_de_LI.java +++ b/gnu/java/locale/LocaleInformation_de_LI.java @@ -1,5 +1,5 @@ /* LocaleInformation_de_LI.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_de_LU.java b/gnu/java/locale/LocaleInformation_de_LU.java index bf6582a74..9858d5b8c 100644 --- a/gnu/java/locale/LocaleInformation_de_LU.java +++ b/gnu/java/locale/LocaleInformation_de_LU.java @@ -1,5 +1,5 @@ /* LocaleInformation_de_LU.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_dv.java b/gnu/java/locale/LocaleInformation_dv.java index 6fbdef07a..b2a500842 100644 --- a/gnu/java/locale/LocaleInformation_dv.java +++ b/gnu/java/locale/LocaleInformation_dv.java @@ -1,5 +1,5 @@ /* LocaleInformation_dv.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_dv_MV.java b/gnu/java/locale/LocaleInformation_dv_MV.java index aa4e858e7..ab9e84011 100644 --- a/gnu/java/locale/LocaleInformation_dv_MV.java +++ b/gnu/java/locale/LocaleInformation_dv_MV.java @@ -1,5 +1,5 @@ /* LocaleInformation_dv_MV.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,6 +49,7 @@ public class LocaleInformation_dv_MV extends ListResourceBundle { private static final Object[][] contents = { + { "firstDayOfWeek", "fri" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_dz.java b/gnu/java/locale/LocaleInformation_dz.java index c6eb76e20..044f5cf7e 100644 --- a/gnu/java/locale/LocaleInformation_dz.java +++ b/gnu/java/locale/LocaleInformation_dz.java @@ -1,5 +1,5 @@ /* LocaleInformation_dz.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -153,6 +153,7 @@ public class LocaleInformation_dz extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "ampms", ampms }, { "shortDateFormat", "\u0f66\u0fa4\u0fb1\u0f72\u0f0b\u0f63\u0f7c\u0f0b yyyy \u0f5f\u0fb3\u0f0b MMM \u0f5a\u0f7a\u0f66\u0f0b dd" }, { "mediumDateFormat", "\u0f66\u0fa4\u0fb1\u0f72\u0f0b\u0f63\u0f7c\u0f0byyyy \u0f5f\u0fb3\u0f0b MMM \u0f5a\u0f7a\u0f66\u0f0b dd" }, diff --git a/gnu/java/locale/LocaleInformation_dz_BT.java b/gnu/java/locale/LocaleInformation_dz_BT.java index c45e24e2b..2b89c7f27 100644 --- a/gnu/java/locale/LocaleInformation_dz_BT.java +++ b/gnu/java/locale/LocaleInformation_dz_BT.java @@ -1,5 +1,5 @@ /* LocaleInformation_dz_BT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_el.java b/gnu/java/locale/LocaleInformation_el.java index 75d806d38..e0e72ce3c 100644 --- a/gnu/java/locale/LocaleInformation_el.java +++ b/gnu/java/locale/LocaleInformation_el.java @@ -1,5 +1,5 @@ /* LocaleInformation_el.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -194,6 +194,7 @@ public class LocaleInformation_el extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "dd/MM/yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_el_GR.java b/gnu/java/locale/LocaleInformation_el_GR.java index d47765228..7cc34d9f1 100644 --- a/gnu/java/locale/LocaleInformation_el_GR.java +++ b/gnu/java/locale/LocaleInformation_el_GR.java @@ -1,5 +1,5 @@ /* LocaleInformation_el_GR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en.java b/gnu/java/locale/LocaleInformation_en.java index 07027f92c..9fc59264d 100644 --- a/gnu/java/locale/LocaleInformation_en.java +++ b/gnu/java/locale/LocaleInformation_en.java @@ -1,5 +1,5 @@ /* LocaleInformation_en.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_AS.java b/gnu/java/locale/LocaleInformation_en_AS.java index fea83c7f5..dc1832c3e 100644 --- a/gnu/java/locale/LocaleInformation_en_AS.java +++ b/gnu/java/locale/LocaleInformation_en_AS.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_AS.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_AU.java b/gnu/java/locale/LocaleInformation_en_AU.java index eee32b2ed..5aa5406f2 100644 --- a/gnu/java/locale/LocaleInformation_en_AU.java +++ b/gnu/java/locale/LocaleInformation_en_AU.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_AU.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_BE.java b/gnu/java/locale/LocaleInformation_en_BE.java index 94de0c68b..f8f43c96a 100644 --- a/gnu/java/locale/LocaleInformation_en_BE.java +++ b/gnu/java/locale/LocaleInformation_en_BE.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_BE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -90,6 +90,8 @@ public class LocaleInformation_en_BE extends ListResourceBundle { "currencyFormat", "#,##0.00 \u00a4;-#,##0.00 \u00a4" }, { "currenciesDisplayName", currenciesDisplayName }, { "currenciesSymbol", currenciesSymbol }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "dd MMM yyyy" }, { "longDateFormat", "EEE d MMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_en_BW.java b/gnu/java/locale/LocaleInformation_en_BW.java index 214f01fdf..839a6a488 100644 --- a/gnu/java/locale/LocaleInformation_en_BW.java +++ b/gnu/java/locale/LocaleInformation_en_BW.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_BW.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_BZ.java b/gnu/java/locale/LocaleInformation_en_BZ.java index 0e61f240b..cd7f4e73d 100644 --- a/gnu/java/locale/LocaleInformation_en_BZ.java +++ b/gnu/java/locale/LocaleInformation_en_BZ.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_BZ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,6 +49,7 @@ public class LocaleInformation_en_BZ extends ListResourceBundle { private static final Object[][] contents = { + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "dd-MMM-yy" }, { "longDateFormat", "dd MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_en_CA.java b/gnu/java/locale/LocaleInformation_en_CA.java index a3fa674d2..23839d5c5 100644 --- a/gnu/java/locale/LocaleInformation_en_CA.java +++ b/gnu/java/locale/LocaleInformation_en_CA.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_CA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -88,6 +88,7 @@ public class LocaleInformation_en_CA extends ListResourceBundle { "currencyFormat", "\u00a4#,##0.00;(\u00a4#,##0.00)" }, { "currenciesDisplayName", currenciesDisplayName }, { "currenciesSymbol", currenciesSymbol }, + { "minNumberOfDaysInFirstWeek", "4" }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "d-MMM-yy" }, }; diff --git a/gnu/java/locale/LocaleInformation_en_GB.java b/gnu/java/locale/LocaleInformation_en_GB.java index ee4a6e3bc..435867178 100644 --- a/gnu/java/locale/LocaleInformation_en_GB.java +++ b/gnu/java/locale/LocaleInformation_en_GB.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_GB.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -54,6 +54,7 @@ public class LocaleInformation_en_GB extends ListResourceBundle private static final Object[][] contents = { + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yyyy" }, { "mediumDateFormat", "d MMM yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_en_GU.java b/gnu/java/locale/LocaleInformation_en_GU.java index 626a80006..672efc6df 100644 --- a/gnu/java/locale/LocaleInformation_en_GU.java +++ b/gnu/java/locale/LocaleInformation_en_GU.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_GU.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_HK.java b/gnu/java/locale/LocaleInformation_en_HK.java index 6e3a82edc..b6746b968 100644 --- a/gnu/java/locale/LocaleInformation_en_HK.java +++ b/gnu/java/locale/LocaleInformation_en_HK.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_HK.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_IE.java b/gnu/java/locale/LocaleInformation_en_IE.java index 2abc36742..a5b65f6f9 100644 --- a/gnu/java/locale/LocaleInformation_en_IE.java +++ b/gnu/java/locale/LocaleInformation_en_IE.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_IE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_IN.java b/gnu/java/locale/LocaleInformation_en_IN.java index 5f64f78a9..273dcae7c 100644 --- a/gnu/java/locale/LocaleInformation_en_IN.java +++ b/gnu/java/locale/LocaleInformation_en_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_en_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "dd-MMM-yy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_en_MH.java b/gnu/java/locale/LocaleInformation_en_MH.java index a70824e72..411dcc33b 100644 --- a/gnu/java/locale/LocaleInformation_en_MH.java +++ b/gnu/java/locale/LocaleInformation_en_MH.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_MH.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_MP.java b/gnu/java/locale/LocaleInformation_en_MP.java index 514bbd51e..6896c9097 100644 --- a/gnu/java/locale/LocaleInformation_en_MP.java +++ b/gnu/java/locale/LocaleInformation_en_MP.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_MP.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_MT.java b/gnu/java/locale/LocaleInformation_en_MT.java index 6327c53f0..c71fe5743 100644 --- a/gnu/java/locale/LocaleInformation_en_MT.java +++ b/gnu/java/locale/LocaleInformation_en_MT.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_MT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -87,6 +87,7 @@ public class LocaleInformation_en_MT extends ListResourceBundle { { "currenciesDisplayName", currenciesDisplayName }, { "currenciesSymbol", currenciesSymbol }, + { "minNumberOfDaysInFirstWeek", "4" }, { "shortDateFormat", "dd/MM/yyyy" }, { "mediumDateFormat", "dd MMM yyyy" }, { "longDateFormat", "dd MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_en_NZ.java b/gnu/java/locale/LocaleInformation_en_NZ.java index 76e3e206e..71de1e198 100644 --- a/gnu/java/locale/LocaleInformation_en_NZ.java +++ b/gnu/java/locale/LocaleInformation_en_NZ.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_NZ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_PH.java b/gnu/java/locale/LocaleInformation_en_PH.java index 948797ed3..d712a4d02 100644 --- a/gnu/java/locale/LocaleInformation_en_PH.java +++ b/gnu/java/locale/LocaleInformation_en_PH.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_PH.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_PK.java b/gnu/java/locale/LocaleInformation_en_PK.java index 25ec5f3d5..8c71d4420 100644 --- a/gnu/java/locale/LocaleInformation_en_PK.java +++ b/gnu/java/locale/LocaleInformation_en_PK.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_PK.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_SG.java b/gnu/java/locale/LocaleInformation_en_SG.java index 769c63297..0315bac93 100644 --- a/gnu/java/locale/LocaleInformation_en_SG.java +++ b/gnu/java/locale/LocaleInformation_en_SG.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_SG.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_UM.java b/gnu/java/locale/LocaleInformation_en_UM.java index 87b9653b8..5d26e02f0 100644 --- a/gnu/java/locale/LocaleInformation_en_UM.java +++ b/gnu/java/locale/LocaleInformation_en_UM.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_UM.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_US.java b/gnu/java/locale/LocaleInformation_en_US.java index b240604fd..b686c2503 100644 --- a/gnu/java/locale/LocaleInformation_en_US.java +++ b/gnu/java/locale/LocaleInformation_en_US.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_US.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_US_POSIX.java b/gnu/java/locale/LocaleInformation_en_US_POSIX.java index c433d016e..8897f7396 100644 --- a/gnu/java/locale/LocaleInformation_en_US_POSIX.java +++ b/gnu/java/locale/LocaleInformation_en_US_POSIX.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_US_POSIX.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_VI.java b/gnu/java/locale/LocaleInformation_en_VI.java index a2d4102ce..6720ccece 100644 --- a/gnu/java/locale/LocaleInformation_en_VI.java +++ b/gnu/java/locale/LocaleInformation_en_VI.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_VI.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_ZA.java b/gnu/java/locale/LocaleInformation_en_ZA.java index 7ac52dcdb..0770e7770 100644 --- a/gnu/java/locale/LocaleInformation_en_ZA.java +++ b/gnu/java/locale/LocaleInformation_en_ZA.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_ZA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_en_ZW.java b/gnu/java/locale/LocaleInformation_en_ZW.java index c2936f1aa..9cc674eeb 100644 --- a/gnu/java/locale/LocaleInformation_en_ZW.java +++ b/gnu/java/locale/LocaleInformation_en_ZW.java @@ -1,5 +1,5 @@ /* LocaleInformation_en_ZW.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_eo.java b/gnu/java/locale/LocaleInformation_eo.java index 417180f58..6773dc7d6 100644 --- a/gnu/java/locale/LocaleInformation_eo.java +++ b/gnu/java/locale/LocaleInformation_eo.java @@ -1,5 +1,5 @@ /* LocaleInformation_eo.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -156,6 +156,8 @@ public class LocaleInformation_eo extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "yy-MM-dd" }, diff --git a/gnu/java/locale/LocaleInformation_es.java b/gnu/java/locale/LocaleInformation_es.java index e6aa49cc8..1adb6efc9 100644 --- a/gnu/java/locale/LocaleInformation_es.java +++ b/gnu/java/locale/LocaleInformation_es.java @@ -1,5 +1,5 @@ /* LocaleInformation_es.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -227,6 +227,7 @@ public class LocaleInformation_es extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "d/MM/yy" }, { "mediumDateFormat", "dd-MMM-yy" }, diff --git a/gnu/java/locale/LocaleInformation_es_AR.java b/gnu/java/locale/LocaleInformation_es_AR.java index fd6983056..d00a4f26b 100644 --- a/gnu/java/locale/LocaleInformation_es_AR.java +++ b/gnu/java/locale/LocaleInformation_es_AR.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_AR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_BO.java b/gnu/java/locale/LocaleInformation_es_BO.java index 475cdd104..e22d75926 100644 --- a/gnu/java/locale/LocaleInformation_es_BO.java +++ b/gnu/java/locale/LocaleInformation_es_BO.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_BO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_CL.java b/gnu/java/locale/LocaleInformation_es_CL.java index d89ffcd39..5eb74a04b 100644 --- a/gnu/java/locale/LocaleInformation_es_CL.java +++ b/gnu/java/locale/LocaleInformation_es_CL.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_CL.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_CO.java b/gnu/java/locale/LocaleInformation_es_CO.java index 856d1e51b..081b1afed 100644 --- a/gnu/java/locale/LocaleInformation_es_CO.java +++ b/gnu/java/locale/LocaleInformation_es_CO.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_CO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_CR.java b/gnu/java/locale/LocaleInformation_es_CR.java index 27f46e46a..2c878c65f 100644 --- a/gnu/java/locale/LocaleInformation_es_CR.java +++ b/gnu/java/locale/LocaleInformation_es_CR.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_CR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_DO.java b/gnu/java/locale/LocaleInformation_es_DO.java index 0f9ea248d..418d84d04 100644 --- a/gnu/java/locale/LocaleInformation_es_DO.java +++ b/gnu/java/locale/LocaleInformation_es_DO.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_DO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_EC.java b/gnu/java/locale/LocaleInformation_es_EC.java index ba36c9823..5e8571bfd 100644 --- a/gnu/java/locale/LocaleInformation_es_EC.java +++ b/gnu/java/locale/LocaleInformation_es_EC.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_EC.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_ES.java b/gnu/java/locale/LocaleInformation_es_ES.java index a3761a5b1..2dd49c254 100644 --- a/gnu/java/locale/LocaleInformation_es_ES.java +++ b/gnu/java/locale/LocaleInformation_es_ES.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_ES.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_GT.java b/gnu/java/locale/LocaleInformation_es_GT.java index 4cfbbe5ff..b4b5490e8 100644 --- a/gnu/java/locale/LocaleInformation_es_GT.java +++ b/gnu/java/locale/LocaleInformation_es_GT.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_GT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_HN.java b/gnu/java/locale/LocaleInformation_es_HN.java index 2c39bf333..2a11b70da 100644 --- a/gnu/java/locale/LocaleInformation_es_HN.java +++ b/gnu/java/locale/LocaleInformation_es_HN.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_HN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_MX.java b/gnu/java/locale/LocaleInformation_es_MX.java index 33a3f0b47..199b5b7c0 100644 --- a/gnu/java/locale/LocaleInformation_es_MX.java +++ b/gnu/java/locale/LocaleInformation_es_MX.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_MX.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_NI.java b/gnu/java/locale/LocaleInformation_es_NI.java index af31bde3c..5e3d0211c 100644 --- a/gnu/java/locale/LocaleInformation_es_NI.java +++ b/gnu/java/locale/LocaleInformation_es_NI.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_NI.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_PA.java b/gnu/java/locale/LocaleInformation_es_PA.java index 85ef525fb..c4ab7eaa7 100644 --- a/gnu/java/locale/LocaleInformation_es_PA.java +++ b/gnu/java/locale/LocaleInformation_es_PA.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_PA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_PE.java b/gnu/java/locale/LocaleInformation_es_PE.java index 8f5a4b22c..808391da9 100644 --- a/gnu/java/locale/LocaleInformation_es_PE.java +++ b/gnu/java/locale/LocaleInformation_es_PE.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_PE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_PR.java b/gnu/java/locale/LocaleInformation_es_PR.java index ed873bb8a..2cd7e5e69 100644 --- a/gnu/java/locale/LocaleInformation_es_PR.java +++ b/gnu/java/locale/LocaleInformation_es_PR.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_PR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_PY.java b/gnu/java/locale/LocaleInformation_es_PY.java index 67c50e314..8fd13cdcf 100644 --- a/gnu/java/locale/LocaleInformation_es_PY.java +++ b/gnu/java/locale/LocaleInformation_es_PY.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_PY.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_SV.java b/gnu/java/locale/LocaleInformation_es_SV.java index 3b2f55650..0cee80d10 100644 --- a/gnu/java/locale/LocaleInformation_es_SV.java +++ b/gnu/java/locale/LocaleInformation_es_SV.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_SV.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_US.java b/gnu/java/locale/LocaleInformation_es_US.java index bc57ad00b..0c50e95cf 100644 --- a/gnu/java/locale/LocaleInformation_es_US.java +++ b/gnu/java/locale/LocaleInformation_es_US.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_US.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -49,6 +49,8 @@ public class LocaleInformation_es_US extends ListResourceBundle { private static final Object[][] contents = { + { "minNumberOfDaysInFirstWeek", "1" }, + { "firstDayOfWeek", "sun" }, { "shortDateFormat", "M/d/yy" }, { "mediumDateFormat", "MMM d, yyyy" }, { "shortTimeFormat", "h:mm a" }, diff --git a/gnu/java/locale/LocaleInformation_es_UY.java b/gnu/java/locale/LocaleInformation_es_UY.java index 581ba8880..66c393625 100644 --- a/gnu/java/locale/LocaleInformation_es_UY.java +++ b/gnu/java/locale/LocaleInformation_es_UY.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_UY.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_es_VE.java b/gnu/java/locale/LocaleInformation_es_VE.java index f0566fee7..fb717db8b 100644 --- a/gnu/java/locale/LocaleInformation_es_VE.java +++ b/gnu/java/locale/LocaleInformation_es_VE.java @@ -1,5 +1,5 @@ /* LocaleInformation_es_VE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_et.java b/gnu/java/locale/LocaleInformation_et.java index 32341d38d..7a25150ef 100644 --- a/gnu/java/locale/LocaleInformation_et.java +++ b/gnu/java/locale/LocaleInformation_et.java @@ -1,5 +1,5 @@ /* LocaleInformation_et.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_et extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yy" }, { "mediumDateFormat", "dd.MM.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_et_EE.java b/gnu/java/locale/LocaleInformation_et_EE.java index dca3859cb..d9a85b2a8 100644 --- a/gnu/java/locale/LocaleInformation_et_EE.java +++ b/gnu/java/locale/LocaleInformation_et_EE.java @@ -1,5 +1,5 @@ /* LocaleInformation_et_EE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_eu.java b/gnu/java/locale/LocaleInformation_eu.java index ed207ee1a..21f3105ca 100644 --- a/gnu/java/locale/LocaleInformation_eu.java +++ b/gnu/java/locale/LocaleInformation_eu.java @@ -1,5 +1,5 @@ /* LocaleInformation_eu.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_eu_ES.java b/gnu/java/locale/LocaleInformation_eu_ES.java index a379e4214..7185d8e04 100644 --- a/gnu/java/locale/LocaleInformation_eu_ES.java +++ b/gnu/java/locale/LocaleInformation_eu_ES.java @@ -1,5 +1,5 @@ /* LocaleInformation_eu_ES.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ public class LocaleInformation_eu_ES extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "#,##0.00 \u00a4;-#,##0.00 \u00a4" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "yy'-'MM'-'dd" }, { "mediumDateFormat", "yy'-'MMM'-'dd" }, { "longDateFormat", "EEE, yyyy'eko' MMM'ren' dd'a'" }, diff --git a/gnu/java/locale/LocaleInformation_fa.java b/gnu/java/locale/LocaleInformation_fa.java index ff673a3ee..66af28cf4 100644 --- a/gnu/java/locale/LocaleInformation_fa.java +++ b/gnu/java/locale/LocaleInformation_fa.java @@ -1,5 +1,5 @@ /* LocaleInformation_fa.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_fa_AF.java b/gnu/java/locale/LocaleInformation_fa_AF.java index 34a66f32a..12af14a50 100644 --- a/gnu/java/locale/LocaleInformation_fa_AF.java +++ b/gnu/java/locale/LocaleInformation_fa_AF.java @@ -1,5 +1,5 @@ /* LocaleInformation_fa_AF.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -131,6 +131,7 @@ public class LocaleInformation_fa_AF extends ListResourceBundle { "currencyFormat", "#,##0 \u00a4;-#,##0 \u00a4" }, { "shortMonths", shortMonths }, { "months", months }, + { "firstDayOfWeek", "sat" }, { "zoneStrings", zoneStrings }, { "territories", territories }, { "languages", languages }, diff --git a/gnu/java/locale/LocaleInformation_fa_IR.java b/gnu/java/locale/LocaleInformation_fa_IR.java index dea9e9d47..ef92f4a30 100644 --- a/gnu/java/locale/LocaleInformation_fa_IR.java +++ b/gnu/java/locale/LocaleInformation_fa_IR.java @@ -1,5 +1,5 @@ /* LocaleInformation_fa_IR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -56,6 +56,7 @@ public class LocaleInformation_fa_IR extends ListResourceBundle { "groupingSeparator", "\u066c" }, { "percentFormat", "%#,##0" }, { "currencyFormat", "#,##0 \u00a4;\u2212#,##0 \u00a4" }, + { "firstDayOfWeek", "sat" }, }; public Object[][] getContents() { return contents; } diff --git a/gnu/java/locale/LocaleInformation_fi.java b/gnu/java/locale/LocaleInformation_fi.java index 97d81a978..d1773a575 100644 --- a/gnu/java/locale/LocaleInformation_fi.java +++ b/gnu/java/locale/LocaleInformation_fi.java @@ -1,5 +1,5 @@ /* LocaleInformation_fi.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -215,6 +215,8 @@ public class LocaleInformation_fi extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "d.M.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_fi_FI.java b/gnu/java/locale/LocaleInformation_fi_FI.java index 5fb19e17f..592e2acde 100644 --- a/gnu/java/locale/LocaleInformation_fi_FI.java +++ b/gnu/java/locale/LocaleInformation_fi_FI.java @@ -1,5 +1,5 @@ /* LocaleInformation_fi_FI.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_fo.java b/gnu/java/locale/LocaleInformation_fo.java index d08f64462..ecb7845b9 100644 --- a/gnu/java/locale/LocaleInformation_fo.java +++ b/gnu/java/locale/LocaleInformation_fo.java @@ -1,5 +1,5 @@ /* LocaleInformation_fo.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_fo_FO.java b/gnu/java/locale/LocaleInformation_fo_FO.java index ddeb8d38d..3e366e6d4 100644 --- a/gnu/java/locale/LocaleInformation_fo_FO.java +++ b/gnu/java/locale/LocaleInformation_fo_FO.java @@ -1,5 +1,5 @@ /* LocaleInformation_fo_FO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_fr.java b/gnu/java/locale/LocaleInformation_fr.java index 0294fc614..10c9eac1e 100644 --- a/gnu/java/locale/LocaleInformation_fr.java +++ b/gnu/java/locale/LocaleInformation_fr.java @@ -1,5 +1,5 @@ /* LocaleInformation_fr.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -232,6 +232,8 @@ public class LocaleInformation_fr extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "d MMM yy" }, diff --git a/gnu/java/locale/LocaleInformation_fr_BE.java b/gnu/java/locale/LocaleInformation_fr_BE.java index 8eb30a7af..3edd664a2 100644 --- a/gnu/java/locale/LocaleInformation_fr_BE.java +++ b/gnu/java/locale/LocaleInformation_fr_BE.java @@ -1,5 +1,5 @@ /* LocaleInformation_fr_BE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_fr_CA.java b/gnu/java/locale/LocaleInformation_fr_CA.java index 9f8202f19..49e4b6343 100644 --- a/gnu/java/locale/LocaleInformation_fr_CA.java +++ b/gnu/java/locale/LocaleInformation_fr_CA.java @@ -1,5 +1,5 @@ /* LocaleInformation_fr_CA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -88,6 +88,8 @@ public class LocaleInformation_fr_CA extends ListResourceBundle { "currencyFormat", "#,##0.00 \u00a4;(#,##0.00\u00a4)" }, { "currenciesDisplayName", currenciesDisplayName }, { "currenciesSymbol", currenciesSymbol }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "sun" }, { "shortDateFormat", "yy-MM-dd" }, { "mediumDateFormat", "yy-MM-dd" }, { "fullTimeFormat", "HH' h 'mm' min 'ss' s 'z" }, diff --git a/gnu/java/locale/LocaleInformation_fr_CH.java b/gnu/java/locale/LocaleInformation_fr_CH.java index 7c7247e15..3c27934ca 100644 --- a/gnu/java/locale/LocaleInformation_fr_CH.java +++ b/gnu/java/locale/LocaleInformation_fr_CH.java @@ -1,5 +1,5 @@ /* LocaleInformation_fr_CH.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_fr_LU.java b/gnu/java/locale/LocaleInformation_fr_LU.java index 4c1e1cd0c..75ccaee9a 100644 --- a/gnu/java/locale/LocaleInformation_fr_LU.java +++ b/gnu/java/locale/LocaleInformation_fr_LU.java @@ -1,5 +1,5 @@ /* LocaleInformation_fr_LU.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ga.java b/gnu/java/locale/LocaleInformation_ga.java index 586431747..1c609dca3 100644 --- a/gnu/java/locale/LocaleInformation_ga.java +++ b/gnu/java/locale/LocaleInformation_ga.java @@ -1,5 +1,5 @@ /* LocaleInformation_ga.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ga_IE.java b/gnu/java/locale/LocaleInformation_ga_IE.java index 7fb503324..d166da7c3 100644 --- a/gnu/java/locale/LocaleInformation_ga_IE.java +++ b/gnu/java/locale/LocaleInformation_ga_IE.java @@ -1,5 +1,5 @@ /* LocaleInformation_ga_IE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_gl.java b/gnu/java/locale/LocaleInformation_gl.java index fd971f69a..1e5685491 100644 --- a/gnu/java/locale/LocaleInformation_gl.java +++ b/gnu/java/locale/LocaleInformation_gl.java @@ -1,5 +1,5 @@ /* LocaleInformation_gl.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_gl_ES.java b/gnu/java/locale/LocaleInformation_gl_ES.java index 24cc34fd1..7854e97b5 100644 --- a/gnu/java/locale/LocaleInformation_gl_ES.java +++ b/gnu/java/locale/LocaleInformation_gl_ES.java @@ -1,5 +1,5 @@ /* LocaleInformation_gl_ES.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ public class LocaleInformation_gl_ES extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "#,##0.00 \u00a4;-#,##0.00 \u00a4" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "MMM dd,yy" }, { "longDateFormat", "dd MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_gu.java b/gnu/java/locale/LocaleInformation_gu.java index 91af31347..cb239feb8 100644 --- a/gnu/java/locale/LocaleInformation_gu.java +++ b/gnu/java/locale/LocaleInformation_gu.java @@ -1,5 +1,5 @@ /* LocaleInformation_gu.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_gu_IN.java b/gnu/java/locale/LocaleInformation_gu_IN.java index f4bcd09f4..d29c7774b 100644 --- a/gnu/java/locale/LocaleInformation_gu_IN.java +++ b/gnu/java/locale/LocaleInformation_gu_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_gu_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_gu_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-MM-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_gv.java b/gnu/java/locale/LocaleInformation_gv.java index efa849245..d169d8e30 100644 --- a/gnu/java/locale/LocaleInformation_gv.java +++ b/gnu/java/locale/LocaleInformation_gv.java @@ -1,5 +1,5 @@ /* LocaleInformation_gv.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_gv_GB.java b/gnu/java/locale/LocaleInformation_gv_GB.java index ba4cdfd0c..b23f565f5 100644 --- a/gnu/java/locale/LocaleInformation_gv_GB.java +++ b/gnu/java/locale/LocaleInformation_gv_GB.java @@ -1,5 +1,5 @@ /* LocaleInformation_gv_GB.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ public class LocaleInformation_gv_GB extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "\u00a4#,##0.00;-\u00a4#,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yy" }, { "mediumDateFormat", "MMM dd,yy" }, { "longDateFormat", "dd MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_he.java b/gnu/java/locale/LocaleInformation_he.java index 6b901303f..03d2c768d 100644 --- a/gnu/java/locale/LocaleInformation_he.java +++ b/gnu/java/locale/LocaleInformation_he.java @@ -1,5 +1,5 @@ /* LocaleInformation_he.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_he_IL.java b/gnu/java/locale/LocaleInformation_he_IL.java index a4f411a56..c3071b22a 100644 --- a/gnu/java/locale/LocaleInformation_he_IL.java +++ b/gnu/java/locale/LocaleInformation_he_IL.java @@ -1,5 +1,5 @@ /* LocaleInformation_he_IL.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_hi.java b/gnu/java/locale/LocaleInformation_hi.java index cac4768e0..3712cc31e 100644 --- a/gnu/java/locale/LocaleInformation_hi.java +++ b/gnu/java/locale/LocaleInformation_hi.java @@ -1,5 +1,5 @@ /* LocaleInformation_hi.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_hi_IN.java b/gnu/java/locale/LocaleInformation_hi_IN.java index d8468bac8..2a79916cf 100644 --- a/gnu/java/locale/LocaleInformation_hi_IN.java +++ b/gnu/java/locale/LocaleInformation_hi_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_hi_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_hi_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_hr.java b/gnu/java/locale/LocaleInformation_hr.java index adc7fefe1..3859f60f9 100644 --- a/gnu/java/locale/LocaleInformation_hr.java +++ b/gnu/java/locale/LocaleInformation_hr.java @@ -1,5 +1,5 @@ /* LocaleInformation_hr.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -184,6 +184,7 @@ public class LocaleInformation_hr extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "yyyy.MM.dd" }, { "mediumDateFormat", "yyyy.MM.dd" }, { "longDateFormat", "yyyy. MMMM dd" }, diff --git a/gnu/java/locale/LocaleInformation_hu.java b/gnu/java/locale/LocaleInformation_hu.java index 5cd1a5222..1e2bbe5a3 100644 --- a/gnu/java/locale/LocaleInformation_hu.java +++ b/gnu/java/locale/LocaleInformation_hu.java @@ -1,5 +1,5 @@ /* LocaleInformation_hu.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -195,6 +195,7 @@ public class LocaleInformation_hu extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "yyyy.MM.dd." }, diff --git a/gnu/java/locale/LocaleInformation_hu_HU.java b/gnu/java/locale/LocaleInformation_hu_HU.java index 524221832..5a6f5eed8 100644 --- a/gnu/java/locale/LocaleInformation_hu_HU.java +++ b/gnu/java/locale/LocaleInformation_hu_HU.java @@ -1,5 +1,5 @@ /* LocaleInformation_hu_HU.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_hy.java b/gnu/java/locale/LocaleInformation_hy.java index 1d04869f3..2e9e19bb7 100644 --- a/gnu/java/locale/LocaleInformation_hy.java +++ b/gnu/java/locale/LocaleInformation_hy.java @@ -1,5 +1,5 @@ /* LocaleInformation_hy.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -157,6 +157,7 @@ public class LocaleInformation_hy extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "MM/dd/yy" }, diff --git a/gnu/java/locale/LocaleInformation_hy_AM.java b/gnu/java/locale/LocaleInformation_hy_AM.java index d501036f6..5b77c922a 100644 --- a/gnu/java/locale/LocaleInformation_hy_AM.java +++ b/gnu/java/locale/LocaleInformation_hy_AM.java @@ -1,5 +1,5 @@ /* LocaleInformation_hy_AM.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_hy_AM_REVISED.java b/gnu/java/locale/LocaleInformation_hy_AM_REVISED.java index 4e2edb3aa..43e7b515e 100644 --- a/gnu/java/locale/LocaleInformation_hy_AM_REVISED.java +++ b/gnu/java/locale/LocaleInformation_hy_AM_REVISED.java @@ -1,5 +1,5 @@ /* LocaleInformation_hy_AM_REVISED.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_id.java b/gnu/java/locale/LocaleInformation_id.java index e312fb0a8..791b23b67 100644 --- a/gnu/java/locale/LocaleInformation_id.java +++ b/gnu/java/locale/LocaleInformation_id.java @@ -1,5 +1,5 @@ /* LocaleInformation_id.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -184,6 +184,7 @@ public class LocaleInformation_id extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "territories", territories }, { "languages", languages }, }; diff --git a/gnu/java/locale/LocaleInformation_id_ID.java b/gnu/java/locale/LocaleInformation_id_ID.java index 038c362aa..0f10d2d86 100644 --- a/gnu/java/locale/LocaleInformation_id_ID.java +++ b/gnu/java/locale/LocaleInformation_id_ID.java @@ -1,5 +1,5 @@ /* LocaleInformation_id_ID.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_is.java b/gnu/java/locale/LocaleInformation_is.java index 88372e8f3..bfc1663ca 100644 --- a/gnu/java/locale/LocaleInformation_is.java +++ b/gnu/java/locale/LocaleInformation_is.java @@ -1,5 +1,5 @@ /* LocaleInformation_is.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_is_IS.java b/gnu/java/locale/LocaleInformation_is_IS.java index e4d3a28a3..a7b9fd9d1 100644 --- a/gnu/java/locale/LocaleInformation_is_IS.java +++ b/gnu/java/locale/LocaleInformation_is_IS.java @@ -1,5 +1,5 @@ /* LocaleInformation_is_IS.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_it.java b/gnu/java/locale/LocaleInformation_it.java index 916a5fbd0..3b393c67b 100644 --- a/gnu/java/locale/LocaleInformation_it.java +++ b/gnu/java/locale/LocaleInformation_it.java @@ -1,5 +1,5 @@ /* LocaleInformation_it.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -232,6 +232,8 @@ public class LocaleInformation_it extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "dd/MM/yy" }, diff --git a/gnu/java/locale/LocaleInformation_it_CH.java b/gnu/java/locale/LocaleInformation_it_CH.java index 488fc832f..d73749aa2 100644 --- a/gnu/java/locale/LocaleInformation_it_CH.java +++ b/gnu/java/locale/LocaleInformation_it_CH.java @@ -1,5 +1,5 @@ /* LocaleInformation_it_CH.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_it_IT.java b/gnu/java/locale/LocaleInformation_it_IT.java index 3bf9457e6..17b89665f 100644 --- a/gnu/java/locale/LocaleInformation_it_IT.java +++ b/gnu/java/locale/LocaleInformation_it_IT.java @@ -1,5 +1,5 @@ /* LocaleInformation_it_IT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_iu.java b/gnu/java/locale/LocaleInformation_iu.java index 249e1ed20..9fad969ed 100644 --- a/gnu/java/locale/LocaleInformation_iu.java +++ b/gnu/java/locale/LocaleInformation_iu.java @@ -1,5 +1,5 @@ /* LocaleInformation_iu.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ja.java b/gnu/java/locale/LocaleInformation_ja.java index 1fb6dc44b..7c25b0949 100644 --- a/gnu/java/locale/LocaleInformation_ja.java +++ b/gnu/java/locale/LocaleInformation_ja.java @@ -1,5 +1,5 @@ /* LocaleInformation_ja.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ja_JP.java b/gnu/java/locale/LocaleInformation_ja_JP.java index 8567af894..aca8bd1b8 100644 --- a/gnu/java/locale/LocaleInformation_ja_JP.java +++ b/gnu/java/locale/LocaleInformation_ja_JP.java @@ -1,5 +1,5 @@ /* LocaleInformation_ja_JP.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ka.java b/gnu/java/locale/LocaleInformation_ka.java index 918956caa..318fac619 100644 --- a/gnu/java/locale/LocaleInformation_ka.java +++ b/gnu/java/locale/LocaleInformation_ka.java @@ -1,5 +1,5 @@ /* LocaleInformation_ka.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_kk.java b/gnu/java/locale/LocaleInformation_kk.java index 9ff8f80dd..c38660622 100644 --- a/gnu/java/locale/LocaleInformation_kk.java +++ b/gnu/java/locale/LocaleInformation_kk.java @@ -1,5 +1,5 @@ /* LocaleInformation_kk.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -183,6 +183,7 @@ public class LocaleInformation_kk extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd.MM.yy" }, { "mediumDateFormat", "dd.MM.yyyy" }, { "longDateFormat", "d MMMM yyyy '\u0436.'" }, diff --git a/gnu/java/locale/LocaleInformation_kk_KZ.java b/gnu/java/locale/LocaleInformation_kk_KZ.java index dce45f1cf..c84b98704 100644 --- a/gnu/java/locale/LocaleInformation_kk_KZ.java +++ b/gnu/java/locale/LocaleInformation_kk_KZ.java @@ -1,5 +1,5 @@ /* LocaleInformation_kk_KZ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_kl.java b/gnu/java/locale/LocaleInformation_kl.java index a768f94de..23a84b7d0 100644 --- a/gnu/java/locale/LocaleInformation_kl.java +++ b/gnu/java/locale/LocaleInformation_kl.java @@ -1,5 +1,5 @@ /* LocaleInformation_kl.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_kl_GL.java b/gnu/java/locale/LocaleInformation_kl_GL.java index e6eedf9aa..8ba9ae571 100644 --- a/gnu/java/locale/LocaleInformation_kl_GL.java +++ b/gnu/java/locale/LocaleInformation_kl_GL.java @@ -1,5 +1,5 @@ /* LocaleInformation_kl_GL.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_km.java b/gnu/java/locale/LocaleInformation_km.java index 1975981a1..b6cf356a1 100644 --- a/gnu/java/locale/LocaleInformation_km.java +++ b/gnu/java/locale/LocaleInformation_km.java @@ -1,5 +1,5 @@ /* LocaleInformation_km.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_km_KH.java b/gnu/java/locale/LocaleInformation_km_KH.java index 25c9c7e2f..701c4171f 100644 --- a/gnu/java/locale/LocaleInformation_km_KH.java +++ b/gnu/java/locale/LocaleInformation_km_KH.java @@ -1,5 +1,5 @@ /* LocaleInformation_km_KH.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_kn.java b/gnu/java/locale/LocaleInformation_kn.java index 38fc08621..cf43234f5 100644 --- a/gnu/java/locale/LocaleInformation_kn.java +++ b/gnu/java/locale/LocaleInformation_kn.java @@ -1,5 +1,5 @@ /* LocaleInformation_kn.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_kn_IN.java b/gnu/java/locale/LocaleInformation_kn_IN.java index 38d0b596a..08d29b7ba 100644 --- a/gnu/java/locale/LocaleInformation_kn_IN.java +++ b/gnu/java/locale/LocaleInformation_kn_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_kn_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_kn_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ko.java b/gnu/java/locale/LocaleInformation_ko.java index 549bbcee1..6227a052a 100644 --- a/gnu/java/locale/LocaleInformation_ko.java +++ b/gnu/java/locale/LocaleInformation_ko.java @@ -1,5 +1,5 @@ /* LocaleInformation_ko.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ko_KR.java b/gnu/java/locale/LocaleInformation_ko_KR.java index 4953c205d..f0930669a 100644 --- a/gnu/java/locale/LocaleInformation_ko_KR.java +++ b/gnu/java/locale/LocaleInformation_ko_KR.java @@ -1,5 +1,5 @@ /* LocaleInformation_ko_KR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_kw.java b/gnu/java/locale/LocaleInformation_kw.java index f4b98e471..6b1e4ce55 100644 --- a/gnu/java/locale/LocaleInformation_kw.java +++ b/gnu/java/locale/LocaleInformation_kw.java @@ -1,5 +1,5 @@ /* LocaleInformation_kw.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_kw_GB.java b/gnu/java/locale/LocaleInformation_kw_GB.java index c5e401fef..749c38a81 100644 --- a/gnu/java/locale/LocaleInformation_kw_GB.java +++ b/gnu/java/locale/LocaleInformation_kw_GB.java @@ -1,5 +1,5 @@ /* LocaleInformation_kw_GB.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ public class LocaleInformation_kw_GB extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "\u00a4#,##0.00;-\u00a4#,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd/MM/yyyy" }, { "mediumDateFormat", "d MMM yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ky.java b/gnu/java/locale/LocaleInformation_ky.java index e32df6385..06984b5a4 100644 --- a/gnu/java/locale/LocaleInformation_ky.java +++ b/gnu/java/locale/LocaleInformation_ky.java @@ -1,5 +1,5 @@ /* LocaleInformation_ky.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_lo.java b/gnu/java/locale/LocaleInformation_lo.java index 18aacde3f..5119da375 100644 --- a/gnu/java/locale/LocaleInformation_lo.java +++ b/gnu/java/locale/LocaleInformation_lo.java @@ -1,5 +1,5 @@ /* LocaleInformation_lo.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_lo_LA.java b/gnu/java/locale/LocaleInformation_lo_LA.java index 59a224676..54dd472c5 100644 --- a/gnu/java/locale/LocaleInformation_lo_LA.java +++ b/gnu/java/locale/LocaleInformation_lo_LA.java @@ -1,5 +1,5 @@ /* LocaleInformation_lo_LA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_lt.java b/gnu/java/locale/LocaleInformation_lt.java index bc5e6d30a..c7ae467cf 100644 --- a/gnu/java/locale/LocaleInformation_lt.java +++ b/gnu/java/locale/LocaleInformation_lt.java @@ -1,5 +1,5 @@ /* LocaleInformation_lt.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,8 @@ public class LocaleInformation_lt extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "yyyy.MM.dd" }, { "mediumDateFormat", "yyyy.MM.dd" }, diff --git a/gnu/java/locale/LocaleInformation_lt_LT.java b/gnu/java/locale/LocaleInformation_lt_LT.java index 35c7b5764..583350134 100644 --- a/gnu/java/locale/LocaleInformation_lt_LT.java +++ b/gnu/java/locale/LocaleInformation_lt_LT.java @@ -1,5 +1,5 @@ /* LocaleInformation_lt_LT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_lv.java b/gnu/java/locale/LocaleInformation_lv.java index 198bcd595..a271cc571 100644 --- a/gnu/java/locale/LocaleInformation_lv.java +++ b/gnu/java/locale/LocaleInformation_lv.java @@ -1,5 +1,5 @@ /* LocaleInformation_lv.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_lv extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "yy.d.M" }, { "mediumDateFormat", "yyyy.d.M" }, diff --git a/gnu/java/locale/LocaleInformation_lv_LV.java b/gnu/java/locale/LocaleInformation_lv_LV.java index 4e8956069..061877630 100644 --- a/gnu/java/locale/LocaleInformation_lv_LV.java +++ b/gnu/java/locale/LocaleInformation_lv_LV.java @@ -1,5 +1,5 @@ /* LocaleInformation_lv_LV.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_mk.java b/gnu/java/locale/LocaleInformation_mk.java index e7a18ab59..7fd43e036 100644 --- a/gnu/java/locale/LocaleInformation_mk.java +++ b/gnu/java/locale/LocaleInformation_mk.java @@ -1,5 +1,5 @@ /* LocaleInformation_mk.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_mk extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.M.yy" }, { "mediumDateFormat", "dd.M.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ml.java b/gnu/java/locale/LocaleInformation_ml.java index a08bf3144..171ed3739 100644 --- a/gnu/java/locale/LocaleInformation_ml.java +++ b/gnu/java/locale/LocaleInformation_ml.java @@ -1,5 +1,5 @@ /* LocaleInformation_ml.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ml_IN.java b/gnu/java/locale/LocaleInformation_ml_IN.java index 4b2b015f8..bba8266c6 100644 --- a/gnu/java/locale/LocaleInformation_ml_IN.java +++ b/gnu/java/locale/LocaleInformation_ml_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_ml_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_ml_IN extends ListResourceBundle { { "percentFormat", "#,##,##0%" }, { "currencyFormat", "\u00a4 #,##,##0.00;-\u00a4 #,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd-MM-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_mn.java b/gnu/java/locale/LocaleInformation_mn.java index 6044a17fd..31583eb3a 100644 --- a/gnu/java/locale/LocaleInformation_mn.java +++ b/gnu/java/locale/LocaleInformation_mn.java @@ -1,5 +1,5 @@ /* LocaleInformation_mn.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -155,6 +155,8 @@ public class LocaleInformation_mn extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "territories", territories }, diff --git a/gnu/java/locale/LocaleInformation_mn_MN.java b/gnu/java/locale/LocaleInformation_mn_MN.java index ab4569e47..b8585509b 100644 --- a/gnu/java/locale/LocaleInformation_mn_MN.java +++ b/gnu/java/locale/LocaleInformation_mn_MN.java @@ -1,5 +1,5 @@ /* LocaleInformation_mn_MN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_mr.java b/gnu/java/locale/LocaleInformation_mr.java index 0f549ef65..56c1a6505 100644 --- a/gnu/java/locale/LocaleInformation_mr.java +++ b/gnu/java/locale/LocaleInformation_mr.java @@ -1,5 +1,5 @@ /* LocaleInformation_mr.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_mr_IN.java b/gnu/java/locale/LocaleInformation_mr_IN.java index ec1500613..22f1a2911 100644 --- a/gnu/java/locale/LocaleInformation_mr_IN.java +++ b/gnu/java/locale/LocaleInformation_mr_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_mr_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_mr_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ms.java b/gnu/java/locale/LocaleInformation_ms.java index 131f6ca0e..0ae15bab4 100644 --- a/gnu/java/locale/LocaleInformation_ms.java +++ b/gnu/java/locale/LocaleInformation_ms.java @@ -1,5 +1,5 @@ /* LocaleInformation_ms.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -181,6 +181,7 @@ public class LocaleInformation_ms extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "territories", territories }, { "languages", languages }, }; diff --git a/gnu/java/locale/LocaleInformation_ms_BN.java b/gnu/java/locale/LocaleInformation_ms_BN.java index ce0c026f0..9d8e14962 100644 --- a/gnu/java/locale/LocaleInformation_ms_BN.java +++ b/gnu/java/locale/LocaleInformation_ms_BN.java @@ -1,5 +1,5 @@ /* LocaleInformation_ms_BN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ms_MY.java b/gnu/java/locale/LocaleInformation_ms_MY.java index 3aa6a91b3..d69813a0b 100644 --- a/gnu/java/locale/LocaleInformation_ms_MY.java +++ b/gnu/java/locale/LocaleInformation_ms_MY.java @@ -1,5 +1,5 @@ /* LocaleInformation_ms_MY.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_mt.java b/gnu/java/locale/LocaleInformation_mt.java index 4a00a795b..ae0fde7de 100644 --- a/gnu/java/locale/LocaleInformation_mt.java +++ b/gnu/java/locale/LocaleInformation_mt.java @@ -1,5 +1,5 @@ /* LocaleInformation_mt.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -191,6 +191,7 @@ public class LocaleInformation_mt extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, { "eras", eras }, { "shortDateFormat", "dd/MM/yyyy" }, { "mediumDateFormat", "dd MMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_mt_MT.java b/gnu/java/locale/LocaleInformation_mt_MT.java index 6d7271d2d..59266f8dd 100644 --- a/gnu/java/locale/LocaleInformation_mt_MT.java +++ b/gnu/java/locale/LocaleInformation_mt_MT.java @@ -1,5 +1,5 @@ /* LocaleInformation_mt_MT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_nb.java b/gnu/java/locale/LocaleInformation_nb.java index 3dc0fff81..e20953b85 100644 --- a/gnu/java/locale/LocaleInformation_nb.java +++ b/gnu/java/locale/LocaleInformation_nb.java @@ -1,5 +1,5 @@ /* LocaleInformation_nb.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -212,6 +212,8 @@ public class LocaleInformation_nb extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yy" }, { "mediumDateFormat", "d. MMM. yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_nb_NO.java b/gnu/java/locale/LocaleInformation_nb_NO.java index 29cd85654..c98216886 100644 --- a/gnu/java/locale/LocaleInformation_nb_NO.java +++ b/gnu/java/locale/LocaleInformation_nb_NO.java @@ -1,5 +1,5 @@ /* LocaleInformation_nb_NO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_nl.java b/gnu/java/locale/LocaleInformation_nl.java index e355357fc..692658df9 100644 --- a/gnu/java/locale/LocaleInformation_nl.java +++ b/gnu/java/locale/LocaleInformation_nl.java @@ -1,5 +1,5 @@ /* LocaleInformation_nl.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_nl_BE.java b/gnu/java/locale/LocaleInformation_nl_BE.java index 7523a6445..eeef2a600 100644 --- a/gnu/java/locale/LocaleInformation_nl_BE.java +++ b/gnu/java/locale/LocaleInformation_nl_BE.java @@ -1,5 +1,5 @@ /* LocaleInformation_nl_BE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,8 @@ public class LocaleInformation_nl_BE extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "#,##0.00 \u00a4;-#,##0.00 \u00a4" }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d/MM/yy" }, { "mediumDateFormat", "d-MMM-yy" }, { "shortTimeFormat", "HH:mm" }, diff --git a/gnu/java/locale/LocaleInformation_nl_NL.java b/gnu/java/locale/LocaleInformation_nl_NL.java index 885dd1a43..f7985fbe6 100644 --- a/gnu/java/locale/LocaleInformation_nl_NL.java +++ b/gnu/java/locale/LocaleInformation_nl_NL.java @@ -1,5 +1,5 @@ /* LocaleInformation_nl_NL.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_nn.java b/gnu/java/locale/LocaleInformation_nn.java index f57900970..cf84606f1 100644 --- a/gnu/java/locale/LocaleInformation_nn.java +++ b/gnu/java/locale/LocaleInformation_nn.java @@ -1,5 +1,5 @@ /* LocaleInformation_nn.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -188,6 +188,8 @@ public class LocaleInformation_nn extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yy" }, { "mediumDateFormat", "d. MMM. yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_nn_NO.java b/gnu/java/locale/LocaleInformation_nn_NO.java index 0e3b54932..06cb3f679 100644 --- a/gnu/java/locale/LocaleInformation_nn_NO.java +++ b/gnu/java/locale/LocaleInformation_nn_NO.java @@ -1,5 +1,5 @@ /* LocaleInformation_nn_NO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_om.java b/gnu/java/locale/LocaleInformation_om.java index 5e9ca0412..e769a0f85 100644 --- a/gnu/java/locale/LocaleInformation_om.java +++ b/gnu/java/locale/LocaleInformation_om.java @@ -1,5 +1,5 @@ /* LocaleInformation_om.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -186,6 +186,7 @@ public class LocaleInformation_om extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "territories", territories }, { "languages", languages }, diff --git a/gnu/java/locale/LocaleInformation_om_ET.java b/gnu/java/locale/LocaleInformation_om_ET.java index 2f26a34e2..3d78a5b40 100644 --- a/gnu/java/locale/LocaleInformation_om_ET.java +++ b/gnu/java/locale/LocaleInformation_om_ET.java @@ -1,5 +1,5 @@ /* LocaleInformation_om_ET.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_om_KE.java b/gnu/java/locale/LocaleInformation_om_KE.java index a59c08a08..24fa02cad 100644 --- a/gnu/java/locale/LocaleInformation_om_KE.java +++ b/gnu/java/locale/LocaleInformation_om_KE.java @@ -1,5 +1,5 @@ /* LocaleInformation_om_KE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_or.java b/gnu/java/locale/LocaleInformation_or.java index e15f92b63..9d4bd6934 100644 --- a/gnu/java/locale/LocaleInformation_or.java +++ b/gnu/java/locale/LocaleInformation_or.java @@ -1,5 +1,5 @@ /* LocaleInformation_or.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_or_IN.java b/gnu/java/locale/LocaleInformation_or_IN.java index f1c3d804e..aa91db3ed 100644 --- a/gnu/java/locale/LocaleInformation_or_IN.java +++ b/gnu/java/locale/LocaleInformation_or_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_or_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_or_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd-MM-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_pa.java b/gnu/java/locale/LocaleInformation_pa.java index d611b2efa..2e74ea357 100644 --- a/gnu/java/locale/LocaleInformation_pa.java +++ b/gnu/java/locale/LocaleInformation_pa.java @@ -1,5 +1,5 @@ /* LocaleInformation_pa.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_pa_IN.java b/gnu/java/locale/LocaleInformation_pa_IN.java index 191e1fcde..0d3ce2f9a 100644 --- a/gnu/java/locale/LocaleInformation_pa_IN.java +++ b/gnu/java/locale/LocaleInformation_pa_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_pa_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ public class LocaleInformation_pa_IN extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "\u00a4##,##,##0.00;-\u00a4##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_pl.java b/gnu/java/locale/LocaleInformation_pl.java index 37f39eef6..c0f6da341 100644 --- a/gnu/java/locale/LocaleInformation_pl.java +++ b/gnu/java/locale/LocaleInformation_pl.java @@ -1,5 +1,5 @@ /* LocaleInformation_pl.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_pl extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "yy-MM-dd" }, { "mediumDateFormat", "yyyy-MM-dd" }, diff --git a/gnu/java/locale/LocaleInformation_pl_PL.java b/gnu/java/locale/LocaleInformation_pl_PL.java index 4af5a4877..1f1fdd9db 100644 --- a/gnu/java/locale/LocaleInformation_pl_PL.java +++ b/gnu/java/locale/LocaleInformation_pl_PL.java @@ -1,5 +1,5 @@ /* LocaleInformation_pl_PL.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ps.java b/gnu/java/locale/LocaleInformation_ps.java index 5ac9ae552..47dca8c6b 100644 --- a/gnu/java/locale/LocaleInformation_ps.java +++ b/gnu/java/locale/LocaleInformation_ps.java @@ -1,5 +1,5 @@ /* LocaleInformation_ps.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ps_AF.java b/gnu/java/locale/LocaleInformation_ps_AF.java index 8cb2e68ee..d1db0dcc5 100644 --- a/gnu/java/locale/LocaleInformation_ps_AF.java +++ b/gnu/java/locale/LocaleInformation_ps_AF.java @@ -1,5 +1,5 @@ /* LocaleInformation_ps_AF.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -56,6 +56,7 @@ public class LocaleInformation_ps_AF extends ListResourceBundle { "decimalSeparator", "\u066b" }, { "groupingSeparator", "\u066c" }, { "currencyFormat", "#,##0 \u00a4;-#,##0 \u00a4" }, + { "firstDayOfWeek", "sat" }, }; public Object[][] getContents() { return contents; } diff --git a/gnu/java/locale/LocaleInformation_pt.java b/gnu/java/locale/LocaleInformation_pt.java index b1abc21cf..9a1064b07 100644 --- a/gnu/java/locale/LocaleInformation_pt.java +++ b/gnu/java/locale/LocaleInformation_pt.java @@ -1,5 +1,5 @@ /* LocaleInformation_pt.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -227,6 +227,7 @@ public class LocaleInformation_pt extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd-MM-yyyy" }, { "mediumDateFormat", "d/MMM/yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_pt_BR.java b/gnu/java/locale/LocaleInformation_pt_BR.java index 8f47e9b08..34ddab362 100644 --- a/gnu/java/locale/LocaleInformation_pt_BR.java +++ b/gnu/java/locale/LocaleInformation_pt_BR.java @@ -1,5 +1,5 @@ /* LocaleInformation_pt_BR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_pt_PT.java b/gnu/java/locale/LocaleInformation_pt_PT.java index 69de7e137..9efb8b202 100644 --- a/gnu/java/locale/LocaleInformation_pt_PT.java +++ b/gnu/java/locale/LocaleInformation_pt_PT.java @@ -1,5 +1,5 @@ /* LocaleInformation_pt_PT.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ro.java b/gnu/java/locale/LocaleInformation_ro.java index 81e666cd2..5e37d6044 100644 --- a/gnu/java/locale/LocaleInformation_ro.java +++ b/gnu/java/locale/LocaleInformation_ro.java @@ -1,5 +1,5 @@ /* LocaleInformation_ro.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_ro extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yyyy" }, { "mediumDateFormat", "dd.MM.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ro_RO.java b/gnu/java/locale/LocaleInformation_ro_RO.java index a0f75e880..10fb73e59 100644 --- a/gnu/java/locale/LocaleInformation_ro_RO.java +++ b/gnu/java/locale/LocaleInformation_ro_RO.java @@ -1,5 +1,5 @@ /* LocaleInformation_ro_RO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ru.java b/gnu/java/locale/LocaleInformation_ru.java index a67c2aa10..e1edec4b5 100644 --- a/gnu/java/locale/LocaleInformation_ru.java +++ b/gnu/java/locale/LocaleInformation_ru.java @@ -1,5 +1,5 @@ /* LocaleInformation_ru.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -188,6 +188,7 @@ public class LocaleInformation_ru extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yy" }, { "mediumDateFormat", "dd.MM.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_ru_RU.java b/gnu/java/locale/LocaleInformation_ru_RU.java index 2144c792e..537b243dc 100644 --- a/gnu/java/locale/LocaleInformation_ru_RU.java +++ b/gnu/java/locale/LocaleInformation_ru_RU.java @@ -1,5 +1,5 @@ /* LocaleInformation_ru_RU.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ru_UA.java b/gnu/java/locale/LocaleInformation_ru_UA.java index ee0640e6c..7507dc0d3 100644 --- a/gnu/java/locale/LocaleInformation_ru_UA.java +++ b/gnu/java/locale/LocaleInformation_ru_UA.java @@ -1,5 +1,5 @@ /* LocaleInformation_ru_UA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sa.java b/gnu/java/locale/LocaleInformation_sa.java index 8b1dccdd3..1a7f05225 100644 --- a/gnu/java/locale/LocaleInformation_sa.java +++ b/gnu/java/locale/LocaleInformation_sa.java @@ -1,5 +1,5 @@ /* LocaleInformation_sa.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sa_IN.java b/gnu/java/locale/LocaleInformation_sa_IN.java index 34e87d291..7067cd3dc 100644 --- a/gnu/java/locale/LocaleInformation_sa_IN.java +++ b/gnu/java/locale/LocaleInformation_sa_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_sa_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sk.java b/gnu/java/locale/LocaleInformation_sk.java index f178d6a8e..d753c357e 100644 --- a/gnu/java/locale/LocaleInformation_sk.java +++ b/gnu/java/locale/LocaleInformation_sk.java @@ -1,5 +1,5 @@ /* LocaleInformation_sk.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,8 @@ public class LocaleInformation_sk extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "d.M.yyyy" }, { "mediumDateFormat", "d.M.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_sk_SK.java b/gnu/java/locale/LocaleInformation_sk_SK.java index 68289c5e4..29cad0163 100644 --- a/gnu/java/locale/LocaleInformation_sk_SK.java +++ b/gnu/java/locale/LocaleInformation_sk_SK.java @@ -1,5 +1,5 @@ /* LocaleInformation_sk_SK.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sl.java b/gnu/java/locale/LocaleInformation_sl.java index 5aa6083f9..17eb7b764 100644 --- a/gnu/java/locale/LocaleInformation_sl.java +++ b/gnu/java/locale/LocaleInformation_sl.java @@ -1,5 +1,5 @@ /* LocaleInformation_sl.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_sl extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "yy.M.d" }, { "mediumDateFormat", "yyyy.M.d" }, diff --git a/gnu/java/locale/LocaleInformation_so.java b/gnu/java/locale/LocaleInformation_so.java index 435f21a82..33b838c1d 100644 --- a/gnu/java/locale/LocaleInformation_so.java +++ b/gnu/java/locale/LocaleInformation_so.java @@ -1,5 +1,5 @@ /* LocaleInformation_so.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -191,6 +191,7 @@ public class LocaleInformation_so extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "dd/MM/yy" }, diff --git a/gnu/java/locale/LocaleInformation_so_DJ.java b/gnu/java/locale/LocaleInformation_so_DJ.java index ccc84fb18..da2753c1e 100644 --- a/gnu/java/locale/LocaleInformation_so_DJ.java +++ b/gnu/java/locale/LocaleInformation_so_DJ.java @@ -1,5 +1,5 @@ /* LocaleInformation_so_DJ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_so_ET.java b/gnu/java/locale/LocaleInformation_so_ET.java index 06b46cfbd..23f80f218 100644 --- a/gnu/java/locale/LocaleInformation_so_ET.java +++ b/gnu/java/locale/LocaleInformation_so_ET.java @@ -1,5 +1,5 @@ /* LocaleInformation_so_ET.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_so_KE.java b/gnu/java/locale/LocaleInformation_so_KE.java index 0867aa700..55bc871f4 100644 --- a/gnu/java/locale/LocaleInformation_so_KE.java +++ b/gnu/java/locale/LocaleInformation_so_KE.java @@ -1,5 +1,5 @@ /* LocaleInformation_so_KE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_so_SO.java b/gnu/java/locale/LocaleInformation_so_SO.java index 384c4deab..718621f2a 100644 --- a/gnu/java/locale/LocaleInformation_so_SO.java +++ b/gnu/java/locale/LocaleInformation_so_SO.java @@ -1,5 +1,5 @@ /* LocaleInformation_so_SO.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sq.java b/gnu/java/locale/LocaleInformation_sq.java index 2bbc56b8a..04c73be93 100644 --- a/gnu/java/locale/LocaleInformation_sq.java +++ b/gnu/java/locale/LocaleInformation_sq.java @@ -1,5 +1,5 @@ /* LocaleInformation_sq.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -194,6 +194,7 @@ public class LocaleInformation_sq extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "yy-MM-dd" }, diff --git a/gnu/java/locale/LocaleInformation_sq_AL.java b/gnu/java/locale/LocaleInformation_sq_AL.java index 9f54f50ef..bd06cd2aa 100644 --- a/gnu/java/locale/LocaleInformation_sq_AL.java +++ b/gnu/java/locale/LocaleInformation_sq_AL.java @@ -1,5 +1,5 @@ /* LocaleInformation_sq_AL.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sr.java b/gnu/java/locale/LocaleInformation_sr.java index c1056cf9e..3dd90e0b6 100644 --- a/gnu/java/locale/LocaleInformation_sr.java +++ b/gnu/java/locale/LocaleInformation_sr.java @@ -1,5 +1,5 @@ /* LocaleInformation_sr.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -194,6 +194,7 @@ public class LocaleInformation_sr extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "d.M.yy." }, { "mediumDateFormat", "dd.MM.yyyy." }, diff --git a/gnu/java/locale/LocaleInformation_sr_Latn.java b/gnu/java/locale/LocaleInformation_sr_Latn.java index d1e60cf28..dd8463b9a 100644 --- a/gnu/java/locale/LocaleInformation_sr_Latn.java +++ b/gnu/java/locale/LocaleInformation_sr_Latn.java @@ -1,5 +1,5 @@ /* LocaleInformation_sr_Latn.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sv.java b/gnu/java/locale/LocaleInformation_sv.java index d90cdf7b2..33bfccded 100644 --- a/gnu/java/locale/LocaleInformation_sv.java +++ b/gnu/java/locale/LocaleInformation_sv.java @@ -1,5 +1,5 @@ /* LocaleInformation_sv.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -232,6 +232,8 @@ public class LocaleInformation_sv extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "minNumberOfDaysInFirstWeek", "4" }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "yyyy-MM-dd" }, diff --git a/gnu/java/locale/LocaleInformation_sv_FI.java b/gnu/java/locale/LocaleInformation_sv_FI.java index bbdb6722e..5798a78f9 100644 --- a/gnu/java/locale/LocaleInformation_sv_FI.java +++ b/gnu/java/locale/LocaleInformation_sv_FI.java @@ -1,5 +1,5 @@ /* LocaleInformation_sv_FI.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sv_SE.java b/gnu/java/locale/LocaleInformation_sv_SE.java index 445e12b1f..255975978 100644 --- a/gnu/java/locale/LocaleInformation_sv_SE.java +++ b/gnu/java/locale/LocaleInformation_sv_SE.java @@ -1,5 +1,5 @@ /* LocaleInformation_sv_SE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sw.java b/gnu/java/locale/LocaleInformation_sw.java index 674f120f0..b2bef458c 100644 --- a/gnu/java/locale/LocaleInformation_sw.java +++ b/gnu/java/locale/LocaleInformation_sw.java @@ -1,5 +1,5 @@ /* LocaleInformation_sw.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -191,6 +191,7 @@ public class LocaleInformation_sw extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "zoneStrings", zoneStrings }, { "territories", territories }, diff --git a/gnu/java/locale/LocaleInformation_sw_KE.java b/gnu/java/locale/LocaleInformation_sw_KE.java index 9f330b342..9577785b5 100644 --- a/gnu/java/locale/LocaleInformation_sw_KE.java +++ b/gnu/java/locale/LocaleInformation_sw_KE.java @@ -1,5 +1,5 @@ /* LocaleInformation_sw_KE.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_sw_TZ.java b/gnu/java/locale/LocaleInformation_sw_TZ.java index 154f8dfe8..8c37eff3e 100644 --- a/gnu/java/locale/LocaleInformation_sw_TZ.java +++ b/gnu/java/locale/LocaleInformation_sw_TZ.java @@ -1,5 +1,5 @@ /* LocaleInformation_sw_TZ.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ta.java b/gnu/java/locale/LocaleInformation_ta.java index dac9a712b..cff0cb756 100644 --- a/gnu/java/locale/LocaleInformation_ta.java +++ b/gnu/java/locale/LocaleInformation_ta.java @@ -1,5 +1,5 @@ /* LocaleInformation_ta.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ta_IN.java b/gnu/java/locale/LocaleInformation_ta_IN.java index 73086d678..2989d2a1a 100644 --- a/gnu/java/locale/LocaleInformation_ta_IN.java +++ b/gnu/java/locale/LocaleInformation_ta_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_ta_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_ta_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "d-M-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_te.java b/gnu/java/locale/LocaleInformation_te.java index 42acc89c0..65071bcaa 100644 --- a/gnu/java/locale/LocaleInformation_te.java +++ b/gnu/java/locale/LocaleInformation_te.java @@ -1,5 +1,5 @@ /* LocaleInformation_te.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_te_IN.java b/gnu/java/locale/LocaleInformation_te_IN.java index 0a2679b11..88906e794 100644 --- a/gnu/java/locale/LocaleInformation_te_IN.java +++ b/gnu/java/locale/LocaleInformation_te_IN.java @@ -1,5 +1,5 @@ /* LocaleInformation_te_IN.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -51,6 +51,7 @@ public class LocaleInformation_te_IN extends ListResourceBundle { { "percentFormat", "##,##,##0%" }, { "currencyFormat", "\u00a4 ##,##,##0.00;-\u00a4 ##,##,##0.00" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd-MM-yy" }, { "mediumDateFormat", "dd-MM-yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_th.java b/gnu/java/locale/LocaleInformation_th.java index ecf6ff62b..1c20e6093 100644 --- a/gnu/java/locale/LocaleInformation_th.java +++ b/gnu/java/locale/LocaleInformation_th.java @@ -1,5 +1,5 @@ /* LocaleInformation_th.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_th_TH.java b/gnu/java/locale/LocaleInformation_th_TH.java index 8de8b0760..f08b0f56c 100644 --- a/gnu/java/locale/LocaleInformation_th_TH.java +++ b/gnu/java/locale/LocaleInformation_th_TH.java @@ -1,5 +1,5 @@ /* LocaleInformation_th_TH.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ti.java b/gnu/java/locale/LocaleInformation_ti.java index d5bed521e..ef7ad8b2c 100644 --- a/gnu/java/locale/LocaleInformation_ti.java +++ b/gnu/java/locale/LocaleInformation_ti.java @@ -1,5 +1,5 @@ /* LocaleInformation_ti.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -153,6 +153,7 @@ public class LocaleInformation_ti extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "ampms", ampms }, { "territories", territories }, diff --git a/gnu/java/locale/LocaleInformation_ti_ER.java b/gnu/java/locale/LocaleInformation_ti_ER.java index ff1669ddc..43ae1a103 100644 --- a/gnu/java/locale/LocaleInformation_ti_ER.java +++ b/gnu/java/locale/LocaleInformation_ti_ER.java @@ -1,5 +1,5 @@ /* LocaleInformation_ti_ER.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ti_ET.java b/gnu/java/locale/LocaleInformation_ti_ET.java index 643fba625..b3f20e1bb 100644 --- a/gnu/java/locale/LocaleInformation_ti_ET.java +++ b/gnu/java/locale/LocaleInformation_ti_ET.java @@ -1,5 +1,5 @@ /* LocaleInformation_ti_ET.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_tr.java b/gnu/java/locale/LocaleInformation_tr.java index 968978c79..9a63bf981 100644 --- a/gnu/java/locale/LocaleInformation_tr.java +++ b/gnu/java/locale/LocaleInformation_tr.java @@ -1,5 +1,5 @@ /* LocaleInformation_tr.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -190,6 +190,7 @@ public class LocaleInformation_tr extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yyyy" }, { "mediumDateFormat", "dd.MMM.yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_tr_TR.java b/gnu/java/locale/LocaleInformation_tr_TR.java index 4e80397b5..ff701e302 100644 --- a/gnu/java/locale/LocaleInformation_tr_TR.java +++ b/gnu/java/locale/LocaleInformation_tr_TR.java @@ -1,5 +1,5 @@ /* LocaleInformation_tr_TR.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_tt.java b/gnu/java/locale/LocaleInformation_tt.java index 7d8c984d5..660a5126c 100644 --- a/gnu/java/locale/LocaleInformation_tt.java +++ b/gnu/java/locale/LocaleInformation_tt.java @@ -1,5 +1,5 @@ /* LocaleInformation_tt.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_tt_RU.java b/gnu/java/locale/LocaleInformation_tt_RU.java index a512b9e2a..1b754260b 100644 --- a/gnu/java/locale/LocaleInformation_tt_RU.java +++ b/gnu/java/locale/LocaleInformation_tt_RU.java @@ -1,5 +1,5 @@ /* LocaleInformation_tt_RU.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -50,6 +50,7 @@ public class LocaleInformation_tt_RU extends ListResourceBundle private static final Object[][] contents = { { "currencyFormat", "#,##0.00\u00a4;-#,##0.00\u00a4" }, + { "firstDayOfWeek", "mon" }, { "shortDateFormat", "dd.MM.yyyy" }, { "mediumDateFormat", "dd.MM.yyyy" }, { "longDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_uk.java b/gnu/java/locale/LocaleInformation_uk.java index 0fa709052..095d0eaf1 100644 --- a/gnu/java/locale/LocaleInformation_uk.java +++ b/gnu/java/locale/LocaleInformation_uk.java @@ -1,5 +1,5 @@ /* LocaleInformation_uk.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -189,6 +189,7 @@ public class LocaleInformation_uk extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "shortDateFormat", "dd.MM.yy" }, { "mediumDateFormat", "d MMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_uk_UA.java b/gnu/java/locale/LocaleInformation_uk_UA.java index 18978af9b..eda269399 100644 --- a/gnu/java/locale/LocaleInformation_uk_UA.java +++ b/gnu/java/locale/LocaleInformation_uk_UA.java @@ -1,5 +1,5 @@ /* LocaleInformation_uk_UA.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_ur.java b/gnu/java/locale/LocaleInformation_ur.java index 349d266b9..00ae5e56d 100644 --- a/gnu/java/locale/LocaleInformation_ur.java +++ b/gnu/java/locale/LocaleInformation_ur.java @@ -1,5 +1,5 @@ /* LocaleInformation_ur.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_uz.java b/gnu/java/locale/LocaleInformation_uz.java index cfba56f77..5d2521722 100644 --- a/gnu/java/locale/LocaleInformation_uz.java +++ b/gnu/java/locale/LocaleInformation_uz.java @@ -1,5 +1,5 @@ /* LocaleInformation_uz.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_uz_AF.java b/gnu/java/locale/LocaleInformation_uz_AF.java index d8ca3e208..233cc1907 100644 --- a/gnu/java/locale/LocaleInformation_uz_AF.java +++ b/gnu/java/locale/LocaleInformation_uz_AF.java @@ -1,5 +1,5 @@ /* LocaleInformation_uz_AF.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -198,6 +198,7 @@ public class LocaleInformation_uz_AF extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "sat" }, { "eras", eras }, { "shortDateFormat", "yyyy/M/d" }, { "mediumDateFormat", "d MMMM yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_vi.java b/gnu/java/locale/LocaleInformation_vi.java index cca6aa25b..4b5f0ab5a 100644 --- a/gnu/java/locale/LocaleInformation_vi.java +++ b/gnu/java/locale/LocaleInformation_vi.java @@ -1,5 +1,5 @@ /* LocaleInformation_vi.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -194,6 +194,7 @@ public class LocaleInformation_vi extends ListResourceBundle { "months", months }, { "shortWeekdays", shortWeekdays }, { "weekdays", weekdays }, + { "firstDayOfWeek", "mon" }, { "eras", eras }, { "ampms", ampms }, { "shortDateFormat", "dd/MM/yyyy" }, diff --git a/gnu/java/locale/LocaleInformation_zh.java b/gnu/java/locale/LocaleInformation_zh.java index 9c7a2e290..479d10c4b 100644 --- a/gnu/java/locale/LocaleInformation_zh.java +++ b/gnu/java/locale/LocaleInformation_zh.java @@ -1,5 +1,5 @@ /* LocaleInformation_zh.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_zh_CN_Hans.java b/gnu/java/locale/LocaleInformation_zh_CN_Hans.java index 0e9bdfaf1..019f20ced 100644 --- a/gnu/java/locale/LocaleInformation_zh_CN_Hans.java +++ b/gnu/java/locale/LocaleInformation_zh_CN_Hans.java @@ -1,5 +1,5 @@ /* LocaleInformation_zh_CN_Hans.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_zh_HK_Hant.java b/gnu/java/locale/LocaleInformation_zh_HK_Hant.java index ccedc9fa7..a209453c4 100644 --- a/gnu/java/locale/LocaleInformation_zh_HK_Hant.java +++ b/gnu/java/locale/LocaleInformation_zh_HK_Hant.java @@ -1,5 +1,5 @@ /* LocaleInformation_zh_HK_Hant.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_zh_Hant.java b/gnu/java/locale/LocaleInformation_zh_Hant.java index 45b095dd4..33e90c4e2 100644 --- a/gnu/java/locale/LocaleInformation_zh_Hant.java +++ b/gnu/java/locale/LocaleInformation_zh_Hant.java @@ -1,5 +1,5 @@ /* LocaleInformation_zh_Hant.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_zh_MO_Hant.java b/gnu/java/locale/LocaleInformation_zh_MO_Hant.java index 44fa6be09..f23db80e7 100644 --- a/gnu/java/locale/LocaleInformation_zh_MO_Hant.java +++ b/gnu/java/locale/LocaleInformation_zh_MO_Hant.java @@ -1,5 +1,5 @@ /* LocaleInformation_zh_MO_Hant.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_zh_SG_Hans.java b/gnu/java/locale/LocaleInformation_zh_SG_Hans.java index c009ba6b9..443927b15 100644 --- a/gnu/java/locale/LocaleInformation_zh_SG_Hans.java +++ b/gnu/java/locale/LocaleInformation_zh_SG_Hans.java @@ -1,5 +1,5 @@ /* LocaleInformation_zh_SG_Hans.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/LocaleInformation_zh_TW_Hant.java b/gnu/java/locale/LocaleInformation_zh_TW_Hant.java index 293e4638f..247ad5972 100644 --- a/gnu/java/locale/LocaleInformation_zh_TW_Hant.java +++ b/gnu/java/locale/LocaleInformation_zh_TW_Hant.java @@ -1,5 +1,5 @@ /* LocaleInformation_zh_TW_Hant.java -- - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/locale/package.html b/gnu/java/locale/package.html new file mode 100644 index 000000000..b63a101f0 --- /dev/null +++ b/gnu/java/locale/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.locale package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.locale</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/math/package.html b/gnu/java/math/package.html new file mode 100644 index 000000000..73fa2e5f5 --- /dev/null +++ b/gnu/java/math/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.math package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.math</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/net/BASE64.java b/gnu/java/net/BASE64.java index e711bb6e8..2b997e38a 100644 --- a/gnu/java/net/BASE64.java +++ b/gnu/java/net/BASE64.java @@ -1,5 +1,5 @@ /* BASE.java -- - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -109,6 +109,12 @@ public final class BASE64 bt[ti++] = src[b3 & 0x3f]; } } + if (ti < bt.length) + { + byte[] tmp = new byte[ti]; + System.arraycopy(bt, 0, tmp, 0, ti); + bt = tmp; + } /*while (ti < bt.length) { bt[ti++] = 0x3d; diff --git a/gnu/java/net/CRLFInputStream.java b/gnu/java/net/CRLFInputStream.java index 706c23447..9bfb50db6 100644 --- a/gnu/java/net/CRLFInputStream.java +++ b/gnu/java/net/CRLFInputStream.java @@ -39,8 +39,8 @@ exception statement from your version. */ package gnu.java.net; import java.io.FilterInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; /** * An input stream that filters out CR/LF pairs into LFs. diff --git a/gnu/java/net/EmptyX509TrustManager.java b/gnu/java/net/EmptyX509TrustManager.java index c7e9055a3..18d433b53 100644 --- a/gnu/java/net/EmptyX509TrustManager.java +++ b/gnu/java/net/EmptyX509TrustManager.java @@ -40,6 +40,7 @@ package gnu.java.net; import java.security.cert.CertificateException; import java.security.cert.X509Certificate; + import javax.net.ssl.X509TrustManager; /** diff --git a/gnu/java/net/HeaderFieldHelper.java b/gnu/java/net/HeaderFieldHelper.java index 2bcfd17fd..7c78e69c5 100644 --- a/gnu/java/net/HeaderFieldHelper.java +++ b/gnu/java/net/HeaderFieldHelper.java @@ -45,7 +45,7 @@ import java.util.Vector; /** * This class manages header field keys and values. * - * @author Aaron M. Renn <arenn@urbanophile.com> + * @author Aaron M. Renn (arenn@urbanophile.com) */ public class HeaderFieldHelper { diff --git a/gnu/java/net/LineInputStream.java b/gnu/java/net/LineInputStream.java index 491e6f78e..5028fe480 100644 --- a/gnu/java/net/LineInputStream.java +++ b/gnu/java/net/LineInputStream.java @@ -40,8 +40,8 @@ package gnu.java.net; import java.io.ByteArrayOutputStream; import java.io.FilterInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; /** * An input stream that can read lines of input. diff --git a/gnu/java/net/PlainSocketImpl.java b/gnu/java/net/PlainSocketImpl.java index 2b2bb1e59..07bbaeee3 100644 --- a/gnu/java/net/PlainSocketImpl.java +++ b/gnu/java/net/PlainSocketImpl.java @@ -39,8 +39,10 @@ exception statement from your version. */ package gnu.java.net; -import java.io.InputStream; +import gnu.classpath.Configuration; + import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; @@ -48,7 +50,6 @@ import java.net.SocketAddress; import java.net.SocketException; import java.net.SocketImpl; import java.net.SocketOptions; -import gnu.classpath.Configuration; /** * Written using on-line Java Platform 1.2 API Specification, as well @@ -62,9 +63,9 @@ import gnu.classpath.Configuration; * combination of Java and native routines to implement standard BSD * style sockets of family AF_INET and types SOCK_STREAM and SOCK_DGRAM * - * @author Per Bothner <bothner@cygnus.com> - * @author Nic Ferrier <nferrier@tapsellferrier.co.uk> - * @author Aaron M. Renn <arenn@urbanophile.com> + * @author Per Bothner (bothner@cygnus.com) + * @author Nic Ferrier (nferrier@tapsellferrier.co.uk) + * @author Aaron M. Renn (arenn@urbanophile.com) */ public final class PlainSocketImpl extends SocketImpl { @@ -379,7 +380,7 @@ public final class PlainSocketImpl extends SocketImpl * This class contains an implementation of <code>InputStream</code> for * sockets. It in an internal only class used by <code>PlainSocketImpl</code>. * - * @author Nic Ferrier <nferrier@tapsellferrier.co.uk> + * @author Nic Ferrier (nferrier@tapsellferrier.co.uk) */ final class SocketInputStream extends InputStream @@ -449,7 +450,7 @@ public final class PlainSocketImpl extends SocketImpl * <code>getOutputStream method</code>. It expects only to be used in that * context. * - * @author Nic Ferrier <nferrier@tapsellferrier.co.uk> + * @author Nic Ferrier (nferrier@tapsellferrier.co.uk) */ final class SocketOutputStream extends OutputStream diff --git a/gnu/java/net/URLParseError.java b/gnu/java/net/URLParseError.java index 95eed65dd..7cb105fb3 100644 --- a/gnu/java/net/URLParseError.java +++ b/gnu/java/net/URLParseError.java @@ -46,7 +46,7 @@ package gnu.java.net; * The main drawback is that it uses the Error mechanism which should not * be used for that type of error reporting. * - * @author Guilhem Lavaux <guilhem@kaffe.org> + * @author Guilhem Lavaux (guilhem@kaffe.org) */ public class URLParseError extends Error { diff --git a/gnu/java/net/package.html b/gnu/java/net/package.html new file mode 100644 index 000000000..d0a4c8924 --- /dev/null +++ b/gnu/java/net/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.net package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.net</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/net/protocol/file/Connection.java b/gnu/java/net/protocol/file/Connection.java index 3a37def99..05611e24d 100644 --- a/gnu/java/net/protocol/file/Connection.java +++ b/gnu/java/net/protocol/file/Connection.java @@ -33,7 +33,7 @@ module. An independent module is a module which is not derived from or based on this library. If you modify this library, you may extend this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this -exception statement from your version. */ +exception statement from your version. */ package gnu.java.net.protocol.file; @@ -42,13 +42,16 @@ import gnu.classpath.SystemProperties; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; import java.io.ByteArrayInputStream; +import java.io.ByteArrayOutputStream; import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.FilePermission; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; +import java.io.OutputStreamWriter; +import java.io.Writer; import java.net.ProtocolException; import java.net.URL; import java.net.URLConnection; @@ -61,9 +64,9 @@ import java.util.Locale; * This subclass of java.net.URLConnection models a URLConnection via * the "file" protocol. * - * @author Aaron M. Renn <arenn@urbanophile.com> - * @author Nic Ferrier <nferrier@tapsellferrier.co.uk> - * @author Warren Levy <warrenl@cygnus.com> + * @author Aaron M. Renn (arenn@urbanophile.com) + * @author Nic Ferrier (nferrier@tapsellferrier.co.uk) + * @author Warren Levy (warrenl@cygnus.com) */ public class Connection extends URLConnection { @@ -92,6 +95,11 @@ public class Connection extends URLConnection private File file; /** + * If a directory, contains a list of files in the directory. + */ + private byte[] directoryListing; + + /** * InputStream if we are reading from the file */ private InputStream inputStream; @@ -140,13 +148,7 @@ public class Connection extends URLConnection { if (doInput) { - StringBuffer sb = new StringBuffer(); - String[] files = file.list(); - - for (int index = 0; index < files.length; ++index) - sb.append(files[index]).append(StaticData.lineSeparator); - - inputStream = new ByteArrayInputStream(sb.toString().getBytes()); + inputStream = new ByteArrayInputStream(getDirectoryListing()); } if (doOutput) @@ -156,6 +158,32 @@ public class Connection extends URLConnection connected = true; } + + /** + * Populates the <code>directoryListing</code> field with a byte array + * containing a representation of the directory listing. + */ + byte[] getDirectoryListing() + throws IOException + { + if (directoryListing == null) + { + ByteArrayOutputStream sink = new ByteArrayOutputStream(); + // NB uses default character encoding for this system + Writer writer = new OutputStreamWriter(sink); + + String[] files = file.list(); + + for (int i = 0; i < files.length; i++) + { + writer.write(files[i]); + writer.write(StaticData.lineSeparator); + } + + directoryListing = sink.toByteArray(); + } + return directoryListing; + } /** * Opens the file for reading and returns a stream for it. @@ -229,7 +257,13 @@ public class Connection extends URLConnection if (field.equals("content-type")) return guessContentTypeFromName(file.getName()); else if (field.equals("content-length")) - return Long.toString(file.length()); + { + if (file.isDirectory()) + { + return Integer.toString(getContentLength()); + } + return Long.toString(file.length()); + } else if (field.equals("last-modified")) { synchronized (StaticData.dateFormat) @@ -258,6 +292,10 @@ public class Connection extends URLConnection if (!connected) connect(); + if (file.isDirectory()) + { + return getDirectoryListing().length; + } return (int) file.length(); } catch (IOException e) diff --git a/gnu/java/net/protocol/file/Handler.java b/gnu/java/net/protocol/file/Handler.java index 18f91720e..fe3fafa7c 100644 --- a/gnu/java/net/protocol/file/Handler.java +++ b/gnu/java/net/protocol/file/Handler.java @@ -49,7 +49,7 @@ import java.net.URLStreamHandler; * this package). All other methods are inherited * * @author Aaron M. Renn (arenn@urbanophile.com) - * @author Warren Levy <warrenl@cygnus.com> + * @author Warren Levy (warrenl@cygnus.com) */ public class Handler extends URLStreamHandler { diff --git a/gnu/java/net/protocol/file/package.html b/gnu/java/net/protocol/file/package.html new file mode 100644 index 000000000..81f5faaa5 --- /dev/null +++ b/gnu/java/net/protocol/file/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.net.protocol.file package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.net.protocol.file</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/net/protocol/ftp/ActiveModeDTP.java b/gnu/java/net/protocol/ftp/ActiveModeDTP.java index ab387e4a9..5e38bfdbd 100644 --- a/gnu/java/net/protocol/ftp/ActiveModeDTP.java +++ b/gnu/java/net/protocol/ftp/ActiveModeDTP.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.net.protocol.ftp; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.ServerSocket; diff --git a/gnu/java/net/protocol/ftp/BlockInputStream.java b/gnu/java/net/protocol/ftp/BlockInputStream.java index f72d8df25..882e79aee 100644 --- a/gnu/java/net/protocol/ftp/BlockInputStream.java +++ b/gnu/java/net/protocol/ftp/BlockInputStream.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.net.protocol.ftp; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; /** * A DTP input stream that implements the FTP block transfer mode. diff --git a/gnu/java/net/protocol/ftp/CompressedInputStream.java b/gnu/java/net/protocol/ftp/CompressedInputStream.java index 4e2eb7176..8a5a34a24 100644 --- a/gnu/java/net/protocol/ftp/CompressedInputStream.java +++ b/gnu/java/net/protocol/ftp/CompressedInputStream.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.net.protocol.ftp; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.net.ProtocolException; /** diff --git a/gnu/java/net/protocol/ftp/DTP.java b/gnu/java/net/protocol/ftp/DTP.java index 54016b8a4..6c9089710 100644 --- a/gnu/java/net/protocol/ftp/DTP.java +++ b/gnu/java/net/protocol/ftp/DTP.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.net.protocol.ftp; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; /** diff --git a/gnu/java/net/protocol/ftp/DTPInputStream.java b/gnu/java/net/protocol/ftp/DTPInputStream.java index 73b6aa635..a9df39087 100644 --- a/gnu/java/net/protocol/ftp/DTPInputStream.java +++ b/gnu/java/net/protocol/ftp/DTPInputStream.java @@ -39,8 +39,8 @@ exception statement from your version. */ package gnu.java.net.protocol.ftp; import java.io.FilterInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; /** * An input stream that notifies a DTP on completion. diff --git a/gnu/java/net/protocol/ftp/FTPConnection.java b/gnu/java/net/protocol/ftp/FTPConnection.java index 2c1237349..5ead9c814 100644 --- a/gnu/java/net/protocol/ftp/FTPConnection.java +++ b/gnu/java/net/protocol/ftp/FTPConnection.java @@ -45,8 +45,8 @@ import gnu.java.net.LineInputStream; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.BindException; import java.net.InetAddress; diff --git a/gnu/java/net/protocol/ftp/FTPURLConnection.java b/gnu/java/net/protocol/ftp/FTPURLConnection.java index 368c035c3..efc6f635b 100644 --- a/gnu/java/net/protocol/ftp/FTPURLConnection.java +++ b/gnu/java/net/protocol/ftp/FTPURLConnection.java @@ -44,8 +44,8 @@ import gnu.java.security.action.GetPropertyAction; import java.io.FileNotFoundException; import java.io.FilterInputStream; import java.io.FilterOutputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.URL; diff --git a/gnu/java/net/protocol/ftp/PassiveModeDTP.java b/gnu/java/net/protocol/ftp/PassiveModeDTP.java index c08eb5ca1..495a59d73 100644 --- a/gnu/java/net/protocol/ftp/PassiveModeDTP.java +++ b/gnu/java/net/protocol/ftp/PassiveModeDTP.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.net.protocol.ftp; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.InetAddress; import java.net.InetSocketAddress; diff --git a/gnu/java/net/protocol/ftp/StreamInputStream.java b/gnu/java/net/protocol/ftp/StreamInputStream.java index 0ee8857f8..0efd2ffc9 100644 --- a/gnu/java/net/protocol/ftp/StreamInputStream.java +++ b/gnu/java/net/protocol/ftp/StreamInputStream.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.net.protocol.ftp; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; /** * A DTP input stream that implements the FTP stream data transfer mode. diff --git a/gnu/java/net/protocol/http/ChunkedInputStream.java b/gnu/java/net/protocol/http/ChunkedInputStream.java index cb051bf71..cd4a88d9f 100644 --- a/gnu/java/net/protocol/http/ChunkedInputStream.java +++ b/gnu/java/net/protocol/http/ChunkedInputStream.java @@ -39,8 +39,8 @@ exception statement from your version. */ package gnu.java.net.protocol.http; import java.io.FilterInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.net.ProtocolException; /** diff --git a/gnu/java/net/protocol/http/HTTPConnection.java b/gnu/java/net/protocol/http/HTTPConnection.java index 4dee4a226..1a5ce79bb 100644 --- a/gnu/java/net/protocol/http/HTTPConnection.java +++ b/gnu/java/net/protocol/http/HTTPConnection.java @@ -39,16 +39,16 @@ exception statement from your version. */ package gnu.java.net.protocol.http; import gnu.classpath.Configuration; +import gnu.java.net.EmptyX509TrustManager; import gnu.java.net.protocol.http.event.ConnectionEvent; import gnu.java.net.protocol.http.event.ConnectionListener; import gnu.java.net.protocol.http.event.RequestEvent; import gnu.java.net.protocol.http.event.RequestListener; -import gnu.java.net.EmptyX509TrustManager; import java.io.BufferedInputStream; import java.io.BufferedOutputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.InetSocketAddress; import java.net.Socket; @@ -58,6 +58,7 @@ import java.util.HashMap; import java.util.Iterator; import java.util.List; import java.util.Map; + import javax.net.ssl.HandshakeCompletedListener; import javax.net.ssl.SSLContext; import javax.net.ssl.SSLSocket; diff --git a/gnu/java/net/protocol/http/HTTPURLConnection.java b/gnu/java/net/protocol/http/HTTPURLConnection.java index b289860eb..2938dfc95 100644 --- a/gnu/java/net/protocol/http/HTTPURLConnection.java +++ b/gnu/java/net/protocol/http/HTTPURLConnection.java @@ -40,19 +40,20 @@ package gnu.java.net.protocol.http; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.ProtocolException; import java.net.URL; import java.security.AccessController; import java.security.PrivilegedAction; import java.security.cert.Certificate; -import java.util.Date; import java.util.Collections; +import java.util.Date; import java.util.Iterator; import java.util.LinkedHashMap; import java.util.Map; + import javax.net.ssl.HandshakeCompletedEvent; import javax.net.ssl.HandshakeCompletedListener; import javax.net.ssl.HostnameVerifier; diff --git a/gnu/java/net/protocol/http/Headers.java b/gnu/java/net/protocol/http/Headers.java index e56139f02..0db9a552a 100644 --- a/gnu/java/net/protocol/http/Headers.java +++ b/gnu/java/net/protocol/http/Headers.java @@ -40,8 +40,8 @@ package gnu.java.net.protocol.http; import gnu.java.net.LineInputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.text.DateFormat; import java.text.ParseException; import java.util.Collection; diff --git a/gnu/java/net/protocol/http/Request.java b/gnu/java/net/protocol/http/Request.java index 62a1a535a..53e08c556 100644 --- a/gnu/java/net/protocol/http/Request.java +++ b/gnu/java/net/protocol/http/Request.java @@ -38,12 +38,12 @@ exception statement from your version. */ package gnu.java.net.protocol.http; -import gnu.java.net.protocol.http.event.RequestEvent; import gnu.java.net.BASE64; import gnu.java.net.LineInputStream; +import gnu.java.net.protocol.http.event.RequestEvent; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.OutputStream; import java.net.ProtocolException; import java.security.MessageDigest; diff --git a/gnu/java/net/protocol/http/event/package.html b/gnu/java/net/protocol/http/event/package.html new file mode 100644 index 000000000..6ee147a36 --- /dev/null +++ b/gnu/java/net/protocol/http/event/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.net.protocol.http.event package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.net.protocol.http.event</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/locale/Calendar_de.java b/gnu/java/net/protocol/https/Handler.java index 9cf9fc0df..ec1962f1f 100644 --- a/gnu/java/locale/Calendar_de.java +++ b/gnu/java/net/protocol/https/Handler.java @@ -1,5 +1,5 @@ -/* Calendar_de.java -- German calendar locale data - Copyright (C) 1999 Free Software Foundation, Inc. +/* Handler.java -- + Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -36,36 +36,41 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -package gnu.java.locale; +package gnu.java.net.protocol.https; -import java.util.Calendar; -import java.util.ListResourceBundle; +import java.io.IOException; +import java.net.URL; +import java.net.URLConnection; +import java.net.URLStreamHandler; + +import gnu.java.net.protocol.http.HTTPConnection; +import gnu.java.net.protocol.http.HTTPURLConnection; /** - * This class contains locale data for java.util.Calendar specific for - * german language. - * @author Jochen Hoenicke + * An HTTPS URL stream handler. + * + * @author Chris Burdess (dog@gnu.org) */ -public class Calendar_de extends ListResourceBundle +public class Handler + extends URLStreamHandler { + /** - * This is the object array used to hold the keys and values - * for this bundle + * Returns the default HTTPS port (443). */ - private static final Object[][] contents = + protected int getDefaultPort() { - { "firstDayOfWeek", new Integer(Calendar.MONDAY) }, - { "minimalDaysInFirstWeek", new Integer(4) }, - }; + return HTTPConnection.HTTPS_PORT; + } /** - * This method returns the object array of key, value pairs containing - * the data for this bundle. - * - * @return The key, value information. + * Returns an HTTPURLConnection for the given URL. */ - public Object[][] getContents() + public URLConnection openConnection(URL url) + throws IOException { - return contents; + return new HTTPURLConnection(url); } + } + diff --git a/gnu/java/net/protocol/jar/Connection.java b/gnu/java/net/protocol/jar/Connection.java index 75760120d..966aad277 100644 --- a/gnu/java/net/protocol/jar/Connection.java +++ b/gnu/java/net/protocol/jar/Connection.java @@ -40,8 +40,8 @@ package gnu.java.net.protocol.jar; import java.io.File; import java.io.FileOutputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.net.JarURLConnection; import java.net.MalformedURLException; import java.net.ProtocolException; @@ -56,7 +56,7 @@ import java.util.zip.ZipFile; * This subclass of java.net.JarURLConnection models a URLConnection via * the "jar" protocol. * - * @author Kresten Krab Thorup <krab@gnu.org> + * @author Kresten Krab Thorup (krab@gnu.org) */ public final class Connection extends JarURLConnection { diff --git a/gnu/java/net/protocol/jar/Handler.java b/gnu/java/net/protocol/jar/Handler.java index fc4223d46..726eb4404 100644 --- a/gnu/java/net/protocol/jar/Handler.java +++ b/gnu/java/net/protocol/jar/Handler.java @@ -39,6 +39,7 @@ exception statement from your version. */ package gnu.java.net.protocol.jar; import gnu.java.net.URLParseError; + import java.io.IOException; import java.net.MalformedURLException; import java.net.URL; @@ -46,7 +47,7 @@ import java.net.URLConnection; import java.net.URLStreamHandler; /** - * @author Kresten Krab Thorup <krab@gnu.org> + * @author Kresten Krab Thorup (krab@gnu.org) */ public class Handler extends URLStreamHandler { diff --git a/gnu/java/net/protocol/jar/package.html b/gnu/java/net/protocol/jar/package.html new file mode 100644 index 000000000..90571965f --- /dev/null +++ b/gnu/java/net/protocol/jar/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.net.protocol.jar package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.net.protocol.jar</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/nio/ChannelInputStream.java b/gnu/java/nio/ChannelInputStream.java index 4cf4875c3..b7b1974cf 100644 --- a/gnu/java/nio/ChannelInputStream.java +++ b/gnu/java/nio/ChannelInputStream.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.nio; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.IllegalBlockingModeException; import java.nio.channels.ReadableByteChannel; diff --git a/gnu/java/nio/ChannelOutputStream.java b/gnu/java/nio/ChannelOutputStream.java index 96dc76106..73fd7dc3c 100644 --- a/gnu/java/nio/ChannelOutputStream.java +++ b/gnu/java/nio/ChannelOutputStream.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.nio; -import java.io.OutputStream; import java.io.IOException; +import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.channels.WritableByteChannel; diff --git a/gnu/java/nio/ChannelReader.java b/gnu/java/nio/ChannelReader.java new file mode 100644 index 000000000..11e66a77e --- /dev/null +++ b/gnu/java/nio/ChannelReader.java @@ -0,0 +1,211 @@ +/* ChannelReader.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + + This file is part of GNU Classpath. + + GNU Classpath 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 2, or (at your option) + any later version. + + GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the + Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + 02111-1307 USA. + + Linking this library statically or dynamically with other modules is + making a combined work based on this library. Thus, the terms and + conditions of the GNU General Public License cover the whole + combination. + + As a special exception, the copyright holders of this library give you + permission to link this library with independent modules to produce an + executable, regardless of the license terms of these independent + modules, and to copy and distribute the resulting executable under + terms of your choice, provided that you also meet, for each linked + independent module, the terms and conditions of the license of that + module. An independent module is a module which is not derived from + or based on this library. If you modify this library, you may extend + this exception to your version of the library, but you are not + obligated to do so. If you do not wish to do so, delete this + exception statement from your version. */ + + +package gnu.java.nio; + +import java.io.IOException; +import java.io.Reader; +import java.nio.ByteBuffer; +import java.nio.CharBuffer; +import java.nio.channels.ReadableByteChannel; +import java.nio.charset.CharsetDecoder; +import java.nio.charset.CoderResult; +import java.nio.charset.CodingErrorAction; + +/** + * A Reader implementation that works using a ReadableByteChannel and a + * CharsetDecoder. + * + * <p> + * This is a bridge between NIO <-> IO character decoding. + * </p> + * + * @author Robert Schuster + */ +public class ChannelReader extends Reader +{ + + private static final int DEFAULT_BUFFER_CAP = 8192; + + private ReadableByteChannel channel; + + private CharsetDecoder decoder; + + private ByteBuffer byteBuffer; + + private CharBuffer charBuffer; + + public ChannelReader(ReadableByteChannel channel, CharsetDecoder decoder, + int minBufferCap) + { + this.channel = channel; + this.decoder = decoder; + + // JDK reports errors, so we do the same. + decoder.onMalformedInput(CodingErrorAction.REPORT); + decoder.onUnmappableCharacter(CodingErrorAction.REPORT); + decoder.reset(); + + int size = (minBufferCap == -1) ? DEFAULT_BUFFER_CAP : minBufferCap; + + // Allocates the buffers and prepares them for reading, because that is the + // first operation being done on them. + byteBuffer = ByteBuffer.allocate(size); + byteBuffer.flip(); + charBuffer = CharBuffer.allocate((int) (size * decoder.averageCharsPerByte())); + } + + public int read(char[] buf, int offset, int count) throws IOException + { + // I declared channel being null meaning that the reader is closed. + if (!channel.isOpen()) + throw new IOException("Reader was already closed."); + + // I declared decoder being null meaning that there is no more data to read + // and convert. + if (decoder == null) + return -1; + + // Stores the amount of character being read. It -1 so that if no conversion + // occured the caller will see this as an 'end of file'. + int sum = -1; + + // Copies any characters which may be left from the last invocation into the + // destination array. + if (charBuffer.remaining() > 0) + { + sum = Math.min(count, charBuffer.remaining()); + charBuffer.get(buf, offset, sum); + + // Updates the control variables according to the latest copy operation. + offset += sum; + count -= sum; + } + + // Copies the character which have not been put in the destination array to + // the beginning. If data is actually copied count will be 0. If no data is + // copied count is >0 and we can now convert some more characters. + charBuffer.compact(); + + int converted = 0; + boolean last = false; + + while (count != 0) + { + // Tries to convert some bytes (Which will intentionally fail in the + // first place because we have not read any bytes yet.) + CoderResult result = decoder.decode(byteBuffer, charBuffer, last); + if (result.isMalformed() || result.isUnmappable()) + { + // JDK throws exception when bytes are malformed for sure. + // FIXME: Unsure what happens when a character is simply + // unmappable. + result.throwException(); + } + + // Marks that we should end this loop regardless whether the caller + // wants more chars or not, when this was the last conversion. + if (last) + { + decoder = null; + } + else if (result.isUnderflow()) + { + // We need more bytes to do the conversion. + + // Copies the not yet converted bytes to the beginning making it + // being able to receive more bytes. + byteBuffer.compact(); + + // Reads in another bunch of bytes for being converted. + if (channel.read(byteBuffer) == -1) + { + // If there is no more data available in the channel we mark + // that state for the final character conversion run which is + // done in the next loop iteration. + last = true; + } + + // Prepares the byteBuffer for the next character conversion run. + byteBuffer.flip(); + } + + // Prepares the charBuffer for being drained. + charBuffer.flip(); + + converted = Math.min(count, charBuffer.remaining()); + charBuffer.get(buf, offset, converted); + + // Copies characters which have not yet being copied into the char-Array + // to the beginning making it possible to read them later (If data is + // really copied here, then the caller has received enough characters so + // far.). + charBuffer.compact(); + + // Updates the control variables according to the latest copy operation. + offset += converted; + count -= converted; + + // Updates the amount of transferred characters. + sum += converted; + + if (decoder == null) + { + break; + } + + // Now that more characters have been transfered we let the loop decide + // what to do next. + } + + // Makes the charBuffer ready for reading on the next invocation. + charBuffer.flip(); + + return sum; + } + + public void close() throws IOException + { + channel.close(); + + // Makes sure all intermediate data is released by the decoder. + if (decoder != null) + decoder.reset(); + } + +} diff --git a/gnu/java/nio/InputStreamChannel.java b/gnu/java/nio/InputStreamChannel.java index 49e8b3c7e..6e0119eb5 100644 --- a/gnu/java/nio/InputStreamChannel.java +++ b/gnu/java/nio/InputStreamChannel.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.nio; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.nio.ByteBuffer; import java.nio.channels.ClosedChannelException; import java.nio.channels.ReadableByteChannel; diff --git a/gnu/java/nio/OutputStreamChannel.java b/gnu/java/nio/OutputStreamChannel.java index 37ded3b11..98f3f15dc 100644 --- a/gnu/java/nio/OutputStreamChannel.java +++ b/gnu/java/nio/OutputStreamChannel.java @@ -38,8 +38,8 @@ exception statement from your version. */ package gnu.java.nio; -import java.io.OutputStream; import java.io.IOException; +import java.io.OutputStream; import java.nio.ByteBuffer; import java.nio.channels.ClosedChannelException; import java.nio.channels.WritableByteChannel; diff --git a/gnu/java/nio/SelectorProviderImpl.java b/gnu/java/nio/SelectorProviderImpl.java index 41966ef14..37f4074cb 100644 --- a/gnu/java/nio/SelectorProviderImpl.java +++ b/gnu/java/nio/SelectorProviderImpl.java @@ -42,8 +42,8 @@ import java.nio.channels.DatagramChannel; import java.nio.channels.Pipe; import java.nio.channels.ServerSocketChannel; import java.nio.channels.SocketChannel; -import java.nio.channels.spi.SelectorProvider; import java.nio.channels.spi.AbstractSelector; +import java.nio.channels.spi.SelectorProvider; public class SelectorProviderImpl extends SelectorProvider { diff --git a/gnu/java/nio/channels/FileChannelImpl.java b/gnu/java/nio/channels/FileChannelImpl.java index 3db4a6d0d..5174e2dbb 100644 --- a/gnu/java/nio/channels/FileChannelImpl.java +++ b/gnu/java/nio/channels/FileChannelImpl.java @@ -281,7 +281,30 @@ public final class FileChannelImpl extends FileChannel throw new ClosedChannelException (); } - public long transferTo (long position, long count, WritableByteChannel target) + // like transferTo, but with a count of less than 2Gbytes + private int smallTransferTo (long position, int count, + WritableByteChannel target) + throws IOException + { + ByteBuffer buffer; + try + { + // Try to use a mapped buffer if we can. If this fails for + // any reason we'll fall back to using a ByteBuffer. + buffer = map (MapMode.READ_ONLY, position, count); + } + catch (IOException e) + { + buffer = ByteBuffer.allocate (count); + read (buffer, position); + buffer.flip(); + } + + return target.write (buffer); + } + + public long transferTo (long position, long count, + WritableByteChannel target) throws IOException { if (position < 0 @@ -294,14 +317,57 @@ public final class FileChannelImpl extends FileChannel if ((mode & READ) == 0) throw new NonReadableChannelException (); - // XXX: count needs to be casted from long to int. Dataloss ? - ByteBuffer buffer = ByteBuffer.allocate ((int) count); - read (buffer, position); - buffer.flip(); - return target.write (buffer); + final int pageSize = 65536; + long total = 0; + + while (count > 0) + { + int transferred + = smallTransferTo (position, (int)Math.min (count, pageSize), + target); + if (transferred < 0) + break; + total += transferred; + position += transferred; + count -= transferred; + } + + return total; } - public long transferFrom (ReadableByteChannel src, long position, long count) + // like transferFrom, but with a count of less than 2Gbytes + private int smallTransferFrom (ReadableByteChannel src, long position, + int count) + throws IOException + { + ByteBuffer buffer = null; + + if (src instanceof FileChannel) + { + try + { + // Try to use a mapped buffer if we can. If this fails + // for any reason we'll fall back to using a ByteBuffer. + buffer = ((FileChannel)src).map (MapMode.READ_ONLY, position, + count); + } + catch (IOException e) + { + } + } + + if (buffer == null) + { + buffer = ByteBuffer.allocate ((int) count); + src.read (buffer); + buffer.flip(); + } + + return write (buffer, position); + } + + public long transferFrom (ReadableByteChannel src, long position, + long count) throws IOException { if (position < 0 @@ -314,11 +380,21 @@ public final class FileChannelImpl extends FileChannel if ((mode & WRITE) == 0) throw new NonWritableChannelException (); - // XXX: count needs to be casted from long to int. Dataloss ? - ByteBuffer buffer = ByteBuffer.allocate ((int) count); - src.read (buffer); - buffer.flip(); - return write (buffer, position); + final int pageSize = 65536; + long total = 0; + + while (count > 0) + { + int transferred = smallTransferFrom (src, position, + (int)Math.min (count, pageSize)); + if (transferred < 0) + break; + total += transferred; + position += transferred; + count -= transferred; + } + + return total; } public FileLock tryLock (long position, long size, boolean shared) diff --git a/gnu/java/nio/channels/package.html b/gnu/java/nio/channels/package.html new file mode 100644 index 000000000..006f630d7 --- /dev/null +++ b/gnu/java/nio/channels/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.nio.channels package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.nio.channels</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/nio/charset/package.html b/gnu/java/nio/charset/package.html new file mode 100644 index 000000000..15418f74c --- /dev/null +++ b/gnu/java/nio/charset/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.nio.charset package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.nio.charset</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/nio/package.html b/gnu/java/nio/package.html new file mode 100644 index 000000000..7a023af6d --- /dev/null +++ b/gnu/java/nio/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.nio package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.nio</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/rmi/RMIMarshalledObjectInputStream.java b/gnu/java/rmi/RMIMarshalledObjectInputStream.java index 8835280a0..e20dda8eb 100644 --- a/gnu/java/rmi/RMIMarshalledObjectInputStream.java +++ b/gnu/java/rmi/RMIMarshalledObjectInputStream.java @@ -39,9 +39,10 @@ exception statement from your version. */ package gnu.java.rmi; import gnu.java.rmi.server.RMIObjectInputStream; -import java.io.ObjectInputStream; -import java.io.IOException; + import java.io.ByteArrayInputStream; +import java.io.IOException; +import java.io.ObjectInputStream; /** * This class is only for java.rmi.MarshalledObject to deserialize object from diff --git a/gnu/java/rmi/RMIMarshalledObjectOutputStream.java b/gnu/java/rmi/RMIMarshalledObjectOutputStream.java index 53a5bf159..931116a22 100644 --- a/gnu/java/rmi/RMIMarshalledObjectOutputStream.java +++ b/gnu/java/rmi/RMIMarshalledObjectOutputStream.java @@ -40,10 +40,10 @@ package gnu.java.rmi; import gnu.java.rmi.server.RMIObjectOutputStream; -import java.io.OutputStream; -import java.io.ObjectOutputStream; import java.io.ByteArrayOutputStream; import java.io.IOException; +import java.io.ObjectOutputStream; +import java.io.OutputStream; /** * This class is only for java.rmi.MarshalledObject to serialize object and diff --git a/gnu/java/rmi/dgc/DGCImpl.java b/gnu/java/rmi/dgc/DGCImpl.java index 483ac54f1..a41dabded 100644 --- a/gnu/java/rmi/dgc/DGCImpl.java +++ b/gnu/java/rmi/dgc/DGCImpl.java @@ -1,5 +1,6 @@ -/* - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. +/* DGCImpl.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,14 +38,14 @@ exception statement from your version. */ package gnu.java.rmi.dgc; +import gnu.java.rmi.server.UnicastServerRef; + +import java.rmi.RemoteException; import java.rmi.dgc.DGC; import java.rmi.dgc.Lease; import java.rmi.dgc.VMID; import java.rmi.server.ObjID; -import java.rmi.RemoteException; import java.rmi.server.RMISocketFactory; -import gnu.java.rmi.server.UnicastServerRef; - import java.util.Hashtable; /** diff --git a/gnu/java/rmi/dgc/package.html b/gnu/java/rmi/dgc/package.html new file mode 100644 index 000000000..cb06ca8ba --- /dev/null +++ b/gnu/java/rmi/dgc/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.rmi.dgc package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.rmi.dgc</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/rmi/package.html b/gnu/java/rmi/package.html new file mode 100644 index 000000000..3e220144b --- /dev/null +++ b/gnu/java/rmi/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.rmi package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.rmi</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/rmi/registry/RegistryImpl.java b/gnu/java/rmi/registry/RegistryImpl.java index 007d5a97d..056ab804c 100644 --- a/gnu/java/rmi/registry/RegistryImpl.java +++ b/gnu/java/rmi/registry/RegistryImpl.java @@ -1,5 +1,6 @@ -/* - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. +/* RegistryImpl.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,21 +38,22 @@ exception statement from your version. */ package gnu.java.rmi.registry; -import java.rmi.registry.Registry; -import java.rmi.registry.LocateRegistry; -import java.rmi.RemoteException; -import java.rmi.NotBoundException; +import gnu.java.rmi.server.UnicastServerRef; + import java.rmi.AccessException; import java.rmi.AlreadyBoundException; +import java.rmi.NotBoundException; import java.rmi.Remote; -import java.rmi.server.UnicastRemoteObject; +import java.rmi.RemoteException; +import java.rmi.registry.LocateRegistry; +import java.rmi.registry.Registry; import java.rmi.server.ObjID; -import java.util.Hashtable; -import java.util.Enumeration; -import java.rmi.server.RMISocketFactory; import java.rmi.server.RMIClientSocketFactory; import java.rmi.server.RMIServerSocketFactory; -import gnu.java.rmi.server.UnicastServerRef; +import java.rmi.server.RMISocketFactory; +import java.rmi.server.UnicastRemoteObject; +import java.util.Enumeration; +import java.util.Hashtable; public class RegistryImpl extends UnicastRemoteObject implements Registry { @@ -109,7 +111,7 @@ public static void version() { + System.getProperty("java.vm.name") + ") " + System.getProperty("java.vm.version")); - System.out.println("Copyright 2002 Free Software Foundation, Inc."); + System.out.println("Copyright 2005 Free Software Foundation, Inc."); System.out.println("This is free software; see the source for copying conditions. There is NO"); System.out.println("warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE."); System.exit(0); diff --git a/gnu/java/rmi/registry/package.html b/gnu/java/rmi/registry/package.html new file mode 100644 index 000000000..dd2df7c4c --- /dev/null +++ b/gnu/java/rmi/registry/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.rmi.registry package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.rmi.registry</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/rmi/server/ProtocolConstants.java b/gnu/java/rmi/server/ProtocolConstants.java index 7837a8e51..9f214c96a 100644 --- a/gnu/java/rmi/server/ProtocolConstants.java +++ b/gnu/java/rmi/server/ProtocolConstants.java @@ -1,5 +1,5 @@ -/* - Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* ProtocolConstants.java -- + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/rmi/server/RMIDefaultSocketFactory.java b/gnu/java/rmi/server/RMIDefaultSocketFactory.java index 887be9a4d..b58be1ade 100644 --- a/gnu/java/rmi/server/RMIDefaultSocketFactory.java +++ b/gnu/java/rmi/server/RMIDefaultSocketFactory.java @@ -1,5 +1,5 @@ -/* - Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* RMIDefaultSocketFactory.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,10 +37,10 @@ exception statement from your version. */ package gnu.java.rmi.server; -import java.rmi.server.RMISocketFactory; import java.io.IOException; -import java.net.Socket; import java.net.ServerSocket; +import java.net.Socket; +import java.rmi.server.RMISocketFactory; public class RMIDefaultSocketFactory extends RMISocketFactory { diff --git a/gnu/java/rmi/server/RMIIncomingThread.java b/gnu/java/rmi/server/RMIIncomingThread.java index 2855c039e..a6e2fee83 100644 --- a/gnu/java/rmi/server/RMIIncomingThread.java +++ b/gnu/java/rmi/server/RMIIncomingThread.java @@ -1,5 +1,5 @@ -/* - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. +/* RMIIncomingThread.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/rmi/server/RMIObjectInputStream.java b/gnu/java/rmi/server/RMIObjectInputStream.java index ffdccba4f..c890a1433 100644 --- a/gnu/java/rmi/server/RMIObjectInputStream.java +++ b/gnu/java/rmi/server/RMIObjectInputStream.java @@ -39,8 +39,8 @@ exception statement from your version. */ package gnu.java.rmi.server; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.lang.reflect.Proxy; diff --git a/gnu/java/rmi/server/RMIObjectOutputStream.java b/gnu/java/rmi/server/RMIObjectOutputStream.java index 1ae2000da..32aa5314e 100644 --- a/gnu/java/rmi/server/RMIObjectOutputStream.java +++ b/gnu/java/rmi/server/RMIObjectOutputStream.java @@ -43,8 +43,8 @@ import java.io.IOException; import java.io.ObjectOutputStream; import java.io.OutputStream; import java.rmi.Remote; -import java.rmi.server.RemoteStub; import java.rmi.server.RMIClassLoader; +import java.rmi.server.RemoteStub; public class RMIObjectOutputStream extends ObjectOutputStream { diff --git a/gnu/java/rmi/server/RMIVoidValue.java b/gnu/java/rmi/server/RMIVoidValue.java index 7829fc601..bad8b9652 100644 --- a/gnu/java/rmi/server/RMIVoidValue.java +++ b/gnu/java/rmi/server/RMIVoidValue.java @@ -1,5 +1,5 @@ -/* RMIVoidValue.java - Copyright (c) 2003 Free Software Foundation, Inc. +/* RMIVoidValue.java -- + Copyright (c) 2003 Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/rmi/server/UnicastConnectionManager.java b/gnu/java/rmi/server/UnicastConnectionManager.java index ef01c8264..c8c1d57ca 100644 --- a/gnu/java/rmi/server/UnicastConnectionManager.java +++ b/gnu/java/rmi/server/UnicastConnectionManager.java @@ -39,20 +39,17 @@ exception statement from your version. */ package gnu.java.rmi.server; -import gnu.java.rmi.server.RMIIncomingThread; -import gnu.java.rmi.server.UnicastConnection; - import java.io.IOException; -import java.io.ObjectOutput; import java.io.ObjectInput; +import java.io.ObjectOutput; import java.net.InetAddress; -import java.net.Socket; import java.net.ServerSocket; +import java.net.Socket; import java.net.UnknownHostException; import java.rmi.RemoteException; -import java.rmi.server.RMISocketFactory; -import java.rmi.server.RMIServerSocketFactory; import java.rmi.server.RMIClientSocketFactory; +import java.rmi.server.RMIServerSocketFactory; +import java.rmi.server.RMISocketFactory; import java.util.ArrayList; import java.util.ConcurrentModificationException; import java.util.Hashtable; diff --git a/gnu/java/rmi/server/UnicastRef.java b/gnu/java/rmi/server/UnicastRef.java index 60a745e84..77042d724 100644 --- a/gnu/java/rmi/server/UnicastRef.java +++ b/gnu/java/rmi/server/UnicastRef.java @@ -1,5 +1,6 @@ -/* - Copyright (c) 1996, 1997, 1998, 1999, 2002 Free Software Foundation, Inc. +/* UnicastRef.java -- + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2005 + Free Software Foundation, Inc. This file is part of GNU Classpath. diff --git a/gnu/java/rmi/server/UnicastRemoteCall.java b/gnu/java/rmi/server/UnicastRemoteCall.java index abbe02725..e38f0f92b 100644 --- a/gnu/java/rmi/server/UnicastRemoteCall.java +++ b/gnu/java/rmi/server/UnicastRemoteCall.java @@ -1,5 +1,6 @@ /* UnicastRemoteCall.java - Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004 Free Software Foundation, Inc. + Copyright (c) 1996, 1997, 1998, 1999, 2002, 2004, 2005 + Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,11 +45,11 @@ import java.io.IOException; import java.io.ObjectInput; import java.io.ObjectOutput; import java.io.StreamCorruptedException; -import java.rmi.RemoteException; import java.rmi.MarshalException; +import java.rmi.RemoteException; import java.rmi.UnmarshalException; -import java.rmi.server.RemoteCall; import java.rmi.server.ObjID; +import java.rmi.server.RemoteCall; import java.rmi.server.UID; import java.util.Vector; diff --git a/gnu/java/rmi/server/UnicastRemoteStub.java b/gnu/java/rmi/server/UnicastRemoteStub.java index 97b911047..f19ecccb9 100644 --- a/gnu/java/rmi/server/UnicastRemoteStub.java +++ b/gnu/java/rmi/server/UnicastRemoteStub.java @@ -1,5 +1,5 @@ -/* - Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. +/* UnicastRemoteStub.java -- + Copyright (c) 1996, 1997, 1998, 1999 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,8 +37,8 @@ exception statement from your version. */ package gnu.java.rmi.server; -import java.rmi.server.RemoteStub; import java.rmi.server.RemoteRef; +import java.rmi.server.RemoteStub; public class UnicastRemoteStub extends RemoteStub { diff --git a/gnu/java/rmi/server/UnicastServerRef.java b/gnu/java/rmi/server/UnicastServerRef.java index ce4420c47..71c84a58a 100644 --- a/gnu/java/rmi/server/UnicastServerRef.java +++ b/gnu/java/rmi/server/UnicastServerRef.java @@ -41,17 +41,17 @@ package gnu.java.rmi.server; import java.io.ObjectInputStream; import java.lang.reflect.Constructor; -import java.lang.reflect.Method; import java.lang.reflect.InvocationTargetException; +import java.lang.reflect.Method; import java.rmi.Remote; import java.rmi.RemoteException; -import java.rmi.server.RemoteStub; import java.rmi.server.ObjID; -import java.rmi.server.ServerRef; -import java.rmi.server.RemoteServer; +import java.rmi.server.RMIServerSocketFactory; import java.rmi.server.RemoteRef; +import java.rmi.server.RemoteServer; +import java.rmi.server.RemoteStub; import java.rmi.server.ServerNotActiveException; -import java.rmi.server.RMIServerSocketFactory; +import java.rmi.server.ServerRef; import java.rmi.server.Skeleton; import java.util.Hashtable; diff --git a/gnu/java/rmi/server/package.html b/gnu/java/rmi/server/package.html new file mode 100644 index 000000000..fc209823b --- /dev/null +++ b/gnu/java/rmi/server/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.rmi.server package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.rmi.server</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/OID.java b/gnu/java/security/OID.java index 0b935c48c..918435108 100644 --- a/gnu/java/security/OID.java +++ b/gnu/java/security/OID.java @@ -41,8 +41,8 @@ package gnu.java.security; import gnu.java.security.der.DEREncodingException; import java.io.ByteArrayOutputStream; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.util.StringTokenizer; /** diff --git a/gnu/java/security/PolicyFile.java b/gnu/java/security/PolicyFile.java index 84f3e5c07..c939dda47 100644 --- a/gnu/java/security/PolicyFile.java +++ b/gnu/java/security/PolicyFile.java @@ -1,18 +1,20 @@ -/* PolicyFile.java -- policy file reader. - Copyright (C) 2004 Free Software Foundation, Inc. +/* PolicyFile.java -- policy file reader + Copyright (C) 2004, 2005 Free Software Foundation, Inc. -This program is free software; you can redistribute it and/or modify +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) any later version. -This program is distributed in the hope that it will be useful, but +GNU Classpath 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 this program; see the file COPYING. If not, write to the +along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -33,7 +35,6 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ - package gnu.java.security; import java.io.File; diff --git a/gnu/java/security/action/package.html b/gnu/java/security/action/package.html new file mode 100644 index 000000000..c971a78cc --- /dev/null +++ b/gnu/java/security/action/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.action package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.action</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/ber/package.html b/gnu/java/security/ber/package.html new file mode 100644 index 000000000..c7ff170f5 --- /dev/null +++ b/gnu/java/security/ber/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.ber package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.ber</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/der/DERReader.java b/gnu/java/security/der/DERReader.java index 688b509eb..aab3a2fc8 100644 --- a/gnu/java/security/der/DERReader.java +++ b/gnu/java/security/der/DERReader.java @@ -38,21 +38,19 @@ exception statement from your version. */ package gnu.java.security.der; +import gnu.java.security.OID; + import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.EOFException; -import java.io.InputStream; import java.io.IOException; - +import java.io.InputStream; import java.math.BigInteger; - import java.util.Calendar; import java.util.Date; import java.util.TimeZone; -import gnu.java.security.OID; - /** * This class decodes DER sequences into Java objects. The methods of * this class do not have knowledge of higher-levels of structure in the diff --git a/gnu/java/security/der/package.html b/gnu/java/security/der/package.html new file mode 100644 index 000000000..06d55182d --- /dev/null +++ b/gnu/java/security/der/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.der package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.der</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/package.html b/gnu/java/security/package.html new file mode 100644 index 000000000..d87340849 --- /dev/null +++ b/gnu/java/security/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/pkcs/PKCS7SignedData.java b/gnu/java/security/pkcs/PKCS7SignedData.java index 5c2a98a5c..869febebd 100644 --- a/gnu/java/security/pkcs/PKCS7SignedData.java +++ b/gnu/java/security/pkcs/PKCS7SignedData.java @@ -1,18 +1,20 @@ -/* PKCS7SignedData.java -- reader for PKCS#7 signedData objects. - Copyright (C) 2004 Free Software Foundation, Inc. +/* PKCS7SignedData.java -- reader for PKCS#7 signedData objects + Copyright (C) 2004, 2005 Free Software Foundation, Inc. -This program is free software; you can redistribute it and/or modify +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) any later version. -This program is distributed in the hope that it will be useful, but +GNU Classpath 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 this program; see the file COPYING. If not, write to the +along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -33,7 +35,6 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ - package gnu.java.security.pkcs; import gnu.java.security.OID; diff --git a/gnu/java/security/pkcs/SignerInfo.java b/gnu/java/security/pkcs/SignerInfo.java index 15fe9f9f8..d6b747dea 100644 --- a/gnu/java/security/pkcs/SignerInfo.java +++ b/gnu/java/security/pkcs/SignerInfo.java @@ -1,18 +1,20 @@ -/* SignerInfo.java -- a SignerInfo object, from PKCS #7. - Copyright (C) 2004 Free Software Foundation, Inc. +/* SignerInfo.java -- a SignerInfo object, from PKCS #7 + Copyright (C) 2004, 2005 Free Software Foundation, Inc. -This program is free software; you can redistribute it and/or modify +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) any later version. -This program is distributed in the hope that it will be useful, but +GNU Classpath 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 this program; see the file COPYING. If not, write to the +along with GNU Classpath; see the file COPYING. If not, write to the Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. @@ -33,7 +35,6 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ - package gnu.java.security.pkcs; import gnu.java.security.OID; diff --git a/gnu/java/security/pkcs/package.html b/gnu/java/security/pkcs/package.html new file mode 100644 index 000000000..945fb5d75 --- /dev/null +++ b/gnu/java/security/pkcs/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.pkcs package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.pkcs</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/provider/CollectionCertStoreImpl.java b/gnu/java/security/provider/CollectionCertStoreImpl.java index 1b22cc891..b67a4332c 100644 --- a/gnu/java/security/provider/CollectionCertStoreImpl.java +++ b/gnu/java/security/provider/CollectionCertStoreImpl.java @@ -39,15 +39,14 @@ exception statement from your version. */ package gnu.java.security.provider; import java.security.InvalidAlgorithmParameterException; -import java.security.cert.Certificate; -import java.security.cert.CertSelector; import java.security.cert.CRL; import java.security.cert.CRLSelector; +import java.security.cert.CertSelector; import java.security.cert.CertStoreException; import java.security.cert.CertStoreParameters; import java.security.cert.CertStoreSpi; +import java.security.cert.Certificate; import java.security.cert.CollectionCertStoreParameters; - import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; diff --git a/gnu/java/security/provider/DSAParameterGenerator.java b/gnu/java/security/provider/DSAParameterGenerator.java index f481f294d..92032fa94 100644 --- a/gnu/java/security/provider/DSAParameterGenerator.java +++ b/gnu/java/security/provider/DSAParameterGenerator.java @@ -38,9 +38,11 @@ exception statement from your version. */ package gnu.java.security.provider; +import gnu.java.security.util.Prime; + import java.math.BigInteger; -import java.security.AlgorithmParameters; import java.security.AlgorithmParameterGeneratorSpi; +import java.security.AlgorithmParameters; import java.security.InvalidAlgorithmParameterException; import java.security.NoSuchAlgorithmException; import java.security.SecureRandom; @@ -49,8 +51,6 @@ import java.security.spec.DSAParameterSpec; import java.security.spec.InvalidParameterSpecException; import java.util.Random; -import gnu.java.security.util.Prime; - public class DSAParameterGenerator extends AlgorithmParameterGeneratorSpi { private int size; diff --git a/gnu/java/security/provider/DefaultPolicy.java b/gnu/java/security/provider/DefaultPolicy.java index f3385fa04..f7ef782fc 100644 --- a/gnu/java/security/provider/DefaultPolicy.java +++ b/gnu/java/security/provider/DefaultPolicy.java @@ -1,4 +1,4 @@ -/* DefaultPolicy.java +/* DefaultPolicy.java -- Copyright (C) 2001, 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -37,7 +37,12 @@ exception statement from your version. */ package gnu.java.security.provider; -import java.security.*; +import java.security.AllPermission; +import java.security.CodeSource; +import java.security.Permission; +import java.security.PermissionCollection; +import java.security.Permissions; +import java.security.Policy; /** * This is just a stub policy implementation which grants all permissions diff --git a/gnu/java/security/provider/EncodedKeyFactory.java b/gnu/java/security/provider/EncodedKeyFactory.java index 7dc5ee933..dd1a06a79 100644 --- a/gnu/java/security/provider/EncodedKeyFactory.java +++ b/gnu/java/security/provider/EncodedKeyFactory.java @@ -44,9 +44,7 @@ import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; import java.io.IOException; - import java.math.BigInteger; - import java.security.AlgorithmParameters; import java.security.InvalidKeyException; import java.security.Key; @@ -54,10 +52,9 @@ import java.security.KeyFactorySpi; import java.security.NoSuchAlgorithmException; import java.security.PrivateKey; import java.security.PublicKey; - import java.security.spec.DSAParameterSpec; -import java.security.spec.InvalidParameterSpecException; import java.security.spec.InvalidKeySpecException; +import java.security.spec.InvalidParameterSpecException; import java.security.spec.KeySpec; import java.security.spec.PKCS8EncodedKeySpec; import java.security.spec.RSAPrivateCrtKeySpec; diff --git a/gnu/java/security/provider/GnuDHPublicKey.java b/gnu/java/security/provider/GnuDHPublicKey.java index fbf9d9f86..d62fcc93a 100644 --- a/gnu/java/security/provider/GnuDHPublicKey.java +++ b/gnu/java/security/provider/GnuDHPublicKey.java @@ -38,18 +38,17 @@ exception statement from your version. */ package gnu.java.security.provider; -import java.math.BigInteger; +import gnu.java.security.OID; +import gnu.java.security.der.BitString; +import gnu.java.security.der.DER; +import gnu.java.security.der.DERValue; +import java.math.BigInteger; import java.util.ArrayList; import javax.crypto.interfaces.DHPublicKey; import javax.crypto.spec.DHParameterSpec; -import gnu.java.security.OID; -import gnu.java.security.der.BitString; -import gnu.java.security.der.DER; -import gnu.java.security.der.DERValue; - public class GnuDHPublicKey implements DHPublicKey { diff --git a/gnu/java/security/provider/GnuDSAPrivateKey.java b/gnu/java/security/provider/GnuDSAPrivateKey.java index 72fe38784..8cac9c351 100644 --- a/gnu/java/security/provider/GnuDSAPrivateKey.java +++ b/gnu/java/security/provider/GnuDSAPrivateKey.java @@ -45,13 +45,10 @@ import gnu.java.security.der.DERWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; - import java.math.BigInteger; - -import java.security.interfaces.DSAPrivateKey; import java.security.interfaces.DSAParams; +import java.security.interfaces.DSAPrivateKey; import java.security.spec.DSAParameterSpec; - import java.util.ArrayList; public class GnuDSAPrivateKey implements DSAPrivateKey diff --git a/gnu/java/security/provider/GnuDSAPublicKey.java b/gnu/java/security/provider/GnuDSAPublicKey.java index 9ec827d41..6f3a29da9 100644 --- a/gnu/java/security/provider/GnuDSAPublicKey.java +++ b/gnu/java/security/provider/GnuDSAPublicKey.java @@ -46,13 +46,10 @@ import gnu.java.security.der.DERWriter; import java.io.ByteArrayOutputStream; import java.io.IOException; - import java.math.BigInteger; - -import java.security.interfaces.DSAPublicKey; import java.security.interfaces.DSAParams; +import java.security.interfaces.DSAPublicKey; import java.security.spec.DSAParameterSpec; - import java.util.ArrayList; public class GnuDSAPublicKey implements DSAPublicKey diff --git a/gnu/java/security/provider/GnuRSAPrivateKey.java b/gnu/java/security/provider/GnuRSAPrivateKey.java index 455326dd0..45a212552 100644 --- a/gnu/java/security/provider/GnuRSAPrivateKey.java +++ b/gnu/java/security/provider/GnuRSAPrivateKey.java @@ -38,17 +38,15 @@ exception statement from your version. */ package gnu.java.security.provider; -import java.math.BigInteger; +import gnu.java.security.OID; +import gnu.java.security.der.DER; +import gnu.java.security.der.DERValue; +import java.math.BigInteger; import java.security.interfaces.RSAPrivateCrtKey; import java.security.spec.RSAPrivateCrtKeySpec; - import java.util.ArrayList; -import gnu.java.security.OID; -import gnu.java.security.der.DER; -import gnu.java.security.der.DERValue; - class GnuRSAPrivateKey implements RSAPrivateCrtKey { diff --git a/gnu/java/security/provider/GnuRSAPublicKey.java b/gnu/java/security/provider/GnuRSAPublicKey.java index 502fcccbf..053774467 100644 --- a/gnu/java/security/provider/GnuRSAPublicKey.java +++ b/gnu/java/security/provider/GnuRSAPublicKey.java @@ -38,16 +38,16 @@ exception statement from your version. */ package gnu.java.security.provider; -import java.math.BigInteger; -import java.security.interfaces.RSAPublicKey; -import java.security.spec.RSAPublicKeySpec; -import java.util.ArrayList; - import gnu.java.security.OID; import gnu.java.security.der.BitString; import gnu.java.security.der.DER; import gnu.java.security.der.DERValue; +import java.math.BigInteger; +import java.security.interfaces.RSAPublicKey; +import java.security.spec.RSAPublicKeySpec; +import java.util.ArrayList; + class GnuRSAPublicKey implements RSAPublicKey { diff --git a/gnu/java/security/provider/PKIXCertPathValidatorImpl.java b/gnu/java/security/provider/PKIXCertPathValidatorImpl.java index 7bba50213..3e493ee6d 100644 --- a/gnu/java/security/provider/PKIXCertPathValidatorImpl.java +++ b/gnu/java/security/provider/PKIXCertPathValidatorImpl.java @@ -41,8 +41,8 @@ package gnu.java.security.provider; import gnu.java.security.OID; import gnu.java.security.x509.GnuPKIExtension; import gnu.java.security.x509.PolicyNodeImpl; -import gnu.java.security.x509.X509CertSelectorImpl; import gnu.java.security.x509.X509CRLSelectorImpl; +import gnu.java.security.x509.X509CertSelectorImpl; import gnu.java.security.x509.ext.BasicConstraints; import gnu.java.security.x509.ext.CertificatePolicies; import gnu.java.security.x509.ext.Extension; @@ -50,12 +50,10 @@ import gnu.java.security.x509.ext.KeyUsage; import gnu.java.security.x509.ext.PolicyConstraint; import java.io.IOException; - import java.security.InvalidAlgorithmParameterException; import java.security.InvalidKeyException; import java.security.PublicKey; - -import java.security.cert.CertificateException; +import java.security.cert.CRL; import java.security.cert.CertPath; import java.security.cert.CertPathParameters; import java.security.cert.CertPathValidatorException; @@ -63,16 +61,15 @@ import java.security.cert.CertPathValidatorResult; import java.security.cert.CertPathValidatorSpi; import java.security.cert.CertStore; import java.security.cert.CertStoreException; -import java.security.cert.CRL; +import java.security.cert.CertificateException; import java.security.cert.PKIXCertPathChecker; import java.security.cert.PKIXCertPathValidatorResult; import java.security.cert.PKIXParameters; import java.security.cert.TrustAnchor; -import java.security.cert.X509Certificate; import java.security.cert.X509CRL; +import java.security.cert.X509Certificate; import java.security.interfaces.DSAParams; import java.security.interfaces.DSAPublicKey; - import java.util.Arrays; import java.util.Collection; import java.util.Collections; diff --git a/gnu/java/security/provider/RSA.java b/gnu/java/security/provider/RSA.java index 5afa8b740..4fd463378 100644 --- a/gnu/java/security/provider/RSA.java +++ b/gnu/java/security/provider/RSA.java @@ -38,11 +38,15 @@ exception statement from your version. */ package gnu.java.security.provider; +import gnu.java.security.OID; +import gnu.java.security.der.DER; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; +import gnu.java.security.der.DERWriter; + import java.io.ByteArrayOutputStream; import java.io.IOException; - import java.math.BigInteger; - import java.security.InvalidKeyException; import java.security.MessageDigest; import java.security.PrivateKey; @@ -52,15 +56,8 @@ import java.security.SignatureException; import java.security.SignatureSpi; import java.security.interfaces.RSAPrivateKey; import java.security.interfaces.RSAPublicKey; - import java.util.ArrayList; -import gnu.java.security.OID; -import gnu.java.security.der.DER; -import gnu.java.security.der.DERReader; -import gnu.java.security.der.DERValue; -import gnu.java.security.der.DERWriter; - public abstract class RSA extends SignatureSpi implements Cloneable { diff --git a/gnu/java/security/provider/SHA1PRNG.java b/gnu/java/security/provider/SHA1PRNG.java index 97a8b9e34..058dc6daa 100644 --- a/gnu/java/security/provider/SHA1PRNG.java +++ b/gnu/java/security/provider/SHA1PRNG.java @@ -38,11 +38,11 @@ exception statement from your version. */ package gnu.java.security.provider; -import java.util.Random; -import java.security.SecureRandomSpi; +import java.io.Serializable; import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import java.io.Serializable; +import java.security.SecureRandomSpi; +import java.util.Random; public class SHA1PRNG extends SecureRandomSpi implements Serializable { diff --git a/gnu/java/security/provider/SHA1withRSA.java b/gnu/java/security/provider/SHA1withRSA.java index 64e93f9b0..7e1061929 100644 --- a/gnu/java/security/provider/SHA1withRSA.java +++ b/gnu/java/security/provider/SHA1withRSA.java @@ -38,11 +38,11 @@ exception statement from your version. */ package gnu.java.security.provider; +import gnu.java.security.OID; + import java.security.MessageDigest; import java.security.NoSuchAlgorithmException; -import gnu.java.security.OID; - public class SHA1withRSA extends RSA { diff --git a/gnu/java/security/provider/X509CertificateFactory.java b/gnu/java/security/provider/X509CertificateFactory.java index 753300651..7cfa1f610 100644 --- a/gnu/java/security/provider/X509CertificateFactory.java +++ b/gnu/java/security/provider/X509CertificateFactory.java @@ -38,29 +38,27 @@ exception statement from your version. */ package gnu.java.security.provider; +import gnu.java.io.Base64InputStream; +import gnu.java.security.x509.X509CRL; +import gnu.java.security.x509.X509CertPath; +import gnu.java.security.x509.X509Certificate; + import java.io.BufferedInputStream; import java.io.EOFException; -import java.io.InputStream; import java.io.IOException; - +import java.io.InputStream; +import java.security.cert.CRL; +import java.security.cert.CRLException; +import java.security.cert.CertPath; import java.security.cert.Certificate; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.security.cert.CertificateFactorySpi; -import java.security.cert.CertPath; -import java.security.cert.CRL; -import java.security.cert.CRLException; - import java.util.Collection; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import gnu.java.io.Base64InputStream; -import gnu.java.security.x509.X509Certificate; -import gnu.java.security.x509.X509CertPath; -import gnu.java.security.x509.X509CRL; - public class X509CertificateFactory extends CertificateFactorySpi { diff --git a/gnu/java/security/provider/package.html b/gnu/java/security/provider/package.html new file mode 100644 index 000000000..d5a0a2ece --- /dev/null +++ b/gnu/java/security/provider/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.provider package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.provider</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/util/package.html b/gnu/java/security/util/package.html new file mode 100644 index 000000000..ea91cb5df --- /dev/null +++ b/gnu/java/security/util/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.util package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.util</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/x509/GnuPKIExtension.java b/gnu/java/security/x509/GnuPKIExtension.java index 8294e654b..36ce84db0 100644 --- a/gnu/java/security/x509/GnuPKIExtension.java +++ b/gnu/java/security/x509/GnuPKIExtension.java @@ -38,12 +38,12 @@ exception statement from your version. */ package gnu.java.security.x509; -import java.security.cert.X509Extension; -import java.util.Collection; - import gnu.java.security.OID; import gnu.java.security.x509.ext.Extension; +import java.security.cert.X509Extension; +import java.util.Collection; + public interface GnuPKIExtension extends X509Extension { diff --git a/gnu/java/security/x509/X500DistinguishedName.java b/gnu/java/security/x509/X500DistinguishedName.java index daf76a22d..6c34f0579 100644 --- a/gnu/java/security/x509/X500DistinguishedName.java +++ b/gnu/java/security/x509/X500DistinguishedName.java @@ -38,14 +38,17 @@ exception statement from your version. */ package gnu.java.security.x509; +import gnu.java.security.OID; +import gnu.java.security.der.DER; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; + import java.io.EOFException; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.io.Reader; import java.io.StringReader; - import java.security.Principal; - import java.util.ArrayList; import java.util.Collections; import java.util.HashSet; @@ -56,11 +59,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import gnu.java.security.der.DER; -import gnu.java.security.der.DERReader; -import gnu.java.security.der.DERValue; -import gnu.java.security.OID; - public class X500DistinguishedName implements Principal { diff --git a/gnu/java/security/x509/X509CRL.java b/gnu/java/security/x509/X509CRL.java index 33263af43..5fe255c2a 100644 --- a/gnu/java/security/x509/X509CRL.java +++ b/gnu/java/security/x509/X509CRL.java @@ -45,23 +45,23 @@ import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; import gnu.java.security.x509.ext.Extension; -import java.io.InputStream; import java.io.IOException; +import java.io.InputStream; import java.math.BigInteger; import java.security.InvalidKeyException; import java.security.NoSuchAlgorithmException; import java.security.NoSuchProviderException; -import java.security.PublicKey; import java.security.Principal; +import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; -import java.security.cert.Certificate; import java.security.cert.CRLException; +import java.security.cert.Certificate; import java.util.Collection; import java.util.Collections; import java.util.Date; -import java.util.HashSet; import java.util.HashMap; +import java.util.HashSet; import java.util.Iterator; import java.util.Set; diff --git a/gnu/java/security/x509/X509CRLEntry.java b/gnu/java/security/x509/X509CRLEntry.java index da161153c..4f7e1c258 100644 --- a/gnu/java/security/x509/X509CRLEntry.java +++ b/gnu/java/security/x509/X509CRLEntry.java @@ -38,12 +38,14 @@ exception statement from your version. */ package gnu.java.security.x509; -import java.io.IOException; +import gnu.java.security.OID; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; +import gnu.java.security.x509.ext.Extension; +import java.io.IOException; import java.math.BigInteger; - import java.security.cert.CRLException; - import java.util.Collection; import java.util.Collections; import java.util.Date; @@ -52,10 +54,6 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Set; -import gnu.java.security.OID; -import gnu.java.security.der.*; -import gnu.java.security.x509.ext.*; - /** * A single entry in a X.509 certificate revocation list. * diff --git a/gnu/java/security/x509/X509CertPath.java b/gnu/java/security/x509/X509CertPath.java index 0990abda0..598dbeb94 100644 --- a/gnu/java/security/x509/X509CertPath.java +++ b/gnu/java/security/x509/X509CertPath.java @@ -38,18 +38,21 @@ exception statement from your version. */ package gnu.java.security.x509; +import gnu.java.security.OID; +import gnu.java.security.der.DER; +import gnu.java.security.der.DEREncodingException; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; + import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; -import java.io.InputStream; import java.io.IOException; - +import java.io.InputStream; import java.math.BigInteger; - +import java.security.cert.CertPath; import java.security.cert.Certificate; import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; -import java.security.cert.CertPath; - import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -57,12 +60,6 @@ import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import gnu.java.security.OID; -import gnu.java.security.der.DER; -import gnu.java.security.der.DEREncodingException; -import gnu.java.security.der.DERReader; -import gnu.java.security.der.DERValue; - /** * A certificate path (or certificate chain) of X509Certificates. * diff --git a/gnu/java/security/x509/X509CertSelectorImpl.java b/gnu/java/security/x509/X509CertSelectorImpl.java index 4535cce6d..c355dc176 100644 --- a/gnu/java/security/x509/X509CertSelectorImpl.java +++ b/gnu/java/security/x509/X509CertSelectorImpl.java @@ -39,12 +39,10 @@ exception statement from your version. */ package gnu.java.security.x509; import java.io.IOException; - import java.security.Principal; -import java.security.cert.Certificate; import java.security.cert.CertSelector; +import java.security.cert.Certificate; import java.security.cert.X509Certificate; - import java.util.Collection; import java.util.Collections; import java.util.HashSet; diff --git a/gnu/java/security/x509/X509Certificate.java b/gnu/java/security/x509/X509Certificate.java index 7009be423..5d8f1d91c 100644 --- a/gnu/java/security/x509/X509Certificate.java +++ b/gnu/java/security/x509/X509Certificate.java @@ -38,14 +38,24 @@ exception statement from your version. */ package gnu.java.security.x509; -import java.io.InputStream; +import gnu.java.security.OID; +import gnu.java.security.der.BitString; +import gnu.java.security.der.DER; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; +import gnu.java.security.x509.ext.BasicConstraints; +import gnu.java.security.x509.ext.ExtendedKeyUsage; +import gnu.java.security.x509.ext.Extension; +import gnu.java.security.x509.ext.IssuerAlternativeNames; +import gnu.java.security.x509.ext.KeyUsage; +import gnu.java.security.x509.ext.SubjectAlternativeNames; + import java.io.IOException; +import java.io.InputStream; import java.io.PrintWriter; import java.io.Serializable; import java.io.StringWriter; - import java.math.BigInteger; - import java.security.AlgorithmParameters; import java.security.InvalidKeyException; import java.security.KeyFactory; @@ -55,20 +65,17 @@ import java.security.Principal; import java.security.PublicKey; import java.security.Signature; import java.security.SignatureException; - import java.security.cert.CertificateEncodingException; import java.security.cert.CertificateException; import java.security.cert.CertificateExpiredException; import java.security.cert.CertificateNotYetValidException; import java.security.cert.CertificateParsingException; - import java.security.interfaces.DSAParams; import java.security.interfaces.DSAPublicKey; import java.security.spec.DSAParameterSpec; import java.security.spec.X509EncodedKeySpec; - -import java.util.Arrays; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Date; @@ -81,10 +88,6 @@ import java.util.Set; import javax.security.auth.x500.X500Principal; -import gnu.java.security.OID; -import gnu.java.security.der.*; -import gnu.java.security.x509.ext.*; - /** * An implementation of X.509 certificates. * diff --git a/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java b/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java index 544152199..dafb3ba23 100644 --- a/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java +++ b/gnu/java/security/x509/ext/AuthorityKeyIdentifier.java @@ -38,15 +38,15 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.math.BigInteger; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; import gnu.java.security.x509.Util; +import java.io.IOException; +import java.math.BigInteger; + public class AuthorityKeyIdentifier extends Extension.Value { diff --git a/gnu/java/security/x509/ext/BasicConstraints.java b/gnu/java/security/x509/ext/BasicConstraints.java index f720d22a9..a51e7a8f0 100644 --- a/gnu/java/security/x509/ext/BasicConstraints.java +++ b/gnu/java/security/x509/ext/BasicConstraints.java @@ -38,16 +38,16 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.math.BigInteger; -import java.util.ArrayList; -import java.util.List; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; +import java.math.BigInteger; +import java.util.ArrayList; +import java.util.List; + public class BasicConstraints extends Extension.Value { diff --git a/gnu/java/security/x509/ext/CRLNumber.java b/gnu/java/security/x509/ext/CRLNumber.java index 556aa303a..1c3e01e36 100644 --- a/gnu/java/security/x509/ext/CRLNumber.java +++ b/gnu/java/security/x509/ext/CRLNumber.java @@ -38,14 +38,14 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.math.BigInteger; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; +import java.math.BigInteger; + public class CRLNumber extends Extension.Value { diff --git a/gnu/java/security/x509/ext/CertificatePolicies.java b/gnu/java/security/x509/ext/CertificatePolicies.java index 9c14dc96e..266a4c3c6 100644 --- a/gnu/java/security/x509/ext/CertificatePolicies.java +++ b/gnu/java/security/x509/ext/CertificatePolicies.java @@ -38,9 +38,13 @@ exception statement from your version. */ package gnu.java.security.x509.ext; +import gnu.java.security.OID; +import gnu.java.security.der.DER; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; + import java.io.IOException; import java.security.cert.PolicyQualifierInfo; - import java.util.ArrayList; import java.util.Collections; import java.util.HashMap; @@ -49,11 +53,6 @@ import java.util.LinkedList; import java.util.List; import java.util.Map; -import gnu.java.security.OID; -import gnu.java.security.der.DER; -import gnu.java.security.der.DERReader; -import gnu.java.security.der.DERValue; - public class CertificatePolicies extends Extension.Value { diff --git a/gnu/java/security/x509/ext/ExtendedKeyUsage.java b/gnu/java/security/x509/ext/ExtendedKeyUsage.java index e2a98e0a3..cd551a99e 100644 --- a/gnu/java/security/x509/ext/ExtendedKeyUsage.java +++ b/gnu/java/security/x509/ext/ExtendedKeyUsage.java @@ -38,16 +38,16 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.util.Collections; -import java.util.LinkedList; -import java.util.List; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; +import java.util.Collections; +import java.util.LinkedList; +import java.util.List; + public class ExtendedKeyUsage extends Extension.Value { diff --git a/gnu/java/security/x509/ext/Extension.java b/gnu/java/security/x509/ext/Extension.java index ccbd60c15..28a32fecc 100644 --- a/gnu/java/security/x509/ext/Extension.java +++ b/gnu/java/security/x509/ext/Extension.java @@ -38,17 +38,17 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.util.ArrayList; -import java.util.Arrays; -import java.util.List; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; import gnu.java.security.x509.Util; +import java.io.IOException; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + public class Extension { diff --git a/gnu/java/security/x509/ext/GeneralNames.java b/gnu/java/security/x509/ext/GeneralNames.java index fc9a73ba3..66473ee60 100644 --- a/gnu/java/security/x509/ext/GeneralNames.java +++ b/gnu/java/security/x509/ext/GeneralNames.java @@ -1,4 +1,4 @@ -/* GeneralNames.java -- the GeneralNames object. +/* GeneralNames.java -- the GeneralNames object Copyright (C) 2004 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -38,22 +38,20 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; +import gnu.java.security.OID; +import gnu.java.security.der.DER; +import gnu.java.security.der.DERReader; +import gnu.java.security.der.DERValue; +import gnu.java.security.x509.X500DistinguishedName; +import java.io.IOException; import java.net.InetAddress; - import java.util.ArrayList; import java.util.Collections; import java.util.Iterator; import java.util.LinkedList; import java.util.List; -import gnu.java.security.OID; -import gnu.java.security.x509.X500DistinguishedName; -import gnu.java.security.der.DER; -import gnu.java.security.der.DERReader; -import gnu.java.security.der.DERValue; - public class GeneralNames { diff --git a/gnu/java/security/x509/ext/IssuerAlternativeNames.java b/gnu/java/security/x509/ext/IssuerAlternativeNames.java index 0d0beb04b..7576b6d34 100644 --- a/gnu/java/security/x509/ext/IssuerAlternativeNames.java +++ b/gnu/java/security/x509/ext/IssuerAlternativeNames.java @@ -38,9 +38,10 @@ exception statement from your version. */ package gnu.java.security.x509.ext; +import gnu.java.security.OID; + import java.io.IOException; import java.util.List; -import gnu.java.security.OID; public class IssuerAlternativeNames extends Extension.Value { diff --git a/gnu/java/security/x509/ext/KeyUsage.java b/gnu/java/security/x509/ext/KeyUsage.java index 7d5d7c62c..a6fd77573 100644 --- a/gnu/java/security/x509/ext/KeyUsage.java +++ b/gnu/java/security/x509/ext/KeyUsage.java @@ -38,14 +38,14 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; - import gnu.java.security.OID; import gnu.java.security.der.BitString; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; + public class KeyUsage extends Extension.Value { diff --git a/gnu/java/security/x509/ext/PolicyConstraint.java b/gnu/java/security/x509/ext/PolicyConstraint.java index e33f960b3..866f015cd 100644 --- a/gnu/java/security/x509/ext/PolicyConstraint.java +++ b/gnu/java/security/x509/ext/PolicyConstraint.java @@ -38,13 +38,13 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.math.BigInteger; - import gnu.java.security.OID; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; +import java.math.BigInteger; + public class PolicyConstraint extends Extension.Value { diff --git a/gnu/java/security/x509/ext/PolicyMappings.java b/gnu/java/security/x509/ext/PolicyMappings.java index 827e83fe0..81cb88c13 100644 --- a/gnu/java/security/x509/ext/PolicyMappings.java +++ b/gnu/java/security/x509/ext/PolicyMappings.java @@ -38,16 +38,16 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.util.Collections; -import java.util.HashMap; -import java.util.Map; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; + public class PolicyMappings extends Extension.Value { diff --git a/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java b/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java index 108af4bcf..8e7e9e230 100644 --- a/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java +++ b/gnu/java/security/x509/ext/PrivateKeyUsagePeriod.java @@ -38,14 +38,14 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.util.Date; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; +import java.util.Date; + public class PrivateKeyUsagePeriod extends Extension.Value { diff --git a/gnu/java/security/x509/ext/ReasonCode.java b/gnu/java/security/x509/ext/ReasonCode.java index 779611de1..d9651652c 100644 --- a/gnu/java/security/x509/ext/ReasonCode.java +++ b/gnu/java/security/x509/ext/ReasonCode.java @@ -38,14 +38,14 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; -import java.math.BigInteger; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; +import java.io.IOException; +import java.math.BigInteger; + public class ReasonCode extends Extension.Value { diff --git a/gnu/java/security/x509/ext/SubjectAlternativeNames.java b/gnu/java/security/x509/ext/SubjectAlternativeNames.java index 19c0bdee8..73f36b1e3 100644 --- a/gnu/java/security/x509/ext/SubjectAlternativeNames.java +++ b/gnu/java/security/x509/ext/SubjectAlternativeNames.java @@ -38,11 +38,11 @@ exception statement from your version. */ package gnu.java.security.x509.ext; +import gnu.java.security.OID; + import java.io.IOException; import java.util.List; -import gnu.java.security.OID; - public class SubjectAlternativeNames extends Extension.Value { diff --git a/gnu/java/security/x509/ext/SubjectKeyIdentifier.java b/gnu/java/security/x509/ext/SubjectKeyIdentifier.java index 2d48f7c36..910decc79 100644 --- a/gnu/java/security/x509/ext/SubjectKeyIdentifier.java +++ b/gnu/java/security/x509/ext/SubjectKeyIdentifier.java @@ -38,14 +38,14 @@ exception statement from your version. */ package gnu.java.security.x509.ext; -import java.io.IOException; - import gnu.java.security.OID; import gnu.java.security.der.DER; import gnu.java.security.der.DERReader; import gnu.java.security.der.DERValue; import gnu.java.security.x509.Util; +import java.io.IOException; + public class SubjectKeyIdentifier extends Extension.Value { diff --git a/gnu/java/security/x509/ext/package.html b/gnu/java/security/x509/ext/package.html new file mode 100644 index 000000000..468cf97d6 --- /dev/null +++ b/gnu/java/security/x509/ext/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.x509.ext package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.x509.ext</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/security/x509/package.html b/gnu/java/security/x509/package.html new file mode 100644 index 000000000..ca04ca9ab --- /dev/null +++ b/gnu/java/security/x509/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.security.x509 package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.security.x509</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/text/package.html b/gnu/java/text/package.html new file mode 100644 index 000000000..b379b9b3b --- /dev/null +++ b/gnu/java/text/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.text package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.text</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/util/package.html b/gnu/java/util/package.html new file mode 100644 index 000000000..446a9c823 --- /dev/null +++ b/gnu/java/util/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.util package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.util</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/java/util/prefs/package.html b/gnu/java/util/prefs/package.html new file mode 100644 index 000000000..b8ed83588 --- /dev/null +++ b/gnu/java/util/prefs/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in gnu.java.util.prefs package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.java.util.prefs</title></head> + +<body> +<p></p> + +</body> +</html> diff --git a/gnu/javax/swing/text/html/package.html b/gnu/javax/swing/text/html/package.html new file mode 100644 index 000000000..622c4fcc1 --- /dev/null +++ b/gnu/javax/swing/text/html/package.html @@ -0,0 +1,50 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.swing.text.html package. + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.swing.text.html</title></head> + +<body> +<p> Provides supporting classes for web browsers, + web robots, web page content analysers, web editors and + other applications applications working with Hypertext + Markup Language (HTML). +</p> + +</body> +</html> diff --git a/gnu/javax/swing/text/html/parser/HTML_401F.java b/gnu/javax/swing/text/html/parser/HTML_401F.java new file mode 100644 index 000000000..9f8814bce --- /dev/null +++ b/gnu/javax/swing/text/html/parser/HTML_401F.java @@ -0,0 +1,3730 @@ +/* HTML_401F.java -- HTML 4.01 FRAMESET DTD java conception. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser; + +import java.io.IOException; + +import javax.swing.text.html.parser.DTDConstants; + +import gnu.javax.swing.text.html.parser.models.PCDATAonly_model; +import gnu.javax.swing.text.html.parser.models.TableRowContentModel; +import gnu.javax.swing.text.html.parser.models.noTagModel; +import gnu.javax.swing.text.html.parser.models.node; +import gnu.javax.swing.text.html.parser.models.transformer; +import java.io.Serializable; +import javax.swing.text.html.parser.*; + +/** + * This class represents the java implementation of the HTML 4.01 + * ( -//W3C//DTD HTML 4.01 Frameset//EN ) Frameset version. The + * Frameset version includes as recommended, as obsoleted features and + * also the frameset support. This the default DTD to parse HTML + * documents in this implementation, containing 315 pre-defined general + * entities and 92 elements. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class HTML_401F + extends gnuDTD + implements DTDConstants, Serializable +{ + private static final long serialVersionUID = 1; + + /** + * The standard name of this DTD, + * '-//W3C//DTD HTML 4.01 Frameset//EN' + */ + public static final String DTD_NAME = "-//W3C//DTD HTML 4.01 Frameset//EN"; + + /** + * The integer representing length in pixels. + */ + static final int PIXELS = NUMBER; + + static final String[] NONE = new String[0]; + + /* Define the HTML tags. */ + static final String PCDATA = "#pcdata"; + static final String A = "a"; + static final String ABBR = "abbr"; + static final String ACRONYM = "acronym"; + static final String ADDRESS = "address"; + static final String APPLET = "applet"; + static final String AREA = "area"; + static final String B = "b"; + static final String BASE = "base"; + static final String BASEFONT = "basefont"; + static final String BDO = "bdo"; + static final String BIG = "big"; + static final String BLOCKQUOTE = "blockquote"; + static final String BODY = "body"; + static final String BR = "br"; + static final String BUTTON = "button"; + static final String CAPTION = "caption"; + static final String CENTER = "center"; + static final String CITE = "cite"; + static final String CODE = "code"; + static final String COL = "col"; + static final String COLGROUP = "colgroup"; + static final String DEFAULTS = "default"; + static final String DD = "dd"; + static final String DEL = "del"; + static final String DFN = "dfn"; + static final String DIR = "dir"; + static final String DIV = "div"; + static final String DL = "dl"; + static final String DT = "dt"; + static final String EM = "em"; + static final String FIELDSET = "fieldset"; + static final String FONT = "font"; + static final String FORM = "form"; + static final String FRAME = "frame"; + static final String FRAMESET = "frameset"; + static final String H1 = "h1"; + static final String H2 = "h2"; + static final String H3 = "h3"; + static final String H4 = "h4"; + static final String H5 = "h5"; + static final String H6 = "h6"; + static final String HEAD = "head"; + static final String HR = "hr"; + static final String HTML = "html"; + static final String I = "i"; + static final String IFRAME = "iframe"; + static final String IMG = "img"; + static final String INPUT = "input"; + static final String INS = "ins"; + static final String ISINDEX = "isindex"; + static final String KBD = "kbd"; + static final String LABEL = "label"; + static final String LEGEND = "legend"; + static final String LI = "li"; + static final String LINK = "link"; + static final String MAP = "map"; + static final String MENU = "menu"; + static final String META = "meta"; + static final String NOFRAMES = "noframes"; + static final String NOSCRIPT = "noscript"; + static final String NONES = "none"; + static final String sNAME = "name"; + static final String OBJECT = "object"; + static final String OL = "ol"; + static final String OPTGROUP = "optgroup"; + static final String OPTION = "option"; + static final String P = "p"; + static final String PARAM = "param"; + static final String PRE = "pre"; + static final String Q = "q"; + static final String S = "s"; + static final String SAMP = "samp"; + static final String SCRIPT = "script"; + static final String SELECT = "select"; + static final String SMALL = "small"; + static final String SPAN = "span"; + static final String STRIKE = "strike"; + static final String STRONG = "strong"; + static final String STYLE = "style"; + static final String SUB = "sub"; + static final String SUP = "sup"; + static final String TABLE = "table"; + static final String TBODY = "tbody"; + static final String TD = "td"; + static final String TEXTAREA = "textarea"; + static final String TFOOT = "tfoot"; + static final String TH = "th"; + static final String THEAD = "thead"; + static final String TITLE = "title"; + static final String TR = "tr"; + static final String TT = "tt"; + static final String U = "u"; + static final String UL = "ul"; + static final String VAR = "var"; + + /* Define the attribute constants. */ + static final String C_0 = "0"; + static final String C_1 = "1"; + static final String CHECKBOX = "checkbox"; + static final String DATA = "data"; + static final String FILE = "file"; + static final String GET = "get"; + static final String HIDDEN = "hidden"; + static final String IMAGE = "image"; + static final String PASSWORD = "password"; + static final String POST = "post"; + static final String RADIO = "radio"; + static final String REF = "ref"; + static final String RESET = "reset"; + static final String SUBMIT = "submit"; + static final String TEXT = "text"; + static final String ABOVE = "above"; + static final String ACCEPT = "accept"; + static final String ACCEPTCHARSET = "accept-charset"; + static final String ACCESSKEY = "accesskey"; + static final String ACTION = "action"; + static final String ALIGN = "align"; + static final String ALINK = "alink"; + static final String ALL = "all"; + static final String ALT = "alt"; + static final String APPLICATION_X_WWW_FORM_URLENCODED + = "application/x-www-form-urlencoded"; + static final String ARCHIVE = "archive"; + static final String AUTO = "auto"; + static final String AXIS = "axis"; + static final String BACKGROUND = "background"; + static final String BASELINE = "baseline"; + static final String BELOW = "below"; + static final String BGCOLOR = "bgcolor"; + static final String BORDER = "border"; + static final String BOTTOM = "bottom"; + static final String BOX = "box"; + static final String CELLPADDING = "cellpadding"; + static final String CELLSPACING = "cellspacing"; + static final String CHAR = "char"; + static final String CHAROFF = "charoff"; + static final String CHARSET = "charset"; + static final String CHECKED = "checked"; + static final String CIRCLE = "circle"; + static final String CLASS = "class"; + static final String CLASSID = "classid"; + static final String CLEAR = "clear"; + static final String CODEBASE = "codebase"; + static final String CODETYPE = "codetype"; + static final String COLOR = "color"; + static final String COLS = "cols"; + static final String COLSPAN = "colspan"; + static final String COMPACT = "compact"; + static final String CONTENT = "content"; + static final String COORDS = "coords"; + static final String DATAPAGESIZE = "datapagesize"; + static final String DATETIME = "datetime"; + static final String DECLARE = "declare"; + static final String DEFER = "defer"; + static final String DISABLED = "disabled"; + static final String DISC = "disc"; + static final String ENCTYPE = "enctype"; + static final String EVENT = "event"; + static final String FACE = "face"; + static final String FOR = "for"; + static final String FRAMEBORDER = "frameborder"; + static final String GROUPS = "groups"; + static final String HEADERS = "headers"; + static final String HEIGHT = "height"; + static final String HREF = "href"; + static final String HREFLANG = "hreflang"; + static final String HSIDES = "hsides"; + static final String HSPACE = "hspace"; + static final String HTTPEQUIV = "http-equiv"; + static final String sID = "id"; + static final String ISMAP = "ismap"; + static final String JUSTIFY = "justify"; + static final String LANG = "lang"; + static final String LANGUAGE = "language"; + static final String LEFT = "left"; + static final String LHS = "lhs"; + static final String LONGDESC = "longdesc"; + static final String LTR = "ltr"; + static final String MARGINHEIGHT = "marginheight"; + static final String MARGINWIDTH = "marginwidth"; + static final String MAXLENGTH = "maxlength"; + static final String MEDIA = "media"; + static final String METHOD = "method"; + static final String MIDDLE = "middle"; + static final String MULTIPLE = "multiple"; + static final String NO = "no"; + static final String NOHREF = "nohref"; + static final String NORESIZE = "noresize"; + static final String NOSHADE = "noshade"; + static final String NOWRAP = "nowrap"; + static final String ONBLUR = "onblur"; + static final String ONCHANGE = "onchange"; + static final String ONCLICK = "onclick"; + static final String ONDBLCLICK = "ondblclick"; + static final String ONFOCUS = "onfocus"; + static final String ONKEYDOWN = "onkeydown"; + static final String ONKEYPRESS = "onkeypress"; + static final String ONKEYUP = "onkeyup"; + static final String ONLOAD = "onload"; + static final String ONMOUSEDOWN = "onmousedown"; + static final String ONMOUSEMOVE = "onmousemove"; + static final String ONMOUSEOUT = "onmouseout"; + static final String ONMOUSEOVER = "onmouseover"; + static final String ONMOUSEUP = "onmouseup"; + static final String ONRESET = "onreset"; + static final String ONSELECT = "onselect"; + static final String ONSUBMIT = "onsubmit"; + static final String ONUNLOAD = "onunload"; + static final String POLY = "poly"; + static final String PROFILE = "profile"; + static final String PROMPT = "prompt"; + static final String READONLY = "readonly"; + static final String RECT = "rect"; + static final String REL = "rel"; + static final String REV = "rev"; + static final String RHS = "rhs"; + static final String RIGHT = "right"; + static final String ROW = "row"; + static final String ROWGROUP = "rowgroup"; + static final String ROWS = "rows"; + static final String ROWSPAN = "rowspan"; + static final String RTL = "rtl"; + static final String RULES = "rules"; + static final String SCHEME = "scheme"; + static final String SCOPE = "scope"; + static final String SCROLLING = "scrolling"; + static final String SELECTED = "selected"; + static final String SHAPE = "shape"; + static final String SIZE = "size"; + static final String SQUARE = "square"; + static final String SRC = "src"; + static final String STANDBY = "standby"; + static final String START = "start"; + static final String SUMMARY = "summary"; + static final String TABINDEX = "tabindex"; + static final String TARGET = "target"; + static final String TOP = "top"; + static final String TYPE = "type"; + static final String USEMAP = "usemap"; + static final String VALIGN = "valign"; + static final String VALUE = "value"; + static final String VALUETYPE = "valuetype"; + static final String VERSION = "version"; + static final String VLINK = "vlink"; + static final String VOID = "void"; + static final String VSIDES = "vsides"; + static final String VSPACE = "vspace"; + static final String WIDTH = "width"; + static final String YES = "yes"; + + static final String[] BLOCK = + new String[] { + ADDRESS, BLOCKQUOTE, CENTER, DIR, + DIV, DL, FIELDSET, FORM, + H1, H2, H3, H4, H5, H6, + HR, ISINDEX, MENU, NOFRAMES, NOSCRIPT, + OL, P, PRE, TABLE, UL + }; + + /** + * Creates this DTD, filling in the entities and attributes data + * as defined in -//W3C//DTD HTML 4.01 Frameset//EN. + */ + protected HTML_401F() + { + super(DTD_NAME); + defineEntities(); + defineElements(); + } + + /** + * Either takes the document (by name) from DTD table, or + * creates a new instance and registers it in the tabe. + * The document is registerd under name "-//W3C//DTD HTML 4.01 Frameset//EN". + * @return The new or existing DTD for parsing HTML 4.01 Frameset. + */ + public static DTD getInstance() + { + try + { + DTD dtd = getDTD(DTD_NAME); + if (dtd == null || dtd.getClass().equals(DTD.class)) + { + dtd = new HTML_401F(); + putDTDHash(DTD_NAME, dtd); + } + return dtd; + } + catch (IOException ex) + { + throw new Error("This should never happen. Report the bug.", ex); + } + } + + /** + * Define all elements of this DTD. + */ + protected void defineElements() + { + /* Define the elements. */ + defElement(PCDATA, 0, false, false, null, NONE, NONE, + new AttributeList[ 0 ]); + + defElement(A, 0, false, false, null, + new String[] { + A + } + , + new String[] { + PCDATA, ABBR, ACRONYM, APPLET, + B, BASEFONT, BDO, BIG, BR, + BUTTON, CITE, CODE, DFN, EM, + FONT, I, IFRAME, IMG, INPUT, + KBD, LABEL, MAP, OBJECT, Q, + S, SAMP, SCRIPT, SELECT, SMALL, + SPAN, STRIKE, STRONG, SUB, SUP, + TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(CHARSET, null, null, 0, IMPLIED), + attr(TYPE, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(HREF, null, null, 0, IMPLIED), + attr(HREFLANG, null, null, 0, IMPLIED), + attr(TARGET, null, null, 0, IMPLIED), + attr(REL, null, null, 0, IMPLIED), + attr(REV, null, null, 0, IMPLIED), + attr(ACCESSKEY, null, null, 0, IMPLIED), + attr(SHAPE, RECT, new String[] { RECT, CIRCLE, POLY, DEFAULTS }, + 0, DEFAULT), + attr(COORDS, null, null, 0, IMPLIED), + attr(TABINDEX, null, null, NUMBER, IMPLIED), + attr(ONFOCUS, null, null, 0, IMPLIED), + attr(ONBLUR, null, null, 0, IMPLIED) + } + ); + defElement(ABBR, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(ACRONYM, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(ADDRESS, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + P + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(APPLET, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL, PARAM + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(CODEBASE, null, null, 0, IMPLIED), + attr(ARCHIVE, null, null, 0, IMPLIED), + attr(CODE, null, null, 0, IMPLIED), + attr(OBJECT, null, null, 0, IMPLIED), + attr(ALT, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, REQUIRED), + attr(HEIGHT, null, null, 0, REQUIRED), + attr(ALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, LEFT, RIGHT }, + 0, IMPLIED), + attr(HSPACE, null, null, 0, IMPLIED), + attr(VSPACE, null, null, 0, IMPLIED) + } + ); + defElement(AREA, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(SHAPE, RECT, new String[] { RECT, CIRCLE, POLY, DEFAULTS }, + 0, DEFAULT), + attr(COORDS, null, null, 0, IMPLIED), + attr(HREF, null, null, 0, IMPLIED), + attr(TARGET, null, null, 0, IMPLIED), + attr(NOHREF, null, new String[] { NOHREF }, 0, IMPLIED), + attr(ALT, null, null, 0, REQUIRED), + attr(TABINDEX, null, null, NUMBER, IMPLIED), + attr(ACCESSKEY, null, null, 0, IMPLIED), + attr(ONFOCUS, null, null, 0, IMPLIED), + attr(ONBLUR, null, null, 0, IMPLIED) + } + ); + defElement(B, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(BASE, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(HREF, null, null, 0, IMPLIED), + attr(TARGET, null, null, 0, IMPLIED) + } + ); + defElement(BASEFONT, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(SIZE, null, null, 0, REQUIRED), + attr(COLOR, null, null, 0, IMPLIED), + attr(FACE, null, null, 0, IMPLIED) + } + ); + defElement(BDO, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, REQUIRED) + } + ); + defElement(BIG, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(BLOCKQUOTE, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(CITE, null, null, 0, IMPLIED) + } + ); + defElement(BODY, 0, true, true, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DEL, DIR, + DIV, DL, FIELDSET, FORM, H1, + H2, H3, H4, H5, H6, + HR, INS, ISINDEX, MENU, NOFRAMES, + NOSCRIPT, OL, P, PRE, TABLE, + UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ONLOAD, null, null, 0, IMPLIED), + attr(ONUNLOAD, null, null, 0, IMPLIED), + attr(BACKGROUND, null, null, 0, IMPLIED), + attr(BGCOLOR, null, null, 0, IMPLIED), + attr(TEXT, null, null, 0, IMPLIED), + attr(LINK, null, null, 0, IMPLIED), + attr(VLINK, null, null, 0, IMPLIED), + attr(ALINK, null, null, 0, IMPLIED) + } + ); + defElement(BR, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(CLEAR, "NONE", new String[] { LEFT, ALL, RIGHT, NONES }, + 0, DEFAULT) + } + ); + defElement(BUTTON, 0, false, false, null, + new String[] { + A, BUTTON, IFRAME, INPUT, + LABEL, SELECT, TEXTAREA, FIELDSET, FORM, + ISINDEX + } + , + new String[] { + PCDATA, ABBR, ACRONYM, APPLET, + B, BASEFONT, BDO, BIG, BR, + CITE, CODE, DFN, EM, FONT, + I, IMG, KBD, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SMALL, + SPAN, STRIKE, STRONG, SUB, SUP, + TT, U, VAR, ADDRESS, BLOCKQUOTE, + CENTER, DIR, DIV, DL, H1, + H2, H3, H4, H5, H6, + HR, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(VALUE, null, null, 0, IMPLIED), + attr(TYPE, SUBMIT, new String[] { BUTTON, SUBMIT, RESET }, 0, DEFAULT), + attr(DISABLED, null, new String[] { DISABLED }, 0, IMPLIED), + attr(TABINDEX, null, null, NUMBER, IMPLIED), + attr(ACCESSKEY, null, null, 0, IMPLIED), + attr(ONFOCUS, null, null, 0, IMPLIED), + attr(ONBLUR, null, null, 0, IMPLIED) + } + ); + defElement(CAPTION, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { TOP, BOTTOM, LEFT, RIGHT }, + 0, IMPLIED) + } + ); + defElement(CENTER, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(CITE, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(CODE, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(COL, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(SPAN, C_1, null, NUMBER, DEFAULT), + attr(WIDTH, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED) + } + ); + defElement(COLGROUP, 0, false, true, null, + NONE + , + new String[] { + COL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(SPAN, C_1, null, NUMBER, DEFAULT), + attr(WIDTH, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED) + } + ); + defElement(DD, 0, false, true, new ContentModel(0, + new noTagModel( new String[] { DD, DT } ), null ), + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(DEL, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(CITE, null, null, 0, IMPLIED), + attr(DATETIME, null, null, 0, IMPLIED) + } + ); + defElement(DFN, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(DIR, 0, false, false, createListModel(), + new String[] { + ADDRESS, BLOCKQUOTE, CENTER, DIR, + DIV, DL, FIELDSET, FORM, H1, + H2, H3, H4, H5, H6, + HR, ISINDEX, MENU, NOFRAMES, NOSCRIPT, + OL, P, PRE, TABLE, UL + } + , + new String[] { + LI, UL, OL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(COMPACT, null, new String[] { COMPACT }, 0, IMPLIED) + } + ); + defElement(DIV, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(DL, 0, false, false, createDefListModel(), + NONE + , + new String[] { + DD, DT + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(COMPACT, null, new String[] { COMPACT }, 0, IMPLIED) + } + ); + defElement(DT, 0, false, true, + new ContentModel(0, + new noTagModel( new String[] { DT, DD } ), null), + BLOCK + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(EM, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(FIELDSET, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL, LEGEND + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(FONT, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(SIZE, null, null, 0, IMPLIED), + attr(COLOR, null, null, 0, IMPLIED), + attr(FACE, null, null, 0, IMPLIED) + } + ); + defElement(FORM, 0, false, false, null, + new String[] { + FORM + } + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, H1, H2, H3, + H4, H5, H6, HR, ISINDEX, + MENU, NOFRAMES, NOSCRIPT, OL, P, + PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ACTION, null, null, 0, REQUIRED), + attr(METHOD, GET, new String[] { GET, POST }, 0, DEFAULT), + attr(ENCTYPE, APPLICATION_X_WWW_FORM_URLENCODED, null, 0, DEFAULT), + attr(ACCEPT, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(ONSUBMIT, null, null, 0, IMPLIED), + attr(ONRESET, null, null, 0, IMPLIED), + attr(TARGET, null, null, 0, IMPLIED), + attr(ACCEPTCHARSET, null, null, 0, IMPLIED) + } + ); + defElement(FRAME, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LONGDESC, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(SRC, null, null, 0, IMPLIED), + attr(FRAMEBORDER, C_1, new String[] { C_1, C_0 }, 0, DEFAULT), + attr(MARGINWIDTH, null, null, PIXELS, IMPLIED), + attr(MARGINHEIGHT, null, null, PIXELS, IMPLIED), + attr(NORESIZE, null, new String[] { NORESIZE }, 0, IMPLIED), + attr(SCROLLING, AUTO, new String[] { YES, NO, AUTO }, 0, DEFAULT) + } + ); + defElement(FRAMESET, 0, false, false, null, + NONE + , + new String[] { + NOFRAMES, FRAME, FRAMESET + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(ROWS, null, null, 0, IMPLIED), + attr(COLS, null, null, 0, IMPLIED), + attr(ONLOAD, null, null, 0, IMPLIED), + attr(ONUNLOAD, null, null, 0, IMPLIED) + } + ); + defElement(H1, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(H2, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(H3, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(H4, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(H5, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(H6, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(HEAD, 0, true, true, null, + new String[] { + BODY + } + , + new String[] { + TITLE, ISINDEX, BASE, + SCRIPT, STYLE, META, LINK, OBJECT + } + , + new AttributeList[] { + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(PROFILE, null, null, 0, IMPLIED) + } + ); + + defElement(HR, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT }, 0, IMPLIED), + attr(NOSHADE, null, new String[] { NOSHADE }, 0, IMPLIED), + attr(SIZE, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, IMPLIED) + } + ); + defElement(HTML, 0, true, true, createHtmlContentModel(), + NONE + , + new String[] { + HEAD, BODY + } + , + new AttributeList[] { + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(VERSION, DTD_NAME, null, 0, FIXED) + } + ); + defElement(I, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(IFRAME, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LONGDESC, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(SRC, null, null, 0, IMPLIED), + attr(FRAMEBORDER, C_1, new String[] { C_1, C_0 }, 0, DEFAULT), + attr(MARGINWIDTH, null, null, PIXELS, IMPLIED), + attr(MARGINHEIGHT, null, null, PIXELS, IMPLIED), + attr(SCROLLING, AUTO, new String[] { YES, NO, AUTO }, 0, DEFAULT), + attr(ALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, LEFT, RIGHT }, + 0, IMPLIED), + attr(HEIGHT, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, IMPLIED) + } + ); + defElement(IMG, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(SRC, null, null, 0, REQUIRED), + attr(ALT, null, null, 0, REQUIRED), + attr(LONGDESC, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(HEIGHT, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, IMPLIED), + attr(USEMAP, null, null, 0, IMPLIED), + attr(ISMAP, null, new String[] { ISMAP }, 0, IMPLIED), + attr(ALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, LEFT, RIGHT }, + 0, IMPLIED), + attr(BORDER, null, null, PIXELS, IMPLIED), + attr(HSPACE, null, null, 0, IMPLIED), + attr(VSPACE, null, null, 0, IMPLIED) + } + ); + defElement(INPUT, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(TYPE, TEXT, new String[] { TEXT, PASSWORD, CHECKBOX, RADIO, + SUBMIT, RESET, FILE, HIDDEN, IMAGE, BUTTON }, 0, DEFAULT), + attr(sNAME, null, null, 0, IMPLIED), + attr(VALUE, null, null, 0, IMPLIED), + attr(CHECKED, null, new String[] { CHECKED }, 0, IMPLIED), + attr(DISABLED, null, new String[] { DISABLED }, 0, IMPLIED), + attr(READONLY, null, new String[] { READONLY }, 0, IMPLIED), + attr(SIZE, null, null, 0, IMPLIED), + attr(MAXLENGTH, null, null, 0, IMPLIED), + attr(SRC, null, null, 0, IMPLIED), + attr(ALT, null, null, 0, IMPLIED), + attr(USEMAP, null, null, 0, IMPLIED), + attr(ISMAP, null, new String[] { ISMAP }, 0, IMPLIED), + attr(TABINDEX, null, null, NUMBER, IMPLIED), + attr(ACCESSKEY, null, null, 0, IMPLIED), + attr(ONFOCUS, null, null, 0, IMPLIED), + attr(ONBLUR, null, null, 0, IMPLIED), + attr(ONSELECT, null, null, 0, IMPLIED), + attr(ONCHANGE, null, null, 0, IMPLIED), + attr(ACCEPT, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, LEFT, RIGHT }, + 0, IMPLIED) + } + ); + defElement(INS, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(CITE, null, null, 0, IMPLIED), + attr(DATETIME, null, null, 0, IMPLIED) + } + ); + defElement(ISINDEX, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(PROMPT, null, null, 0, IMPLIED) + } + ); + defElement(KBD, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(LABEL, 0, false, false, null, + new String[] { + LABEL + } + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, MAP, OBJECT, Q, + S, SAMP, SCRIPT, SELECT, SMALL, + SPAN, STRIKE, STRONG, SUB, SUP, + TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(FOR, null, null, 0, IMPLIED), + attr(ACCESSKEY, null, null, 0, IMPLIED), + attr(ONFOCUS, null, null, 0, IMPLIED), + attr(ONBLUR, null, null, 0, IMPLIED) + } + ); + defElement(LEGEND, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ACCESSKEY, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { TOP, BOTTOM, LEFT, RIGHT }, + 0, IMPLIED) + } + ); + // LI has a special content model that will be resolved into + // by transformer. + defElement(LI, 0, false, true, + new ContentModel(0, + new noTagModel(LI), null), + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(TYPE, null, null, 0, IMPLIED), + attr(VALUE, null, null, NUMBER, IMPLIED) + } + ); + defElement(LINK, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(CHARSET, null, null, 0, IMPLIED), + attr(HREF, null, null, 0, IMPLIED), + attr(HREFLANG, null, null, 0, IMPLIED), + attr(TYPE, null, null, 0, IMPLIED), + attr(REL, null, null, 0, IMPLIED), + attr(REV, null, null, 0, IMPLIED), + attr(MEDIA, null, null, 0, IMPLIED), + attr(TARGET, null, null, 0, IMPLIED) + } + ); + defElement(MAP, 0, false, false, null, + NONE + , + new String[] { + ADDRESS, BLOCKQUOTE, CENTER, DIR, + DIV, DL, FIELDSET, FORM, H1, + H2, H3, H4, H5, H6, + HR, ISINDEX, MENU, NOFRAMES, NOSCRIPT, + OL, P, PRE, TABLE, UL, + AREA + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, REQUIRED) + } + ); + defElement(MENU, 0, false, false, createListModel(), + new String[] { + ADDRESS, BLOCKQUOTE, CENTER, DIR, + DIV, DL, FIELDSET, FORM, H1, + H2, H3, H4, H5, H6, + HR, ISINDEX, MENU, NOFRAMES, NOSCRIPT, + OL, P, PRE, TABLE, UL + } + , + new String[] { + LI, UL, OL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(COMPACT, null, new String[] { COMPACT }, 0, IMPLIED) + } + ); + defElement(META, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(HTTPEQUIV, null, null, 0, IMPLIED), + attr(sNAME, null, null, NAME, IMPLIED), + attr(CONTENT, null, null, 0, REQUIRED), + attr(SCHEME, null, null, 0, IMPLIED) + } + ); + defElement(NOFRAMES, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(NOSCRIPT, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(OBJECT, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL, PARAM + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(DECLARE, null, new String[] { DECLARE }, 0, IMPLIED), + attr(CLASSID, null, null, 0, IMPLIED), + attr(CODEBASE, null, null, 0, IMPLIED), + attr(DATA, null, null, 0, IMPLIED), + attr(TYPE, null, null, 0, IMPLIED), + attr(CODETYPE, null, null, 0, IMPLIED), + attr(ARCHIVE, null, null, 0, IMPLIED), + attr(STANDBY, null, null, 0, IMPLIED), + attr(HEIGHT, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, IMPLIED), + attr(USEMAP, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(TABINDEX, null, null, NUMBER, IMPLIED), + attr(ALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, LEFT, RIGHT }, + 0, IMPLIED), + attr(BORDER, null, null, PIXELS, IMPLIED), + attr(HSPACE, null, null, 0, IMPLIED), + attr(VSPACE, null, null, 0, IMPLIED) + } + ); + defElement(OL, 0, false, false, createListModel(), + NONE + , + new String[] { + // See note on the createListModel method + LI, UL, OL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(TYPE, null, null, 0, IMPLIED), + attr(COMPACT, null, new String[] { COMPACT }, 0, IMPLIED), + attr(START, null, null, 0, IMPLIED) + } + ); + defElement(OPTGROUP, 0, false, false, null, + NONE + , + new String[] { + OPTION + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(DISABLED, null, new String[] { DISABLED }, 0, IMPLIED), + attr(LABEL, null, null, 0, REQUIRED) + } + ); + defElement(OPTION, 0, false, true, new ContentModel(0, + new PCDATAonly_model(), null), + NONE, + new String[] { + PCDATA + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(SELECTED, null, new String[] { SELECTED }, 0, IMPLIED), + attr(DISABLED, null, new String[] { DISABLED }, 0, IMPLIED), + attr(LABEL, null, null, 0, IMPLIED), + attr(VALUE, null, null, 0, IMPLIED) + } + ); + defElement(P, 0, false, true, new ContentModel( 0, + new noTagModel(P), null), + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY }, + 0, IMPLIED) + } + ); + defElement(PARAM, EMPTY, false, true, null, + NONE + , + NONE + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(sNAME, null, null, 0, REQUIRED), + attr(VALUE, null, null, 0, IMPLIED), + attr(VALUETYPE, DATA, new String[] { DATA, REF, OBJECT }, 0, DEFAULT), + attr(TYPE, null, null, 0, IMPLIED) + } + ); + defElement(PRE, 0, false, false, null, + new String[] { + APPLET, BASEFONT, BIG, FONT, + IMG, OBJECT, SMALL, SUB, SUP + } + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + B, BDO, BR, BUTTON, CITE, + CODE, DFN, EM, I, IFRAME, + INPUT, KBD, LABEL, MAP, Q, + S, SAMP, SCRIPT, SELECT, SPAN, + STRIKE, STRONG, TEXTAREA, TT, U, + VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(WIDTH, null, null, NUMBER, IMPLIED) + } + ); + defElement(Q, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(CITE, null, null, 0, IMPLIED) + } + ); + defElement(S, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(SAMP, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(SCRIPT, CDATA, false, false, null, + NONE + , + NONE + , + new AttributeList[] { + attr(CHARSET, null, null, 0, IMPLIED), + attr(TYPE, null, null, 0, REQUIRED), + attr(LANGUAGE, null, null, 0, IMPLIED), + attr(SRC, null, null, 0, IMPLIED), + attr(DEFER, null, new String[] { DEFER }, 0, IMPLIED), + attr(EVENT, null, null, 0, IMPLIED), + attr(FOR, null, null, 0, IMPLIED) + } + ); + defElement(SELECT, 0, false, false, null, + NONE + , + new String[] { + OPTGROUP, OPTION + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(SIZE, null, null, NUMBER, IMPLIED), + attr(MULTIPLE, null, new String[] { MULTIPLE }, 0, IMPLIED), + attr(DISABLED, null, new String[] { DISABLED }, 0, IMPLIED), + attr(TABINDEX, null, null, NUMBER, IMPLIED), + attr(ONFOCUS, null, null, 0, IMPLIED), + attr(ONBLUR, null, null, 0, IMPLIED), + attr(ONCHANGE, null, null, 0, IMPLIED) + } + ); + defElement(SMALL, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(SPAN, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(STRIKE, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(STRONG, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(STYLE, CDATA, false, false, null, + NONE + , + NONE + , + new AttributeList[] { + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(TYPE, null, null, 0, REQUIRED), + attr(MEDIA, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED) + } + ); + defElement(SUB, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(SUP, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(TABLE, 0, false, false, createTableContentModel(), + NONE + , + new String[] { + CAPTION, COL, COLGROUP, TBODY, + TFOOT, THEAD + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(SUMMARY, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, IMPLIED), + attr(BORDER, null, null, PIXELS, IMPLIED), + attr(FRAME, null, new String[] { VOID, ABOVE, BELOW, HSIDES, LHS, RHS, + VSIDES, BOX, BORDER }, 0, IMPLIED), + attr(RULES, null, new String[] { NONES, GROUPS, ROWS, COLS, ALL }, + 0, IMPLIED), + attr(CELLSPACING, null, null, 0, IMPLIED), + attr(CELLPADDING, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT }, 0, IMPLIED), + attr(BGCOLOR, null, null, 0, IMPLIED), + attr(DATAPAGESIZE, null, null, 0, IMPLIED) + } + ); + defElement(TBODY, 0, true, true, model(TR,'+'), + NONE + , + new String[] { + TR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED) + } + ); + + defElement(TD, 0, false, true, + new ContentModel(0, + new noTagModel(new String[] {"TD", "TH", "TR" } ), null), + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ABBR, null, null, 0, IMPLIED), + attr(AXIS, null, null, 0, IMPLIED), + attr(HEADERS, null, null, 0, IMPLIED), + attr(SCOPE, null, new String[] { ROW, COL, ROWGROUP, COLGROUP }, + 0, IMPLIED), + attr(ROWSPAN, C_1, null, NUMBER, DEFAULT), + attr(COLSPAN, C_1, null, NUMBER, DEFAULT), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED), + attr(NOWRAP, null, new String[] { NOWRAP }, 0, IMPLIED), + attr(BGCOLOR, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, IMPLIED), + attr(HEIGHT, null, null, 0, IMPLIED) + } + ); + defElement(TEXTAREA, 0, false, false, null, + NONE + , + new String[] { + PCDATA + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(sNAME, null, null, 0, IMPLIED), + attr(ROWS, null, null, NUMBER, REQUIRED), + attr(COLS, null, null, NUMBER, REQUIRED), + attr(DISABLED, null, new String[] { DISABLED }, 0, IMPLIED), + attr(READONLY, null, new String[] { READONLY }, 0, IMPLIED), + attr(TABINDEX, null, null, NUMBER, IMPLIED), + attr(ACCESSKEY, null, null, 0, IMPLIED), + attr(ONFOCUS, null, null, 0, IMPLIED), + attr(ONBLUR, null, null, 0, IMPLIED), + attr(ONSELECT, null, null, 0, IMPLIED), + attr(ONCHANGE, null, null, 0, IMPLIED) + } + ); + defElement(TFOOT, 0, false, true, model(TR,'+'), + NONE + , + new String[] { + TR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED) + } + ); + defElement(TH, 0, false, true, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR, + ADDRESS, BLOCKQUOTE, CENTER, DIR, DIV, + DL, FIELDSET, FORM, H1, H2, + H3, H4, H5, H6, HR, + ISINDEX, MENU, NOFRAMES, NOSCRIPT, OL, + P, PRE, TABLE, UL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ABBR, null, null, 0, IMPLIED), + attr(AXIS, null, null, 0, IMPLIED), + attr(HEADERS, null, null, 0, IMPLIED), + attr(SCOPE, null, new String[] { ROW, COL, ROWGROUP, COLGROUP }, + 0, IMPLIED), + attr(ROWSPAN, C_1, null, NUMBER, DEFAULT), + attr(COLSPAN, C_1, null, NUMBER, DEFAULT), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED), + attr(NOWRAP, null, new String[] { NOWRAP }, 0, IMPLIED), + attr(BGCOLOR, null, null, 0, IMPLIED), + attr(WIDTH, null, null, 0, IMPLIED), + attr(HEIGHT, null, null, 0, IMPLIED) + } + ); + defElement(THEAD, 0, false, true, model(TR,'+'), + NONE + , + new String[] { + TR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED) + } + ); + defElement(TITLE, 0, false, false, null, + new String[] { + OBJECT, SCRIPT, LINK, META, + STYLE + } + , + new String[] { + PCDATA + } + , + new AttributeList[] { + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED) + } + ); + defElement(TR, 0, false, true, + new ContentModel(0, new TableRowContentModel(this), null), + NONE + , + new String[] { + TD, TH + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(ALIGN, null, new String[] { LEFT, CENTER, RIGHT, JUSTIFY, CHAR }, + 0, IMPLIED), + attr(CHAR, null, null, 0, IMPLIED), + attr(CHAROFF, null, null, 0, IMPLIED), + attr(VALIGN, null, new String[] { TOP, MIDDLE, BOTTOM, BASELINE }, + 0, IMPLIED), + attr(BGCOLOR, null, null, 0, IMPLIED) + } + ); + defElement(TT, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(U, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + defElement(UL, 0, false, false, createListModel(), + NONE + , + new String[] { + // See note on the createListModel method + LI, UL, OL + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED), + attr(TYPE, null, new String[] { DISC, SQUARE, CIRCLE }, 0, IMPLIED), + attr(COMPACT, null, new String[] { COMPACT }, 0, IMPLIED) + } + ); + defElement(VAR, 0, false, false, null, + NONE + , + new String[] { + PCDATA, A, ABBR, ACRONYM, + APPLET, B, BASEFONT, BDO, BIG, + BR, BUTTON, CITE, CODE, DFN, + EM, FONT, I, IFRAME, IMG, + INPUT, KBD, LABEL, MAP, OBJECT, + Q, S, SAMP, SCRIPT, SELECT, + SMALL, SPAN, STRIKE, STRONG, SUB, + SUP, TEXTAREA, TT, U, VAR + } + , + new AttributeList[] { + attr(sID, null, null, ID, IMPLIED), + attr(CLASS, null, null, 0, IMPLIED), + attr(STYLE, null, null, 0, IMPLIED), + attr(TITLE, null, null, 0, IMPLIED), + attr(LANG, null, null, 0, IMPLIED), + attr(DIR, null, new String[] { LTR, RTL }, 0, IMPLIED), + attr(ONCLICK, null, null, 0, IMPLIED), + attr(ONDBLCLICK, null, null, 0, IMPLIED), + attr(ONMOUSEDOWN, null, null, 0, IMPLIED), + attr(ONMOUSEUP, null, null, 0, IMPLIED), + attr(ONMOUSEOVER, null, null, 0, IMPLIED), + attr(ONMOUSEMOVE, null, null, 0, IMPLIED), + attr(ONMOUSEOUT, null, null, 0, IMPLIED), + attr(ONKEYPRESS, null, null, 0, IMPLIED), + attr(ONKEYDOWN, null, null, 0, IMPLIED), + attr(ONKEYUP, null, null, 0, IMPLIED) + } + ); + + } + + /** + * Define all entities in this DTD. + */ + protected void defineEntities() + { + /* Define general entities */ + defineEntity("AElig", 198); + defineEntity("Aacute", 193); + defineEntity("Acirc", 194); + defineEntity("Agrave", 192); + defineEntity("Alpha", 913); + defineEntity("Aring", 197); + defineEntity("Atilde", 195); + defineEntity("Auml", 196); + defineEntity("Beta", 914); + defineEntity("Ccedil", 199); + defineEntity("Chi", 935); + defineEntity("Dagger", 8225); + defineEntity("Delta", 916); + defineEntity("ETH", 208); + defineEntity("Eacute", 201); + defineEntity("Ecirc", 202); + defineEntity("Egrave", 200); + defineEntity("Epsilon", 917); + defineEntity("Eta", 919); + defineEntity("Euml", 203); + defineEntity("Gamma", 915); + defineEntity("Iacute", 205); + defineEntity("Icirc", 206); + defineEntity("Igrave", 204); + defineEntity("Iota", 921); + defineEntity("Iuml", 207); + defineEntity("Kappa", 922); + defineEntity("Lambda", 923); + defineEntity("Mu", 924); + defineEntity("Ntilde", 209); + defineEntity("Nu", 925); + defineEntity("OElig", 338); + defineEntity("Oacute", 211); + defineEntity("Ocirc", 212); + defineEntity("Ograve", 210); + defineEntity("Omega", 937); + defineEntity("Omicron", 927); + defineEntity("Oslash", 216); + defineEntity("Otilde", 213); + defineEntity("Ouml", 214); + defineEntity("Phi", 934); + defineEntity("Pi", 928); + defineEntity("Prime", 8243); + defineEntity("Psi", 936); + defineEntity("Rho", 929); + defineEntity("Scaron", 352); + defineEntity("Sigma", 931); + defineEntity("THORN", 222); + defineEntity("Tau", 932); + defineEntity("Theta", 920); + defineEntity("Uacute", 218); + defineEntity("Ucirc", 219); + defineEntity("Ugrave", 217); + defineEntity("Upsilon", 933); + defineEntity("Uuml", 220); + defineEntity("Xi", 926); + defineEntity("Yacute", 221); + defineEntity("Yuml", 376); + defineEntity("Zeta", 918); + defineEntity("aacute", 225); + defineEntity("acirc", 226); + defineEntity("acute", 180); + defineEntity("aelig", 230); + defineEntity("agrave", 224); + defineEntity("alefsym", 8501); + defineEntity("alpha", 945); + defineEntity("amp", 38); + defineEntity("and", 8743); + defineEntity("ang", 8736); + defineEntity("aring", 229); + defineEntity("asymp", 8776); + defineEntity("atilde", 227); + defineEntity("auml", 228); + defineEntity("bdquo", 8222); + defineEntity("beta", 946); + defineEntity("brvbar", 166); + defineEntity("bull", 8226); + defineEntity("cap", 8745); + defineEntity("ccedil", 231); + defineEntity("cedil", 184); + defineEntity("cent", 162); + defineEntity("chi", 967); + defineEntity("circ", 710); + defineEntity("clubs", 9827); + defineEntity("cong", 8773); + defineEntity("copy", 169); + defineEntity("crarr", 8629); + defineEntity("cup", 8746); + defineEntity("curren", 164); + defineEntity("dArr", 8659); + defineEntity("dagger", 8224); + defineEntity("darr", 8595); + defineEntity("deg", 176); + defineEntity("delta", 948); + defineEntity("diams", 9830); + defineEntity("divide", 247); + defineEntity("eacute", 233); + defineEntity("ecirc", 234); + defineEntity("egrave", 232); + defineEntity("empty", 8709); + defineEntity("emsp", 8195); + defineEntity("ensp", 8194); + defineEntity("epsilon", 949); + defineEntity("equiv", 8801); + defineEntity("eta", 951); + defineEntity("eth", 240); + defineEntity("euml", 235); + defineEntity("euro", 8364); + defineEntity("exist", 8707); + defineEntity("fnof", 402); + defineEntity("forall", 8704); + defineEntity("frac12", 189); + defineEntity("frac14", 188); + defineEntity("frac34", 190); + defineEntity("frasl", 8260); + defineEntity("gamma", 947); + defineEntity("ge", 8805); + defineEntity("gt", 62); + defineEntity("hArr", 8660); + defineEntity("harr", 8596); + defineEntity("hearts", 9829); + defineEntity("hellip", 8230); + defineEntity("iacute", 237); + defineEntity("icirc", 238); + defineEntity("iexcl", 161); + defineEntity("igrave", 236); + defineEntity("image", 8465); + defineEntity("infin", 8734); + defineEntity("int", 8747); + defineEntity("iota", 953); + defineEntity("iquest", 191); + defineEntity("isin", 8712); + defineEntity("iuml", 239); + defineEntity("kappa", 954); + defineEntity("lArr", 8656); + defineEntity("lambda", 955); + defineEntity("lang", 9001); + defineEntity("laquo", 171); + defineEntity("larr", 8592); + defineEntity("lceil", 8968); + defineEntity("ldquo", 8220); + defineEntity("le", 8804); + defineEntity("lfloor", 8970); + defineEntity("lowast", 8727); + defineEntity("loz", 9674); + defineEntity("lrm", 8206); + defineEntity("lsaquo", 8249); + defineEntity("lsquo", 8216); + defineEntity("lt", 60); + defineEntity("macr", 175); + defineEntity("mdash", 8212); + defineEntity("micro", 181); + defineEntity("middot", 183); + defineEntity("minus", 8722); + defineEntity("mu", 956); + defineEntity("nabla", 8711); + defineEntity("nbsp", 160); + defineEntity("ndash", 8211); + defineEntity("ne", 8800); + defineEntity("ni", 8715); + defineEntity("not", 172); + defineEntity("notin", 8713); + defineEntity("nsub", 8836); + defineEntity("ntilde", 241); + defineEntity("nu", 957); + defineEntity("oacute", 243); + defineEntity("ocirc", 244); + defineEntity("oelig", 339); + defineEntity("ograve", 242); + defineEntity("oline", 8254); + defineEntity("omega", 969); + defineEntity("omicron", 959); + defineEntity("oplus", 8853); + defineEntity("or", 8744); + defineEntity("ordf", 170); + defineEntity("ordm", 186); + defineEntity("oslash", 248); + defineEntity("otilde", 245); + defineEntity("otimes", 8855); + defineEntity("ouml", 246); + defineEntity("para", 182); + defineEntity("part", 8706); + defineEntity("permil", 8240); + defineEntity("perp", 8869); + defineEntity("phi", 966); + defineEntity("pi", 960); + defineEntity("piv", 982); + defineEntity("plusmn", 177); + defineEntity("pound", 163); + defineEntity("prime", 8242); + defineEntity("prod", 8719); + defineEntity("prop", 8733); + defineEntity("psi", 968); + defineEntity("quot", 34); + defineEntity("rArr", 8658); + defineEntity("radic", 8730); + defineEntity("rang", 9002); + defineEntity("raquo", 187); + defineEntity("rarr", 8594); + defineEntity("rceil", 8969); + defineEntity("rdquo", 8221); + defineEntity("real", 8476); + defineEntity("reg", 174); + defineEntity("rfloor", 8971); + defineEntity("rho", 961); + defineEntity("rlm", 8207); + defineEntity("rsaquo", 8250); + defineEntity("rsquo", 8217); + defineEntity("sbquo", 8218); + defineEntity("scaron", 353); + defineEntity("sdot", 8901); + defineEntity("sect", 167); + defineEntity("shy", 173); + defineEntity("sigma", 963); + defineEntity("sigmaf", 962); + defineEntity("sim", 8764); + defineEntity("spades", 9824); + defineEntity("sub", 8834); + defineEntity("sube", 8838); + defineEntity("sum", 8721); + defineEntity("sup", 8835); + defineEntity("sup1", 185); + defineEntity("sup2", 178); + defineEntity("sup3", 179); + defineEntity("supe", 8839); + defineEntity("szlig", 223); + defineEntity("tau", 964); + defineEntity("there4", 8756); + defineEntity("theta", 952); + defineEntity("thetasym", 977); + defineEntity("thinsp", 8201); + defineEntity("thorn", 254); + defineEntity("tilde", 732); + defineEntity("times", 215); + defineEntity("trade", 8482); + defineEntity("uArr", 8657); + defineEntity("uacute", 250); + defineEntity("uarr", 8593); + defineEntity("ucirc", 251); + defineEntity("ugrave", 249); + defineEntity("uml", 168); + defineEntity("upsih", 978); + defineEntity("upsilon", 965); + defineEntity("uuml", 252); + defineEntity("weierp", 8472); + defineEntity("xi", 958); + defineEntity("yacute", 253); + defineEntity("yen", 165); + defineEntity("yuml", 255); + defineEntity("zeta", 950); + defineEntity("zwj", 8205); + defineEntity("zwnj", 8204); + } + + /** + * Crate a content model, consisting of the single + * element, specified by name. + */ + private ContentModel model(String element) + { + return new ContentModel(getElement(element)); + } + + /** + * Crate a chain from the two content models, + * the last containing the given element and + * the specified unary operation. + */ + private ContentModel model(String element, int unary) + { + ContentModel ct = model(element); + ct.type = unary; + return new ContentModel(0, ct); + } + + /** + * Create the model HEAD, BODY + * @return + */ + protected ContentModel createHtmlContentModel() + { + ContentModel head = model(HEAD); + ContentModel body = model(BODY); + head.next = body; + head.type = ','; + return head; + } + + /** + * Create the model + * ( CAPTION ? , ( COL * | COLGROUP * ) , THEAD ? , TFOOT ? , TBODY + ) + */ + protected ContentModel createTableContentModel() + { + ContentModel col_colgroup = new ContentModel + ('|', model(COL,'*'), model(COLGROUP,'*') ); + + col_colgroup = new ContentModel('*', col_colgroup); + col_colgroup = new ContentModel(',', col_colgroup); + + ContentModel caption = model(CAPTION,'?'); + ContentModel thead = model(THEAD, '?'); + ContentModel tfoot = model(TFOOT, '?'); + ContentModel tbody = model(TBODY, '+'); + + caption.next = col_colgroup; + col_colgroup.next = thead; + thead.next = tfoot; + tfoot.next = tbody; + + caption.type = col_colgroup.type = thead.type = tfoot.type = + tbody.type = ','; + + return caption; + } + + /** + * Creates a model for <DL> tag: + * <code> DT+ | DL+ </code>. + * @return + */ + protected ContentModel createDefListModel() + { + ContentModel dt = model(DT, '+'); + ContentModel dd = model(DD, '+'); + + dt.next = dd; + dt.type = dd.type = '|'; + return dt; + } + + /** + * This model is used for UL, OL, MENU and DIR. + * HTML 4.01 specifies LI only, but the nested + * list seems rendered correctly only if + * it is not enclosed into <LI>-</LI> of the + * parent list. + */ + protected ContentModel createListModel() + { + ContentModel li = model(LI, '+'); + ContentModel ul = model(UL, '+'); + ContentModel ol = model(OL, '+'); + + li.next = ul; + ul.next = ol; + li.type = ul.type = ol.type = '|'; + return li; + } + +} diff --git a/gnu/javax/swing/text/html/parser/gnuDTD.java b/gnu/javax/swing/text/html/parser/gnuDTD.java new file mode 100644 index 000000000..ba23223fd --- /dev/null +++ b/gnu/javax/swing/text/html/parser/gnuDTD.java @@ -0,0 +1,423 @@ +/* gnuDTD.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser; + +import java.io.PrintStream; +import java.io.Serializable; + +import java.util.BitSet; +import java.util.Collection; +import java.util.Iterator; +import java.util.Map; +import java.util.Vector; + +import javax.swing.text.html.parser.AttributeList; +import javax.swing.text.html.parser.ContentModel; +import javax.swing.text.html.parser.DTD; +import javax.swing.text.html.parser.Element; +import javax.swing.text.html.parser.Entity; + +/** + * <p> + * The class is derived from {@link gnu.javax.swing.text.html.parser.DTD } + * making structure creation methods public. This is required when + * creating the DTD by SGML parser that must have access to the structure. + * + * SGML DTD representation. Provides basis for describing a syntax of the + * HTML documents. The fields of this class are NOT initialized in + * constructor. You need to do this separately before passing this data + * structure to the parser constructor.</p> + * + * <p>This implementation also provides you the derived class + * <code>gnu.javax.swing.text.html.parser.DTD.HTML_4_0_1</code>, where + * all fields are initialized to the values, representing HTML 4.01 + * ("-//W3C//DTD HTML 4.01 Frameset//EN") DTD. You can use it if you do not care + * about the portability between different implementations of the core + * class libraries. </p> + * <p>Use {@link javax.swing.HTML.HTMLEditorKit.Parser#parse } + * for parsing in accordance with "-//W3C//DTD HTML 4.01 Frameset//EN" + * without specifying DTD separately.</p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class gnuDTD + extends javax.swing.text.html.parser.DTD + implements javax.swing.text.html.parser.DTDConstants, Serializable +{ + /* The undocumented element types, used to specify types, not defined + in DTDConstants. */ + + /** + * The URI element type (not defined in DTDConstants). + */ + public static final int URI = 512; + + /** + * The Length element type + */ + public static final int Length = 513; + + /** + * The Char element type + */ + public static final int Char = 514; + + /** + * The Color element type + */ + public static final int Color = 515; + + /** + * Creates a new instance of gnuDTD. + * @param name the name of the DTD. + */ + public gnuDTD(String name) + { + super(name); + } + + /** + * Creates and returns new attribute (not an attribute list). + * @param name the name of this attribute + * @param type the type of this attribute (FIXED, IMPLIED or + * REQUIRED from <code>DTDConstants</code>). + * @param modifier the modifier of this attribute + * @param default_value the default value of this attribute or null if + * it is not specified. + * @param allowed_values the allowed values of this attribute. The multiple + * possible values in this parameter are supposed to be separated by + * '|', same as in SGML DTD <code><!ATTLIST </code>tag. This parameter + * can be null if no list of allowed values is specified. + * @param atts the previous attribute of this element. This is + * placed to the field + * {@link javax.swing.text.html.parser.AttributeList#next }, + * creating a linked list. + * @return + */ + public AttributeList defAttributeList(String name, int type, int modifier, + String default_value, + String allowed_values, + AttributeList atts + ) + { + return super.defAttributeList(name, type, modifier, default_value, + allowed_values, atts + ); + } + + /** + * Define the attributes for the element with the given name. + * If the element is not exist, it is created. This method is + * needed if the element attributes are defined befor the + * element itself. + * @param forElement + * @param attributes + */ + public void defAttrsFor(String forElement, AttributeList attributes) + { + super.defineAttributes(forElement, attributes); + } + + /** + * Creates a new content model. + * @param type specifies the BNF operation for this content model. + * The valid operations are documented in the + * {@link javax.swing.text.html.parser.ContentModel#type }. + * @param content the content of this content model + * @param next if the content model is specified by BNF-like + * expression, contains the rest of this expression. + * @return The newly created content model. + */ + public ContentModel defContentModel(int type, Object content, + ContentModel next + ) + { + return super.defContentModel(type, content, next); + } + + /** + * Defines a new element and adds it to the element table. + * If the element alredy exists, + * overrides it settings with the specified values. + * @param name the name of the new element + * @param type the type of the element + * @param headless true if the element needs no starting tag + * @param tailless true if the element needs no closing tag + * @param content the element content. + * @param exclusions the elements that must be excluded from the + * content of this element, in all levels of the hierarchy. + * @param inclusions the elements that can be included as the + * content of this element. + * @param attributes the element attributes. + * @return the created or updated element. + */ + public Element defElement(String name, int type, boolean headless, + boolean tailless, ContentModel content, + String[] exclusions, String[] inclusions, + AttributeList attributes + ) + { + return super.defElement(name, type, headless, tailless, content, + exclusions, inclusions, attributes + ); + } + + /** + * Defines a new element and adds it to the element table. + * If the element alredy exists, + * overrides it settings with the specified values. + * @param name the name of the new element + * @param type the type of the element + * @param headless true if the element needs no starting tag + * @param tailless true if the element needs no closing tag + * @param content the element content. + * @param exclusions the elements that must be excluded from the + * content of this element, in all levels of the hierarchy. + * @param inclusions the elements that can be included as the + * content of this element. + * @param attributes the element attributes. + * @return the created or updated element. + */ + public Element defElement(String name, int type, boolean headless, + boolean tailless, ContentModel content, + Collection exclusions, Collection inclusions, + AttributeList attributes + ) + { + return super.defElement(name, type, headless, tailless, content, + toStringArray(exclusions), + toStringArray(inclusions), attributes + ); + } + + /** + * Defines a new element and adds it to the element table. + * If the element alredy exists, + * overrides it settings with the specified values. + * @param name the name of the new element + * @param type the type of the element + * @param headless true if the element needs no starting tag + * @param tailless true if the element needs no closing tag + * @param content the element content. + * @param exclusions the elements that must be excluded from the + * content of this element, in all levels of the hierarchy. + * @param inclusions the elements that can be included as the + * content of this element. + * @param attributes the element attributes (an array and not a + * linked list). The attributes are chained into the linked list + * inside this method. + * @return the created or updated element. + */ + public Element defElement(String name, int type, boolean headless, + boolean tailless, ContentModel content, + String[] exclusions, String[] inclusions, + AttributeList[] attributes + ) + { + AttributeList list; + + if (attributes == null || attributes.length == 0) + list = null; + else + { + if (attributes.length > 1) + for (int i = 1; i < attributes.length; i++) + { + attributes [ i - 1 ].next = attributes [ i ]; + } + list = attributes [ 0 ]; + } + + Element e = + super.defElement(name, type, headless, tailless, content, exclusions, + inclusions, list + ); + return e; + } + + /** + * Creates, adds into the internal table and returns the + * character entity like <code>&lt;</code> + * (means '<code><</code>' ); + * This method inactivates the recursive refenrences to the same + * entity. + * @param name The entity name (without heading & and closing ;) + * @param type The entity type + * @param character The entity value (single character) + * @return The created entity + */ + public Entity defEntity(String name, int type, String data) + { + int r; + String eref = "%" + name + ";"; + do + { + r = data.indexOf(eref); + if (r > 0) + { + data = data.substring(0, r) + data.substring(r + 1); + } + } + while (r > 0); + + return super.defEntity(name, type, data); + } + + /** + * Summarises the document content into the given PrintStream. + */ + public void dump(PrintStream p) + { + Iterator iter = entityHash.entrySet().iterator(); + while (iter.hasNext()) + { + Map.Entry item = (Map.Entry) iter.next(); + Entity e = (Entity) item.getValue(); + if (e.isGeneral()) + p.println("Entity " + e.getName() + ": " + e.getString()); + } + + iter = elementHash.entrySet().iterator(); + while (iter.hasNext()) + { + Map.Entry item = (Map.Entry) iter.next(); + Element e = (Element) item.getValue(); + p.println("Element " + e.getName()); + + System.out.println(" includes:"); + dump(e.inclusions); + System.out.println(" excludes:"); + dump(e.exclusions); + System.out.println(" attributes:"); + + AttributeList atts = e.atts; + while (atts != null) + { + p.print(" " + atts.name + " = " + atts.value); + if (atts.values == null || atts.values.size() == 0) + p.println(); + else + { + Iterator viter = atts.values.iterator(); + System.out.print(" ( "); + while (viter.hasNext()) + { + System.out.print(viter.next()); + if (viter.hasNext()) + System.out.print(" | "); + } + System.out.println(" ) "); + } + atts = atts.next; + } + } + } + + /** + * Prints the content of the given attribute set to the System.out. + * @param b + */ + public void dump(BitSet b) + { + if (b != null) + { + for (int i = 0; i < b.size(); i++) + { + if (b.get(i)) + System.out.println(" " + elements.get(i)); + } + } + else + System.out.println(" NULL set"); + } + + /** + * Creates the attribute. + * @param name The attribute name. + * @param type The attribute type. + * @param modifier The attribute modifier. + * @param defaultValue Default value (or null) + * @param allowed_values Allowed values (or null) + * @return The newly created AttributeList. The <code>next</code> + * field is initialized to null. + */ + protected AttributeList attr(String name, String default_value, + String[] allowed_values, int type, int modifier + ) + { + Vector allowed = null; + + if (allowed_values != null) + { + allowed = new Vector(allowed_values.length); + for (int i = 0; i < allowed_values.length; i++) + { + allowed.add(allowed_values [ i ]); + } + } + ; + + AttributeList attr = + new AttributeList(name, type, modifier, default_value, allowed, null); + + return attr; + } + + /** + * Define the general entity, holding a single character. + * @param name The entity name (for example, 'amp'). + * The defined entity <b>is</b> stored into the entity table. + * @param character The entity character (for example, '&'). + */ + protected void defineEntity(String name, int character) + { + super.defEntity(name, GENERAL, character); + } + + private String[] toStringArray(Collection c) + { + String[] s = new String[ c.size() ]; + Iterator iter = c.iterator(); + for (int i = 0; i < s.length; i++) + { + s [ i ] = iter.next().toString(); + } + return s; + } +} diff --git a/gnu/javax/swing/text/html/parser/htmlAttributeSet.java b/gnu/javax/swing/text/html/parser/htmlAttributeSet.java new file mode 100644 index 000000000..f42b46328 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/htmlAttributeSet.java @@ -0,0 +1,133 @@ +/* htmlAttributeSet.java -- A set to store HTML attributes + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser; + +import java.util.Enumeration; + +import javax.swing.text.AttributeSet; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.html.HTML; + +/** + * A set, adapted to store HTML attributes. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class htmlAttributeSet + extends SimpleAttributeSet +{ + public static final htmlAttributeSet EMPTY_HTML_ATTRIBUTE_SET = + new htmlAttributeSet(); + AttributeSet parent; + + /** + * Looks in this set and, if not found, later looks in the parent set. + * Calls toString(), allowing to pass as HTML.Attribute, as String + * to this method. + * @param key A key to search for a value. + * @return The value, if one is defined. + */ + public Object getAttribute(Object _key) + { + Object key = _key.toString().toLowerCase(); + + Object v = super.getAttribute(key); + if (v != null) + return v; + else if (parent != null) + return parent.getAttribute(key); + else + return null; + } + + /** + * The name set must return HTML.Attribute and not a string, + * where applicable. + */ + public Enumeration getAttributeNames() + { + // Replace the string keys by HTML.attribute, where applicable + final Enumeration enumeration = super.getAttributeNames(); + + return new Enumeration() + { + public boolean hasMoreElements() + { + return enumeration.hasMoreElements(); + } + + public Object nextElement() + { + Object key = enumeration.nextElement(); + HTML.Attribute hKey = HTML.getAttributeKey((String) key); + if (hKey != null) + return hKey; + else + return key; + } + }; + } + + /** + * Set the parent set, containing the default values. + * @param a_parent + */ + public void setResolveParent(AttributeSet a_parent) + { + parent = a_parent; + } + + /** + * Get the parent set, containing the default values. + * @return + */ + public AttributeSet getResolveParent() + { + return parent; + } + + /** + * Add the attribute to this attribute set. + * @param key Attribute key (will be case insensitive) + * @param value Attribute value + */ + public void addAttribute(Object key, Object value) + { + super.addAttribute(key.toString().toLowerCase(), value); + } +} diff --git a/gnu/javax/swing/text/html/parser/htmlValidator.java b/gnu/javax/swing/text/html/parser/htmlValidator.java new file mode 100644 index 000000000..456e008a0 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/htmlValidator.java @@ -0,0 +1,609 @@ +/* tagStack.java -- The HTML tag stack. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.models.node; +import gnu.javax.swing.text.html.parser.models.transformer; + +import java.util.BitSet; +import java.util.Enumeration; +import java.util.LinkedList; +import java.util.ListIterator; + +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.html.HTML; +import javax.swing.text.html.parser.*; + +/** + * <p>The HTML content validator, is responsible for opening and + * closing elements with optional start/end tags, detecting + * the wrongly placed html tags and reporting errors. The working instance + * is the inner class inside the {@link javax.swing.text.html.parser.Parser } + * </p> + * <p>This class could potentially + * provide basis for automated closing and insertion of the html tags, + * correcting the found html errors. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class htmlValidator +{ + /** + * The tag reference, holding additional information that the tag + * has been forcibly closed. + */ + protected class hTag + { + protected final Element element; + protected final HTML.Tag tag; + protected final TagElement tgElement; + protected boolean forcibly_closed; + protected node validationTrace; + + protected hTag(TagElement an_element) + { + element = an_element.getElement(); + tag = an_element.getHTMLTag(); + tgElement = an_element; + + if (element.content != null) + validationTrace = transformer.transform(element.content, dtd); + } + + /** + * This is called when the tag must be forcibly closed because + * it would make the newly appearing tag invalid. + * The parser is not notified about such event (just the error + * is reported). For such tags, the closing message does not + * appear when later reaching the end of stream. The exception is + * the <head> tag: the parser is notified about its silent closing + * when <body> or other html content appears. + */ + protected void forciblyCloseDueContext() + { + forcibly_closed = true; + } + + /** + * This is called when the tag must be forcibly closed after + * reaching the end of stream. The parser is notified as if + * closing the tag explicitly. + */ + protected void forciblyCloseDueEndOfStream() + { + forcibly_closed = true; + handleSupposedEndTag(element); + } + } + + /** + * The DTD, providing information about the valid document structure. + */ + protected final DTD dtd; + + /** + * The stack, holding the current tag context. + */ + protected final LinkedList stack = new LinkedList(); + + /** + * Creates a new tag stack, using the given DTD. + * @param a_dtd A DTD, providing the information about the valid + * tag content. + */ + public htmlValidator(DTD a_dtd) + { + dtd = a_dtd; + } + + /** + * Close all opened tags (called at the end of parsing). + */ + public void closeAll() + { + hTag h; + while (!stack.isEmpty()) + { + h = (hTag) stack.getLast(); + if (!h.forcibly_closed && !h.element.omitEnd()) + s_error("Unclosed <" + h.tag + ">, closing at the end of stream"); + + handleSupposedEndTag(h.element); + + closeTag(h.tgElement); + } + } + + /** + * Remove the given tag from the stack or (if found) from the list + * of the forcibly closed tags. + */ + public void closeTag(TagElement tElement) + { + HTML.Tag tag = tElement.getHTMLTag(); + hTag x; + hTag close; + + if (!stack.isEmpty()) + { + ListIterator iter = stack.listIterator(stack.size()); + + while (iter.hasPrevious()) + { + x = (hTag) iter.previous(); + if (tag.equals(x.tag)) + { + if (x.forcibly_closed && !x.element.omitEnd()) + s_error("The tag <" + x.tag + + "> has already been forcibly closed" + ); + + + // If the tag has a content model defined, forcibly close all + // tags that were opened after the tag being currently closed. + closing: + if (x.element.content != null) + { + iter = stack.listIterator(stack.size()); + while (iter.hasPrevious()) + { + close = (hTag) iter.previous(); + if (close == x) + break closing; + handleSupposedEndTag(close.element); + iter.remove(); + } + } + + stack.remove(x); + return; + } + } + } + s_error("Closing unopened <" + tag + ">"); + } + + /** + * Add the given HTML tag to the stack of the opened tags. Forcibly closes + * all tags in the stack that does not allow this tag in they content (error + * is reported). + * @param element + */ + public void openTag(TagElement tElement, htmlAttributeSet parameters) + { + // If this is a fictional call, the message from the parser + // has recursively returned - ignore. + if (tElement.fictional()) + return; + + validateParameters(tElement, parameters); + + // If the stack is empty, start from HTML + if (stack.isEmpty() && tElement.getHTMLTag() != HTML.Tag.HTML) + { + Element html = dtd.getElement(HTML.Tag.HTML.toString()); + openFictionalTag(html); + } + + Object v = tagIsValidForContext(tElement); + if (v != Boolean.TRUE) + { + // The tag is not valid for context, the content + // model suggest to open another tag. + if (v instanceof Element) + { + int n = 0; + while (v instanceof Element && (n++ < 100)) + { + Element fe = (Element) v; + + // notify the content model that we add the proposed tag + getCurrentContentModel().show(fe); + openFictionalTag(fe); + + Object vv = tagIsValidForContext(tElement); + if (vv instanceof Element) // One level of nesting is supported. + { + openFictionalTag((Element) vv); + + Object vx = tagIsValidForContext(tElement); + if (vx instanceof Element) + openFictionalTag((Element) vx); + } + else if (vv == Boolean.FALSE) + { + // The tag is still not valid for the current + // content after opening a fictional element. + if (fe.omitEnd()) + { + // close the previously opened fictional tag. + closeLast(); + vv = tagIsValidForContext(tElement); + if (vv instanceof Element) + + // another tag was suggested by the content model + openFictionalTag((Element) vv); + } + } + v = tagIsValidForContext(tElement); + } + } + else // If the current element has the optional end tag, close it. + { + if (!stack.isEmpty()) + { + closing: + do + { + hTag last = (hTag) stack.getLast(); + if (last.element.omitEnd()) + { + closeLast(); + v = tagIsValidForContext(tElement); + if (v instanceof Element) // another tag was suggested by the content model + { + openFictionalTag((Element) v); + break closing; + } + } + else + break closing; + } + while (v == Boolean.FALSE && !stack.isEmpty()); + } + } + } + + stack.add(new hTag(tElement)); + } + + /** + * Clear the stack. + */ + public void restart() + { + stack.clear(); + } + + /** + * Check if this tag is valid for the current context. + * Return Boolean.True if it is OK, Boolean.False + * if it is surely not OK or the Element that the + * content model recommends to insert making the situation + * ok. If Boolean.True is returned, the content model current + * position is moved forward. Otherwise this position remains + * the same. + * @param tElement + * @return + */ + public Object tagIsValidForContext(TagElement tElement) + { + // Check the current content model, if one is available. + node cv = getCurrentContentModel(); + + if (cv != null) + return cv.show(tElement.getElement()); + + // Check exclusions and inclusions. + ListIterator iter = stack.listIterator(stack.size()); + hTag t; + final int idx = tElement.getElement().index; + + // Check only known tags. + if (idx >= 0) + { + BitSet inclusions = new BitSet(); + while (iter.hasPrevious()) + { + t = (hTag) iter.previous(); + if (!t.forcibly_closed) + { + if (t.element.exclusions != null && + t.element.exclusions.get(idx) + ) + return Boolean.FALSE; + + if (t.element.inclusions != null) + inclusions.or(t.element.inclusions); + } + } + if (!inclusions.get(idx)) + return Boolean.FALSE; + } + return Boolean.TRUE; + } + + /** + * Validate tag without storing in into the tag stack. This is called + * for the empty tags and results the subsequent calls to the openTag + * and closeTag. + */ + public void validateTag(TagElement tElement, htmlAttributeSet parameters) + { + openTag(tElement, parameters); + closeTag(tElement); + } + + /** + * Check for mandatory elements, subsequent to the last tag: + * @param tElement The element that will be inserted next. + */ + protected void checkContentModel(TagElement tElement, boolean first) + { + if (stack.isEmpty()) + return; + + hTag last = (hTag) stack.getLast(); + if (last.validationTrace == null) + return; + + Object r = last.validationTrace.show(tElement.getElement()); + if (r == Boolean.FALSE) + s_error("The <" + last.element + "> does not match the content model " + + last.validationTrace + ); + else if (r instanceof Element) // The content model recommends insertion of this element + { + if (!first) + closeTag(last.tgElement); + handleSupposedStartTag((Element) r); + openTag(new TagElement((Element) r), null); + } + } + + /** + * The method is called when the tag must be closed because + * it does not allow the subsequent elements inside its context + * or the end of stream has been reached. The parser is only + * informed if the element being closed does not require the + * end tag (the "omitEnd" flag is set). + * The closing message must be passed to the parser mechanism + * before passing message about the opening the next tag. + * + * @param element The tag being fictionally (forcibly) closed. + */ + protected abstract void handleSupposedEndTag(Element element); + + /** + * The method is called when the validator decides to open the + * tag on its own initiative. This may happen if the content model + * includes the element with the optional (supposed) start tag. + * + * @param element The tag being opened. + */ + protected abstract void handleSupposedStartTag(Element element); + + /** + * Handles the error message. This method must be overridden to pass + * the message where required. + * @param msg The message text. + */ + protected abstract void s_error(String msg); + + /** + * Validate the parameters, report the error if the given parameter is + * not in the parameter set, valid for the given attribute. The information + * about the valid parameter set is taken from the Element, enclosed + * inside the tag. The method does not validate the default parameters. + * @param tag The tag + * @param parameters The parameters of this tag. + */ + protected void validateParameters(TagElement tag, htmlAttributeSet parameters) + { + if (parameters == null || + parameters == htmlAttributeSet.EMPTY_HTML_ATTRIBUTE_SET || + parameters == SimpleAttributeSet.EMPTY + ) + return; + + Enumeration enumeration = parameters.getAttributeNames(); + + while (enumeration.hasMoreElements()) + { + validateAttribute(tag, parameters, enumeration); + } + + // Check for missing required values. + AttributeList a = tag.getElement().getAttributes(); + + while (a != null) + { + if (a.getModifier() == DTDConstants.REQUIRED) + if (parameters.getAttribute(a.getName()) == null) + { + s_error("Missing required attribute '" + a.getName() + + "' for <" + tag.getHTMLTag() + ">"); + } + a = a.next; + } + } + + private node getCurrentContentModel() + { + if (!stack.isEmpty()) + { + hTag last = (hTag) stack.getLast(); + return last.validationTrace; + } + else + return null; + } + + private void closeLast() + { + handleSupposedEndTag(((hTag) stack.getLast()).element); + stack.removeLast(); + } + + private void openFictionalTag(Element e) + { + handleSupposedStartTag(e); + stack.add(new hTag(new TagElement(e, true))); + if (!e.omitStart()) + s_error("<" + e + "> is expected (supposing it)"); + } + + private void validateAttribute(TagElement tag, htmlAttributeSet parameters, + Enumeration enumeration + ) + { + Object foundAttribute; + AttributeList dtdAttribute; + foundAttribute = enumeration.nextElement(); + dtdAttribute = tag.getElement().getAttribute(foundAttribute.toString()); + if (dtdAttribute == null) + { + StringBuffer valid = + new StringBuffer("The tag <" + tag.getHTMLTag() + + "> cannot contain the attribute '" + foundAttribute + + "'. The valid attributes for this tag are: " + ); + + AttributeList a = tag.getElement().getAttributes(); + + while (a != null) + { + valid.append(a.name.toUpperCase()); + valid.append(' '); + a = a.next; + } + s_error(valid.toString()); + } + + else + { + String value = parameters.getAttribute(foundAttribute).toString(); + + if (dtdAttribute.type == DTDConstants.NUMBER) + validateNumberAttribute(tag, foundAttribute, value); + + if (dtdAttribute.type == DTDConstants.NAME || + dtdAttribute.type == DTDConstants.ID + ) + validateNameOrIdAttribute(tag, foundAttribute, value); + + if (dtdAttribute.values != null) + validateAttributeWithValueList(tag, foundAttribute, dtdAttribute, + value + ); + } + } + + private void validateAttributeWithValueList(TagElement tag, + Object foundAttribute, + AttributeList dtdAttribute, + String value + ) + { + if (!dtdAttribute.values.contains(value.toLowerCase()) && + !dtdAttribute.values.contains(value.toUpperCase()) + ) + { + StringBuffer valid; + if (dtdAttribute.values.size() == 1) + valid = + new StringBuffer("The attribute '" + foundAttribute + + "' of the tag <" + tag.getHTMLTag() + + "> cannot have the value '" + value + + "'. The only valid value is " + ); + else + valid = + new StringBuffer("The attribute '" + foundAttribute + + "' of the tag <" + tag.getHTMLTag() + + "> cannot have the value '" + value + "'. The " + + dtdAttribute.values.size() + + " valid values are: " + ); + + Enumeration vv = dtdAttribute.values.elements(); + while (vv.hasMoreElements()) + { + valid.append('"'); + valid.append(vv.nextElement()); + valid.append("\" "); + } + s_error(valid.toString()); + } + } + + private void validateNameOrIdAttribute(TagElement tag, Object foundAttribute, + String value + ) + { + boolean ok = true; + + if (!Character.isLetter(value.charAt(0))) + ok = false; + + char c; + for (int i = 0; i < value.length(); i++) + { + c = value.charAt(i); + if (!( + Character.isLetter(c) || Character.isDigit(c) || + "".indexOf(c) >= 0 + ) + ) + ok = false; + } + if (!ok) + s_error("The '" + foundAttribute + "' attribute of the tag <" + + tag.getHTMLTag() + "> must start from letter and consist of " + + "letters, digits, hypens, colons, underscores and periods. " + + "It cannot be '" + value + "'" + ); + } + + private void validateNumberAttribute(TagElement tag, Object foundAttribute, + String value + ) + { + try + { + Integer.parseInt(value); + } + catch (NumberFormatException ex) + { + s_error("The '" + foundAttribute + "' attribute of the tag <" + + tag.getHTMLTag() + "> must be a valid number and not '" + + value + "'" + ); + } + } +} diff --git a/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java b/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java new file mode 100644 index 000000000..4bfc3b960 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/models/PCDATAonly_model.java @@ -0,0 +1,62 @@ +/* PCDATAonly_model.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.models; + +import java.io.Serializable; + +/** + * The model, allowing only PCDATA in it (like for element OPTION). + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class PCDATAonly_model + extends node + implements Serializable +{ + private static final long serialVersionUID = 1; + + public PCDATAonly_model() + { + super((char) 0, (char) 0, null); + } + + public Object show(Object x) + { + return x.toString().equalsIgnoreCase("#pcdata") ? Boolean.TRUE : Boolean.FALSE; + } +} diff --git a/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java b/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java new file mode 100644 index 000000000..1a803d547 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/models/TableRowContentModel.java @@ -0,0 +1,77 @@ +/* TableRowContentModel.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.models; + +import java.io.Serializable; + +import javax.swing.text.html.parser.DTD; +import javax.swing.text.html.parser.Element; + +/** + * Table row content model. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class TableRowContentModel + extends node + implements Serializable +{ + private static final long serialVersionUID = 1; + final Element TD; + + public TableRowContentModel(DTD dtd) + { + super((char) 0, (char) 0, null); + TD = dtd.getElement("TD"); + } + + public Object show(Object x) + { + // Always accept TD and TH + String s = x.toString(); + if (s.equalsIgnoreCase("TD") || s.equalsIgnoreCase("TH")) + return Boolean.TRUE; + + // Suggest closing in response to TR: + if (s.equalsIgnoreCase("TR")) + return Boolean.FALSE; + + // Recommend TD for other cases: + return TD; + } +} diff --git a/gnu/javax/swing/text/html/parser/models/list.java b/gnu/javax/swing/text/html/parser/models/list.java new file mode 100644 index 000000000..1fa16d965 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/models/list.java @@ -0,0 +1,382 @@ +/* list.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.models; + +import java.io.Serializable; + +/** + * Part of the internal representation of the content model. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class list + extends node + implements Serializable +{ + private static final long serialVersionUID = 1; + + /** + * Setting to true means that the list nodes must always be connected + * by the same operation. This is far safer and clearer, but not + * required by default standard. + */ + public static boolean CLEAR; + + /** + * A list of nodes. + */ + public final node[] nodes; + + /** + * Creates a new model list that is a member of some enclosing list. + * @param binary_operator An operator with that this list is connected + * with other members of the enclosing list. + * @param unary_operator The unary operator for this list. + * @param a_nodes The nodes inside this list. + */ + public list(char binary_operator, char unary_operator, node[] a_nodes) + { + super(binary_operator, unary_operator, a_nodes); + nodes = a_nodes; + } + + /** + * Creates a new model list. Assigns the previous field. + * @param a_nodes The nodes for this list. + * @throws an error if the node elements are connected by the + * different operations. This is not supported, use grouping. + */ + public list(node[] a_nodes) + throws Error + { + this(',', (char) 0, a_nodes); + + int operation = nodes [ 0 ].binary; + + for (int i = 0; i < nodes.length; i++) + { + if (CLEAR && nodes [ i ].binary != operation) + throw new Error("List members can only be connected by " + + "the same operation, use grouping" + ); + + if (i > 0) + nodes [ i ].previous = nodes [ i - 1 ]; + } + } + + /** + * Returns true if all members in the list are closed. + */ + public boolean isClosed() + { + if (super.isClosed()) + return true; + for (int i = 0; i < nodes.length; i++) + { + if (!nodes [ i ].isClosed()) + return false; + } + return true; + } + + /** + * Find the token that could match as the next token in + * the token list. + * + * @return Such token object or null if none is found. + */ + public Object findFreeNode() + { + Object fn; + for (int j = 0; j < nodes.length; j++) + { + if (!nodes [ j ].isClosed()) + { + fn = nodes [ j ].findFreeNode(); + if (fn != null) + return fn; + } + } + return null; + } + + /** + * Tries to match this list agains the given token sequence. + * @param tokens the sequence of the tokens to match. + * @return true if the valid match is found. + */ + public boolean matches(Object[] tokens) + { + reset(); + + Object x; + boolean m; + boolean matched = false; + + for (int i = 0; i < tokens.length; i++) + { + matched = false; + x = tokens [ i ]; + + nodescan: + for (int j = 0; j < nodes.length; j++) + { + if (!nodes [ j ].isClosed()) + { + m = nodes [ j ].performMatch(x); + + if (m) + { + matched = true; + break nodescan; + } + } + } + if (!matched) + return false; + } + + boolean valid = true; + + for (int i = 0; i < nodes.length; i++) + { + if (!nodes [ i ].valid()) + valid = false; + } + + return valid; + } + + /** + * The list never closes, despite it is trated as closed + * if all members in the list are closed. + * @return false. + */ + public boolean mustClose() + { + return false; + } + + /** + * Perform a match operation for the single token + * against this list. + * @param token a token to match. + * @return true if the match is found. + */ + public boolean performMatch(Object token) + { + boolean ok = false; + Matching: + for (int i = 0; i < nodes.length; i++) + { + ok = nodes [ i ].performMatch(token); + + if (ok) + break Matching; + } + + if (ok) + matches(); + + return ok; + } + + /** + * Prepeares the list for the next matching operation. + */ + public void reset() + { + super.reset(); + for (int i = 0; i < nodes.length; i++) + nodes [ i ].reset(); + } + + /** + * Check if the provided token can match as a next token in the + * list. In the case of match, the list state changes, moving + * current position after the matched token. However if this method + * returns a suggested new token to insert before the provided one, + * the state of the list does not change. + * @return Boolean.TRUE if the match is found, + * Boolean.FALSE if the match is not possible and no token can be + * inserted to make the match valid. Otherwise, returns the + * token object that can be inserted before the last token in the + * list, probably (not for sure) making the match valid. + * If the object is an instance of Element or TagElement, + * it is first ensured that the object flag "omit start" is set. + */ + public Object show(Object x) + { + boolean m; + boolean matched = false; + + nodescan: + for (int j = 0; j < nodes.length; j++) + { + if (!nodes [ j ].isClosed()) + { + m = nodes [ j ].performMatch(x); + + if (m) + { + matched = true; + break nodescan; + } + else + { + // For comma operation, only first not closed + // node must be tested for a match. + // unless it allows matching zero times. + if (binary == ',' && + !(nodes [ j ].unary == '?' || nodes [ j ].unary == '*') + ) + break nodescan; + } + } + } + + if (!matched) + { + // Find and return that would be matched. + Object freeNode = findFreeNode(); + if (freeNode == null) + return Boolean.FALSE; + else + return freeNode; + } + + for (int i = 0; i < nodes.length; i++) + if (!nodes [ i ].validPreliminary()) + { + return Boolean.FALSE; + } + + return Boolean.TRUE; + } + + /** + * Returns a string representation of the list. + * @return String representation, similar to BNF expression. + */ + public String toString() + { + StringBuffer b = new StringBuffer(); + b.append(" ( "); + for (int i = 0; i < nodes.length; i++) + { + if (i > 0) + b.append(" " + (char) nodes [ i ].binary + " "); + b.append(nodes [ i ]); + } + + b.append(" )"); + if (unary != 0) + b.append((char) unary); + else + b.append(' '); + return b.toString(); + } + + /** + * Returns true if all memebers in the list are valid. + */ + public boolean valid() + { + for (int i = 0; i < nodes.length; i++) + { + if (!nodes [ i ].valid()) + return false; + } + return true; + } + + /** + * Returns true if all memebers in the list are either valid + * or unvisited. The unvisited members can become valid after + * more tokens will be shown. + */ + public boolean validPreliminary() + { + if (silenceAllowed()) + { + boolean everVisited = false; + for (int i = 0; i < nodes.length; i++) + { + if (nodes [ i ].visits > 0) + { + everVisited = true; + break; + } + } + if (!everVisited) + return true; + } + + for (int i = 0; i < nodes.length; i++) + { + if (!nodes [ i ].validPreliminary()) + return false; + } + return true; + } + + /** + * Closes all members in the list. + */ + protected void close() + { + super.close(); + for (int i = 0; i < nodes.length; i++) + { + nodes [ i ].close(); + } + } + + /** + * Compare given token with the token of this node. + * If the token represents a <code>list</code>, the call may be + * delegeted to the child subnodes. + * @param a_token A token to compare. + * @return True if the token matches the token of this node. + */ + protected boolean compare(Object a_token) + { + return performMatch(a_token); + } +} diff --git a/gnu/javax/swing/text/html/parser/models/noTagModel.java b/gnu/javax/swing/text/html/parser/models/noTagModel.java new file mode 100644 index 000000000..7ac58f050 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/models/noTagModel.java @@ -0,0 +1,75 @@ +/* noTagModel.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.models; + +import java.io.Serializable; + +/** + * Disallows a single given tag at the current content level only. + * <p>@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)</p> + */ +public class noTagModel + extends node + implements Serializable +{ + private static final long serialVersionUID = 1; + final String[] no; + + public noTagModel(String[] noTag) + { + super((char) 0, (char) 0, null); + no = noTag; + } + + public noTagModel(String noTag) + { + super((char) 0, (char) 0, null); + no = new String[] { noTag }; + } + + public Object show(Object x) + { + for (int i = 0; i < no.length; i++) + { + if (x.toString().equalsIgnoreCase(no [ i ])) + return Boolean.FALSE; + } + return Boolean.TRUE; + } +} diff --git a/gnu/javax/swing/text/html/parser/models/node.java b/gnu/javax/swing/text/html/parser/models/node.java new file mode 100644 index 000000000..7b12d11eb --- /dev/null +++ b/gnu/javax/swing/text/html/parser/models/node.java @@ -0,0 +1,340 @@ +/* node.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.models; + +import java.io.Serializable; + +import javax.swing.text.html.parser.Element; +import javax.swing.text.html.parser.TagElement; + +/** + * Part of the internal representation of the content model. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class node + implements Serializable +{ + private static final long serialVersionUID = 1; + + /** + * The token to match (can be instance of list). + */ + public Object token; + + /** + * True for the node that cannot be visited again. + */ + public boolean _closed; + + /** + * The binary operation for this node. + */ + public char binary; + + /** + * The unary opeation for this node. + */ + public char unary; + + /** + * The number of times the node already was visited. + */ + public int visits; + + /** + * The previous node in content model (used for closing nodes). + */ + public node previous; + + /** + * Creates a new node. + * @param binary_operator The operator, connecting all nodes in the list. + * The nodes, connected by the different operators, must be arranged into + * the different lists. + * @param unary_operator The unary operator for this node or zero if + * no such was specified. + * @param token The token to match. This can be either a string or + * the new instance of the list. + * @param a_previous The previous node in the list, null for the first + * node. This is used for propagating the closing operation for the + * comma delimited list. + */ + public node(char binary_operator, char unary_operator, Object a_token) + { + if (a_token != null) + if (a_token.getClass().equals(node.class)) + throw new Error("Creating node in node is redundant and ineffective."); + + binary = binary_operator; + unary = unary_operator; + token = a_token; + } + + /** + * Checks if this node is in the closed state. + * @return True if the node is closed. + */ + public boolean isClosed() + { + return _closed; + } + + /** + * Check if closing this node means closing the previous node. + */ + public boolean closePrevious() + { + return binary == ','; + } + + /** + * Return the token object if it could match as a next token in + * a token list of null if it could not. + * @return + */ + public Object findFreeNode() + { + boolean ok; + if (isClosed() || silenceAllowed()) + return null; + + // Try if the node would stay valid after a one more visit. + visits++; + ok = valid(); + visits--; + + if (ok) + { + if (token instanceof node) + return ((node) token).findFreeNode(); + else + return token; + } + else + return null; + } + + /** + * Check if the current situation is such that the node must be closed + * now. + */ + public boolean mustClose() + { + switch (unary) + { + case 0 : + return true; + + case '*' : + return false; + + case '+' : + return false; + + case '?' : + return visits <= 1; + + default : + throw new Error("Invalid unary operation " + unary + " ( '" + + (char) unary + "' )" + ); + } + } + + /** + * Do the match operation with the given token. This sets various + * flags. + * @param token The token to match. + * @return true if the the token matches node, false if it does not match + * or if the node is closed. + */ + public boolean performMatch(Object a_token) + { + if (isClosed()) + return false; + + boolean matches = compare(a_token); + if (matches) + matches(); + + return matches; + } + + /** + * Prepares the node for matching against a new list of tokens. + */ + public void reset() + { + _closed = false; + visits = 0; + } + + /** + * Check if the provided token can match this node. + * In the case of match, the node state changes, moving + * current position after the matched token. However if this method + * returns a suggested new token to insert before the provided one, + * the state of the list does not change. + * @return Boolean.TRUE if the match is found, + * Boolean.FALSE if the match is not possible and no token can be + * inserted to make the match valid. Otherwise, returns the + * token object that can be inserted before the last token in the + * list, probably (not for sure) making the match valid. + */ + public Object show(Object x) + { + if (compare(x)) + return performMatch(x) ? Boolean.TRUE : Boolean.FALSE; + + Object recommended = findFreeNode(); + return recommended != null ? recommended : Boolean.FALSE; + } + + /** + * Check if it would be a valid case if this node is visited zero times. + * Nodes with unary operator * or ? need not be matched to make a + * model valid. + */ + public boolean silenceAllowed() + { + return unary == '?' || unary == '*'; + } + + /** + * Returns a string representation of the list. + * @return String representation, similar to BNF expression. + */ + public String toString() + { + StringBuffer b = new StringBuffer(); + + b.append(token); + if (unary != 0) + b.append((char) unary); + else + b.append('\''); + + return b.toString(); + } + + /** + * Check if the node state is valid. + */ + public boolean valid() + { + switch (unary) + { + case 0 : + if (binary == '|') + return true; + else + return visits == 1; + + case '*' : + return true; + + case '+' : + return visits > 0; + + case '?' : + return visits <= 1; + + default : + throw new Error("Invalid unary operation " + unary + " ( '" + + (char) unary + "' )" + ); + } + } + + public boolean validPreliminary() + { + return visits == 0 || valid(); + } + + /** + * Closes this node and, if closePrevious() returs true, calls close() for + * the previous node. + */ + protected void close() + { + _closed = true; + if (previous != null && closePrevious()) + previous.close(); + } + + /** + * Compare the provided token object with the token object of this node. + */ + protected boolean compare(Object a_token) + { + if (token instanceof Object[]) + throw new Error("Invalid token object, probably the 'list' " + + "should be used. " + ); + + if (token instanceof node[]) + throw new Error("Do not use 'node' for the array of nodes, use 'list'. "); + + if (token instanceof node) + { + return ((node) token).performMatch(a_token); + } + + boolean rt = false; + + if (token == a_token) + rt = true; + if (token.equals(a_token)) + rt = true; + if (token.toString().equalsIgnoreCase(a_token.toString())) + rt = true; + + return rt; + } + + /** + * Fire the changes that must happen then the token matches this node. + */ + protected void matches() + { + visits++; + if (mustClose()) + close(); + } +} diff --git a/gnu/javax/swing/text/html/parser/models/package.html b/gnu/javax/swing/text/html/parser/models/package.html new file mode 100644 index 000000000..60719d0cc --- /dev/null +++ b/gnu/javax/swing/text/html/parser/models/package.html @@ -0,0 +1,53 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.swing.text.html.parser package. + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.javax.swing.text.html.parser.models</title></head> + +<body> +<p>This package contains classes for working with content models. In this implementation, the +standardized content model is pre-processed by <code>transformer</code> into an instance of +<code>node</code>. Node holds a single element of the content model with the optional unary operation. +The derived class <code>list</code> holds multiple nodes connected by the same binary operation. +As the members of this <code>list</code> can also be lists itself, these structures support +the most of required operations. Several cases when the model cannot be expressed using +BNF syntax are handled providing specialised classes that are also derived from <code>node</code>. +</p> +@author Audrius Meskauskas, Lithuania +</body> +</html> diff --git a/gnu/javax/swing/text/html/parser/models/transformer.java b/gnu/javax/swing/text/html/parser/models/transformer.java new file mode 100644 index 000000000..c8c4a2544 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/models/transformer.java @@ -0,0 +1,201 @@ +/* transformer.java -- Content model transforms. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.models; + +import java.io.Serializable; + +import javax.swing.text.html.parser.ContentModel; +import javax.swing.text.html.parser.DTD; + +/** + * Transforms the standard ContentModel tree into the internal representation, + * used in this implementation. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class transformer + implements Serializable +{ + private static final long serialVersionUID = 1; + + /** + * All binary operators. + */ + protected static String binary = "&|,"; + + /** + * All unary operators. + */ + protected static String unary = "+*?"; + + /** + * Measure length of the linked list of the content models. + * @param c The heading element of the linked list. + * @return the length of the list (0 for null 1 if c!=null and c.next==null, + * etc. + */ + public static int measureChainLength(ContentModel c) + { + if (c == null) + return 0; + else + return measureChainLength(c.next) + 1; + } + + /** + * Transform into internal representation without usind dtd. + * This should be used only for testing. + */ + public static node transform(ContentModel c) + { + return transform(c, null); + } + + /** + * Transform into internal representation. + * @param c a model to transform + * @return a transformed model + * @throws Error if the model structure contains errors. + */ + public static node transform(ContentModel c, DTD dtd) + { + // Handle the special cases first. + if (c.content instanceof node) + return (node) c.content; + + // Do the typical transform. + node n; + + /* Case with the single token */ + if (c.next == null) + { + n = optionalTransform(c, dtd); + } + else /* Case with the chain of the multiple tokens. */ + { + node[] l = new node[ measureChainLength(c) ]; + ContentModel m = c; + for (int i = 0; i < l.length; i++) + { + if (m.content instanceof ContentModel) + { + ContentModel nested = (ContentModel) m.content; + if (nested.next == null && + !(nested.content instanceof ContentModel) + ) + { + l [ i ] = + new node((char) m.type, (char) nested.type, nested.content); + } + else + { + l [ i ] = transform(nested, dtd); + } + } + else + l [ i ] = new node((char) 0, (char) 0, m.content); + addtype(l [ i ], (char) m.type); + m = m.next; + } + + if (isBinary(c.type)) + for (int i = 0; i < l.length; i++) + { + l [ i ].binary = (char) c.type; + } + + n = new list(l); + } + + addtype(n, (char) c.type); + + return n; + } + + /** + * True for binary operator + * @param c a character to test + * @return true for [ ,&| ], false otherwise. + */ + private static boolean isBinary(int c) + { + return binary.indexOf((char) c) >= 0; + } + + /** + * True for unary operator. + * @param c a character to test + * @return true for [ +?* ], false otherwise. + */ + private static boolean isUnary(int c) + { + return unary.indexOf((char) c) >= 0; + } + + /** + * Assign an operation type for the given node. + * @param n A node to set the operation to. + * @param type Either binary or unary operation, is assigned to the + * corresponding field of the node. + * @throws error if the operation type is not + * representing a valid unary or binary operation. + */ + private static void addtype(node n, char type) + { + if (isBinary(type)) + n.binary = type; + + else if (isUnary(type)) + n.unary = type; + + else if (type != 0) + throw new Error("Invalid operation '" + (char) type + "'"); + } + + private static node optionalTransform(ContentModel c, DTD dtd) + { + node n; + if (c.content instanceof ContentModel) + n = transform((ContentModel) c.content, dtd); + else + + /* A single token with the specified operation */ + n = new node((char) 0, (char) 0, c.content); + return n; + } +} diff --git a/gnu/javax/swing/text/html/parser/package.html b/gnu/javax/swing/text/html/parser/package.html new file mode 100644 index 000000000..7fa699530 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/package.html @@ -0,0 +1,51 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.swing.text.html.parser package. + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - javax.swing.text.html.parser</title></head> + +<body> +<p>Provides the error tolerant, DTD-driven HTML 4.01 parser. +The parser that is used in web robots, html content analysers, +web browsers, web editors and other related applications. +It should compativle with the older HTML versions, supporting +obsoleted HTML featues. This package also includes some +supporting classes.</p> +@author Audrius Meskauskas, Lithuania +</body> +</html> diff --git a/gnu/javax/swing/text/html/parser/support/Parser.java b/gnu/javax/swing/text/html/parser/support/Parser.java new file mode 100644 index 000000000..084edf65c --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/Parser.java @@ -0,0 +1,1440 @@ +/* Parser.java -- HTML parser. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support; + +import gnu.javax.swing.text.html.parser.htmlAttributeSet; +import gnu.javax.swing.text.html.parser.htmlValidator; +import gnu.javax.swing.text.html.parser.support.low.Constants; +import gnu.javax.swing.text.html.parser.support.low.ParseException; +import gnu.javax.swing.text.html.parser.support.low.ReaderTokenizer; +import gnu.javax.swing.text.html.parser.support.low.Token; +import gnu.javax.swing.text.html.parser.support.low.node; +import gnu.javax.swing.text.html.parser.support.low.pattern; + +import java.io.IOException; +import java.io.Reader; + +import java.util.Comparator; +import java.util.Set; +import java.util.TreeSet; +import java.util.Vector; + +import javax.swing.text.ChangedCharSetException; +import javax.swing.text.html.HTML; +import javax.swing.text.html.parser.AttributeList; +import javax.swing.text.html.parser.DTD; +import javax.swing.text.html.parser.DTDConstants; +import javax.swing.text.html.parser.Element; +import javax.swing.text.html.parser.Entity; +import javax.swing.text.html.parser.TagElement; + +/** + * <p>A simple error-tolerant HTML parser that uses a DTD document + * to access data on the possible tokens, arguments and syntax.</p> + * <p> The parser reads an HTML content from a Reader and calls various + * notifying methods (which should be overridden in a subclass) + * when tags or data are encountered.</p> + * <p>Some HTML elements need no opening or closing tags. The + * task of this parser is to invoke the tag handling methods also when + * the tags are not explicitly specified and must be supposed using + * information, stored in the DTD. + * For example, parsing the document + * <p><table><tr><td>a<td>b<td>c</tr> <br> + * will invoke exactly the handling methods exactly in the same order + * (and with the same parameters) as if parsing the document: <br> + * <em><html><head></head><body><table>< + * tbody></em><tr><td>a<em></td></em><td>b<em> + * </td></em><td>c<em></td></tr></em>< + * <em>/tbody></table></body></html></em></p> + * (supposed tags are given in italics). The parser also supports + * obsolete elements of HTML syntax.<p> + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Parser + extends ReaderTokenizer + implements DTDConstants +{ + /** + * The current html tag. + */ + public Token hTag = new Token(); + + /** + * The document template description that will be used to parse the documents. + */ + protected DTD dtd; + + /** + * The value of this field determines whether or not the Parser will be + * strict in enforcing SGML compatibility. The default value is false, + * stating that the parser should do everything to parse and get at least + * some information even from the incorrectly written HTML input. + */ + protected boolean strict; + + /** + * This fields has positive values in preformatted tags. + */ + protected int preformatted = 0; + + /** + * The set of the document tags. This field is used for supporting + * markFirstTime(). + */ + private Set documentTags = + new TreeSet(new Comparator() + { + public int compare(Object a, Object b) + { + return ((String) a).compareToIgnoreCase((String) b); + } + } + ); + + /** + * The buffer to collect the incremental output like text or coment. + */ + private StringBuffer buffer = new StringBuffer(); + + /** + * The buffer to store the document title. + */ + private StringBuffer title = new StringBuffer(); + + /** + * The current token. + */ + private Token t; + + /** + * True means that the 'title' tag of this document has + * already been handled. + */ + private boolean titleHandled; + + /** + * True means that the 'title' tag is currently open and all + * text is also added to the title buffer. + */ + private boolean titleOpen; + + /** + * The attributes of the current HTML element. + */ + private htmlAttributeSet attributes = + htmlAttributeSet.EMPTY_HTML_ATTRIBUTE_SET; + + /** + * The validator, controlling the forcible closing of the tags that + * (in accordance to dtd) are not allowed in the current context. + */ + private htmlValidator validator; + + /** + * Provides the default values for parameters in the case when these + * values are defined in the DTD. + */ + private parameterDefaulter defaulter; + + /** + * The text pre-processor for handling line ends and tabs. + */ + private textPreProcessor textProcessor = new textPreProcessor(); + + /** + * Creates a new Parser that uses the given + * {@link javax.swing.text.html.parser.DTD }. The only standard way + * to get an instance of DTD is to construct it manually, filling in + * all required fields. + * @param a_dtd The DTD to use. The parser behaviour after passing null + * as an argument is not documented and may vary between implementations. + */ + public Parser(DTD a_dtd) + { + if (a_dtd == null) + dtd = gnu.javax.swing.text.html.parser.HTML_401F.getInstance(); + else + dtd = a_dtd; + + defaulter = new parameterDefaulter(dtd); + + validator = + new htmlValidator(dtd) + { + /** + * Handles the error message. This method must be overridden to pass + * the message where required. + * @param msg The message text. + */ + protected void s_error(String msg) + { + error(msg); + } + + /** + * The method is called when the tag validator decides to close the + * tag on its own initiative. After reaching the end of stream, + * The tag validator closes all unclosed elements that are required + * to have the end (closing) tag. + * + * @param element The tag being fictionally (forcibly) closed. + */ + protected void handleSupposedEndTag(Element tElement) + { + // The tag is cloned as the original tElement is the + // element from the starting tag - may be accidently used + // somewhere else. + TagElement tag = makeTag(tElement, true); + _handleEndTag_remaining(tag); + } + + /** + * The method is called when the the tag validator decides to open + * the new tag on its own initiative. The tags, opened in this + * way, are HTML, HEAD and BODY. The attribute set is temporary + * assigned to the empty one, the previous value is + * restored before return. + * + * @param element The tag being fictionally (forcibly) closed. + */ + protected void handleSupposedStartTag(Element tElement) + { + TagElement tag = makeTag(tElement, true); + htmlAttributeSet were = attributes; + attributes = htmlAttributeSet.EMPTY_HTML_ATTRIBUTE_SET; + _handleStartTag(tag); + attributes = were; + } + }; + } + + /** + * Get the attributes of the current tag. + * @return The attribute set, representing the attributes of the current tag. + */ + public htmlAttributeSet getAttributes() + { + return attributes; + } + + /** + * Invokes the error handler. The default method in this implementation + * delegates the call to handleError, also providing the current line. + */ + public void error(String msg) + { + error(msg, getTokenAhead()); + } + + public void error(String msg, Token atToken) + { + if (atToken != null) + handleError(atToken.where.beginLine, + msg + ": line " + atToken.where.beginLine + + ", absolute pos " + atToken.where.startPosition + ); + else + handleError(0, msg); + } + + /** + * Invokes the error handler. The default method in this implementation + * delegates the call to error (parm1+": '"+parm2+"'"). + */ + public void error(String msg, String invalid) + { + error(msg + ": '" + invalid + "'"); + } + + /** + * Invokes the error handler. The default method in this implementation + * delegates the call to error (parm1+" "+ parm2+" "+ parm3). + */ + public void error(String parm1, String parm2, String parm3) + { + error(parm1 + " " + parm2 + " " + parm3); + } + + /** + * Invokes the error handler. The default method in this implementation + * delegates the call to error (parm1+" "+ parm2+" "+ parm3+" "+ parm4). + */ + public void error(String parm1, String parm2, String parm3, String parm4) + { + error(parm1 + " " + parm2 + " " + parm3 + " " + parm4); + } + + public void flushAttributes() + { + } + + /** + * Parse the HTML text, calling various methods in response to the + * occurence of the corresponding HTML constructions. + * @param reader The reader to read the source HTML from. + * @throws IOException If the reader throws one. + */ + public synchronized void parse(Reader reader) + throws IOException + { + reset(reader); + restart(); + try + { + parseDocument(); + validator.closeAll(); + } + catch (ParseException ex) + { + if (ex != null) + { + error("Unable to continue parsing the document", ex.getMessage()); + + Throwable cause = ex.getCause(); + if (cause instanceof IOException) + throw (IOException) cause; + } + } + } + + /** + * Parses DTD markup declaration. Currently returns null without action. + * @return null. + * @throws IOException + */ + public String parseDTDMarkup() + throws IOException + { + return null; + } + + /** + * Parse SGML insertion ( <! ... > ). When the + * the SGML insertion is found, this method is called, passing + * SGML in the string buffer as a parameter. The default method + * returns false without action and can be overridden to + * implement user - defined SGML support. + * <p> + * If you need more information about SGML insertions in HTML documents, + * the author suggests to read SGML tutorial on + * {@link http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html}. + * We also recommend Goldfarb C.F (1991) <i>The SGML Handbook</i>, + * Oxford University Press, 688 p, ISBN: 0198537379. + * </p> + * @param strBuff + * @return true if this is a valid DTD markup declaration. + * @throws IOException + */ + public boolean parseMarkupDeclarations(StringBuffer strBuff) + throws IOException + { + return false; + } + + /** + * Get the first line of the last parsed token. + */ + protected int getCurrentLine() + { + return hTag.where.beginLine; + } + + /** + * Read parseable character data, add to buffer. + * @param clearBuffer If true, buffer if filled by CDATA section, + * otherwise the section is appended to the existing content of the + * buffer. + * + * @throws ParseException + */ + protected void CDATA(boolean clearBuffer) + throws ParseException + { + Token start = hTag = getTokenAhead(); + + if (clearBuffer) + buffer.setLength(0); + + // Handle expected EOF. + if (start.kind == EOF) + return; + + read: + while (true) + { + t = getTokenAhead(); + if (t.kind == EOF) + { + error("unexpected eof", t); + break read; + } + else if (t.kind == BEGIN) + break read; + else if (t.kind == Constants.ENTITY) + { + resolveAndAppendEntity(t); + getNextToken(); + } + else + { + append(t); + getNextToken(); + } + } + hTag = new Token(start, getTokenAhead(0)); + if (buffer.length() != 0) + _handleText(); + } + + /** + * Process Comment. This method skips till --> without + * taking SGML constructs into consideration. The supported SGML + * constructs are handled separately. + */ + protected void Comment() + throws ParseException + { + buffer.setLength(0); + + Token start = hTag = mustBe(BEGIN); + optional(WS); + mustBe(EXCLAMATION); + optional(WS); + mustBe(DOUBLE_DASH); + + Token t; + Token last; + + comment: + while (true) + { + t = getTokenAhead(); + if (t.kind == EOF) + { + handleEOFInComment(); + last = t; + break comment; + } + else if (COMMENT_END.matches(this)) + { + mustBe(DOUBLE_DASH); + optional(WS); + last = mustBe(END); + break comment; + } + else if (COMMENT_TRIPLEDASH_END.matches(this)) + { + mustBe(DOUBLE_DASH); + t = mustBe(NUMTOKEN); + if (t.getImage().equals("-")) + { + append(t); + last = mustBe(END); + break comment; + } + else + { + buffer.append("--"); + append(t); + t = getTokenAhead(); + } + } + else + /* The lllll-- can match as NUMTOKEN */ + if ((t.getImage().endsWith("--")) && + ( + getTokenAhead(1).kind == END || + (getTokenAhead(1).kind == WS && getTokenAhead(2).kind == END) + ) + ) + { + buffer.append(t.getImage().substring(0, t.getImage().length() - 2)); + + /* Skip the closing > that we have already checked. */ + last = mustBe(t.kind); + break comment; + } + else + append(t); + mustBe(t.kind); + } + hTag = new Token(start, last); + handleComment(); + } + + /** + * Read a script. The text, returned without any changes, + * is terminated only by the closing tag SCRIPT. + */ + protected void Script() + throws ParseException + { + Token name; + + Token start = hTag = mustBe(BEGIN); + optional(WS); + + name = mustBe(SCRIPT); + + optional(WS); + + restOfTag(false, name, start); + + buffer.setLength(0); + + script: + while (!SCRIPT_CLOSE.matches(this)) + { + append(getNextToken()); + } + + consume(SCRIPT_CLOSE); + + _handleText(); + + endTag(false); + _handleEndTag(makeTagElement(name.getImage(), false)); + } + + /** + * Process SGML insertion that is not a comment. + */ + protected void Sgml() + throws ParseException + { + if (COMMENT_OPEN.matches(this)) + Comment(); + else // skip till ">" + { + Token start = hTag = mustBe(BEGIN); + optional(WS); + mustBe(EXCLAMATION); + + buffer.setLength(0); + read: + while (true) + { + t = getNextToken(); + if (t.kind == Constants.ENTITY) + { + resolveAndAppendEntity(t); + } + else if (t.kind == EOF) + { + error("unexpected eof", t); + break read; + } + else if (t.kind == END) + break read; + else + append(t); + } + + try + { + parseMarkupDeclarations(buffer); + } + catch (IOException ex) + { + error("Unable to parse SGML insertion: '" + buffer + "'", + new Token(start, t) + ); + } + } + } + + /** + * Read a style definition. The text, returned without any changes, + * is terminated only by the closing tag STYLE. + */ + protected void Style() + throws ParseException + { + Token name; + + Token start = hTag = mustBe(BEGIN); + optional(WS); + + name = mustBe(STYLE); + + optional(WS); + + restOfTag(false, name, start); + + buffer.setLength(0); + + style: + while (!STYLE_CLOSE.matches(this)) + { + append(getNextToken()); + } + + consume(STYLE_CLOSE); + + _handleText(); + + endTag(false); + _handleEndTag(makeTagElement(name.getImage(), false)); + } + + /** + * Read a html tag. + */ + protected void Tag() + throws ParseException + { + mark(true); + + boolean closing = false; + Token name; + Token start = hTag = mustBe(BEGIN); + + optional(WS); + name = getNextToken(); + optional(WS); + + if (name.kind == SLASH) + { + closing = true; + name = getNextToken(); + } + + restOfTag(closing, name, start); + } + + /** + * A hook, for operations, preceeding call to handleText. + * Handle text in a string buffer. + * In non - preformatted mode, all line breaks immediately following the + * start tag and immediately before an end tag is discarded, + * \r, \n and \t are replaced by spaces, multiple space are replaced + * by the single one and the result is moved into array, + * passing it to handleText(). + */ + protected void _handleText() + { + char[] text; + + if (preformatted > 0) + text = textProcessor.preprocessPreformatted(buffer); + else + text = textProcessor.preprocess(buffer); + + if (text != null && text.length > 0) + { + TagElement pcdata = new TagElement(dtd.getElement("#pcdata")); + attributes = htmlAttributeSet.EMPTY_HTML_ATTRIBUTE_SET; + _handleEmptyTag(pcdata); + + handleText(text); + if (titleOpen) + title.append(text); + } + } + + /** + * Add the image of this token to the buffer. + * @param t A token to append. + */ + protected final void append(Token t) + { + if (t.kind != EOF) + t.appendTo(buffer); + } + + /** + * Consume pattern that must match. + * @param p A pattern to consume. + */ + protected final void consume(pattern p) + { + node n; + for (int i = 0; i < p.nodes.length; i++) + { + n = p.nodes [ i ]; + if (n.optional) + optional(n.kind); + else + mustBe(n.kind); + } + } + + /** + * The method is called when the HTML end (closing) tag is found or if + * the parser concludes that the one should be present in the + * current position. The method is called immediatly + * before calling the handleEndTag(). + * @param omitted True if the tag is no actually present in the document, + * but is supposed by the parser (like </html> at the end of the + * document). + */ + protected void endTag(boolean omitted) + { + } + + /** + * Handle HTML comment. The default method returns without action. + * @param comment + */ + protected void handleComment(char[] comment) + { + } + + /** + * This is additionally called in when the HTML content terminates + * without closing the HTML comment. This can only happen if the + * HTML document contains errors (for example, the closing --;gt is + * missing. + */ + protected void handleEOFInComment() + { + error("Unclosed comment"); + } + + /** + * Handle the tag with no content, like <br>. The method is + * called for the elements that, in accordance with the current DTD, + * has an empty content. + * @param The tag being handled. + * @throws javax.swing.text.ChangedCharSetException + */ + protected void handleEmptyTag(TagElement tag) + throws javax.swing.text.ChangedCharSetException + { + } + + /** + * The method is called when the HTML closing tag ((like </table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param The tag + */ + protected void handleEndTag(TagElement tag) + { + } + + /* Handle error that has occured in the given line. */ + protected void handleError(int line, String message) + { + } + + /** + * The method is called when the HTML opening tag ((like <table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param The tag + */ + protected void handleStartTag(TagElement tag) + { + } + + /** + * Handle the text section. + * <p> For non-preformatted section, the parser replaces + * \t, \r and \n by spaces and then multiple spaces + * by a single space. Additionaly, all whitespace around + * tags is discarded. + * </p> + * <p> For pre-formatted text (inside TEXAREA and PRE), the parser preserves + * all tabs and spaces, but removes <b>one</b> bounding \r, \n or \r\n, + * if it is present. Additionally, it replaces each occurence of \r or \r\n + * by a single \n.</p> + * + * @param text A section text. + */ + protected void handleText(char[] text) + { + } + + /** + * Handle HTML <title> tag. This method is invoked when + * both title starting and closing tags are already behind. + * The passed argument contains the concatenation of all + * title text sections. + * @param The title text. + */ + protected void handleTitle(char[] title) + { + } + + /** + * Constructs the tag from the given element. In this implementation, + * this is defined, but never called. + * @return the tag + */ + protected TagElement makeTag(Element element) + { + return makeTag(element, false); + } + + /** + * Constructs the tag from the given element. + * @param the tag base {@link javax.swing.text.html.parser.Element} + * @param isSupposed true if the tag is not actually present in the + * html input, but the parser supposes that it should to occur in + * the current location. + * @return the tag + */ + protected TagElement makeTag(Element element, boolean isSupposed) + { + return new TagElement(element, isSupposed); + } + + /** + * This is called when the tag, representing the given element, + * occurs first time in the document. + * @param element + */ + protected void markFirstTime(Element element) + { + } + + /** + * Consume the token that was checked before and hence MUST be present. + * @param kind The kind of token to consume. + */ + protected Token mustBe(int kind) + { + if (getTokenAhead().kind == kind) + return getNextToken(); + else + { + String ei = ""; + if (kind < 1000) + ei = " ('" + (char) kind + "') "; + throw new AssertionError("The token of kind " + kind + ei + + " MUST be here," + ); + } + } + + /** + * Handle attribute without value. The default method uses + * the only allowed attribute value from DTD. + * If the attribute is unknown or allows several values, + * the HTML.NULL_ATTRIBUTE_VALUE is used. The attribute with + * this value is added to the attribute set. + * @param element The name of element. + * @param attribute The name of attribute without value. + */ + protected void noValueAttribute(String element, String attribute) + { + Object value = HTML.NULL_ATTRIBUTE_VALUE; + + Element e = (Element) dtd.elementHash.get(element.toLowerCase()); + if (e != null) + { + AttributeList attr = e.getAttribute(attribute); + if (attr != null) + { + Vector values = attr.values; + if (values != null && values.size() == 1) + value = values.get(0); + } + } + attributes.addAttribute(attribute, value); + } + + /** + * Consume the optional token, if present. + * @param kind The kind of token to consume. + */ + protected Token optional(int kind) + { + if (getTokenAhead().kind == kind) + return getNextToken(); + else + return null; + } + + /** Parse the html document. */ + protected void parseDocument() + throws ParseException + { + while (getTokenAhead().kind != EOF) + { + advanced = false; + if (TAG.matches(this)) + Tag(); + else if (COMMENT_OPEN.matches(this)) + Comment(); + else if (STYLE_OPEN.matches(this)) + Style(); + else if (SCRIPT_OPEN.matches(this)) + Script(); + else if (SGML.matches(this)) + Sgml(); + else + CDATA(true); + + // Surely HTML error, treat as a text. + if (!advanced) + { + Token wrong = getNextToken(); + error("unexpected '" + wrong.getImage() + "'", wrong); + buffer.setLength(0); + buffer.append(wrong.getImage()); + _handleText(); + } + } + } + + /** + * Read the element attributes, adding them into attribute set. + * @param element The element name (needed to access attribute + * information in dtd). + */ + protected void readAttributes(String element) + { + Token name; + Token value; + Token next; + String attrValue; + + attributes = new htmlAttributeSet(); + + optional(WS); + + attributeReading: + while (getTokenAhead().kind == NUMTOKEN) + { + name = getNextToken(); + optional(WS); + + next = getTokenAhead(); + if (next.kind == EQ) + { + mustBe(EQ); + optional(WS); + + next = getNextToken(); + + switch (next.kind) + { + case QUOT : + + // read "quoted" attribute. + buffer.setLength(0); + readTillTokenE(QUOT); + attrValue = buffer.toString(); + break; + + case AP : + + // read 'quoted' attribute. + buffer.setLength(0); + readTillTokenE(AP); + attrValue = buffer.toString(); + break; + + // read unquoted attribute. + case NUMTOKEN : + value = next; + optional(WS); + + // Check maybe the opening quote is missing. + next = getTokenAhead(); + if (bQUOTING.get(next.kind)) + { + hTag = next; + error("The value without opening quote is closed with '" + + next.getImage() + "'" + ); + } + attrValue = value.getImage(); + break; + + default : + break attributeReading; + } + attributes.addAttribute(name.getImage(), attrValue); + optional(WS); + } + else // The '=' is missing: attribute without value. + { + noValueAttribute(element, name.getImage()); + } + } + } + + /** + * Return string, corresponding the given named entity. + * The name is passed with the preceeding &, but without + * the ending semicolon. + */ + protected String resolveNamedEntity(final String a_tag) + { + // Discard & + if (!a_tag.startsWith("&")) + throw new AssertionError("Named entity " + a_tag + + " must start witn '&'." + ); + + String tag = a_tag.substring(1); + + try + { + Entity entity = dtd.getEntity(tag); + if (entity != null) + return entity.getString(); + + entity = dtd.getEntity(tag.toLowerCase()); + + if (entity != null) + { + error("The name of this entity should be in lowercase", a_tag); + return entity.getString(); + } + } + catch (IndexOutOfBoundsException ibx) + { + /* The error will be reported. */ + } + + error("Unknown named entity", a_tag); + return a_tag; + } + + /** + * Return char, corresponding the given numeric entity. + * The name is passed with the preceeding &#, but without + * the ending semicolon. + */ + protected char resolveNumericEntity(final String a_tag) + { + // Discard &# + if (!a_tag.startsWith("&#")) + throw new AssertionError("Numeric entity " + a_tag + + " must start witn '&#'." + ); + + String tag = a_tag.substring(2); + + try + { + // Determine the encoding type: + char cx = tag.charAt(0); + if (cx == 'x' || cx == 'X') // Hexadecimal &#Xnnn; + + return (char) Integer.parseInt(tag.substring(1), 16); + + return (char) Integer.parseInt(tag); + } + + /* The error will be reported. */ + catch (NumberFormatException nex) + { + } + catch (IndexOutOfBoundsException ix) + { + } + + error("Invalid numeric entity", a_tag); + return '?'; + } + + /** + * Reset all fields into the intial default state, preparing the + * parset for parsing the next document. + */ + protected void restart() + { + documentTags.clear(); + titleHandled = false; + titleOpen = false; + buffer.setLength(0); + title.setLength(0); + validator.restart(); + } + + /** + * The method is called when the HTML opening tag ((like <table>) + * is found or if the parser concludes that the one should be present + * in the current position. The method is called immediately before + * calling the handleStartTag. + * @param The tag + */ + protected void startTag(TagElement tag) + throws ChangedCharSetException + { + } + + /** + * Handle a complete element, when the tag content is already present in the + * buffer and both starting and heading tags behind. This is called + * in the case when the tag text must not be parsed for the nested + * elements (elements STYLE and SCRIPT). + */ + private void _handleCompleteElement(TagElement tag) + { + _handleStartTag(tag); + + // Suppress inclusion of the SCRIPT ans STYLE texts into the title. + HTML.Tag h = tag.getHTMLTag(); + if (h == HTML.Tag.SCRIPT || h == HTML.Tag.STYLE) + { + boolean tmp = titleOpen; + titleOpen = false; + _handleText(); + titleOpen = tmp; + } + else + _handleText(); + + _handleEndTag(tag); + } + + /** + * A hooks for operations, preceeding call to handleEmptyTag(). + * Handle the tag with no content, like <br>. As no any + * nested tags are expected, the tag validator is not involved. + * @param The tag being handled. + */ + private void _handleEmptyTag(TagElement tag) + { + try + { + validator.validateTag(tag, attributes); + handleEmptyTag(tag); + } + catch (ChangedCharSetException ex) + { + error("Changed charset exception:", ex.getMessage()); + } + } + + /** + * A hooks for operations, preceeding call to handleEndTag(). + * The method is called when the HTML closing tag + * is found. Calls handleTitle after closing the 'title' tag. + * @param The tag + */ + private void _handleEndTag(TagElement tag) + { + validator.closeTag(tag); + _handleEndTag_remaining(tag); + } + + /** + * Actions that are also required if the closing action was + * intiated by the tag validator. + */ + private void _handleEndTag_remaining(TagElement tag) + { + HTML.Tag h = tag.getHTMLTag(); + + handleEndTag(tag); + endTag(tag.fictional()); + + if (h.isPreformatted()) + preformatted--; + if (preformatted < 0) + preformatted = 0; + + if (h == HTML.Tag.TITLE) + { + titleOpen = false; + titleHandled = true; + + char[] a = new char[ title.length() ]; + title.getChars(0, a.length, a, 0); + handleTitle(a); + } + } + + /** + * A hooks for operations, preceeding call to handleStartTag(). + * The method is called when the HTML opening tag ((like <table>) + * is found. + * @param The tag + */ + private void _handleStartTag(TagElement tag) + { + validator.openTag(tag, attributes); + startingTag(tag); + handleStartTag(tag); + + HTML.Tag h = tag.getHTMLTag(); + + if (h.isPreformatted()) + preformatted++; + + if (h == HTML.Tag.TITLE) + { + if (titleHandled) + error("Repetetive <TITLE> tag"); + titleOpen = true; + titleHandled = false; + } + } + + /** + * Resume parsing after heavy errors in HTML tag structure. + * @throws ParseException + */ + private void forciblyCloseTheTag() + throws ParseException + { + int closeAt = 0; + buffer.setLength(0); + + ahead: + for (int i = 1; i < 100; i++) + { + t = getTokenAhead(i - 1); + if (t.kind == EOF || t.kind == BEGIN) + break ahead; + if (t.kind == END) + { + /* Closing '>' found. */ + closeAt = i; + break ahead; + } + } + if (closeAt > 0) + { + buffer.append("Ignoring '"); + for (int i = 1; i <= closeAt; i++) + { + t = getNextToken(); + append(t); + } + buffer.append('\''); + error(buffer.toString()); + } + } + + /** + * Handle comment in string buffer. You can avoid allocating a char + * array each time by processing your comment directly here. + */ + private void handleComment() + { + char[] a = new char[ buffer.length() ]; + buffer.getChars(0, a.length, a, 0); + handleComment(a); + } + + private TagElement makeTagElement(String name, boolean isSupposed) + { + Element e = (Element) dtd.elementHash.get(name.toLowerCase()); + if (e == null) + { + error("Unknown tag <" + name + ">"); + e = dtd.getElement(name); + e.name = name.toUpperCase(); + e.index = -1; + } + + if (!documentTags.contains(e.name)) + { + markFirstTime(e); + documentTags.add(e.name); + } + + return makeTag(e, isSupposed); + } + + /** + * Read till the given token, resolving entities. Consume the given + * token without adding it to buffer. + * @param till The token to read till + * @throws ParseException + */ + private void readTillTokenE(int till) + throws ParseException + { + buffer.setLength(0); + read: + while (true) + { + t = getNextToken(); + if (t.kind == Constants.ENTITY) + { + resolveAndAppendEntity(t); + } + else if (t.kind == EOF) + { + error("unexpected eof", t); + break read; + } + else if (t.kind == till) + break read; + else if (t.kind == WS) + { + // Processing whitespace in accordance with CDATA rules: + String s = t.getImage(); + char c; + for (int i = 0; i < s.length(); i++) + { + c = s.charAt(i); + if (c == '\r') + buffer.append(' '); // CR replaced by space + else if (c == '\n') + ; // LF ignored + else if (c == '\t') + buffer.append(' '); // Tab replaced by space + else + buffer.append(c); + } + } + else + append(t); + } + } + + /** + * Resolve the entity and append it to the end of buffer. + * @param entity + */ + private void resolveAndAppendEntity(Token entity) + { + switch (entity.category) + { + case ENTITY_NAMED : + buffer.append(resolveNamedEntity(entity.getImage())); + break; + + case ENTITY_NUMERIC : + buffer.append(resolveNumericEntity(entity.getImage())); + break; + + default : + throw new AssertionError("Invalid entity category " + + entity.category + ); + } + } + + /** + * Handle the remaining of HTML tags. This is a common end for + * TAG, SCRIPT and STYLE. + * @param closing True for closing tags ( </TAG> ). + * @param name Name of element + * @param start Token where element has started + * @throws ParseException + */ + private void restOfTag(boolean closing, Token name, Token start) + throws ParseException + { + boolean end = false; + Token next; + + optional(WS); + + readAttributes(name.getImage()); + + optional(WS); + + next = getTokenAhead(); + if (next.kind == END) + { + mustBe(END); + end = true; + } + + hTag = new Token(start, next); + + attributes.setResolveParent(defaulter.getDefaultParameters(name.getImage())); + + if (!end) + { + // The tag body contains errors. If additionally the tag + // name is not valid, this construction is treated as text. + if (dtd.elementHash.get(name.getImage().toLowerCase()) == null && + backupMode + ) + { + error("Errors in tag body and unknown tag name. " + + "Treating the tag as a text." + ); + reset(); + + hTag = mustBe(BEGIN); + buffer.setLength(0); + buffer.append(hTag.getImage()); + CDATA(false); + return; + } + else + { + error("Forcibly closing invalid parameter list"); + forciblyCloseTheTag(); + } + } + + if (closing) + { + endTag(false); + _handleEndTag(makeTagElement(name.getImage(), false)); + } + else + { + TagElement te = makeTagElement(name.getImage(), false); + if (te.getElement().type == DTDConstants.EMPTY) + _handleEmptyTag(te); + else + _handleStartTag(te); + } + } + + /** + * This should fire additional actions in response to the + * ChangedCharSetException. The current implementation + * does nothing. + * @param tag + */ + private void startingTag(TagElement tag) + { + try + { + startTag(tag); + } + catch (ChangedCharSetException cax) + { + error("Invalid change of charset"); + } + } + + private void ws_error() + { + error("Whitespace here is not permitted"); + } +} diff --git a/gnu/javax/swing/text/html/parser/support/gnuStringIntMapper.java b/gnu/javax/swing/text/html/parser/support/gnuStringIntMapper.java new file mode 100644 index 000000000..2887bac0a --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/gnuStringIntMapper.java @@ -0,0 +1,112 @@ +/* gnuStringIntMapper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support; + +import java.util.HashMap; +import java.util.Map; +import java.util.TreeMap; + +/** + * A helper class, mapping between the strings and they unique integer + * identifiers. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public abstract class gnuStringIntMapper +{ + /** + * Maps argument integer values from DTDConstants into they string + * names. Initialized on demand. + */ + private Map is_Map; + + /** + * Maps argument string names into they integer values from DTDConstants. + * Initialized on demand. + */ + private Map si_Map; + + /** + * Get string from id or null if no such id is present in the mapper. + */ + public final String get(int id) + { + if (is_Map == null) + createTheMap(); + + return (String) is_Map.get(new Integer(id)); + } + + /** Get id from string or 0 if no such string is present in the mapper. */ + public final int get(String id) + { + if (si_Map == null) + createTheMap(); + + Integer i = (Integer) si_Map.get(id); + + return i != null ? i.intValue() : 0; + } + + /** + * Create the mapping table for this mapper by adding the required + * String/int pairs. The method is invoked + * only once for each instance, after the first invocation of the any + * form of the <code>get</code> method. Use <code>add</code> to + * create a map for a concrete instance. + */ + protected abstract void create(); + + /** + * Add an id/string pair to this mapper. This is called from + * the method <code>create</code> only. + */ + protected void add(String name, int id) + { + Integer i = new Integer(id); + si_Map.put(name, i); + is_Map.put(i, name); + } + + private void createTheMap() + { + is_Map = new HashMap(); + si_Map = new TreeMap(); + create(); + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/Buffer.java b/gnu/javax/swing/text/html/parser/support/low/Buffer.java new file mode 100644 index 000000000..b9e8edc13 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/Buffer.java @@ -0,0 +1,238 @@ +/* Buffer.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +/** + * A string buffer that additionally holds line and absolute postion + * information. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Buffer +{ + public static int INITIAL_SIZE = 2048; + + /** + * True if the \n symbol has been seen. + */ + public boolean n_seen; + + /** + * True if the \r symbol has been seen. + */ + public boolean r_seen; + char[] chr = new char[ INITIAL_SIZE ]; + int[] line = new int[ INITIAL_SIZE ]; + int[] position = new int[ INITIAL_SIZE ]; + + /** + * Current line. + */ + int current_line = 0; + + /** + * Point to the next free position. + */ + int length; + + public Buffer() + { + } + + public Buffer(String content) + { + for (int i = 0; i < content.length(); i++) + { + append(content.charAt(i), i); + } + } + + /** + * Get the characters into array. + * @param srcBegin From, inclusive + * @param srcEnd To, exclusive. + * @param dst Into + * @param dstBegin Offset. + */ + public void getChars(int srcBegin, int srcEnd, char[] dst, int dstBegin) + { + System.arraycopy(chr, srcBegin, dst, dstBegin, (srcEnd - srcBegin)); + } + + /** + * Return the sequence, used to separate lines in the document. + * @return one of \n, \r or \r\n. + */ + public String getEndOfLineSequence() + { + if (r_seen && n_seen) + return "\r\n"; + else if (r_seen) + return "\r"; + else + + // This also is returned for single-line document. + return "\n"; + } + + /** + * Truncate. + * @param n The length to truncate till. + */ + public void setLength(int n) + { + length = n; + } + + /** + * Get location information for the given region. + * @param from Region start, inclusive. + * @param to Region end, exclusive. + * @return The location, covering the region. + */ + public Location getLocation(int from, int to) + { + Location l = new Location(); + l.beginLine = line [ from ]; + l.endLine = line [ to - 1 ]; + + l.startPosition = position [ from ]; + l.endPosition = position [ to - 1 ] + 1; + + return l; + } + + /** + * Add the character. + * @param c The character. + * @param pos The character position in the stream (the line number + * is handled internally in the buffer). + */ + public void append(char c, int pos) + { + if (length >= chr.length) + expand(); + chr [ length ] = c; + position [ length ] = pos; + + if (c == '\n') + { + if (!r_seen) + current_line++; + n_seen = true; + } + else if (c == '\r') + { + current_line++; + r_seen = true; + } + + line [ length ] = current_line; + + length++; + } + + /** + * Return char at the given positon. + */ + public char charAt(int i) + { + return chr [ i ]; + } + + /** + * Delete the range + * @param from Start position, inclusive. + * @param to End position, exclusive. + */ + public void delete(int from, int to) + { + int len = to - from; + if (len < 1) + throw new AssertionError("Deleting " + from + " till " + to); + + int tail = length - to; + + System.arraycopy(chr, to, chr, from, tail); + System.arraycopy(position, to, position, from, tail); + System.arraycopy(line, to, line, from, tail); + length = length - len; + } + + /** + * Double the buffer size. + */ + public void expand() + { + int nSize = 2 * chr.length; + + char[] nchr = new char[ nSize ]; + int[] nposition = new int[ nSize ]; + int[] nline = new int[ nSize ]; + + System.arraycopy(chr, 0, nchr, 0, chr.length); + System.arraycopy(position, 0, nposition, 0, position.length); + System.arraycopy(line, 0, nline, 0, line.length); + + chr = nchr; + position = nposition; + line = nline; + } + + /** + * Return length of the occupied part of the buffer. + */ + public int length() + { + return length; + } + + /** + * Prepare for parsing the new document. + */ + public void reset() + { + setLength(0); + r_seen = n_seen = false; + } + + public String toString() + { + return new String(chr, 0, length); + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/Constants.java b/gnu/javax/swing/text/html/parser/support/low/Constants.java new file mode 100644 index 000000000..367dd0396 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/Constants.java @@ -0,0 +1,422 @@ +/* Constants.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +import java.util.BitSet; + +/** + * The parser constants and operations, directly related to the parser + * constants. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Constants +{ + /* Single character tokens are reflected into they ASCII codes. */ + + /** + * Start of HTML token. + */ + public static final int BEGIN = '<'; + + /** + * End of HTML token. + */ + public static final int END = '>'; + + /** + * Exclamation (indicates SGML or comment). + */ + public static final int EXCLAMATION = '!'; + + /** + * Slash (indicates closing tag). + */ + public static final int SLASH = '/'; + + /** + * Equals sign. + */ + public static final int EQ = '='; + + /** + * Quoting sign. + */ + public static final int AP = '\''; + + /** + * Quoting sign. + */ + public static final int QUOT = '"'; + + /* The numbers of other tokens start outside the ascii space. */ + /* String tokens */ + + /** + * Double dash (--) + */ + public static final int DOUBLE_DASH = 1000; + + /** + * The STYLE tag (needs special handling). + */ + public static final int STYLE = 1001; + + /** + * The SCRIPT tag (needs special handling). + */ + public static final int SCRIPT = 1002; + + /* Pattern tokens */ + + /** + * HTML whitespace. + */ + public static final int WS = 1003; + + /** + * Named or numeric entity, + */ + public static final int ENTITY = 1004; + + /** + * Sequence of valid name characters (can start from digit). + */ + public static final int NUMTOKEN = 1005; + + /* Complex tokens */ + + /** + * Comment opening sequence. + */ + public static final pattern COMMENT_OPEN = + new pattern(new node[] + { + new node(BEGIN), new node(WS, true), new node(EXCLAMATION), + new node(WS, true), new node(DOUBLE_DASH), + } + ); + + /** + * Comment closing sequence + */ + public static final pattern COMMENT_END = + new pattern(new node[] + { + new node(DOUBLE_DASH), new node(WS, true), new node(END) + } + ); + + /** + * Special case ---> (also is treated as end of comment). + */ + public static final pattern COMMENT_TRIPLEDASH_END = + new pattern(new node[] + { + new node(DOUBLE_DASH), new node(NUMTOKEN), new node(END) + } + ); + + /** + * STYLE element heading pattern. + */ + public static final pattern STYLE_OPEN = + new pattern(new node[] { new node(BEGIN), new node(WS, true), new node(STYLE) }); + + /** + * SCRIPT element heading pattern. + */ + public static final pattern SCRIPT_OPEN = + new pattern(new node[] { new node(BEGIN), new node(WS, true), new node(SCRIPT) }); + + /** + * SGML element heading pattern. + */ + public static final pattern SGML = + new pattern(new node[] + { + new node(BEGIN), new node(WS, true), new node(EXCLAMATION) + } + ); + + /** + * SCRIPT element closing pattern. + */ + public static final pattern SCRIPT_CLOSE = + new pattern(new node[] + { + new node(BEGIN), new node(WS, true), new node(SLASH), + new node(WS, true), new node(SCRIPT), new node(WS, true), + new node(END) + } + ); + + /** + * STYLE element closing pattern. + */ + public static final pattern STYLE_CLOSE = + new pattern(new node[] + { + new node(BEGIN), new node(WS, true), new node(SLASH), + new node(WS, true), new node(STYLE), new node(WS, true), + new node(END) + } + ); + + /** + * Ordinary HTML tag heading pattern. + */ + public static final pattern TAG = + new pattern(new node[] + { + new node(BEGIN), new node(WS, true), new node(SLASH, true), + new node(WS, true), new node(NUMTOKEN) + } + ); + + /* Special tokens */ + + /** + * All other tokens. + */ + public static final int OTHER = 1999; + + /** + * The UNICODE "end of text" control code + */ + static final char ETX = 3; + + /** + * End of file. + */ + public static final int EOF = ETX; + + /* Character categories */ + + /** + * All single char tokens. + */ + public static final BitSet bSINGLE_CHAR_TOKEN = new BitSet(); + + /** + * Non letters and non numbers, allowed in HTML names. + */ + public static final BitSet bSPECIAL = new BitSet(); + + /** + * All letters, used in HTML names. + */ + public static final BitSet bLETTER = new BitSet(); + + /** + * Digits. + */ + public static final BitSet bDIGIT = new BitSet(); + + /** + * Both line breaks. + */ + public static final BitSet bLINEBREAK = new BitSet(); + + /** + * All whitespace. + */ + public static final BitSet bWHITESPACE = new BitSet(); + + /** + * Both quoting characters. + */ + public static final BitSet bQUOTING = new BitSet(); + + /** + * Valid name characters. + */ + public static final BitSet bNAME = new BitSet(); + + /* Entity subcategories */ + + /** + * Named entity. + */ + public static final int ENTITY_NAMED = 1; + + /** + * Numeric entity. + */ + public static final int ENTITY_NUMERIC = 2; + + static + { + bQUOTING.set(AP); + bQUOTING.set(QUOT); + + bSINGLE_CHAR_TOKEN.set(BEGIN); + bSINGLE_CHAR_TOKEN.set(END); + bSINGLE_CHAR_TOKEN.set(EXCLAMATION); + bSINGLE_CHAR_TOKEN.set(SLASH); + bSINGLE_CHAR_TOKEN.set(EQ); + bSINGLE_CHAR_TOKEN.set(EOF); + + bSINGLE_CHAR_TOKEN.or(bQUOTING); + + bLINEBREAK.set('\r'); + bLINEBREAK.set('\n'); + + bWHITESPACE.set(' '); + bWHITESPACE.set('\t'); + bWHITESPACE.set(0xC); + bWHITESPACE.or(bLINEBREAK); + + for (char i = '0'; i <= '9'; i++) + { + bDIGIT.set(i); + } + + for (char i = 'a'; i <= 'z'; i++) + { + bLETTER.set(i); + } + + for (char i = 'A'; i <= 'Z'; i++) + { + bLETTER.set(i); + } + + bSPECIAL.set('-'); + bSPECIAL.set('_'); + bSPECIAL.set(':'); + bSPECIAL.set('.'); + + bNAME.or(bLETTER); + bNAME.or(bDIGIT); + bNAME.or(bSPECIAL); + } + + /** + * Verifies if one of the tokens matches the end of string + * buffer. The last character in the string buffer is the + * "future character", some tokens needs to verify it the + * token does not continue "towards the future". If the token + * matches, it matches till "pre-last" character in the buffer. + * @param b + * @return + */ + public Token endMatches(Buffer b) + { + if (b.length() < 2) + return null; + + int p = b.length() - 2; + + if (b.length() > 2 && b.charAt(p) == '-' && b.charAt(p - 1) == '-') + return new Token(DOUBLE_DASH, "--", b.getLocation(p - 1, p + 1)); + + char last = b.charAt(p); + + if (bSINGLE_CHAR_TOKEN.get(last)) + return new Token(last, last, b.getLocation(p, p + 1)); + + char future = b.charAt(p + 1); + + // Check for numtokens, script and style: + if (bNAME.get(last) && !bNAME.get(future)) + { + // Scan the history up: + int u = p - 1; + while (u >= 0 && bNAME.get(b.charAt(u))) + u--; + u++; + + char[] token = new char[ p - u + 1 ]; + + // Found a numtoken + b.getChars(u, p + 1, token, 0); + + // Verify for the built-in tokens: + String e = new String(token); + + // found the entity reference + if (u > 0 && b.charAt(u - 1) == '&') + { + // The subsequent semicolon may be the part of the token + // as well. The semicolon must be ignored. This must be + // handled elsewhere. + return new Token(ENTITY, ENTITY_NAMED, "&" + e, + b.getLocation(u - 1, p + 1) + ); + } + + // found the numeric entity reference + if (u > 1 && b.charAt(u - 1) == '#' && b.charAt(u - 2) == '&') + { + // The subsequent semicolon may be the part of the token + // as well. The semicolon must be ignored. This must be + // handled elsewhere. + return new Token(ENTITY, ENTITY_NUMERIC, "&#" + e, + b.getLocation(u - 2, p + 2) + ); + } + + Location le = b.getLocation(u, p + 1); + + if (e.equalsIgnoreCase("SCRIPT")) + return new Token(SCRIPT, e, le); + else if (e.equalsIgnoreCase("STYLE")) + return new Token(STYLE, e, le); + else + return new Token(NUMTOKEN, e, le); + } + + // Check for whitespace + if (bWHITESPACE.get(last) && !bWHITESPACE.get(future)) + { + // Scan the history up: + int u = p - 1; + while (u >= 0 && bWHITESPACE.get(b.charAt(u))) + u--; + u++; + + char[] token = new char[ p - u + 1 ]; + b.getChars(u, p + 1, token, 0); + + return new Token(WS, new String(token), b.getLocation(u, p + 1)); + } + + return null; + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/Location.java b/gnu/javax/swing/text/html/parser/support/low/Location.java new file mode 100644 index 000000000..5a0f2046f --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/Location.java @@ -0,0 +1,83 @@ +/* Location.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +/** + * Defines a region in the text: its bounding positions and the line number. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Location +{ + /** + * The line number, where the token starts. + */ + public int beginLine; + + /** + * The line, where the token ends. + */ + public int endLine; + + /** + * The absolute token end position in the input stream, + * exclusive. + */ + public int endPosition; + + /** + * The absolute token start position in the input stream, + * inclusive. + */ + public int startPosition; + + public Location() + { + } + + /** + * Special case, used to mark EOF. + * @param p The total stream length. + */ + public Location(int p) + { + startPosition = p; + endPosition = p + 1; + beginLine = endLine = -1; + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/ParseException.java b/gnu/javax/swing/text/html/parser/support/low/ParseException.java new file mode 100644 index 000000000..9f1094e62 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/ParseException.java @@ -0,0 +1,51 @@ +/* ParseException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +/** + * This can be thrown from various parsing methods. + */ +public class ParseException + extends RuntimeException +{ + public ParseException(String s, Throwable cause) + { + super(s, cause); + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/Queue.java b/gnu/javax/swing/text/html/parser/support/low/Queue.java new file mode 100644 index 000000000..30890e4eb --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/Queue.java @@ -0,0 +1,142 @@ +/* Queue.java -- a token queue. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +import java.util.Arrays; + +/** + * A token queue. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Queue +{ + Token[] m = new Token[ 64 ]; + int a = 0; + int b = 0; + + /** + * True for the empty queue. + */ + public boolean isEmpty() + { + return size() == 0; + } + + /** + * Add this trace to the end of the queue. + */ + public void add(Token u) + { + if (a < m.length) + { + m [ a ] = u; + a++; + } + else // The end of array has been reached. + { + if (b > 0) // If some elements were deleted from the start of the queue, shift. + { + int d = b; + System.arraycopy(m, b, m, 0, a - b); + b = b - d; + a = a - d; + m [ a ] = u; + a++; + } + else // Enlarge the queue, doubling the size. + { + int n = m.length * 2; + Token[] nm = new Token[ 2 * n ]; + System.arraycopy(m, 0, nm, 0, m.length); + Arrays.fill(m, null); + + nm [ a ] = u; + m = nm; + a++; + } + } + } + + /** + * Clear the queue. + */ + public void clear() + { + a = b = 0; + Arrays.fill(m, null); + } + + /** + * Read the value ahead. 0 is the value that will be returned with + * the following next. This method does not remove values from the + * queue. To test if there is enough tokens in the queue, size() must + * be checked before calling this method. + */ + public Token get(int ahead) + { + int p = b + ahead; + if (p < a) + return m [ p ]; + else + throw new ArrayIndexOutOfBoundsException("Not enough tokens"); + } + + /** + * Read the oldest value from the queue and remove this value from + * the queue. + */ + public Token next() + { + if (a == b) + throw new ArrayIndexOutOfBoundsException("queue empty"); + + Token r = m [ b ]; + m [ b ] = null; + b++; + return r; + } + + /** + * Size of the queue. + */ + public int size() + { + return a - b; + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java b/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java new file mode 100644 index 000000000..f354bec6e --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/ReaderTokenizer.java @@ -0,0 +1,374 @@ +/* ReaderTokenizer.java -- splits the input char sequence int tokens. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +import java.io.IOException; +import java.io.Reader; + +/** + * Reader splits the input char sequence into tokens. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class ReaderTokenizer + extends Constants +{ + /** + * This is set to true each time the getNextToken is called. + * Used in preventing loops when all patterns refuse to accept + * the invalid input. + */ + protected boolean advanced; + + /** + * If true, the returned tokens are also placed in the backup + * queue. + */ + protected boolean backupMode; + + /** + * The buffer to read document into. + */ + Buffer buffer = new Buffer(); + + /** + * The queue for supporting mark(). + */ + Queue backup = new Queue(); + + /** + * The queue of found tokens. + */ + Queue queue = new Queue(); + + /** + * The reader to read the document from. + */ + Reader reader; + + /** + * Array of char tokens + */ + char[] charTokens; + + /** + * Array of string tokens. + */ + String[] stringTokens; + + /** + * The current reader position. + */ + int readerPosition = -1; + + /** + * Creates a new ReaderTokenizer. The reset(...) method must be + * subsequently called to set the reader. + */ + public ReaderTokenizer() + { + } + + /** + * Return the sequence, used to separate lines in the document. + * @return one of \n, \r or \r\n. + */ + public String getEndOfLineSequence() + { + return buffer.getEndOfLineSequence(); + } + + /** + * Get the next token. + * @return + */ + public Token getNextToken() + { + Token rt; + advanced = true; + try + { + if (queue.isEmpty()) + read(1); + + if (!queue.isEmpty()) + rt = queue.next(); + else + rt = new Token(EOF, new Location(readerPosition)); + } + catch (IOException ex) + { + throw new ParseException("IO Exception", ex); + } + if (backupMode) + backup.add(rt); + return rt; + } + + /** + * Get a token, lying the given number of tokens + * ahead. getToken(0) will return the same token, + * what would be returned by getNextToken(). + * getToken(..) does change the current position + * in the input stream. If the end of stream is + * reached, the EOF token is always returned. + */ + public Token getTokenAhead(int ahead) + { + try + { + read(ahead - queue.size() + 1); + return queue.size() >= ahead ? queue.get(ahead) : eofToken(); + } + catch (IOException ex) + { + throw new ParseException("IO Exception", ex); + } + } + + /** + * Get a token, bein immediatley ahead. + * If the end of stream is + * reached, the EOF token is always returned. + * The method is equivalent calling getTokenAhead(0). + */ + public Token getTokenAhead() + { + try + { + if (queue.isEmpty()) + read(1); + if (!queue.isEmpty()) + return queue.get(0); + else + return eofToken(); + } + catch (IOException ex) + { + throw new ParseException("IO Exception", ex); + } + } + + /** + * Invokes the error handler. + */ + public void error(String msg, Token at) + { + System.out.println(msg); + } + + /** + * Turns the backup mode on or off. + * It is possible to return where the mark(true) was last called + * by calling reset(). + * @param mode True if it is required to save tokens, making + * returning to the current point possible. + */ + public void mark(boolean mode) + { + backup.clear(); + backupMode = mode; + } + + /** + * Prepare for new parsing from the given stream. + * @param a_reader A reader to parse from. + */ + public void reset(Reader a_reader) + { + reader = a_reader; + readerPosition = -1; + buffer.reset(); + queue.clear(); + } + + /** + * Reset the internal cursor to the position where the mark() + * was last time called. Switches the backup mode off. + */ + public void reset() + { + if (!backupMode) + throw new AssertionError("Call mark(true) before using reset()!"); + backupMode = false; + + // That is now in the queue, will be appended to the end of backup. + while (!queue.isEmpty()) + backup.add(queue.next()); + + Queue t = queue; + queue = backup; + backup = t; + backup.clear(); + } + + /** + * Read the given number of the tokens. Add the needed number of EOF + * tokens if there are no more data in the stream. + * @param amount The number of additional tokens to read. + */ + void read(int numberOfTokens) + throws IOException + { + if (numberOfTokens <= 0) + return; + + reading: + for (int i = 0; i < numberOfTokens; i++) + readToken(); + } + + /** + * Read next token from the reader, add it to the queue + */ + void readToken() + throws IOException + { + Token t; + int ch; + + enlarging: + while (true) + { + t = tokenMatches(); + if (t != null) + break enlarging; + else + { + ch = reader.read(); + readerPosition++; + if (ch == ETX) + ch = ' '; + if (ch < 0) + { + if (buffer.length() == 0) + { + queue.add(eofToken()); + return; + } + else + { + if (buffer.charAt(buffer.length() - 1) != ETX) + buffer.append(ETX, readerPosition++); + else + { + // Discard terminating ETX + buffer.setLength(buffer.length() - 1); + if (buffer.length() > 0) + { + t = new Token(OTHER, buffer.toString(), + buffer.getLocation(0, buffer.length()) + ); + queue.add(t); + buffer.setLength(0); + } + return; + } + } + } + else + buffer.append((char) ch, readerPosition); + } + } + } + + /** + * Check if the end of buffer matches one of the tokens. If it does, + * return this token and remove the token sequence from the end of + * buffer. + * @return The matching token. + */ + Token tokenMatches() + { + Token rt = endMatches(buffer); + if (rt != null) // Remove the matched image + { + // Consume future character if it was an entity and the future + // character is semicolon. + if (rt.kind == ENTITY) + { + if (buffer.charAt(buffer.length() - 1) == ';') + buffer.setLength(buffer.length() - rt.getImage().length() - 1); + else + { + error("Missing closing semicolon for entity '" + rt.getImage() + + "'", rt + ); + consumeBuffer(rt); + } + } + else + { + consumeBuffer(rt); + } + } + + // If the buffer is not empty, some sequence does not match any tokens. + // Add it to the queue as "OTHER". + if (rt != null) + { + if (buffer.length() > 1) + { + String rest = buffer.toString(); + rest = rest.substring(0, rest.length() - 1); + + Token other = + new Token(OTHER, rest, buffer.getLocation(0, buffer.length)); + queue.add(other); + consumeBuffer(other); + } + queue.add(rt); + } + return rt; + } + + private void consumeBuffer(Token rt) + { + buffer.delete(buffer.length() - rt.getImage().length() - 1, + buffer.length() - 1 + ); + } + + /** + * Create EOF token. + */ + private Token eofToken() + { + return new Token(EOF, "#", new Location(readerPosition)); + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/Token.java b/gnu/javax/swing/text/html/parser/support/low/Token.java new file mode 100644 index 000000000..c298d7817 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/Token.java @@ -0,0 +1,169 @@ +/* Token.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +/** + * A token. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Token +{ + /** + * The place of this token in the document. + */ + public Location where; + + /** + * The additional category of token. + */ + public int category; + + /** + * An integer that describes the kind of this token. + */ + public int kind; + + /** + * The string image of the token, null if the char image must be used. + */ + private String stringImage; + + /** + * The char image of the token. + */ + private char charImage; + + /** + * Creates a new token with fields, initialized to the default values. + */ + public Token() + { + } + + /** + * Creates a new token of the given kind. + */ + public Token(int _kind, Location _where) + { + kind = _kind; + where = _where; + } + + /** + * Creates a new token of the given kind and given single char image. + */ + public Token(int _kind, char _image, Location _where) + { + kind = _kind; + charImage = _image; + where = _where; + } + + /** + * Creates a new token of the given kind and given string image. + */ + public Token(int _kind, String _image, Location _where) + { + kind = _kind; + stringImage = _image; + where = _where; + } + + /** + * Creates a new token of the given kind, category and given string image. + */ + public Token(int _kind, int _category, String _image, Location _where) + { + kind = _kind; + category = _category; + stringImage = _image; + where = _where; + } + + /** + * Creates a new token, where location fields are set as for token, + * spanning over two provided tokens and any tokens between them. + * The image field is initialized to null, the kind field is set to -1. + */ + public Token(Token fromInclusive, Token toInclusive) + { + where = new Location(); + where.beginLine = fromInclusive.where.beginLine; + where.startPosition = fromInclusive.where.startPosition; + + where.endLine = toInclusive.where.endLine; + where.endPosition = toInclusive.where.endPosition; + } + + public String getImage() + { + if (kind == 3) + return "#"; + if (stringImage == null) + { + if (charImage == 0) + return null; + stringImage = new String(new char[] { charImage }); + } + return stringImage; + } + + /** + * Append the token image to the given string buffer. + * This may be more effective that buffer.append(this.getImage()). + * @param buffer A buffer to append. + */ + public void appendTo(StringBuffer buffer) + { + if (charImage == 0) + buffer.append(getImage()); + else + buffer.append(charImage); + } + + /** + * Returns the string image or, if null, the bounding positions. + */ + public String toString() + { + return getImage() != null ? kind + "'" + getImage() + : "<line " + where.beginLine + ", abs pos " + where.startPosition + + ".." + where.endPosition + ">"; + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/node.java b/gnu/javax/swing/text/html/parser/support/low/node.java new file mode 100644 index 000000000..981166562 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/node.java @@ -0,0 +1,78 @@ +/* node.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + +/** + * A text level content model node. The only required unary operations + * here are "appears" and "optionally appears" ('?'). + * <p>@author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org)</p> + */ +public class node +{ + /** + * True for node that is optional for the given position. + */ + public boolean optional; + + /** + * The kind of the token to match. + */ + public int kind; + + /** + * Creates the new node for matching a given kind of the token. + * @param kind The kind of the token to match. + * @param modifier The modifier (*?+). + */ + public node(int kind, boolean _optional) + { + this.kind = kind; + optional = _optional; + } + + /** + * Creates the node, indicating that token must match exactluy one time. + * @param kind The kind of token to match. + */ + public node(int kind) + { + this.kind = kind; + optional = false; + } +} diff --git a/gnu/javax/swing/text/html/parser/support/low/package.html b/gnu/javax/swing/text/html/parser/support/low/package.html new file mode 100644 index 000000000..a4ae57bff --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/package.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.swing.text.html.parser package. + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.javax.swing.text.html.parser.support.low</title></head> + +<body> +<p>This package contains classes that are directly used to process +the text input: adapted stream tokenizer, specialized buffer and text-level content models .</p> +@author Audrius Meskauskas, Lithuania +</body> +</html> diff --git a/gnu/javax/swing/text/html/parser/support/low/pattern.java b/gnu/javax/swing/text/html/parser/support/low/pattern.java new file mode 100644 index 000000000..ac82a2050 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/low/pattern.java @@ -0,0 +1,105 @@ +/* pattern.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support.low; + + +/** + * The simple pattern, consisting from the sequence of tokens that + * may have the unary modifier '?'. Choices and grouping + * are not required here. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class pattern +{ + /** + * The nodes of this pattern. + */ + public final node[] nodes; + + /** + * Create a pattern, containing the given list of nodes. + * @param a_nodes + */ + public pattern(node[] a_nodes) + { + nodes = a_nodes; + } + + /** + * Checks if the pattern can match the tokens in this + * tokenizer. Does not change the state of tokenizer. + * @param stream The tokenizer to read data from + * @return True if the pattern sequence matches the + * beginning of the tokenizer content. + */ + public boolean matches(ReaderTokenizer stream) + { + try + { + int pt = 0; + int pn = 0; + Token t; + node n; + + while (pn < nodes.length) + { + n = nodes [ pn ]; + t = stream.getTokenAhead(pt); + + if (t.kind == n.kind) + { + pn++; + pt++; + } + else + { + if (!n.optional) + return false; + else + pn++; + } + } + return true; + } + catch (Exception ex) + { + throw new ParseException("Exception", ex); + } + } +} diff --git a/gnu/javax/swing/text/html/parser/support/package.html b/gnu/javax/swing/text/html/parser/support/package.html new file mode 100644 index 000000000..35071ed00 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/package.html @@ -0,0 +1,47 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.swing.text.html.parser package. + Copyright (C) 2002 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - gnu.javax.swing.text.html.parser.support</title></head> + +<body> +<p>This package provides various specialised classes, needed by HTML parser. +</p> +@author Audrius Meskauskas, Lithuania +</body> +</html> diff --git a/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java b/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java new file mode 100644 index 000000000..4b4878a79 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/parameterDefaulter.java @@ -0,0 +1,106 @@ +/* parameterDefaulter.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support; + +import gnu.javax.swing.text.html.parser.htmlAttributeSet; + +import java.util.Hashtable; + +import javax.swing.text.html.parser.AttributeList; +import javax.swing.text.html.parser.DTD; +import javax.swing.text.html.parser.Element; + +/** + * Returns an attribute set, containing default + * parameters for the given element. Caches sets of default + * parameters. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class parameterDefaulter +{ + public final DTD dtd; + Hashtable sets = new Hashtable(); + + /** + * Create a parameterDefaulter that looks for the default attribute + * values in the given DTD. + * @param a_dtd + */ + public parameterDefaulter(DTD a_dtd) + { + dtd = a_dtd; + } + + /** + * Get the default parameter set for the given element. + * @param element The element name (case insensitive). + * @return the default attrbute set. + */ + public htmlAttributeSet getDefaultParameters(String element) + { + String key = element.toLowerCase(); + htmlAttributeSet atts = (htmlAttributeSet) sets.get(key); + + if (atts == null) + { + htmlAttributeSet set = new htmlAttributeSet(); + Element e = (Element) dtd.elementHash.get(element.toLowerCase()); + + if (e != null) + { + AttributeList a = e.getAttributes(); + + while (a != null) + { + if (a.value != null) + set.addAttribute(a.name, a.value); + a = a.next; + } + } + + if (set.getAttributeCount() > 0) + sets.put(key, set); + else + sets.put(key, htmlAttributeSet.EMPTY_HTML_ATTRIBUTE_SET); + + atts = set; + } + return atts; + } +} diff --git a/gnu/javax/swing/text/html/parser/support/textPreProcessor.java b/gnu/javax/swing/text/html/parser/support/textPreProcessor.java new file mode 100644 index 000000000..20af8f635 --- /dev/null +++ b/gnu/javax/swing/text/html/parser/support/textPreProcessor.java @@ -0,0 +1,193 @@ +/* textPreProcessor.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package gnu.javax.swing.text.html.parser.support; + +import gnu.javax.swing.text.html.parser.support.low.Constants; + +/** + * Pre - processes text in text parts of the html document. + * Not thread - safe. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class textPreProcessor +{ + /** + * Pre - process non-preformatted text. + * \t, \r and \n mutate into spaces, then multiple spaces mutate + * into single one, all whitespace around tags is consumed. + * The content of the passed buffer is destroyed. + * @param text A text to pre-process. + */ + public char[] preprocess(StringBuffer a_text) + { + if (a_text.length() == 0) + return null; + + char[] text = toCharArray(a_text); + + int a = 0; + int b = text.length - 1; + + try + { + while (Constants.bWHITESPACE.get(text [ a ])) + a++; + while (Constants.bWHITESPACE.get(text [ b ])) + b--; + } + catch (ArrayIndexOutOfBoundsException sx) + { + // A text fragment, consisting from line breaks only. + return null; + } + + a_text.setLength(0); + + boolean spacesWere = false; + boolean spaceNow; + char c; + + chars: + for (int i = a; i <= b; i++) + { + c = text [ i ]; + spaceNow = Constants.bWHITESPACE.get(c); + if (spacesWere && spaceNow) + continue chars; + if (spaceNow) + a_text.append(' '); + else + a_text.append(c); + spacesWere = spaceNow; + } + + if (a_text.length() == text.length) + { + a_text.getChars(0, a_text.length(), text, 0); + return text; + } + else + return toCharArray(a_text); + } + + /** + * Pre - process pre-formatted text. + * Heading/closing spaces and tabs preserved. + * ONE bounding \r, \n or \r\n is removed. + * \r or \r\n mutate into \n. Tabs are + * preserved. + * The content of the passed buffer is destroyed. + * @param text + * @return + */ + public char[] preprocessPreformatted(StringBuffer a_text) + { + if (a_text.length() == 0) + return null; + + char[] text = toCharArray(a_text); + + int a = 0; + int n = text.length - 1; + int b = n; + + if (text [ 0 ] == '\n') + a++; + else + { + if (text [ 0 ] == '\r') + { + a++; + if (text.length > 1 && text [ 1 ] == '\n') + a++; + } + } + + if (text [ n ] == '\r') + b--; + else + { + if (text [ n ] == '\n') + { + b--; + if (n > 0 && text [ n - 1 ] == '\r') + b--; + } + } + + a_text.setLength(0); + + if (a > b) + return null; + + char c; + + for (int i = a; i <= b; i++) + { + c = text [ i ]; + if (c == '\r') + { + if (i == b || text [ i + 1 ] != '\n') + a_text.append('\n'); + } + else + a_text.append(c); + } + + if (a_text.length() == text.length) + { + a_text.getChars(0, a_text.length(), text, 0); + return text; + } + else + return toCharArray(a_text); + } + + /** + * Return array of chars, present in the given buffer. + * @param a_text The buffer + * @return + */ + private static char[] toCharArray(StringBuffer a_text) + { + char[] text = new char[ a_text.length() ]; + a_text.getChars(0, text.length, text, 0); + return text; + } +} diff --git a/gnu/xml/aelfred2/JAXPFactory.java b/gnu/xml/aelfred2/JAXPFactory.java index 006dc1302..ff585a82a 100644 --- a/gnu/xml/aelfred2/JAXPFactory.java +++ b/gnu/xml/aelfred2/JAXPFactory.java @@ -60,137 +60,172 @@ import javax.xml.parsers.SAXParserFactory; * * @author David Brownell */ -public final class JAXPFactory extends SAXParserFactory +public final class JAXPFactory + extends SAXParserFactory { - private Hashtable flags = new Hashtable (); - - /** - * Constructs a factory which normally returns a non-validating - * parser. - */ - public JAXPFactory () { } - - public SAXParser newSAXParser () + + private Hashtable flags = new Hashtable(); + + /** + * Constructs a factory which normally returns a non-validating + * parser. + */ + public JAXPFactory() + { + } + + public SAXParser newSAXParser() throws ParserConfigurationException, SAXException + { + JaxpParser jaxp = new JaxpParser(); + Enumeration e = flags.keys(); + XMLReader parser = jaxp.getXMLReader(); + + parser.setFeature(SAXDriver.FEATURE + "namespaces", + isNamespaceAware()); + parser.setFeature(SAXDriver.FEATURE + "validation", + isValidating()); + // that makes SAX2 feature flags trump JAXP + + while (e.hasMoreElements()) + { + String uri = (String) e.nextElement(); + Boolean value = (Boolean) flags.get(uri); + parser.setFeature(uri, value.booleanValue()); + } + + return jaxp; + } + + // yes, this "feature transfer" mechanism doesn't play well + + public void setFeature(String name, boolean value) + throws ParserConfigurationException, SAXNotRecognizedException, + SAXNotSupportedException + { + try + { + // force "early" detection of errors where possible + // (flags can't necessarily be set before parsing) + new JaxpParser().getXMLReader().setFeature(name, value); + + flags.put(name, new Boolean(value)); + } + catch (SAXNotRecognizedException e) + { + throw new SAXNotRecognizedException(name); + } + catch (SAXNotSupportedException e) + { + throw new SAXNotSupportedException(name); + } + catch (Exception e) + { + throw new ParserConfigurationException(e.getClass().getName() + + ": " + + e.getMessage()); + } + } + + public boolean getFeature(String name) + throws ParserConfigurationException, SAXNotRecognizedException, + SAXNotSupportedException + { + Boolean value = (Boolean) flags.get(name); + + if (value != null) + { + return value.booleanValue(); + } + else + { + try + { + return new JaxpParser().getXMLReader().getFeature(name); + } + catch (SAXNotRecognizedException e) + { + throw new SAXNotRecognizedException(name); + } + catch (SAXNotSupportedException e) + { + throw new SAXNotSupportedException(name); + } + catch (SAXException e) + { + throw new ParserConfigurationException(e.getClass().getName() + + ": " + + e.getMessage()); + } + } + } + + private static class JaxpParser + extends SAXParser + { + + private XmlReader ae2 = new XmlReader(); + private XMLReaderAdapter parser = null; + + JaxpParser() { - JaxpParser jaxp = new JaxpParser (); - Enumeration e = flags.keys (); - XMLReader parser = jaxp.getXMLReader (); - - parser.setFeature ( - SAXDriver.FEATURE + "namespaces", - isNamespaceAware ()); - parser.setFeature ( - SAXDriver.FEATURE + "validation", - isValidating ()); - // that makes SAX2 feature flags trump JAXP - - while (e.hasMoreElements ()) { - String uri = (String) e.nextElement (); - Boolean value = (Boolean) flags.get (uri); - parser.setFeature (uri, value.booleanValue ()); - } - - return jaxp; } - // yes, this "feature transfer" mechanism doesn't play well + public void setProperty(String id, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException + { + ae2.setProperty(id, value); + } - public void setFeature (String name, boolean value) - throws - ParserConfigurationException, - SAXNotRecognizedException, - SAXNotSupportedException + public Object getProperty(String id) + throws SAXNotRecognizedException, SAXNotSupportedException { - try { - // force "early" detection of errors where possible - // (flags can't necessarily be set before parsing) - new JaxpParser ().getXMLReader ().setFeature (name, value); - - flags.put (name, new Boolean (value)); - } catch (SAXNotRecognizedException e) { - throw new SAXNotRecognizedException (name); - } catch (SAXNotSupportedException e) { - throw new SAXNotSupportedException (name); - } catch (Exception e) { - throw new ParserConfigurationException ( - e.getClass ().getName () - + ": " - + e.getMessage ()); - } + return ae2.getProperty(id); } - public boolean getFeature (String name) - throws - ParserConfigurationException, - SAXNotRecognizedException, - SAXNotSupportedException + public Parser getParser() + throws SAXException { - Boolean value = (Boolean) flags.get (name); - - if (value != null) - return value.booleanValue (); - else - try { - return new JaxpParser ().getXMLReader ().getFeature (name); - } catch (SAXNotRecognizedException e) { - throw new SAXNotRecognizedException (name); - } catch (SAXNotSupportedException e) { - throw new SAXNotSupportedException (name); - } catch (SAXException e) { - throw new ParserConfigurationException ( - e.getClass ().getName () - + ": " - + e.getMessage ()); - } + if (parser == null) + { + parser = new XMLReaderAdapter(ae2); + } + return parser; } - private static class JaxpParser extends SAXParser + public XMLReader getXMLReader () + throws SAXException { - private XmlReader ae2 = new XmlReader (); - private XMLReaderAdapter parser = null; - - JaxpParser () { } - - public void setProperty (String id, Object value) - throws SAXNotRecognizedException, SAXNotSupportedException - { ae2.setProperty (id, value); } - - public Object getProperty (String id) - throws SAXNotRecognizedException, SAXNotSupportedException - { return ae2.getProperty (id); } - - public Parser getParser () - throws SAXException - { - if (parser == null) - parser = new XMLReaderAdapter (ae2); - return parser; - } - - public XMLReader getXMLReader () - throws SAXException - { return ae2; } - - public boolean isNamespaceAware () - { - try { - return ae2.getFeature (SAXDriver.FEATURE + "namespaces"); - } catch (Exception e) { - throw new Error (); - } - } - - public boolean isValidating () - { - try { - return ae2.getFeature (SAXDriver.FEATURE + "validation"); - } catch (Exception e) { - throw new Error (); - } - } - - // TODO isXIncludeAware() - + return ae2; } + + public boolean isNamespaceAware() + { + try + { + return ae2.getFeature(SAXDriver.FEATURE + "namespaces"); + } + catch (Exception e) + { + throw new Error(); + } + } + + public boolean isValidating() + { + try + { + return ae2.getFeature(SAXDriver.FEATURE + "validation"); + } + catch (Exception e) + { + throw new Error(); + } + } + + // TODO isXIncludeAware() + + } + } + diff --git a/gnu/xml/aelfred2/SAXDriver.java b/gnu/xml/aelfred2/SAXDriver.java index 80cbc1155..003a73620 100644 --- a/gnu/xml/aelfred2/SAXDriver.java +++ b/gnu/xml/aelfred2/SAXDriver.java @@ -60,8 +60,6 @@ import java.net.URL; import java.util.Locale; import java.util.Stack; -// maintaining 1.1 compatibility for now ... more portable, PJava, etc -// Iterator, Hashmap and ArrayList ought to be faster import java.util.ArrayList; import java.util.Collections; import java.util.Enumeration; @@ -131,1276 +129,1494 @@ import org.xml.sax.helpers.NamespaceSupport; * @see org.xml.sax.Parser */ final public class SAXDriver - implements Locator, Attributes2, XMLReader, Parser, AttributeList + implements Locator, Attributes2, XMLReader, Parser, AttributeList { - private final DefaultHandler2 base = new DefaultHandler2 (); - private XmlParser parser; - - private EntityResolver entityResolver = base; - private EntityResolver2 resolver2 = null; - private ContentHandler contentHandler = base; - private DTDHandler dtdHandler = base; - private ErrorHandler errorHandler = base; - private DeclHandler declHandler = base; - private LexicalHandler lexicalHandler = base; - - private String elementName; - private Stack entityStack; - - // one vector (of object/struct): faster, smaller - private List attributesList; - - private boolean namespaces = true; - private boolean xmlNames = false; - private boolean extGE = true; - private boolean extPE = true; - private boolean resolveAll = true; - private boolean useResolver2 = true; - private boolean stringInterning = true; - - private int attributeCount; - private boolean attributes; - private String nsTemp []; - private NamespaceSupport prefixStack; + + private final DefaultHandler2 base = new DefaultHandler2(); + private XmlParser parser; + + private EntityResolver entityResolver = base; + private EntityResolver2 resolver2 = null; + private ContentHandler contentHandler = base; + private DTDHandler dtdHandler = base; + private ErrorHandler errorHandler = base; + private DeclHandler declHandler = base; + private LexicalHandler lexicalHandler = base; + + private String elementName; + private Stack entityStack; + + // one vector (of object/struct): faster, smaller + private List attributesList; + + private boolean namespaces = true; + private boolean xmlNames = false; + private boolean extGE = true; + private boolean extPE = true; + private boolean resolveAll = true; + private boolean useResolver2 = true; + + // package private to allow (read-only) access in XmlParser + boolean stringInterning = true; + + private int attributeCount; + private boolean attributes; + private String[] nsTemp; + private NamespaceSupport prefixStack; + + // + // Constructor. + // + + /** + * Constructs a SAX Parser. + */ + public SAXDriver() + { + reset(); + } - // - // Constructor. - // + private void reset() + { + elementName = null; + entityStack = new Stack(); + attributesList = Collections.synchronizedList(new ArrayList()); + attributeCount = 0; + attributes = false; + nsTemp = new String[3]; + prefixStack = null; + } - /** Constructs a SAX Parser. */ - public SAXDriver () - { - reset (); - } - private void reset () - { - elementName = null; - entityStack = new Stack (); - attributesList = Collections.synchronizedList(new ArrayList()); - attributeCount = 0; - attributes = false; - nsTemp = new String[3]; - prefixStack = null; - } + // + // Implementation of org.xml.sax.Parser. + // + /** + * <b>SAX1</b>: Sets the locale used for diagnostics; currently, + * only locales using the English language are supported. + * @param locale The locale for which diagnostics will be generated + */ + public void setLocale(Locale locale) + throws SAXException + { + if ("en".equals(locale.getLanguage())) + { + return; + } + throw new SAXException ("AElfred2 only supports English locales."); + } - // - // Implementation of org.xml.sax.Parser. - // + /** + * <b>SAX2</b>: Returns the object used when resolving external + * entities during parsing (both general and parameter entities). + */ + public EntityResolver getEntityResolver() + { + return (entityResolver == base) ? null : entityResolver; + } - /** - * <b>SAX1</b>: Sets the locale used for diagnostics; currently, - * only locales using the English language are supported. - * @param locale The locale for which diagnostics will be generated - */ - public void setLocale (Locale locale) - throws SAXException - { - if ("en".equals (locale.getLanguage ())) - return ; + /** + * <b>SAX1, SAX2</b>: Set the entity resolver for this parser. + * @param handler The object to receive entity events. + */ + public void setEntityResolver(EntityResolver resolver) + { + if (resolver instanceof EntityResolver2) + { + resolver2 = (EntityResolver2) resolver; + } + else + { + resolver2 = null; + } + if (resolver == null) + { + resolver = base; + } + entityResolver = resolver; + } - throw new SAXException ("AElfred2 only supports English locales."); - } + /** + * <b>SAX2</b>: Returns the object used to process declarations related + * to notations and unparsed entities. + */ + public DTDHandler getDTDHandler() + { + return (dtdHandler == base) ? null : dtdHandler; + } + /** + * <b>SAX1, SAX2</b>: Set the DTD handler for this parser. + * @param handler The object to receive DTD events. + */ + public void setDTDHandler(DTDHandler handler) + { + if (handler == null) + { + handler = base; + } + this.dtdHandler = handler; + } - /** - * <b>SAX2</b>: Returns the object used when resolving external - * entities during parsing (both general and parameter entities). - */ - public EntityResolver getEntityResolver () - { - return (entityResolver == base) ? null : entityResolver; - } - /** - * <b>SAX1, SAX2</b>: Set the entity resolver for this parser. - * @param handler The object to receive entity events. - */ - public void setEntityResolver (EntityResolver resolver) - { - if (resolver instanceof EntityResolver2) - resolver2 = (EntityResolver2) resolver; - else - resolver2 = null; - if (resolver == null) - resolver = base; - entityResolver = resolver; - } + /** + * <b>SAX1</b>: Set the document handler for this parser. If a + * content handler was set, this document handler will supplant it. + * The parser is set to report all XML 1.0 names rather than to + * filter out "xmlns" attributes (the "namespace-prefixes" feature + * is set to true). + * + * @deprecated SAX2 programs should use the XMLReader interface + * and a ContentHandler. + * + * @param handler The object to receive document events. + */ + public void setDocumentHandler(DocumentHandler handler) + { + contentHandler = new Adapter(handler); + xmlNames = true; + } + /** + * <b>SAX2</b>: Returns the object used to report the logical + * content of an XML document. + */ + public ContentHandler getContentHandler() + { + return (contentHandler == base) ? null : contentHandler; + } - /** - * <b>SAX2</b>: Returns the object used to process declarations related - * to notations and unparsed entities. - */ - public DTDHandler getDTDHandler () - { - return (dtdHandler == base) ? null : dtdHandler; - } + /** + * <b>SAX2</b>: Assigns the object used to report the logical + * content of an XML document. If a document handler was set, + * this content handler will supplant it (but XML 1.0 style name + * reporting may remain enabled). + */ + public void setContentHandler(ContentHandler handler) + { + if (handler == null) + { + handler = base; + } + contentHandler = handler; + } - /** - * <b>SAX1, SAX2</b>: Set the DTD handler for this parser. - * @param handler The object to receive DTD events. - */ - public void setDTDHandler (DTDHandler handler) - { - if (handler == null) - handler = base; - this.dtdHandler = handler; - } + /** + * <b>SAX1, SAX2</b>: Set the error handler for this parser. + * @param handler The object to receive error events. + */ + public void setErrorHandler(ErrorHandler handler) + { + if (handler == null) + { + handler = base; + } + this.errorHandler = handler; + } + /** + * <b>SAX2</b>: Returns the object used to receive callbacks for XML + * errors of all levels (fatal, nonfatal, warning); this is never null; + */ + public ErrorHandler getErrorHandler() + { + return (errorHandler == base) ? null : errorHandler; + } - /** - * <b>SAX1</b>: Set the document handler for this parser. If a - * content handler was set, this document handler will supplant it. - * The parser is set to report all XML 1.0 names rather than to - * filter out "xmlns" attributes (the "namespace-prefixes" feature - * is set to true). - * - * @deprecated SAX2 programs should use the XMLReader interface - * and a ContentHandler. - * - * @param handler The object to receive document events. - */ - public void setDocumentHandler (DocumentHandler handler) - { - contentHandler = new Adapter (handler); - xmlNames = true; - } + /** + * <b>SAX1, SAX2</b>: Auxiliary API to parse an XML document, used mostly + * when no URI is available. + * If you want anything useful to happen, you should set + * at least one type of handler. + * @param source The XML input source. Don't set 'encoding' unless + * you know for a fact that it's correct. + * @see #setEntityResolver + * @see #setDTDHandler + * @see #setContentHandler + * @see #setErrorHandler + * @exception SAXException The handlers may throw any SAXException, + * and the parser normally throws SAXParseException objects. + * @exception IOException IOExceptions are normally through through + * the parser if there are problems reading the source document. + */ + public void parse(InputSource source) + throws SAXException, IOException + { + synchronized (base) + { + parser = new XmlParser(); + if (namespaces) + { + prefixStack = new NamespaceSupport(); + } + else if (!xmlNames) + { + throw new IllegalStateException(); + } + parser.setHandler(this); + + try + { + Reader r = source.getCharacterStream(); + InputStream in = source.getByteStream(); + + parser.doParse(source.getSystemId(), + source.getPublicId(), + r, + in, + source.getEncoding()); + } + catch (SAXException e) + { + throw e; + } + catch (IOException e) + { + throw e; + } + catch (RuntimeException e) + { + throw e; + } + catch (Exception e) + { + throw new SAXParseException(e.getMessage(), this, e); + } + finally + { + contentHandler.endDocument(); + reset(); + } + } + } - /** - * <b>SAX2</b>: Returns the object used to report the logical - * content of an XML document. - */ - public ContentHandler getContentHandler () - { - return contentHandler == base ? null : contentHandler; - } + /** + * <b>SAX1, SAX2</b>: Preferred API to parse an XML document, using a + * system identifier (URI). + */ + public void parse(String systemId) + throws SAXException, IOException + { + parse(new InputSource(systemId)); + } - /** - * <b>SAX2</b>: Assigns the object used to report the logical - * content of an XML document. If a document handler was set, - * this content handler will supplant it (but XML 1.0 style name - * reporting may remain enabled). - */ - public void setContentHandler (ContentHandler handler) - { - if (handler == null) - handler = base; - contentHandler = handler; - } + // + // Implementation of SAX2 "XMLReader" interface + // + static final String FEATURE = "http://xml.org/sax/features/"; + static final String PROPERTY = "http://xml.org/sax/properties/"; + + /** + * <b>SAX2</b>: Tells the value of the specified feature flag. + * + * @exception SAXNotRecognizedException thrown if the feature flag + * is neither built in, nor yet assigned. + */ + public boolean getFeature(String featureId) + throws SAXNotRecognizedException, SAXNotSupportedException + { + if ((FEATURE + "validation").equals(featureId)) + { + return false; + } - /** - * <b>SAX1, SAX2</b>: Set the error handler for this parser. - * @param handler The object to receive error events. - */ - public void setErrorHandler (ErrorHandler handler) - { - if (handler == null) - handler = base; - this.errorHandler = handler; - } + // external entities (both types) are optionally included + if ((FEATURE + "external-general-entities").equals(featureId)) + { + return extGE; + } + if ((FEATURE + "external-parameter-entities").equals(featureId)) + { + return extPE; + } + + // element/attribute names are as written in document; no mangling + if ((FEATURE + "namespace-prefixes").equals(featureId)) + { + return xmlNames; + } - /** - * <b>SAX2</b>: Returns the object used to receive callbacks for XML - * errors of all levels (fatal, nonfatal, warning); this is never null; - */ - public ErrorHandler getErrorHandler () - { return errorHandler == base ? null : errorHandler; } - - - /** - * <b>SAX1, SAX2</b>: Auxiliary API to parse an XML document, used mostly - * when no URI is available. - * If you want anything useful to happen, you should set - * at least one type of handler. - * @param source The XML input source. Don't set 'encoding' unless - * you know for a fact that it's correct. - * @see #setEntityResolver - * @see #setDTDHandler - * @see #setContentHandler - * @see #setErrorHandler - * @exception SAXException The handlers may throw any SAXException, - * and the parser normally throws SAXParseException objects. - * @exception IOException IOExceptions are normally through through - * the parser if there are problems reading the source document. - */ - public void parse (InputSource source) - throws SAXException, IOException - { - synchronized (base) { - parser = new XmlParser (); - if (namespaces) - prefixStack = new NamespaceSupport (); - else if (!xmlNames) - throw new IllegalStateException (); - parser.setHandler (this); - - try { - - Reader r = source.getCharacterStream(); - InputStream in = source.getByteStream(); - - - parser.doParse (source.getSystemId (), - source.getPublicId (), - r, - in, - source.getEncoding ()); - } catch (SAXException e) { - throw e; - } catch (IOException e) { - throw e; - } catch (RuntimeException e) { - throw e; - } catch (Exception e) { - throw new SAXParseException (e.getMessage (), this, e); - } finally { - contentHandler.endDocument (); - reset(); - } - } - } + // report element/attribute namespaces? + if ((FEATURE + "namespaces").equals(featureId)) + { + return namespaces; + } + // all PEs and GEs are reported + if ((FEATURE + "lexical-handler/parameter-entities").equals(featureId)) + { + return true; + } - /** - * <b>SAX1, SAX2</b>: Preferred API to parse an XML document, using a - * system identifier (URI). - */ - public void parse (String systemId) - throws SAXException, IOException - { - parse (new InputSource (systemId)); - } + // default is true + if ((FEATURE + "string-interning").equals(featureId)) + { + return stringInterning; + } + + // EXTENSIONS 1.1 + + // always returns isSpecified info + if ((FEATURE + "use-attributes2").equals(featureId)) + { + return true; + } + + // meaningful between startDocument/endDocument + if ((FEATURE + "is-standalone").equals(featureId)) + { + if (parser == null) + { + throw new SAXNotSupportedException(featureId); + } + return parser.isStandalone(); + } - // - // Implementation of SAX2 "XMLReader" interface - // - static final String FEATURE = "http://xml.org/sax/features/"; - static final String PROPERTY = "http://xml.org/sax/properties/"; - - /** - * <b>SAX2</b>: Tells the value of the specified feature flag. - * - * @exception SAXNotRecognizedException thrown if the feature flag - * is neither built in, nor yet assigned. - */ - public boolean getFeature (String featureId) - throws SAXNotRecognizedException, SAXNotSupportedException - { - if ((FEATURE + "validation").equals (featureId)) - return false; - - // external entities (both types) are optionally included - if ((FEATURE + "external-general-entities").equals (featureId)) - return extGE; - if ((FEATURE + "external-parameter-entities") .equals (featureId)) - return extPE; - - // element/attribute names are as written in document; no mangling - if ((FEATURE + "namespace-prefixes").equals (featureId)) - return xmlNames; - - // report element/attribute namespaces? - if ((FEATURE + "namespaces").equals (featureId)) - return namespaces; - - // all PEs and GEs are reported - if ((FEATURE + "lexical-handler/parameter-entities").equals (featureId)) - return true; - - // default is true - if ((FEATURE + "string-interning").equals (featureId)) - return stringInterning; - - // EXTENSIONS 1.1 - - // always returns isSpecified info - if ((FEATURE + "use-attributes2").equals (featureId)) - return true; - - // meaningful between startDocument/endDocument - if ((FEATURE + "is-standalone").equals (featureId)) { - if (parser == null) - throw new SAXNotSupportedException (featureId); - return parser.isStandalone (); - } - - // optionally don't absolutize URIs in declarations - if ((FEATURE + "resolve-dtd-uris").equals (featureId)) - return resolveAll; - - // optionally use resolver2 interface methods, if possible - if ((FEATURE + "use-entity-resolver2").equals (featureId)) - return useResolver2; - - throw new SAXNotRecognizedException (featureId); - } + // optionally don't absolutize URIs in declarations + if ((FEATURE + "resolve-dtd-uris").equals(featureId)) + { + return resolveAll; + } + + // optionally use resolver2 interface methods, if possible + if ((FEATURE + "use-entity-resolver2").equals(featureId)) + { + return useResolver2; + } + + throw new SAXNotRecognizedException(featureId); + } - // package private - DeclHandler getDeclHandler () { return declHandler; } + // package private + DeclHandler getDeclHandler() + { + return declHandler; + } - // package private - boolean resolveURIs () { return resolveAll; } + // package private + boolean resolveURIs() + { + return resolveAll; + } - /** - * <b>SAX2</b>: Returns the specified property. - * - * @exception SAXNotRecognizedException thrown if the property value - * is neither built in, nor yet stored. - */ - public Object getProperty (String propertyId) + /** + * <b>SAX2</b>: Returns the specified property. + * + * @exception SAXNotRecognizedException thrown if the property value + * is neither built in, nor yet stored. + */ + public Object getProperty(String propertyId) throws SAXNotRecognizedException - { - if ((PROPERTY + "declaration-handler").equals (propertyId)) - return declHandler == base ? null : declHandler; - - if ((PROPERTY + "lexical-handler").equals (propertyId)) - return lexicalHandler == base ? null : lexicalHandler; - - // unknown properties - throw new SAXNotRecognizedException (propertyId); - } + { + if ((PROPERTY + "declaration-handler").equals(propertyId)) + { + return (declHandler == base) ? null : declHandler; + } - /** - * <b>SAX2</b>: Sets the state of feature flags in this parser. Some - * built-in feature flags are mutable. - */ - public void setFeature (String featureId, boolean value) - throws SAXNotRecognizedException, SAXNotSupportedException - { - boolean state; - - // Features with a defined value, we just change it if we can. - state = getFeature (featureId); - - if (state == value) - return; - if (parser != null) - throw new SAXNotSupportedException ("not while parsing"); - - if ((FEATURE + "namespace-prefixes").equals (featureId)) { - // in this implementation, this only affects xmlns reporting - xmlNames = value; - // forcibly prevent illegal parser state - if (!xmlNames) - namespaces = true; - return; - } - - if ((FEATURE + "namespaces").equals (featureId)) { - namespaces = value; - // forcibly prevent illegal parser state - if (!namespaces) - xmlNames = true; - return; - } - - if ((FEATURE + "external-general-entities").equals (featureId)) { - extGE = value; - return; - } - if ((FEATURE + "external-parameter-entities") .equals (featureId)) { - extPE = value; - return; - } - if ((FEATURE + "resolve-dtd-uris").equals (featureId)) { - resolveAll = value; - return; - } - - if ((FEATURE + "use-entity-resolver2").equals (featureId)) { - useResolver2 = value; - return; - } - - throw new SAXNotRecognizedException (featureId); - } + if ((PROPERTY + "lexical-handler").equals(propertyId)) + { + return (lexicalHandler == base) ? null : lexicalHandler; + } + + // unknown properties + throw new SAXNotRecognizedException(propertyId); + } - /** - * <b>SAX2</b>: Assigns the specified property. Like SAX1 handlers, - * these may be changed at any time. - */ - public void setProperty (String propertyId, Object value) + /** + * <b>SAX2</b>: Sets the state of feature flags in this parser. Some + * built-in feature flags are mutable. + */ + public void setFeature(String featureId, boolean value) throws SAXNotRecognizedException, SAXNotSupportedException - { - // see if the property is recognized - getProperty (propertyId); - - // Properties with a defined value, we just change it if we can. - - if ((PROPERTY + "declaration-handler").equals (propertyId)) { - if (value == null) - declHandler = base; - else if (! (value instanceof DeclHandler)) - throw new SAXNotSupportedException (propertyId); - else - declHandler = (DeclHandler) value; - return ; - } - - if ((PROPERTY + "lexical-handler").equals (propertyId)) { - if (value == null) - lexicalHandler = base; - else if (! (value instanceof LexicalHandler)) - throw new SAXNotSupportedException (propertyId); - else - lexicalHandler = (LexicalHandler) value; - return ; - } - - throw new SAXNotSupportedException (propertyId); - } + { + boolean state; + + // Features with a defined value, we just change it if we can. + state = getFeature (featureId); + + if (state == value) + { + return; + } + if (parser != null) + { + throw new SAXNotSupportedException("not while parsing"); + } + if ((FEATURE + "namespace-prefixes").equals(featureId)) + { + // in this implementation, this only affects xmlns reporting + xmlNames = value; + // forcibly prevent illegal parser state + if (!xmlNames) + { + namespaces = true; + } + return; + } - // - // This is where the driver receives XmlParser callbacks and translates - // them into SAX callbacks. Some more callbacks have been added for - // SAX2 support. - // + if ((FEATURE + "namespaces").equals(featureId)) + { + namespaces = value; + // forcibly prevent illegal parser state + if (!namespaces) + { + xmlNames = true; + } + return; + } + + if ((FEATURE + "external-general-entities").equals(featureId)) + { + extGE = value; + return; + } + if ((FEATURE + "external-parameter-entities").equals(featureId)) + { + extPE = value; + return; + } + if ((FEATURE + "resolve-dtd-uris").equals(featureId)) + { + resolveAll = value; + return; + } - void startDocument () + if ((FEATURE + "use-entity-resolver2").equals(featureId)) + { + useResolver2 = value; + return; + } + + throw new SAXNotRecognizedException(featureId); + } + + /** + * <b>SAX2</b>: Assigns the specified property. Like SAX1 handlers, + * these may be changed at any time. + */ + public void setProperty(String propertyId, Object value) + throws SAXNotRecognizedException, SAXNotSupportedException + { + // see if the property is recognized + getProperty(propertyId); + + // Properties with a defined value, we just change it if we can. + + if ((PROPERTY + "declaration-handler").equals(propertyId)) + { + if (value == null) + { + declHandler = base; + } + else if (!(value instanceof DeclHandler)) + { + throw new SAXNotSupportedException(propertyId); + } + else + { + declHandler = (DeclHandler) value; + } + return ; + } + + if ((PROPERTY + "lexical-handler").equals(propertyId)) + { + if (value == null) + { + lexicalHandler = base; + } + else if (!(value instanceof LexicalHandler)) + { + throw new SAXNotSupportedException(propertyId); + } + else + { + lexicalHandler = (LexicalHandler) value; + } + return; + } + + throw new SAXNotSupportedException(propertyId); + } + + // + // This is where the driver receives XmlParser callbacks and translates + // them into SAX callbacks. Some more callbacks have been added for + // SAX2 support. + // + + void startDocument() throws SAXException - { - contentHandler.setDocumentLocator (this); - contentHandler.startDocument (); - attributesList.clear (); - } + { + contentHandler.setDocumentLocator(this); + contentHandler.startDocument(); + attributesList.clear(); + } - void xmlDecl(String version, - String encoding, - boolean standalone, - String inputEncoding) - throws SAXException - { - if (contentHandler instanceof ContentHandler2) - { - ((ContentHandler2) contentHandler).xmlDecl(version, - encoding, - standalone, - inputEncoding); - } - } + void xmlDecl(String version, + String encoding, + boolean standalone, + String inputEncoding) + throws SAXException + { + if (contentHandler instanceof ContentHandler2) + { + ((ContentHandler2) contentHandler).xmlDecl(version, + encoding, + standalone, + inputEncoding); + } + } - void skippedEntity (String name) + void skippedEntity(String name) throws SAXException - { contentHandler.skippedEntity (name); } + { + contentHandler.skippedEntity(name); + } - InputSource getExternalSubset (String name, String baseURI) + InputSource getExternalSubset(String name, String baseURI) throws SAXException, IOException - { - if (resolver2 == null || !useResolver2 || !extPE) - return null; - return resolver2.getExternalSubset (name, baseURI); - } + { + if (resolver2 == null || !useResolver2 || !extPE) + { + return null; + } + return resolver2.getExternalSubset(name, baseURI); + } - InputSource resolveEntity (boolean isPE, String name, - InputSource in, String baseURI) + InputSource resolveEntity(boolean isPE, String name, + InputSource in, String baseURI) throws SAXException, IOException - { - InputSource source; - - // external entities might be skipped - if (isPE && !extPE) - return null; - if (!isPE && !extGE) - return null; - - // ... or not - lexicalHandler.startEntity (name); - if (resolver2 != null && useResolver2) { - source = resolver2.resolveEntity (name, in.getPublicId (), - baseURI, in.getSystemId ()); - if (source == null) { - in.setSystemId (absolutize (baseURI, - in.getSystemId (), false)); - source = in; - } - } else { - in.setSystemId (absolutize (baseURI, in.getSystemId (), false)); - source = entityResolver.resolveEntity (in.getPublicId (), - in.getSystemId ()); - if (source == null) - source = in; - } - startExternalEntity (name, source.getSystemId (), true); - return source; - } + { + InputSource source; + + // external entities might be skipped + if (isPE && !extPE) + { + return null; + } + if (!isPE && !extGE) + { + return null; + } - // absolutize a system ID relative to the specified base URI - // (temporarily) package-visible for external entity decls - String absolutize (String baseURI, String systemId, boolean nice) + // ... or not + lexicalHandler.startEntity(name); + if (resolver2 != null && useResolver2) + { + source = resolver2.resolveEntity(name, in.getPublicId(), + baseURI, in.getSystemId()); + if (source == null) + { + in.setSystemId(absolutize(baseURI, + in.getSystemId(), false)); + source = in; + } + } + else + { + in.setSystemId(absolutize(baseURI, in.getSystemId(), false)); + source = entityResolver.resolveEntity(in.getPublicId(), + in.getSystemId()); + if (source == null) + { + source = in; + } + } + startExternalEntity(name, source.getSystemId(), true); + return source; + } + + // absolutize a system ID relative to the specified base URI + // (temporarily) package-visible for external entity decls + String absolutize(String baseURI, String systemId, boolean nice) throws MalformedURLException, SAXException - { - // FIXME normalize system IDs -- when? - // - Convert to UTF-8 - // - Map reserved and non-ASCII characters to %HH - - try { - if (baseURI == null) { - warn ("No base URI; hope this SYSTEM id is absolute: " - + systemId); - return new URL (systemId).toString (); - } else - return new URL (new URL (baseURI), systemId).toString (); - - } catch (MalformedURLException e) { - - // Let unknown URI schemes pass through unless we need - // the JVM to map them to i/o streams for us... - if (!nice) - throw e; - - // sometimes sysids for notations or unparsed entities - // aren't really URIs... - warn ("Can't absolutize SYSTEM id: " + e.getMessage ()); - return systemId; - } - } + { + // FIXME normalize system IDs -- when? + // - Convert to UTF-8 + // - Map reserved and non-ASCII characters to %HH + + try + { + if (baseURI == null) + { + if (XmlParser.uriWarnings) + { + warn ("No base URI; hope this SYSTEM id is absolute: " + + systemId); + } + return new URL(systemId).toString(); + } + else + { + return new URL(new URL(baseURI), systemId).toString(); + } + } + catch (MalformedURLException e) + { + // Let unknown URI schemes pass through unless we need + // the JVM to map them to i/o streams for us... + if (!nice) + { + throw e; + } + + // sometimes sysids for notations or unparsed entities + // aren't really URIs... + warn("Can't absolutize SYSTEM id: " + e.getMessage()); + return systemId; + } + } - void startExternalEntity (String name, String systemId, - boolean stackOnly) + void startExternalEntity(String name, String systemId, boolean stackOnly) throws SAXException - { - // The following warning was deleted because the application has the - // option of not setting systemId. Sun's JAXP or Xerces seems to - // ignore this case. - /* - if (systemId == null) - warn ("URI was not reported to parser for entity " + name); - */ - if (!stackOnly) // spliced [dtd] needs startEntity - lexicalHandler.startEntity (name); - entityStack.push (systemId); - } + { + // The following warning was deleted because the application has the + // option of not setting systemId. Sun's JAXP or Xerces seems to + // ignore this case. + /* + if (systemId == null) + warn ("URI was not reported to parser for entity " + name); + */ + if (!stackOnly) // spliced [dtd] needs startEntity + { + lexicalHandler.startEntity(name); + } + entityStack.push(systemId); + } - void endExternalEntity (String name) + void endExternalEntity(String name) throws SAXException - { - if (!"[document]".equals (name)) - lexicalHandler.endEntity (name); - entityStack.pop (); - } + { + if (!"[document]".equals(name)) + { + lexicalHandler.endEntity(name); + } + entityStack.pop(); + } - void startInternalEntity (String name) + void startInternalEntity(String name) throws SAXException - { - lexicalHandler.startEntity (name); - } + { + lexicalHandler.startEntity(name); + } - void endInternalEntity (String name) + void endInternalEntity(String name) throws SAXException - { - lexicalHandler.endEntity (name); - } + { + lexicalHandler.endEntity(name); + } - void doctypeDecl (String name, String publicId, String systemId) + void doctypeDecl(String name, String publicId, String systemId) throws SAXException - { - lexicalHandler.startDTD (name, publicId, systemId); - - // ... the "name" is a declaration and should be given - // to the DeclHandler (but sax2 doesn't). - - // the IDs for the external subset are lexical details, - // as are the contents of the internal subset; but sax2 - // doesn't provide the internal subset "pre-parse" - } - - void notationDecl (String name, String ids []) + { + lexicalHandler.startDTD(name, publicId, systemId); + + // ... the "name" is a declaration and should be given + // to the DeclHandler (but sax2 doesn't). + + // the IDs for the external subset are lexical details, + // as are the contents of the internal subset; but sax2 + // doesn't provide the internal subset "pre-parse" + } + + void notationDecl(String name, String publicId, String systemId, + String baseUri) throws SAXException - { - try { - dtdHandler.notationDecl (name, ids [0], - (resolveAll && ids [1] != null) - ? absolutize (ids [2], ids [1], true) - : ids [1]); - } catch (IOException e) { - // "can't happen" - throw new SAXParseException (e.getMessage (), this, e); - } - } + { + try + { + dtdHandler.notationDecl(name, publicId, + (resolveAll && systemId != null) + ? absolutize(baseUri, systemId, true) + : systemId); + } + catch (IOException e) + { + // "can't happen" + throw new SAXParseException(e.getMessage(), this, e); + } + } - void unparsedEntityDecl (String name, String ids [], String notation) + void unparsedEntityDecl(String name, String publicId, String systemId, + String baseUri, String notation) throws SAXException - { - try { - dtdHandler.unparsedEntityDecl (name, ids [0], - resolveAll - ? absolutize (ids [2], ids [1], true) - : ids [1], - notation); - } catch (IOException e) { - // "can't happen" - throw new SAXParseException (e.getMessage (), this, e); - } - } + { + try + { + dtdHandler.unparsedEntityDecl(name, publicId, + resolveAll + ? absolutize(baseUri, systemId, true) + : systemId, + notation); + } + catch (IOException e) + { + // "can't happen" + throw new SAXParseException(e.getMessage(), this, e); + } + } - void endDoctype () + void endDoctype() throws SAXException - { - lexicalHandler.endDTD (); - } + { + lexicalHandler.endDTD(); + } - private void declarePrefix (String prefix, String uri) + private void declarePrefix(String prefix, String uri) throws SAXException - { - int index = uri.indexOf (':'); - - // many versions of nwalsh docbook stylesheets - // have bogus URLs; so this can't be an error... - if (index < 1 && uri.length () != 0) - warn ("relative URI for namespace: " + uri); - - // FIXME: char [0] must be ascii alpha; chars [1..index] - // must be ascii alphanumeric or in "+-." [RFC 2396] - - //Namespace Constraints - //name for xml prefix must be http://www.w3.org/XML/1998/namespace - boolean prefixEquality = prefix.equals("xml"); - boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); - if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) - fatal ("xml is by definition bound to the namespace name " + - "http://www.w3.org/XML/1998/namespace"); - - //xmlns prefix declaration is illegal but xml prefix declaration is llegal... - if (prefixEquality && uriEquality) - return; - - //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ - prefixEquality = prefix.equals("xmlns"); - uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); - if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) - fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + - " to prefix xmlns"); - - //even if the uri is http://www.w3.org/2000/xmlns/ it is illegal to declare it - if (prefixEquality && uriEquality) - fatal ("declaring the xmlns prefix is illegal"); - - uri = uri.intern (); - prefixStack.declarePrefix (prefix, uri); - contentHandler.startPrefixMapping (prefix, uri); - } + { + int index = uri.indexOf(':'); + + // many versions of nwalsh docbook stylesheets + // have bogus URLs; so this can't be an error... + if (index < 1 && uri.length() != 0) + { + warn("relative URI for namespace: " + uri); + } - void attribute (String qname, String value, boolean isSpecified) - throws SAXException - { - if (!attributes) { - attributes = true; - if (namespaces) - prefixStack.pushContext (); - } - - // process namespace decls immediately; - // then maybe forget this as an attribute - if (namespaces) { - int index; - - // default NS declaration? - if (getFeature (FEATURE + "string-interning")) { - if ("xmlns" == qname) { - declarePrefix ("", value); - if (!xmlNames) - return; - } - // NS prefix declaration? - else if ((index = qname.indexOf (':')) == 5 - && qname.startsWith ("xmlns")) { - String prefix = qname.substring (6); - - if (prefix.equals("")) - fatal ("missing prefix in namespace declaration attribute"); - if (value.length () == 0) { - verror ("missing URI in namespace declaration attribute: " - + qname); - } else - declarePrefix (prefix, value); - if (!xmlNames) - return; - } - } else { - if ("xmlns".equals(qname)) { - declarePrefix ("", value); - if (!xmlNames) - return; - } - // NS prefix declaration? - else if ((index = qname.indexOf (':')) == 5 - && qname.startsWith ("xmlns")) { - String prefix = qname.substring (6); - - if (value.length () == 0) { - verror ("missing URI in namespace decl attribute: " - + qname); - } else - declarePrefix (prefix, value); - if (!xmlNames) - return; - } + // FIXME: char [0] must be ascii alpha; chars [1..index] + // must be ascii alphanumeric or in "+-." [RFC 2396] + + //Namespace Constraints + //name for xml prefix must be http://www.w3.org/XML/1998/namespace + boolean prefixEquality = prefix.equals("xml"); + boolean uriEquality = uri.equals("http://www.w3.org/XML/1998/namespace"); + if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) + { + fatal("xml is by definition bound to the namespace name " + + "http://www.w3.org/XML/1998/namespace"); + } + + //xmlns prefix declaration is illegal but xml prefix declaration is llegal... + if (prefixEquality && uriEquality) + { + return; } + + //name for xmlns prefix must be http://www.w3.org/2000/xmlns/ + prefixEquality = prefix.equals("xmlns"); + uriEquality = uri.equals("http://www.w3.org/2000/xmlns/"); + if ((prefixEquality || uriEquality) && !(prefixEquality && uriEquality)) + { + fatal("http://www.w3.org/2000/xmlns/ is by definition bound" + + " to prefix xmlns"); + } + + //even if the uri is http://www.w3.org/2000/xmlns/ + // it is illegal to declare it + if (prefixEquality && uriEquality) + { + fatal ("declaring the xmlns prefix is illegal"); + } + + uri = uri.intern(); + prefixStack.declarePrefix(prefix, uri); + contentHandler.startPrefixMapping(prefix, uri); } - // remember this attribute ... - - attributeCount++; - - // attribute type comes from querying parser's DTD records - attributesList.add(new Attribute(qname, value, isSpecified)); - - } - void startElement (String elname) + void attribute(String qname, String value, boolean isSpecified) throws SAXException - { - ContentHandler handler = contentHandler; - - // - // NOTE: this implementation of namespace support adds something - // like six percent to parsing CPU time, in a large (~50 MB) - // document that doesn't use namespaces at all. (Measured by PC - // sampling, with a bug where endElement processing was omitted.) - // [Measurement referred to older implementation, older JVM ...] - // - // It ought to become notably faster in such cases. Most - // costs are the prefix stack calling Hashtable.get() (2%), - // String.hashCode() (1.5%) and about 1.3% each for pushing - // the context, and two chunks of name processing. - // - - if (!attributes) { - if (namespaces) - prefixStack.pushContext (); - } else if (namespaces) { - - // now we can patch up namespace refs; we saw all the - // declarations, so now we'll do the Right Thing - Iterator itt = attributesList.iterator (); - while(itt.hasNext()) - { - Attribute attribute = (Attribute) itt.next(); - String qname = attribute.name; - int index; - - // default NS declaration? - if (getFeature (FEATURE + "string-interning")) { - if ("xmlns" == qname) - continue; - } else { - if ("xmlns".equals(qname)) - continue; - } - //Illegal in the new Namespaces Draft - //should it be only in 1.1 docs?? - if (qname.equals (":")) - fatal ("namespace names consisting of a single colon " + - "character are invalid"); - index = qname.indexOf (':'); - - // NS prefix declaration? - if (index == 5 && qname.startsWith ("xmlns")) - continue; - - // it's not a NS decl; patch namespace info items - if (prefixStack.processName (qname, nsTemp, true) == null) - fatal ("undeclared attribute prefix in: " + qname); - else { - attribute.nameSpace = nsTemp[0]; - attribute.localName = nsTemp[1]; - } - } - } - - // save element name so attribute callbacks work - elementName = elname; - if (namespaces) { - if (prefixStack.processName (elname, nsTemp, false) == null) { - fatal ("undeclared element prefix in: " + elname); - nsTemp [0] = nsTemp [1] = ""; - } - handler.startElement (nsTemp [0], nsTemp [1], elname, this); - } else - handler.startElement ("", "", elname, this); - // elementName = null; - - // elements with no attributes are pretty common! - if (attributes) { - attributesList.clear(); - attributeCount = 0; - attributes = false; - } - } - - void endElement (String elname) + { + if (!attributes) + { + attributes = true; + if (namespaces) + { + prefixStack.pushContext(); + } + } + + // process namespace decls immediately; + // then maybe forget this as an attribute + if (namespaces) + { + int index; + + // default NS declaration? + if (stringInterning) + { + if ("xmlns" == qname) + { + declarePrefix("", value); + if (!xmlNames) + { + return; + } + } + // NS prefix declaration? + else if ((index = qname.indexOf(':')) == 5 + && qname.startsWith("xmlns")) + { + String prefix = qname.substring(6); + + if (prefix.equals("")) + { + fatal("missing prefix " + + "in namespace declaration attribute"); + } + if (value.length() == 0) + { + verror("missing URI in namespace declaration attribute: " + + qname); + } + else + { + declarePrefix(prefix, value); + } + if (!xmlNames) + { + return; + } + } + } + else + { + if ("xmlns".equals(qname)) + { + declarePrefix("", value); + if (!xmlNames) + { + return; + } + } + // NS prefix declaration? + else if ((index = qname.indexOf(':')) == 5 + && qname.startsWith("xmlns")) + { + String prefix = qname.substring(6); + + if (value.length() == 0) + { + verror("missing URI in namespace decl attribute: " + + qname); + } + else + { + declarePrefix(prefix, value); + } + if (!xmlNames) + { + return; + } + } + } + } + // remember this attribute ... + attributeCount++; + + // attribute type comes from querying parser's DTD records + attributesList.add(new Attribute(qname, value, isSpecified)); + + } + + void startElement(String elname) throws SAXException - { - ContentHandler handler = contentHandler; - - if (!namespaces) { - handler.endElement ("", "", elname); - return; - } - prefixStack.processName (elname, nsTemp, false); - handler.endElement (nsTemp [0], nsTemp [1], elname); + { + ContentHandler handler = contentHandler; - Enumeration prefixes = prefixStack.getDeclaredPrefixes (); + // + // NOTE: this implementation of namespace support adds something + // like six percent to parsing CPU time, in a large (~50 MB) + // document that doesn't use namespaces at all. (Measured by PC + // sampling, with a bug where endElement processing was omitted.) + // [Measurement referred to older implementation, older JVM ...] + // + // It ought to become notably faster in such cases. Most + // costs are the prefix stack calling Hashtable.get() (2%), + // String.hashCode() (1.5%) and about 1.3% each for pushing + // the context, and two chunks of name processing. + // + + if (!attributes) + { + if (namespaces) + { + prefixStack.pushContext(); + } + } + else if (namespaces) + { + + // now we can patch up namespace refs; we saw all the + // declarations, so now we'll do the Right Thing + Iterator itt = attributesList.iterator(); + while (itt.hasNext()) + { + Attribute attribute = (Attribute) itt.next(); + String qname = attribute.name; + int index; + + // default NS declaration? + if (stringInterning) + { + if ("xmlns" == qname) + { + continue; + } + } + else + { + if ("xmlns".equals(qname)) + { + continue; + } + } + //Illegal in the new Namespaces Draft + //should it be only in 1.1 docs?? + if (qname.equals (":")) + { + fatal("namespace names consisting of a single colon " + + "character are invalid"); + } + index = qname.indexOf(':'); + + // NS prefix declaration? + if (index == 5 && qname.startsWith("xmlns")) + { + continue; + } + + // it's not a NS decl; patch namespace info items + if (prefixStack.processName(qname, nsTemp, true) == null) + { + fatal("undeclared attribute prefix in: " + qname); + } + else + { + attribute.nameSpace = nsTemp[0]; + attribute.localName = nsTemp[1]; + } + } + } + + // save element name so attribute callbacks work + elementName = elname; + if (namespaces) + { + if (prefixStack.processName(elname, nsTemp, false) == null) + { + fatal("undeclared element prefix in: " + elname); + nsTemp[0] = nsTemp[1] = ""; + } + handler.startElement(nsTemp[0], nsTemp[1], elname, this); + } + else + { + handler.startElement("", "", elname, this); + } + // elementName = null; + + // elements with no attributes are pretty common! + if (attributes) + { + attributesList.clear(); + attributeCount = 0; + attributes = false; + } + } + + void endElement(String elname) + throws SAXException + { + ContentHandler handler = contentHandler; - while (prefixes.hasMoreElements ()) - handler.endPrefixMapping ((String) prefixes.nextElement ()); - prefixStack.popContext (); - } + if (!namespaces) + { + handler.endElement("", "", elname); + return; + } + prefixStack.processName(elname, nsTemp, false); + handler.endElement(nsTemp[0], nsTemp[1], elname); + + Enumeration prefixes = prefixStack.getDeclaredPrefixes(); + + while (prefixes.hasMoreElements()) + { + handler.endPrefixMapping((String) prefixes.nextElement()); + } + prefixStack.popContext(); + } - void startCDATA () + void startCDATA() throws SAXException - { - lexicalHandler.startCDATA (); - } + { + lexicalHandler.startCDATA(); + } - void charData (char ch[], int start, int length) + void charData(char[] ch, int start, int length) throws SAXException - { - contentHandler.characters (ch, start, length); - } + { + contentHandler.characters(ch, start, length); + } - void endCDATA () + void endCDATA() throws SAXException - { - lexicalHandler.endCDATA (); - } + { + lexicalHandler.endCDATA(); + } - void ignorableWhitespace (char ch[], int start, int length) + void ignorableWhitespace(char[] ch, int start, int length) throws SAXException - { - contentHandler.ignorableWhitespace (ch, start, length); - } + { + contentHandler.ignorableWhitespace(ch, start, length); + } - void processingInstruction (String target, String data) + void processingInstruction(String target, String data) throws SAXException - { - contentHandler.processingInstruction (target, data); - } + { + contentHandler.processingInstruction(target, data); + } - void comment (char ch[], int start, int length) + void comment(char[] ch, int start, int length) throws SAXException - { - if (lexicalHandler != base) - lexicalHandler.comment (ch, start, length); - } + { + if (lexicalHandler != base) + { + lexicalHandler.comment(ch, start, length); + } + } - void fatal (String message) + void fatal(String message) throws SAXException - { - SAXParseException fatal; - - fatal = new SAXParseException (message, this); - errorHandler.fatalError (fatal); - - // Even if the application can continue ... we can't! - throw fatal; - } + { + SAXParseException fatal; + + fatal = new SAXParseException(message, this); + errorHandler.fatalError(fatal); + + // Even if the application can continue ... we can't! + throw fatal; + } - // We can safely report a few validity errors that - // make layered SAX2 DTD validation more conformant - void verror (String message) + // We can safely report a few validity errors that + // make layered SAX2 DTD validation more conformant + void verror(String message) throws SAXException - { - SAXParseException err; - - err = new SAXParseException (message, this); - errorHandler.error (err); - } - - void warn (String message) + { + SAXParseException err; + + err = new SAXParseException(message, this); + errorHandler.error(err); + } + + void warn(String message) throws SAXException - { - SAXParseException err; - - err = new SAXParseException (message, this); - errorHandler.warning (err); - } + { + SAXParseException err; + + err = new SAXParseException(message, this); + errorHandler.warning(err); + } + // + // Implementation of org.xml.sax.Attributes. + // + + /** + * <b>SAX1 AttributeList, SAX2 Attributes</b> method + * (don't invoke on parser); + */ + public int getLength() + { + return attributesList.size(); + } - // - // Implementation of org.xml.sax.Attributes. - // + /** + * <b>SAX2 Attributes</b> method (don't invoke on parser); + */ + public String getURI(int index) + { + if (index < 0 || index >= attributesList.size()) + { + return null; + } + return ((Attribute) attributesList.get(index)).nameSpace; + } - /** - * <b>SAX1 AttributeList, SAX2 Attributes</b> method - * (don't invoke on parser); - */ - public int getLength () - { - return attributesList.size(); - } + /** + * <b>SAX2 Attributes</b> method (don't invoke on parser); + */ + public String getLocalName(int index) + { + if (index < 0 || index >= attributesList.size()) + { + return null; + } + Attribute attr = (Attribute) attributesList.get(index); + // FIXME attr.localName is sometimes null, why? + if (namespaces && attr.localName == null) + { + // XXX fix this here for now + int ci = attr.name.indexOf(':'); + attr.localName = (ci == -1) ? attr.name : + attr.name.substring(ci + 1); + } + return (attr.localName == null) ? "" : attr.localName; + } - /** - * <b>SAX2 Attributes</b> method (don't invoke on parser); - */ - public String getURI (int index) - { - if (index < 0 || index >= attributesList.size()) - { - return null; - } - return ((Attribute) attributesList.get(index)).nameSpace; - } + /** + * <b>SAX2 Attributes</b> method (don't invoke on parser); + */ + public String getQName(int index) + { + if (index < 0 || index >= attributesList.size()) + { + return null; + } + Attribute attr = (Attribute) attributesList.get(index); + return (attr.name == null) ? "" : attr.name; + } - /** - * <b>SAX2 Attributes</b> method (don't invoke on parser); - */ - public String getLocalName (int index) - { - if (index < 0 || index >= attributesList.size()) - { - return null; - } - Attribute attr = (Attribute) attributesList.get(index); - // FIXME attr.localName is sometimes null, why? - if (namespaces && attr.localName == null) - { - // XXX fix this here for now - int ci = attr.name.indexOf(':'); - attr.localName = (ci == -1) ? attr.name : - attr.name.substring(ci + 1); - } - return (attr.localName == null) ? "" : attr.localName; - } + /** + * <b>SAX1 AttributeList</b> method (don't invoke on parser); + */ + public String getName(int index) + { + return getQName(index); + } - /** - * <b>SAX2 Attributes</b> method (don't invoke on parser); - */ - public String getQName (int index) - { - if (index < 0 || index >= attributesList.size()) - { - return null; - } - Attribute attr = (Attribute) attributesList.get(index); - return (attr.name == null) ? "" : attr.name; - } + /** + * <b>SAX1 AttributeList, SAX2 Attributes</b> method + * (don't invoke on parser); + */ + public String getType(int index) + { + if (index < 0 || index >= attributesList.size()) + { + return null; + } + String type = parser.getAttributeType(elementName, getQName(index)); + if (type == null) + { + return "CDATA"; + } + // ... use DeclHandler.attributeDecl to see enumerations + if (type == "ENUMERATION") + { + return "NMTOKEN"; + } + return type; + } - /** - * <b>SAX1 AttributeList</b> method (don't invoke on parser); - */ - public String getName (int index) - { - return getQName(index); - } + /** + * <b>SAX1 AttributeList, SAX2 Attributes</b> method + * (don't invoke on parser); + */ + public String getValue(int index) + { + if (index < 0 || index >= attributesList.size()) + { + return null; + } + return ((Attribute) attributesList.get(index)).value; + } - /** - * <b>SAX1 AttributeList, SAX2 Attributes</b> method - * (don't invoke on parser); - */ - public String getType (int index) + /** + * <b>SAX2 Attributes</b> method (don't invoke on parser); + */ + public int getIndex(String uri, String local) { - if (index < 0 || index >= attributesList.size()) - { - return null; - } - String type = parser.getAttributeType(elementName, getQName(index)); - if (type == null) - { - return "CDATA"; - } - // ... use DeclHandler.attributeDecl to see enumerations - if (type == "ENUMERATION") - { - return "NMTOKEN"; - } - return type; - } - + int length = getLength(); + + for (int i = 0; i < length; i++) + { + if (!getURI(i).equals(uri)) + { + continue; + } + if (getLocalName(i).equals(local)) + { + return i; + } + } + return -1; + } - /** - * <b>SAX1 AttributeList, SAX2 Attributes</b> method - * (don't invoke on parser); - */ - public String getValue (int index) - { - if (index < 0 || index >= attributesList.size()) + /** + * <b>SAX2 Attributes</b> method (don't invoke on parser); + */ + public int getIndex(String xmlName) + { + int length = getLength(); + + for (int i = 0; i < length; i++) + { + if (getQName(i).equals(xmlName)) { - return null; + return i; } - return ((Attribute) attributesList.get(index)).value; - } + } + return -1; + } + /** + * <b>SAX2 Attributes</b> method (don't invoke on parser); + */ + public String getType(String uri, String local) + { + int index = getIndex(uri, local); + + if (index < 0) + { + return null; + } + return getType(index); + } - /** - * <b>SAX2 Attributes</b> method (don't invoke on parser); - */ - public int getIndex (String uri, String local) - { - int length = getLength(); + /** + * <b>SAX1 AttributeList, SAX2 Attributes</b> method + * (don't invoke on parser); + */ + public String getType(String xmlName) + { + int index = getIndex(xmlName); + + if (index < 0) + { + return null; + } + return getType(index); + } - for (int i = 0; i < length; i++) - { - if (!getURI(i).equals(uri)) - { - continue; - } - if (getLocalName(i).equals(local)) - { - return i; - } - } - return -1; - } + /** + * <b>SAX Attributes</b> method (don't invoke on parser); + */ + public String getValue(String uri, String local) + { + int index = getIndex(uri, local); + + if (index < 0) + { + return null; + } + return getValue(index); + } + /** + * <b>SAX1 AttributeList, SAX2 Attributes</b> method + * (don't invoke on parser); + */ + public String getValue(String xmlName) + { + int index = getIndex(xmlName); + + if (index < 0) + { + return null; + } + return getValue(index); + } - /** - * <b>SAX2 Attributes</b> method (don't invoke on parser); - */ - public int getIndex (String xmlName) - { - int length = getLength(); + // + // Implementation of org.xml.sax.ext.Attributes2 + // + + /** @return false unless the attribute was declared in the DTD. + * @throws java.lang.ArrayIndexOutOfBoundsException + * When the supplied index does not identify an attribute. + */ + public boolean isDeclared(int index) + { + if (index < 0 || index >= attributeCount) + { + throw new ArrayIndexOutOfBoundsException(); + } + String type = parser.getAttributeType(elementName, getQName(index)); + return (type != null); + } - for (int i = 0; i < length; i++) - { - if (getQName(i).equals(xmlName)) - { - return i; - } - } - return -1; - } + /** @return false unless the attribute was declared in the DTD. + * @throws java.lang.IllegalArgumentException + * When the supplied names do not identify an attribute. + */ + public boolean isDeclared(String qName) + { + int index = getIndex(qName); + if (index < 0) + { + throw new IllegalArgumentException(); + } + String type = parser.getAttributeType(elementName, qName); + return (type != null); + } + /** @return false unless the attribute was declared in the DTD. + * @throws java.lang.IllegalArgumentException + * When the supplied names do not identify an attribute. + */ + public boolean isDeclared(String uri, String localName) + { + int index = getIndex(uri, localName); + return isDeclared(index); + } - /** - * <b>SAX2 Attributes</b> method (don't invoke on parser); - */ - public String getType (String uri, String local) - { - int index = getIndex(uri, local); + /** + * <b>SAX-ext Attributes2</b> method (don't invoke on parser); + */ + public boolean isSpecified(int index) + { + return ((Attribute) attributesList.get(index)).specified; + } - if (index < 0) - { - return null; - } - return getType(index); - } + /** + * <b>SAX-ext Attributes2</b> method (don't invoke on parser); + */ + public boolean isSpecified(String uri, String local) + { + int index = getIndex (uri, local); + return isSpecified(index); + } + /** + * <b>SAX-ext Attributes2</b> method (don't invoke on parser); + */ + public boolean isSpecified(String xmlName) + { + int index = getIndex (xmlName); + return isSpecified(index); + } - /** - * <b>SAX1 AttributeList, SAX2 Attributes</b> method - * (don't invoke on parser); - */ - public String getType (String xmlName) - { - int index = getIndex(xmlName); + // + // Implementation of org.xml.sax.Locator. + // - if (index < 0) - { - return null; - } - return getType(index); - } + /** + * <b>SAX Locator</b> method (don't invoke on parser); + */ + public String getPublicId() + { + return null; // FIXME track public IDs too + } + /** + * <b>SAX Locator</b> method (don't invoke on parser); + */ + public String getSystemId() + { + if (entityStack.empty()) + { + return null; + } + else + { + return (String) entityStack.peek(); + } + } - /** - * <b>SAX Attributes</b> method (don't invoke on parser); - */ - public String getValue (String uri, String local) - { - int index = getIndex(uri, local); + /** + * <b>SAX Locator</b> method (don't invoke on parser); + */ + public int getLineNumber() + { + return parser.getLineNumber(); + } - if (index < 0) - { - return null; - } - return getValue(index); - } + /** + * <b>SAX Locator</b> method (don't invoke on parser); + */ + public int getColumnNumber() + { + return parser.getColumnNumber(); + } + // adapter between SAX2 content handler and SAX1 document handler callbacks + private static class Adapter + implements ContentHandler + { + + private DocumentHandler docHandler; - /** - * <b>SAX1 AttributeList, SAX2 Attributes</b> method - * (don't invoke on parser); - */ - public String getValue (String xmlName) + Adapter(DocumentHandler dh) { - int index = getIndex(xmlName); - - if (index < 0) - { - return null; - } - return getValue(index); + docHandler = dh; } - - // - // Implementation of org.xml.sax.ext.Attributes2 - // - - - /** @return false unless the attribute was declared in the DTD. - * @throws java.lang.ArrayIndexOutOfBoundsException - * When the supplied index does not identify an attribute. - */ - public boolean isDeclared (int index) + public void setDocumentLocator(Locator l) { - if (index < 0 || index >= attributeCount) - throw new ArrayIndexOutOfBoundsException (); - String type = parser.getAttributeType(elementName, getQName(index)); - return (type != null); + docHandler.setDocumentLocator(l); } - - /** @return false unless the attribute was declared in the DTD. - * @throws java.lang.IllegalArgumentException - * When the supplied names do not identify an attribute. - */ - public boolean isDeclared (String qName) + + public void startDocument() + throws SAXException { - int index = getIndex (qName); - if (index < 0) - throw new IllegalArgumentException (); - String type = parser.getAttributeType(elementName, qName); - return (type != null); + docHandler.startDocument(); } - - /** @return false unless the attribute was declared in the DTD. - * @throws java.lang.IllegalArgumentException - * When the supplied names do not identify an attribute. - */ - public boolean isDeclared (String uri, String localName) + + public void processingInstruction(String target, String data) + throws SAXException { - int index = getIndex (uri, localName); - return isDeclared(index); + docHandler.processingInstruction(target, data); } - - - /** - * <b>SAX-ext Attributes2</b> method (don't invoke on parser); - */ - public boolean isSpecified (int index) + + public void startPrefixMapping(String prefix, String uri) { - return ((Attribute) attributesList.get(index)).specified; + /* ignored */ } - /** - * <b>SAX-ext Attributes2</b> method (don't invoke on parser); - */ - public boolean isSpecified (String uri, String local) + public void startElement(String namespace, + String local, + String name, + Attributes attrs) + throws SAXException { - int index = getIndex (uri, local); - return isSpecified(index); + docHandler.startElement(name, (AttributeList) attrs); } - /** - * <b>SAX-ext Attributes2</b> method (don't invoke on parser); - */ - public boolean isSpecified (String xmlName) + public void characters(char[] buf, int offset, int len) + throws SAXException { - int index = getIndex (xmlName); - return isSpecified(index); + docHandler.characters(buf, offset, len); } - - // - // Implementation of org.xml.sax.Locator. - // - - /** - * <b>SAX Locator</b> method (don't invoke on parser); - */ - public String getPublicId () + public void ignorableWhitespace(char[] buf, int offset, int len) + throws SAXException { - return null; // FIXME track public IDs too + docHandler.ignorableWhitespace(buf, offset, len); } - /** - * <b>SAX Locator</b> method (don't invoke on parser); - */ - public String getSystemId () + public void skippedEntity(String name) { - if (entityStack.empty ()) - return null; - else - return (String) entityStack.peek (); + /* ignored */ } - /** - * <b>SAX Locator</b> method (don't invoke on parser); - */ - public int getLineNumber () + public void endElement(String u, String l, String name) + throws SAXException { - return parser.getLineNumber (); + docHandler.endElement(name); } - /** - * <b>SAX Locator</b> method (don't invoke on parser); - */ - public int getColumnNumber () + public void endPrefixMapping(String prefix) { - return parser.getColumnNumber (); + /* ignored */ } - // adapter between SAX2 content handler and SAX1 document handler callbacks - private static class Adapter implements ContentHandler + public void endDocument() + throws SAXException { - private DocumentHandler docHandler; - - Adapter (DocumentHandler dh) - { docHandler = dh; } - - - public void setDocumentLocator (Locator l) - { docHandler.setDocumentLocator (l); } - - public void startDocument () throws SAXException - { docHandler.startDocument (); } - - public void processingInstruction (String target, String data) - throws SAXException - { docHandler.processingInstruction (target, data); } - - public void startPrefixMapping (String prefix, String uri) - { /* ignored */ } - - public void startElement ( - String namespace, - String local, - String name, - Attributes attrs - ) throws SAXException - { docHandler.startElement (name, (AttributeList) attrs); } - - public void characters (char buf [], int offset, int len) - throws SAXException - { docHandler.characters (buf, offset, len); } - - public void ignorableWhitespace (char buf [], int offset, int len) - throws SAXException - { docHandler.ignorableWhitespace (buf, offset, len); } - - public void skippedEntity (String name) - { /* ignored */ } - - public void endElement (String u, String l, String name) - throws SAXException - { docHandler.endElement (name); } - - public void endPrefixMapping (String prefix) - { /* ignored */ } - - public void endDocument () throws SAXException - { docHandler.endDocument (); } + docHandler.endDocument(); } -} - -class Attribute -{ + } + private static class Attribute + { + String name; String value; String nameSpace; String localName; boolean specified; - + Attribute(String name, String value, boolean specified) { - this.name = name; - this.value = value; - this.nameSpace = ""; - this.specified = specified; + this.name = name; + this.value = value; + this.nameSpace = ""; + this.specified = specified; } -} + + } +} diff --git a/gnu/xml/aelfred2/XmlParser.java b/gnu/xml/aelfred2/XmlParser.java index f4abf2229..b29849217 100644 --- a/gnu/xml/aelfred2/XmlParser.java +++ b/gnu/xml/aelfred2/XmlParser.java @@ -53,6 +53,8 @@ Partly derived from code which carried the following notice: package gnu.xml.aelfred2; +import gnu.java.security.action.GetPropertyAction; + import java.io.BufferedInputStream; import java.io.CharConversionException; import java.io.EOFException; @@ -63,12 +65,11 @@ import java.io.Reader; import java.io.UnsupportedEncodingException; import java.net.URL; import java.net.URLConnection; +import java.security.AccessController; -// maintaining 1.1 compatibility for now ... -// Iterator and Hashmap ought to be faster -import java.util.Enumeration; -import java.util.Hashtable; -import java.util.Stack; +import java.util.Iterator; +import java.util.HashMap; +import java.util.LinkedList; import org.xml.sax.InputSource; import org.xml.sax.SAXException; @@ -86,1511 +87,1838 @@ import org.xml.sax.SAXException; */ final class XmlParser { - // avoid slow per-character readCh() - private final static boolean USE_CHEATS = true; - - - ////////////////////////////////////////////////////////////////////// - // Constructors. - //////////////////////////////////////////////////////////////////////// - - - /** - * Construct a new parser with no associated handler. - * @see #setHandler - * @see #parse - */ - // package private - XmlParser () - { - } + // avoid slow per-character readCh() + private final static boolean USE_CHEATS = true; - /** - * Set the handler that will receive parsing events. - * @param handler The handler to receive callback events. - * @see #parse - */ - // package private - void setHandler (SAXDriver handler) - { - this.handler = handler; - } - - - /** - * Parse an XML document from the character stream, byte stream, or URI - * that you provide (in that order of preference). Any URI that you - * supply will become the base URI for resolving relative URI, and may - * be used to acquire a reader or byte stream. - * - * <p> Only one thread at a time may use this parser; since it is - * private to this package, post-parse cleanup is done by the caller, - * which MUST NOT REUSE the parser (just null it). - * - * @param systemId Absolute URI of the document; should never be null, - * but may be so iff a reader <em>or</em> a stream is provided. - * @param publicId The public identifier of the document, or null. - * @param reader A character stream; must be null if stream isn't. - * @param stream A byte input stream; must be null if reader isn't. - * @param encoding The suggested encoding, or null if unknown. - * @exception java.lang.Exception Basically SAXException or IOException - */ - // package private - void doParse ( - String systemId, - String publicId, - Reader reader, - InputStream stream, - String encoding - ) throws Exception - { - if (handler == null) - throw new IllegalStateException ("no callback handler"); - - initializeVariables (); - - // predeclare the built-in entities here (replacement texts) - // we don't need to intern(), since we're guaranteed literals - // are always (globally) interned. - setInternalEntity ("amp", "&"); - setInternalEntity ("lt", "<"); - setInternalEntity ("gt", ">"); - setInternalEntity ("apos", "'"); - setInternalEntity ("quot", """); - - try { - // pushURL first to ensure locator is correct in startDocument - // ... it might report an IO or encoding exception. - handler.startDocument (); - pushURL (false, "[document]", - // default baseURI: null - new String [] { publicId, systemId, null}, - reader, stream, encoding, false); - - parseDocument (); - } catch (EOFException e){ - //empty input - error("empty document, with no root element."); - }finally { - if (reader != null) - try { reader.close (); - } catch (IOException e) { /* ignore */ } - if (stream != null) - try { stream.close (); - } catch (IOException e) { /* ignore */ } - if (is != null) - try { is.close (); - } catch (IOException e) { /* ignore */ } - if (reader != null) - try { - reader.close (); - } catch (IOException e) { /* ignore */ - } - scratch = null; - } - } - - - //////////////////////////////////////////////////////////////////////// - // Constants. - //////////////////////////////////////////////////////////////////////// - - // - // Constants for element content type. - // - - /** - * Constant: an element has not been declared. - * @see #getElementContentType - */ - public final static int CONTENT_UNDECLARED = 0; - - /** - * Constant: the element has a content model of ANY. - * @see #getElementContentType - */ - public final static int CONTENT_ANY = 1; - - /** - * Constant: the element has declared content of EMPTY. - * @see #getElementContentType - */ - public final static int CONTENT_EMPTY = 2; - - /** - * Constant: the element has mixed content. - * @see #getElementContentType - */ - public final static int CONTENT_MIXED = 3; - - /** - * Constant: the element has element content. - * @see #getElementContentType - */ - public final static int CONTENT_ELEMENTS = 4; - - - // - // Constants for the entity type. - // - - /** - * Constant: the entity has not been declared. - * @see #getEntityType - */ - public final static int ENTITY_UNDECLARED = 0; - - /** - * Constant: the entity is internal. - * @see #getEntityType - */ - public final static int ENTITY_INTERNAL = 1; - - /** - * Constant: the entity is external, non-parsable data. - * @see #getEntityType - */ - public final static int ENTITY_NDATA = 2; - - /** - * Constant: the entity is external XML data. - * @see #getEntityType - */ - public final static int ENTITY_TEXT = 3; - - - // - // Attribute type constants are interned literal strings. - // - - // - // Constants for supported encodings. "external" is just a flag. - // - private final static int ENCODING_EXTERNAL = 0; - private final static int ENCODING_UTF_8 = 1; - private final static int ENCODING_ISO_8859_1 = 2; - private final static int ENCODING_UCS_2_12 = 3; - private final static int ENCODING_UCS_2_21 = 4; - private final static int ENCODING_UCS_4_1234 = 5; - private final static int ENCODING_UCS_4_4321 = 6; - private final static int ENCODING_UCS_4_2143 = 7; - private final static int ENCODING_UCS_4_3412 = 8; - private final static int ENCODING_ASCII = 9; - - - // - // Constants for attribute default value. - // - - /** - * Constant: the attribute is not declared. - * @see #getAttributeDefaultValueType - */ - public final static int ATTRIBUTE_DEFAULT_UNDECLARED = 30; - - /** - * Constant: the attribute has a literal default value specified. - * @see #getAttributeDefaultValueType - * @see #getAttributeDefaultValue - */ - public final static int ATTRIBUTE_DEFAULT_SPECIFIED = 31; - - /** - * Constant: the attribute was declared #IMPLIED. - * @see #getAttributeDefaultValueType - */ - public final static int ATTRIBUTE_DEFAULT_IMPLIED = 32; - - /** - * Constant: the attribute was declared #REQUIRED. - * @see #getAttributeDefaultValueType - */ - public final static int ATTRIBUTE_DEFAULT_REQUIRED = 33; - - /** - * Constant: the attribute was declared #FIXED. - * @see #getAttributeDefaultValueType - * @see #getAttributeDefaultValue - */ - public final static int ATTRIBUTE_DEFAULT_FIXED = 34; - - - // - // Constants for input. - // - private final static int INPUT_NONE = 0; - private final static int INPUT_INTERNAL = 1; - private final static int INPUT_STREAM = 3; - private final static int INPUT_READER = 5; - - - // - // Flags for reading literals. - // - // expand general entity refs (attribute values in dtd and content) - private final static int LIT_ENTITY_REF = 2; - // normalize this value (space chars) (attributes, public ids) - private final static int LIT_NORMALIZE = 4; - // literal is an attribute value - private final static int LIT_ATTRIBUTE = 8; - // don't expand parameter entities - private final static int LIT_DISABLE_PE = 16; - // don't expand [or parse] character refs - private final static int LIT_DISABLE_CREF = 32; - // don't parse general entity refs - private final static int LIT_DISABLE_EREF = 64; - // literal is a public ID value - private final static int LIT_PUBID = 256; - - - // - // Flags affecting PE handling in DTDs (if expandPE is true). - // PEs expand with space padding, except inside literals. - // - private final static int CONTEXT_NORMAL = 0; - private final static int CONTEXT_LITERAL = 1; + //////////////////////////////////////////////////////////////////////// + // Constants. + //////////////////////////////////////////////////////////////////////// + + // + // Constants for element content type. + // + + /** + * Constant: an element has not been declared. + * @see #getElementContentType + */ + public final static int CONTENT_UNDECLARED = 0; + + /** + * Constant: the element has a content model of ANY. + * @see #getElementContentType + */ + public final static int CONTENT_ANY = 1; + + /** + * Constant: the element has declared content of EMPTY. + * @see #getElementContentType + */ + public final static int CONTENT_EMPTY = 2; + + /** + * Constant: the element has mixed content. + * @see #getElementContentType + */ + public final static int CONTENT_MIXED = 3; + + /** + * Constant: the element has element content. + * @see #getElementContentType + */ + public final static int CONTENT_ELEMENTS = 4; + + + // + // Constants for the entity type. + // + + /** + * Constant: the entity has not been declared. + * @see #getEntityType + */ + public final static int ENTITY_UNDECLARED = 0; + + /** + * Constant: the entity is internal. + * @see #getEntityType + */ + public final static int ENTITY_INTERNAL = 1; + + /** + * Constant: the entity is external, non-parsable data. + * @see #getEntityType + */ + public final static int ENTITY_NDATA = 2; + + /** + * Constant: the entity is external XML data. + * @see #getEntityType + */ + public final static int ENTITY_TEXT = 3; + + // + // Attribute type constants are interned literal strings. + // + + // + // Constants for supported encodings. "external" is just a flag. + // + private final static int ENCODING_EXTERNAL = 0; + private final static int ENCODING_UTF_8 = 1; + private final static int ENCODING_ISO_8859_1 = 2; + private final static int ENCODING_UCS_2_12 = 3; + private final static int ENCODING_UCS_2_21 = 4; + private final static int ENCODING_UCS_4_1234 = 5; + private final static int ENCODING_UCS_4_4321 = 6; + private final static int ENCODING_UCS_4_2143 = 7; + private final static int ENCODING_UCS_4_3412 = 8; + private final static int ENCODING_ASCII = 9; + + // + // Constants for attribute default value. + // + + /** + * Constant: the attribute is not declared. + * @see #getAttributeDefaultValueType + */ + public final static int ATTRIBUTE_DEFAULT_UNDECLARED = 30; + + /** + * Constant: the attribute has a literal default value specified. + * @see #getAttributeDefaultValueType + * @see #getAttributeDefaultValue + */ + public final static int ATTRIBUTE_DEFAULT_SPECIFIED = 31; + + /** + * Constant: the attribute was declared #IMPLIED. + * @see #getAttributeDefaultValueType + */ + public final static int ATTRIBUTE_DEFAULT_IMPLIED = 32; + + /** + * Constant: the attribute was declared #REQUIRED. + * @see #getAttributeDefaultValueType + */ + public final static int ATTRIBUTE_DEFAULT_REQUIRED = 33; + + /** + * Constant: the attribute was declared #FIXED. + * @see #getAttributeDefaultValueType + * @see #getAttributeDefaultValue + */ + public final static int ATTRIBUTE_DEFAULT_FIXED = 34; + + // + // Constants for input. + // + private final static int INPUT_NONE = 0; + private final static int INPUT_INTERNAL = 1; + private final static int INPUT_STREAM = 3; + private final static int INPUT_READER = 5; + + // + // Flags for reading literals. + // + // expand general entity refs (attribute values in dtd and content) + private final static int LIT_ENTITY_REF = 2; + // normalize this value (space chars) (attributes, public ids) + private final static int LIT_NORMALIZE = 4; + // literal is an attribute value + private final static int LIT_ATTRIBUTE = 8; + // don't expand parameter entities + private final static int LIT_DISABLE_PE = 16; + // don't expand [or parse] character refs + private final static int LIT_DISABLE_CREF = 32; + // don't parse general entity refs + private final static int LIT_DISABLE_EREF = 64; + // literal is a public ID value + private final static int LIT_PUBID = 256; + + // + // Flags affecting PE handling in DTDs (if expandPE is true). + // PEs expand with space padding, except inside literals. + // + private final static int CONTEXT_NORMAL = 0; + private final static int CONTEXT_LITERAL = 1; + + // Emit warnings for relative URIs with no base URI. + static boolean uriWarnings; + static + { + String key = "gnu.xml.aelfred2.XmlParser.uriWarnings"; + GetPropertyAction a = new GetPropertyAction(key); + uriWarnings = "true".equals(AccessController.doPrivileged(a)); + } + + // + // The current XML handler interface. + // + private SAXDriver handler; + + // + // I/O information. + // + private Reader reader; // current reader + private InputStream is; // current input stream + private int line; // current line number + private int column; // current column number + private int sourceType; // type of input source + private LinkedList inputStack; // stack of input soruces + private URLConnection externalEntity; // current external entity + private int encoding; // current character encoding + private int currentByteCount; // bytes read from current source + private InputSource scratch; // temporary + + // + // Buffers for decoded but unparsed character input. + // + private char[] readBuffer; + private int readBufferPos; + private int readBufferLength; + private int readBufferOverflow; // overflow from last data chunk. + + // + // Buffer for undecoded raw byte input. + // + private final static int READ_BUFFER_MAX = 16384; + private byte[] rawReadBuffer; + + + // + // Buffer for attribute values, char refs, DTD stuff. + // + private static int DATA_BUFFER_INITIAL = 4096; + private char[] dataBuffer; + private int dataBufferPos; + + // + // Buffer for parsed names. + // + private static int NAME_BUFFER_INITIAL = 1024; + private char[] nameBuffer; + private int nameBufferPos; + + // + // Save any standalone flag + // + private boolean docIsStandalone; + + // + // Hashtables for DTD information on elements, entities, and notations. + // Populated until we start ignoring decls (because of skipping a PE) + // + private HashMap elementInfo; + private HashMap entityInfo; + private HashMap notationInfo; + private boolean skippedPE; + + // + // Element type currently in force. + // + private String currentElement; + private int currentElementContent; + + // + // Stack of entity names, to detect recursion. + // + private LinkedList entityStack; + + // + // PE expansion is enabled in most chunks of the DTD, not all. + // When it's enabled, literals are treated differently. + // + private boolean inLiteral; + private boolean expandPE; + private boolean peIsError; + + // + // can't report entity expansion inside two constructs: + // - attribute expansions (internal entities only) + // - markup declarations (parameter entities only) + // + private boolean doReport; + + // + // Symbol table, for caching interned names. + // + // These show up wherever XML names or nmtokens are used: naming elements, + // attributes, PIs, notations, entities, and enumerated attribute values. + // + // NOTE: This hashtable doesn't grow. The default size is intended to be + // rather large for most documents. Example: one snapshot of the DocBook + // XML 4.1 DTD used only about 350 such names. As a rule, only pathological + // documents (ones that don't reuse names) should ever see much collision. + // + // Be sure that SYMBOL_TABLE_LENGTH always stays prime, for best hashing. + // "2039" keeps the hash table size at about two memory pages on typical + // 32 bit hardware. + // + private final static int SYMBOL_TABLE_LENGTH = 2039; + + private Object[][] symbolTable; + + // + // Hash table of attributes found in current start tag. + // + private String[] tagAttributes; + private int tagAttributePos; + + // + // Utility flag: have we noticed a CR while reading the last + // data chunk? If so, we will have to go back and normalise + // CR or CR/LF line ends. + // + private boolean sawCR; + + // + // Utility flag: are we in CDATA? If so, whitespace isn't ignorable. + // + private boolean inCDATA; + + // + // Xml version. + // + private static final int XML_10 = 0; + private static final int XML_11 = 1; + private int xmlVersion = XML_10; + + ////////////////////////////////////////////////////////////////////// + // Constructors. + //////////////////////////////////////////////////////////////////////// + + /** + * Construct a new parser with no associated handler. + * @see #setHandler + * @see #parse + */ + // package private + XmlParser() + { + } + /** + * Set the handler that will receive parsing events. + * @param handler The handler to receive callback events. + * @see #parse + */ + // package private + void setHandler(SAXDriver handler) + { + this.handler = handler; + } - ////////////////////////////////////////////////////////////////////// - // Error reporting. - ////////////////////////////////////////////////////////////////////// + /** + * Parse an XML document from the character stream, byte stream, or URI + * that you provide (in that order of preference). Any URI that you + * supply will become the base URI for resolving relative URI, and may + * be used to acquire a reader or byte stream. + * + * <p> Only one thread at a time may use this parser; since it is + * private to this package, post-parse cleanup is done by the caller, + * which MUST NOT REUSE the parser (just null it). + * + * @param systemId Absolute URI of the document; should never be null, + * but may be so iff a reader <em>or</em> a stream is provided. + * @param publicId The public identifier of the document, or null. + * @param reader A character stream; must be null if stream isn't. + * @param stream A byte input stream; must be null if reader isn't. + * @param encoding The suggested encoding, or null if unknown. + * @exception java.lang.Exception Basically SAXException or IOException + */ + // package private + void doParse(String systemId, String publicId, Reader reader, + InputStream stream, String encoding) + throws Exception + { + if (handler == null) + { + throw new IllegalStateException("no callback handler"); + } + initializeVariables(); + + // predeclare the built-in entities here (replacement texts) + // we don't need to intern(), since we're guaranteed literals + // are always (globally) interned. + setInternalEntity("amp", "&"); + setInternalEntity("lt", "<"); + setInternalEntity("gt", ">"); + setInternalEntity("apos", "'"); + setInternalEntity("quot", """); + + try + { + // pushURL first to ensure locator is correct in startDocument + // ... it might report an IO or encoding exception. + handler.startDocument(); + pushURL(false, "[document]", + // default baseURI: null + new ExternalIdentifiers(publicId, systemId, null), + reader, stream, encoding, false); + + parseDocument(); + } + catch (EOFException e) + { + //empty input + error("empty document, with no root element."); + } + finally + { + if (reader != null) + { + try + { + reader.close(); + } + catch (IOException e) + { + /* ignore */ + } + } + if (stream != null) + { + try + { + stream.close(); + } + catch (IOException e) + { + /* ignore */ + } + } + if (is != null) + { + try + { + is.close(); + } + catch (IOException e) + { + /* ignore */ + } + } + scratch = null; + } + } - /** - * Report an error. - * @param message The error message. - * @param textFound The text that caused the error (or null). - * @see SAXDriver#error - * @see #line - */ - private void error (String message, String textFound, String textExpected) + ////////////////////////////////////////////////////////////////////// + // Error reporting. + ////////////////////////////////////////////////////////////////////// + + /** + * Report an error. + * @param message The error message. + * @param textFound The text that caused the error (or null). + * @see SAXDriver#error + * @see #line + */ + private void error(String message, String textFound, String textExpected) throws SAXException - { - if (textFound != null) { - message = message + " (found \"" + textFound + "\")"; - } - if (textExpected != null) { - message = message + " (expected \"" + textExpected + "\")"; - } - handler.fatal (message); - - // "can't happen" - throw new SAXException (message); - } - + { + if (textFound != null) + { + message = message + " (found \"" + textFound + "\")"; + } + if (textExpected != null) + { + message = message + " (expected \"" + textExpected + "\")"; + } + handler.fatal(message); + + // "can't happen" + throw new SAXException(message); + } - /** - * Report a serious error. - * @param message The error message. - * @param textFound The text that caused the error (or null). - */ - private void error (String message, char textFound, String textExpected) + /** + * Report a serious error. + * @param message The error message. + * @param textFound The text that caused the error (or null). + */ + private void error(String message, char textFound, String textExpected) throws SAXException - { - error (message, new Character (textFound).toString (), textExpected); - } + { + error(message, new Character(textFound).toString(), textExpected); + } - /** Report typical case fatal errors. */ - private void error (String message) + /** + * Report typical case fatal errors. + */ + private void error(String message) throws SAXException - { - handler.fatal (message); - } - - - ////////////////////////////////////////////////////////////////////// - // Major syntactic productions. - ////////////////////////////////////////////////////////////////////// + { + handler.fatal(message); + } + ////////////////////////////////////////////////////////////////////// + // Major syntactic productions. + ////////////////////////////////////////////////////////////////////// - /** - * Parse an XML document. - * <pre> - * [1] document ::= prolog element Misc* - * </pre> - * <p>This is the top-level parsing function for a single XML - * document. As a minimum, a well-formed document must have - * a document element, and a valid document must have a prolog - * (one with doctype) as well. - */ - private void parseDocument () + /** + * Parse an XML document. + * <pre> + * [1] document ::= prolog element Misc* + * </pre> + * <p>This is the top-level parsing function for a single XML + * document. As a minimum, a well-formed document must have + * a document element, and a valid document must have a prolog + * (one with doctype) as well. + */ + private void parseDocument() throws Exception - { - try { // added by MHK - boolean sawDTD = parseProlog (); - require ('<'); - parseElement (!sawDTD); - } catch (EOFException ee) { // added by MHK - error("premature end of file", "[EOF]", null); - } - - try { - parseMisc (); //skip all white, PIs, and comments - char c = readCh (); //if this doesn't throw an exception... - error ("unexpected characters after document end", c, null); - } catch (EOFException e) { - return; - } - } - - static final char startDelimComment [] = { '<', '!', '-', '-' }; - static final char endDelimComment [] = { '-', '-' }; + { + try + { // added by MHK + boolean sawDTD = parseProlog(); + require('<'); + parseElement(!sawDTD); + } + catch (EOFException ee) + { // added by MHK + error("premature end of file", "[EOF]", null); + } + + try + { + parseMisc(); //skip all white, PIs, and comments + char c = readCh(); //if this doesn't throw an exception... + error("unexpected characters after document end", c, null); + } + catch (EOFException e) + { + return; + } + } + + static final char[] startDelimComment = { '<', '!', '-', '-' }; + static final char[] endDelimComment = { '-', '-' }; - /** - * Skip a comment. - * <pre> - * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* "-->" - * </pre> - * <p> (The <code><!--</code> has already been read.) - */ - private void parseComment () + /** + * Skip a comment. + * <pre> + * [15] Comment ::= '<!--' ((Char - '-') | ('-' (Char - '-')))* "-->" + * </pre> + * <p> (The <code><!--</code> has already been read.) + */ + private void parseComment() throws Exception - { - char c; - boolean saved = expandPE; - - expandPE = false; - parseUntil (endDelimComment); - require ('>'); - expandPE = saved; - handler.comment (dataBuffer, 0, dataBufferPos); - dataBufferPos = 0; - } + { + char c; + boolean saved = expandPE; + + expandPE = false; + parseUntil(endDelimComment); + require('>'); + expandPE = saved; + handler.comment(dataBuffer, 0, dataBufferPos); + dataBufferPos = 0; + } + + static final char[] startDelimPI = { '<', '?' }; + static final char[] endDelimPI = { '?', '>' }; - static final char startDelimPI [] = { '<', '?' }; - static final char endDelimPI [] = { '?', '>' }; - - /** - * Parse a processing instruction and do a call-back. - * <pre> - * [16] PI ::= '<?' PITarget - * (S (Char* - (Char* '?>' Char*)))? - * '?>' - * [17] PITarget ::= Name - ( ('X'|'x') ('M'|m') ('L'|l') ) - * </pre> - * <p> (The <code><?</code> has already been read.) - */ - private void parsePI () + /** + * Parse a processing instruction and do a call-back. + * <pre> + * [16] PI ::= '<?' PITarget + * (S (Char* - (Char* '?>' Char*)))? + * '?>' + * [17] PITarget ::= Name - ( ('X'|'x') ('M'|m') ('L'|l') ) + * </pre> + * <p> (The <code><?</code> has already been read.) + */ + private void parsePI() throws SAXException, IOException - { - String name; - boolean saved = expandPE; - - expandPE = false; - name = readNmtoken (true); - //NE08 - if (name.indexOf(':') >= 0) - error ("Illegal character(':') in processing instruction name ", name, null); - if ("xml".equalsIgnoreCase (name)) - error ("Illegal processing instruction target", name, null); - if (!tryRead (endDelimPI)) { - requireWhitespace (); - parseUntil (endDelimPI); - } - expandPE = saved; - handler.processingInstruction (name, dataBufferToString ()); - } - - - static final char endDelimCDATA [] = { ']', ']', '>' }; + { + String name; + boolean saved = expandPE; + + expandPE = false; + name = readNmtoken(true); + //NE08 + if (name.indexOf(':') >= 0) + { + error("Illegal character(':') in processing instruction name ", + name, null); + } + if ("xml".equalsIgnoreCase(name)) + { + error("Illegal processing instruction target", name, null); + } + if (!tryRead(endDelimPI)) + { + requireWhitespace(); + parseUntil(endDelimPI); + } + expandPE = saved; + handler.processingInstruction(name, dataBufferToString()); + } + + static final char[] endDelimCDATA = { ']', ']', '>' }; - private boolean isDirtyCurrentElement; + private boolean isDirtyCurrentElement; - /** - * Parse a CDATA section. - * <pre> - * [18] CDSect ::= CDStart CData CDEnd - * [19] CDStart ::= '<![CDATA[' - * [20] CData ::= (Char* - (Char* ']]>' Char*)) - * [21] CDEnd ::= ']]>' - * </pre> - * <p> (The '<![CDATA[' has already been read.) - */ - private void parseCDSect () + /** + * Parse a CDATA section. + * <pre> + * [18] CDSect ::= CDStart CData CDEnd + * [19] CDStart ::= '<![CDATA[' + * [20] CData ::= (Char* - (Char* ']]>' Char*)) + * [21] CDEnd ::= ']]>' + * </pre> + * <p> (The '<![CDATA[' has already been read.) + */ + private void parseCDSect() throws Exception - { - parseUntil (endDelimCDATA); - dataBufferFlush (); - } - + { + parseUntil(endDelimCDATA); + dataBufferFlush(); + } - /** - * Parse the prolog of an XML document. - * <pre> - * [22] prolog ::= XMLDecl? Misc* (Doctypedecl Misc*)? - * </pre> - * <p>We do not look for the XML declaration here, because it was - * handled by pushURL (). - * @see pushURL - * @return true if a DTD was read. - */ - private boolean parseProlog () + /** + * Parse the prolog of an XML document. + * <pre> + * [22] prolog ::= XMLDecl? Misc* (Doctypedecl Misc*)? + * </pre> + * <p>We do not look for the XML declaration here, because it was + * handled by pushURL (). + * @see pushURL + * @return true if a DTD was read. + */ + private boolean parseProlog() throws Exception - { - parseMisc (); - - if (tryRead ("<!DOCTYPE")) { - parseDoctypedecl (); - parseMisc (); - return true; - } - return false; - } + { + parseMisc(); - private void checkLegalVersion (String version) - throws SAXException - { - int len = version.length (); - for (int i = 0; i < len; i++) { - char c = version.charAt (i); - if ('0' <= c && c <= '9') - continue; - if (c == '_' || c == '.' || c == ':' || c == '-') - continue; - if ('a' <= c && c <= 'z') - continue; - if ('A' <= c && c <= 'Z') - continue; - error ("illegal character in version", version, "1.0"); - } - } + if (tryRead("<!DOCTYPE")) + { + parseDoctypedecl(); + parseMisc(); + return true; + } + return false; + } + private void checkLegalVersion(String version) + throws SAXException + { + int len = version.length(); + for (int i = 0; i < len; i++) + { + char c = version.charAt(i); + if ('0' <= c && c <= '9') + { + continue; + } + if (c == '_' || c == '.' || c == ':' || c == '-') + { + continue; + } + if ('a' <= c && c <= 'z') + { + continue; + } + if ('A' <= c && c <= 'Z') + { + continue; + } + error ("illegal character in version", version, "1.0"); + } + } - /** - * Parse the XML declaration. - * <pre> - * [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' - * [24] VersionInfo ::= S 'version' Eq - * ("'" VersionNum "'" | '"' VersionNum '"' ) - * [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')* - * [32] SDDecl ::= S 'standalone' Eq - * ( "'"" ('yes' | 'no') "'"" | '"' ("yes" | "no") '"' ) - * [80] EncodingDecl ::= S 'encoding' Eq - * ( "'" EncName "'" | "'" EncName "'" ) - * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* - * </pre> - * <p> (The <code><?xml</code> and whitespace have already been read.) - * @return the encoding in the declaration, uppercased; or null - * @see #parseTextDecl - * @see #setupDecoding - */ - private String parseXMLDecl (boolean ignoreEncoding) + /** + * Parse the XML declaration. + * <pre> + * [23] XMLDecl ::= '<?xml' VersionInfo EncodingDecl? SDDecl? S? '?>' + * [24] VersionInfo ::= S 'version' Eq + * ("'" VersionNum "'" | '"' VersionNum '"' ) + * [26] VersionNum ::= ([a-zA-Z0-9_.:] | '-')* + * [32] SDDecl ::= S 'standalone' Eq + * ( "'"" ('yes' | 'no') "'"" | '"' ("yes" | "no") '"' ) + * [80] EncodingDecl ::= S 'encoding' Eq + * ( "'" EncName "'" | "'" EncName "'" ) + * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* + * </pre> + * <p> (The <code><?xml</code> and whitespace have already been read.) + * @return the encoding in the declaration, uppercased; or null + * @see #parseTextDecl + * @see #setupDecoding + */ + private String parseXMLDecl(boolean ignoreEncoding) throws SAXException, IOException - { - String version; - String encodingName = null; - String standalone = null; - int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; - String inputEncoding = null; + { + String version; + String encodingName = null; + String standalone = null; + int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; + String inputEncoding = null; - switch (this.encoding) + switch (this.encoding) + { + case ENCODING_EXTERNAL: + case ENCODING_UTF_8: + inputEncoding = "UTF-8"; + break; + case ENCODING_ISO_8859_1: + inputEncoding = "ISO-8859-1"; + break; + case ENCODING_UCS_2_12: + inputEncoding = "UTF-16BE"; + break; + case ENCODING_UCS_2_21: + inputEncoding = "UTF-16LE"; + break; + } + + // Read the version. + require("version"); + parseEq(); + checkLegalVersion(version = readLiteral(flags)); + if (!version.equals("1.0")) + { + if (version.equals("1.1")) { - case ENCODING_EXTERNAL: - case ENCODING_UTF_8: - inputEncoding = "UTF-8"; - break; - case ENCODING_ISO_8859_1: - inputEncoding = "ISO-8859-1"; - break; - case ENCODING_UCS_2_12: - inputEncoding = "UTF-16BE"; - break; - case ENCODING_UCS_2_21: - inputEncoding = "UTF-16LE"; - break; + handler.warn("expected XML version 1.0, not: " + version); + xmlVersion = XML_11; + } + else + { + error("illegal XML version", version, "1.0 or 1.1"); } + } + else + { + xmlVersion = XML_10; + } + // Try reading an encoding declaration. + boolean white = tryWhitespace(); + + if (tryRead("encoding")) + { + if (!white) + { + error("whitespace required before 'encoding='"); + } + parseEq(); + encodingName = readLiteral(flags); + if (!ignoreEncoding) + { + setupDecoding(encodingName); + } + } + + // Try reading a standalone declaration + if (encodingName != null) + { + white = tryWhitespace(); + } + if (tryRead("standalone")) + { + if (!white) + { + error("whitespace required before 'standalone='"); + } + parseEq(); + standalone = readLiteral(flags); + if ("yes".equals(standalone)) + { + docIsStandalone = true; + } + else if (!"no".equals(standalone)) + { + error("standalone flag must be 'yes' or 'no'"); + } + } - // Read the version. - require ("version"); - parseEq (); - checkLegalVersion (version = readLiteral (flags)); - if (!version.equals ("1.0")){ - if(version.equals ("1.1")){ - handler.warn ("expected XML version 1.0, not: " + version); - xmlVersion = XML_11; - }else { - error("illegal XML version", version, "1.0 or 1.1"); - } - } - else - xmlVersion = XML_10; - // Try reading an encoding declaration. - boolean white = tryWhitespace (); - - if (tryRead ("encoding")) { - if (!white) - error ("whitespace required before 'encoding='"); - parseEq (); - encodingName = readLiteral (flags); - if (!ignoreEncoding) - setupDecoding (encodingName); - } - - // Try reading a standalone declaration - if (encodingName != null) - white = tryWhitespace (); - if (tryRead ("standalone")) { - if (!white) - error ("whitespace required before 'standalone='"); - parseEq (); - standalone = readLiteral (flags); - if ("yes".equals (standalone)) - docIsStandalone = true; - else if (!"no".equals (standalone)) - error ("standalone flag must be 'yes' or 'no'"); - } - - skipWhitespace (); - require ("?>"); - - if (inputEncoding == null) - { - inputEncoding = encodingName; - } - handler.xmlDecl(version, encodingName, "yes".equals(standalone), - inputEncoding); - - return encodingName; - } + skipWhitespace(); + require("?>"); + if (inputEncoding == null) + { + inputEncoding = encodingName; + } + handler.xmlDecl(version, encodingName, docIsStandalone, + inputEncoding); + + return encodingName; + } - /** - * Parse a text declaration. - * <pre> - * [79] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' - * [80] EncodingDecl ::= S 'encoding' Eq - * ( '"' EncName '"' | "'" EncName "'" ) - * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* - * </pre> - * <p> (The <code><?xml</code>' and whitespace have already been read.) - * @return the encoding in the declaration, uppercased; or null - * @see #parseXMLDecl - * @see #setupDecoding - */ - private String parseTextDecl (boolean ignoreEncoding) + /** + * Parse a text declaration. + * <pre> + * [79] TextDecl ::= '<?xml' VersionInfo? EncodingDecl S? '?>' + * [80] EncodingDecl ::= S 'encoding' Eq + * ( '"' EncName '"' | "'" EncName "'" ) + * [81] EncName ::= [A-Za-z] ([A-Za-z0-9._] | '-')* + * </pre> + * <p> (The <code><?xml</code>' and whitespace have already been read.) + * @return the encoding in the declaration, uppercased; or null + * @see #parseXMLDecl + * @see #setupDecoding + */ + private String parseTextDecl(boolean ignoreEncoding) throws SAXException, IOException - { - String encodingName = null; - int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; - - // Read an optional version. - if (tryRead ("version")) { - String version; - parseEq (); - checkLegalVersion (version = readLiteral (flags)); - - if (version.equals ("1.1")){ - if (xmlVersion == XML_10){ - error ("external subset has later version number.", "1.0", version); - } - handler.warn ("expected XML version 1.0, not: " + version); - xmlVersion = XML_11; - }else if(!version.equals ("1.0")) { - error("illegal XML version", version, "1.0 or 1.1"); - } - requireWhitespace (); - } - - - // Read the encoding. - require ("encoding"); - parseEq (); - encodingName = readLiteral (flags); - if (!ignoreEncoding) - setupDecoding (encodingName); - - skipWhitespace (); - require ("?>"); - - return encodingName; - } - + { + String encodingName = null; + int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; + + // Read an optional version. + if (tryRead ("version")) + { + String version; + parseEq(); + checkLegalVersion(version = readLiteral(flags)); + + if (version.equals("1.1")) + { + if (xmlVersion == XML_10) + { + error("external subset has later version number.", "1.0", + version); + } + handler.warn("expected XML version 1.0, not: " + version); + xmlVersion = XML_11; + } + else if (!version.equals("1.0")) + { + error("illegal XML version", version, "1.0 or 1.1"); + } + requireWhitespace(); + } + + // Read the encoding. + require("encoding"); + parseEq(); + encodingName = readLiteral(flags); + if (!ignoreEncoding) + { + setupDecoding(encodingName); + } + skipWhitespace(); + require("?>"); + + return encodingName; + } - /** - * Sets up internal state so that we can decode an entity using the - * specified encoding. This is used when we start to read an entity - * and we have been given knowledge of its encoding before we start to - * read any data (e.g. from a SAX input source or from a MIME type). - * - * <p> It is also used after autodetection, at which point only very - * limited adjustments to the encoding may be used (switching between - * related builtin decoders). - * - * @param encodingName The name of the encoding specified by the user. - * @exception IOException if the encoding isn't supported either - * internally to this parser, or by the hosting JVM. - * @see #parseXMLDecl - * @see #parseTextDecl + /** + * Sets up internal state so that we can decode an entity using the + * specified encoding. This is used when we start to read an entity + * and we have been given knowledge of its encoding before we start to + * read any data (e.g. from a SAX input source or from a MIME type). + * + * <p> It is also used after autodetection, at which point only very + * limited adjustments to the encoding may be used (switching between + * related builtin decoders). + * + * @param encodingName The name of the encoding specified by the user. + * @exception IOException if the encoding isn't supported either + * internally to this parser, or by the hosting JVM. + * @see #parseXMLDecl + * @see #parseTextDecl */ - private void setupDecoding (String encodingName) + private void setupDecoding(String encodingName) throws SAXException, IOException - { - encodingName = encodingName.toUpperCase (); - - // ENCODING_EXTERNAL indicates an encoding that wasn't - // autodetected ... we can use builtin decoders, or - // ones from the JVM (InputStreamReader). - - // Otherwise we can only tweak what was autodetected, and - // only for single byte (ASCII derived) builtin encodings. - - // ASCII-derived encodings - if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL) { - if (encodingName.equals ("ISO-8859-1") - || encodingName.equals ("8859_1") - || encodingName.equals ("ISO8859_1") - ) { - encoding = ENCODING_ISO_8859_1; - return; - } else if (encodingName.equals ("US-ASCII") - || encodingName.equals ("ASCII")) { - encoding = ENCODING_ASCII; - return; - } else if (encodingName.equals ("UTF-8") - || encodingName.equals ("UTF8")) { - encoding = ENCODING_UTF_8; - return; - } else if (encoding != ENCODING_EXTERNAL) { - // used to start with a new reader ... - throw new UnsupportedEncodingException (encodingName); - } - // else fallthrough ... - // it's ASCII-ish and something other than a builtin - } - - // Unicode and such - if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) { - if (!(encodingName.equals ("ISO-10646-UCS-2") - || encodingName.equals ("UTF-16") - || encodingName.equals ("UTF-16BE") - || encodingName.equals ("UTF-16LE"))) - error ("unsupported Unicode encoding", - encodingName, - "UTF-16"); - return; - } - - // four byte encodings - if (encoding == ENCODING_UCS_4_1234 - || encoding == ENCODING_UCS_4_4321 - || encoding == ENCODING_UCS_4_2143 - || encoding == ENCODING_UCS_4_3412) { - // Strictly: "UCS-4" == "UTF-32BE"; also, "UTF-32LE" exists - if (!encodingName.equals ("ISO-10646-UCS-4")) - error ("unsupported 32-bit encoding", - encodingName, - "ISO-10646-UCS-4"); - return; - } - - // assert encoding == ENCODING_EXTERNAL - // if (encoding != ENCODING_EXTERNAL) - // throw new RuntimeException ("encoding = " + encoding); - - if (encodingName.equals ("UTF-16BE")) { - encoding = ENCODING_UCS_2_12; - return; - } - if (encodingName.equals ("UTF-16LE")) { - encoding = ENCODING_UCS_2_21; - return; - } - - // We couldn't use the builtin decoders at all. But we can try to - // create a reader, since we haven't messed up buffering. Tweak - // the encoding name if necessary. - - if (encodingName.equals ("UTF-16") - || encodingName.equals ("ISO-10646-UCS-2")) - encodingName = "Unicode"; - // Ignoring all the EBCDIC aliases here - - reader = new InputStreamReader (is, encodingName); - sourceType = INPUT_READER; - } - - - /** - * Parse miscellaneous markup outside the document element and DOCTYPE - * declaration. - * <pre> - * [27] Misc ::= Comment | PI | S - * </pre> - */ - private void parseMisc () + { + encodingName = encodingName.toUpperCase(); + + // ENCODING_EXTERNAL indicates an encoding that wasn't + // autodetected ... we can use builtin decoders, or + // ones from the JVM (InputStreamReader). + + // Otherwise we can only tweak what was autodetected, and + // only for single byte (ASCII derived) builtin encodings. + + // ASCII-derived encodings + if (encoding == ENCODING_UTF_8 || encoding == ENCODING_EXTERNAL) + { + if (encodingName.equals("ISO-8859-1") + || encodingName.equals("8859_1") + || encodingName.equals("ISO8859_1")) + { + encoding = ENCODING_ISO_8859_1; + return; + } + else if (encodingName.equals("US-ASCII") + || encodingName.equals("ASCII")) + { + encoding = ENCODING_ASCII; + return; + } + else if (encodingName.equals("UTF-8") + || encodingName.equals("UTF8")) + { + encoding = ENCODING_UTF_8; + return; + } + else if (encoding != ENCODING_EXTERNAL) + { + // used to start with a new reader ... + throw new UnsupportedEncodingException(encodingName); + } + // else fallthrough ... + // it's ASCII-ish and something other than a builtin + } + + // Unicode and such + if (encoding == ENCODING_UCS_2_12 || encoding == ENCODING_UCS_2_21) + { + if (!(encodingName.equals("ISO-10646-UCS-2") + || encodingName.equals("UTF-16") + || encodingName.equals("UTF-16BE") + || encodingName.equals("UTF-16LE"))) + { + error("unsupported Unicode encoding", encodingName, "UTF-16"); + } + return; + } + + // four byte encodings + if (encoding == ENCODING_UCS_4_1234 + || encoding == ENCODING_UCS_4_4321 + || encoding == ENCODING_UCS_4_2143 + || encoding == ENCODING_UCS_4_3412) + { + // Strictly: "UCS-4" == "UTF-32BE"; also, "UTF-32LE" exists + if (!encodingName.equals("ISO-10646-UCS-4")) + { + error("unsupported 32-bit encoding", encodingName, + "ISO-10646-UCS-4"); + } + return; + } + + // assert encoding == ENCODING_EXTERNAL + // if (encoding != ENCODING_EXTERNAL) + // throw new RuntimeException ("encoding = " + encoding); + + if (encodingName.equals("UTF-16BE")) + { + encoding = ENCODING_UCS_2_12; + return; + } + if (encodingName.equals("UTF-16LE")) + { + encoding = ENCODING_UCS_2_21; + return; + } + + // We couldn't use the builtin decoders at all. But we can try to + // create a reader, since we haven't messed up buffering. Tweak + // the encoding name if necessary. + + if (encodingName.equals("UTF-16") + || encodingName.equals("ISO-10646-UCS-2")) + { + encodingName = "Unicode"; + } + // Ignoring all the EBCDIC aliases here + + reader = new InputStreamReader(is, encodingName); + sourceType = INPUT_READER; + } + + /** + * Parse miscellaneous markup outside the document element and DOCTYPE + * declaration. + * <pre> + * [27] Misc ::= Comment | PI | S + * </pre> + */ + private void parseMisc() throws Exception - { - while (true) { - skipWhitespace (); - if (tryRead (startDelimPI)) { - parsePI (); - } else if (tryRead (startDelimComment)) { - parseComment (); - } else { - return; - } - } - } - + { + while (true) + { + skipWhitespace(); + if (tryRead(startDelimPI)) + { + parsePI(); + } + else if (tryRead(startDelimComment)) + { + parseComment(); + } + else + { + return; + } + } + } - /** - * Parse a document type declaration. - * <pre> - * [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? - * ('[' (markupdecl | PEReference | S)* ']' S?)? '>' - * </pre> - * <p> (The <code><!DOCTYPE</code> has already been read.) - */ - private void parseDoctypedecl () + /** + * Parse a document type declaration. + * <pre> + * [28] doctypedecl ::= '<!DOCTYPE' S Name (S ExternalID)? S? + * ('[' (markupdecl | PEReference | S)* ']' S?)? '>' + * </pre> + * <p> (The <code><!DOCTYPE</code> has already been read.) + */ + private void parseDoctypedecl() throws Exception - { - String rootName, ids[]; - - // Read the document type name. - requireWhitespace (); - rootName = readNmtoken (true); - - // Read the External subset's IDs - skipWhitespace (); - ids = readExternalIds (false, true); - - // report (a) declaration of name, (b) lexical info (ids) - handler.doctypeDecl (rootName, ids [0], ids [1]); - - // Internal subset is parsed first, if present - skipWhitespace (); - if (tryRead ('[')) { - - // loop until the subset ends - while (true) { - doReport = expandPE = true; - skipWhitespace (); - doReport = expandPE = false; - if (tryRead (']')) { - break; // end of subset - } else { - // WFC, PEs in internal subset (only between decls) - peIsError = expandPE = true; - parseMarkupdecl (); - peIsError = expandPE = false; - } - } - } - skipWhitespace (); - require ('>'); - - // Read the external subset, if any - InputSource subset; - - if (ids [1] == null) - subset = handler.getExternalSubset (rootName, - handler.getSystemId ()); - else - subset = null; - if (ids [1] != null || subset != null) { - pushString (null, ">"); - - // NOTE: [dtd] is so we say what SAX2 expects, - // though it's misleading (subset, not entire dtd) - if (ids [1] != null) - pushURL (true, "[dtd]", ids, null, null, null, true); - else { - handler.warn ("modifying document by adding external subset"); - pushURL (true, "[dtd]", - new String [] { subset.getPublicId (), - subset.getSystemId (), null }, - subset.getCharacterStream (), - subset.getByteStream (), - subset.getEncoding (), - false); - } - - // Loop until we end up back at '>' - while (true) { - doReport = expandPE = true; - skipWhitespace (); - doReport = expandPE = false; - if (tryRead ('>')) { - break; - } else { - expandPE = true; - parseMarkupdecl (); - expandPE = false; - } - } - - // the ">" string isn't popped yet - if (inputStack.size () != 1) - error ("external subset has unmatched '>'"); - } - - // done dtd - handler.endDoctype (); - expandPE = false; - doReport = true; - } + { + String rootName; + ExternalIdentifiers ids; + // Read the document type name. + requireWhitespace(); + rootName = readNmtoken(true); - /** - * Parse a markup declaration in the internal or external DTD subset. - * <pre> - * [29] markupdecl ::= elementdecl | Attlistdecl | EntityDecl - * | NotationDecl | PI | Comment - * [30] extSubsetDecl ::= (markupdecl | conditionalSect - * | PEReference | S) * - * </pre> - * <p> Reading toplevel PE references is handled as a lexical issue - * by the caller, as is whitespace. - */ - private void parseMarkupdecl () + // Read the External subset's IDs + skipWhitespace(); + ids = readExternalIds(false, true); + + // report (a) declaration of name, (b) lexical info (ids) + handler.doctypeDecl(rootName, ids.publicId, ids.systemId); + + // Internal subset is parsed first, if present + skipWhitespace(); + if (tryRead('[')) + { + + // loop until the subset ends + while (true) + { + doReport = expandPE = true; + skipWhitespace(); + doReport = expandPE = false; + if (tryRead(']')) + { + break; // end of subset + } + else + { + // WFC, PEs in internal subset (only between decls) + peIsError = expandPE = true; + parseMarkupdecl(); + peIsError = expandPE = false; + } + } + } + skipWhitespace(); + require('>'); + + // Read the external subset, if any + InputSource subset; + + if (ids.systemId == null) + { + subset = handler.getExternalSubset(rootName, + handler.getSystemId()); + } + else + { + subset = null; + } + if (ids.systemId != null || subset != null) + { + pushString(null, ">"); + + // NOTE: [dtd] is so we say what SAX2 expects, + // though it's misleading (subset, not entire dtd) + if (ids.systemId != null) + { + pushURL(true, "[dtd]", ids, null, null, null, true); + } + else + { + handler.warn("modifying document by adding external subset"); + pushURL(true, "[dtd]", + new ExternalIdentifiers(subset.getPublicId(), + subset.getSystemId(), + null), + subset.getCharacterStream(), + subset.getByteStream(), + subset.getEncoding(), + false); + } + + // Loop until we end up back at '>' + while (true) + { + doReport = expandPE = true; + skipWhitespace(); + doReport = expandPE = false; + if (tryRead('>')) + { + break; + } + else + { + expandPE = true; + parseMarkupdecl(); + expandPE = false; + } + } + + // the ">" string isn't popped yet + if (inputStack.size() != 1) + { + error("external subset has unmatched '>'"); + } + } + + // done dtd + handler.endDoctype(); + expandPE = false; + doReport = true; + } + + /** + * Parse a markup declaration in the internal or external DTD subset. + * <pre> + * [29] markupdecl ::= elementdecl | Attlistdecl | EntityDecl + * | NotationDecl | PI | Comment + * [30] extSubsetDecl ::= (markupdecl | conditionalSect + * | PEReference | S) * + * </pre> + * <p> Reading toplevel PE references is handled as a lexical issue + * by the caller, as is whitespace. + */ + private void parseMarkupdecl() throws Exception - { - char saved [] = null; - boolean savedPE = expandPE; - - // prevent "<%foo;" and ensures saved entity is right - require ('<'); - unread ('<'); - expandPE = false; - - if (tryRead ("<!ELEMENT")) { - saved = readBuffer; - expandPE = savedPE; - parseElementDecl (); - } else if (tryRead ("<!ATTLIST")) { - saved = readBuffer; - expandPE = savedPE; - parseAttlistDecl (); - } else if (tryRead ("<!ENTITY")) { - saved = readBuffer; - expandPE = savedPE; - parseEntityDecl (); - } else if (tryRead ("<!NOTATION")) { - saved = readBuffer; - expandPE = savedPE; - parseNotationDecl (); - } else if (tryRead (startDelimPI)) { - saved = readBuffer; - expandPE = savedPE; - parsePI (); - } else if (tryRead (startDelimComment)) { - saved = readBuffer; - expandPE = savedPE; - parseComment (); - } else if (tryRead ("<![")) { - saved = readBuffer; - expandPE = savedPE; - if (inputStack.size () > 0) - parseConditionalSect (saved); - else - error ("conditional sections illegal in internal subset"); - } else { - error ("expected markup declaration"); - } - - // VC: Proper Decl/PE Nesting - if (readBuffer != saved) - handler.verror ("Illegal Declaration/PE nesting"); - } + { + char[] saved = null; + boolean savedPE = expandPE; + // prevent "<%foo;" and ensures saved entity is right + require('<'); + unread('<'); + expandPE = false; + + if (tryRead("<!ELEMENT")) + { + saved = readBuffer; + expandPE = savedPE; + parseElementDecl(); + } + else if (tryRead("<!ATTLIST")) + { + saved = readBuffer; + expandPE = savedPE; + parseAttlistDecl(); + } + else if (tryRead("<!ENTITY")) + { + saved = readBuffer; + expandPE = savedPE; + parseEntityDecl(); + } + else if (tryRead("<!NOTATION")) + { + saved = readBuffer; + expandPE = savedPE; + parseNotationDecl(); + } + else if (tryRead(startDelimPI)) + { + saved = readBuffer; + expandPE = savedPE; + parsePI(); + } + else if (tryRead(startDelimComment)) + { + saved = readBuffer; + expandPE = savedPE; + parseComment(); + } + else if (tryRead("<![")) + { + saved = readBuffer; + expandPE = savedPE; + if (inputStack.size() > 0) + { + parseConditionalSect(saved); + } + else + { + error("conditional sections illegal in internal subset"); + } + } + else + { + error("expected markup declaration"); + } - /** - * Parse an element, with its tags. - * <pre> - * [39] element ::= EmptyElementTag | STag content ETag - * [40] STag ::= '<' Name (S Attribute)* S? '>' - * [44] EmptyElementTag ::= '<' Name (S Attribute)* S? '/>' - * </pre> - * <p> (The '<' has already been read.) - * <p>NOTE: this method actually chains onto parseContent (), if necessary, - * and parseContent () will take care of calling parseETag (). - */ - private void parseElement (boolean maybeGetSubset) + // VC: Proper Decl/PE Nesting + if (readBuffer != saved) + { + handler.verror("Illegal Declaration/PE nesting"); + } + } + + /** + * Parse an element, with its tags. + * <pre> + * [39] element ::= EmptyElementTag | STag content ETag + * [40] STag ::= '<' Name (S Attribute)* S? '>' + * [44] EmptyElementTag ::= '<' Name (S Attribute)* S? '/>' + * </pre> + * <p> (The '<' has already been read.) + * <p>NOTE: this method actually chains onto parseContent (), if necessary, + * and parseContent () will take care of calling parseETag (). + */ + private void parseElement(boolean maybeGetSubset) throws Exception - { - String gi; - char c; - int oldElementContent = currentElementContent; - String oldElement = currentElement; - Object element []; - - // This is the (global) counter for the - // array of specified attributes. - tagAttributePos = 0; - - // Read the element type name. - gi = readNmtoken (true); - - // If we saw no DTD, and this is the document root element, - // let the application modify the input stream by providing one. - if (maybeGetSubset) { - InputSource subset = handler.getExternalSubset (gi, - handler.getSystemId ()); - if (subset != null) { - String publicId = subset.getPublicId (); - String systemId = subset.getSystemId (); - - handler.warn ("modifying document by adding DTD"); - handler.doctypeDecl (gi, publicId, systemId); - pushString (null, ">"); - - // NOTE: [dtd] is so we say what SAX2 expects, - // though it's misleading (subset, not entire dtd) - pushURL (true, "[dtd]", - new String [] { publicId, systemId, null }, - subset.getCharacterStream (), - subset.getByteStream (), - subset.getEncoding (), - false); - - // Loop until we end up back at '>' - while (true) { - doReport = expandPE = true; - skipWhitespace (); - doReport = expandPE = false; - if (tryRead ('>')) { - break; - } else { - expandPE = true; - parseMarkupdecl (); - expandPE = false; - } - } - - // the ">" string isn't popped yet - if (inputStack.size () != 1) - error ("external subset has unmatched '>'"); - - handler.endDoctype (); - } - } - - // Determine the current content type. - currentElement = gi; - element = (Object []) elementInfo.get (gi); - currentElementContent = getContentType (element, CONTENT_ANY); - - // Read the attributes, if any. - // After this loop, "c" is the closing delimiter. - boolean white = tryWhitespace (); - c = readCh (); - while (c != '/' && c != '>') { - unread (c); - if (!white) - error ("need whitespace between attributes"); - parseAttribute (gi); - white = tryWhitespace (); - c = readCh (); - } - - // Supply any defaulted attributes. - Enumeration atts = declaredAttributes (element); - if (atts != null) { - String aname; + { + String gi; + char c; + int oldElementContent = currentElementContent; + String oldElement = currentElement; + ElementDecl element; + + // This is the (global) counter for the + // array of specified attributes. + tagAttributePos = 0; + + // Read the element type name. + gi = readNmtoken(true); + + // If we saw no DTD, and this is the document root element, + // let the application modify the input stream by providing one. + if (maybeGetSubset) + { + InputSource subset = handler.getExternalSubset(gi, + handler.getSystemId()); + if (subset != null) + { + String publicId = subset.getPublicId(); + String systemId = subset.getSystemId(); + + handler.warn("modifying document by adding DTD"); + handler.doctypeDecl(gi, publicId, systemId); + pushString(null, ">"); + + // NOTE: [dtd] is so we say what SAX2 expects, + // though it's misleading (subset, not entire dtd) + pushURL(true, "[dtd]", + new ExternalIdentifiers(publicId, systemId, null), + subset.getCharacterStream(), + subset.getByteStream(), + subset.getEncoding(), + false); + + // Loop until we end up back at '>' + while (true) + { + doReport = expandPE = true; + skipWhitespace(); + doReport = expandPE = false; + if (tryRead('>')) + { + break; + } + else + { + expandPE = true; + parseMarkupdecl(); + expandPE = false; + } + } + + // the ">" string isn't popped yet + if (inputStack.size() != 1) + { + error("external subset has unmatched '>'"); + } + + handler.endDoctype(); + } + } + + // Determine the current content type. + currentElement = gi; + element = (ElementDecl) elementInfo.get(gi); + currentElementContent = getContentType(element, CONTENT_ANY); + + // Read the attributes, if any. + // After this loop, "c" is the closing delimiter. + boolean white = tryWhitespace(); + c = readCh(); + while (c != '/' && c != '>') + { + unread(c); + if (!white) + { + error("need whitespace between attributes"); + } + parseAttribute(gi); + white = tryWhitespace(); + c = readCh(); + } + + // Supply any defaulted attributes. + Iterator atts = declaredAttributes(element); + if (atts != null) + { + String aname; loop: - while (atts.hasMoreElements ()) { - aname = (String) atts.nextElement (); - // See if it was specified. - for (int i = 0; i < tagAttributePos; i++) { - if (tagAttributes [i] == aname) { - continue loop; - } - } - // ... or has a default - String value = getAttributeDefaultValue (gi, aname); - - if (value == null) - continue; - handler.attribute (aname, value, false); - } - } - - // Figure out if this is a start tag - // or an empty element, and dispatch an - // event accordingly. - switch (c) { - case '>': - handler.startElement (gi); - parseContent (); - break; - case '/': - require ('>'); - handler.startElement (gi); - handler.endElement (gi); - break; - } - - // Restore the previous state. - currentElement = oldElement; - currentElementContent = oldElementContent; - } + while (atts.hasNext()) + { + aname = (String) atts.next(); + // See if it was specified. + for (int i = 0; i < tagAttributePos; i++) + { + if (tagAttributes[i] == aname) + { + continue loop; + } + } + // ... or has a default + String value = getAttributeDefaultValue(gi, aname); + + if (value == null) + { + continue; + } + handler.attribute(aname, value, false); + } + } + // Figure out if this is a start tag + // or an empty element, and dispatch an + // event accordingly. + switch (c) + { + case '>': + handler.startElement(gi); + parseContent(); + break; + case '/': + require('>'); + handler.startElement(gi); + handler.endElement(gi); + break; + } - /** - * Parse an attribute assignment. - * <pre> - * [41] Attribute ::= Name Eq AttValue - * </pre> - * @param name The name of the attribute's element. - * @see SAXDriver#attribute - */ - private void parseAttribute (String name) - throws Exception - { - String aname; - String type; - String value; - int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF; - - // Read the attribute name. - aname = readNmtoken (true); - type = getAttributeType (name, aname); - - // Parse '=' - parseEq (); - - // Read the value, normalizing whitespace - // unless it is CDATA. - if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { - if (type == "CDATA" || type == null) { - value = readLiteral (flags); - } else { - value = readLiteral (flags | LIT_NORMALIZE); - } - } else { - if (type.equals("CDATA") || type == null) { - value = readLiteral (flags); - } else { - value = readLiteral (flags | LIT_NORMALIZE); - } + // Restore the previous state. + currentElement = oldElement; + currentElementContent = oldElementContent; } + + /** + * Parse an attribute assignment. + * <pre> + * [41] Attribute ::= Name Eq AttValue + * </pre> + * @param name The name of the attribute's element. + * @see SAXDriver#attribute + */ + private void parseAttribute(String name) + throws Exception + { + String aname; + String type; + String value; + int flags = LIT_ATTRIBUTE | LIT_ENTITY_REF; + + // Read the attribute name. + aname = readNmtoken(true); + type = getAttributeType(name, aname); + + // Parse '=' + parseEq(); + + // Read the value, normalizing whitespace + // unless it is CDATA. + if (handler.stringInterning) + { + if (type == "CDATA" || type == null) + { + value = readLiteral(flags); + } + else + { + value = readLiteral(flags | LIT_NORMALIZE); + } + } + else + { + if (type.equals("CDATA") || type == null) + { + value = readLiteral(flags); + } + else + { + value = readLiteral(flags | LIT_NORMALIZE); + } + } - // WFC: no duplicate attributes - for (int i = 0; i < tagAttributePos; i++) - if (aname.equals (tagAttributes [i])) - error ("duplicate attribute", aname, null); - - // Inform the handler about the - // attribute. - handler.attribute (aname, value, true); - dataBufferPos = 0; - - // Note that the attribute has been - // specified. - if (tagAttributePos == tagAttributes.length) { - String newAttrib[] = new String [tagAttributes.length * 2]; - System.arraycopy (tagAttributes, 0, newAttrib, 0, tagAttributePos); - tagAttributes = newAttrib; - } - tagAttributes [tagAttributePos++] = aname; - } + // WFC: no duplicate attributes + for (int i = 0; i < tagAttributePos; i++) + { + if (aname.equals(tagAttributes [i])) + { + error("duplicate attribute", aname, null); + } + } + // Inform the handler about the + // attribute. + handler.attribute(aname, value, true); + dataBufferPos = 0; + + // Note that the attribute has been + // specified. + if (tagAttributePos == tagAttributes.length) + { + String newAttrib[] = new String[tagAttributes.length * 2]; + System.arraycopy(tagAttributes, 0, newAttrib, 0, tagAttributePos); + tagAttributes = newAttrib; + } + tagAttributes[tagAttributePos++] = aname; + } - /** - * Parse an equals sign surrounded by optional whitespace. - * <pre> - * [25] Eq ::= S? '=' S? - * </pre> - */ - private void parseEq () + /** + * Parse an equals sign surrounded by optional whitespace. + * <pre> + * [25] Eq ::= S? '=' S? + * </pre> + */ + private void parseEq() throws SAXException, IOException - { - skipWhitespace (); - require ('='); - skipWhitespace (); - } - + { + skipWhitespace(); + require('='); + skipWhitespace(); + } - /** - * Parse an end tag. - * <pre> - * [42] ETag ::= '</' Name S? '>' - * </pre> - * <p>NOTE: parseContent () chains to here, we already read the - * "</". - */ - private void parseETag () + /** + * Parse an end tag. + * <pre> + * [42] ETag ::= '</' Name S? '>' + * </pre> + * <p>NOTE: parseContent () chains to here, we already read the + * "</". + */ + private void parseETag() throws Exception - { - require (currentElement); - skipWhitespace (); - require ('>'); - handler.endElement (currentElement); - // not re-reporting any SAXException re bogus end tags, - // even though that diagnostic might be clearer ... - } - - - /** - * Parse the content of an element. - * <pre> - * [43] content ::= (element | CharData | Reference - * | CDSect | PI | Comment)* - * [67] Reference ::= EntityRef | CharRef - * </pre> - * <p> NOTE: consumes ETtag. - */ - private void parseContent () + { + require(currentElement); + skipWhitespace(); + require('>'); + handler.endElement(currentElement); + // not re-reporting any SAXException re bogus end tags, + // even though that diagnostic might be clearer ... + } + + /** + * Parse the content of an element. + * <pre> + * [43] content ::= (element | CharData | Reference + * | CDSect | PI | Comment)* + * [67] Reference ::= EntityRef | CharRef + * </pre> + * <p> NOTE: consumes ETtag. + */ + private void parseContent() throws Exception - { - char c; - - while (true) { - // consume characters (or ignorable whitspace) until delimiter - parseCharData (); - - // Handle delimiters - c = readCh (); - switch (c) { - - case '&': // Found "&" - c = readCh (); - if (c == '#') { - parseCharRef (); - } else { - unread (c); - parseEntityRef (true); - } - isDirtyCurrentElement = true; - break; - - case '<': // Found "<" - dataBufferFlush (); - c = readCh (); - switch (c) { - case '!': // Found "<!" - c = readCh (); - switch (c) { - case '-': // Found "<!-" - require ('-'); - isDirtyCurrentElement = false; - parseComment (); - break; - case '[': // Found "<![" - isDirtyCurrentElement = false; - require ("CDATA["); - handler.startCDATA (); - inCDATA = true; - parseCDSect (); - inCDATA = false; - handler.endCDATA (); - break; - default: - error ("expected comment or CDATA section", c, null); - break; - } - break; - - case '?': // Found "<?" - isDirtyCurrentElement = false; - parsePI (); - break; - - case '/': // Found "</" - isDirtyCurrentElement = false; - parseETag (); - return; - - default: // Found "<" followed by something else - isDirtyCurrentElement = false; - unread (c); - parseElement (false); - break; - } - } - } - - } - - - /** - * Parse an element type declaration. - * <pre> - * [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' - * </pre> - * <p> NOTE: the '<!ELEMENT' has already been read. - */ - private void parseElementDecl () + { + char c; + + while (true) + { + // consume characters (or ignorable whitspace) until delimiter + parseCharData(); + + // Handle delimiters + c = readCh(); + switch (c) + { + case '&': // Found "&" + c = readCh(); + if (c == '#') + { + parseCharRef(); + } + else + { + unread(c); + parseEntityRef(true); + } + isDirtyCurrentElement = true; + break; + + case '<': // Found "<" + dataBufferFlush(); + c = readCh(); + switch (c) + { + case '!': // Found "<!" + c = readCh(); + switch (c) + { + case '-': // Found "<!-" + require('-'); + isDirtyCurrentElement = false; + parseComment(); + break; + case '[': // Found "<![" + isDirtyCurrentElement = false; + require("CDATA["); + handler.startCDATA(); + inCDATA = true; + parseCDSect(); + inCDATA = false; + handler.endCDATA(); + break; + default: + error("expected comment or CDATA section", c, null); + break; + } + break; + + case '?': // Found "<?" + isDirtyCurrentElement = false; + parsePI(); + break; + + case '/': // Found "</" + isDirtyCurrentElement = false; + parseETag(); + return; + + default: // Found "<" followed by something else + isDirtyCurrentElement = false; + unread(c); + parseElement(false); + break; + } + } + } + } + + /** + * Parse an element type declaration. + * <pre> + * [45] elementdecl ::= '<!ELEMENT' S Name S contentspec S? '>' + * </pre> + * <p> NOTE: the '<!ELEMENT' has already been read. + */ + private void parseElementDecl() throws Exception - { - String name; - - requireWhitespace (); - // Read the element type name. - name = readNmtoken (true); - - requireWhitespace (); - // Read the content model. - parseContentspec (name); - - skipWhitespace (); - require ('>'); - } - + { + String name; + + requireWhitespace(); + // Read the element type name. + name = readNmtoken(true); - /** - * Content specification. - * <pre> - * [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | elements - * </pre> - */ - private void parseContentspec (String name) - throws Exception - { -// FIXME: move elementDecl() into setElement(), pass EMTPY/ANY ... - if (tryRead ("EMPTY")) { - setElement (name, CONTENT_EMPTY, null, null); - if (!skippedPE) - handler.getDeclHandler ().elementDecl (name, "EMPTY"); - return; - } else if (tryRead ("ANY")) { - setElement (name, CONTENT_ANY, null, null); - if (!skippedPE) - handler.getDeclHandler ().elementDecl (name, "ANY"); - return; - } else { - String model; - char saved []; - - require ('('); - saved = readBuffer; - dataBufferAppend ('('); - skipWhitespace (); - if (tryRead ("#PCDATA")) { - dataBufferAppend ("#PCDATA"); - parseMixed (saved); - model = dataBufferToString (); - setElement (name, CONTENT_MIXED, model, null); - } else { - parseElements (saved); - model = dataBufferToString (); - setElement (name, CONTENT_ELEMENTS, model, null); - } - if (!skippedPE) - handler.getDeclHandler ().elementDecl (name, model); - } - } + requireWhitespace(); + // Read the content model. + parseContentspec(name); + + skipWhitespace(); + require('>'); + } - /** - * Parse an element-content model. - * <pre> - * [47] elements ::= (choice | seq) ('?' | '*' | '+')? - * [49] choice ::= '(' S? cp (S? '|' S? cp)+ S? ')' - * [50] seq ::= '(' S? cp (S? ',' S? cp)* S? ')' - * </pre> - * - * <p> NOTE: the opening '(' and S have already been read. - * - * @param saved Buffer for entity that should have the terminal ')' - */ - private void parseElements (char saved []) + /** + * Content specification. + * <pre> + * [46] contentspec ::= 'EMPTY' | 'ANY' | Mixed | elements + * </pre> + */ + private void parseContentspec(String name) throws Exception - { - char c; - char sep; - - // Parse the first content particle - skipWhitespace (); - parseCp (); - - // Check for end or for a separator. - skipWhitespace (); - c = readCh (); - switch (c) { - case ')': - // VC: Proper Group/PE Nesting - if (readBuffer != saved) - handler.verror ("Illegal Group/PE nesting"); - - dataBufferAppend (')'); - c = readCh (); - switch (c) { - case '*': - case '+': - case '?': - dataBufferAppend (c); - break; - default: - unread (c); - } - return; - case ',': // Register the separator. - case '|': - sep = c; - dataBufferAppend (c); - break; - default: - error ("bad separator in content model", c, null); - return; - } - - // Parse the rest of the content model. - while (true) { - skipWhitespace (); - parseCp (); - skipWhitespace (); - c = readCh (); - if (c == ')') { - // VC: Proper Group/PE Nesting - if (readBuffer != saved) - handler.verror ("Illegal Group/PE nesting"); - - dataBufferAppend (')'); - break; - } else if (c != sep) { - error ("bad separator in content model", c, null); - return; - } else { - dataBufferAppend (c); - } - } - - // Check for the occurrence indicator. - c = readCh (); - switch (c) { - case '?': - case '*': - case '+': - dataBufferAppend (c); - return; - default: - unread (c); - return; - } - } - - - /** - * Parse a content particle. - * <pre> - * [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? - * </pre> - */ - private void parseCp () + { + // FIXME: move elementDecl() into setElement(), pass EMTPY/ANY ... + if (tryRead("EMPTY")) + { + setElement(name, CONTENT_EMPTY, null, null); + if (!skippedPE) + { + handler.getDeclHandler().elementDecl(name, "EMPTY"); + } + return; + } + else if (tryRead("ANY")) + { + setElement(name, CONTENT_ANY, null, null); + if (!skippedPE) + { + handler.getDeclHandler().elementDecl(name, "ANY"); + } + return; + } + else + { + String model; + char[] saved; + + require('('); + saved = readBuffer; + dataBufferAppend('('); + skipWhitespace(); + if (tryRead("#PCDATA")) + { + dataBufferAppend("#PCDATA"); + parseMixed(saved); + model = dataBufferToString(); + setElement(name, CONTENT_MIXED, model, null); + } + else + { + parseElements(saved); + model = dataBufferToString(); + setElement(name, CONTENT_ELEMENTS, model, null); + } + if (!skippedPE) + { + handler.getDeclHandler().elementDecl(name, model); + } + } + } + + /** + * Parse an element-content model. + * <pre> + * [47] elements ::= (choice | seq) ('?' | '*' | '+')? + * [49] choice ::= '(' S? cp (S? '|' S? cp)+ S? ')' + * [50] seq ::= '(' S? cp (S? ',' S? cp)* S? ')' + * </pre> + * + * <p> NOTE: the opening '(' and S have already been read. + * + * @param saved Buffer for entity that should have the terminal ')' + */ + private void parseElements(char[] saved) throws Exception - { - if (tryRead ('(')) { - dataBufferAppend ('('); - parseElements (readBuffer); - } else { - dataBufferAppend (readNmtoken (true)); - char c = readCh (); - switch (c) { - case '?': - case '*': - case '+': - dataBufferAppend (c); - break; - default: - unread (c); - break; - } - } - } - - - /** - * Parse mixed content. - * <pre> - * [51] Mixed ::= '(' S? ( '#PCDATA' (S? '|' S? Name)*) S? ')*' - * | '(' S? ('#PCDATA') S? ')' - * </pre> - * - * @param saved Buffer for entity that should have the terminal ')' - */ - private void parseMixed (char saved []) + { + char c; + char sep; + + // Parse the first content particle + skipWhitespace(); + parseCp(); + + // Check for end or for a separator. + skipWhitespace(); + c = readCh(); + switch (c) + { + case ')': + // VC: Proper Group/PE Nesting + if (readBuffer != saved) + { + handler.verror("Illegal Group/PE nesting"); + } + + dataBufferAppend(')'); + c = readCh(); + switch (c) + { + case '*': + case '+': + case '?': + dataBufferAppend(c); + break; + default: + unread(c); + } + return; + case ',': // Register the separator. + case '|': + sep = c; + dataBufferAppend(c); + break; + default: + error("bad separator in content model", c, null); + return; + } + + // Parse the rest of the content model. + while (true) + { + skipWhitespace(); + parseCp(); + skipWhitespace(); + c = readCh(); + if (c == ')') + { + // VC: Proper Group/PE Nesting + if (readBuffer != saved) + { + handler.verror("Illegal Group/PE nesting"); + } + + dataBufferAppend(')'); + break; + } + else if (c != sep) + { + error("bad separator in content model", c, null); + return; + } + else + { + dataBufferAppend(c); + } + } + + // Check for the occurrence indicator. + c = readCh(); + switch (c) + { + case '?': + case '*': + case '+': + dataBufferAppend(c); + return; + default: + unread(c); + return; + } + } + + /** + * Parse a content particle. + * <pre> + * [48] cp ::= (Name | choice | seq) ('?' | '*' | '+')? + * </pre> + */ + private void parseCp() throws Exception - { - // Check for PCDATA alone. - skipWhitespace (); - if (tryRead (')')) { - // VC: Proper Group/PE Nesting - if (readBuffer != saved) - handler.verror ("Illegal Group/PE nesting"); - - dataBufferAppend (")*"); - tryRead ('*'); - return; - } - - // Parse mixed content. - skipWhitespace (); - while (!tryRead (")")) { - require ('|'); - dataBufferAppend ('|'); - skipWhitespace (); - dataBufferAppend (readNmtoken (true)); - skipWhitespace (); - } - - // VC: Proper Group/PE Nesting - if (readBuffer != saved) - handler.verror ("Illegal Group/PE nesting"); - - require ('*'); - dataBufferAppend (")*"); - } - + { + if (tryRead('(')) + { + dataBufferAppend('('); + parseElements(readBuffer); + } + else + { + dataBufferAppend(readNmtoken(true)); + char c = readCh(); + switch (c) + { + case '?': + case '*': + case '+': + dataBufferAppend(c); + break; + default: + unread(c); + break; + } + } + } - /** - * Parse an attribute list declaration. - * <pre> - * [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' - * </pre> - * <p>NOTE: the '<!ATTLIST' has already been read. - */ - private void parseAttlistDecl () + /** + * Parse mixed content. + * <pre> + * [51] Mixed ::= '(' S? ( '#PCDATA' (S? '|' S? Name)*) S? ')*' + * | '(' S? ('#PCDATA') S? ')' + * </pre> + * + * @param saved Buffer for entity that should have the terminal ')' + */ + private void parseMixed(char[] saved) throws Exception - { - String elementName; - - requireWhitespace (); - elementName = readNmtoken (true); - boolean white = tryWhitespace (); - while (!tryRead ('>')) { - if (!white) - error ("whitespace required before attribute definition"); - parseAttDef (elementName); - white = tryWhitespace (); - } - } - - - /** - * Parse a single attribute definition. - * <pre> - * [53] AttDef ::= S Name S AttType S DefaultDecl - * </pre> - */ - private void parseAttDef (String elementName) + { + // Check for PCDATA alone. + skipWhitespace(); + if (tryRead(')')) + { + // VC: Proper Group/PE Nesting + if (readBuffer != saved) + { + handler.verror("Illegal Group/PE nesting"); + } + + dataBufferAppend(")*"); + tryRead('*'); + return; + } + + // Parse mixed content. + skipWhitespace(); + while (!tryRead(")")) + { + require('|'); + dataBufferAppend('|'); + skipWhitespace(); + dataBufferAppend(readNmtoken(true)); + skipWhitespace(); + } + + // VC: Proper Group/PE Nesting + if (readBuffer != saved) + { + handler.verror("Illegal Group/PE nesting"); + } + + require('*'); + dataBufferAppend(")*"); + } + + /** + * Parse an attribute list declaration. + * <pre> + * [52] AttlistDecl ::= '<!ATTLIST' S Name AttDef* S? '>' + * </pre> + * <p>NOTE: the '<!ATTLIST' has already been read. + */ + private void parseAttlistDecl() throws Exception - { - String name; - String type; - String enumer = null; - - // Read the attribute name. - name = readNmtoken (true); - - // Read the attribute type. - requireWhitespace (); - type = readAttType (); - - // Get the string of enumerated values if necessary. - if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { - if ("ENUMERATION" == type || "NOTATION" == type) - enumer = dataBufferToString (); - } else { - if ("ENUMERATION".equals(type) || "NOTATION".equals(type)) - enumer = dataBufferToString (); + { + String elementName; + + requireWhitespace(); + elementName = readNmtoken(true); + boolean white = tryWhitespace(); + while (!tryRead('>')) + { + if (!white) + { + error("whitespace required before attribute definition"); + } + parseAttDef(elementName); + white = tryWhitespace(); + } } + + /** + * Parse a single attribute definition. + * <pre> + * [53] AttDef ::= S Name S AttType S DefaultDecl + * </pre> + */ + private void parseAttDef(String elementName) + throws Exception + { + String name; + String type; + String enumer = null; + + // Read the attribute name. + name = readNmtoken(true); - // Read the default value. - requireWhitespace (); - parseDefault (elementName, name, type, enumer); - } + // Read the attribute type. + requireWhitespace(); + type = readAttType(); + // Get the string of enumerated values if necessary. + if (handler.stringInterning) + { + if ("ENUMERATION" == type || "NOTATION" == type) + { + enumer = dataBufferToString(); + } + } + else + { + if ("ENUMERATION".equals(type) || "NOTATION".equals(type)) + { + enumer = dataBufferToString(); + } + } + + // Read the default value. + requireWhitespace(); + parseDefault(elementName, name, type, enumer); + } /** * Parse the attribute type. @@ -1598,229 +1926,284 @@ loop: * [54] AttType ::= StringType | TokenizedType | EnumeratedType * [55] StringType ::= 'CDATA' * [56] TokenizedType ::= 'ID' | 'IDREF' | 'IDREFS' | 'ENTITY' - * | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' + * | 'ENTITIES' | 'NMTOKEN' | 'NMTOKENS' * [57] EnumeratedType ::= NotationType | Enumeration * </pre> */ - private String readAttType () + private String readAttType() throws Exception { - if (tryRead ('(')) { - parseEnumeration (false); - return "ENUMERATION"; - } else { - String typeString = readNmtoken (true); - if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { - if ("NOTATION" == typeString) { - parseNotationType (); - return typeString; - } else if ("CDATA" == typeString - || "ID" == typeString - || "IDREF" == typeString - || "IDREFS" == typeString - || "ENTITY" == typeString - || "ENTITIES" == typeString - || "NMTOKEN" == typeString - || "NMTOKENS" == typeString) - return typeString; - } else { - if ("NOTATION".equals(typeString)) { - parseNotationType (); - return typeString; - } else if ("CDATA".equals(typeString) - || "ID".equals(typeString) - || "IDREF".equals(typeString) - || "IDREFS".equals(typeString) - || "ENTITY".equals(typeString) - || "ENTITIES".equals(typeString) - || "NMTOKEN".equals(typeString) - || "NMTOKENS".equals(typeString)) - return typeString; - } - error ("illegal attribute type", typeString, null); - return null; - } + if (tryRead('(')) + { + parseEnumeration(false); + return "ENUMERATION"; + } + else + { + String typeString = readNmtoken(true); + if (handler.stringInterning) + { + if ("NOTATION" == typeString) + { + parseNotationType(); + return typeString; + } + else if ("CDATA" == typeString + || "ID" == typeString + || "IDREF" == typeString + || "IDREFS" == typeString + || "ENTITY" == typeString + || "ENTITIES" == typeString + || "NMTOKEN" == typeString + || "NMTOKENS" == typeString) + { + return typeString; + } + } + else + { + if ("NOTATION".equals(typeString)) + { + parseNotationType(); + return typeString; + } + else if ("CDATA".equals(typeString) + || "ID".equals(typeString) + || "IDREF".equals(typeString) + || "IDREFS".equals(typeString) + || "ENTITY".equals(typeString) + || "ENTITIES".equals(typeString) + || "NMTOKEN".equals(typeString) + || "NMTOKENS".equals(typeString)) + { + return typeString; + } + } + error("illegal attribute type", typeString, null); + return null; + } } - - /** - * Parse an enumeration. - * <pre> - * [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' - * </pre> - * <p>NOTE: the '(' has already been read. - */ - private void parseEnumeration (boolean isNames) + /** + * Parse an enumeration. + * <pre> + * [59] Enumeration ::= '(' S? Nmtoken (S? '|' S? Nmtoken)* S? ')' + * </pre> + * <p>NOTE: the '(' has already been read. + */ + private void parseEnumeration(boolean isNames) throws Exception - { - dataBufferAppend ('('); - - // Read the first token. - skipWhitespace (); - dataBufferAppend (readNmtoken (isNames)); - // Read the remaining tokens. - skipWhitespace (); - while (!tryRead (')')) { - require ('|'); - dataBufferAppend ('|'); - skipWhitespace (); - dataBufferAppend (readNmtoken (isNames)); - skipWhitespace (); - } - dataBufferAppend (')'); - } - + { + dataBufferAppend('('); + + // Read the first token. + skipWhitespace(); + dataBufferAppend(readNmtoken(isNames)); + // Read the remaining tokens. + skipWhitespace(); + while (!tryRead(')')) + { + require('|'); + dataBufferAppend('|'); + skipWhitespace(); + dataBufferAppend(readNmtoken (isNames)); + skipWhitespace(); + } + dataBufferAppend(')'); + } - /** - * Parse a notation type for an attribute. - * <pre> - * [58] NotationType ::= 'NOTATION' S '(' S? NameNtoks - * (S? '|' S? name)* S? ')' - * </pre> - * <p>NOTE: the 'NOTATION' has already been read - */ - private void parseNotationType () + /** + * Parse a notation type for an attribute. + * <pre> + * [58] NotationType ::= 'NOTATION' S '(' S? NameNtoks + * (S? '|' S? name)* S? ')' + * </pre> + * <p>NOTE: the 'NOTATION' has already been read + */ + private void parseNotationType() throws Exception - { - requireWhitespace (); - require ('('); - - parseEnumeration (true); - } - - - /** - * Parse the default value for an attribute. - * <pre> - * [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' - * | (('#FIXED' S)? AttValue) - * </pre> - */ - private void parseDefault ( - String elementName, - String name, - String type, - String enumer - ) throws Exception - { - int valueType = ATTRIBUTE_DEFAULT_SPECIFIED; - String value = null; - int flags = LIT_ATTRIBUTE; - boolean saved = expandPE; - String defaultType = null; - - // LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace - // chars to spaces (doesn't matter when that's done if it doesn't - // interfere with char refs expanding to whitespace). - - if (!skippedPE) { - flags |= LIT_ENTITY_REF; - if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { - if ("CDATA" != type) - flags |= LIT_NORMALIZE; - } else { - if (!"CDATA".equals(type)) - flags |= LIT_NORMALIZE; - } - } - - expandPE = false; - if (tryRead ('#')) { - if (tryRead ("FIXED")) { - defaultType = "#FIXED"; - valueType = ATTRIBUTE_DEFAULT_FIXED; - requireWhitespace (); - value = readLiteral (flags); - } else if (tryRead ("REQUIRED")) { - defaultType = "#REQUIRED"; - valueType = ATTRIBUTE_DEFAULT_REQUIRED; - } else if (tryRead ("IMPLIED")) { - defaultType = "#IMPLIED"; - valueType = ATTRIBUTE_DEFAULT_IMPLIED; - } else { - error ("illegal keyword for attribute default value"); - } - } else - value = readLiteral (flags); - expandPE = saved; - setAttribute (elementName, name, type, enumer, value, valueType); - if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { - if ("ENUMERATION" == type) - type = enumer; - else if ("NOTATION" == type) - type = "NOTATION " + enumer; - } else { - if ("ENUMERATION".equals(type)) - type = enumer; - else if ("NOTATION".equals(type)) - type = "NOTATION " + enumer; + { + requireWhitespace(); + require('('); + + parseEnumeration(true); } - if (!skippedPE) handler.getDeclHandler () - .attributeDecl (elementName, name, type, defaultType, value); - } - - /** - * Parse a conditional section. - * <pre> - * [61] conditionalSect ::= includeSect || ignoreSect - * [62] includeSect ::= '<![' S? 'INCLUDE' S? '[' - * extSubsetDecl ']]>' - * [63] ignoreSect ::= '<![' S? 'IGNORE' S? '[' - * ignoreSectContents* ']]>' - * [64] ignoreSectContents ::= Ignore - * ('<![' ignoreSectContents* ']]>' Ignore )* - * [65] Ignore ::= Char* - (Char* ( '<![' | ']]>') Char* ) - * </pre> - * <p> NOTE: the '>![' has already been read. - */ - private void parseConditionalSect (char saved []) + /** + * Parse the default value for an attribute. + * <pre> + * [60] DefaultDecl ::= '#REQUIRED' | '#IMPLIED' + * | (('#FIXED' S)? AttValue) + * </pre> + */ + private void parseDefault(String elementName, String name, + String type, String enumer) throws Exception - { - skipWhitespace (); - if (tryRead ("INCLUDE")) { - skipWhitespace (); - require ('['); - // VC: Proper Conditional Section/PE Nesting - if (readBuffer != saved) - handler.verror ("Illegal Conditional Section/PE nesting"); - skipWhitespace (); - while (!tryRead ("]]>")) { - parseMarkupdecl (); - skipWhitespace (); - } - } else if (tryRead ("IGNORE")) { - skipWhitespace (); - require ('['); - // VC: Proper Conditional Section/PE Nesting - if (readBuffer != saved) - handler.verror ("Illegal Conditional Section/PE nesting"); - int nesting = 1; - char c; - expandPE = false; - for (int nest = 1; nest > 0;) { - c = readCh (); - switch (c) { - case '<': - if (tryRead ("![")) { - nest++; - } - case ']': - if (tryRead ("]>")) { - nest--; - } - } - } - expandPE = true; - } else { - error ("conditional section must begin with INCLUDE or IGNORE"); - } - } - - private void parseCharRef () + { + int valueType = ATTRIBUTE_DEFAULT_SPECIFIED; + String value = null; + int flags = LIT_ATTRIBUTE; + boolean saved = expandPE; + String defaultType = null; + + // LIT_ATTRIBUTE forces '<' checks now (ASAP) and turns whitespace + // chars to spaces (doesn't matter when that's done if it doesn't + // interfere with char refs expanding to whitespace). + + if (!skippedPE) + { + flags |= LIT_ENTITY_REF; + if (handler.stringInterning) + { + if ("CDATA" != type) + { + flags |= LIT_NORMALIZE; + } + } + else + { + if (!"CDATA".equals(type)) + { + flags |= LIT_NORMALIZE; + } + } + } + + expandPE = false; + if (tryRead('#')) + { + if (tryRead("FIXED")) + { + defaultType = "#FIXED"; + valueType = ATTRIBUTE_DEFAULT_FIXED; + requireWhitespace(); + value = readLiteral(flags); + } + else if (tryRead("REQUIRED")) + { + defaultType = "#REQUIRED"; + valueType = ATTRIBUTE_DEFAULT_REQUIRED; + } + else if (tryRead("IMPLIED")) + { + defaultType = "#IMPLIED"; + valueType = ATTRIBUTE_DEFAULT_IMPLIED; + } + else + { + error("illegal keyword for attribute default value"); + } + } + else + { + value = readLiteral(flags); + } + expandPE = saved; + setAttribute(elementName, name, type, enumer, value, valueType); + if (handler.stringInterning) + { + if ("ENUMERATION" == type) + { + type = enumer; + } + else if ("NOTATION" == type) + { + type = "NOTATION " + enumer; + } + } + else + { + if ("ENUMERATION".equals(type)) + { + type = enumer; + } + else if ("NOTATION".equals(type)) + { + type = "NOTATION " + enumer; + } + } + if (!skippedPE) + { + handler.getDeclHandler().attributeDecl(elementName, name, type, + defaultType, value); + } + } + + /** + * Parse a conditional section. + * <pre> + * [61] conditionalSect ::= includeSect || ignoreSect + * [62] includeSect ::= '<![' S? 'INCLUDE' S? '[' + * extSubsetDecl ']]>' + * [63] ignoreSect ::= '<![' S? 'IGNORE' S? '[' + * ignoreSectContents* ']]>' + * [64] ignoreSectContents ::= Ignore + * ('<![' ignoreSectContents* ']]>' Ignore )* + * [65] Ignore ::= Char* - (Char* ( '<![' | ']]>') Char* ) + * </pre> + * <p> NOTE: the '>![' has already been read. + */ + private void parseConditionalSect(char[] saved) + throws Exception + { + skipWhitespace(); + if (tryRead("INCLUDE")) + { + skipWhitespace(); + require('['); + // VC: Proper Conditional Section/PE Nesting + if (readBuffer != saved) + { + handler.verror("Illegal Conditional Section/PE nesting"); + } + skipWhitespace(); + while (!tryRead("]]>")) + { + parseMarkupdecl(); + skipWhitespace(); + } + } + else if (tryRead("IGNORE")) + { + skipWhitespace(); + require('['); + // VC: Proper Conditional Section/PE Nesting + if (readBuffer != saved) + { + handler.verror("Illegal Conditional Section/PE nesting"); + } + int nesting = 1; + char c; + expandPE = false; + for (int nest = 1; nest > 0; ) + { + c = readCh(); + switch (c) + { + case '<': + if (tryRead("![")) + { + nest++; + } + case ']': + if (tryRead("]>")) + { + nest--; + } + } + } + expandPE = true; + } + else + { + error("conditional section must begin with INCLUDE or IGNORE"); + } + } + + private void parseCharRef() throws SAXException, IOException { - parseCharRef (true /* do flushDataBuffer by default */); + parseCharRef(true /* do flushDataBuffer by default */); } /** @@ -1830,1485 +2213,1717 @@ loop: * </pre> * <p>NOTE: the '&#' has already been read. */ - private void tryReadCharRef () - throws SAXException, IOException + private void tryReadCharRef() + throws SAXException, IOException { - int value = 0; - char c; - - if (tryRead ('x')) { + int value = 0; + char c; + + if (tryRead('x')) + { loop1: - while (true) { - c = readCh (); - int n; - switch (c) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - n = c - '0'; - break; - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - n = (c - 'a') + 10; - break; - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - n = (c - 'A') + 10; - break; - case ';': - break loop1; - default: - error ("illegal character in character reference", c, null); - break loop1; - } - value *= 16; - value += n; - } - } else { + while (true) + { + c = readCh(); + if (c == ';') + { + break loop1; + } + else + { + int n = Character.digit(c, 16); + if (n == -1) + { + error("illegal character in character reference", c, null); + break loop1; + } + value *= 16; + value += n; + } + } + } + else + { loop2: - while (true) { - c = readCh (); - switch (c) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - value *= 10; - value += c - '0'; - break; - case ';': - break loop2; - default: - error ("illegal character in character reference", c, null); - break loop2; - } - } - } - - // check for character refs being legal XML - if ((value < 0x0020 - && ! (value == '\n' || value == '\t' || value == '\r')) - || (value >= 0xD800 && value <= 0xDFFF) - || value == 0xFFFE || value == 0xFFFF - || value > 0x0010ffff) - error ("illegal XML character reference U+" - + Integer.toHexString (value)); - - // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz - // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: - if (value > 0x0010ffff) { - // too big for surrogate - error ("character reference " + value + " is too large for UTF-16", - new Integer (value).toString (), null); - } - + while (true) + { + c = readCh(); + if (c == ';') + { + break loop2; + } + else + { + int n = Character.digit(c, 10); + if (n == -1) + { + error("illegal character in character reference", c, null); + break loop2; + } + value *= 10; + value += n; + } + } + } + + // check for character refs being legal XML + if ((value < 0x0020 + && ! (value == '\n' || value == '\t' || value == '\r')) + || (value >= 0xD800 && value <= 0xDFFF) + || value == 0xFFFE || value == 0xFFFF + || value > 0x0010ffff) + { + error("illegal XML character reference U+" + + Integer.toHexString(value)); + } + + // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz + // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: + if (value > 0x0010ffff) + { + // too big for surrogate + error("character reference " + value + " is too large for UTF-16", + new Integer(value).toString(), null); + } + } - /** - * Read and interpret a character reference. - * <pre> - * [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' - * </pre> - * <p>NOTE: the '&#' has already been read. - */ - private void parseCharRef (boolean doFlush) + /** + * Read and interpret a character reference. + * <pre> + * [66] CharRef ::= '&#' [0-9]+ ';' | '&#x' [0-9a-fA-F]+ ';' + * </pre> + * <p>NOTE: the '&#' has already been read. + */ + private void parseCharRef(boolean doFlush) throws SAXException, IOException - { - int value = 0; - char c; - - if (tryRead ('x')) { + { + int value = 0; + char c; + + if (tryRead('x')) + { loop1: - while (true) { - c = readCh (); - int n; - switch (c) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - n = c - '0'; - break; - case 'a': case 'b': case 'c': case 'd': case 'e': case 'f': - n = (c - 'a') + 10; - break; - case 'A': case 'B': case 'C': case 'D': case 'E': case 'F': - n = (c - 'A') + 10; - break; - case ';': - break loop1; - default: - error ("illegal character in character reference", c, null); - break loop1; - } - value *= 16; - value += n; - } - } else { + while (true) + { + c = readCh(); + if (c == ';') + { + break loop1; + } + else + { + int n = Character.digit(c, 16); + if (n == -1) + { + error("illegal character in character reference", c, null); + break loop1; + } + value *= 16; + value += n; + } + } + } + else + { loop2: - while (true) { - c = readCh (); - switch (c) { - case '0': case '1': case '2': case '3': case '4': - case '5': case '6': case '7': case '8': case '9': - value *= 10; - value += c - '0'; - break; - case ';': - break loop2; - default: - error ("illegal character in character reference", c, null); - break loop2; - } - } - } - - // check for character refs being legal XML - if ((value < 0x0020 - && ! (value == '\n' || value == '\t' || value == '\r')) - || (value >= 0xD800 && value <= 0xDFFF) - || value == 0xFFFE || value == 0xFFFF - || value > 0x0010ffff) - error ("illegal XML character reference U+" - + Integer.toHexString (value)); - - // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz - // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: - if (value <= 0x0000ffff) { - // no surrogates needed - dataBufferAppend ((char) value); - } else if (value <= 0x0010ffff) { - value -= 0x10000; - // > 16 bits, surrogate needed - dataBufferAppend ((char) (0xd800 | (value >> 10))); - dataBufferAppend ((char) (0xdc00 | (value & 0x0003ff))); - } else { - // too big for surrogate - error ("character reference " + value + " is too large for UTF-16", - new Integer (value).toString (), null); - } - if (doFlush) dataBufferFlush (); - } - - - /** - * Parse and expand an entity reference. - * <pre> - * [68] EntityRef ::= '&' Name ';' - * </pre> - * <p>NOTE: the '&' has already been read. - * @param externalAllowed External entities are allowed here. - */ - private void parseEntityRef (boolean externalAllowed) + while (true) + { + c = readCh(); + if (c == ';') + { + break loop2; + } + else + { + int n = Character.digit(c, 10); + if (n == -1) + { + error("illegal character in character reference", c, null); + break loop2; + } + value *= 10; + value += c - '0'; + } + } + } + + // check for character refs being legal XML + if ((value < 0x0020 + && ! (value == '\n' || value == '\t' || value == '\r')) + || (value >= 0xD800 && value <= 0xDFFF) + || value == 0xFFFE || value == 0xFFFF + || value > 0x0010ffff) + { + error("illegal XML character reference U+" + + Integer.toHexString(value)); + } + + // Check for surrogates: 00000000 0000xxxx yyyyyyyy zzzzzzzz + // (1101|10xx|xxyy|yyyy + 1101|11yy|zzzz|zzzz: + if (value <= 0x0000ffff) + { + // no surrogates needed + dataBufferAppend((char) value); + } + else if (value <= 0x0010ffff) + { + value -= 0x10000; + // > 16 bits, surrogate needed + dataBufferAppend((char) (0xd800 | (value >> 10))); + dataBufferAppend((char) (0xdc00 | (value & 0x0003ff))); + } + else + { + // too big for surrogate + error("character reference " + value + " is too large for UTF-16", + new Integer(value).toString(), null); + } + if (doFlush) + { + dataBufferFlush(); + } + } + + /** + * Parse and expand an entity reference. + * <pre> + * [68] EntityRef ::= '&' Name ';' + * </pre> + * <p>NOTE: the '&' has already been read. + * @param externalAllowed External entities are allowed here. + */ + private void parseEntityRef(boolean externalAllowed) throws SAXException, IOException - { - String name; - - name = readNmtoken (true); - require (';'); - switch (getEntityType (name)) { - case ENTITY_UNDECLARED: - // NOTE: XML REC describes amazingly convoluted handling for - // this case. Nothing as meaningful as being a WFness error - // unless the processor might _legitimately_ not have seen a - // declaration ... which is what this implements. - String message; - - message = "reference to undeclared general entity " + name; - if (skippedPE && !docIsStandalone) { - handler.verror (message); - // we don't know this entity, and it might be external... - if (externalAllowed) - handler.skippedEntity (name); - } else - error (message); - break; - case ENTITY_INTERNAL: - pushString (name, getEntityValue (name)); - - //workaround for possible input pop before marking - //the buffer reading position - char t = readCh (); - unread (t); - int bufferPosMark = readBufferPos; - - int end = readBufferPos + getEntityValue (name).length(); - for(int k = readBufferPos; k < end; k++){ - t = readCh (); - if (t == '&'){ - t = readCh (); - if (t == '#'){ - //try to match a character ref - tryReadCharRef (); - - //everything has been read - if (readBufferPos >= end) - break; - k = readBufferPos; - continue; - } - else if (Character.isLetter(t)){ - //looks like an entity ref - unread (t); - readNmtoken (true); - require (';'); - - //everything has been read - if (readBufferPos >= end) - break; - k = readBufferPos; - continue; - } - error(" malformed entity reference"); - } - + { + String name; + + name = readNmtoken(true); + require(';'); + switch (getEntityType(name)) + { + case ENTITY_UNDECLARED: + // NOTE: XML REC describes amazingly convoluted handling for + // this case. Nothing as meaningful as being a WFness error + // unless the processor might _legitimately_ not have seen a + // declaration ... which is what this implements. + String message; + + message = "reference to undeclared general entity " + name; + if (skippedPE && !docIsStandalone) + { + handler.verror(message); + // we don't know this entity, and it might be external... + if (externalAllowed) + { + handler.skippedEntity(name); + } + } + else + { + error(message); + } + break; + case ENTITY_INTERNAL: + pushString(name, getEntityValue(name)); + + //workaround for possible input pop before marking + //the buffer reading position + char t = readCh(); + unread(t); + int bufferPosMark = readBufferPos; + + int end = readBufferPos + getEntityValue(name).length(); + for (int k = readBufferPos; k < end; k++) + { + t = readCh(); + if (t == '&') + { + t = readCh(); + if (t == '#') + { + //try to match a character ref + tryReadCharRef(); + + //everything has been read + if (readBufferPos >= end) + { + break; + } + k = readBufferPos; + continue; + } + else if (Character.isLetter(t)) + { + //looks like an entity ref + unread(t); + readNmtoken(true); + require(';'); + + //everything has been read + if (readBufferPos >= end) + { + break; + } + k = readBufferPos; + continue; + } + error(" malformed entity reference"); + } + } - readBufferPos = bufferPosMark; - break; - case ENTITY_TEXT: - if (externalAllowed) { - pushURL (false, name, getEntityIds (name), - null, null, null, true); - } else { - error ("reference to external entity in attribute value.", - name, null); - } - break; - case ENTITY_NDATA: - if (externalAllowed) { - error ("unparsed entity reference in content", name, null); - } else { - error ("reference to external entity in attribute value.", - name, null); - } - break; - default: - throw new RuntimeException (); - } - } - - - /** - * Parse and expand a parameter entity reference. - * <pre> - * [69] PEReference ::= '%' Name ';' - * </pre> - * <p>NOTE: the '%' has already been read. - */ - private void parsePEReference () + readBufferPos = bufferPosMark; + break; + case ENTITY_TEXT: + if (externalAllowed) + { + pushURL(false, name, getEntityIds(name), + null, null, null, true); + } + else + { + error("reference to external entity in attribute value.", + name, null); + } + break; + case ENTITY_NDATA: + if (externalAllowed) + { + error("unparsed entity reference in content", name, null); + } + else + { + error("reference to external entity in attribute value.", + name, null); + } + break; + default: + throw new RuntimeException(); + } + } + + /** + * Parse and expand a parameter entity reference. + * <pre> + * [69] PEReference ::= '%' Name ';' + * </pre> + * <p>NOTE: the '%' has already been read. + */ + private void parsePEReference() throws SAXException, IOException - { - String name; - - name = "%" + readNmtoken (true); - require (';'); - switch (getEntityType (name)) { - case ENTITY_UNDECLARED: - // VC: Entity Declared - handler.verror ("reference to undeclared parameter entity " + name); - - // we should disable handling of all subsequent declarations - // unless this is a standalone document (info discarded) - break; - case ENTITY_INTERNAL: - if (inLiteral) - pushString (name, getEntityValue (name)); - else - pushString (name, ' ' + getEntityValue (name) + ' '); - break; - case ENTITY_TEXT: - if (!inLiteral) - pushString (null, " "); - pushURL (true, name, getEntityIds (name), null, null, null, true); - if (!inLiteral) - pushString (null, " "); - break; - } - } - - /** - * Parse an entity declaration. - * <pre> - * [70] EntityDecl ::= GEDecl | PEDecl - * [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>' - * [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>' - * [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) - * [74] PEDef ::= EntityValue | ExternalID - * [75] ExternalID ::= 'SYSTEM' S SystemLiteral - * | 'PUBLIC' S PubidLiteral S SystemLiteral - * [76] NDataDecl ::= S 'NDATA' S Name - * </pre> - * <p>NOTE: the '<!ENTITY' has already been read. - */ - private void parseEntityDecl () + { + String name; + + name = "%" + readNmtoken(true); + require(';'); + switch (getEntityType(name)) + { + case ENTITY_UNDECLARED: + // VC: Entity Declared + handler.verror("reference to undeclared parameter entity " + name); + + // we should disable handling of all subsequent declarations + // unless this is a standalone document (info discarded) + break; + case ENTITY_INTERNAL: + if (inLiteral) + { + pushString(name, getEntityValue(name)); + } + else + { + pushString(name, ' ' + getEntityValue(name) + ' '); + } + break; + case ENTITY_TEXT: + if (!inLiteral) + { + pushString(null, " "); + } + pushURL(true, name, getEntityIds(name), null, null, null, true); + if (!inLiteral) + { + pushString(null, " "); + } + break; + } + } + + /** + * Parse an entity declaration. + * <pre> + * [70] EntityDecl ::= GEDecl | PEDecl + * [71] GEDecl ::= '<!ENTITY' S Name S EntityDef S? '>' + * [72] PEDecl ::= '<!ENTITY' S '%' S Name S PEDef S? '>' + * [73] EntityDef ::= EntityValue | (ExternalID NDataDecl?) + * [74] PEDef ::= EntityValue | ExternalID + * [75] ExternalID ::= 'SYSTEM' S SystemLiteral + * | 'PUBLIC' S PubidLiteral S SystemLiteral + * [76] NDataDecl ::= S 'NDATA' S Name + * </pre> + * <p>NOTE: the '<!ENTITY' has already been read. + */ + private void parseEntityDecl() throws Exception - { - boolean peFlag = false; - int flags = 0; - - // Check for a parameter entity. - expandPE = false; - requireWhitespace (); - if (tryRead ('%')) { - peFlag = true; - requireWhitespace (); - } - expandPE = true; - - // Read the entity name, and prepend - // '%' if necessary. - String name = readNmtoken (true); - //NE08 - if (name.indexOf(':') >= 0) - error ("Illegal character(':') in entity name ", name, null); - if (peFlag) { - name = "%" + name; - } - - // Read the entity value. - requireWhitespace (); - char c = readCh (); - unread (c); - if (c == '"' || c == '\'') { - // Internal entity ... replacement text has expanded refs - // to characters and PEs, but not to general entities - String value = readLiteral (flags); - setInternalEntity (name, value); - } else { - // Read the external IDs - String ids [] = readExternalIds (false, false); - - // Check for NDATA declaration. - boolean white = tryWhitespace (); - if (!peFlag && tryRead ("NDATA")) { - if (!white) - error ("whitespace required before NDATA"); - requireWhitespace (); - String notationName = readNmtoken (true); - if (!skippedPE) { - setExternalEntity (name, ENTITY_NDATA, ids, notationName); - handler.unparsedEntityDecl (name, ids, notationName); - } - } else if (!skippedPE) { - setExternalEntity (name, ENTITY_TEXT, ids, null); - handler.getDeclHandler () - .externalEntityDecl (name, ids [0], - handler.resolveURIs () - // FIXME: ASSUMES not skipped - // "false" forces error on bad URI - ? handler.absolutize (ids [2], ids [1], false) - : ids [1]); - } - } - - // Finish the declaration. - skipWhitespace (); - require ('>'); - } + { + boolean peFlag = false; + int flags = 0; + + // Check for a parameter entity. + expandPE = false; + requireWhitespace(); + if (tryRead('%')) + { + peFlag = true; + requireWhitespace(); + } + expandPE = true; + + // Read the entity name, and prepend + // '%' if necessary. + String name = readNmtoken(true); + //NE08 + if (name.indexOf(':') >= 0) + { + error("Illegal character(':') in entity name ", name, null); + } + if (peFlag) + { + name = "%" + name; + } + // Read the entity value. + requireWhitespace(); + char c = readCh(); + unread (c); + if (c == '"' || c == '\'') + { + // Internal entity ... replacement text has expanded refs + // to characters and PEs, but not to general entities + String value = readLiteral(flags); + setInternalEntity(name, value); + } + else + { + // Read the external IDs + ExternalIdentifiers ids = readExternalIds(false, false); + + // Check for NDATA declaration. + boolean white = tryWhitespace(); + if (!peFlag && tryRead("NDATA")) + { + if (!white) + { + error("whitespace required before NDATA"); + } + requireWhitespace(); + String notationName = readNmtoken(true); + if (!skippedPE) + { + setExternalEntity(name, ENTITY_NDATA, ids, notationName); + handler.unparsedEntityDecl(name, ids.publicId, ids.systemId, + ids.baseUri, notationName); + } + } + else if (!skippedPE) + { + setExternalEntity(name, ENTITY_TEXT, ids, null); + handler.getDeclHandler() + .externalEntityDecl(name, ids.publicId, + handler.resolveURIs() + // FIXME: ASSUMES not skipped + // "false" forces error on bad URI + ? handler.absolutize(ids.baseUri, + ids.systemId, + false) + : ids.systemId); + } + } + + // Finish the declaration. + skipWhitespace(); + require('>'); + } - /** - * Parse a notation declaration. - * <pre> - * [82] NotationDecl ::= '<!NOTATION' S Name S - * (ExternalID | PublicID) S? '>' - * [83] PublicID ::= 'PUBLIC' S PubidLiteral - * </pre> - * <P>NOTE: the '<!NOTATION' has already been read. - */ - private void parseNotationDecl () + /** + * Parse a notation declaration. + * <pre> + * [82] NotationDecl ::= '<!NOTATION' S Name S + * (ExternalID | PublicID) S? '>' + * [83] PublicID ::= 'PUBLIC' S PubidLiteral + * </pre> + * <P>NOTE: the '<!NOTATION' has already been read. + */ + private void parseNotationDecl() throws Exception - { - String nname, ids[]; - - - requireWhitespace (); - nname = readNmtoken (true); - //NE08 - if (nname.indexOf(':') >= 0) - error ("Illegal character(':') in notation name ", nname, null); - requireWhitespace (); - - // Read the external identifiers. - ids = readExternalIds (true, false); - - // Register the notation. - setNotation (nname, ids); - - skipWhitespace (); - require ('>'); - } + { + String nname; + ExternalIdentifiers ids; + + requireWhitespace(); + nname = readNmtoken(true); + //NE08 + if (nname.indexOf(':') >= 0) + { + error("Illegal character(':') in notation name ", nname, null); + } + requireWhitespace(); + // Read the external identifiers. + ids = readExternalIds(true, false); - /** - * Parse character data. - * <pre> - * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) - * </pre> - */ - private void parseCharData () + // Register the notation. + setNotation(nname, ids); + + skipWhitespace(); + require('>'); + } + + /** + * Parse character data. + * <pre> + * [14] CharData ::= [^<&]* - ([^<&]* ']]>' [^<&]*) + * </pre> + */ + private void parseCharData() throws Exception - { - char c; - int state = 0; - boolean pureWhite = false; - - // assert (dataBufferPos == 0); - - // are we expecting pure whitespace? it might be dirty... - if ((currentElementContent == CONTENT_ELEMENTS) && !isDirtyCurrentElement) - pureWhite = true; + { + char c; + int state = 0; + boolean pureWhite = false; - // always report right out of readBuffer - // to minimize (pointless) buffer copies - while (true) { - int lineAugment = 0; - int columnAugment = 0; - int i; + // assert (dataBufferPos == 0); + + // are we expecting pure whitespace? it might be dirty... + if ((currentElementContent == CONTENT_ELEMENTS) && !isDirtyCurrentElement) + { + pureWhite = true; + } + // always report right out of readBuffer + // to minimize (pointless) buffer copies + while (true) + { + int lineAugment = 0; + int columnAugment = 0; + int i; + loop: - for (i = readBufferPos; i < readBufferLength; i++) { - switch (c = readBuffer [i]) { - case '\n': - lineAugment++; - columnAugment = 0; - // pureWhite unmodified - break; - case '\r': // should not happen!! - case '\t': - case ' ': - // pureWhite unmodified - columnAugment++; - break; - case '&': - case '<': - columnAugment++; - // pureWhite unmodified - // CLEAN end of text sequence - state = 1; - break loop; - case ']': - // that's not a whitespace char, and - // can not terminate pure whitespace either - pureWhite = false; - if ((i + 2) < readBufferLength) { - if (readBuffer [i + 1] == ']' - && readBuffer [i + 2] == '>') { - // ERROR end of text sequence - state = 2; - break loop; - } - } else { - // FIXME missing two end-of-buffer cases - } - columnAugment++; - break; - default: - if ((c < 0x0020 || c > 0xFFFD) - || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085) - && xmlVersion == XML_11)) - error ("illegal XML character U+" - + Integer.toHexString (c)); - // that's not a whitespace char - pureWhite = false; - columnAugment++; - } - } - - // report text thus far - if (lineAugment > 0) { - line += lineAugment; - column = columnAugment; - } else { - column += columnAugment; - } - - // report characters/whitspace - int length = i - readBufferPos; - - if (length != 0) { - if (pureWhite) - handler.ignorableWhitespace (readBuffer, - readBufferPos, length); - else - handler.charData (readBuffer, readBufferPos, length); - readBufferPos = i; - } - - if (state != 0) - break; - - // fill next buffer from this entity, or - // pop stack and continue with previous entity - unread (readCh ()); - } - if (!pureWhite) - isDirtyCurrentElement = true; - // finish, maybe with error - if (state != 1) // finish, no error - error ("character data may not contain ']]>'"); - } - - - ////////////////////////////////////////////////////////////////////// - // High-level reading and scanning methods. - ////////////////////////////////////////////////////////////////////// - - /** - * Require whitespace characters. - */ - private void requireWhitespace () + for (i = readBufferPos; i < readBufferLength; i++) + { + switch (c = readBuffer[i]) + { + case '\n': + lineAugment++; + columnAugment = 0; + // pureWhite unmodified + break; + case '\r': // should not happen!! + case '\t': + case ' ': + // pureWhite unmodified + columnAugment++; + break; + case '&': + case '<': + columnAugment++; + // pureWhite unmodified + // CLEAN end of text sequence + state = 1; + break loop; + case ']': + // that's not a whitespace char, and + // can not terminate pure whitespace either + pureWhite = false; + if ((i + 2) < readBufferLength) + { + if (readBuffer [i + 1] == ']' + && readBuffer [i + 2] == '>') + { + // ERROR end of text sequence + state = 2; + break loop; + } + } + else + { + // FIXME missing two end-of-buffer cases + } + columnAugment++; + break; + default: + if ((c < 0x0020 || c > 0xFFFD) + || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085) + && xmlVersion == XML_11)) + { + error("illegal XML character U+" + + Integer.toHexString(c)); + } + // that's not a whitespace char + pureWhite = false; + columnAugment++; + } + } + + // report text thus far + if (lineAugment > 0) + { + line += lineAugment; + column = columnAugment; + } + else + { + column += columnAugment; + } + + // report characters/whitspace + int length = i - readBufferPos; + + if (length != 0) + { + if (pureWhite) + { + handler.ignorableWhitespace(readBuffer, + readBufferPos, length); + } + else + { + handler.charData(readBuffer, readBufferPos, length); + } + readBufferPos = i; + } + + if (state != 0) + { + break; + } + + // fill next buffer from this entity, or + // pop stack and continue with previous entity + unread(readCh()); + } + if (!pureWhite) + { + isDirtyCurrentElement = true; + } + // finish, maybe with error + if (state != 1) // finish, no error + { + error("character data may not contain ']]>'"); + } + } + + ////////////////////////////////////////////////////////////////////// + // High-level reading and scanning methods. + ////////////////////////////////////////////////////////////////////// + + /** + * Require whitespace characters. + */ + private void requireWhitespace() throws SAXException, IOException - { - char c = readCh (); - if (isWhitespace (c)) { - skipWhitespace (); - } else { - error ("whitespace required", c, null); - } - } - + { + char c = readCh(); + if (isWhitespace(c)) + { + skipWhitespace(); + } + else + { + error("whitespace required", c, null); + } + } - /** - * Skip whitespace characters. - * <pre> - * [3] S ::= (#x20 | #x9 | #xd | #xa)+ - * </pre> - */ - private void skipWhitespace () + /** + * Skip whitespace characters. + * <pre> + * [3] S ::= (#x20 | #x9 | #xd | #xa)+ + * </pre> + */ + private void skipWhitespace() throws SAXException, IOException - { - // Start with a little cheat. Most of - // the time, the white space will fall - // within the current read buffer; if - // not, then fall through. - if (USE_CHEATS) { - int lineAugment = 0; - int columnAugment = 0; - + { + // Start with a little cheat. Most of + // the time, the white space will fall + // within the current read buffer; if + // not, then fall through. + if (USE_CHEATS) + { + int lineAugment = 0; + int columnAugment = 0; + loop: - for (int i = readBufferPos; i < readBufferLength; i++) { - switch (readBuffer [i]) { - case ' ': - case '\t': - case '\r': - columnAugment++; - break; - case '\n': - lineAugment++; - columnAugment = 0; - break; - case '%': - if (expandPE) - break loop; - // else fall through... - default: - readBufferPos = i; - if (lineAugment > 0) { - line += lineAugment; - column = columnAugment; - } else { - column += columnAugment; - } - return; - } - } - } - - // OK, do it the slow way. - char c = readCh (); - while (isWhitespace (c)) { - c = readCh (); - } - unread (c); - } - - - /** - * Read a name or (when parsing an enumeration) name token. - * <pre> - * [5] Name ::= (Letter | '_' | ':') (NameChar)* - * [7] Nmtoken ::= (NameChar)+ - * </pre> - */ - private String readNmtoken (boolean isName) + for (int i = readBufferPos; i < readBufferLength; i++) + { + switch (readBuffer[i]) + { + case ' ': + case '\t': + case '\r': + columnAugment++; + break; + case '\n': + lineAugment++; + columnAugment = 0; + break; + case '%': + if (expandPE) + { + break loop; + } + // else fall through... + default: + readBufferPos = i; + if (lineAugment > 0) + { + line += lineAugment; + column = columnAugment; + } + else + { + column += columnAugment; + } + return; + } + } + } + + // OK, do it the slow way. + char c = readCh (); + while (isWhitespace(c)) + { + c = readCh(); + } + unread(c); + } + + /** + * Read a name or (when parsing an enumeration) name token. + * <pre> + * [5] Name ::= (Letter | '_' | ':') (NameChar)* + * [7] Nmtoken ::= (NameChar)+ + * </pre> + */ + private String readNmtoken(boolean isName) throws SAXException, IOException - { - char c; - - if (USE_CHEATS) { -loop: - for (int i = readBufferPos; i < readBufferLength; i++) { - c = readBuffer [i]; - switch (c) { - case '%': - if (expandPE) - break loop; - // else fall through... - - // What may legitimately come AFTER a name/nmtoken? - case '<': case '>': case '&': - case ',': case '|': case '*': case '+': case '?': - case ')': - case '=': - case '\'': case '"': - case '[': - case ' ': case '\t': case '\r': case '\n': - case ';': - case '/': - int start = readBufferPos; - if (i == start) - error ("name expected", readBuffer [i], null); - readBufferPos = i; - return intern (readBuffer, start, i - start); - - default: -// FIXME ... per IBM's OASIS test submission, these: -// ? U+06dd -// Combining U+309B - //these switches are kind of ugly but at least we won't - //have to go over the whole lits for each char - if (isName && i == readBufferPos){ - char c2 = (char) (c & 0x00f0); - switch (c & 0xff00){ - //starting with 01 - case 0x0100: - switch (c2){ - case 0x0030: - if (c == 0x0132 || c == 0x0133 || c == 0x013f) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x0040: - if (c == 0x0140 || c == 0x0149) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x00c0: - if (c == 0x01c4 || c == 0x01cc) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x00f0: - if (c == 0x01f1 || c == 0x01f3) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x00b0: - if (c == 0x01f1 || c == 0x01f3) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - default: - if (c == 0x017f) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - } - - break; - //starting with 11 - case 0x1100: - switch (c2){ - case 0x0000: - if (c == 0x1104 || c == 0x1108 || - c == 0x110a || c == 0x110d) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x0030: - if (c == 0x113b || c == 0x113f) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x0040: - if (c == 0x1141 || c == 0x114d - || c == 0x114f ) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x0050: - if (c == 0x1151 || c == 0x1156) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x0060: - if (c == 0x1162 || c == 0x1164 - || c == 0x1166 || c == 0x116b - || c == 0x116f) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - case 0x00b0: - if (c == 0x11b6 || c == 0x11b9 - || c == 0x11bb || c == 0x116f) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - break; - default: - if (c == 0x1174 || c == 0x119f - || c == 0x11ac || c == 0x11c3 - || c == 0x11f1) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - } - break; - default: - if (c == 0x0e46 || c == 0x1011 - || c == 0x212f || c == 0x0587 - || c == 0x0230 ) - error ("Not a name start character, U+" - + Integer.toHexString (c)); - } - } - // punt on exact tests from Appendix A; approximate - // them using the Unicode ID start/part rules - if (i == readBufferPos && isName) { - if (!Character.isUnicodeIdentifierStart (c) - && c != ':' && c != '_') - error ("Not a name start character, U+" - + Integer.toHexString (c)); - } else if (!Character.isUnicodeIdentifierPart (c) - && c != '-' && c != ':' && c != '_' && c != '.' - && !isExtender (c)) - error ("Not a name character, U+" - + Integer.toHexString (c)); - } - } - } - - nameBufferPos = 0; - - // Read the first character. + { + char c; + + if (USE_CHEATS) + { loop: - while (true) { - c = readCh (); - switch (c) { - case '%': - case '<': case '>': case '&': - case ',': case '|': case '*': case '+': case '?': - case ')': - case '=': - case '\'': case '"': - case '[': - case ' ': case '\t': case '\n': case '\r': - case ';': - case '/': - unread (c); - if (nameBufferPos == 0) { - error ("name expected"); - } - // punt on exact tests from Appendix A, but approximate them - if (isName - && !Character.isUnicodeIdentifierStart ( - nameBuffer [0]) - && ":_".indexOf (nameBuffer [0]) == -1) - error ("Not a name start character, U+" - + Integer.toHexString (nameBuffer [0])); - String s = intern (nameBuffer, 0, nameBufferPos); - nameBufferPos = 0; - return s; - default: - // punt on exact tests from Appendix A, but approximate them - - if ((nameBufferPos != 0 || !isName) - && !Character.isUnicodeIdentifierPart (c) - && ":-_.".indexOf (c) == -1 - && !isExtender (c)) - error ("Not a name character, U+" - + Integer.toHexString (c)); - if (nameBufferPos >= nameBuffer.length) - nameBuffer = - (char[]) extendArray (nameBuffer, - nameBuffer.length, nameBufferPos); - nameBuffer [nameBufferPos++] = c; - } - } - } - - private static boolean isExtender (char c) - { - // [88] Extender ::= ... - return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387 - || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005 - || (c >= 0x3031 && c <= 0x3035) - || (c >= 0x309d && c <= 0x309e) - || (c >= 0x30fc && c <= 0x30fe); - } + for (int i = readBufferPos; i < readBufferLength; i++) + { + c = readBuffer[i]; + switch (c) + { + case '%': + if (expandPE) + { + break loop; + } + // else fall through... + + // What may legitimately come AFTER a name/nmtoken? + case '<': case '>': case '&': + case ',': case '|': case '*': case '+': case '?': + case ')': + case '=': + case '\'': case '"': + case '[': + case ' ': case '\t': case '\r': case '\n': + case ';': + case '/': + int start = readBufferPos; + if (i == start) + { + error("name expected", readBuffer[i], null); + } + readBufferPos = i; + return intern(readBuffer, start, i - start); + + default: + // FIXME ... per IBM's OASIS test submission, these: + // ? U+06dd + // Combining U+309B + //these switches are kind of ugly but at least we won't + //have to go over the whole lits for each char + if (isName && i == readBufferPos) + { + char c2 = (char) (c & 0x00f0); + switch (c & 0xff00) + { + //starting with 01 + case 0x0100: + switch (c2) + { + case 0x0030: + if (c == 0x0132 || c == 0x0133 || c == 0x013f) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x0040: + if (c == 0x0140 || c == 0x0149) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x00c0: + if (c == 0x01c4 || c == 0x01cc) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x00f0: + if (c == 0x01f1 || c == 0x01f3) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x00b0: + if (c == 0x01f1 || c == 0x01f3) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + default: + if (c == 0x017f) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + } + + break; + //starting with 11 + case 0x1100: + switch (c2) + { + case 0x0000: + if (c == 0x1104 || c == 0x1108 || + c == 0x110a || c == 0x110d) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x0030: + if (c == 0x113b || c == 0x113f) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x0040: + if (c == 0x1141 || c == 0x114d + || c == 0x114f ) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x0050: + if (c == 0x1151 || c == 0x1156) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x0060: + if (c == 0x1162 || c == 0x1164 + || c == 0x1166 || c == 0x116b + || c == 0x116f) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + case 0x00b0: + if (c == 0x11b6 || c == 0x11b9 + || c == 0x11bb || c == 0x116f) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + break; + default: + if (c == 0x1174 || c == 0x119f + || c == 0x11ac || c == 0x11c3 + || c == 0x11f1) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + } + break; + default: + if (c == 0x0e46 || c == 0x1011 + || c == 0x212f || c == 0x0587 + || c == 0x0230 ) + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + } + } + // punt on exact tests from Appendix A; approximate + // them using the Unicode ID start/part rules + if (i == readBufferPos && isName) + { + if (!Character.isUnicodeIdentifierStart(c) + && c != ':' && c != '_') + { + error("Not a name start character, U+" + + Integer.toHexString(c)); + } + } + else if (!Character.isUnicodeIdentifierPart(c) + && c != '-' && c != ':' && c != '_' && c != '.' + && !isExtender(c)) + { + error("Not a name character, U+" + + Integer.toHexString(c)); + } + } + } + } + + nameBufferPos = 0; + // Read the first character. +loop: + while (true) + { + c = readCh(); + switch (c) + { + case '%': + case '<': case '>': case '&': + case ',': case '|': case '*': case '+': case '?': + case ')': + case '=': + case '\'': case '"': + case '[': + case ' ': case '\t': case '\n': case '\r': + case ';': + case '/': + unread(c); + if (nameBufferPos == 0) + { + error ("name expected"); + } + // punt on exact tests from Appendix A, but approximate them + if (isName + && !Character.isUnicodeIdentifierStart(nameBuffer[0]) + && ":_".indexOf(nameBuffer[0]) == -1) + { + error("Not a name start character, U+" + + Integer.toHexString(nameBuffer[0])); + } + String s = intern(nameBuffer, 0, nameBufferPos); + nameBufferPos = 0; + return s; + default: + // punt on exact tests from Appendix A, but approximate them + + if ((nameBufferPos != 0 || !isName) + && !Character.isUnicodeIdentifierPart(c) + && ":-_.".indexOf(c) == -1 + && !isExtender(c)) + { + error("Not a name character, U+" + + Integer.toHexString(c)); + } + if (nameBufferPos >= nameBuffer.length) + { + nameBuffer = + (char[]) extendArray(nameBuffer, + nameBuffer.length, nameBufferPos); + } + nameBuffer[nameBufferPos++] = c; + } + } + } + + private static boolean isExtender(char c) + { + // [88] Extender ::= ... + return c == 0x00b7 || c == 0x02d0 || c == 0x02d1 || c == 0x0387 + || c == 0x0640 || c == 0x0e46 || c == 0x0ec6 || c == 0x3005 + || (c >= 0x3031 && c <= 0x3035) + || (c >= 0x309d && c <= 0x309e) + || (c >= 0x30fc && c <= 0x30fe); + } - /** - * Read a literal. With matching single or double quotes as - * delimiters (and not embedded!) this is used to parse: - * <pre> - * [9] EntityValue ::= ... ([^%&] | PEReference | Reference)* ... - * [10] AttValue ::= ... ([^<&] | Reference)* ... - * [11] SystemLiteral ::= ... (URLchar - "'")* ... - * [12] PubidLiteral ::= ... (PubidChar - "'")* ... - * </pre> - * as well as the quoted strings in XML and text declarations - * (for version, encoding, and standalone) which have their - * own constraints. - */ - private String readLiteral (int flags) + /** + * Read a literal. With matching single or double quotes as + * delimiters (and not embedded!) this is used to parse: + * <pre> + * [9] EntityValue ::= ... ([^%&] | PEReference | Reference)* ... + * [10] AttValue ::= ... ([^<&] | Reference)* ... + * [11] SystemLiteral ::= ... (URLchar - "'")* ... + * [12] PubidLiteral ::= ... (PubidChar - "'")* ... + * </pre> + * as well as the quoted strings in XML and text declarations + * (for version, encoding, and standalone) which have their + * own constraints. + */ + private String readLiteral(int flags) throws SAXException, IOException - { - char delim, c; - int startLine = line; - boolean saved = expandPE; - boolean savedReport = doReport; - - // Find the first delimiter. - delim = readCh (); - if (delim != '"' && delim != '\'') { - error ("expected '\"' or \"'\"", delim, null); - return null; - } - inLiteral = true; - if ((flags & LIT_DISABLE_PE) != 0) - expandPE = false; - doReport = false; - - // Each level of input source has its own buffer; remember - // ours, so we won't read the ending delimiter from any - // other input source, regardless of entity processing. - char ourBuf [] = readBuffer; - - // Read the literal. - try { - c = readCh (); - boolean ampRead = false; + { + char delim, c; + int startLine = line; + boolean saved = expandPE; + boolean savedReport = doReport; + + // Find the first delimiter. + delim = readCh(); + if (delim != '"' && delim != '\'') + { + error("expected '\"' or \"'\"", delim, null); + return null; + } + inLiteral = true; + if ((flags & LIT_DISABLE_PE) != 0) + { + expandPE = false; + } + doReport = false; + + // Each level of input source has its own buffer; remember + // ours, so we won't read the ending delimiter from any + // other input source, regardless of entity processing. + char[] ourBuf = readBuffer; + + // Read the literal. + try + { + c = readCh(); + boolean ampRead = false; loop: - while (! (c == delim && readBuffer == ourBuf)) { - switch (c) { - // attributes and public ids are normalized - // in almost the same ways - case '\n': - case '\r': - if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) - c = ' '; - break; - case '\t': - if ((flags & LIT_ATTRIBUTE) != 0) - c = ' '; - break; - case '&': - c = readCh (); - // Char refs are expanded immediately, except for - // all the cases where it's deferred. - if (c == '#') { - if ((flags & LIT_DISABLE_CREF) != 0) { - dataBufferAppend ('&'); - break; - } - parseCharRef (false /* Do not do flushDataBuffer */); - - // exotic WFness risk: this is an entity literal, - // dataBuffer [dataBufferPos - 1] == '&', and - // following chars are a _partial_ entity/char ref - - // It looks like an entity ref ... - } else { - unread (c); - // Expand it? - if ((flags & LIT_ENTITY_REF) > 0) { - parseEntityRef (false); - if (String.valueOf (readBuffer).equals("&")) - ampRead = true; + while (! (c == delim && readBuffer == ourBuf)) + { + switch (c) + { + // attributes and public ids are normalized + // in almost the same ways + case '\n': + case '\r': + if ((flags & (LIT_ATTRIBUTE | LIT_PUBID)) != 0) + { + c = ' '; + } + break; + case '\t': + if ((flags & LIT_ATTRIBUTE) != 0) + { + c = ' '; + } + break; + case '&': + c = readCh(); + // Char refs are expanded immediately, except for + // all the cases where it's deferred. + if (c == '#') + { + if ((flags & LIT_DISABLE_CREF) != 0) + { + dataBufferAppend('&'); + break; + } + parseCharRef(false /* Do not do flushDataBuffer */); + + // exotic WFness risk: this is an entity literal, + // dataBuffer [dataBufferPos - 1] == '&', and + // following chars are a _partial_ entity/char ref + + // It looks like an entity ref ... + } + else + { + unread(c); + // Expand it? + if ((flags & LIT_ENTITY_REF) > 0) + { + parseEntityRef(false); + if (String.valueOf(readBuffer).equals("&")) + { + ampRead = true; + } //Is it just data? - } else if ((flags & LIT_DISABLE_EREF) != 0) { - dataBufferAppend ('&'); - - // OK, it will be an entity ref -- expanded later. - } else { - String name = readNmtoken (true); - require (';'); - dataBufferAppend ('&'); - dataBufferAppend (name); - dataBufferAppend (';'); - } - } - c = readCh (); - continue loop; - - case '<': - // and why? Perhaps so "&foo;" expands the same - // inside and outside an attribute? - if ((flags & LIT_ATTRIBUTE) != 0) - error ("attribute values may not contain '<'"); - break; - - // We don't worry about case '%' and PE refs, readCh does. - - default: - break; - } - dataBufferAppend (c); - c = readCh (); - } - } catch (EOFException e) { - error ("end of input while looking for delimiter (started on line " - + startLine + ')', null, new Character (delim).toString ()); - } - inLiteral = false; - expandPE = saved; - doReport = savedReport; - - // Normalise whitespace if necessary. - if ((flags & LIT_NORMALIZE) > 0) { - dataBufferNormalize (); - } - - // Return the value. - return dataBufferToString (); - } - - - /** - * Try reading external identifiers. - * A system identifier is not required for notations. - * @param inNotation Are we parsing a notation decl? - * @param isSubset Parsing external subset decl (may be omitted)? - * @return A three-member String array containing the identifiers, - * or nulls. Order: public, system, baseURI. - */ - private String[] readExternalIds (boolean inNotation, boolean isSubset) + } + else if ((flags & LIT_DISABLE_EREF) != 0) + { + dataBufferAppend('&'); + + // OK, it will be an entity ref -- expanded later. + } + else + { + String name = readNmtoken(true); + require(';'); + dataBufferAppend('&'); + dataBufferAppend(name); + dataBufferAppend(';'); + } + } + c = readCh(); + continue loop; + + case '<': + // and why? Perhaps so "&foo;" expands the same + // inside and outside an attribute? + if ((flags & LIT_ATTRIBUTE) != 0) + { + error("attribute values may not contain '<'"); + } + break; + + // We don't worry about case '%' and PE refs, readCh does. + + default: + break; + } + dataBufferAppend(c); + c = readCh(); + } + } + catch (EOFException e) + { + error("end of input while looking for delimiter (started on line " + + startLine + ')', null, new Character(delim).toString()); + } + inLiteral = false; + expandPE = saved; + doReport = savedReport; + + // Normalise whitespace if necessary. + if ((flags & LIT_NORMALIZE) > 0) + { + dataBufferNormalize(); + } + + // Return the value. + return dataBufferToString(); + } + + /** + * Try reading external identifiers. + * A system identifier is not required for notations. + * @param inNotation Are we parsing a notation decl? + * @param isSubset Parsing external subset decl (may be omitted)? + * @return A three-member String array containing the identifiers, + * or nulls. Order: public, system, baseURI. + */ + private ExternalIdentifiers readExternalIds(boolean inNotation, + boolean isSubset) throws Exception - { - char c; - String ids[] = new String [3]; - int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; - - if (tryRead ("PUBLIC")) { - requireWhitespace (); - ids [0] = readLiteral (LIT_NORMALIZE | LIT_PUBID | flags); - if (inNotation) { - skipWhitespace (); - c = readCh (); - unread (c); - if (c == '"' || c == '\'') { - ids [1] = readLiteral (flags); - } - } else { - requireWhitespace (); - ids [1] = readLiteral (flags); - } - - for (int i = 0; i < ids [0].length (); i++) { - c = ids [0].charAt (i); - if (c >= 'a' && c <= 'z') - continue; - if (c >= 'A' && c <= 'Z') - continue; - if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf (c) != -1) - continue; - error ("illegal PUBLIC id character U+" - + Integer.toHexString (c)); - } - } else if (tryRead ("SYSTEM")) { - requireWhitespace (); - ids [1] = readLiteral (flags); - } else if (!isSubset) - error ("missing SYSTEM or PUBLIC keyword"); - - if (ids [1] != null) { - if (ids [1].indexOf ('#') != -1) - handler.verror ("SYSTEM id has a URI fragment: " + ids [1]); - ids [2] = handler.getSystemId (); - if (ids [2] == null) - handler.warn ("No base URI; hope URI is absolute: " - + ids [1]); - } - - return ids; - } - - - /** - * Test if a character is whitespace. - * <pre> - * [3] S ::= (#x20 | #x9 | #xd | #xa)+ - * </pre> - * @param c The character to test. - * @return true if the character is whitespace. - */ - private final boolean isWhitespace (char c) - { - if (c > 0x20) - return false; - if (c == 0x20 || c == 0x0a || c == 0x09 || c == 0x0d) - return true; - return false; // illegal ... - } - - - ////////////////////////////////////////////////////////////////////// - // Utility routines. - ////////////////////////////////////////////////////////////////////// - - - /** - * Add a character to the data buffer. - */ - private void dataBufferAppend (char c) - { - // Expand buffer if necessary. - if (dataBufferPos >= dataBuffer.length) - dataBuffer = - (char[]) extendArray (dataBuffer, - dataBuffer.length, dataBufferPos); - dataBuffer [dataBufferPos++] = c; - } - - - /** - * Add a string to the data buffer. - */ - private void dataBufferAppend (String s) - { - dataBufferAppend (s.toCharArray (), 0, s.length ()); - } - + { + char c; + ExternalIdentifiers ids = new ExternalIdentifiers(); + int flags = LIT_DISABLE_CREF | LIT_DISABLE_PE | LIT_DISABLE_EREF; + + if (tryRead("PUBLIC")) + { + requireWhitespace(); + ids.publicId = readLiteral(LIT_NORMALIZE | LIT_PUBID | flags); + if (inNotation) + { + skipWhitespace(); + c = readCh(); + unread(c); + if (c == '"' || c == '\'') + { + ids.systemId = readLiteral(flags); + } + } + else + { + requireWhitespace(); + ids.systemId = readLiteral(flags); + } + + for (int i = 0; i < ids.publicId.length(); i++) + { + c = ids.publicId.charAt(i); + if (c >= 'a' && c <= 'z') + { + continue; + } + if (c >= 'A' && c <= 'Z') + { + continue; + } + if (" \r\n0123456789-' ()+,./:=?;!*#@$_%".indexOf(c) != -1) + { + continue; + } + error("illegal PUBLIC id character U+" + + Integer.toHexString(c)); + } + } + else if (tryRead("SYSTEM")) + { + requireWhitespace(); + ids.systemId = readLiteral(flags); + } + else if (!isSubset) + { + error("missing SYSTEM or PUBLIC keyword"); + } + + if (ids.systemId != null) + { + if (ids.systemId.indexOf('#') != -1) + { + handler.verror("SYSTEM id has a URI fragment: " + ids.systemId); + } + ids.baseUri = handler.getSystemId(); + if (ids.baseUri == null && uriWarnings) + { + handler.warn("No base URI; hope URI is absolute: " + + ids.systemId); + } + } + + return ids; + } - /** - * Append (part of) a character array to the data buffer. - */ - private void dataBufferAppend (char ch[], int start, int length) - { - dataBuffer = (char[]) - extendArray (dataBuffer, dataBuffer.length, - dataBufferPos + length); + /** + * Test if a character is whitespace. + * <pre> + * [3] S ::= (#x20 | #x9 | #xd | #xa)+ + * </pre> + * @param c The character to test. + * @return true if the character is whitespace. + */ + private final boolean isWhitespace(char c) + { + if (c > 0x20) + { + return false; + } + if (c == 0x20 || c == 0x0a || c == 0x09 || c == 0x0d) + { + return true; + } + return false; // illegal ... + } - System.arraycopy (ch, start, dataBuffer, dataBufferPos, length); - dataBufferPos += length; - } + ////////////////////////////////////////////////////////////////////// + // Utility routines. + ////////////////////////////////////////////////////////////////////// + + /** + * Add a character to the data buffer. + */ + private void dataBufferAppend(char c) + { + // Expand buffer if necessary. + if (dataBufferPos >= dataBuffer.length) + { + dataBuffer = (char[]) extendArray(dataBuffer, + dataBuffer.length, dataBufferPos); + } + dataBuffer[dataBufferPos++] = c; + } + /** + * Add a string to the data buffer. + */ + private void dataBufferAppend(String s) + { + dataBufferAppend(s.toCharArray(), 0, s.length()); + } - /** - * Normalise space characters in the data buffer. - */ - private void dataBufferNormalize () - { - int i = 0; - int j = 0; - int end = dataBufferPos; - - // Skip spaces at the start. - while (j < end && dataBuffer [j] == ' ') { - j++; - } - - // Skip whitespace at the end. - while (end > j && dataBuffer [end - 1] == ' ') { - end --; - } - - // Start copying to the left. - while (j < end) { - - char c = dataBuffer [j++]; - - // Normalise all other spaces to - // a single space. - if (c == ' ') { - while (j < end && dataBuffer [j++] == ' ') - continue; - dataBuffer [i++] = ' '; - dataBuffer [i++] = dataBuffer [j - 1]; - } else { - dataBuffer [i++] = c; - } - } - - // The new length is <= the old one. - dataBufferPos = i; - } + /** + * Append (part of) a character array to the data buffer. + */ + private void dataBufferAppend(char[] ch, int start, int length) + { + dataBuffer = (char[]) extendArray(dataBuffer, dataBuffer.length, + dataBufferPos + length); + + System.arraycopy(ch, start, dataBuffer, dataBufferPos, length); + dataBufferPos += length; + } + /** + * Normalise space characters in the data buffer. + */ + private void dataBufferNormalize() + { + int i = 0; + int j = 0; + int end = dataBufferPos; + + // Skip spaces at the start. + while (j < end && dataBuffer[j] == ' ') + { + j++; + } + + // Skip whitespace at the end. + while (end > j && dataBuffer[end - 1] == ' ') + { + end --; + } - /** - * Convert the data buffer to a string. - */ - private String dataBufferToString () - { - String s = new String (dataBuffer, 0, dataBufferPos); - dataBufferPos = 0; - return s; - } + // Start copying to the left. + while (j < end) + { + + char c = dataBuffer[j++]; + + // Normalise all other spaces to + // a single space. + if (c == ' ') + { + while (j < end && dataBuffer[j++] == ' ') + { + continue; + } + dataBuffer[i++] = ' '; + dataBuffer[i++] = dataBuffer[j - 1]; + } + else + { + dataBuffer[i++] = c; + } + } + + // The new length is <= the old one. + dataBufferPos = i; + } + /** + * Convert the data buffer to a string. + */ + private String dataBufferToString() + { + String s = new String(dataBuffer, 0, dataBufferPos); + dataBufferPos = 0; + return s; + } - /** - * Flush the contents of the data buffer to the handler, as - * appropriate, and reset the buffer for new input. - */ - private void dataBufferFlush () + /** + * Flush the contents of the data buffer to the handler, as + * appropriate, and reset the buffer for new input. + */ + private void dataBufferFlush() throws SAXException - { - if (currentElementContent == CONTENT_ELEMENTS - && dataBufferPos > 0 - && !inCDATA - ) { - // We can't just trust the buffer to be whitespace, there - // are (error) cases when it isn't - for (int i = 0; i < dataBufferPos; i++) { - if (!isWhitespace (dataBuffer [i])) { - handler.charData (dataBuffer, 0, dataBufferPos); - dataBufferPos = 0; - } - } - if (dataBufferPos > 0) { - handler.ignorableWhitespace (dataBuffer, 0, dataBufferPos); - dataBufferPos = 0; - } - } else if (dataBufferPos > 0) { - handler.charData (dataBuffer, 0, dataBufferPos); - dataBufferPos = 0; - } - } - + { + if (currentElementContent == CONTENT_ELEMENTS + && dataBufferPos > 0 + && !inCDATA) + { + // We can't just trust the buffer to be whitespace, there + // are (error) cases when it isn't + for (int i = 0; i < dataBufferPos; i++) + { + if (!isWhitespace(dataBuffer[i])) + { + handler.charData(dataBuffer, 0, dataBufferPos); + dataBufferPos = 0; + } + } + if (dataBufferPos > 0) + { + handler.ignorableWhitespace(dataBuffer, 0, dataBufferPos); + dataBufferPos = 0; + } + } + else if (dataBufferPos > 0) + { + handler.charData(dataBuffer, 0, dataBufferPos); + dataBufferPos = 0; + } + } - /** - * Require a string to appear, or throw an exception. - * <p><em>Precondition:</em> Entity expansion is not required. - * <p><em>Precondition:</em> data buffer has no characters that - * will get sent to the application. - */ - private void require (String delim) + /** + * Require a string to appear, or throw an exception. + * <p><em>Precondition:</em> Entity expansion is not required. + * <p><em>Precondition:</em> data buffer has no characters that + * will get sent to the application. + */ + private void require(String delim) throws SAXException, IOException - { - int length = delim.length (); - char ch []; - - if (length < dataBuffer.length) { - ch = dataBuffer; - delim.getChars (0, length, ch, 0); - } else - ch = delim.toCharArray (); - - if (USE_CHEATS - && length <= (readBufferLength - readBufferPos)) { - int offset = readBufferPos; - - for (int i = 0; i < length; i++, offset++) - if (ch [i] != readBuffer [offset]) - error ("required string", null, delim); - readBufferPos = offset; - - } else { - for (int i = 0; i < length; i++) - require (ch [i]); - } - } - + { + int length = delim.length(); + char[] ch; + + if (length < dataBuffer.length) + { + ch = dataBuffer; + delim.getChars(0, length, ch, 0); + } + else + { + ch = delim.toCharArray(); + } + + if (USE_CHEATS && length <= (readBufferLength - readBufferPos)) + { + int offset = readBufferPos; + + for (int i = 0; i < length; i++, offset++) + { + if (ch[i] != readBuffer[offset]) + { + error ("required string", null, delim); + } + } + readBufferPos = offset; + + } + else + { + for (int i = 0; i < length; i++) + { + require(ch[i]); + } + } + } - /** - * Require a character to appear, or throw an exception. - */ - private void require (char delim) + /** + * Require a character to appear, or throw an exception. + */ + private void require(char delim) throws SAXException, IOException - { - char c = readCh (); - - if (c != delim) { - error ("required character", c, new Character (delim).toString ()); - } - } - - - /** - * Create an interned string from a character array. - * Ælfred uses this method to create an interned version - * of all names and name tokens, so that it can test equality - * with <code>==</code> instead of <code>String.equals ()</code>. - * - * <p>This is much more efficient than constructing a non-interned - * string first, and then interning it. - * - * @param ch an array of characters for building the string. - * @param start the starting position in the array. - * @param length the number of characters to place in the string. - * @return an interned string. - * @see #intern (String) - * @see java.lang.String#intern - */ - public String intern (char ch[], int start, int length) - { - int index = 0; - int hash = 0; - Object bucket []; - - // Generate a hash code. This is a widely used string hash, - // often attributed to Brian Kernighan. - for (int i = start; i < start + length; i++) - hash = 31 * hash + ch [i]; - hash = (hash & 0x7fffffff) % SYMBOL_TABLE_LENGTH; - - // Get the bucket -- consists of {array,String} pairs - if ((bucket = symbolTable [hash]) == null) { - // first string in this bucket - bucket = new Object [8]; - - // Search for a matching tuple, and - // return the string if we find one. - } else { - while (index < bucket.length) { - char chFound [] = (char []) bucket [index]; - - // Stop when we hit an empty entry. - if (chFound == null) - break; - - // If they're the same length, check for a match. - if (chFound.length == length) { - for (int i = 0; i < chFound.length; i++) { - // continue search on failure - if (ch [start + i] != chFound [i]) { - break; - } else if (i == length - 1) { - // That's it, we have a match! - return (String) bucket [index + 1]; - } - } - } - index += 2; - } - // Not found -- we'll have to add it. - - // Do we have to grow the bucket? - bucket = (Object []) extendArray (bucket, bucket.length, index); - } - symbolTable [hash] = bucket; - - // OK, add it to the end of the bucket -- "local" interning. - // Intern "globally" to let applications share interning benefits. - // That is, "!=" and "==" work on our strings, not just equals(). - String s = new String (ch, start, length).intern (); - bucket [index] = s.toCharArray (); - bucket [index + 1] = s; - return s; - } - - /** - * Ensure the capacity of an array, allocating a new one if - * necessary. Usually extends only for name hash collisions. - */ - private Object extendArray (Object array, int currentSize, int requiredSize) - { - if (requiredSize < currentSize) { - return array; - } else { - Object newArray = null; - int newSize = currentSize * 2; - - if (newSize <= requiredSize) - newSize = requiredSize + 1; - - if (array instanceof char[]) - newArray = new char [newSize]; - else if (array instanceof Object[]) - newArray = new Object [newSize]; - else - throw new RuntimeException (); - - System.arraycopy (array, 0, newArray, 0, currentSize); - return newArray; - } - } - - - ////////////////////////////////////////////////////////////////////// - // XML query routines. - ////////////////////////////////////////////////////////////////////// - - - boolean isStandalone () { return docIsStandalone; } - - - // - // Elements - // - - private int getContentType (Object element [], int defaultType) - { - int retval; - - if (element == null) - return defaultType; - retval = ((Integer) element [0]).intValue (); - if (retval == CONTENT_UNDECLARED) - retval = defaultType; - return retval; - } - - - /** - * Look up the content type of an element. - * @param name The element type name. - * @return An integer constant representing the content type. - * @see #CONTENT_UNDECLARED - * @see #CONTENT_ANY - * @see #CONTENT_EMPTY - * @see #CONTENT_MIXED - * @see #CONTENT_ELEMENTS - */ - public int getElementContentType (String name) - { - Object element [] = (Object []) elementInfo.get (name); - return getContentType (element, CONTENT_UNDECLARED); - } - - - /** - * Register an element. - * Array format: - * [0] element type name - * [1] content model (mixed, elements only) - * [2] attribute hash table - */ - private void setElement ( - String name, - int contentType, - String contentModel, - Hashtable attributes - ) throws SAXException - { - if (skippedPE) - return; - - Object element [] = (Object []) elementInfo.get (name); - - // first <!ELEMENT ...> or <!ATTLIST ...> for this type? - if (element == null) { - element = new Object [3]; - element [0] = new Integer (contentType); - element [1] = contentModel; - element [2] = attributes; - elementInfo.put (name, element); - return; - } - - // <!ELEMENT ...> declaration? - if (contentType != CONTENT_UNDECLARED) { - // ... following an associated <!ATTLIST ...> - if (((Integer) element [0]).intValue () == CONTENT_UNDECLARED) { - element [0] = new Integer (contentType); - element [1] = contentModel; - } else - // VC: Unique Element Type Declaration - handler.verror ("multiple declarations for element type: " - + name); - } - - // first <!ATTLIST ...>, before <!ELEMENT ...> ? - else if (attributes != null) - element [2] = attributes; - } - - - /** - * Look up the attribute hash table for an element. - * The hash table is the second item in the element array. - */ - private Hashtable getElementAttributes (String name) - { - Object element[] = (Object[]) elementInfo.get (name); - if (element == null) - return null; - else - return (Hashtable) element [2]; - } - - - - // - // Attributes - // + { + char c = readCh(); + + if (c != delim) + { + error("required character", c, new Character(delim).toString()); + } + } + + /** + * Create an interned string from a character array. + * Ælfred uses this method to create an interned version + * of all names and name tokens, so that it can test equality + * with <code>==</code> instead of <code>String.equals ()</code>. + * + * <p>This is much more efficient than constructing a non-interned + * string first, and then interning it. + * + * @param ch an array of characters for building the string. + * @param start the starting position in the array. + * @param length the number of characters to place in the string. + * @return an interned string. + * @see #intern (String) + * @see java.lang.String#intern + */ + public String intern(char[] ch, int start, int length) + { + int index = 0; + int hash = 0; + Object[] bucket; + + // Generate a hash code. This is a widely used string hash, + // often attributed to Brian Kernighan. + for (int i = start; i < start + length; i++) + { + hash = 31 * hash + ch[i]; + } + hash = (hash & 0x7fffffff) % SYMBOL_TABLE_LENGTH; + + // Get the bucket -- consists of {array,String} pairs + if ((bucket = symbolTable[hash]) == null) + { + // first string in this bucket + bucket = new Object[8]; + + // Search for a matching tuple, and + // return the string if we find one. + } + else + { + while (index < bucket.length) + { + char[] chFound = (char[]) bucket[index]; + + // Stop when we hit an empty entry. + if (chFound == null) + { + break; + } + + // If they're the same length, check for a match. + if (chFound.length == length) + { + for (int i = 0; i < chFound.length; i++) + { + // continue search on failure + if (ch[start + i] != chFound[i]) + { + break; + } + else if (i == length - 1) + { + // That's it, we have a match! + return (String) bucket[index + 1]; + } + } + } + index += 2; + } + // Not found -- we'll have to add it. + + // Do we have to grow the bucket? + bucket = (Object[]) extendArray(bucket, bucket.length, index); + } + symbolTable[hash] = bucket; + + // OK, add it to the end of the bucket -- "local" interning. + // Intern "globally" to let applications share interning benefits. + // That is, "!=" and "==" work on our strings, not just equals(). + String s = new String(ch, start, length).intern(); + bucket[index] = s.toCharArray(); + bucket[index + 1] = s; + return s; + } - /** - * Get the declared attributes for an element type. - * @param elname The name of the element type. - * @return An Enumeration of all the attributes declared for - * a specific element type. The results will be valid only - * after the DTD (if any) has been parsed. - * @see #getAttributeType - * @see #getAttributeEnumeration - * @see #getAttributeDefaultValueType - * @see #getAttributeDefaultValue - * @see #getAttributeExpandedValue - */ - private Enumeration declaredAttributes (Object element []) - { - Hashtable attlist; + /** + * Ensure the capacity of an array, allocating a new one if + * necessary. Usually extends only for name hash collisions. + */ + private Object extendArray(Object array, int currentSize, int requiredSize) + { + if (requiredSize < currentSize) + { + return array; + } + else + { + Object newArray = null; + int newSize = currentSize * 2; + + if (newSize <= requiredSize) + { + newSize = requiredSize + 1; + } + + if (array instanceof char[]) + { + newArray = new char[newSize]; + } + else if (array instanceof Object[]) + { + newArray = new Object[newSize]; + } + else + { + throw new RuntimeException(); + } + + System.arraycopy(array, 0, newArray, 0, currentSize); + return newArray; + } + } - if (element == null) - return null; - if ((attlist = (Hashtable) element [2]) == null) - return null; - return attlist.keys (); - } + ////////////////////////////////////////////////////////////////////// + // XML query routines. + ////////////////////////////////////////////////////////////////////// + + boolean isStandalone() + { + return docIsStandalone; + } + + // + // Elements + // + + private int getContentType(ElementDecl element, int defaultType) + { + int retval; + + if (element == null) + { + return defaultType; + } + retval = element.contentType; + if (retval == CONTENT_UNDECLARED) + { + retval = defaultType; + } + return retval; + } - /** - * Get the declared attributes for an element type. - * @param elname The name of the element type. - * @return An Enumeration of all the attributes declared for - * a specific element type. The results will be valid only - * after the DTD (if any) has been parsed. - * @see #getAttributeType - * @see #getAttributeEnumeration - * @see #getAttributeDefaultValueType - * @see #getAttributeDefaultValue - * @see #getAttributeExpandedValue - */ - public Enumeration declaredAttributes (String elname) - { - return declaredAttributes ((Object []) elementInfo.get (elname)); - } + /** + * Look up the content type of an element. + * @param name The element type name. + * @return An integer constant representing the content type. + * @see #CONTENT_UNDECLARED + * @see #CONTENT_ANY + * @see #CONTENT_EMPTY + * @see #CONTENT_MIXED + * @see #CONTENT_ELEMENTS + */ + public int getElementContentType(String name) + { + ElementDecl element = (ElementDecl) elementInfo.get(name); + return getContentType(element, CONTENT_UNDECLARED); + } + + /** + * Register an element. + * Array format: + * [0] element type name + * [1] content model (mixed, elements only) + * [2] attribute hash table + */ + private void setElement(String name, int contentType, + String contentModel, HashMap attributes) + throws SAXException + { + if (skippedPE) + { + return; + } + ElementDecl element = (ElementDecl) elementInfo.get(name); + + // first <!ELEMENT ...> or <!ATTLIST ...> for this type? + if (element == null) + { + element = new ElementDecl(); + element.contentType = contentType; + element.contentModel = contentModel; + element.attributes = attributes; + elementInfo.put(name, element); + return; + } + + // <!ELEMENT ...> declaration? + if (contentType != CONTENT_UNDECLARED) + { + // ... following an associated <!ATTLIST ...> + if (element.contentType == CONTENT_UNDECLARED) + { + element.contentType = contentType; + element.contentModel = contentModel; + } + else + { + // VC: Unique Element Type Declaration + handler.verror("multiple declarations for element type: " + + name); + } + } + + // first <!ATTLIST ...>, before <!ELEMENT ...> ? + else if (attributes != null) + { + element.attributes = attributes; + } + } + + /** + * Look up the attribute hash table for an element. + * The hash table is the second item in the element array. + */ + private HashMap getElementAttributes(String name) + { + ElementDecl element = (ElementDecl) elementInfo.get(name); + return (element == null) ? null : element.attributes; + } - /** - * Retrieve the declared type of an attribute. - * @param name The name of the associated element. - * @param aname The name of the attribute. - * @return An interend string denoting the type, or null - * indicating an undeclared attribute. - */ - public String getAttributeType (String name, String aname) - { - Object attribute[] = getAttribute (name, aname); - if (attribute == null) { - return null; - } else { - return (String) attribute [0]; - } - } + // + // Attributes + // + + /** + * Get the declared attributes for an element type. + * @param elname The name of the element type. + * @return An iterator over all the attributes declared for + * a specific element type. The results will be valid only + * after the DTD (if any) has been parsed. + * @see #getAttributeType + * @see #getAttributeEnumeration + * @see #getAttributeDefaultValueType + * @see #getAttributeDefaultValue + * @see #getAttributeExpandedValue + */ + private Iterator declaredAttributes(ElementDecl element) + { + HashMap attlist; + + if (element == null) + { + return null; + } + if ((attlist = element.attributes) == null) + { + return null; + } + return attlist.keySet().iterator(); + } + /** + * Get the declared attributes for an element type. + * @param elname The name of the element type. + * @return An iterator over all the attributes declared for + * a specific element type. The results will be valid only + * after the DTD (if any) has been parsed. + * @see #getAttributeType + * @see #getAttributeEnumeration + * @see #getAttributeDefaultValueType + * @see #getAttributeDefaultValue + * @see #getAttributeExpandedValue + */ + public Iterator declaredAttributes(String elname) + { + return declaredAttributes((ElementDecl) elementInfo.get(elname)); + } - /** - * Retrieve the allowed values for an enumerated attribute type. - * @param name The name of the associated element. - * @param aname The name of the attribute. - * @return A string containing the token list. - */ - public String getAttributeEnumeration (String name, String aname) - { - Object attribute[] = getAttribute (name, aname); - if (attribute == null) { - return null; - } else { - // assert: attribute [0] is "ENUMERATION" or "NOTATION" - return (String) attribute [3]; - } - } + /** + * Retrieve the declared type of an attribute. + * @param name The name of the associated element. + * @param aname The name of the attribute. + * @return An interend string denoting the type, or null + * indicating an undeclared attribute. + */ + public String getAttributeType(String name, String aname) + { + AttributeDecl attribute = getAttribute(name, aname); + return (attribute == null) ? null : attribute.type; + } + /** + * Retrieve the allowed values for an enumerated attribute type. + * @param name The name of the associated element. + * @param aname The name of the attribute. + * @return A string containing the token list. + */ + public String getAttributeEnumeration(String name, String aname) + { + AttributeDecl attribute = getAttribute(name, aname); + // assert: attribute.enumeration is "ENUMERATION" or "NOTATION" + return (attribute == null) ? null : attribute.enumeration; + } - /** - * Retrieve the default value of a declared attribute. - * @param name The name of the associated element. - * @param aname The name of the attribute. - * @return The default value, or null if the attribute was - * #IMPLIED or simply undeclared and unspecified. - * @see #getAttributeExpandedValue - */ - public String getAttributeDefaultValue (String name, String aname) - { - Object attribute[] = getAttribute (name, aname); - if (attribute == null) { - return null; - } else { - return (String) attribute [1]; - } - } + /** + * Retrieve the default value of a declared attribute. + * @param name The name of the associated element. + * @param aname The name of the attribute. + * @return The default value, or null if the attribute was + * #IMPLIED or simply undeclared and unspecified. + * @see #getAttributeExpandedValue + */ + public String getAttributeDefaultValue(String name, String aname) + { + AttributeDecl attribute = getAttribute(name, aname); + return (attribute == null) ? null : attribute.value; + } /* @@ -3325,1789 +3940,1896 @@ loop: * @param name The name of the associated element. * @param aname The name of the attribute. * @return The expanded default value, or null if the attribute was - * #IMPLIED or simply undeclared + * #IMPLIED or simply undeclared * @see #getAttributeDefaultValue public String getAttributeExpandedValue (String name, String aname) throws Exception { - Object attribute[] = getAttribute (name, aname); - - if (attribute == null) { - return null; - } else if (attribute [4] == null && attribute [1] != null) { - // we MUST use the same buf for both quotes else the literal - // can't be properly terminated - char buf [] = new char [1]; - int flags = LIT_ENTITY_REF | LIT_ATTRIBUTE; - String type = getAttributeType (name, aname); - - if (type != "CDATA" && type != null) - flags |= LIT_NORMALIZE; - buf [0] = '"'; - pushCharArray (null, buf, 0, 1); - pushString (null, (String) attribute [1]); - pushCharArray (null, buf, 0, 1); - attribute [4] = readLiteral (flags); - } - return (String) attribute [4]; + AttributeDecl attribute = getAttribute (name, aname); + + if (attribute == null) { + return null; + } else if (attribute.defaultValue == null && attribute.value != null) { + // we MUST use the same buf for both quotes else the literal + // can't be properly terminated + char buf [] = new char [1]; + int flags = LIT_ENTITY_REF | LIT_ATTRIBUTE; + String type = getAttributeType (name, aname); + + if (type != "CDATA" && type != null) + flags |= LIT_NORMALIZE; + buf [0] = '"'; + pushCharArray (null, buf, 0, 1); + pushString (null, attribute.value); + pushCharArray (null, buf, 0, 1); + attribute.defaultValue = readLiteral (flags); + } + return attribute.defaultValue; } */ - /** - * Retrieve the default value mode of a declared attribute. - * @see #ATTRIBUTE_DEFAULT_SPECIFIED - * @see #ATTRIBUTE_DEFAULT_IMPLIED - * @see #ATTRIBUTE_DEFAULT_REQUIRED - * @see #ATTRIBUTE_DEFAULT_FIXED - */ - public int getAttributeDefaultValueType (String name, String aname) - { - Object attribute[] = getAttribute (name, aname); - if (attribute == null) { - return ATTRIBUTE_DEFAULT_UNDECLARED; - } else { - return ((Integer) attribute [2]).intValue (); - } - } - - - /** - * Register an attribute declaration for later retrieval. - * Format: - * - String type - * - String default value - * - int value type - * - enumeration - * - processed default value - */ - private void setAttribute (String elName, String name, String type, - String enumeration, - String value, int valueType) + /** + * Retrieve the default value mode of a declared attribute. + * @see #ATTRIBUTE_DEFAULT_SPECIFIED + * @see #ATTRIBUTE_DEFAULT_IMPLIED + * @see #ATTRIBUTE_DEFAULT_REQUIRED + * @see #ATTRIBUTE_DEFAULT_FIXED + */ + public int getAttributeDefaultValueType(String name, String aname) + { + AttributeDecl attribute = getAttribute(name, aname); + return (attribute == null) ? ATTRIBUTE_DEFAULT_UNDECLARED : + attribute.valueType; + } + + /** + * Register an attribute declaration for later retrieval. + * Format: + * - String type + * - String default value + * - int value type + * - enumeration + * - processed default value + */ + private void setAttribute(String elName, String name, String type, + String enumeration, String value, int valueType) throws Exception - { - Hashtable attlist; - - if (skippedPE) - return; - - // Create a new hashtable if necessary. - attlist = getElementAttributes (elName); - if (attlist == null) - attlist = new Hashtable (); - - // ignore multiple attribute declarations! - if (attlist.get (name) != null) { - // warn ... - return; - } else { - Object attribute [] = new Object [5]; - attribute [0] = type; - attribute [1] = value; - attribute [2] = new Integer (valueType); - attribute [3] = enumeration; - attribute [4] = null; - attlist.put (name, attribute); - - // save; but don't overwrite any existing <!ELEMENT ...> - setElement (elName, CONTENT_UNDECLARED, null, attlist); - } - } - - - /** - * Retrieve the array representing an attribute declaration. - */ - private Object[] getAttribute (String elName, String name) - { - Hashtable attlist; - - attlist = getElementAttributes (elName); - if (attlist == null) - return null; - return (Object[]) attlist.get (name); - } - + { + HashMap attlist; + + if (skippedPE) + { + return; + } + + // Create a new hashtable if necessary. + attlist = getElementAttributes(elName); + if (attlist == null) + { + attlist = new HashMap(); + } + + // ignore multiple attribute declarations! + if (attlist.get(name) != null) + { + // warn ... + return; + } + else + { + AttributeDecl attribute = new AttributeDecl(); + attribute.type = type; + attribute.value = value; + attribute.valueType = valueType; + attribute.enumeration = enumeration; + attlist.put(name, attribute); + + // save; but don't overwrite any existing <!ELEMENT ...> + setElement(elName, CONTENT_UNDECLARED, null, attlist); + } + } - // - // Entities - // + /** + * Retrieve the attribute declaration for the given element name and name. + */ + private AttributeDecl getAttribute(String elName, String name) + { + HashMap attlist = getElementAttributes(elName); + return (attlist == null) ? null : (AttributeDecl) attlist.get(name); + } - /** - * Find the type of an entity. - * @returns An integer constant representing the entity type. - * @see #ENTITY_UNDECLARED - * @see #ENTITY_INTERNAL - * @see #ENTITY_NDATA - * @see #ENTITY_TEXT - */ - public int getEntityType (String ename) - { - Object entity[] = (Object[]) entityInfo.get (ename); - if (entity == null) { - return ENTITY_UNDECLARED; - } else { - return ((Integer) entity [0]).intValue (); - } - } + // + // Entities + // + + /** + * Find the type of an entity. + * @returns An integer constant representing the entity type. + * @see #ENTITY_UNDECLARED + * @see #ENTITY_INTERNAL + * @see #ENTITY_NDATA + * @see #ENTITY_TEXT + */ + public int getEntityType(String ename) + { + EntityInfo entity = (EntityInfo) entityInfo.get(ename); + return (entity == null) ? ENTITY_UNDECLARED : entity.type; + } + /** + * Return an external entity's identifiers. + * @param ename The name of the external entity. + * @return The entity's public identifier, system identifier, and base URI. + * Null if the entity was not declared as an external entity. + * @see #getEntityType + */ + public ExternalIdentifiers getEntityIds(String ename) + { + EntityInfo entity = (EntityInfo) entityInfo.get(ename); + return (entity == null) ? null : entity.ids; + } - /** - * Return an external entity's identifier array. - * @param ename The name of the external entity. - * @return Three element array containing (in order) the entity's - * public identifier, system identifier, and base URI. Null if - * the entity was not declared as an external entity. - * @see #getEntityType - */ - public String [] getEntityIds (String ename) - { - Object entity[] = (Object[]) entityInfo.get (ename); - if (entity == null) { - return null; - } else { - return (String []) entity [1]; - } - } + /** + * Return an internal entity's replacement text. + * @param ename The name of the internal entity. + * @return The entity's replacement text, or null if + * the entity was not declared as an internal entity. + * @see #getEntityType + */ + public String getEntityValue(String ename) + { + EntityInfo entity = (EntityInfo) entityInfo.get(ename); + return (entity == null) ? null : entity.value; + } + /** + * Register an entity declaration for later retrieval. + */ + private void setInternalEntity(String eName, String value) + throws SAXException + { + if (skippedPE) + { + return; + } - /** - * Return an internal entity's replacement text. - * @param ename The name of the internal entity. - * @return The entity's replacement text, or null if - * the entity was not declared as an internal entity. - * @see #getEntityType - */ - public String getEntityValue (String ename) - { - Object entity[] = (Object[]) entityInfo.get (ename); - if (entity == null) { - return null; - } else { - return (String) entity [3]; - } - } + if (entityInfo.get(eName) == null) + { + EntityInfo entity = new EntityInfo(); + entity.type = ENTITY_INTERNAL; + entity.value = value; + entityInfo.put(eName, entity); + } + if (handler.stringInterning) + { + if ("lt" == eName || "gt" == eName || "quot" == eName + || "apos" == eName || "amp" == eName) + { + return; + } + } + else + { + if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName) + || "apos".equals(eName) || "amp".equals(eName)) + { + return; + } + } + handler.getDeclHandler().internalEntityDecl(eName, value); + } + /** + * Register an external entity declaration for later retrieval. + */ + private void setExternalEntity(String eName, int eClass, + ExternalIdentifiers ids, String nName) + { + if (entityInfo.get(eName) == null) + { + EntityInfo entity = new EntityInfo(); + entity.type = eClass; + entity.ids = ids; + entity.notationName = nName; + entityInfo.put(eName, entity); + } + } - /** - * Register an entity declaration for later retrieval. - */ - private void setInternalEntity (String eName, String value) + // + // Notations. + // + + /** + * Report a notation declaration, checking for duplicates. + */ + private void setNotation(String nname, ExternalIdentifiers ids) throws SAXException - { - if (skippedPE) - return; - - if (entityInfo.get (eName) == null) { - Object entity[] = new Object [5]; - entity [0] = new Integer (ENTITY_INTERNAL); -// FIXME: shrink!! [2] useless - entity [3] = value; - entityInfo.put (eName, entity); - } - if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { - if ("lt" == eName || "gt" == eName || "quot" == eName - || "apos" == eName || "amp" == eName) - return; - } else { - if ("lt".equals(eName) || "gt".equals(eName) || "quot".equals(eName) - || "apos".equals(eName) || "amp".equals(eName)) - return; + { + if (skippedPE) + { + return; + } + + handler.notationDecl(nname, ids.publicId, ids.systemId, ids.baseUri); + if (notationInfo.get(nname) == null) + { + notationInfo.put(nname, nname); + } + else + { + // VC: Unique Notation Name + handler.verror("Duplicate notation name decl: " + nname); + } + } + + // + // Location. + // + + /** + * Return the current line number. + */ + public int getLineNumber() + { + return line; } - handler.getDeclHandler () - .internalEntityDecl (eName, value); - } + /** + * Return the current column number. + */ + public int getColumnNumber() + { + return column; + } - /** - * Register an external entity declaration for later retrieval. - */ - private void setExternalEntity (String eName, int eClass, - String ids [], String nName) - { - if (entityInfo.get (eName) == null) { - Object entity[] = new Object [5]; - entity [0] = new Integer (eClass); - entity [1] = ids; -// FIXME: shrink!! [2] no longer used, [4] irrelevant given [0] - entity [4] = nName; - entityInfo.put (eName, entity); - } - } + ////////////////////////////////////////////////////////////////////// + // High-level I/O. + ////////////////////////////////////////////////////////////////////// + + /** + * Read a single character from the readBuffer. + * <p>The readDataChunk () method maintains the buffer. + * <p>If we hit the end of an entity, try to pop the stack and + * keep going. + * <p> (This approach doesn't really enforce XML's rules about + * entity boundaries, but this is not currently a validating + * parser). + * <p>This routine also attempts to keep track of the current + * position in external entities, but it's not entirely accurate. + * @return The next available input character. + * @see #unread (char) + * @see #readDataChunk + * @see #readBuffer + * @see #line + * @return The next character from the current input source. + */ + private char readCh() + throws SAXException, IOException + { + // As long as there's nothing in the + // read buffer, try reading more data + // (for an external entity) or popping + // the entity stack (for either). + while (readBufferPos >= readBufferLength) + { + switch (sourceType) + { + case INPUT_READER: + case INPUT_STREAM: + readDataChunk(); + while (readBufferLength < 1) + { + popInput(); + if (readBufferLength < 1) + { + readDataChunk(); + } + } + break; + + default: + + popInput(); + break; + } + } + + char c = readBuffer[readBufferPos++]; + + if (c == '\n') + { + line++; + column = 0; + } + else + { + if (c == '<') + { + /* the most common return to parseContent () ... NOP */ + } + else if (((c < 0x0020 && (c != '\t') && (c != '\r')) || c > 0xFFFD) + || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085) + && xmlVersion == XML_11)) + { + error("illegal XML character U+" + Integer.toHexString(c)); + } + // If we're in the DTD and in a context where PEs get expanded, + // do so ... 1/14/2000 errata identify those contexts. There + // are also spots in the internal subset where PE refs are fatal + // errors, hence yet another flag. + else if (c == '%' && expandPE) + { + if (peIsError) + { + error("PE reference within decl in internal subset."); + } + parsePEReference(); + return readCh(); + } + column++; + } - // - // Notations. - // + return c; + } - /** - * Report a notation declaration, checking for duplicates. - */ - private void setNotation (String nname, String ids []) + /** + * Push a single character back onto the current input stream. + * <p>This method usually pushes the character back onto + * the readBuffer. + * <p>I don't think that this would ever be called with + * readBufferPos = 0, because the methods always reads a character + * before unreading it, but just in case, I've added a boundary + * condition. + * @param c The character to push back. + * @see #readCh + * @see #unread (char[]) + * @see #readBuffer + */ + private void unread(char c) throws SAXException - { - if (skippedPE) - return; - - handler.notationDecl (nname, ids); - if (notationInfo.get (nname) == null) - notationInfo.put (nname, nname); - else - // VC: Unique Notation Name - handler.verror ("Duplicate notation name decl: " + nname); - } - - - // - // Location. - // - - - /** - * Return the current line number. - */ - public int getLineNumber () - { - return line; - } - - - /** - * Return the current column number. - */ - public int getColumnNumber () - { - return column; - } + { + // Normal condition. + if (c == '\n') + { + line--; + column = -1; + } + if (readBufferPos > 0) + { + readBuffer[--readBufferPos] = c; + } + else + { + pushString(null, new Character(c).toString()); + } + } + /** + * Push a char array back onto the current input stream. + * <p>NOTE: you must <em>never</em> push back characters that you + * haven't actually read: use pushString () instead. + * @see #readCh + * @see #unread (char) + * @see #readBuffer + * @see #pushString + */ + private void unread(char[] ch, int length) + throws SAXException + { + for (int i = 0; i < length; i++) + { + if (ch[i] == '\n') + { + line--; + column = -1; + } + } + if (length < readBufferPos) + { + readBufferPos -= length; + } + else + { + pushCharArray(null, ch, 0, length); + } + } - ////////////////////////////////////////////////////////////////////// - // High-level I/O. - ////////////////////////////////////////////////////////////////////// - - - /** - * Read a single character from the readBuffer. - * <p>The readDataChunk () method maintains the buffer. - * <p>If we hit the end of an entity, try to pop the stack and - * keep going. - * <p> (This approach doesn't really enforce XML's rules about - * entity boundaries, but this is not currently a validating - * parser). - * <p>This routine also attempts to keep track of the current - * position in external entities, but it's not entirely accurate. - * @return The next available input character. - * @see #unread (char) - * @see #readDataChunk - * @see #readBuffer - * @see #line - * @return The next character from the current input source. - */ - private char readCh () + /** + * Push, or skip, a new external input source. + * The source will be some kind of parsed entity, such as a PE + * (including the external DTD subset) or content for the body. + * + * @param url The java.net.URL object for the entity. + * @see SAXDriver#resolveEntity + * @see #pushString + * @see #sourceType + * @see #pushInput + * @see #detectEncoding + * @see #sourceType + * @see #readBuffer + */ + private void pushURL(boolean isPE, + String ename, + ExternalIdentifiers ids, + Reader reader, + InputStream stream, + String encoding, + boolean doResolve) throws SAXException, IOException - { - // As long as there's nothing in the - // read buffer, try reading more data - // (for an external entity) or popping - // the entity stack (for either). - while (readBufferPos >= readBufferLength) { - switch (sourceType) { - case INPUT_READER: - case INPUT_STREAM: - readDataChunk (); - while (readBufferLength < 1) { - popInput (); - if (readBufferLength < 1) { - readDataChunk (); - } - } - break; - - default: - - popInput (); - break; - } - } - - char c = readBuffer [readBufferPos++]; - - if (c == '\n') { - line++; - column = 0; - } else { - if (c == '<') { - /* the most common return to parseContent () ... NOP */ - } else if (((c < 0x0020 && (c != '\t') && (c != '\r')) || c > 0xFFFD) - || ((c >= 0x007f) && (c <= 0x009f) && (c != 0x0085) - && xmlVersion == XML_11)) - error ("illegal XML character U+" - + Integer.toHexString (c)); - - // If we're in the DTD and in a context where PEs get expanded, - // do so ... 1/14/2000 errata identify those contexts. There - // are also spots in the internal subset where PE refs are fatal - // errors, hence yet another flag. - else if (c == '%' && expandPE) { - if (peIsError) - error ("PE reference within decl in internal subset."); - parsePEReference (); - return readCh (); - } - column++; - } - - return c; - } + { + boolean ignoreEncoding; + String systemId; + InputSource source; + if (!isPE) + { + dataBufferFlush(); + } - /** - * Push a single character back onto the current input stream. - * <p>This method usually pushes the character back onto - * the readBuffer. - * <p>I don't think that this would ever be called with - * readBufferPos = 0, because the methods always reads a character - * before unreading it, but just in case, I've added a boundary - * condition. - * @param c The character to push back. - * @see #readCh - * @see #unread (char[]) - * @see #readBuffer - */ - private void unread (char c) - throws SAXException - { - // Normal condition. - if (c == '\n') { - line--; - column = -1; - } - if (readBufferPos > 0) { - readBuffer [--readBufferPos] = c; - } else { - pushString (null, new Character (c).toString ()); - } - } + scratch.setPublicId(ids.publicId); + scratch.setSystemId(ids.systemId); + + // See if we should skip or substitute the entity. + // If we're not skipping, resolving reports startEntity() + // and updates the (handler's) stack of URIs. + if (doResolve) + { + // assert (stream == null && reader == null && encoding == null) + source = handler.resolveEntity(isPE, ename, scratch, ids.baseUri); + if (source == null) + { + handler.warn("skipping entity: " + ename); + handler.skippedEntity(ename); + if (isPE) + { + skippedPE = true; + } + return; + } + // we might be using alternate IDs/encoding + systemId = source.getSystemId(); + // The following warning and setting systemId was deleted bcause + // the application has the option of not setting systemId + // provided that it has set the characte/byte stream. + /* + if (systemId == null) { + handler.warn ("missing system ID, using " + ids.systemId); + systemId = ids.systemId; + } + */ + } + else + { + // "[document]", or "[dtd]" via getExternalSubset() + scratch.setCharacterStream(reader); + scratch.setByteStream(stream); + scratch.setEncoding(encoding); + source = scratch; + systemId = ids.systemId; + if (handler.stringInterning) + { + handler.startExternalEntity(ename, systemId, + "[document]" == ename); + } + else + { + handler.startExternalEntity(ename, systemId, + "[document]".equals(ename)); + } + } - /** - * Push a char array back onto the current input stream. - * <p>NOTE: you must <em>never</em> push back characters that you - * haven't actually read: use pushString () instead. - * @see #readCh - * @see #unread (char) - * @see #readBuffer - * @see #pushString - */ - private void unread (char ch[], int length) - throws SAXException - { - for (int i = 0; i < length; i++) { - if (ch [i] == '\n') { - line--; - column = -1; - } - } - if (length < readBufferPos) { - readBufferPos -= length; - } else { - pushCharArray (null, ch, 0, length); - } - } + // we may have been given I/O streams directly + if (source.getCharacterStream() != null) + { + if (source.getByteStream() != null) + error("InputSource has two streams!"); + reader = source.getCharacterStream(); + } + else if (source.getByteStream() != null) + { + encoding = source.getEncoding(); + if (encoding == null) + { + stream = source.getByteStream(); + } + else + { + try + { + reader = new InputStreamReader(source.getByteStream(), + encoding); + } + catch (IOException e) + { + stream = source.getByteStream(); + } + } + } + else if (systemId == null) + { + error("InputSource has no URI!"); + } + scratch.setCharacterStream(null); + scratch.setByteStream(null); + scratch.setEncoding(null); + + // Push the existing status. + pushInput(ename); + + // Create a new read buffer. + // (Note the four-character margin) + readBuffer = new char[READ_BUFFER_MAX + 4]; + readBufferPos = 0; + readBufferLength = 0; + readBufferOverflow = -1; + is = null; + line = 1; + column = 0; + currentByteCount = 0; + + // If there's an explicit character stream, just + // ignore encoding declarations. + if (reader != null) + { + sourceType = INPUT_READER; + this.reader = reader; + tryEncodingDecl(true); + return; + } + + // Else we handle the conversion, and need to ensure + // it's done right. + sourceType = INPUT_STREAM; + if (stream != null) + { + is = stream; + } + else + { + // We have to open our own stream to the URL. + URL url = new URL(systemId); + + externalEntity = url.openConnection(); + externalEntity.connect(); + is = externalEntity.getInputStream(); + } + + // If we get to here, there must be + // an InputStream available. + if (!is.markSupported()) + { + is = new BufferedInputStream(is); + } + // Get any external encoding label. + if (encoding == null && externalEntity != null) + { + // External labels can be untrustworthy; filesystems in + // particular often have the wrong default for content + // that wasn't locally originated. Those we autodetect. + if (!"file".equals(externalEntity.getURL().getProtocol())) + { + int temp; + + // application/xml;charset=something;otherAttr=... + // ... with many variants on 'something' + encoding = externalEntity.getContentType(); + + // MHK code (fix for Saxon 5.5.1/007): + // protect against encoding==null + if (encoding == null) + { + temp = -1; + } + else + { + temp = encoding.indexOf("charset"); + } + + // RFC 2376 sez MIME text defaults to ASCII, but since the + // JDK will create a MIME type out of thin air, we always + // autodetect when there's no explicit charset attribute. + if (temp < 0) + { + encoding = null; // autodetect + } + else + { + // only this one attribute + if ((temp = encoding.indexOf(';')) > 0) + { + encoding = encoding.substring(0, temp); + } + + if ((temp = encoding.indexOf('=', temp + 7)) > 0) + { + encoding = encoding.substring(temp + 1); + + // attributes can have comment fields (RFC 822) + if ((temp = encoding.indexOf('(')) > 0) + { + encoding = encoding.substring(0, temp); + } + // ... and values may be quoted + if ((temp = encoding.indexOf('"')) > 0) + { + encoding = + encoding.substring(temp + 1, + encoding.indexOf('"', temp + 2)); + } + encoding.trim(); + } + else + { + handler.warn("ignoring illegal MIME attribute: " + + encoding); + encoding = null; + } + } + } + } + + // if we got an external encoding label, use it ... + if (encoding != null) + { + this.encoding = ENCODING_EXTERNAL; + setupDecoding(encoding); + ignoreEncoding = true; + + // ... else autodetect from first bytes. + } + else + { + detectEncoding(); + ignoreEncoding = false; + } - /** - * Push, or skip, a new external input source. - * The source will be some kind of parsed entity, such as a PE - * (including the external DTD subset) or content for the body. - * - * @param url The java.net.URL object for the entity. - * @see SAXDriver#resolveEntity - * @see #pushString - * @see #sourceType - * @see #pushInput - * @see #detectEncoding - * @see #sourceType - * @see #readBuffer - */ - private void pushURL ( - boolean isPE, - String ename, - String ids [], // public, system, baseURI - Reader reader, - InputStream stream, - String encoding, - boolean doResolve - ) throws SAXException, IOException - { - boolean ignoreEncoding; - String systemId; - InputSource source; - - if (!isPE) - dataBufferFlush (); - - scratch.setPublicId (ids [0]); - scratch.setSystemId (ids [1]); - - // See if we should skip or substitute the entity. - // If we're not skipping, resolving reports startEntity() - // and updates the (handler's) stack of URIs. - if (doResolve) { - // assert (stream == null && reader == null && encoding == null) - source = handler.resolveEntity (isPE, ename, scratch, ids [2]); - if (source == null) { - handler.warn ("skipping entity: " + ename); - handler.skippedEntity (ename); - if (isPE) - skippedPE = true; - return; - } - - // we might be using alternate IDs/encoding - systemId = source.getSystemId (); - // The following warning and setting systemId was deleted bcause - // the application has the option of not setting systemId - // provided that it has set the characte/byte stream. - /* - if (systemId == null) { - handler.warn ("missing system ID, using " + ids [1]); - systemId = ids [1]; - } - */ - } else { - // "[document]", or "[dtd]" via getExternalSubset() - scratch.setCharacterStream (reader); - scratch.setByteStream (stream); - scratch.setEncoding (encoding); - source = scratch; - systemId = ids [1]; - if (handler.getFeature (SAXDriver.FEATURE + "string-interning")) { - handler.startExternalEntity (ename, systemId, - "[document]" == ename); - } else { - handler.startExternalEntity (ename, systemId, - "[document]".equals(ename)); - } - } - - // we may have been given I/O streams directly - if (source.getCharacterStream () != null) { - if (source.getByteStream () != null) - error ("InputSource has two streams!"); - reader = source.getCharacterStream (); - } else if (source.getByteStream () != null) { - encoding = source.getEncoding (); - if (encoding == null) - stream = source.getByteStream (); - else try { - reader = new InputStreamReader ( - source.getByteStream (), - encoding); - } catch (IOException e) { - stream = source.getByteStream (); - } - } else if (systemId == null) - error ("InputSource has no URI!"); - scratch.setCharacterStream (null); - scratch.setByteStream (null); - scratch.setEncoding (null); - - // Push the existing status. - pushInput (ename); - - // Create a new read buffer. - // (Note the four-character margin) - readBuffer = new char [READ_BUFFER_MAX + 4]; - readBufferPos = 0; - readBufferLength = 0; - readBufferOverflow = -1; - is = null; - line = 1; - column = 0; - currentByteCount = 0; - - // If there's an explicit character stream, just - // ignore encoding declarations. - if (reader != null) { - sourceType = INPUT_READER; - this.reader = reader; - tryEncodingDecl (true); - return; - } - - // Else we handle the conversion, and need to ensure - // it's done right. - sourceType = INPUT_STREAM; - if (stream != null) { - is = stream; - } else { - // We have to open our own stream to the URL. - URL url = new URL (systemId); - - externalEntity = url.openConnection (); - externalEntity.connect (); - is = externalEntity.getInputStream (); - } - - // If we get to here, there must be - // an InputStream available. - if (!is.markSupported ()) { - is = new BufferedInputStream (is); - } - - // Get any external encoding label. - if (encoding == null && externalEntity != null) { - // External labels can be untrustworthy; filesystems in - // particular often have the wrong default for content - // that wasn't locally originated. Those we autodetect. - if (!"file".equals (externalEntity.getURL ().getProtocol ())) { - int temp; - - // application/xml;charset=something;otherAttr=... - // ... with many variants on 'something' - encoding = externalEntity.getContentType (); - - // MHK code (fix for Saxon 5.5.1/007): - // protect against encoding==null - if (encoding==null) { - temp = -1; - } else { - temp = encoding.indexOf ("charset"); - } - - // RFC 2376 sez MIME text defaults to ASCII, but since the - // JDK will create a MIME type out of thin air, we always - // autodetect when there's no explicit charset attribute. - if (temp < 0) - encoding = null; // autodetect - else { - // only this one attribute - if ((temp = encoding.indexOf (';')) > 0) - encoding = encoding.substring (0, temp); - - if ((temp = encoding.indexOf ('=', temp + 7)) > 0) { - encoding = encoding.substring (temp + 1); - - // attributes can have comment fields (RFC 822) - if ((temp = encoding.indexOf ('(')) > 0) - encoding = encoding.substring (0, temp); - // ... and values may be quoted - if ((temp = encoding.indexOf ('"')) > 0) - encoding = encoding.substring (temp + 1, - encoding.indexOf ('"', temp + 2)); - encoding.trim (); - } else { - handler.warn ("ignoring illegal MIME attribute: " - + encoding); - encoding = null; - } - } - } - } - - // if we got an external encoding label, use it ... - if (encoding != null) { - this.encoding = ENCODING_EXTERNAL; - setupDecoding (encoding); - ignoreEncoding = true; - - // ... else autodetect from first bytes. - } else { - detectEncoding (); - ignoreEncoding = false; - } - - // Read any XML or text declaration. - // If we autodetected, it may tell us the "real" encoding. - try { - tryEncodingDecl (ignoreEncoding); - } catch (UnsupportedEncodingException x) { - encoding = x.getMessage (); - - // if we don't handle the declared encoding, - // try letting a JVM InputStreamReader do it - try { - if (sourceType != INPUT_STREAM) - throw x; - - is.reset (); - readBufferPos = 0; - readBufferLength = 0; - readBufferOverflow = -1; - line = 1; - currentByteCount = column = 0; - - sourceType = INPUT_READER; - this.reader = new InputStreamReader (is, encoding); - is = null; - - tryEncodingDecl (true); - - } catch (IOException e) { - error ("unsupported text encoding", - encoding, - null); - } - } - } + // Read any XML or text declaration. + // If we autodetected, it may tell us the "real" encoding. + try + { + tryEncodingDecl(ignoreEncoding); + } + catch (UnsupportedEncodingException x) + { + encoding = x.getMessage(); + // if we don't handle the declared encoding, + // try letting a JVM InputStreamReader do it + try + { + if (sourceType != INPUT_STREAM) + { + throw x; + } + + is.reset(); + readBufferPos = 0; + readBufferLength = 0; + readBufferOverflow = -1; + line = 1; + currentByteCount = column = 0; + + sourceType = INPUT_READER; + this.reader = new InputStreamReader(is, encoding); + is = null; + + tryEncodingDecl(true); + + } + catch (IOException e) + { + error("unsupported text encoding", + encoding, + null); + } + } + } - /** - * Check for an encoding declaration. This is the second part of the - * XML encoding autodetection algorithm, relying on detectEncoding to - * get to the point that this part can read any encoding declaration - * in the document (using only US-ASCII characters). - * - * <p> Because this part starts to fill parser buffers with this data, - * it's tricky to setup a reader so that Java's built-in decoders can be - * used for the character encodings that aren't built in to this parser - * (such as EUC-JP, KOI8-R, Big5, etc). - * - * @return any encoding in the declaration, uppercased; or null - * @see detectEncoding - */ - private String tryEncodingDecl (boolean ignoreEncoding) + /** + * Check for an encoding declaration. This is the second part of the + * XML encoding autodetection algorithm, relying on detectEncoding to + * get to the point that this part can read any encoding declaration + * in the document (using only US-ASCII characters). + * + * <p> Because this part starts to fill parser buffers with this data, + * it's tricky to setup a reader so that Java's built-in decoders can be + * used for the character encodings that aren't built in to this parser + * (such as EUC-JP, KOI8-R, Big5, etc). + * + * @return any encoding in the declaration, uppercased; or null + * @see detectEncoding + */ + private String tryEncodingDecl(boolean ignoreEncoding) throws SAXException, IOException - { - // Read the XML/text declaration. - if (tryRead ("<?xml")) { - if (tryWhitespace ()) { - if (inputStack.size () > 0) { - return parseTextDecl (ignoreEncoding); - } else { - return parseXMLDecl (ignoreEncoding); - } - } else { - // <?xml-stylesheet ...?> or similar - unread ('l'); - unread ('m'); - unread ('x'); - unread ('?'); - unread ('<'); - } - } - return null; - } - + { + // Read the XML/text declaration. + if (tryRead("<?xml")) + { + if (tryWhitespace()) + { + if (inputStack.size() > 0) + { + return parseTextDecl(ignoreEncoding); + } + else + { + return parseXMLDecl(ignoreEncoding); + } + } + else + { + // <?xml-stylesheet ...?> or similar + unread('l'); + unread('m'); + unread('x'); + unread('?'); + unread('<'); + } + } + return null; + } - /** - * Attempt to detect the encoding of an entity. - * <p>The trick here (as suggested in the XML standard) is that - * any entity not in UTF-8, or in UCS-2 with a byte-order mark, - * <b>must</b> begin with an XML declaration or an encoding - * declaration; we simply have to look for "<?xml" in various - * encodings. - * <p>This method has no way to distinguish among 8-bit encodings. - * Instead, it sets up for UTF-8, then (possibly) revises its assumption - * later in setupDecoding (). Any ASCII-derived 8-bit encoding - * should work, but most will be rejected later by setupDecoding (). - * @see #tryEncoding (byte[], byte, byte, byte, byte) - * @see #tryEncoding (byte[], byte, byte) - * @see #setupDecoding - */ - private void detectEncoding () + /** + * Attempt to detect the encoding of an entity. + * <p>The trick here (as suggested in the XML standard) is that + * any entity not in UTF-8, or in UCS-2 with a byte-order mark, + * <b>must</b> begin with an XML declaration or an encoding + * declaration; we simply have to look for "<?xml" in various + * encodings. + * <p>This method has no way to distinguish among 8-bit encodings. + * Instead, it sets up for UTF-8, then (possibly) revises its assumption + * later in setupDecoding (). Any ASCII-derived 8-bit encoding + * should work, but most will be rejected later by setupDecoding (). + * @see #tryEncoding (byte[], byte, byte, byte, byte) + * @see #tryEncoding (byte[], byte, byte) + * @see #setupDecoding + */ + private void detectEncoding() throws SAXException, IOException - { - byte signature[] = new byte [4]; - - // Read the first four bytes for - // autodetection. - is.mark (4); - is.read (signature); - is.reset (); - - // - // FIRST: four byte encodings (who uses these?) - // - if (tryEncoding (signature, (byte) 0x00, (byte) 0x00, - (byte) 0x00, (byte) 0x3c)) { - // UCS-4 must begin with "<?xml" - // 0x00 0x00 0x00 0x3c: UCS-4, big-endian (1234) - // "UTF-32BE" - encoding = ENCODING_UCS_4_1234; - - } else if (tryEncoding (signature, (byte) 0x3c, (byte) 0x00, - (byte) 0x00, (byte) 0x00)) { - // 0x3c 0x00 0x00 0x00: UCS-4, little-endian (4321) - // "UTF-32LE" - encoding = ENCODING_UCS_4_4321; - - } else if (tryEncoding (signature, (byte) 0x00, (byte) 0x00, - (byte) 0x3c, (byte) 0x00)) { - // 0x00 0x00 0x3c 0x00: UCS-4, unusual (2143) - encoding = ENCODING_UCS_4_2143; - - } else if (tryEncoding (signature, (byte) 0x00, (byte) 0x3c, - (byte) 0x00, (byte) 0x00)) { - // 0x00 0x3c 0x00 0x00: UCS-4, unusual (3421) - encoding = ENCODING_UCS_4_3412; - - // 00 00 fe ff UCS_4_1234 (with BOM) - // ff fe 00 00 UCS_4_4321 (with BOM) - } - - // - // SECOND: two byte encodings - // note ... with 1/14/2000 errata the XML spec identifies some - // more "broken UTF-16" autodetection cases, with no XML decl, - // which we don't handle here (that's legal too). - // - else if (tryEncoding (signature, (byte) 0xfe, (byte) 0xff)) { - // UCS-2 with a byte-order marker. (UTF-16) - // 0xfe 0xff: UCS-2, big-endian (12) - encoding = ENCODING_UCS_2_12; - is.read (); is.read (); - - } else if (tryEncoding (signature, (byte) 0xff, (byte) 0xfe)) { - // UCS-2 with a byte-order marker. (UTF-16) - // 0xff 0xfe: UCS-2, little-endian (21) - encoding = ENCODING_UCS_2_21; - is.read (); is.read (); - - } else if (tryEncoding (signature, (byte) 0x00, (byte) 0x3c, - (byte) 0x00, (byte) 0x3f)) { - // UTF-16BE (otherwise, malformed UTF-16) - // 0x00 0x3c 0x00 0x3f: UCS-2, big-endian, no byte-order mark - encoding = ENCODING_UCS_2_12; - error ("no byte-order mark for UCS-2 entity"); - - } else if (tryEncoding (signature, (byte) 0x3c, (byte) 0x00, - (byte) 0x3f, (byte) 0x00)) { - // UTF-16LE (otherwise, malformed UTF-16) - // 0x3c 0x00 0x3f 0x00: UCS-2, little-endian, no byte-order mark - encoding = ENCODING_UCS_2_21; - error ("no byte-order mark for UCS-2 entity"); - } - - // - // THIRD: ASCII-derived encodings, fixed and variable lengths - // - else if (tryEncoding (signature, (byte) 0x3c, (byte) 0x3f, - (byte) 0x78, (byte) 0x6d)) { - // ASCII derived - // 0x3c 0x3f 0x78 0x6d: UTF-8 or other 8-bit markup (read ENCODING) - encoding = ENCODING_UTF_8; - prefetchASCIIEncodingDecl (); - - } else if (signature [0] == (byte) 0xef - && signature [1] == (byte) 0xbb - && signature [2] == (byte) 0xbf) { - // 0xef 0xbb 0xbf: UTF-8 BOM (not part of document text) - // this un-needed notion slipped into XML 2nd ed through a - // "non-normative" erratum; now required by MSFT and UDDI, - // and E22 made it normative. - encoding = ENCODING_UTF_8; - is.read (); is.read (); is.read (); - - } else { - // 4c 6f a7 94 ... we don't understand EBCDIC flavors - // ... but we COULD at least kick in some fixed code page - - // (default) UTF-8 without encoding/XML declaration - encoding = ENCODING_UTF_8; - } - } - + { + byte[] signature = new byte[4]; - /** - * Check for a four-byte signature. - * <p>Utility routine for detectEncoding (). - * <p>Always looks for some part of "<?XML" in a specific encoding. - * @param sig The first four bytes read. - * @param b1 The first byte of the signature - * @param b2 The second byte of the signature - * @param b3 The third byte of the signature - * @param b4 The fourth byte of the signature - * @see #detectEncoding - */ - private static boolean tryEncoding ( - byte sig[], byte b1, byte b2, byte b3, byte b4) - { - return (sig [0] == b1 && sig [1] == b2 - && sig [2] == b3 && sig [3] == b4); - } + // Read the first four bytes for + // autodetection. + is.mark(4); + is.read(signature); + is.reset(); + // + // FIRST: four byte encodings (who uses these?) + // + if (tryEncoding(signature, (byte) 0x00, (byte) 0x00, + (byte) 0x00, (byte) 0x3c)) + { + // UCS-4 must begin with "<?xml" + // 0x00 0x00 0x00 0x3c: UCS-4, big-endian (1234) + // "UTF-32BE" + encoding = ENCODING_UCS_4_1234; + } + else if (tryEncoding(signature, (byte) 0x3c, (byte) 0x00, + (byte) 0x00, (byte) 0x00)) + { + // 0x3c 0x00 0x00 0x00: UCS-4, little-endian (4321) + // "UTF-32LE" + encoding = ENCODING_UCS_4_4321; + } + else if (tryEncoding(signature, (byte) 0x00, (byte) 0x00, + (byte) 0x3c, (byte) 0x00)) + { + // 0x00 0x00 0x3c 0x00: UCS-4, unusual (2143) + encoding = ENCODING_UCS_4_2143; + } + else if (tryEncoding(signature, (byte) 0x00, (byte) 0x3c, + (byte) 0x00, (byte) 0x00)) + { + // 0x00 0x3c 0x00 0x00: UCS-4, unusual (3421) + encoding = ENCODING_UCS_4_3412; + + // 00 00 fe ff UCS_4_1234 (with BOM) + // ff fe 00 00 UCS_4_4321 (with BOM) + } - /** - * Check for a two-byte signature. - * <p>Looks for a UCS-2 byte-order mark. - * <p>Utility routine for detectEncoding (). - * @param sig The first four bytes read. - * @param b1 The first byte of the signature - * @param b2 The second byte of the signature - * @see #detectEncoding - */ - private static boolean tryEncoding (byte sig[], byte b1, byte b2) - { - return ((sig [0] == b1) && (sig [1] == b2)); - } + // + // SECOND: two byte encodings + // note ... with 1/14/2000 errata the XML spec identifies some + // more "broken UTF-16" autodetection cases, with no XML decl, + // which we don't handle here (that's legal too). + // + else if (tryEncoding(signature, (byte) 0xfe, (byte) 0xff)) + { + // UCS-2 with a byte-order marker. (UTF-16) + // 0xfe 0xff: UCS-2, big-endian (12) + encoding = ENCODING_UCS_2_12; + is.read(); is.read(); + } + else if (tryEncoding(signature, (byte) 0xff, (byte) 0xfe)) + { + // UCS-2 with a byte-order marker. (UTF-16) + // 0xff 0xfe: UCS-2, little-endian (21) + encoding = ENCODING_UCS_2_21; + is.read(); is.read(); + } + else if (tryEncoding(signature, (byte) 0x00, (byte) 0x3c, + (byte) 0x00, (byte) 0x3f)) + { + // UTF-16BE (otherwise, malformed UTF-16) + // 0x00 0x3c 0x00 0x3f: UCS-2, big-endian, no byte-order mark + encoding = ENCODING_UCS_2_12; + error("no byte-order mark for UCS-2 entity"); + } + else if (tryEncoding(signature, (byte) 0x3c, (byte) 0x00, + (byte) 0x3f, (byte) 0x00)) + { + // UTF-16LE (otherwise, malformed UTF-16) + // 0x3c 0x00 0x3f 0x00: UCS-2, little-endian, no byte-order mark + encoding = ENCODING_UCS_2_21; + error("no byte-order mark for UCS-2 entity"); + } + // + // THIRD: ASCII-derived encodings, fixed and variable lengths + // + else if (tryEncoding(signature, (byte) 0x3c, (byte) 0x3f, + (byte) 0x78, (byte) 0x6d)) + { + // ASCII derived + // 0x3c 0x3f 0x78 0x6d: UTF-8 or other 8-bit markup (read ENCODING) + encoding = ENCODING_UTF_8; + prefetchASCIIEncodingDecl(); + } + else if (signature[0] == (byte) 0xef + && signature[1] == (byte) 0xbb + && signature[2] == (byte) 0xbf) + { + // 0xef 0xbb 0xbf: UTF-8 BOM (not part of document text) + // this un-needed notion slipped into XML 2nd ed through a + // "non-normative" erratum; now required by MSFT and UDDI, + // and E22 made it normative. + encoding = ENCODING_UTF_8; + is.read(); is.read(); is.read(); + } + else + { + // 4c 6f a7 94 ... we don't understand EBCDIC flavors + // ... but we COULD at least kick in some fixed code page + + // (default) UTF-8 without encoding/XML declaration + encoding = ENCODING_UTF_8; + } + } - /** - * This method pushes a string back onto input. - * <p>It is useful either as the expansion of an internal entity, - * or for backtracking during the parse. - * <p>Call pushCharArray () to do the actual work. - * @param s The string to push back onto input. - * @see #pushCharArray - */ - private void pushString (String ename, String s) - throws SAXException - { - char ch[] = s.toCharArray (); - pushCharArray (ename, ch, 0, ch.length); - } + /** + * Check for a four-byte signature. + * <p>Utility routine for detectEncoding (). + * <p>Always looks for some part of "<?XML" in a specific encoding. + * @param sig The first four bytes read. + * @param b1 The first byte of the signature + * @param b2 The second byte of the signature + * @param b3 The third byte of the signature + * @param b4 The fourth byte of the signature + * @see #detectEncoding + */ + private static boolean tryEncoding(byte[] sig, byte b1, byte b2, + byte b3, byte b4) + { + return (sig[0] == b1 && sig[1] == b2 + && sig[2] == b3 && sig[3] == b4); + } + /** + * Check for a two-byte signature. + * <p>Looks for a UCS-2 byte-order mark. + * <p>Utility routine for detectEncoding (). + * @param sig The first four bytes read. + * @param b1 The first byte of the signature + * @param b2 The second byte of the signature + * @see #detectEncoding + */ + private static boolean tryEncoding(byte[] sig, byte b1, byte b2) + { + return ((sig[0] == b1) && (sig[1] == b2)); + } - /** - * Push a new internal input source. - * <p>This method is useful for expanding an internal entity, - * or for unreading a string of characters. It creates a new - * readBuffer containing the characters in the array, instead - * of characters converted from an input byte stream. - * @param ch The char array to push. - * @see #pushString - * @see #pushURL - * @see #readBuffer - * @see #sourceType - * @see #pushInput - */ - private void pushCharArray (String ename, char ch[], int start, int length) + /** + * This method pushes a string back onto input. + * <p>It is useful either as the expansion of an internal entity, + * or for backtracking during the parse. + * <p>Call pushCharArray () to do the actual work. + * @param s The string to push back onto input. + * @see #pushCharArray + */ + private void pushString(String ename, String s) throws SAXException - { - // Push the existing status - pushInput (ename); - if (ename != null && doReport) { - dataBufferFlush (); - handler.startInternalEntity (ename); - } - sourceType = INPUT_INTERNAL; - readBuffer = ch; - readBufferPos = start; - readBufferLength = length; - readBufferOverflow = -1; - } - + { + char[] ch = s.toCharArray(); + pushCharArray(ename, ch, 0, ch.length); + } - /** - * Save the current input source onto the stack. - * <p>This method saves all of the global variables associated with - * the current input source, so that they can be restored when a new - * input source has finished. It also tests for entity recursion. - * <p>The method saves the following global variables onto a stack - * using a fixed-length array: - * <ol> - * <li>sourceType - * <li>externalEntity - * <li>readBuffer - * <li>readBufferPos - * <li>readBufferLength - * <li>line - * <li>encoding - * </ol> - * @param ename The name of the entity (if any) causing the new input. - * @see #popInput - * @see #sourceType - * @see #externalEntity - * @see #readBuffer - * @see #readBufferPos - * @see #readBufferLength - * @see #line - * @see #encoding - */ - private void pushInput (String ename) + /** + * Push a new internal input source. + * <p>This method is useful for expanding an internal entity, + * or for unreading a string of characters. It creates a new + * readBuffer containing the characters in the array, instead + * of characters converted from an input byte stream. + * @param ch The char array to push. + * @see #pushString + * @see #pushURL + * @see #readBuffer + * @see #sourceType + * @see #pushInput + */ + private void pushCharArray(String ename, char[] ch, int start, int length) throws SAXException - { - // Check for entity recursion. - if (ename != null) { - Enumeration entities = entityStack.elements (); - while (entities.hasMoreElements ()) { - String e = (String) entities.nextElement (); - if (e != null && e == ename) { - error ("recursive reference to entity", ename, null); - } - } - } - entityStack.push (ename); - - // Don't bother if there is no current input. - if (sourceType == INPUT_NONE) { - return; - } - - // Set up a snapshot of the current - // input source. - Object input[] = new Object [12]; - - input [0] = new Integer (sourceType); - input [1] = externalEntity; - input [2] = readBuffer; - input [3] = new Integer (readBufferPos); - input [4] = new Integer (readBufferLength); - input [5] = new Integer (line); - input [6] = new Integer (encoding); - input [7] = new Integer (readBufferOverflow); - input [8] = is; - input [9] = new Integer (currentByteCount); - input [10] = new Integer (column); - input [11] = reader; - - // Push it onto the stack. - inputStack.push (input); - } + { + // Push the existing status + pushInput(ename); + if (ename != null && doReport) + { + dataBufferFlush(); + handler.startInternalEntity(ename); + } + sourceType = INPUT_INTERNAL; + readBuffer = ch; + readBufferPos = start; + readBufferLength = length; + readBufferOverflow = -1; + } + /** + * Save the current input source onto the stack. + * <p>This method saves all of the global variables associated with + * the current input source, so that they can be restored when a new + * input source has finished. It also tests for entity recursion. + * <p>The method saves the following global variables onto a stack + * using a fixed-length array: + * <ol> + * <li>sourceType + * <li>externalEntity + * <li>readBuffer + * <li>readBufferPos + * <li>readBufferLength + * <li>line + * <li>encoding + * </ol> + * @param ename The name of the entity (if any) causing the new input. + * @see #popInput + * @see #sourceType + * @see #externalEntity + * @see #readBuffer + * @see #readBufferPos + * @see #readBufferLength + * @see #line + * @see #encoding + */ + private void pushInput(String ename) + throws SAXException + { + // Check for entity recursion. + if (ename != null) + { + Iterator entities = entityStack.iterator(); + while (entities.hasNext()) + { + String e = (String) entities.next(); + if (e != null && e == ename) + { + error("recursive reference to entity", ename, null); + } + } + } + entityStack.addLast(ename); + + // Don't bother if there is no current input. + if (sourceType == INPUT_NONE) + { + return; + } + + // Set up a snapshot of the current + // input source. + Input input = new Input(); + + input.sourceType = sourceType; + input.externalEntity = externalEntity; + input.readBuffer = readBuffer; + input.readBufferPos = readBufferPos; + input.readBufferLength = readBufferLength; + input.line = line; + input.encoding = encoding; + input.readBufferOverflow = readBufferOverflow; + input.is = is; + input.currentByteCount = currentByteCount; + input.column = column; + input.reader = reader; + + // Push it onto the stack. + inputStack.addLast(input); + } - /** - * Restore a previous input source. - * <p>This method restores all of the global variables associated with - * the current input source. - * @exception java.io.EOFException - * If there are no more entries on the input stack. - * @see #pushInput - * @see #sourceType - * @see #externalEntity - * @see #readBuffer - * @see #readBufferPos - * @see #readBufferLength - * @see #line - * @see #encoding - */ - private void popInput () + /** + * Restore a previous input source. + * <p>This method restores all of the global variables associated with + * the current input source. + * @exception java.io.EOFException + * If there are no more entries on the input stack. + * @see #pushInput + * @see #sourceType + * @see #externalEntity + * @see #readBuffer + * @see #readBufferPos + * @see #readBufferLength + * @see #line + * @see #encoding + */ + private void popInput() throws SAXException, IOException - { - String ename = (String) entityStack.pop (); - - if (ename != null && doReport) - dataBufferFlush (); - switch (sourceType) { - case INPUT_STREAM: - handler.endExternalEntity (ename); - is.close (); - break; - case INPUT_READER: - handler.endExternalEntity (ename); - reader.close (); - break; - case INPUT_INTERNAL: - if (ename != null && doReport) - handler.endInternalEntity (ename); - break; - } - - // Throw an EOFException if there - // is nothing else to pop. - if (inputStack.isEmpty ()) { - throw new EOFException ("no more input"); - } - - Object input [] = (Object[]) inputStack.pop (); - - sourceType = ((Integer) input [0]).intValue (); - externalEntity = (URLConnection) input [1]; - readBuffer = (char[]) input [2]; - readBufferPos = ((Integer) input [3]).intValue (); - readBufferLength = ((Integer) input [4]).intValue (); - line = ((Integer) input [5]).intValue (); - encoding = ((Integer) input [6]).intValue (); - readBufferOverflow = ((Integer) input [7]).intValue (); - is = (InputStream) input [8]; - currentByteCount = ((Integer) input [9]).intValue (); - column = ((Integer) input [10]).intValue (); - reader = (Reader) input [11]; - } - + { + String ename = (String) entityStack.removeLast(); - /** - * Return true if we can read the expected character. - * <p>Note that the character will be removed from the input stream - * on success, but will be put back on failure. Do not attempt to - * read the character again if the method succeeds. - * @param delim The character that should appear next. For a - * insensitive match, you must supply this in upper-case. - * @return true if the character was successfully read, or false if - * it was not. - * @see #tryRead (String) - */ - private boolean tryRead (char delim) - throws SAXException, IOException - { - char c; - - // Read the character - c = readCh (); - - // Test for a match, and push the character - // back if the match fails. - if (c == delim) { - return true; - } else { - unread (c); - return false; - } - } + if (ename != null && doReport) + { + dataBufferFlush(); + } + switch (sourceType) + { + case INPUT_STREAM: + handler.endExternalEntity(ename); + is.close(); + break; + case INPUT_READER: + handler.endExternalEntity(ename); + reader.close(); + break; + case INPUT_INTERNAL: + if (ename != null && doReport) + { + handler.endInternalEntity(ename); + } + break; + } + // Throw an EOFException if there + // is nothing else to pop. + if (inputStack.isEmpty()) + { + throw new EOFException("no more input"); + } - /** - * Return true if we can read the expected string. - * <p>This is simply a convenience method. - * <p>Note that the string will be removed from the input stream - * on success, but will be put back on failure. Do not attempt to - * read the string again if the method succeeds. - * <p>This method will push back a character rather than an - * array whenever possible (probably the majority of cases). - * @param delim The string that should appear next. - * @return true if the string was successfully read, or false if - * it was not. - * @see #tryRead (char) - */ - private boolean tryRead (String delim) + Input input = (Input) inputStack.removeLast(); + + sourceType = input.sourceType; + externalEntity = input.externalEntity; + readBuffer = input.readBuffer; + readBufferPos = input.readBufferPos; + readBufferLength = input.readBufferLength; + line = input.line; + encoding = input.encoding; + readBufferOverflow = input.readBufferOverflow; + is = input.is; + currentByteCount = input.currentByteCount; + column = input.column; + reader = input.reader; + } + + /** + * Return true if we can read the expected character. + * <p>Note that the character will be removed from the input stream + * on success, but will be put back on failure. Do not attempt to + * read the character again if the method succeeds. + * @param delim The character that should appear next. For a + * insensitive match, you must supply this in upper-case. + * @return true if the character was successfully read, or false if + * it was not. + * @see #tryRead (String) + */ + private boolean tryRead(char delim) throws SAXException, IOException - { - return tryRead (delim.toCharArray ()); - } + { + char c; + + // Read the character + c = readCh(); + + // Test for a match, and push the character + // back if the match fails. + if (c == delim) + { + return true; + } + else + { + unread(c); + return false; + } + } - private boolean tryRead (char ch []) + /** + * Return true if we can read the expected string. + * <p>This is simply a convenience method. + * <p>Note that the string will be removed from the input stream + * on success, but will be put back on failure. Do not attempt to + * read the string again if the method succeeds. + * <p>This method will push back a character rather than an + * array whenever possible (probably the majority of cases). + * @param delim The string that should appear next. + * @return true if the string was successfully read, or false if + * it was not. + * @see #tryRead (char) + */ + private boolean tryRead(String delim) throws SAXException, IOException - { - char c; - - // Compare the input, character- - // by character. - - for (int i = 0; i < ch.length; i++) { - c = readCh (); - if (c != ch [i]) { - unread (c); - if (i != 0) { - unread (ch, i); - } - return false; - } - } - return true; - } - - + { + return tryRead(delim.toCharArray()); + } - /** - * Return true if we can read some whitespace. - * <p>This is simply a convenience method. - * <p>This method will push back a character rather than an - * array whenever possible (probably the majority of cases). - * @return true if whitespace was found. - */ - private boolean tryWhitespace () + private boolean tryRead(char[] ch) throws SAXException, IOException - { - char c; - c = readCh (); - if (isWhitespace (c)) { - skipWhitespace (); - return true; - } else { - unread (c); - return false; - } - } + { + char c; + // Compare the input, character- + // by character. + + for (int i = 0; i < ch.length; i++) + { + c = readCh(); + if (c != ch[i]) + { + unread(c); + if (i != 0) + { + unread(ch, i); + } + return false; + } + } + return true; + } - /** - * Read all data until we find the specified string. - * This is useful for scanning CDATA sections and PIs. - * <p>This is inefficient right now, since it calls tryRead () - * for every character. - * @param delim The string delimiter - * @see #tryRead (String, boolean) - * @see #readCh - */ - private void parseUntil (String delim) + /** + * Return true if we can read some whitespace. + * <p>This is simply a convenience method. + * <p>This method will push back a character rather than an + * array whenever possible (probably the majority of cases). + * @return true if whitespace was found. + */ + private boolean tryWhitespace() throws SAXException, IOException - { - parseUntil (delim.toCharArray ()); - } - - private void parseUntil (char delim []) + { + char c; + c = readCh(); + if (isWhitespace(c)) + { + skipWhitespace(); + return true; + } + else + { + unread(c); + return false; + } + } + + /** + * Read all data until we find the specified string. + * This is useful for scanning CDATA sections and PIs. + * <p>This is inefficient right now, since it calls tryRead () + * for every character. + * @param delim The string delimiter + * @see #tryRead (String, boolean) + * @see #readCh + */ + private void parseUntil(String delim) throws SAXException, IOException - { - char c; - int startLine = line; - - try { - while (!tryRead (delim)) { - c = readCh (); - dataBufferAppend (c); - } - } catch (EOFException e) { - error ("end of input while looking for delimiter " - + "(started on line " + startLine - + ')', null, new String (delim)); - } - } - - - ////////////////////////////////////////////////////////////////////// - // Low-level I/O. - ////////////////////////////////////////////////////////////////////// + { + parseUntil(delim.toCharArray()); + } + private void parseUntil(char[] delim) + throws SAXException, IOException + { + char c; + int startLine = line; + + try + { + while (!tryRead(delim)) + { + c = readCh(); + dataBufferAppend(c); + } + } + catch (EOFException e) + { + error("end of input while looking for delimiter " + + "(started on line " + startLine + + ')', null, new String(delim)); + } + } - /** - * Prefetch US-ASCII XML/text decl from input stream into read buffer. - * Doesn't buffer more than absolutely needed, so that when an encoding - * decl says we need to create an InputStreamReader, we can discard our - * buffer and reset(). Caller knows the first chars of the decl exist - * in the input stream. - */ - private void prefetchASCIIEncodingDecl () + ////////////////////////////////////////////////////////////////////// + // Low-level I/O. + ////////////////////////////////////////////////////////////////////// + + /** + * Prefetch US-ASCII XML/text decl from input stream into read buffer. + * Doesn't buffer more than absolutely needed, so that when an encoding + * decl says we need to create an InputStreamReader, we can discard our + * buffer and reset(). Caller knows the first chars of the decl exist + * in the input stream. + */ + private void prefetchASCIIEncodingDecl() throws SAXException, IOException - { - int ch; - readBufferPos = readBufferLength = 0; - - is.mark (readBuffer.length); - while (true) { - ch = is.read (); - readBuffer [readBufferLength++] = (char) ch; - switch (ch) { - case (int) '>': - return; - case -1: - error ("file ends before end of XML or encoding declaration.", - null, "?>"); - } - if (readBuffer.length == readBufferLength) - error ("unfinished XML or encoding declaration"); - } - } + { + int ch; + readBufferPos = readBufferLength = 0; + + is.mark(readBuffer.length); + while (true) + { + ch = is.read(); + readBuffer[readBufferLength++] = (char) ch; + switch (ch) + { + case (int) '>': + return; + case -1: + error("file ends before end of XML or encoding declaration.", + null, "?>"); + } + if (readBuffer.length == readBufferLength) + { + error("unfinished XML or encoding declaration"); + } + } + } - /** - * Read a chunk of data from an external input source. - * <p>This is simply a front-end that fills the rawReadBuffer - * with bytes, then calls the appropriate encoding handler. - * @see #encoding - * @see #rawReadBuffer - * @see #readBuffer - * @see #filterCR - * @see #copyUtf8ReadBuffer - * @see #copyIso8859_1ReadBuffer - * @see #copyUcs_2ReadBuffer - * @see #copyUcs_4ReadBuffer - */ - private void readDataChunk () + /** + * Read a chunk of data from an external input source. + * <p>This is simply a front-end that fills the rawReadBuffer + * with bytes, then calls the appropriate encoding handler. + * @see #encoding + * @see #rawReadBuffer + * @see #readBuffer + * @see #filterCR + * @see #copyUtf8ReadBuffer + * @see #copyIso8859_1ReadBuffer + * @see #copyUcs_2ReadBuffer + * @see #copyUcs_4ReadBuffer + */ + private void readDataChunk() throws SAXException, IOException - { - int count; - - // See if we have any overflow (filterCR sets for CR at end) - if (readBufferOverflow > -1) { - readBuffer [0] = (char) readBufferOverflow; - readBufferOverflow = -1; - readBufferPos = 1; - sawCR = true; - } else { - readBufferPos = 0; - sawCR = false; - } - - // input from a character stream. - if (sourceType == INPUT_READER) { - count = reader.read (readBuffer, - readBufferPos, READ_BUFFER_MAX - readBufferPos); - if (count < 0) - readBufferLength = readBufferPos; - else - readBufferLength = readBufferPos + count; - if (readBufferLength > 0) - filterCR (count >= 0); - sawCR = false; - return; - } - - // Read as many bytes as possible into the raw buffer. - count = is.read (rawReadBuffer, 0, READ_BUFFER_MAX); - - // Dispatch to an encoding-specific reader method to populate - // the readBuffer. In most parser speed profiles, these routines - // show up at the top of the CPU usage chart. - if (count > 0) { - switch (encoding) { - // one byte builtins - case ENCODING_ASCII: - copyIso8859_1ReadBuffer (count, (char) 0x0080); - break; - case ENCODING_UTF_8: - copyUtf8ReadBuffer (count); - break; - case ENCODING_ISO_8859_1: - copyIso8859_1ReadBuffer (count, (char) 0); - break; - - // two byte builtins - case ENCODING_UCS_2_12: - copyUcs2ReadBuffer (count, 8, 0); - break; - case ENCODING_UCS_2_21: - copyUcs2ReadBuffer (count, 0, 8); - break; - - // four byte builtins - case ENCODING_UCS_4_1234: - copyUcs4ReadBuffer (count, 24, 16, 8, 0); - break; - case ENCODING_UCS_4_4321: - copyUcs4ReadBuffer (count, 0, 8, 16, 24); - break; - case ENCODING_UCS_4_2143: - copyUcs4ReadBuffer (count, 16, 24, 0, 8); - break; - case ENCODING_UCS_4_3412: - copyUcs4ReadBuffer (count, 8, 0, 24, 16); - break; - } - } else - readBufferLength = readBufferPos; - - readBufferPos = 0; - - // Filter out all carriage returns if we've seen any - // (including any saved from a previous read) - if (sawCR) { - filterCR (count >= 0); - sawCR = false; - - // must actively report EOF, lest some CRs get lost. - if (readBufferLength == 0 && count >= 0) - readDataChunk (); - } - - if (count > 0) - currentByteCount += count; - } + { + int count; + + // See if we have any overflow (filterCR sets for CR at end) + if (readBufferOverflow > -1) + { + readBuffer[0] = (char) readBufferOverflow; + readBufferOverflow = -1; + readBufferPos = 1; + sawCR = true; + } + else + { + readBufferPos = 0; + sawCR = false; + } + // input from a character stream. + if (sourceType == INPUT_READER) + { + count = reader.read(readBuffer, + readBufferPos, READ_BUFFER_MAX - readBufferPos); + if (count < 0) + { + readBufferLength = readBufferPos; + } + else + { + readBufferLength = readBufferPos + count; + } + if (readBufferLength > 0) + { + filterCR(count >= 0); + } + sawCR = false; + return; + } + + // Read as many bytes as possible into the raw buffer. + count = is.read(rawReadBuffer, 0, READ_BUFFER_MAX); + + // Dispatch to an encoding-specific reader method to populate + // the readBuffer. In most parser speed profiles, these routines + // show up at the top of the CPU usage chart. + if (count > 0) + { + switch (encoding) + { + // one byte builtins + case ENCODING_ASCII: + copyIso8859_1ReadBuffer(count, (char) 0x0080); + break; + case ENCODING_UTF_8: + copyUtf8ReadBuffer(count); + break; + case ENCODING_ISO_8859_1: + copyIso8859_1ReadBuffer(count, (char) 0); + break; - /** - * Filter carriage returns in the read buffer. - * CRLF becomes LF; CR becomes LF. - * @param moreData true iff more data might come from the same source - * @see #readDataChunk - * @see #readBuffer - * @see #readBufferOverflow - */ - private void filterCR (boolean moreData) - { - int i, j; + // two byte builtins + case ENCODING_UCS_2_12: + copyUcs2ReadBuffer(count, 8, 0); + break; + case ENCODING_UCS_2_21: + copyUcs2ReadBuffer(count, 0, 8); + break; + + // four byte builtins + case ENCODING_UCS_4_1234: + copyUcs4ReadBuffer(count, 24, 16, 8, 0); + break; + case ENCODING_UCS_4_4321: + copyUcs4ReadBuffer(count, 0, 8, 16, 24); + break; + case ENCODING_UCS_4_2143: + copyUcs4ReadBuffer(count, 16, 24, 0, 8); + break; + case ENCODING_UCS_4_3412: + copyUcs4ReadBuffer(count, 8, 0, 24, 16); + break; + } + } + else + { + readBufferLength = readBufferPos; + } - readBufferOverflow = -1; + readBufferPos = 0; + + // Filter out all carriage returns if we've seen any + // (including any saved from a previous read) + if (sawCR) + { + filterCR(count >= 0); + sawCR = false; + + // must actively report EOF, lest some CRs get lost. + if (readBufferLength == 0 && count >= 0) + { + readDataChunk(); + } + } + + if (count > 0) + { + currentByteCount += count; + } + } + + /** + * Filter carriage returns in the read buffer. + * CRLF becomes LF; CR becomes LF. + * @param moreData true iff more data might come from the same source + * @see #readDataChunk + * @see #readBuffer + * @see #readBufferOverflow + */ + private void filterCR(boolean moreData) + { + int i, j; + readBufferOverflow = -1; + loop: - for (i = j = readBufferPos; j < readBufferLength; i++, j++) { - switch (readBuffer [j]) { - case '\r': - if (j == readBufferLength - 1) { - if (moreData) { - readBufferOverflow = '\r'; - readBufferLength--; - } else // CR at end of buffer - readBuffer [i++] = '\n'; - break loop; - } else if (readBuffer [j + 1] == '\n') { - j++; - } - readBuffer [i] = '\n'; - break; - - case '\n': - default: - readBuffer [i] = readBuffer [j]; - break; - } - } - readBufferLength = i; - } + for (i = j = readBufferPos; j < readBufferLength; i++, j++) + { + switch (readBuffer[j]) + { + case '\r': + if (j == readBufferLength - 1) + { + if (moreData) + { + readBufferOverflow = '\r'; + readBufferLength--; + } + else // CR at end of buffer + { + readBuffer[i++] = '\n'; + } + break loop; + } + else if (readBuffer[j + 1] == '\n') + { + j++; + } + readBuffer[i] = '\n'; + break; - /** - * Convert a buffer of UTF-8-encoded bytes into UTF-16 characters. - * <p>When readDataChunk () calls this method, the raw bytes are in - * rawReadBuffer, and the final characters will appear in - * readBuffer. - * <p>Note that as of Unicode 3.1, good practice became a requirement, - * so that each Unicode character has exactly one UTF-8 representation. - * @param count The number of bytes to convert. - * @see #readDataChunk - * @see #rawReadBuffer - * @see #readBuffer - * @see #getNextUtf8Byte - */ - private void copyUtf8ReadBuffer (int count) + case '\n': + default: + readBuffer[i] = readBuffer[j]; + break; + } + } + readBufferLength = i; + } + + /** + * Convert a buffer of UTF-8-encoded bytes into UTF-16 characters. + * <p>When readDataChunk () calls this method, the raw bytes are in + * rawReadBuffer, and the final characters will appear in + * readBuffer. + * <p>Note that as of Unicode 3.1, good practice became a requirement, + * so that each Unicode character has exactly one UTF-8 representation. + * @param count The number of bytes to convert. + * @see #readDataChunk + * @see #rawReadBuffer + * @see #readBuffer + * @see #getNextUtf8Byte + */ + private void copyUtf8ReadBuffer(int count) throws SAXException, IOException - { - int i = 0; - int j = readBufferPos; - int b1; - char c = 0; - - /* - // check once, so the runtime won't (if it's smart enough) - if (count < 0 || count > rawReadBuffer.length) - throw new ArrayIndexOutOfBoundsException (Integer.toString (count)); - */ - - while (i < count) { - b1 = rawReadBuffer [i++]; - - // Determine whether we are dealing - // with a one-, two-, three-, or four- - // byte sequence. - if (b1 < 0) { - if ((b1 & 0xe0) == 0xc0) { - // 2-byte sequence: 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx - c = (char) (((b1 & 0x1f) << 6) - | getNextUtf8Byte (i++, count)); - if (c < 0x0080) - encodingError ("Illegal two byte UTF-8 sequence", - c, 0); - //Sec 2.11 - // [1] the two-character sequence #xD #xA - // [2] the two-character sequence #xD #x85 - if ((c == 0x0085 || c == 0x000a) && sawCR) - continue; - - // Sec 2.11 - // [3] the single character #x85 - - if(c == 0x0085 && xmlVersion == XML_11) - readBuffer[j++] = '\r'; - } else if ((b1 & 0xf0) == 0xe0) { - // 3-byte sequence: - // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx - // most CJKV characters - c = (char) (((b1 & 0x0f) << 12) | - (getNextUtf8Byte (i++, count) << 6) | - getNextUtf8Byte (i++, count)); - //sec 2.11 - //[4] the single character #x2028 - if(c == 0x2028 && xmlVersion == XML_11){ - readBuffer[j++] = '\r'; - sawCR = true; - continue; - } - if (c < 0x0800 || (c >= 0xd800 && c <= 0xdfff)) - encodingError ("Illegal three byte UTF-8 sequence", - c, 0); - } else if ((b1 & 0xf8) == 0xf0) { - // 4-byte sequence: 11101110wwwwzzzzyy + 110111yyyyxxxxxx - // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx - // (uuuuu = wwww + 1) - // "Surrogate Pairs" ... from the "Astral Planes" - // Unicode 3.1 assigned the first characters there - int iso646 = b1 & 07; - iso646 = (iso646 << 6) + getNextUtf8Byte (i++, count); - iso646 = (iso646 << 6) + getNextUtf8Byte (i++, count); - iso646 = (iso646 << 6) + getNextUtf8Byte (i++, count); - - if (iso646 <= 0xffff) { - encodingError ("Illegal four byte UTF-8 sequence", - iso646, 0); - } else { - if (iso646 > 0x0010ffff) - encodingError ( - "UTF-8 value out of range for Unicode", - iso646, 0); - iso646 -= 0x010000; - readBuffer [j++] = (char) (0xd800 | (iso646 >> 10)); - readBuffer [j++] = (char) (0xdc00 | (iso646 & 0x03ff)); - continue; - } - } else { - // The five and six byte encodings aren't supported; - // they exceed the Unicode (and XML) range. - encodingError ( - "unsupported five or six byte UTF-8 sequence", - 0xff & b1, i); - // NOTREACHED - c = 0; - } - } else { - // 1-byte sequence: 000000000xxxxxxx = 0xxxxxxx - // (US-ASCII character, "common" case, one branch to here) - c = (char) b1; - } - readBuffer [j++] = c; - if (c == '\r') - sawCR = true; - } - // How many characters have we read? - readBufferLength = j; - } + { + int i = 0; + int j = readBufferPos; + int b1; + char c = 0; + + /* + // check once, so the runtime won't (if it's smart enough) + if (count < 0 || count > rawReadBuffer.length) + throw new ArrayIndexOutOfBoundsException (Integer.toString (count)); + */ + while (i < count) + { + b1 = rawReadBuffer[i++]; - /** - * Return the next byte value in a UTF-8 sequence. - * If it is not possible to get a byte from the current - * entity, throw an exception. - * @param pos The current position in the rawReadBuffer. - * @param count The number of bytes in the rawReadBuffer - * @return The significant six bits of a non-initial byte in - * a UTF-8 sequence. - * @exception EOFException If the sequence is incomplete. - */ - private int getNextUtf8Byte (int pos, int count) + // Determine whether we are dealing + // with a one-, two-, three-, or four- + // byte sequence. + if (b1 < 0) + { + if ((b1 & 0xe0) == 0xc0) + { + // 2-byte sequence: 00000yyyyyxxxxxx = 110yyyyy 10xxxxxx + c = (char) (((b1 & 0x1f) << 6) + | getNextUtf8Byte(i++, count)); + if (c < 0x0080) + { + encodingError("Illegal two byte UTF-8 sequence", + c, 0); + } + + //Sec 2.11 + // [1] the two-character sequence #xD #xA + // [2] the two-character sequence #xD #x85 + if ((c == 0x0085 || c == 0x000a) && sawCR) + { + continue; + } + + // Sec 2.11 + // [3] the single character #x85 + + if (c == 0x0085 && xmlVersion == XML_11) + { + readBuffer[j++] = '\r'; + } + } + else if ((b1 & 0xf0) == 0xe0) + { + // 3-byte sequence: + // zzzzyyyyyyxxxxxx = 1110zzzz 10yyyyyy 10xxxxxx + // most CJKV characters + c = (char) (((b1 & 0x0f) << 12) | + (getNextUtf8Byte(i++, count) << 6) | + getNextUtf8Byte(i++, count)); + //sec 2.11 + //[4] the single character #x2028 + if (c == 0x2028 && xmlVersion == XML_11) + { + readBuffer[j++] = '\r'; + sawCR = true; + continue; + } + if (c < 0x0800 || (c >= 0xd800 && c <= 0xdfff)) + { + encodingError("Illegal three byte UTF-8 sequence", + c, 0); + } + } + else if ((b1 & 0xf8) == 0xf0) + { + // 4-byte sequence: 11101110wwwwzzzzyy + 110111yyyyxxxxxx + // = 11110uuu 10uuzzzz 10yyyyyy 10xxxxxx + // (uuuuu = wwww + 1) + // "Surrogate Pairs" ... from the "Astral Planes" + // Unicode 3.1 assigned the first characters there + int iso646 = b1 & 07; + iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count); + iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count); + iso646 = (iso646 << 6) + getNextUtf8Byte(i++, count); + + if (iso646 <= 0xffff) + { + encodingError("Illegal four byte UTF-8 sequence", + iso646, 0); + } + else + { + if (iso646 > 0x0010ffff) + { + encodingError("UTF-8 value out of range for Unicode", + iso646, 0); + } + iso646 -= 0x010000; + readBuffer[j++] = (char) (0xd800 | (iso646 >> 10)); + readBuffer[j++] = (char) (0xdc00 | (iso646 & 0x03ff)); + continue; + } + } + else + { + // The five and six byte encodings aren't supported; + // they exceed the Unicode (and XML) range. + encodingError("unsupported five or six byte UTF-8 sequence", + 0xff & b1, i); + // NOTREACHED + c = 0; + } + } + else + { + // 1-byte sequence: 000000000xxxxxxx = 0xxxxxxx + // (US-ASCII character, "common" case, one branch to here) + c = (char) b1; + } + readBuffer[j++] = c; + if (c == '\r') + { + sawCR = true; + } + } + // How many characters have we read? + readBufferLength = j; + } + + /** + * Return the next byte value in a UTF-8 sequence. + * If it is not possible to get a byte from the current + * entity, throw an exception. + * @param pos The current position in the rawReadBuffer. + * @param count The number of bytes in the rawReadBuffer + * @return The significant six bits of a non-initial byte in + * a UTF-8 sequence. + * @exception EOFException If the sequence is incomplete. + */ + private int getNextUtf8Byte(int pos, int count) throws SAXException, IOException - { - int val; - - // Take a character from the buffer - // or from the actual input stream. - if (pos < count) { - val = rawReadBuffer [pos]; - } else { - val = is.read (); - if (val == -1) { - encodingError ("unfinished multi-byte UTF-8 sequence at EOF", - -1, pos); - } - } - - // Check for the correct bits at the start. - if ((val & 0xc0) != 0x80) { - encodingError ("bad continuation of multi-byte UTF-8 sequence", - val, pos + 1); - } - - // Return the significant bits. - return (val & 0x3f); - } + { + int val; + + // Take a character from the buffer + // or from the actual input stream. + if (pos < count) + { + val = rawReadBuffer[pos]; + } + else + { + val = is.read(); + if (val == -1) + { + encodingError("unfinished multi-byte UTF-8 sequence at EOF", + -1, pos); + } + } + // Check for the correct bits at the start. + if ((val & 0xc0) != 0x80) + { + encodingError("bad continuation of multi-byte UTF-8 sequence", + val, pos + 1); + } - /** - * Convert a buffer of US-ASCII or ISO-8859-1-encoded bytes into - * UTF-16 characters. - * - * <p>When readDataChunk () calls this method, the raw bytes are in - * rawReadBuffer, and the final characters will appear in - * readBuffer. - * - * @param count The number of bytes to convert. - * @param mask For ASCII conversion, 0x7f; else, 0xff. - * @see #readDataChunk - * @see #rawReadBuffer - * @see #readBuffer - */ - private void copyIso8859_1ReadBuffer (int count, char mask) - throws IOException - { - int i, j; - for (i = 0, j = readBufferPos; i < count; i++, j++) { - char c = (char) (rawReadBuffer [i] & 0xff); - if ((c & mask) != 0) - throw new CharConversionException ("non-ASCII character U+" - + Integer.toHexString (c)); - if (c == 0x0085 && xmlVersion == XML_11) - c = '\r'; - readBuffer [j] = c; - if (c == '\r') { - sawCR = true; - } - } - readBufferLength = j; - } + // Return the significant bits. + return (val & 0x3f); + } + /** + * Convert a buffer of US-ASCII or ISO-8859-1-encoded bytes into + * UTF-16 characters. + * + * <p>When readDataChunk () calls this method, the raw bytes are in + * rawReadBuffer, and the final characters will appear in + * readBuffer. + * + * @param count The number of bytes to convert. + * @param mask For ASCII conversion, 0x7f; else, 0xff. + * @see #readDataChunk + * @see #rawReadBuffer + * @see #readBuffer + */ + private void copyIso8859_1ReadBuffer(int count, char mask) + throws IOException + { + int i, j; + for (i = 0, j = readBufferPos; i < count; i++, j++) + { + char c = (char) (rawReadBuffer[i] & 0xff); + if ((c & mask) != 0) + { + throw new CharConversionException("non-ASCII character U+" + + Integer.toHexString(c)); + } + if (c == 0x0085 && xmlVersion == XML_11) + { + c = '\r'; + } + readBuffer[j] = c; + if (c == '\r') + { + sawCR = true; + } + } + readBufferLength = j; + } - /** - * Convert a buffer of UCS-2-encoded bytes into UTF-16 characters - * (as used in Java string manipulation). - * - * <p>When readDataChunk () calls this method, the raw bytes are in - * rawReadBuffer, and the final characters will appear in - * readBuffer. - * @param count The number of bytes to convert. - * @param shift1 The number of bits to shift byte 1. - * @param shift2 The number of bits to shift byte 2 - * @see #readDataChunk - * @see #rawReadBuffer - * @see #readBuffer - */ - private void copyUcs2ReadBuffer (int count, int shift1, int shift2) + /** + * Convert a buffer of UCS-2-encoded bytes into UTF-16 characters + * (as used in Java string manipulation). + * + * <p>When readDataChunk () calls this method, the raw bytes are in + * rawReadBuffer, and the final characters will appear in + * readBuffer. + * @param count The number of bytes to convert. + * @param shift1 The number of bits to shift byte 1. + * @param shift2 The number of bits to shift byte 2 + * @see #readDataChunk + * @see #rawReadBuffer + * @see #readBuffer + */ + private void copyUcs2ReadBuffer(int count, int shift1, int shift2) throws SAXException - { - int j = readBufferPos; - - if (count > 0 && (count % 2) != 0) { - encodingError ("odd number of bytes in UCS-2 encoding", -1, count); - } - // The loops are faster with less internal brancing; hence two - if (shift1 == 0) { // "UTF-16-LE" - for (int i = 0; i < count; i += 2) { - char c = (char) (rawReadBuffer [i + 1] << 8); - c |= 0xff & rawReadBuffer [i]; - readBuffer [j++] = c; - if (c == '\r') - sawCR = true; - } - } else { // "UTF-16-BE" - for (int i = 0; i < count; i += 2) { - char c = (char) (rawReadBuffer [i] << 8); - c |= 0xff & rawReadBuffer [i + 1]; - readBuffer [j++] = c; - if (c == '\r') - sawCR = true; - } - } - readBufferLength = j; - } - + { + int j = readBufferPos; + + if (count > 0 && (count % 2) != 0) + { + encodingError("odd number of bytes in UCS-2 encoding", -1, count); + } + // The loops are faster with less internal brancing; hence two + if (shift1 == 0) + { // "UTF-16-LE" + for (int i = 0; i < count; i += 2) + { + char c = (char) (rawReadBuffer[i + 1] << 8); + c |= 0xff & rawReadBuffer[i]; + readBuffer[j++] = c; + if (c == '\r') + { + sawCR = true; + } + } + } + else + { // "UTF-16-BE" + for (int i = 0; i < count; i += 2) + { + char c = (char) (rawReadBuffer[i] << 8); + c |= 0xff & rawReadBuffer[i + 1]; + readBuffer[j++] = c; + if (c == '\r') + { + sawCR = true; + } + } + } + readBufferLength = j; + } - /** - * Convert a buffer of UCS-4-encoded bytes into UTF-16 characters. - * - * <p>When readDataChunk () calls this method, the raw bytes are in - * rawReadBuffer, and the final characters will appear in - * readBuffer. - * <p>Java has Unicode chars, and this routine uses surrogate pairs - * for ISO-10646 values between 0x00010000 and 0x000fffff. An - * exception is thrown if the ISO-10646 character has no Unicode - * representation. - * - * @param count The number of bytes to convert. - * @param shift1 The number of bits to shift byte 1. - * @param shift2 The number of bits to shift byte 2 - * @param shift3 The number of bits to shift byte 2 - * @param shift4 The number of bits to shift byte 2 - * @see #readDataChunk - * @see #rawReadBuffer - * @see #readBuffer - */ - private void copyUcs4ReadBuffer (int count, int shift1, int shift2, - int shift3, int shift4) + /** + * Convert a buffer of UCS-4-encoded bytes into UTF-16 characters. + * + * <p>When readDataChunk () calls this method, the raw bytes are in + * rawReadBuffer, and the final characters will appear in + * readBuffer. + * <p>Java has Unicode chars, and this routine uses surrogate pairs + * for ISO-10646 values between 0x00010000 and 0x000fffff. An + * exception is thrown if the ISO-10646 character has no Unicode + * representation. + * + * @param count The number of bytes to convert. + * @param shift1 The number of bits to shift byte 1. + * @param shift2 The number of bits to shift byte 2 + * @param shift3 The number of bits to shift byte 2 + * @param shift4 The number of bits to shift byte 2 + * @see #readDataChunk + * @see #rawReadBuffer + * @see #readBuffer + */ + private void copyUcs4ReadBuffer(int count, int shift1, int shift2, + int shift3, int shift4) throws SAXException - { - int j = readBufferPos; - - if (count > 0 && (count % 4) != 0) { - encodingError ( - "number of bytes in UCS-4 encoding not divisible by 4", - -1, count); - } - for (int i = 0; i < count; i += 4) { - int value = (((rawReadBuffer [i] & 0xff) << shift1) | - ((rawReadBuffer [i + 1] & 0xff) << shift2) | - ((rawReadBuffer [i + 2] & 0xff) << shift3) | - ((rawReadBuffer [i + 3] & 0xff) << shift4)); - if (value < 0x0000ffff) { - readBuffer [j++] = (char) value; - if (value == (int) '\r') { - sawCR = true; - } - } else if (value < 0x0010ffff) { - value -= 0x010000; - readBuffer [j++] = (char) (0xd8 | ((value >> 10) & 0x03ff)); - readBuffer [j++] = (char) (0xdc | (value & 0x03ff)); - } else { - encodingError ("UCS-4 value out of range for Unicode", - value, i); - } - } - readBufferLength = j; - } - + { + int j = readBufferPos; + + if (count > 0 && (count % 4) != 0) + { + encodingError("number of bytes in UCS-4 encoding " + + "not divisible by 4", + -1, count); + } + for (int i = 0; i < count; i += 4) + { + int value = (((rawReadBuffer [i] & 0xff) << shift1) | + ((rawReadBuffer [i + 1] & 0xff) << shift2) | + ((rawReadBuffer [i + 2] & 0xff) << shift3) | + ((rawReadBuffer [i + 3] & 0xff) << shift4)); + if (value < 0x0000ffff) + { + readBuffer [j++] = (char) value; + if (value == (int) '\r') + { + sawCR = true; + } + } + else if (value < 0x0010ffff) + { + value -= 0x010000; + readBuffer[j++] = (char) (0xd8 | ((value >> 10) & 0x03ff)); + readBuffer[j++] = (char) (0xdc | (value & 0x03ff)); + } + else + { + encodingError("UCS-4 value out of range for Unicode", + value, i); + } + } + readBufferLength = j; + } - /** - * Report a character encoding error. - */ - private void encodingError (String message, int value, int offset) + /** + * Report a character encoding error. + */ + private void encodingError(String message, int value, int offset) throws SAXException - { - if (value != -1) - message = message + " (character code: 0x" + - Integer.toHexString (value) + ')'; - error (message); - } + { + if (value != -1) + { + message = message + " (character code: 0x" + + Integer.toHexString(value) + ')'; + error(message); + } + } + + ////////////////////////////////////////////////////////////////////// + // Local Variables. + ////////////////////////////////////////////////////////////////////// + + /** + * Re-initialize the variables for each parse. + */ + private void initializeVariables() + { + // First line + line = 1; + column = 0; + + // Set up the buffers for data and names + dataBufferPos = 0; + dataBuffer = new char[DATA_BUFFER_INITIAL]; + nameBufferPos = 0; + nameBuffer = new char[NAME_BUFFER_INITIAL]; + + // Set up the DTD hash tables + elementInfo = new HashMap(); + entityInfo = new HashMap(); + notationInfo = new HashMap(); + skippedPE = false; + + // Set up the variables for the current + // element context. + currentElement = null; + currentElementContent = CONTENT_UNDECLARED; + + // Set up the input variables + sourceType = INPUT_NONE; + inputStack = new LinkedList(); + entityStack = new LinkedList(); + externalEntity = null; + tagAttributePos = 0; + tagAttributes = new String[100]; + rawReadBuffer = new byte[READ_BUFFER_MAX]; + readBufferOverflow = -1; + + scratch = new InputSource(); + + inLiteral = false; + expandPE = false; + peIsError = false; + + doReport = false; + + inCDATA = false; + + symbolTable = new Object[SYMBOL_TABLE_LENGTH][]; + } + static class ExternalIdentifiers + { - ////////////////////////////////////////////////////////////////////// - // Local Variables. - ////////////////////////////////////////////////////////////////////// + String publicId; + String systemId; + String baseUri; - /** - * Re-initialize the variables for each parse. - */ - private void initializeVariables () + ExternalIdentifiers() { - // First line - line = 1; - column = 0; - - // Set up the buffers for data and names - dataBufferPos = 0; - dataBuffer = new char [DATA_BUFFER_INITIAL]; - nameBufferPos = 0; - nameBuffer = new char [NAME_BUFFER_INITIAL]; - - // Set up the DTD hash tables - elementInfo = new Hashtable (); - entityInfo = new Hashtable (); - notationInfo = new Hashtable (); - skippedPE = false; - - // Set up the variables for the current - // element context. - currentElement = null; - currentElementContent = CONTENT_UNDECLARED; - - // Set up the input variables - sourceType = INPUT_NONE; - inputStack = new Stack (); - entityStack = new Stack (); - externalEntity = null; - tagAttributePos = 0; - tagAttributes = new String [100]; - rawReadBuffer = new byte [READ_BUFFER_MAX]; - readBufferOverflow = -1; - - scratch = new InputSource (); - - inLiteral = false; - expandPE = false; - peIsError = false; - - doReport = false; - - inCDATA = false; - - symbolTable = new Object [SYMBOL_TABLE_LENGTH][]; } + ExternalIdentifiers(String publicId, String systemId, String baseUri) + { + this.publicId = publicId; + this.systemId = systemId; + this.baseUri = baseUri; + } + + } - // - // The current XML handler interface. - // - private SAXDriver handler; - - // - // I/O information. - // - private Reader reader; // current reader - private InputStream is; // current input stream - private int line; // current line number - private int column; // current column number - private int sourceType; // type of input source - private Stack inputStack; // stack of input soruces - private URLConnection externalEntity; // current external entity - private int encoding; // current character encoding - private int currentByteCount; // bytes read from current source - private InputSource scratch; // temporary - - // - // Buffers for decoded but unparsed character input. - // - private char readBuffer []; - private int readBufferPos; - private int readBufferLength; - private int readBufferOverflow; // overflow from last data chunk. - - - // - // Buffer for undecoded raw byte input. - // - private final static int READ_BUFFER_MAX = 16384; - private byte rawReadBuffer []; - - - // - // Buffer for attribute values, char refs, DTD stuff. - // - private static int DATA_BUFFER_INITIAL = 4096; - private char dataBuffer []; - private int dataBufferPos; - - // - // Buffer for parsed names. - // - private static int NAME_BUFFER_INITIAL = 1024; - private char nameBuffer []; - private int nameBufferPos; - - // - // Save any standalone flag - // - private boolean docIsStandalone; - - // - // Hashtables for DTD information on elements, entities, and notations. - // Populated until we start ignoring decls (because of skipping a PE) - // - private Hashtable elementInfo; - private Hashtable entityInfo; - private Hashtable notationInfo; - private boolean skippedPE; - - - // - // Element type currently in force. - // - private String currentElement; - private int currentElementContent; - - // - // Stack of entity names, to detect recursion. - // - private Stack entityStack; - - // - // PE expansion is enabled in most chunks of the DTD, not all. - // When it's enabled, literals are treated differently. - // - private boolean inLiteral; - private boolean expandPE; - private boolean peIsError; - - // - // can't report entity expansion inside two constructs: - // - attribute expansions (internal entities only) - // - markup declarations (parameter entities only) - // - private boolean doReport; - - // - // Symbol table, for caching interned names. - // - // These show up wherever XML names or nmtokens are used: naming elements, - // attributes, PIs, notations, entities, and enumerated attribute values. - // - // NOTE: This hashtable doesn't grow. The default size is intended to be - // rather large for most documents. Example: one snapshot of the DocBook - // XML 4.1 DTD used only about 350 such names. As a rule, only pathological - // documents (ones that don't reuse names) should ever see much collision. - // - // Be sure that SYMBOL_TABLE_LENGTH always stays prime, for best hashing. - // "2039" keeps the hash table size at about two memory pages on typical - // 32 bit hardware. - // - private final static int SYMBOL_TABLE_LENGTH = 2039; + static class EntityInfo + { - private Object symbolTable [][]; + int type; + ExternalIdentifiers ids; + String value; + String notationName; + + } - // - // Hash table of attributes found in current start tag. - // - private String tagAttributes []; - private int tagAttributePos; + static class AttributeDecl + { + + String type; + String value; + int valueType; + String enumeration; + String defaultValue; - // - // Utility flag: have we noticed a CR while reading the last - // data chunk? If so, we will have to go back and normalise - // CR or CR/LF line ends. - // - private boolean sawCR; + } - // - // Utility flag: are we in CDATA? If so, whitespace isn't ignorable. - // - private boolean inCDATA; + static class ElementDecl + { - // - // Xml version. - // - private static final int XML_10 = 0; - private static final int XML_11 = 1; - private int xmlVersion = XML_10; + int contentType; + String contentModel; + HashMap attributes; + + } + + static class Input + { + + int sourceType; + URLConnection externalEntity; + char[] readBuffer; + int readBufferPos; + int readBufferLength; + int line; + int encoding; + int readBufferOverflow; + InputStream is; + int currentByteCount; + int column; + Reader reader; + + } + } + diff --git a/gnu/xml/aelfred2/XmlReader.java b/gnu/xml/aelfred2/XmlReader.java index 96c9c723f..dacf8b103 100644 --- a/gnu/xml/aelfred2/XmlReader.java +++ b/gnu/xml/aelfred2/XmlReader.java @@ -70,246 +70,305 @@ import gnu.xml.pipeline.ValidationConsumer; * * @author David Brownell */ -public final class XmlReader implements XMLReader +public final class XmlReader + implements XMLReader { - private SAXDriver aelfred2 = new SAXDriver (); - private EventFilter filter = new EventFilter (); - private boolean isValidating; - private boolean active; - - /** Constructs a SAX Parser. */ - public XmlReader () - { } - - /** - * Constructs a SAX Parser, optionally treating validity errors - * as if they were fatal errors. - */ - public XmlReader (boolean invalidIsFatal) - { - if (invalidIsFatal) - setErrorHandler (new DefaultHandler2 () { - public void error (SAXParseException e) - throws SAXException - { throw e; } - }); - } - - /** - * <b>SAX2</b>: Returns the object used to report the logical - * content of an XML document. - */ - public ContentHandler getContentHandler () - { return filter.getContentHandler (); } - - /** - * <b>SAX2</b>: Assigns the object used to report the logical - * content of an XML document. - * @exception IllegalStateException if called mid-parse - */ - public void setContentHandler (ContentHandler handler) + static class FatalErrorHandler + extends DefaultHandler2 + { + + public void error(SAXParseException e) + throws SAXException { - if (active) - throw new IllegalStateException ("already parsing"); - filter.setContentHandler (handler); + throw e; } - - /** - * <b>SAX2</b>: Returns the object used to process declarations related - * to notations and unparsed entities. - */ - public DTDHandler getDTDHandler () - { return filter.getDTDHandler (); } - - /** - * <b>SAX1</b> Assigns DTD handler - * @exception IllegalStateException if called mid-parse - */ - public void setDTDHandler (DTDHandler handler) - { - if (active) - throw new IllegalStateException ("already parsing"); - filter.setDTDHandler (handler); - } - - /** - * <b>SAX2</b>: Returns the object used when resolving external - * entities during parsing (both general and parameter entities). - */ - public EntityResolver getEntityResolver () - { return aelfred2.getEntityResolver (); } - - /** <b>SAX1</b> Assigns parser's entity resolver */ - public void setEntityResolver (EntityResolver handler) - { aelfred2.setEntityResolver (handler); } - - /** - * <b>SAX2</b>: Returns the object used to receive callbacks for XML - * errors of all levels (fatal, nonfatal, warning); this is never null; - */ - public ErrorHandler getErrorHandler () - { return aelfred2.getErrorHandler (); } - - /** - * <b>SAX1</b> Assigns error handler - * @exception IllegalStateException if called mid-parse - */ - public void setErrorHandler (ErrorHandler handler) - { - if (active) - throw new IllegalStateException ("already parsing"); - aelfred2.setErrorHandler (handler); - } - - /** - * <b>SAX2</b>: Assigns the specified property. - * @exception IllegalStateException if called mid-parse - */ - public void setProperty (String propertyId, Object value) + + } + + private SAXDriver aelfred2 = new SAXDriver(); + private EventFilter filter = new EventFilter(); + private boolean isValidating; + private boolean active; + + /** + * Constructs a SAX Parser. + */ + public XmlReader() + { + } + + /** + * Constructs a SAX Parser, optionally treating validity errors + * as if they were fatal errors. + */ + public XmlReader(boolean invalidIsFatal) + { + if (invalidIsFatal) + { + setErrorHandler(new FatalErrorHandler()); + } + } + + /** + * <b>SAX2</b>: Returns the object used to report the logical + * content of an XML document. + */ + public ContentHandler getContentHandler() + { + return filter.getContentHandler(); + } + + /** + * <b>SAX2</b>: Assigns the object used to report the logical + * content of an XML document. + * @exception IllegalStateException if called mid-parse + */ + public void setContentHandler(ContentHandler handler) + { + if (active) + { + throw new IllegalStateException("already parsing"); + } + filter.setContentHandler(handler); + } + + /** + * <b>SAX2</b>: Returns the object used to process declarations related + * to notations and unparsed entities. + */ + public DTDHandler getDTDHandler() + { + return filter.getDTDHandler(); + } + + /** + * <b>SAX1</b> Assigns DTD handler + * @exception IllegalStateException if called mid-parse + */ + public void setDTDHandler(DTDHandler handler) + { + if (active) + { + throw new IllegalStateException("already parsing"); + } + filter.setDTDHandler(handler); + } + + /** + * <b>SAX2</b>: Returns the object used when resolving external + * entities during parsing (both general and parameter entities). + */ + public EntityResolver getEntityResolver() + { + return aelfred2.getEntityResolver(); + } + + /** + * <b>SAX1</b> Assigns parser's entity resolver + */ + public void setEntityResolver(EntityResolver handler) + { + aelfred2.setEntityResolver(handler); + } + + /** + * <b>SAX2</b>: Returns the object used to receive callbacks for XML + * errors of all levels (fatal, nonfatal, warning); this is never null; + */ + public ErrorHandler getErrorHandler() + { + return aelfred2.getErrorHandler(); + } + + /** + * <b>SAX1</b> Assigns error handler + * @exception IllegalStateException if called mid-parse + */ + public void setErrorHandler(ErrorHandler handler) + { + if (active) + { + throw new IllegalStateException("already parsing"); + } + aelfred2.setErrorHandler(handler); + } + + /** + * <b>SAX2</b>: Assigns the specified property. + * @exception IllegalStateException if called mid-parse + */ + public void setProperty(String propertyId, Object value) throws SAXNotRecognizedException, SAXNotSupportedException - { - if (active) - throw new IllegalStateException ("already parsing"); - if (getProperty (propertyId) != value) - filter.setProperty (propertyId, value); - } - - /** - * <b>SAX2</b>: Returns the specified property. - */ - public Object getProperty (String propertyId) + { + if (active) + { + throw new IllegalStateException("already parsing"); + } + if (getProperty(propertyId) != value) + { + filter.setProperty(propertyId, value); + } + } + + /** + * <b>SAX2</b>: Returns the specified property. + */ + public Object getProperty(String propertyId) throws SAXNotRecognizedException - { - if ((SAXDriver.PROPERTY + "declaration-handler") - .equals (propertyId) - || (SAXDriver.PROPERTY + "lexical-handler") - .equals (propertyId)) - return filter.getProperty (propertyId); - throw new SAXNotRecognizedException (propertyId); - } - - private void forceValidating () + { + if ((SAXDriver.PROPERTY + "declaration-handler").equals(propertyId) + || (SAXDriver.PROPERTY + "lexical-handler").equals(propertyId)) + { + return filter.getProperty(propertyId); + } + throw new SAXNotRecognizedException(propertyId); + } + + private void forceValidating() throws SAXNotRecognizedException, SAXNotSupportedException - { - aelfred2.setFeature ( - SAXDriver.FEATURE + "namespace-prefixes", - true); - aelfred2.setFeature ( - SAXDriver.FEATURE + "external-general-entities", - true); - aelfred2.setFeature ( - SAXDriver.FEATURE + "external-parameter-entities", - true); - } - - /** - * <b>SAX2</b>: Sets the state of features supported in this parser. - * Note that this parser requires reporting of namespace prefixes when - * validating. - */ - public void setFeature (String featureId, boolean state) + { + aelfred2.setFeature(SAXDriver.FEATURE + "namespace-prefixes", + true); + aelfred2.setFeature(SAXDriver.FEATURE + "external-general-entities", + true); + aelfred2.setFeature(SAXDriver.FEATURE + "external-parameter-entities", + true); + } + + /** + * <b>SAX2</b>: Sets the state of features supported in this parser. + * Note that this parser requires reporting of namespace prefixes when + * validating. + */ + public void setFeature(String featureId, boolean state) throws SAXNotRecognizedException, SAXNotSupportedException - { - boolean value = getFeature (featureId); - - if (state == value) - return; - - if ((SAXDriver.FEATURE + "validation").equals (featureId)) { - if (active) - throw new SAXNotSupportedException ("already parsing"); - if (state) - forceValidating (); - isValidating = state; - } else - aelfred2.setFeature (featureId, state); - } - - /** - * <b>SAX2</b>: Tells whether this parser supports the specified feature. - * At this time, this directly parallels the underlying SAXDriver, - * except that validation is optionally supported. - * - * @see SAXDriver - */ - public boolean getFeature (String featureId) + { + boolean value = getFeature(featureId); + + if (state == value) + { + return; + } + + if ((SAXDriver.FEATURE + "validation").equals(featureId)) + { + if (active) + { + throw new SAXNotSupportedException("already parsing"); + } + if (state) + { + forceValidating(); + } + isValidating = state; + } + else + { + aelfred2.setFeature(featureId, state); + } + } + + /** + * <b>SAX2</b>: Tells whether this parser supports the specified feature. + * At this time, this directly parallels the underlying SAXDriver, + * except that validation is optionally supported. + * + * @see SAXDriver + */ + public boolean getFeature(String featureId) throws SAXNotRecognizedException, SAXNotSupportedException - { - if ((SAXDriver.FEATURE + "validation").equals (featureId)) - return isValidating; - - return aelfred2.getFeature (featureId); - } - - /** - * <b>SAX1</b>: Sets the locale used for diagnostics; currently, - * only locales using the English language are supported. - * @param locale The locale for which diagnostics will be generated - */ - public void setLocale (Locale locale) + { + if ((SAXDriver.FEATURE + "validation").equals(featureId)) + { + return isValidating; + } + + return aelfred2.getFeature(featureId); + } + + /** + * <b>SAX1</b>: Sets the locale used for diagnostics; currently, + * only locales using the English language are supported. + * @param locale The locale for which diagnostics will be generated + */ + public void setLocale(Locale locale) throws SAXException - { aelfred2.setLocale (locale); } + { + aelfred2.setLocale(locale); + } - /** - * <b>SAX1</b>: Preferred API to parse an XML document, using a - * system identifier (URI). + /** + * <b>SAX1</b>: Preferred API to parse an XML document, using a + * system identifier (URI). */ - public void parse (String systemId) + public void parse(String systemId) throws SAXException, IOException - { - parse (new InputSource (systemId)); - } - - /** - * <b>SAX1</b>: Underlying API to parse an XML document, used - * directly when no URI is available. When this is invoked, - * and the parser is set to validate, some features will be - * automatically reset to appropriate values: for reporting - * namespace prefixes, and incorporating external entities. - * - * @param source The XML input source. - * - * @exception IllegalStateException if called mid-parse - * @exception SAXException The handlers may throw any SAXException, - * and the parser normally throws SAXParseException objects. - * @exception IOException IOExceptions are normally through through - * the parser if there are problems reading the source document. - */ - public void parse (InputSource source) + { + parse(new InputSource(systemId)); + } + + /** + * <b>SAX1</b>: Underlying API to parse an XML document, used + * directly when no URI is available. When this is invoked, + * and the parser is set to validate, some features will be + * automatically reset to appropriate values: for reporting + * namespace prefixes, and incorporating external entities. + * + * @param source The XML input source. + * + * @exception IllegalStateException if called mid-parse + * @exception SAXException The handlers may throw any SAXException, + * and the parser normally throws SAXParseException objects. + * @exception IOException IOExceptions are normally through through + * the parser if there are problems reading the source document. + */ + public void parse(InputSource source) throws SAXException, IOException - { - EventFilter next; - boolean nsdecls; - - synchronized (aelfred2) { - if (active) - throw new IllegalStateException ("already parsing"); - active = true; - } - - // set up the output pipeline - if (isValidating) { - forceValidating (); - next = new ValidationConsumer (filter); - } else - next = filter; - - // connect pipeline and error handler - // don't let _this_ call to bind() affect xmlns* attributes - nsdecls = aelfred2.getFeature ( - SAXDriver.FEATURE + "namespace-prefixes"); - EventFilter.bind (aelfred2, next); - if (!nsdecls) - aelfred2.setFeature ( - SAXDriver.FEATURE + "namespace-prefixes", - false); - - // parse, clean up - try { - aelfred2.parse (source); - } finally { - active = false; - } - } + { + EventFilter next; + boolean nsdecls; + + synchronized (aelfred2) + { + if (active) + { + throw new IllegalStateException("already parsing"); + } + active = true; + } + + // set up the output pipeline + if (isValidating) + { + forceValidating(); + next = new ValidationConsumer(filter); + } + else + { + next = filter; + } + + // connect pipeline and error handler + // don't let _this_ call to bind() affect xmlns* attributes + nsdecls = aelfred2.getFeature(SAXDriver.FEATURE + "namespace-prefixes"); + EventFilter.bind(aelfred2, next); + if (!nsdecls) + { + aelfred2.setFeature(SAXDriver.FEATURE + "namespace-prefixes", + false); + } + + // parse, clean up + try + { + aelfred2.parse(source); + } + finally + { + active = false; + } + } + } + diff --git a/gnu/xml/dom/html2/DomHTMLAnchorElement.java b/gnu/xml/dom/html2/DomHTMLAnchorElement.java new file mode 100644 index 000000000..041666f6d --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLAnchorElement.java @@ -0,0 +1,189 @@ +/* DomHTMLAnchorElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLAnchorElement; + +/** + * An HTML 'A' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLAnchorElement + extends DomHTMLElement + implements HTMLAnchorElement +{ + + protected DomHTMLAnchorElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAccessKey() + { + return getHTMLAttribute("accesskey"); + } + + public void setAccessKey(String accessKey) + { + setHTMLAttribute("accesskey", accessKey); + } + + public String getCharset() + { + return getHTMLAttribute("charset"); + } + + public void setCharset(String charset) + { + setHTMLAttribute("charset", charset); + } + + public String getCoords() + { + return getHTMLAttribute("coords"); + } + + public void setCoords(String coords) + { + setHTMLAttribute("coords", coords); + } + + public String getHref() + { + return getHTMLAttribute("href"); + } + + public void setHref(String href) + { + setHTMLAttribute("href", href); + } + + public String getHreflang() + { + return getHTMLAttribute("hreflang"); + } + + public void setHreflang(String hreflang) + { + setHTMLAttribute("hreflang", hreflang); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getRel() + { + return getHTMLAttribute("rel"); + } + + public void setRel(String rel) + { + setHTMLAttribute("rel", rel); + } + + public String getRev() + { + return getHTMLAttribute("rev"); + } + + public void setRev(String rev) + { + setHTMLAttribute("rev", rev); + } + + public String getShape() + { + return getHTMLAttribute("shape"); + } + + public void setShape(String shape) + { + setHTMLAttribute("shape", shape); + } + + public int getTabIndex() + { + return getIntHTMLAttribute("tabindex"); + } + + public void setTabIndex(int tabIndex) + { + setIntHTMLAttribute("tabindex", tabIndex); + } + + public String getTarget() + { + return getHTMLAttribute("target"); + } + + public void setTarget(String target) + { + setHTMLAttribute("target", target); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + + public void blur() + { + // TODO + } + + public void focus() + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLAppletElement.java b/gnu/xml/dom/html2/DomHTMLAppletElement.java new file mode 100644 index 000000000..39bc4061a --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLAppletElement.java @@ -0,0 +1,169 @@ +/* DomHTMLAppletElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLAppletElement; + +/** + * An HTML 'APPLET' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLAppletElement + extends DomHTMLElement + implements HTMLAppletElement +{ + + protected DomHTMLAppletElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getAlt() + { + return getHTMLAttribute("alt"); + } + + public void setAlt(String alt) + { + setHTMLAttribute("alt", alt); + } + + public String getArchive() + { + return getHTMLAttribute("archive"); + } + + public void setArchive(String archive) + { + setHTMLAttribute("archive", archive); + } + + public String getCode() + { + return getHTMLAttribute("code"); + } + + public void setCode(String code) + { + setHTMLAttribute("code", code); + } + + public String getCodeBase() + { + return getHTMLAttribute("codebase"); + } + + public void setCodeBase(String codeBase) + { + setHTMLAttribute("codebase", codeBase); + } + + public String getHeight() + { + return getHTMLAttribute("height"); + } + + public void setHeight(String height) + { + setHTMLAttribute("height", height); + } + + public int getHspace() + { + return getIntHTMLAttribute("hspace"); + } + + public void setHspace(int hspace) + { + setIntHTMLAttribute("hspace", hspace); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getObject() + { + return getHTMLAttribute("object"); + } + + public void setObject(String object) + { + setHTMLAttribute("object", object); + } + + public int getVspace() + { + return getIntHTMLAttribute("vspace"); + } + + public void setVspace(int vspace) + { + setIntHTMLAttribute("vspace", vspace); + } + + public String getWidth() + { + return getHTMLAttribute("width"); + } + + public void setWidth(String width) + { + setHTMLAttribute("width", width); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLAreaElement.java b/gnu/xml/dom/html2/DomHTMLAreaElement.java new file mode 100644 index 000000000..10229fe2c --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLAreaElement.java @@ -0,0 +1,139 @@ +/* DomHTMLAreaElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLAreaElement; + +/** + * An HTML 'AREA' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLAreaElement + extends DomHTMLElement + implements HTMLAreaElement +{ + + protected DomHTMLAreaElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAccessKey() + { + return getHTMLAttribute("accesskey"); + } + + public void setAccessKey(String accessKey) + { + setHTMLAttribute("accesskey", accessKey); + } + + public String getAlt() + { + return getHTMLAttribute("alt"); + } + + public void setAlt(String alt) + { + setHTMLAttribute("alt", alt); + } + + public String getCoords() + { + return getHTMLAttribute("coords"); + } + + public void setCoords(String coords) + { + setHTMLAttribute("coords", coords); + } + + public String getHref() + { + return getHTMLAttribute("href"); + } + + public void setHref(String href) + { + setHTMLAttribute("href", href); + } + + public boolean getNoHref() + { + return getBooleanHTMLAttribute("nohref"); + } + + public void setNoHref(boolean nohref) + { + setBooleanHTMLAttribute("nohref", nohref); + } + + public String getShape() + { + return getHTMLAttribute("shape"); + } + + public void setShape(String shape) + { + setHTMLAttribute("shape", shape); + } + + public int getTabIndex() + { + return getIntHTMLAttribute("tabindex"); + } + + public void setTabIndex(int tabIndex) + { + setIntHTMLAttribute("tabindex", tabIndex); + } + + public String getTarget() + { + return getHTMLAttribute("target"); + } + + public void setTarget(String target) + { + setHTMLAttribute("target", target); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLBRElement.java b/gnu/xml/dom/html2/DomHTMLBRElement.java new file mode 100644 index 000000000..d02ad22ca --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLBRElement.java @@ -0,0 +1,69 @@ +/* DomHTMLBRElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLBRElement; + +/** + * An HTML 'BR' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLBRElement + extends DomHTMLElement + implements HTMLBRElement +{ + + protected DomHTMLBRElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getClear() + { + return getHTMLAttribute("clear"); + } + + public void setClear(String clear) + { + setHTMLAttribute("clear", clear); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLBaseElement.java b/gnu/xml/dom/html2/DomHTMLBaseElement.java new file mode 100644 index 000000000..a7b241aad --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLBaseElement.java @@ -0,0 +1,79 @@ +/* DomHTMLBaseElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLBaseElement; + +/** + * An HTML 'BASE' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLBaseElement + extends DomHTMLElement + implements HTMLBaseElement +{ + + protected DomHTMLBaseElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getHref() + { + return getHTMLAttribute("href"); + } + + public void setHref(String href) + { + setHTMLAttribute("href", href); + } + + public String getTarget() + { + return getHTMLAttribute("target"); + } + + public void setTarget(String target) + { + setHTMLAttribute("target", target); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLBaseFontElement.java b/gnu/xml/dom/html2/DomHTMLBaseFontElement.java new file mode 100644 index 000000000..0d64f445e --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLBaseFontElement.java @@ -0,0 +1,89 @@ +/* DomHTMLBaseFontElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLBaseFontElement; + +/** + * An HTML 'BASEFONT' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLBaseFontElement + extends DomHTMLElement + implements HTMLBaseFontElement +{ + + protected DomHTMLBaseFontElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getColor() + { + return getHTMLAttribute("color"); + } + + public void setColor(String color) + { + setHTMLAttribute("color", color); + } + + public String getFace() + { + return getHTMLAttribute("face"); + } + + public void setFace(String face) + { + setHTMLAttribute("face", face); + } + + public int getSize() + { + return getIntHTMLAttribute("size"); + } + + public void setSize(int size) + { + setIntHTMLAttribute("size", size); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLBodyElement.java b/gnu/xml/dom/html2/DomHTMLBodyElement.java new file mode 100644 index 000000000..efcd855b3 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLBodyElement.java @@ -0,0 +1,119 @@ +/* DomHTMLBodyElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLBodyElement; + +/** + * An HTML 'BODY' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLBodyElement + extends DomHTMLElement + implements HTMLBodyElement +{ + + protected DomHTMLBodyElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getALink() + { + return getHTMLAttribute("alink"); + } + + public void setALink(String alink) + { + setHTMLAttribute("alink", alink); + } + + public String getBackground() + { + return getHTMLAttribute("background"); + } + + public void setBackground(String background) + { + setHTMLAttribute("background", background); + } + + public String getBgColor() + { + return getHTMLAttribute("bgcolor"); + } + + public void setBgColor(String bgcolor) + { + setHTMLAttribute("bgcolor", bgcolor); + } + + public String getLink() + { + return getHTMLAttribute("link"); + } + + public void setLink(String link) + { + setHTMLAttribute("link", link); + } + + public String getText() + { + return getHTMLAttribute("text"); + } + + public void setText(String text) + { + setHTMLAttribute("text", text); + } + + public String getVLink() + { + return getHTMLAttribute("vlink"); + } + + public void setVLink(String vlink) + { + setHTMLAttribute("vlink", vlink); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLButtonElement.java b/gnu/xml/dom/html2/DomHTMLButtonElement.java new file mode 100644 index 000000000..996750ea6 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLButtonElement.java @@ -0,0 +1,121 @@ +/* DomHTMLButtonElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.Node; +import org.w3c.dom.html2.HTMLButtonElement; +import org.w3c.dom.html2.HTMLFormElement; + +/** + * An HTML 'BUTTON' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLButtonElement + extends DomHTMLElement + implements HTMLButtonElement +{ + + protected DomHTMLButtonElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public String getAccessKey() + { + return getHTMLAttribute("accesskey"); + } + + public void setAccessKey(String accessKey) + { + setHTMLAttribute("accesskey", accessKey); + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public int getTabIndex() + { + return getIntHTMLAttribute("tabindex"); + } + + public void setTabIndex(int tabIndex) + { + setIntHTMLAttribute("tabindex", tabIndex); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public String getValue() + { + return getHTMLAttribute("value"); + } + + public void setValue(String value) + { + setHTMLAttribute("value", value); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLCollection.java b/gnu/xml/dom/html2/DomHTMLCollection.java new file mode 100644 index 000000000..da9d0142e --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLCollection.java @@ -0,0 +1,218 @@ +/* DomHTMLCollection.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import gnu.xml.dom.DomDOMException; +import gnu.xml.dom.DomElement; +import java.util.ArrayList; +import java.util.Iterator; +import java.util.LinkedList; +import java.util.List; +import org.w3c.dom.DOMException; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.html2.HTMLCollection; +import org.w3c.dom.html2.HTMLOptionsCollection; +import org.w3c.dom.traversal.NodeFilter; +import org.w3c.dom.traversal.NodeIterator; + +/** + * An HTML element collection. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +class DomHTMLCollection + implements HTMLCollection, HTMLOptionsCollection, NodeList, NodeFilter +{ + + final DomHTMLDocument doc; + final Node root; + List nodeNames; + List attributeNames; + List results; + + DomHTMLCollection(DomHTMLDocument doc, Node root) + { + this.doc = doc; + this.root = root; + } + + // -- Node name and attribute filtering -- + + void addNodeName(String name) + { + if (nodeNames == null) + { + nodeNames = new LinkedList(); + } + nodeNames.add(name); + } + + void addAttributeName(String name) + { + if (attributeNames == null) + { + attributeNames = new LinkedList(); + } + attributeNames.add(name); + } + + public short acceptNode(Node n) + { + if (n.getNodeType() != Node.ELEMENT_NODE) + { + return NodeFilter.FILTER_SKIP; + } + if (nodeNames != null && !acceptName(n.getLocalName())) + { + return NodeFilter.FILTER_SKIP; + } + if (attributeNames != null && !acceptAttributes(n.getAttributes())) + { + return NodeFilter.FILTER_SKIP; + } + return NodeFilter.FILTER_ACCEPT; + } + + private boolean acceptName(String name) + { + for (Iterator i = nodeNames.iterator(); i.hasNext(); ) + { + String nodeName = (String) i.next(); + if (nodeName.equalsIgnoreCase(name)) + { + return true; + } + } + return false; + } + + private boolean acceptAttributes(NamedNodeMap attrs) + { + for (Iterator i = attributeNames.iterator(); i.hasNext(); ) + { + String attributeName = (String) i.next(); + Node attr = getNamedItem(attrs, attributeName); + if (attr != null) + { + // Check that attribute has a non-null value + String nodeValue = attr.getNodeValue(); + if (nodeValue != null && nodeValue.length() > 0) + { + return true; + } + } + } + return false; + } + + /** + * Case-insensitive version of getNamedItem. + */ + private Node getNamedItem(NamedNodeMap attrs, String name) + { + int len = attrs.getLength(); + for (int i = 0; i < len; i++) + { + Node attr = attrs.item(i); + String attrName = attr.getLocalName(); + if (name.equalsIgnoreCase(attrName)) + { + return attr; + } + } + return null; + } + + // -- Perform query -- + + void evaluate() + { + NodeIterator i = doc.createNodeIterator(root, NodeFilter.SHOW_ELEMENT, + this, true); + results = new ArrayList(); + for (Node node = i.nextNode(); node != null; node = i.nextNode()) + { + results.add(node); + } + } + + // -- HTMLCollection/NodeList interface -- + + public int getLength() + { + return results.size(); + } + + public void setLength(int length) + { + throw new DomDOMException(DOMException.NOT_SUPPORTED_ERR); + } + + public Node item(int index) + { + return (Node) results.get(index); + } + + public Node namedItem(String name) + { + boolean xhtml = false; // FIXME detect XHTML document + for (Iterator i = results.iterator(); i.hasNext(); ) + { + Node node = (Node) i.next(); + NamedNodeMap attrs = node.getAttributes(); + Node attr = getNamedItem(attrs, "id"); + if (name.equals(attr.getTextContent())) + { + return node; + } + if (!xhtml) + { + attr = getNamedItem(attrs, "name"); + if (name.equals(attr.getTextContent())) + { + return node; + } + } + } + return null; + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLDListElement.java b/gnu/xml/dom/html2/DomHTMLDListElement.java new file mode 100644 index 000000000..790e3081a --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLDListElement.java @@ -0,0 +1,69 @@ +/* DomHTMLDListElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLDListElement; + +/** + * An HTML 'DL' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLDListElement + extends DomHTMLElement + implements HTMLDListElement +{ + + protected DomHTMLDListElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getCompact() + { + return getBooleanHTMLAttribute("compact"); + } + + public void setCompact(boolean compact) + { + setBooleanHTMLAttribute("compact", compact); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLDirectoryElement.java b/gnu/xml/dom/html2/DomHTMLDirectoryElement.java new file mode 100644 index 000000000..0f71f960b --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLDirectoryElement.java @@ -0,0 +1,69 @@ +/* DomHTMLDirectoryElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLDirectoryElement; + +/** + * An HTML 'DIR' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLDirectoryElement + extends DomHTMLElement + implements HTMLDirectoryElement +{ + + protected DomHTMLDirectoryElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getCompact() + { + return getBooleanHTMLAttribute("compact"); + } + + public void setCompact(boolean compact) + { + setBooleanHTMLAttribute("compact", compact); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLDivElement.java b/gnu/xml/dom/html2/DomHTMLDivElement.java new file mode 100644 index 000000000..a35a5fb93 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLDivElement.java @@ -0,0 +1,69 @@ +/* DomHTMLDivElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLDivElement; + +/** + * An HTML 'DIV' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLDivElement + extends DomHTMLElement + implements HTMLDivElement +{ + + protected DomHTMLDivElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLDocument.java b/gnu/xml/dom/html2/DomHTMLDocument.java new file mode 100644 index 000000000..9a3182916 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLDocument.java @@ -0,0 +1,370 @@ +/* DomHTMLDocument.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import gnu.xml.dom.DomDocument; +import gnu.xml.dom.DomDOMException; +import java.lang.reflect.Constructor; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collections; +import java.util.HashMap; +import java.util.Map; +import org.w3c.dom.DOMException; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; +import org.w3c.dom.html2.HTMLCollection; +import org.w3c.dom.html2.HTMLDocument; +import org.w3c.dom.html2.HTMLElement; + +/** + * An HTML document. + * This is the factory object used to create HTML elements. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLDocument + extends DomDocument + implements HTMLDocument +{ + + private static final Class[] ELEMENT_PT = new Class[] { + DomHTMLDocument.class, + String.class, + String.class + }; + + private static Map ELEMENT_CLASSES; + static + { + Map map = new HashMap(); + map.put("a", DomHTMLAnchorElement.class); + map.put("applet", DomHTMLAppletElement.class); + map.put("area", DomHTMLAreaElement.class); + map.put("base", DomHTMLBaseElement.class); + map.put("basefont", DomHTMLBaseFontElement.class); + map.put("body", DomHTMLBodyElement.class); + map.put("br", DomHTMLBRElement.class); + map.put("button", DomHTMLButtonElement.class); + map.put("dir", DomHTMLDirectoryElement.class); + map.put("div", DomHTMLDivElement.class); + map.put("dlist", DomHTMLDListElement.class); + map.put("fieldset", DomHTMLFieldSetElement.class); + map.put("font", DomHTMLFontElement.class); + map.put("form", DomHTMLFormElement.class); + map.put("frame", DomHTMLFrameElement.class); + map.put("frameset", DomHTMLFrameSetElement.class); + map.put("head", DomHTMLHeadElement.class); + map.put("h1", DomHTMLHeadingElement.class); + map.put("h2", DomHTMLHeadingElement.class); + map.put("h3", DomHTMLHeadingElement.class); + map.put("h4", DomHTMLHeadingElement.class); + map.put("h5", DomHTMLHeadingElement.class); + map.put("h6", DomHTMLHeadingElement.class); + map.put("html", DomHTMLHtmlElement.class); + map.put("iframe", DomHTMLIFrameElement.class); + map.put("img", DomHTMLImageElement.class); + map.put("input", DomHTMLInputElement.class); + map.put("isindex", DomHTMLIsIndexElement.class); + map.put("label", DomHTMLLabelElement.class); + map.put("legend", DomHTMLLegendElement.class); + map.put("li", DomHTMLLIElement.class); + map.put("link", DomHTMLLinkElement.class); + map.put("map", DomHTMLMapElement.class); + map.put("menu", DomHTMLMenuElement.class); + map.put("meta", DomHTMLMetaElement.class); + map.put("ins", DomHTMLModElement.class); + map.put("del", DomHTMLModElement.class); + map.put("object", DomHTMLObjectElement.class); + map.put("ol", DomHTMLOListElement.class); + map.put("optgroup", DomHTMLOptGroupElement.class); + map.put("option", DomHTMLOptionElement.class); + map.put("p", DomHTMLParagraphElement.class); + map.put("param", DomHTMLParamElement.class); + map.put("pre", DomHTMLPreElement.class); + map.put("q", DomHTMLQuoteElement.class); + map.put("blockquote", DomHTMLQuoteElement.class); + map.put("script", DomHTMLScriptElement.class); + map.put("select", DomHTMLSelectElement.class); + map.put("style", DomHTMLStyleElement.class); + map.put("caption", DomHTMLTableCaptionElement.class); + map.put("th", DomHTMLTableCellElement.class); + map.put("td", DomHTMLTableCellElement.class); + map.put("col", DomHTMLTableColElement.class); + map.put("colgroup", DomHTMLTableColElement.class); + map.put("table", DomHTMLTableElement.class); + map.put("tr", DomHTMLTableRowElement.class); + map.put("thead", DomHTMLTableSectionElement.class); + map.put("tfoot", DomHTMLTableSectionElement.class); + map.put("tbody", DomHTMLTableSectionElement.class); + // TODO others + ELEMENT_CLASSES = Collections.unmodifiableMap(map); + } + + private Node getChildNodeByName(Node parent, String name) + { + for (Node ctx = parent.getFirstChild(); ctx != null; + ctx = ctx.getNextSibling()) + { + if (name.equalsIgnoreCase(ctx.getNodeName())) + { + return ctx; + } + } + return null; + } + + public String getTitle() + { + Node html = getDocumentElement(); + if (html != null) + { + Node head = getChildNodeByName(html, "head"); + if (head != null) + { + Node title = getChildNodeByName(head, "title"); + if (title != null) + { + return title.getTextContent(); + } + } + } + return null; + } + + public void setTitle(String title) + { + Node html = getDocumentElement(); + if (html == null) + { + html = createElement("html"); + appendChild(html); + } + Node head = getChildNodeByName(html, "head"); + if (head == null) + { + head = createElement("head"); + Node first = html.getFirstChild(); + if (first != null) + { + html.insertBefore(first, head); + } + else + { + html.appendChild(head); + } + } + Node titleNode = getChildNodeByName(head, "title"); + if (titleNode == null) + { + titleNode = createElement("title"); + Node first = head.getFirstChild(); + if (first != null) + { + head.insertBefore(first, titleNode); + } + else + { + head.appendChild(titleNode); + } + } + titleNode.setTextContent(title); + } + + public String getReferrer() + { + // TODO + return null; + } + + public String getDomain() + { + try + { + URL url = new URL(getDocumentURI()); + return url.getHost(); + } + catch (MalformedURLException e) + { + return null; + } + } + + public String getURL() + { + return getDocumentURI(); + } + + public HTMLElement getBody() + { + Node html = getDocumentElement(); + if (html != null) + { + Node body = getChildNodeByName(html, "body"); + if (body == null) + { + body = getChildNodeByName(html, "frameset"); + } + return (HTMLElement) body; + } + return null; + } + + public void setBody(HTMLElement body) + { + // TODO + } + + public HTMLCollection getImages() + { + DomHTMLCollection ret = new DomHTMLCollection(this, this); + ret.addNodeName("img"); + ret.evaluate(); + return ret; + } + + public HTMLCollection getApplets() + { + DomHTMLCollection ret = new DomHTMLCollection(this, this); + ret.addNodeName("object"); + ret.addNodeName("applet"); + ret.evaluate(); + return ret; + } + + public HTMLCollection getLinks() + { + DomHTMLCollection ret = new DomHTMLCollection(this, this); + ret.addNodeName("area"); + ret.addNodeName("a"); + ret.evaluate(); + return ret; + } + + public HTMLCollection getForms() + { + DomHTMLCollection ret = new DomHTMLCollection(this, this); + ret.addNodeName("form"); + ret.evaluate(); + return ret; + } + + public HTMLCollection getAnchors() + { + DomHTMLCollection ret = new DomHTMLCollection(this, this); + ret.addNodeName("a"); + ret.addAttributeName("name"); + ret.evaluate(); + return ret; + } + + public String getCookie() + { + // TODO + return null; + } + + public void setCookie(String cookie) + { + // TODO + } + + public void open() + { + // TODO + } + + public void close() + { + // TODO + } + + public void write(String text) + { + // TODO + } + + public void writeln(String text) + { + // TODO + } + + public NodeList getElementsByName(String name) + { + DomHTMLCollection ret = new DomHTMLCollection(this, this); + ret.addNodeName(name); + ret.evaluate(); + return ret; + // TODO xhtml: return only form controls (?) + } + + public Element createElement(String tagName) + { + return createElementNS(null, tagName); + } + + public Element createElementNS(String uri, String qName) + { + String localName = qName.toLowerCase(); + int ci = qName.indexOf(':'); + if (ci != -1) + { + localName = qName.substring(ci + 1); + } + Class t = (Class) ELEMENT_CLASSES.get(localName); + if (t == null) + { + return super.createElementNS(uri, qName); + } + try + { + Constructor c = t.getConstructor(ELEMENT_PT); + Object[] args = new Object[] { this, uri, qName }; + return (Element) c.newInstance(args); + } + catch (Exception e) + { + DOMException e2 = new DomDOMException(DOMException.TYPE_MISMATCH_ERR); + e2.initCause(e); + throw e2; + } + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLElement.java b/gnu/xml/dom/html2/DomHTMLElement.java new file mode 100644 index 000000000..b204139fa --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLElement.java @@ -0,0 +1,220 @@ +/* DomHTMLElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import gnu.xml.dom.DomElement; +import org.w3c.dom.NamedNodeMap; +import org.w3c.dom.Node; +import org.w3c.dom.html2.HTMLElement; + +/** + * Abstract implementation of an HTML element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public abstract class DomHTMLElement + extends DomElement + implements HTMLElement +{ + + protected DomHTMLElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + /** + * Returns the value of the specified attribute. + * The attribute name is case insensitive. + */ + protected String getHTMLAttribute(String name) + { + if (hasAttributes()) + { + NamedNodeMap attrs = getAttributes(); + int len = attrs.getLength(); + for (int i = 0; i < len; i++) + { + Node attr = attrs.item(i); + String attrName = attr.getLocalName(); + if (attrName.equalsIgnoreCase(name)) + { + return attr.getNodeValue(); + } + } + } + return ""; + } + + protected int getIntHTMLAttribute(String name) + { + String value = getHTMLAttribute(name); + if (value == null) + { + return -1; + } + try + { + return Integer.parseInt(value); + } + catch (NumberFormatException e) + { + return -1; + } + } + + protected boolean getBooleanHTMLAttribute(String name) + { + String value = getHTMLAttribute(name); + return value != null; + } + + /** + * Sets the value of the specified attribute. + * The attribute name is case insensitive. + */ + protected void setHTMLAttribute(String name, String value) + { + Node attr; + NamedNodeMap attrs = getAttributes(); + int len = attrs.getLength(); + for (int i = 0; i < len; i++) + { + attr = attrs.item(i); + String attrName = attr.getLocalName(); + if (attrName.equalsIgnoreCase(name)) + { + if (value != null) + { + attr.setNodeValue(value); + } + else + { + attrs.removeNamedItem(attr.getNodeName()); + } + return; + } + } + if (value != null) + { + // Create a new attribute + DomHTMLDocument doc = (DomHTMLDocument) getOwnerDocument(); + // XXX namespace URI for attribute? + attr = doc.createAttribute(name); + attr.setNodeValue(value); + } + } + + protected void setIntHTMLAttribute(String name, int value) + { + setHTMLAttribute(name, Integer.toString(value)); + } + + protected void setBooleanHTMLAttribute(String name, boolean value) + { + setHTMLAttribute(name, value ? name : null); + } + + /** + * Returns the first parent element with the specified name. + */ + protected Node getParentElement(String name) + { + for (Node parent = getParentNode(); parent != null; + parent = parent.getParentNode()) + { + if (name.equalsIgnoreCase(parent.getLocalName())) + { + return parent; + } + } + return null; + } + + public String getId() + { + return getHTMLAttribute("id"); + } + + public void setId(String id) + { + setHTMLAttribute("id", id); + } + + public String getTitle() + { + return getHTMLAttribute("title"); + } + + public void setTitle(String title) + { + setHTMLAttribute("title", title); + } + + public String getLang() + { + return getHTMLAttribute("lang"); + } + + public void setLang(String lang) + { + setHTMLAttribute("lang", lang); + } + + public String getDir() + { + return getHTMLAttribute("dir"); + } + + public void setDir(String dir) + { + setHTMLAttribute("dir", dir); + } + + public String getClassName() + { + return getHTMLAttribute("class"); + } + + public void setClassName(String className) + { + setHTMLAttribute("class", className); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLFieldSetElement.java b/gnu/xml/dom/html2/DomHTMLFieldSetElement.java new file mode 100644 index 000000000..2e49fe474 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLFieldSetElement.java @@ -0,0 +1,65 @@ +/* DomHTMLFieldSetElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFieldSetElement; +import org.w3c.dom.html2.HTMLFormElement; + +/** + * An HTML 'FIELDSET' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLFieldSetElement + extends DomHTMLElement + implements HTMLFieldSetElement +{ + + protected DomHTMLFieldSetElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLFontElement.java b/gnu/xml/dom/html2/DomHTMLFontElement.java new file mode 100644 index 000000000..3fd1d98e7 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLFontElement.java @@ -0,0 +1,89 @@ +/* DomHTMLFontElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFontElement; + +/** + * An HTML 'FONT' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLFontElement + extends DomHTMLElement + implements HTMLFontElement +{ + + protected DomHTMLFontElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getColor() + { + return getHTMLAttribute("color"); + } + + public void setColor(String color) + { + setHTMLAttribute("color", color); + } + + public String getFace() + { + return getHTMLAttribute("face"); + } + + public void setFace(String face) + { + setHTMLAttribute("face", face); + } + + public String getSize() + { + return getHTMLAttribute("size"); + } + + public void setSize(String size) + { + setHTMLAttribute("size", size); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLFormElement.java b/gnu/xml/dom/html2/DomHTMLFormElement.java new file mode 100644 index 000000000..041e15eb4 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLFormElement.java @@ -0,0 +1,150 @@ +/* DomHTMLFormElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLCollection; +import org.w3c.dom.html2.HTMLFormElement; + +/** + * An HTML 'FORM' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLFormElement + extends DomHTMLElement + implements HTMLFormElement +{ + + protected DomHTMLFormElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLCollection getElements() + { + DomHTMLCollection ret = + new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this); + ret.addNodeName("input"); + ret.addNodeName("button"); + ret.addNodeName("select"); + ret.addNodeName("textarea"); + ret.addNodeName("isindex"); + ret.addNodeName("label"); + ret.addNodeName("option"); + ret.evaluate(); + return ret; + } + + public int getLength() + { + return getElements().getLength(); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getAcceptCharset() + { + return getHTMLAttribute("accept-charset"); + } + + public void setAcceptCharset(String acceptCharset) + { + setHTMLAttribute("accept-charset", acceptCharset); + } + + public String getAction() + { + return getHTMLAttribute("action"); + } + + public void setAction(String action) + { + setHTMLAttribute("action", action); + } + + public String getEnctype() + { + return getHTMLAttribute("enctype"); + } + + public void setEnctype(String enctype) + { + setHTMLAttribute("enctype", enctype); + } + + public String getMethod() + { + return getHTMLAttribute("method"); + } + + public void setMethod(String method) + { + setHTMLAttribute("method", method); + } + + public String getTarget() + { + return getHTMLAttribute("target"); + } + + public void setTarget(String target) + { + setHTMLAttribute("target", target); + } + + public void submit() + { + // TODO + } + + public void reset() + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLFrameElement.java b/gnu/xml/dom/html2/DomHTMLFrameElement.java new file mode 100644 index 000000000..5912cacb6 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLFrameElement.java @@ -0,0 +1,146 @@ +/* DomHTMLFrameElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.Document; +import org.w3c.dom.html2.HTMLFrameElement; + +/** + * An HTML 'FRAME' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLFrameElement + extends DomHTMLElement + implements HTMLFrameElement +{ + + protected DomHTMLFrameElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getFrameBorder() + { + return getHTMLAttribute("frameborder"); + } + + public void setFrameBorder(String frameBorder) + { + setHTMLAttribute("frameborder", frameBorder); + } + + public String getLongDesc() + { + return getHTMLAttribute("longdesc"); + } + + public void setLongDesc(String longDesc) + { + setHTMLAttribute("longdesc", longDesc); + } + + public String getMarginHeight() + { + return getHTMLAttribute("marginheight"); + } + + public void setMarginHeight(String marginHeight) + { + setHTMLAttribute("marginheight", marginHeight); + } + + public String getMarginWidth() + { + return getHTMLAttribute("marginwidth"); + } + + public void setMarginWidth(String marginWidth) + { + setHTMLAttribute("marginwidth", marginWidth); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public boolean getNoResize() + { + return getBooleanHTMLAttribute("noresize"); + } + + public void setNoResize(boolean noResize) + { + setBooleanHTMLAttribute("noresize", noResize); + } + + public String getScrolling() + { + return getHTMLAttribute("scrolling"); + } + + public void setScrolling(String scrolling) + { + setHTMLAttribute("scrolling", scrolling); + } + + public String getSrc() + { + return getHTMLAttribute("src"); + } + + public void setSrc(String src) + { + setHTMLAttribute("src", src); + } + + public Document getContentDocument() + { + // TODO + return null; + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLFrameSetElement.java b/gnu/xml/dom/html2/DomHTMLFrameSetElement.java new file mode 100644 index 000000000..8e5eb3312 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLFrameSetElement.java @@ -0,0 +1,79 @@ +/* DomHTMLFrameSetElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFrameSetElement; + +/** + * An HTML 'FRAMESET' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLFrameSetElement + extends DomHTMLElement + implements HTMLFrameSetElement +{ + + protected DomHTMLFrameSetElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getCols() + { + return getHTMLAttribute("cols"); + } + + public void setCols(String cols) + { + setHTMLAttribute("cols", cols); + } + + public String getRows() + { + return getHTMLAttribute("rows"); + } + + public void setRows(String rows) + { + setHTMLAttribute("rows", rows); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLHRElement.java b/gnu/xml/dom/html2/DomHTMLHRElement.java new file mode 100644 index 000000000..850907b8e --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLHRElement.java @@ -0,0 +1,99 @@ +/* DomHTMLHRElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLHRElement; + +/** + * An HTML 'HR' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLHRElement + extends DomHTMLElement + implements HTMLHRElement +{ + + protected DomHTMLHRElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public boolean getNoShade() + { + return getBooleanHTMLAttribute("noshade"); + } + + public void setNoShade(boolean noShade) + { + setBooleanHTMLAttribute("noshade", noShade); + } + + public String getSize() + { + return getHTMLAttribute("size"); + } + + public void setSize(String size) + { + setHTMLAttribute("size", size); + } + + public String getWidth() + { + return getHTMLAttribute("width"); + } + + public void setWidth(String width) + { + setHTMLAttribute("width", width); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLHeadElement.java b/gnu/xml/dom/html2/DomHTMLHeadElement.java new file mode 100644 index 000000000..d6072a070 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLHeadElement.java @@ -0,0 +1,69 @@ +/* DomHTMLHeadElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLHeadElement; + +/** + * An HTML 'HEAD' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLHeadElement + extends DomHTMLElement + implements HTMLHeadElement +{ + + protected DomHTMLHeadElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getProfile() + { + return getHTMLAttribute("profile"); + } + + public void setProfile(String profile) + { + setHTMLAttribute("profile", profile); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLHeadingElement.java b/gnu/xml/dom/html2/DomHTMLHeadingElement.java new file mode 100644 index 000000000..a336e31e9 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLHeadingElement.java @@ -0,0 +1,69 @@ +/* DomHTMLHeadingElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLHeadingElement; + +/** + * An HTML 'H1', 'H2', 'H3', 'H4', 'H5', or 'H6' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLHeadingElement + extends DomHTMLElement + implements HTMLHeadingElement +{ + + protected DomHTMLHeadingElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLHtmlElement.java b/gnu/xml/dom/html2/DomHTMLHtmlElement.java new file mode 100644 index 000000000..6a4e195f6 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLHtmlElement.java @@ -0,0 +1,69 @@ +/* DomHTMLHtmlElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLHtmlElement; + +/** + * An HTML 'HTML' top-level element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLHtmlElement + extends DomHTMLElement + implements HTMLHtmlElement +{ + + protected DomHTMLHtmlElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getVersion() + { + return getHTMLAttribute("version"); + } + + public void setVersion(String version) + { + setHTMLAttribute("version", version); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLIFrameElement.java b/gnu/xml/dom/html2/DomHTMLIFrameElement.java new file mode 100644 index 000000000..8799cbc7a --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLIFrameElement.java @@ -0,0 +1,166 @@ +/* DomHTMLIFrameElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.Document; +import org.w3c.dom.html2.HTMLIFrameElement; + +/** + * An HTML 'IFRAME' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLIFrameElement + extends DomHTMLElement + implements HTMLIFrameElement +{ + + protected DomHTMLIFrameElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getFrameBorder() + { + return getHTMLAttribute("frameborder"); + } + + public void setFrameBorder(String frameBorder) + { + setHTMLAttribute("frameborder", frameBorder); + } + + public String getHeight() + { + return getHTMLAttribute("height"); + } + + public void setHeight(String height) + { + setHTMLAttribute("height", height); + } + + public String getLongDesc() + { + return getHTMLAttribute("longdesc"); + } + + public void setLongDesc(String longDesc) + { + setHTMLAttribute("longdesc", longDesc); + } + + public String getMarginHeight() + { + return getHTMLAttribute("marginheight"); + } + + public void setMarginHeight(String marginHeight) + { + setHTMLAttribute("marginheight", marginHeight); + } + + public String getMarginWidth() + { + return getHTMLAttribute("marginwidth"); + } + + public void setMarginWidth(String marginWidth) + { + setHTMLAttribute("marginwidth", marginWidth); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getScrolling() + { + return getHTMLAttribute("scrolling"); + } + + public void setScrolling(String scrolling) + { + setHTMLAttribute("scrolling", scrolling); + } + + public String getSrc() + { + return getHTMLAttribute("src"); + } + + public void setSrc(String src) + { + setHTMLAttribute("src", src); + } + + public String getWidth() + { + return getHTMLAttribute("width"); + } + + public void setWidth(String width) + { + setHTMLAttribute("width", width); + } + + public Document getContentDocument() + { + // TODO + return null; + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLImageElement.java b/gnu/xml/dom/html2/DomHTMLImageElement.java new file mode 100644 index 000000000..7a621a6db --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLImageElement.java @@ -0,0 +1,179 @@ +/* DomHTMLImageElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLImageElement; + +/** + * An HTML 'IMG' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLImageElement + extends DomHTMLElement + implements HTMLImageElement +{ + + protected DomHTMLImageElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getAlt() + { + return getHTMLAttribute("alt"); + } + + public void setAlt(String alt) + { + setHTMLAttribute("alt", alt); + } + + public String getBorder() + { + return getHTMLAttribute("border"); + } + + public void setBorder(String border) + { + setHTMLAttribute("border", border); + } + + public int getHeight() + { + return getIntHTMLAttribute("height"); + } + + public void setHeight(int height) + { + setIntHTMLAttribute("height", height); + } + + public int getHspace() + { + return getIntHTMLAttribute("hspace"); + } + + public void setHspace(int hspace) + { + setIntHTMLAttribute("hspace", hspace); + } + + public boolean getIsMap() + { + return getBooleanHTMLAttribute("ismap"); + } + + public void setIsMap(boolean isMap) + { + setBooleanHTMLAttribute("ismap", isMap); + } + + public String getLongDesc() + { + return getHTMLAttribute("longdesc"); + } + + public void setLongDesc(String longDesc) + { + setHTMLAttribute("longdesc", longDesc); + } + + public String getSrc() + { + return getHTMLAttribute("src"); + } + + public void setSrc(String src) + { + setHTMLAttribute("src", src); + } + + public String getUseMap() + { + return getHTMLAttribute("usemap"); + } + + public void setUseMap(String useMap) + { + setHTMLAttribute("usemap", useMap); + } + + public int getVspace() + { + return getIntHTMLAttribute("vspace"); + } + + public void setVspace(int vspace) + { + setIntHTMLAttribute("vspace", vspace); + } + + public int getWidth() + { + return getIntHTMLAttribute("width"); + } + + public void setWidth(int width) + { + setIntHTMLAttribute("width", width); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLInputElement.java b/gnu/xml/dom/html2/DomHTMLInputElement.java new file mode 100644 index 000000000..1a3a8a082 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLInputElement.java @@ -0,0 +1,266 @@ +/* DomHTMLInputElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLInputElement; + +/** + * An HTML 'INPUT' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLInputElement + extends DomHTMLElement + implements HTMLInputElement +{ + + protected String value; + protected Boolean checked; + + protected DomHTMLInputElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getDefaultValue() + { + return getHTMLAttribute("value"); + } + + public void setDefaultValue(String defaultValue) + { + setHTMLAttribute("value", defaultValue); + } + + public boolean getDefaultChecked() + { + return getBooleanHTMLAttribute("checked"); + } + + public void setDefaultChecked(boolean defaultChecked) + { + setBooleanHTMLAttribute("checked", defaultChecked); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public String getAccept() + { + return getHTMLAttribute("accept"); + } + + public void setAccept(String accept) + { + setHTMLAttribute("accept", accept); + } + + public String getAccessKey() + { + return getHTMLAttribute("accesskey"); + } + + public void setAccessKey(String accessKey) + { + setHTMLAttribute("accesskey", accessKey); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getAlt() + { + return getHTMLAttribute("alt"); + } + + public void setAlt(String alt) + { + setHTMLAttribute("alt", alt); + } + + public boolean getChecked() + { + if (checked == null) + { + checked = Boolean.valueOf(getDefaultChecked()); + } + return checked.booleanValue(); + } + + public void setChecked(boolean checked) + { + this.checked = Boolean.valueOf(checked); + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public int getMaxLength() + { + return getIntHTMLAttribute("maxLength"); + } + + public void setMaxLength(int maxLength) + { + setIntHTMLAttribute("maxLength", maxLength); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public boolean getReadOnly() + { + return getBooleanHTMLAttribute("readonly"); + } + + public void setReadOnly(boolean readOnly) + { + setBooleanHTMLAttribute("readonly", readOnly); + } + + public int getSize() + { + return getIntHTMLAttribute("size"); + } + + public void setSize(int size) + { + setIntHTMLAttribute("size", size); + } + + public String getSrc() + { + return getHTMLAttribute("src"); + } + + public void setSrc(String src) + { + setHTMLAttribute("src", src); + } + + public int getTabIndex() + { + return getIntHTMLAttribute("tabindex"); + } + + public void setTabIndex(int tabIndex) + { + setIntHTMLAttribute("tabindex", tabIndex); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + + public String getUseMap() + { + return getHTMLAttribute("usemap"); + } + + public void setUseMap(String useMap) + { + setHTMLAttribute("usemap", useMap); + } + + public String getValue() + { + if (value == null) + { + value = getDefaultValue(); + } + return value; + } + + public void setValue(String value) + { + this.value = value; + } + + public void blur() + { + // TODO + } + + public void focus() + { + // TODO + } + + public void select() + { + // TODO + } + + public void click() + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLIsIndexElement.java b/gnu/xml/dom/html2/DomHTMLIsIndexElement.java new file mode 100644 index 000000000..02d5a9886 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLIsIndexElement.java @@ -0,0 +1,75 @@ +/* DomHTMLIsIndexElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLIsIndexElement; + +/** + * An HTML 'ISINDEX' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLIsIndexElement + extends DomHTMLElement + implements HTMLIsIndexElement +{ + + protected DomHTMLIsIndexElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public String getPrompt() + { + return getHTMLAttribute("prompt"); + } + + public void setPrompt(String prompt) + { + setHTMLAttribute("prompt", prompt); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLLIElement.java b/gnu/xml/dom/html2/DomHTMLLIElement.java new file mode 100644 index 000000000..ea99ee171 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLLIElement.java @@ -0,0 +1,79 @@ +/* DomHTMLLIElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLLIElement; + +/** + * An HTML 'LI' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLLIElement + extends DomHTMLElement + implements HTMLLIElement +{ + + protected DomHTMLLIElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + + public int getValue() + { + return getIntHTMLAttribute("value"); + } + + public void setValue(int value) + { + setIntHTMLAttribute("value", value); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLLabelElement.java b/gnu/xml/dom/html2/DomHTMLLabelElement.java new file mode 100644 index 000000000..0dd2f833f --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLLabelElement.java @@ -0,0 +1,85 @@ +/* DomHTMLLabelElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLLabelElement; + +/** + * An HTML 'LABEL' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLLabelElement + extends DomHTMLElement + implements HTMLLabelElement +{ + + protected DomHTMLLabelElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public String getAccessKey() + { + return getHTMLAttribute("accesskey"); + } + + public void setAccessKey(String accessKey) + { + setHTMLAttribute("accesskey", accessKey); + } + + public String getHtmlFor() + { + return getHTMLAttribute("for"); + } + + public void setHtmlFor(String htmlFor) + { + setHTMLAttribute("for", htmlFor); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLLegendElement.java b/gnu/xml/dom/html2/DomHTMLLegendElement.java new file mode 100644 index 000000000..663e67c7d --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLLegendElement.java @@ -0,0 +1,85 @@ +/* DomHTMLLegendElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLLegendElement; + +/** + * An HTML 'LEGEND' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLLegendElement + extends DomHTMLElement + implements HTMLLegendElement +{ + + protected DomHTMLLegendElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public String getAccessKey() + { + return getHTMLAttribute("accesskey"); + } + + public void setAccessKey(String accessKey) + { + setHTMLAttribute("accesskey", accessKey); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLLinkElement.java b/gnu/xml/dom/html2/DomHTMLLinkElement.java new file mode 100644 index 000000000..c81486a8a --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLLinkElement.java @@ -0,0 +1,149 @@ +/* DomHTMLLinkElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLLinkElement; + +/** + * An HTML 'LINK' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLLinkElement + extends DomHTMLElement + implements HTMLLinkElement +{ + + protected DomHTMLLinkElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public String getCharset() + { + return getHTMLAttribute("charset"); + } + + public void setCharset(String charset) + { + setHTMLAttribute("charset", charset); + } + + public String getHref() + { + return getHTMLAttribute("href"); + } + + public void setHref(String href) + { + setHTMLAttribute("href", href); + } + + public String getHreflang() + { + return getHTMLAttribute("hreflang"); + } + + public void setHreflang(String hreflang) + { + setHTMLAttribute("hreflang", hreflang); + } + + public String getMedia() + { + return getHTMLAttribute("media"); + } + + public void setMedia(String media) + { + setHTMLAttribute("media", media); + } + + public String getRel() + { + return getHTMLAttribute("rel"); + } + + public void setRel(String rel) + { + setHTMLAttribute("rel", rel); + } + + public String getRev() + { + return getHTMLAttribute("rev"); + } + + public void setRev(String rev) + { + setHTMLAttribute("rev", rev); + } + + public String getTarget() + { + return getHTMLAttribute("target"); + } + + public void setTarget(String target) + { + setHTMLAttribute("target", target); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLMapElement.java b/gnu/xml/dom/html2/DomHTMLMapElement.java new file mode 100644 index 000000000..d078f70f0 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLMapElement.java @@ -0,0 +1,79 @@ +/* DomHTMLMapElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLCollection; +import org.w3c.dom.html2.HTMLMapElement; + +/** + * An HTML 'MAP' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLMapElement + extends DomHTMLElement + implements HTMLMapElement +{ + + protected DomHTMLMapElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLCollection getAreas() + { + DomHTMLCollection ret = + new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this); + ret.addNodeName("area"); + ret.evaluate(); + return ret; + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLMenuElement.java b/gnu/xml/dom/html2/DomHTMLMenuElement.java new file mode 100644 index 000000000..e674f3e7e --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLMenuElement.java @@ -0,0 +1,69 @@ +/* DomHTMLMenuElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLMenuElement; + +/** + * An HTML 'MENU' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLMenuElement + extends DomHTMLElement + implements HTMLMenuElement +{ + + protected DomHTMLMenuElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getCompact() + { + return getBooleanHTMLAttribute("compact"); + } + + public void setCompact(boolean compact) + { + setBooleanHTMLAttribute("compact", compact); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLMetaElement.java b/gnu/xml/dom/html2/DomHTMLMetaElement.java new file mode 100644 index 000000000..d8bd43509 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLMetaElement.java @@ -0,0 +1,99 @@ +/* DomHTMLMetaElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLMetaElement; + +/** + * An HTML 'META' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLMetaElement + extends DomHTMLElement + implements HTMLMetaElement +{ + + protected DomHTMLMetaElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getContent() + { + return getHTMLAttribute("content"); + } + + public void setContent(String content) + { + setHTMLAttribute("content", content); + } + + public String getHttpEquiv() + { + return getHTMLAttribute("http-equiv"); + } + + public void setHttpEquiv(String httpEquiv) + { + setHTMLAttribute("http-equiv", httpEquiv); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getScheme() + { + return getHTMLAttribute("scheme"); + } + + public void setScheme(String scheme) + { + setHTMLAttribute("scheme", scheme); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLModElement.java b/gnu/xml/dom/html2/DomHTMLModElement.java new file mode 100644 index 000000000..78f94011c --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLModElement.java @@ -0,0 +1,79 @@ +/* DomHTMLModElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLModElement; + +/** + * An HTML 'INS' or 'DEL' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLModElement + extends DomHTMLElement + implements HTMLModElement +{ + + protected DomHTMLModElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getCite() + { + return getHTMLAttribute("cite"); + } + + public void setCite(String cite) + { + setHTMLAttribute("cite", cite); + } + + public String getDateTime() + { + return getHTMLAttribute("datetime"); + } + + public void setDateTime(String dateTime) + { + setHTMLAttribute("datetime", dateTime); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLOListElement.java b/gnu/xml/dom/html2/DomHTMLOListElement.java new file mode 100644 index 000000000..85d1b3fcd --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLOListElement.java @@ -0,0 +1,89 @@ +/* DomHTMLOListElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLOListElement; + +/** + * An HTML 'OL' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLOListElement + extends DomHTMLElement + implements HTMLOListElement +{ + + protected DomHTMLOListElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getCompact() + { + return getBooleanHTMLAttribute("compact"); + } + + public void setCompact(boolean compact) + { + setBooleanHTMLAttribute("compact", compact); + } + + public int getStart() + { + return getIntHTMLAttribute("start"); + } + + public void setStart(int start) + { + setIntHTMLAttribute("start", start); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLObjectElement.java b/gnu/xml/dom/html2/DomHTMLObjectElement.java new file mode 100644 index 000000000..d4dded5a0 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLObjectElement.java @@ -0,0 +1,242 @@ +/* DomHTMLObjectElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.Document; +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLObjectElement; + +/** + * An HTML 'OBJECT' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLObjectElement + extends DomHTMLElement + implements HTMLObjectElement +{ + + protected DomHTMLObjectElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public String getCode() + { + return getHTMLAttribute("code"); + } + + public void setCode(String code) + { + setHTMLAttribute("code", code); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getArchive() + { + return getHTMLAttribute("archive"); + } + + public void setArchive(String archive) + { + setHTMLAttribute("archive", archive); + } + + public String getBorder() + { + return getHTMLAttribute("border"); + } + + public void setBorder(String border) + { + setHTMLAttribute("border", border); + } + + public String getCodeBase() + { + return getHTMLAttribute("codebase"); + } + + public void setCodeBase(String codeBase) + { + setHTMLAttribute("codebase", codeBase); + } + + public String getCodeType() + { + return getHTMLAttribute("codetype"); + } + + public void setCodeType(String codeType) + { + setHTMLAttribute("codetype", codeType); + } + + public String getData() + { + return getHTMLAttribute("data"); + } + + public void setData(String data) + { + setHTMLAttribute("data", data); + } + + public boolean getDeclare() + { + return getBooleanHTMLAttribute("declare"); + } + + public void setDeclare(boolean declare) + { + setBooleanHTMLAttribute("declare", declare); + } + + public String getHeight() + { + return getHTMLAttribute("height"); + } + + public void setHeight(String height) + { + setHTMLAttribute("height", height); + } + + public int getHspace() + { + return getIntHTMLAttribute("hspace"); + } + + public void setHspace(int hspace) + { + setIntHTMLAttribute("hspace", hspace); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getStandby() + { + return getHTMLAttribute("standby"); + } + + public void setStandby(String standby) + { + setHTMLAttribute("standby", standby); + } + + public int getTabIndex() + { + return getIntHTMLAttribute("tabindex"); + } + + public void setTabIndex(int tabIndex) + { + setIntHTMLAttribute("tabindex", tabIndex); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + + public String getUseMap() + { + return getHTMLAttribute("usemap"); + } + + public void setUseMap(String useMap) + { + setHTMLAttribute("usemap", useMap); + } + + public int getVspace() + { + return getIntHTMLAttribute("vspace"); + } + + public void setVspace(int vspace) + { + setIntHTMLAttribute("vspace", vspace); + } + + public String getWidth() + { + return getHTMLAttribute("width"); + } + + public void setWidth(String width) + { + setHTMLAttribute("width", width); + } + + public Document getContentDocument() + { + // TODO + return null; + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLOptGroupElement.java b/gnu/xml/dom/html2/DomHTMLOptGroupElement.java new file mode 100644 index 000000000..782deb216 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLOptGroupElement.java @@ -0,0 +1,79 @@ +/* DomHTMLOptGroupElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLOptGroupElement; + +/** + * An HTML 'OPTGROUP' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLOptGroupElement + extends DomHTMLElement + implements HTMLOptGroupElement +{ + + protected DomHTMLOptGroupElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public String getLabel() + { + return getHTMLAttribute("label"); + } + + public void setLabel(String label) + { + setHTMLAttribute("label", label); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLOptionElement.java b/gnu/xml/dom/html2/DomHTMLOptionElement.java new file mode 100644 index 000000000..b1c808fa6 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLOptionElement.java @@ -0,0 +1,132 @@ +/* DomHTMLOptionElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLOptionElement; + +/** + * An HTML 'OPTION' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLOptionElement + extends DomHTMLElement + implements HTMLOptionElement +{ + + protected Boolean selected; + + protected DomHTMLOptionElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public boolean getDefaultSelected() + { + return getBooleanHTMLAttribute("selected"); + } + + public void setDefaultSelected(boolean defaultSelected) + { + setBooleanHTMLAttribute("selected", defaultSelected); + } + + public String getText() + { + return getTextContent(); + } + + public int getIndex() + { + // TODO + return -1; + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public String getLabel() + { + return getHTMLAttribute("label"); + } + + public void setLabel(String label) + { + setHTMLAttribute("label", label); + } + + public boolean getSelected() + { + if (selected == null) + { + selected = Boolean.valueOf(getDefaultSelected()); + } + return selected.booleanValue(); + } + + public void setSelected(boolean selected) + { + this.selected = Boolean.valueOf(selected); + } + + public String getValue() + { + return getHTMLAttribute("value"); + } + + public void setValue(String value) + { + setHTMLAttribute("value", value); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLParagraphElement.java b/gnu/xml/dom/html2/DomHTMLParagraphElement.java new file mode 100644 index 000000000..573ddc9db --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLParagraphElement.java @@ -0,0 +1,69 @@ +/* DomHTMLParagraphElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLParagraphElement; + +/** + * An HTML 'P' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLParagraphElement + extends DomHTMLElement + implements HTMLParagraphElement +{ + + protected DomHTMLParagraphElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLParamElement.java b/gnu/xml/dom/html2/DomHTMLParamElement.java new file mode 100644 index 000000000..c8e565d15 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLParamElement.java @@ -0,0 +1,99 @@ +/* DomHTMLParamElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLParamElement; + +/** + * An HTML 'PARAM' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLParamElement + extends DomHTMLElement + implements HTMLParamElement +{ + + protected DomHTMLParamElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + + public String getValue() + { + return getHTMLAttribute("value"); + } + + public void setValue(String value) + { + setHTMLAttribute("value", value); + } + + public String getValueType() + { + return getHTMLAttribute("valuetype"); + } + + public void setValueType(String valueType) + { + setHTMLAttribute("valuetype", valueType); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLPreElement.java b/gnu/xml/dom/html2/DomHTMLPreElement.java new file mode 100644 index 000000000..c8f306fff --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLPreElement.java @@ -0,0 +1,69 @@ +/* DomHTMLPreElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLPreElement; + +/** + * An HTML 'PRE' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLPreElement + extends DomHTMLElement + implements HTMLPreElement +{ + + protected DomHTMLPreElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public int getWidth() + { + return getIntHTMLAttribute("width"); + } + + public void setWidth(int width) + { + setIntHTMLAttribute("width", width); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLQuoteElement.java b/gnu/xml/dom/html2/DomHTMLQuoteElement.java new file mode 100644 index 000000000..0424ebf3b --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLQuoteElement.java @@ -0,0 +1,69 @@ +/* DomHTMLQuoteElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLQuoteElement; + +/** + * An HTML 'Q' or 'BLOCKQUOTE' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLQuoteElement + extends DomHTMLElement + implements HTMLQuoteElement +{ + + protected DomHTMLQuoteElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getCite() + { + return getHTMLAttribute("cite"); + } + + public void setCite(String cite) + { + setHTMLAttribute("cite", cite); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLScriptElement.java b/gnu/xml/dom/html2/DomHTMLScriptElement.java new file mode 100644 index 000000000..2bf6a5579 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLScriptElement.java @@ -0,0 +1,129 @@ +/* DomHTMLScriptElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLScriptElement; + +/** + * An HTML 'SCRIPT' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLScriptElement + extends DomHTMLElement + implements HTMLScriptElement +{ + + protected DomHTMLScriptElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getText() + { + return getTextContent(); + } + + public void setText(String text) + { + setTextContent(text); + } + + public String getHtmlFor() + { + return getHTMLAttribute("for"); + } + + public void setHtmlFor(String htmlFor) + { + setHTMLAttribute("for", htmlFor); + } + + public String getEvent() + { + return getHTMLAttribute("event"); + } + + public void setEvent(String event) + { + setHTMLAttribute("event", event); + } + + public String getCharset() + { + return getHTMLAttribute("charset"); + } + + public void setCharset(String charset) + { + setHTMLAttribute("charset", charset); + } + + public boolean getDefer() + { + return getBooleanHTMLAttribute("defer"); + } + + public void setDefer(boolean defer) + { + setBooleanHTMLAttribute("defer", defer); + } + + public String getSrc() + { + return getHTMLAttribute("src"); + } + + public void setSrc(String src) + { + setHTMLAttribute("src", src); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLSelectElement.java b/gnu/xml/dom/html2/DomHTMLSelectElement.java new file mode 100644 index 000000000..6bc9bfc20 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLSelectElement.java @@ -0,0 +1,211 @@ +/* DomHTMLSelectElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import gnu.xml.dom.DomDOMException; +import org.w3c.dom.DOMException; +import org.w3c.dom.html2.HTMLElement; +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLOptionElement; +import org.w3c.dom.html2.HTMLOptionsCollection; +import org.w3c.dom.html2.HTMLSelectElement; + +/** + * An HTML 'SELECT' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLSelectElement + extends DomHTMLElement + implements HTMLSelectElement +{ + + protected DomHTMLSelectElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public int getSelectedIndex() + { + HTMLOptionsCollection options = getOptions(); + int len = options.getLength(); + for (int i = 0; i < len; i++) + { + HTMLOptionElement option = (HTMLOptionElement) options.item(i); + if (option.getSelected()) + { + return i; + } + } + return -1; + } + + public void setSelectedIndex(int selectedIndex) + { + HTMLOptionsCollection options = getOptions(); + int len = options.getLength(); + if (selectedIndex < 0 || selectedIndex >= len) + { + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); + } + for (int i = 0; i < len; i++) + { + HTMLOptionElement option = (HTMLOptionElement) options.item(i); + option.setSelected(i == selectedIndex); + } + } + + public String getValue() + { + return getHTMLAttribute("value"); + } + + public void setValue(String value) + { + setHTMLAttribute("value", value); + } + + public int getLength() + { + return getIntHTMLAttribute("length"); + } + + public void setLength(int length) + { + setIntHTMLAttribute("length", length); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public HTMLOptionsCollection getOptions() + { + DomHTMLCollection ret = + new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this); + ret.addNodeName("option"); + ret.evaluate(); + return ret; + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public boolean getMultiple() + { + return getBooleanHTMLAttribute("multiple"); + } + + public void setMultiple(boolean multiple) + { + setBooleanHTMLAttribute("multiple", multiple); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public int getSize() + { + return getIntHTMLAttribute("size"); + } + + public void setSize(int size) + { + setIntHTMLAttribute("size", size); + } + + public int getTabIndex() + { + return getIntHTMLAttribute("tabindex"); + } + + public void setTabIndex(int tabIndex) + { + setIntHTMLAttribute("tabindex", tabIndex); + } + + public void add(HTMLElement element, HTMLElement before) + { + insertBefore(before, element); + } + + public void remove(int index) + { + HTMLOptionsCollection options = getOptions(); + int len = options.getLength(); + if (index < 0 || index >= len) + { + throw new DomDOMException(DOMException.INDEX_SIZE_ERR); + } + HTMLOptionElement option = (HTMLOptionElement) options.item(index); + option.getParentNode().removeChild(option); + } + + public void blur() + { + // TODO + } + + public void focus() + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLStyleElement.java b/gnu/xml/dom/html2/DomHTMLStyleElement.java new file mode 100644 index 000000000..4d2de8c6b --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLStyleElement.java @@ -0,0 +1,89 @@ +/* DomHTMLStyleElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLStyleElement; + +/** + * An HTML 'STYLE' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLStyleElement + extends DomHTMLElement + implements HTMLStyleElement +{ + + protected DomHTMLStyleElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public String getMedia() + { + return getHTMLAttribute("media"); + } + + public void setMedia(String media) + { + setHTMLAttribute("media", media); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java b/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java new file mode 100644 index 000000000..a481f47fa --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTableCaptionElement.java @@ -0,0 +1,70 @@ +/* DomHTMLTableCaptionElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLTableCaptionElement; + +/** + * An HTML 'CAPTION' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTableCaptionElement + extends DomHTMLElement + implements HTMLTableCaptionElement +{ + + protected DomHTMLTableCaptionElement(DomHTMLDocument owner, + String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTableCellElement.java b/gnu/xml/dom/html2/DomHTMLTableCellElement.java new file mode 100644 index 000000000..b89c012a6 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTableCellElement.java @@ -0,0 +1,206 @@ +/* DomHTMLTableCellElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLTableCellElement; + +/** + * An HTML 'TH' or 'TD' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTableCellElement + extends DomHTMLElement + implements HTMLTableCellElement +{ + + protected DomHTMLTableCellElement(DomHTMLDocument owner, + String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public int getCellIndex() + { + // TODO + return -1; + } + + public String getAbbr() + { + return getHTMLAttribute("abbr"); + } + + public void setAbbr(String abbr) + { + setHTMLAttribute("abbr", abbr); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getAxis() + { + return getHTMLAttribute("axis"); + } + + public void setAxis(String axis) + { + setHTMLAttribute("axis", axis); + } + + public String getBgColor() + { + return getHTMLAttribute("bgcolor"); + } + + public void setBgColor(String bgColor) + { + setHTMLAttribute("bgcolor", bgColor); + } + + public String getCh() + { + return getHTMLAttribute("char"); + } + + public void setCh(String ch) + { + setHTMLAttribute("char", ch); + } + + public String getChOff() + { + return getHTMLAttribute("charoff"); + } + + public void setChOff(String chOff) + { + setHTMLAttribute("charoff", chOff); + } + + public int getColSpan() + { + return getIntHTMLAttribute("colspan"); + } + + public void setColSpan(int colSpan) + { + setIntHTMLAttribute("colspan", colSpan); + } + + public String getHeaders() + { + return getHTMLAttribute("headers"); + } + + public void setHeaders(String headers) + { + setHTMLAttribute("headers", headers); + } + + public String getHeight() + { + return getHTMLAttribute("height"); + } + + public void setHeight(String height) + { + setHTMLAttribute("height", height); + } + + public boolean getNoWrap() + { + return getBooleanHTMLAttribute("nowrap"); + } + + public void setNoWrap(boolean noWrap) + { + setBooleanHTMLAttribute("nowrap", noWrap); + } + + public int getRowSpan() + { + return getIntHTMLAttribute("rowspan"); + } + + public void setRowSpan(int rowSpan) + { + setIntHTMLAttribute("rowspan", rowSpan); + } + + public String getScope() + { + return getHTMLAttribute("scope"); + } + + public void setScope(String scope) + { + setHTMLAttribute("scope", scope); + } + + public String getVAlign() + { + return getHTMLAttribute("valign"); + } + + public void setVAlign(String vAlign) + { + setHTMLAttribute("valign", vAlign); + } + + public String getWidth() + { + return getHTMLAttribute("width"); + } + + public void setWidth(String width) + { + setHTMLAttribute("width", width); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTableColElement.java b/gnu/xml/dom/html2/DomHTMLTableColElement.java new file mode 100644 index 000000000..0ed20a07a --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTableColElement.java @@ -0,0 +1,120 @@ +/* DomHTMLTableColElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLTableColElement; + +/** + * An HTML 'COL' or 'COLGROUP' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTableColElement + extends DomHTMLElement + implements HTMLTableColElement +{ + + protected DomHTMLTableColElement(DomHTMLDocument owner, + String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getCh() + { + return getHTMLAttribute("char"); + } + + public void setCh(String ch) + { + setHTMLAttribute("char", ch); + } + + public String getChOff() + { + return getHTMLAttribute("charoff"); + } + + public void setChOff(String chOff) + { + setHTMLAttribute("charoff", chOff); + } + + public int getSpan() + { + return getIntHTMLAttribute("span"); + } + + public void setSpan(int span) + { + setIntHTMLAttribute("span", span); + } + + public String getVAlign() + { + return getHTMLAttribute("valign"); + } + + public void setVAlign(String vAlign) + { + setHTMLAttribute("valign", vAlign); + } + + public String getWidth() + { + return getHTMLAttribute("width"); + } + + public void setWidth(String width) + { + setHTMLAttribute("width", width); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTableElement.java b/gnu/xml/dom/html2/DomHTMLTableElement.java new file mode 100644 index 000000000..570b3f1e0 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTableElement.java @@ -0,0 +1,248 @@ +/* DomHTMLTableElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLCollection; +import org.w3c.dom.html2.HTMLElement; +import org.w3c.dom.html2.HTMLTableCaptionElement; +import org.w3c.dom.html2.HTMLTableElement; +import org.w3c.dom.html2.HTMLTableSectionElement; + +/** + * An HTML 'TABLE' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTableElement + extends DomHTMLElement + implements HTMLTableElement +{ + + protected DomHTMLTableElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public HTMLTableCaptionElement getCaption() + { + // TODO + return null; + } + + public void setCaption(HTMLTableCaptionElement caption) + { + // TODO + } + + public HTMLTableSectionElement getTHead() + { + // TODO + return null; + } + + public void setTHead(HTMLTableSectionElement tHead) + { + // TODO + } + + public HTMLTableSectionElement getTFoot() + { + // TODO + return null; + } + + public void setTFoot(HTMLTableSectionElement tFoot) + { + // TODO + } + + public HTMLCollection getRows() + { + DomHTMLCollection ret = + new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this); + ret.addNodeName("tr"); + ret.evaluate(); + return ret; + } + + public HTMLCollection getTBodies() + { + DomHTMLCollection ret = + new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this); + ret.addNodeName("tbody"); + ret.evaluate(); + return ret; + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getBgColor() + { + return getHTMLAttribute("bgcolor"); + } + + public void setBgColor(String bgColor) + { + setHTMLAttribute("bgcolor", bgColor); + } + + public String getBorder() + { + return getHTMLAttribute("border"); + } + + public void setBorder(String border) + { + setHTMLAttribute("border", border); + } + + public String getCellPadding() + { + return getHTMLAttribute("cellpadding"); + } + + public void setCellPadding(String cellPadding) + { + setHTMLAttribute("cellpadding", cellPadding); + } + + public String getCellSpacing() + { + return getHTMLAttribute("cellspacing"); + } + + public void setCellSpacing(String cellSpacing) + { + setHTMLAttribute("cellspacing", cellSpacing); + } + + public String getFrame() + { + return getHTMLAttribute("frame"); + } + + public void setFrame(String frame) + { + setHTMLAttribute("frame", frame); + } + + public String getRules() + { + return getHTMLAttribute("rules"); + } + + public void setRules(String rules) + { + setHTMLAttribute("rules", rules); + } + + public String getSummary() + { + return getHTMLAttribute("summary"); + } + + public void setSummary(String summary) + { + setHTMLAttribute("summary", summary); + } + + public String getWidth() + { + return getHTMLAttribute("width"); + } + + public void setWidth(String width) + { + setHTMLAttribute("width", width); + } + + public HTMLElement createTHead() + { + // TODO + return null; + } + + public void deleteTHead() + { + // TODO + } + + public HTMLElement createTFoot() + { + // TODO + return null; + } + + public void deleteTFoot() + { + // TODO + } + + public HTMLElement createCaption() + { + // TODO + return null; + } + + public void deleteCaption() + { + // TODO + } + + public HTMLElement insertRow(int index) + { + // TODO + return null; + } + + public void deleteRow(int index) + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTableRowElement.java b/gnu/xml/dom/html2/DomHTMLTableRowElement.java new file mode 100644 index 000000000..6b40b34e6 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTableRowElement.java @@ -0,0 +1,145 @@ +/* DomHTMLTableRowElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLCollection; +import org.w3c.dom.html2.HTMLElement; +import org.w3c.dom.html2.HTMLTableRowElement; + +/** + * An HTML 'TR' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTableRowElement + extends DomHTMLElement + implements HTMLTableRowElement +{ + + protected DomHTMLTableRowElement(DomHTMLDocument owner, + String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public int getRowIndex() + { + // TODO + return -1; + } + + public int getSectionRowIndex() + { + // TODO + return -1; + } + + public HTMLCollection getCells() + { + DomHTMLCollection ret = + new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this); + ret.addNodeName("th"); + ret.addNodeName("td"); + ret.evaluate(); + return ret; + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getBgColor() + { + return getHTMLAttribute("bgcolor"); + } + + public void setBgColor(String bgColor) + { + setHTMLAttribute("bgcolor", bgColor); + } + + public String getCh() + { + return getHTMLAttribute("char"); + } + + public void setCh(String ch) + { + setHTMLAttribute("char", ch); + } + + public String getChOff() + { + return getHTMLAttribute("charoff"); + } + + public void setChOff(String chOff) + { + setHTMLAttribute("charoff", chOff); + } + + public String getVAlign() + { + return getHTMLAttribute("valign"); + } + + public void setVAlign(String vAlign) + { + setHTMLAttribute("valign", vAlign); + } + + public HTMLElement insertCell(int index) + { + // TODO + return null; + } + + public void deleteCell(int index) + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTableSectionElement.java b/gnu/xml/dom/html2/DomHTMLTableSectionElement.java new file mode 100644 index 000000000..c2247dfb7 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTableSectionElement.java @@ -0,0 +1,122 @@ +/* DomHTMLTableSectionElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLCollection; +import org.w3c.dom.html2.HTMLElement; +import org.w3c.dom.html2.HTMLTableSectionElement; + +/** + * An HTML 'THEAD', 'TFOOT', or 'TBODY' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTableSectionElement + extends DomHTMLElement + implements HTMLTableSectionElement +{ + + protected DomHTMLTableSectionElement(DomHTMLDocument owner, + String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getAlign() + { + return getHTMLAttribute("align"); + } + + public void setAlign(String align) + { + setHTMLAttribute("align", align); + } + + public String getCh() + { + return getHTMLAttribute("char"); + } + + public void setCh(String ch) + { + setHTMLAttribute("char", ch); + } + + public String getChOff() + { + return getHTMLAttribute("charoff"); + } + + public void setChOff(String chOff) + { + setHTMLAttribute("charoff", chOff); + } + + public String getVAlign() + { + return getHTMLAttribute("valign"); + } + + public void setVAlign(String vAlign) + { + setHTMLAttribute("valign", vAlign); + } + + public HTMLCollection getRows() + { + DomHTMLCollection ret = + new DomHTMLCollection((DomHTMLDocument) getOwnerDocument(), this); + ret.addNodeName("tr"); + ret.evaluate(); + return ret; + } + + public HTMLElement insertRow(int index) + { + // TODO + return null; + } + + public void deleteRow(int index) + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTextAreaElement.java b/gnu/xml/dom/html2/DomHTMLTextAreaElement.java new file mode 100644 index 000000000..9ef9b185c --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTextAreaElement.java @@ -0,0 +1,182 @@ +/* DomHTMLTextAreaElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLFormElement; +import org.w3c.dom.html2.HTMLTextAreaElement; + +/** + * An HTML 'TEXTAREA' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTextAreaElement + extends DomHTMLElement + implements HTMLTextAreaElement +{ + + protected String value; + + protected DomHTMLTextAreaElement(DomHTMLDocument owner, + String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getDefaultValue() + { + return getHTMLAttribute("value"); + } + + public void setDefaultValue(String defaultValue) + { + setHTMLAttribute("value", defaultValue); + } + + public HTMLFormElement getForm() + { + return (HTMLFormElement) getParentElement("form"); + } + + public String getAccessKey() + { + return getHTMLAttribute("accesskey"); + } + + public void setAccessKey(String accessKey) + { + setHTMLAttribute("accesskey", accessKey); + } + + public int getCols() + { + return getIntHTMLAttribute("cols"); + } + + public void setCols(int cols) + { + setIntHTMLAttribute("cols", cols); + } + + public boolean getDisabled() + { + return getBooleanHTMLAttribute("disabled"); + } + + public void setDisabled(boolean disabled) + { + setBooleanHTMLAttribute("disabled", disabled); + } + + public String getName() + { + return getHTMLAttribute("name"); + } + + public void setName(String name) + { + setHTMLAttribute("name", name); + } + + public boolean getReadOnly() + { + return getBooleanHTMLAttribute("readOnly"); + } + + public void setReadOnly(boolean readOnly) + { + setBooleanHTMLAttribute("readonly", readOnly); + } + + public int getRows() + { + return getIntHTMLAttribute("rows"); + } + + public void setRows(int rows) + { + setIntHTMLAttribute("rows", rows); + } + + public int getTabIndex() + { + return getIntHTMLAttribute("tabindex"); + } + + public void setTabIndex(int tabIndex) + { + setIntHTMLAttribute("tabindex", tabIndex); + } + + public String getType() + { + return "textarea"; + } + + public String getValue() + { + if (value == null) + { + value = getDefaultValue(); + } + return value; + } + + public void setValue(String value) + { + this.value = value; + } + + public void blur() + { + // TODO + } + + public void focus() + { + // TODO + } + + public void select() + { + // TODO + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLTitleElement.java b/gnu/xml/dom/html2/DomHTMLTitleElement.java new file mode 100644 index 000000000..1c1105528 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLTitleElement.java @@ -0,0 +1,69 @@ +/* DomHTMLTitleElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLTitleElement; + +/** + * An HTML 'TITLE' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLTitleElement + extends DomHTMLElement + implements HTMLTitleElement +{ + + protected DomHTMLTitleElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public String getText() + { + return getTextContent(); + } + + public void setText(String text) + { + setTextContent(text); + } + +} + diff --git a/gnu/xml/dom/html2/DomHTMLUListElement.java b/gnu/xml/dom/html2/DomHTMLUListElement.java new file mode 100644 index 000000000..9f6b69249 --- /dev/null +++ b/gnu/xml/dom/html2/DomHTMLUListElement.java @@ -0,0 +1,79 @@ +/* DomHTMLUListElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package gnu.xml.dom.html2; + +import org.w3c.dom.html2.HTMLUListElement; + +/** + * An HTML 'UL' element node. + * + * @author <a href='mailto:dog@gnu.org'>Chris Burdess</a> + */ +public class DomHTMLUListElement + extends DomHTMLElement + implements HTMLUListElement +{ + + protected DomHTMLUListElement(DomHTMLDocument owner, String namespaceURI, + String name) + { + super(owner, namespaceURI, name); + } + + public boolean getCompact() + { + return getBooleanHTMLAttribute("compact"); + } + + public void setCompact(boolean compact) + { + setBooleanHTMLAttribute("compact", compact); + } + + public String getType() + { + return getHTMLAttribute("type"); + } + + public void setType(String type) + { + setHTMLAttribute("type", type); + } + +} + diff --git a/gnu/xml/dom/ls/SAXEventSink.java b/gnu/xml/dom/ls/SAXEventSink.java index 24f6cccf5..60b99d493 100644 --- a/gnu/xml/dom/ls/SAXEventSink.java +++ b/gnu/xml/dom/ls/SAXEventSink.java @@ -486,6 +486,13 @@ class SAXEventSink { return; } + // Ignore fake element declarations generated by ValidationConsumer. + // If an element is not really declared in the DTD it will not be + // declared in the document model. + if (!(ctx instanceof DomDoctype)) + { + return; + } DomDoctype doctype = (DomDoctype) ctx; doctype.elementDecl(name, model); } diff --git a/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h b/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h index 28b942b1d..d228bc8bb 100644 --- a/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h +++ b/include/gnu_java_awt_peer_gtk_GtkWindowPeer.h @@ -13,7 +13,7 @@ extern "C" JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetTitle (JNIEnv *env, jobject, jstring); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetResizable (JNIEnv *env, jobject, jboolean); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_gtkWindowSetModal (JNIEnv *env, jobject, jboolean); -JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create (JNIEnv *env, jobject, jint, jboolean, jint, jint, jobject, jintArray); +JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create (JNIEnv *env, jobject, jint, jboolean, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toBack (JNIEnv *env, jobject); JNIEXPORT void JNICALL Java_gnu_java_awt_peer_gtk_GtkWindowPeer_toFront (JNIEnv *env, jobject); diff --git a/include/gnu_java_nio_channels_FileChannelImpl.h b/include/gnu_java_nio_channels_FileChannelImpl.h index 2795e945f..514c1b38b 100644 --- a/include/gnu_java_nio_channels_FileChannelImpl.h +++ b/include/gnu_java_nio_channels_FileChannelImpl.h @@ -25,6 +25,18 @@ JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_write___3BII ( JNIEXPORT void JNICALL Java_gnu_java_nio_channels_FileChannelImpl_write__I (JNIEnv *env, jobject, jint); JNIEXPORT jobject JNICALL Java_gnu_java_nio_channels_FileChannelImpl_mapImpl (JNIEnv *env, jobject, jchar, jlong, jint); JNIEXPORT jboolean JNICALL Java_gnu_java_nio_channels_FileChannelImpl_lock (JNIEnv *env, jobject, jlong, jlong, jboolean, jboolean); +#undef gnu_java_nio_channels_FileChannelImpl_READ +#define gnu_java_nio_channels_FileChannelImpl_READ 1L +#undef gnu_java_nio_channels_FileChannelImpl_WRITE +#define gnu_java_nio_channels_FileChannelImpl_WRITE 2L +#undef gnu_java_nio_channels_FileChannelImpl_APPEND +#define gnu_java_nio_channels_FileChannelImpl_APPEND 4L +#undef gnu_java_nio_channels_FileChannelImpl_EXCL +#define gnu_java_nio_channels_FileChannelImpl_EXCL 8L +#undef gnu_java_nio_channels_FileChannelImpl_SYNC +#define gnu_java_nio_channels_FileChannelImpl_SYNC 16L +#undef gnu_java_nio_channels_FileChannelImpl_DSYNC +#define gnu_java_nio_channels_FileChannelImpl_DSYNC 32L #ifdef __cplusplus } diff --git a/java/awt/AWTEvent.java b/java/awt/AWTEvent.java index faa6dac25..872feda58 100644 --- a/java/awt/AWTEvent.java +++ b/java/awt/AWTEvent.java @@ -1,5 +1,5 @@ /* AWTEvent.java -- the root event in AWT - Copyright (C) 1999, 2000, 2002 Free Software Foundation + Copyright (C) 1999, 2000, 2002, 2005 Free Software Foundation This file is part of GNU Classpath. @@ -246,6 +246,9 @@ public abstract class AWTEvent extends EventObject else if (source instanceof MenuComponent) string = getClass ().getName () + "[" + paramString () + "] on " + ((MenuComponent) source).getName (); + else + string = getClass ().getName () + "[" + paramString () + "] on " + + source; return string; } diff --git a/java/awt/Button.java b/java/awt/Button.java index 1d1a30aa8..eb0fe3b7a 100644 --- a/java/awt/Button.java +++ b/java/awt/Button.java @@ -96,7 +96,10 @@ private transient ActionListener action_listeners; protected class AccessibleAWTButton extends AccessibleAWTComponent implements AccessibleAction, AccessibleValue { - protected AccessibleAWTButton() { } + protected AccessibleAWTButton() + { + // Do nothing here. + } /* (non-Javadoc) * @see javax.accessibility.AccessibleAction#getAccessibleActionCount() diff --git a/java/awt/Checkbox.java b/java/awt/Checkbox.java index b3fc4c24d..2a8b62afd 100644 --- a/java/awt/Checkbox.java +++ b/java/awt/Checkbox.java @@ -1,5 +1,5 @@ /* Checkbox.java -- An AWT checkbox widget - Copyright (C) 1999, 2000, 2001, 2002 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -95,6 +95,11 @@ private boolean state; // The list of listeners for this object. private transient ItemListener item_listeners; + /* + * The number used to generate the name returned by getName. + */ + private static transient long next_checkbox_number; + /** * This class provides accessibility support for the * checkbox. @@ -106,7 +111,6 @@ protected class AccessibleAWTCheckbox extends AccessibleAWTComponent implements ItemListener, AccessibleAction, AccessibleValue { - /** * Serialization constant to match JDK 1.5 */ @@ -627,4 +631,18 @@ public AccessibleContext getAccessibleContext() return accessibleContext; } -} // class Checkbox + /** + * Generate a unique name for this checkbox. + * + * @return A unique name for this checkbox. + */ + String generateName() + { + return "checkbox" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_checkbox_number++; + } +} diff --git a/java/awt/Component.java b/java/awt/Component.java index e275109b9..b40fc9a96 100644 --- a/java/awt/Component.java +++ b/java/awt/Component.java @@ -4442,7 +4442,9 @@ p * <li>the set of backward traversal keys { if (o == null) throw new NullPointerException(); + ComponentOrientation oldOrientation = orientation; orientation = o; + firePropertyChange("componentOrientation", oldOrientation, o); } /** diff --git a/java/awt/Container.java b/java/awt/Container.java index 575d2764c..c682bffad 100644 --- a/java/awt/Container.java +++ b/java/awt/Container.java @@ -1690,26 +1690,42 @@ public class Container extends Component static class GfxPaintVisitor extends GfxVisitor { - public void visit(Component c, Graphics gfx) { c.paint(gfx); } public static final GfxVisitor INSTANCE = new GfxPaintVisitor(); + + public void visit(Component c, Graphics gfx) + { + c.paint(gfx); + } } static class GfxPrintVisitor extends GfxVisitor { - public void visit(Component c, Graphics gfx) { c.print(gfx); } public static final GfxVisitor INSTANCE = new GfxPrintVisitor(); + + public void visit(Component c, Graphics gfx) + { + c.print(gfx); + } } static class GfxPaintAllVisitor extends GfxVisitor { - public void visit(Component c, Graphics gfx) { c.paintAll(gfx); } public static final GfxVisitor INSTANCE = new GfxPaintAllVisitor(); + + public void visit(Component c, Graphics gfx) + { + c.paintAll(gfx); + } } static class GfxPrintAllVisitor extends GfxVisitor { - public void visit(Component c, Graphics gfx) { c.printAll(gfx); } public static final GfxVisitor INSTANCE = new GfxPrintAllVisitor(); + + public void visit(Component c, Graphics gfx) + { + c.printAll(gfx); + } } /** diff --git a/java/awt/Font.java b/java/awt/Font.java index 4b2ad5a4f..ec74e14eb 100644 --- a/java/awt/Font.java +++ b/java/awt/Font.java @@ -1,5 +1,5 @@ /* Font.java -- Font object - Copyright (C) 1999, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -209,14 +209,21 @@ private static final long serialVersionUID = -4206021311591459213L; * The style should be one of BOLD, ITALIC, or BOLDITALIC. The default * style if none is specified is PLAIN. The default size if none * is specified is 12. + * + * @param fontspec a string specifying the required font (<code>null</code> + * permitted, interpreted as 'Dialog-PLAIN-12'). + * + * @return A font. */ public static Font decode (String fontspec) { + if (fontspec == null) + fontspec = "Dialog-PLAIN-12"; String name = null; int style = PLAIN; int size = 12; - StringTokenizer st = new StringTokenizer(fontspec, "-"); + StringTokenizer st = new StringTokenizer(fontspec, "- "); while (st.hasMoreTokens()) { String token = st.nextToken(); @@ -247,7 +254,10 @@ private static final long serialVersionUID = -4206021311591459213L; { tokenval = Integer.parseInt(token); } - catch(NumberFormatException e) { ; } + catch(NumberFormatException e) + { + // Ignored. + } if (tokenval != 0) size = tokenval; diff --git a/java/awt/Frame.java b/java/awt/Frame.java index 465a26814..d180984ab 100644 --- a/java/awt/Frame.java +++ b/java/awt/Frame.java @@ -1,5 +1,5 @@ /* Frame.java -- AWT toplevel window - Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -403,10 +403,15 @@ remove(MenuComponent menu) /** * Notifies this frame that it should create its native peer. */ - private static void fireDummyEvent() { - EventQueue.invokeLater(new Runnable() { public void run() { } }); + EventQueue.invokeLater(new Runnable() + { + public void run() + { + // Do nothing here. + } + }); } public void diff --git a/java/awt/Robot.java b/java/awt/Robot.java index 49726c8a1..23b6f8104 100644 --- a/java/awt/Robot.java +++ b/java/awt/Robot.java @@ -40,6 +40,7 @@ package java.awt; import gnu.java.awt.ClasspathToolkit; +import java.lang.reflect.InvocationTargetException; import java.awt.event.InputEvent; import java.awt.image.BufferedImage; import java.awt.peer.RobotPeer; @@ -53,8 +54,8 @@ import java.awt.peer.RobotPeer; * * Since Robot generates native windowing system events, rather than * simply inserting {@link AWTEvents} on the AWT event queue, its use - * is not restricted to Java programs. It can be to programatically - * drive any graphical application. + * is not restricted to Java programs. It can be used to + * programatically drive any graphical application. * * This implementation requires an X server that supports the XTest * extension. @@ -384,7 +385,8 @@ public class Robot } /** - * Wait until the event dispatch thread is idle. + * Wait until all events currently on the event queue have been + * dispatched. */ public void waitForIdle () { @@ -393,17 +395,17 @@ public class Robot + "the event dispatch thread"); EventQueue q = Toolkit.getDefaultToolkit ().getSystemEventQueue (); - - while (q.peekEvent () != null) + try + { + q.invokeAndWait (new Runnable () { public void run () { } }); + } + catch (InterruptedException e) + { + System.err.println ("Robot: waitForIdle interrupted"); + } + catch (InvocationTargetException e) { - try - { - wait (); - } - catch (InterruptedException e) - { - System.err.println ("Robot: waitForIdle interrupted"); - } + System.err.println ("Robot: waitForIdle cannot invoke target"); } } diff --git a/java/awt/Window.java b/java/awt/Window.java index cdcd1a4bf..0a39d20b1 100644 --- a/java/awt/Window.java +++ b/java/awt/Window.java @@ -92,6 +92,11 @@ public class Window extends Container implements Accessible private transient Component windowFocusOwner; + /* + * The number used to generate the name returned by getName. + */ + private static transient long next_window_number; + protected class AccessibleAWTWindow extends AccessibleAWTContainer { public AccessibleRole getAccessibleRole() @@ -945,4 +950,19 @@ public class Window extends Container implements Accessible getToolkit().getSystemEventQueue().postEvent(ce); } } + + /** + * Generate a unique name for this window. + * + * @return A unique name for this window. + */ + String generateName() + { + return "win" + getUniqueLong(); + } + + private static synchronized long getUniqueLong() + { + return next_window_number++; + } } diff --git a/java/awt/font/TextAttribute.java b/java/awt/font/TextAttribute.java index 7d5444677..e63d2955e 100644 --- a/java/awt/font/TextAttribute.java +++ b/java/awt/font/TextAttribute.java @@ -1,5 +1,5 @@ /* TextAttribute.java -- - Copyright (C) 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -41,83 +41,269 @@ package java.awt.font; import java.io.InvalidObjectException; import java.text.AttributedCharacterIterator; +/** + * Attributes (and associated values) that can be used to define an + * {@link java.text.AttributedString}. + */ public final class TextAttribute extends AttributedCharacterIterator.Attribute { private static final long serialVersionUID = 7744112784117861702L; + /** A key for the background paint attribute. */ public static final TextAttribute BACKGROUND = - new TextAttribute ("BACKGROUND"); + new TextAttribute("background"); + + /** A key for the BIDI_EMBEDDING attribute. */ public static final TextAttribute BIDI_EMBEDDING = - new TextAttribute ("BIDI_EMBEDDING"); + new TextAttribute("bidi_embedding"); + + /** A key for the CHAR_REPLACEMENT attribute. */ public static final TextAttribute CHAR_REPLACEMENT = - new TextAttribute ("CHAR_REPLACEMENT"); - public static final TextAttribute FAMILY = new TextAttribute ("FAMILY"); - public static final TextAttribute FONT = new TextAttribute ("FONT"); - public static final TextAttribute FOREGROUND = - new TextAttribute ("FOREGROUND"); + new TextAttribute("char_replacement"); + + /** A key for the FAMILY attribute. */ + public static final TextAttribute FAMILY = new TextAttribute("family"); + + /** A key for the font attribute. */ + public static final TextAttribute FONT = new TextAttribute("font"); + + /** A key for the foreground paint attribute. */ + public static final TextAttribute FOREGROUND = + new TextAttribute("foreground"); + + /** A key for the INPUT_METHOD_HIGHLIGHT attribute. */ public static final TextAttribute INPUT_METHOD_HIGHLIGHT = - new TextAttribute ("INPUT_METHOD_HIGHLIGHT"); + new TextAttribute("input method highlight"); + + /** A key for the INPUT_METHOD_UNDERLINE attribute. */ public static final TextAttribute INPUT_METHOD_UNDERLINE = - new TextAttribute ("INPUT_METHOD_UNDERLINE"); + new TextAttribute("input method underline"); + + /** A key for the text justification attribute. */ public static final TextAttribute JUSTIFICATION = - new TextAttribute ("JUSTIFICATION"); - public static final Float JUSTIFICATION_FULL = new Float (1.0); - public static final Float JUSTIFICATION_NONE = new Float (0.0); + new TextAttribute("justification"); + + /** + * A value that can be used with the {@link #JUSTIFICATION} attribute to + * indicate full justification of the text. + */ + public static final Float JUSTIFICATION_FULL = new Float(1.0); + + /** + * A value that can be used with the {@link #JUSTIFICATION} attribute to + * indicate no justification of the text. + */ + public static final Float JUSTIFICATION_NONE = new Float(0.0); + + /** A key for the NUMERIC_SHAPING attribute. */ public static final TextAttribute NUMERIC_SHAPING = - new TextAttribute ("NUMERIC_SHAPING"); - public static final TextAttribute POSTURE = new TextAttribute ("POSTURE"); - public static final Float POSTURE_OBLIQUE = new Float (0.2); - public static final Float POSTURE_REGULAR = new Float (0.0); + new TextAttribute("numeric_shaping"); + + /** A key for the POSTURE attribute. */ + public static final TextAttribute POSTURE = new TextAttribute("posture"); + + /** A value that can be used with the {@link #POSTURE} attribute. */ + public static final Float POSTURE_OBLIQUE = new Float(0.2); + + /** A value that can be used with the {@link #POSTURE} attribute. */ + public static final Float POSTURE_REGULAR = new Float(0.0); + + /** A key for the RUN_DIRECTION attribute. */ public static final TextAttribute RUN_DIRECTION = - new TextAttribute ("RUN_DIRECTION"); - public static final Boolean RUN_DIRECTION_LTR = Boolean.TRUE; - public static final Boolean RUN_DIRECTION_RTL = Boolean.FALSE; - public static final TextAttribute SIZE = new TextAttribute ("SIZE"); + new TextAttribute("run_direction"); + + /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */ + public static final Boolean RUN_DIRECTION_LTR = Boolean.FALSE; + + /** A value that can be used with the {@link #RUN_DIRECTION} attribute. */ + public static final Boolean RUN_DIRECTION_RTL = Boolean.TRUE; + + /** A key for the text size attribute. */ + public static final TextAttribute SIZE = new TextAttribute("size"); + + /** A key for the STRIKETHROUGH attribute. */ public static final TextAttribute STRIKETHROUGH = - new TextAttribute ("STRIKETHROUGH"); + new TextAttribute("strikethrough"); + + /** A value that can be used with the {@link #STRIKETHROUGH} attribute. */ public static final Boolean STRIKETHROUGH_ON = Boolean.TRUE; + + /** A key for the SUPERSCRIPT attribute. */ public static final TextAttribute SUPERSCRIPT = - new TextAttribute ("SUPERSCRIPT"); - public static final Integer SUPERSCRIPT_SUB = new Integer (-1); - public static final Integer SUPERSCRIPT_SUPER = new Integer (1); + new TextAttribute("superscript"); + + /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */ + public static final Integer SUPERSCRIPT_SUB = new Integer(-1); + + /** A value that can be used with the {@link #SUPERSCRIPT} attribute. */ + public static final Integer SUPERSCRIPT_SUPER = new Integer(1); + + /** A key for the SWAP_COLORS attribute. */ public static final TextAttribute SWAP_COLORS = - new TextAttribute ("SWAP_COLORS"); + new TextAttribute("swap_colors"); + + /** A value that can be used with the {@link #SWAP_COLORS} attribute. */ public static final Boolean SWAP_COLORS_ON = Boolean.TRUE; - public static final TextAttribute TRANSFORM = new TextAttribute ("TRANSFORM"); - public static final TextAttribute UNDERLINE = new TextAttribute ("UNDERLINE"); - public static final Integer UNDERLINE_LOW_DASHED = new Integer (0); - public static final Integer UNDERLINE_LOW_DOTTED = new Integer (0); - public static final Integer UNDERLINE_LOW_GRAY = new Integer (0); - public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer (0); - public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer (0); - public static final Integer UNDERLINE_ON = new Integer (0); - public static final TextAttribute WEIGHT = new TextAttribute ("WEIGHT"); - public static final Float WEIGHT_BOLD = new Float (2.0); - public static final Float WEIGHT_DEMIBOLD = new Float (1.75); - public static final Float WEIGHT_DEMILIGHT = new Float (0.875); - public static final Float WEIGHT_EXTRA_LIGHT = new Float (0.5); - public static final Float WEIGHT_EXTRABOLD = new Float (2.5); - public static final Float WEIGHT_HEAVY = new Float (2.25); - public static final Float WEIGHT_LIGHT = new Float (0.75); - public static final Float WEIGHT_MEDIUM = new Float (1.5); - public static final Float WEIGHT_REGULAR = new Float (1.0); - public static final Float WEIGHT_SEMIBOLD = new Float (1.25); - public static final Float WEIGHT_ULTRABOLD = new Float (2.75); - public static final TextAttribute WIDTH = new TextAttribute (""); - public static final Float WIDTH_CONDENSED = new Float (0.75); - public static final Float WIDTH_EXTENDED = new Float (1.5); - public static final Float WIDTH_REGULAR = new Float (1.0); - public static final Float WIDTH_SEMI_CONDENSED = new Float (0.875); - public static final Float WIDTH_SEMI_EXTENDED = new Float (1.25); - - protected TextAttribute (String name) + + /** A key for the TRANFORM attribute. */ + public static final TextAttribute TRANSFORM = new TextAttribute("transform"); + + /** A key for the UNDERLINE attribute. */ + public static final TextAttribute UNDERLINE = new TextAttribute("underline"); + + /** A value that can be used with the {@link #UNDERLINE} attribute. */ + public static final Integer UNDERLINE_LOW_DASHED = new Integer(5); + + /** A value that can be used with the {@link #UNDERLINE} attribute. */ + public static final Integer UNDERLINE_LOW_DOTTED = new Integer(3); + + /** A value that can be used with the {@link #UNDERLINE} attribute. */ + public static final Integer UNDERLINE_LOW_GRAY = new Integer(4); + + /** A value that can be used with the {@link #UNDERLINE} attribute. */ + public static final Integer UNDERLINE_LOW_ONE_PIXEL = new Integer(1); + + /** A value that can be used with the {@link #UNDERLINE} attribute. */ + public static final Integer UNDERLINE_LOW_TWO_PIXEL = new Integer(2); + + /** A value that can be used with the {@link #UNDERLINE} attribute. */ + public static final Integer UNDERLINE_ON = new Integer(0); + + /** A key for the WEIGHT attribute. */ + public static final TextAttribute WEIGHT = new TextAttribute("weight"); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_BOLD = new Float(2.0); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_DEMIBOLD = new Float(1.75); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_DEMILIGHT = new Float(0.875); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_EXTRA_LIGHT = new Float(0.5); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_EXTRABOLD = new Float(2.5); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_HEAVY = new Float(2.25); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_LIGHT = new Float(0.75); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_MEDIUM = new Float(1.5); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_REGULAR = new Float(1.0); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_SEMIBOLD = new Float(1.25); + + /** A value that can be used with the {@link #WEIGHT} attribute. */ + public static final Float WEIGHT_ULTRABOLD = new Float(2.75); + + /** A key for the WIDTH attribute. */ + public static final TextAttribute WIDTH = new TextAttribute("width"); + + /** A value that can be used with the {@link #WIDTH} attribute. */ + public static final Float WIDTH_CONDENSED = new Float(0.75); + + /** A value that can be used with the {@link #WIDTH} attribute. */ + public static final Float WIDTH_EXTENDED = new Float(1.5); + + /** A value that can be used with the {@link #WIDTH} attribute. */ + public static final Float WIDTH_REGULAR = new Float(1.0); + + /** A value that can be used with the {@link #WIDTH} attribute. */ + public static final Float WIDTH_SEMI_CONDENSED = new Float(0.875); + + /** A value that can be used with the {@link #WIDTH} attribute. */ + public static final Float WIDTH_SEMI_EXTENDED = new Float(1.25); + + /** + * Creates a new attribute. + * + * @param name the name. + */ + protected TextAttribute(String name) { - super (name); + super(name); } - protected Object readResolve () + /** + * After deserialization, this method ensures that only one instance of + * each attribute is used. + * + * @return The (single) attribute instance. + * + * @throws InvalidObjectException if the attribute is not recognised. + */ + protected Object readResolve() throws InvalidObjectException { - throw new Error ("not implemented"); + if (this.getName().equals("background")) + return BACKGROUND; + + if (this.getName().equals("bidi_embedding")) + return BIDI_EMBEDDING; + + if (this.getName().equals("char_replacement")) + return CHAR_REPLACEMENT; + + if (this.getName().equals("family")) + return FAMILY; + + if (this.getName().equals("font")) + return FONT; + + if (this.getName().equals("foreground")) + return FOREGROUND; + + if (this.getName().equals("input method highlight")) + return INPUT_METHOD_HIGHLIGHT; + + if (this.getName().equals("input method underline")) + return INPUT_METHOD_UNDERLINE; + + if (this.getName().equals("justification")) + return JUSTIFICATION; + + if (this.getName().equals("numeric_shaping")) + return NUMERIC_SHAPING; + + if (this.getName().equals("posture")) + return POSTURE; + + if (this.getName().equals("run_direction")) + return RUN_DIRECTION; + + if (this.getName().equals("size")) + return SIZE; + + if (this.getName().equals("strikethrough")) + return STRIKETHROUGH; + + if (this.getName().equals("superscript")) + return SUPERSCRIPT; + + if (this.getName().equals("swap_colors")) + return SWAP_COLORS; + + if (this.getName().equals("transform")) + return TRANSFORM; + + if (this.getName().equals("underline")) + return UNDERLINE; + + if (this.getName().equals("weight")) + return WEIGHT; + + if (this.getName().equals("width")) + return WIDTH; + + throw new InvalidObjectException("Can't resolve Attribute: " + getName()); } } diff --git a/java/beans/EventHandler.java b/java/beans/EventHandler.java index 98c7ae4ee..b1e4da794 100644 --- a/java/beans/EventHandler.java +++ b/java/beans/EventHandler.java @@ -1,5 +1,5 @@ /* java.beans.EventHandler - Copyright (C) 2004 Free Software Foundation, Inc. + Copyright (C) 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -44,26 +44,18 @@ import java.lang.reflect.Method; import java.lang.reflect.Proxy; /** - * class EventHandler - * - * EventHandler forms a bridge between dynamically created listeners and - * arbitrary properties and methods. The idea is that a Proxy that implements - * a listener class calls the EventHandler when a listener method is called. - * The Proxy calls invoke(), which dispatches the event to a method, called - * the action, in another object, called the target. - * - * The event passed to the listener method is used to access a prespecified - * property, which in turn is passed to the action method. + * <p>EventHandler forms a bridge between dynamically created listeners and + * arbitrary properties and methods.</p> * - * Normally, call EventHandler.create(), which constructs an EventHandler and - * a Proxy for the listener interface. When the listenerMethod gets called on - * the proxy, it in turn calls invoke on the attached EventHandler. The - * invoke call extracts the bean property from the event object and passes it - * to the action method of target object. - * - * TODO: Add examples of using this thing. + * <p>You can use this class to easily create listener implementations for + * some basic interactions between an event source and its target. Using + * the three static methods named <code>create</code> you can create + * these listener implementations.</p> * + * <p>See the documentation of each method for usage examples.</p> + * * @author Jerry Quinn (jlquinn@optonline.net) + * @author Robert Schuster (thebohemian@gmx.net) * @since 1.4 */ public class EventHandler implements InvocationHandler @@ -80,6 +72,9 @@ public class EventHandler implements InvocationHandler // The property to extract from an event passed to listenerMethod. private String property; + // The target objects Class. + private Class targetClass; + // String class doesn't already have a capitalize routine. private String capitalize(String s) { @@ -89,14 +84,15 @@ public class EventHandler implements InvocationHandler /** * Creates a new <code>EventHandler</code> instance. * - * Typical creation is done with the create method, not by newing an - * EventHandler. + * <p>Typical creation is done with the create method, not by knewing an + * EventHandler.</p> * - * This constructs an EventHandler that will connect the method + * <p>This constructs an EventHandler that will connect the method * listenerMethodName to target.action, extracting eventPropertyName from - * the first argument of listenerMethodName. and sending it to action. - * - * + * the first argument of listenerMethodName. and sending it to action.</p> + * + * <p>Throws a <code>NullPointerException</code> if the <code>target</code> + * argument is <code>null</code>. * * @param target Object that will perform the action. * @param action A property or method of the target. @@ -107,14 +103,20 @@ public class EventHandler implements InvocationHandler String listenerMethodName) { this.target = target; + + // Retrieving the class is done for two reasons: + // 1) The class object is needed very frequently in the invoke() method. + // 2) The constructor should throw a NullPointerException if target is null. + targetClass = target.getClass(); + this.action = action; // Turn this into a method or do we wait till - // runtime + // runtime property = eventPropertyName; listenerMethod = listenerMethodName; } /** - * Return the event property name. + * Returns the event property name. */ public String getEventPropertyName() { @@ -122,7 +124,7 @@ public class EventHandler implements InvocationHandler } /** - * Return the listener's method name. + * Returns the listener's method name. */ public String getListenerMethodName() { @@ -130,7 +132,7 @@ public class EventHandler implements InvocationHandler } /** - * Return the target object. + * Returns the target object. */ public Object getTarget() { @@ -138,7 +140,7 @@ public class EventHandler implements InvocationHandler } /** - * Return the action method name. + * Returns the action method name. */ public String getAction() { @@ -156,12 +158,7 @@ public class EventHandler implements InvocationHandler // value will be a wrapper. If we then take the type of the wrapper and use // it to locate the action method that takes the native type, it won't match. private Object[] getProperty(Object o, String prop) - throws NoSuchMethodException, IllegalAccessException, InvocationTargetException { - // Use the event object when the property name to extract is null. - if (prop == null) - return new Object[] {o, o.getClass()}; - // Isolate the first property name from a.b.c. int pos; String rest = null; @@ -179,121 +176,287 @@ public class EventHandler implements InvocationHandler getter = o.getClass().getMethod("is" + capitalize(prop), null); } - catch (NoSuchMethodException e) + catch (NoSuchMethodException nsme1) { - // Look for regular property getter getProperty - getter = o.getClass().getMethod("get" + capitalize(prop), + try { + // Look for regular property getter getProperty + getter = o.getClass().getMethod("get" + capitalize(prop), null); + } catch(NoSuchMethodException nsme2) { + try { + // Finally look for a method of the name prop + getter = o.getClass().getMethod(prop, null); + } catch(NoSuchMethodException nsme3) { + // Ok, give up with an intelligent hint for the user. + throw new RuntimeException("Method not called: Could not find a property or method '" + prop + + "' in " + o.getClass() + " while following the property argument '" + property + "'."); + } + } } - Object val = getter.invoke(o, null); - - if (rest != null) - return getProperty(val, rest); - - return new Object[] {val, getter.getReturnType()}; + try { + Object val = getter.invoke(o, null); + + if (rest != null) + return getProperty(val, rest); + + return new Object[] {val, getter.getReturnType()}; + } catch(InvocationTargetException ite) { + throw new RuntimeException("Method not called: Property or method '" + prop + "' has thrown an exception.", ite); + } catch(IllegalAccessException iae) { + // This cannot happen because we looked up method with Class.getMethod() + // which returns public methods only. + throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae); + } } - /** - * Invoke the event handler. - * - * Proxy is the object that was used, method is the method that was invoked - * on object, and arguments is the set of arguments passed to this method. - * We assume that the first argument is the event to extract a property - * from. - * - * Assuming that method matches the listener method specified when creating - * this EventHandler, the desired property is extracted from this argument. - * The property is passed to target.setAction(), if possible. Otherwise - * target.action() is called, where action is the string fed to the - * constructor. - * - * For now we punt on indexed properties. Sun docs are not clear to me - * about this. - * - * @param proxy The proxy object that had method invoked on it. - * @param method The method that was invoked. - * @param arguments Arguments to method. - * @return Result of invoking target.action on the event property + * Invokes the <code>EventHandler</code>. + * + * <p>This method is normally called by the listener's proxy implementation.</p> + * + * @param proxy The listener interface that is implemented using + * the proxy mechanism. + * @param method The method that was called on the proxy instance. + * @param arguments The arguments which where given to the method. + * @throws Throwable <code>NoSuchMethodException</code> is thrown when the EventHandler's + * action method or property cannot be found. */ public Object invoke(Object proxy, Method method, Object[] arguments) - throws Exception { - // Do we actually need the proxy? - if (method == null) - throw new RuntimeException("Invoking null method"); + try { + // The method instance of the target object. We have to find out which + // one we have to invoke. + Method actionMethod = null; // Listener methods that weren't specified are ignored. If listenerMethod // is null, then all listener methods are processed. if (listenerMethod != null && !method.getName().equals(listenerMethod)) return null; - // Extract the first arg from arguments and do getProperty on arg - if (arguments == null || arguments.length == 0) - return null; - Object event = arguments[0]; // We hope :-) - - // Obtain the property XXX propertyType keeps showing up null - why? - // because the object inside getProperty changes, but the ref variable - // can't change this way, dolt! need a better way to get both values out - // - need method and object to do the invoke and get return type - Object v[] = getProperty(event, property); - Object val = v[0]; - Class propertyType = (Class) v[1]; - - // Find the actual method of target to invoke. We can't do this in the - // constructor since we don't know the type of the property we extracted - // from the event then. - // - // action can be either a property or a method. Sun's docs seem to imply - // that action should be treated as a property first, and then a method, - // but don't specifically say it. - // - // XXX check what happens with native type wrappers. The better thing to - // do is look at the return type of the method - Method actionMethod; - try + // If a property is defined we definitely need a valid object at + // arguments[0] that can be used to retrieve a value to which the + // property of the target gets set. + if(property != null) { + // Extracts the argument. We will let it fail with a NullPointerException + // the caller used a listener method that has no arguments. + Object event = arguments[0]; + + // Obtains the property XXX propertyType keeps showing up null - why? + // because the object inside getProperty changes, but the ref variable + // can't change this way, dolt! need a better way to get both values out + // - need method and object to do the invoke and get return type + Object v[] = getProperty(event, property); + Object[] args = new Object[] { v[0] }; + + // Changes the class array that controls which method signature we are going + // to look up in the target object. + Class[] argTypes = new Class[] { initClass((Class) v[1]) }; + + // Tries to find a setter method to which we can apply the + while(argTypes[0] != null) { + try { - // Look for a property setter for action. - actionMethod = - target.getClass().getMethod("set" + capitalize(action), - new Class[] {propertyType}); + // Look for a property setter for action. + actionMethod = targetClass.getMethod("set" + capitalize(action), argTypes); + + return actionMethod.invoke(target, args); } catch (NoSuchMethodException e) { - // If action as property didn't work, try as method. - try - { - actionMethod = - target.getClass().getMethod(action, new Class[] {propertyType}); - } - catch (NoSuchMethodException e1) - { - // When event property is null, we may call action with no args - if (property == null) - { - actionMethod = - target.getClass().getMethod(action, null); - return actionMethod.invoke(target, null); - } - else - throw e1; - } + // If action as property didn't work, try as method later. + } + + argTypes[0] = nextClass(argTypes[0]); + } + + // We could not find a suitable setter method. Now we try again interpreting + // action as the method name itself. + // Since we probably have changed the block local argTypes array + // we need to rebuild it. + argTypes = new Class[] { initClass((Class) v[1]) }; + + // Tries to find a setter method to which we can apply the + while(argTypes[0] != null) { + try + { + actionMethod = targetClass.getMethod(action, argTypes); + + return actionMethod.invoke(target, args); + } + catch (NoSuchMethodException e) + { + } + + argTypes[0] = nextClass(argTypes[0]); + } + + throw new RuntimeException("Method not called: Could not find a public method named '" + + action + "' in target " + targetClass + " which takes a '" + + v[1] + "' argument or a property of this type."); + } + + // If property was null we will search for a no-argument method here. + // Note: The ordering of method lookups is important because we want to prefer no-argument + // calls like the JDK does. This means if we have actionMethod() and actionMethod(Event) we will + // call the first *EVEN* if we have a valid argument for the second method. This is behavior compliant + // to the JDK. + // If actionMethod() is not available but there is a actionMethod(Event) we take this. That makes us + // more specification compliant than the JDK itself because this one will fail in such a case. + try + { + actionMethod = targetClass.getMethod(action, null); + } + catch(NoSuchMethodException nsme) + { + // Note: If we want to be really strict the specification says that a no-argument method should + // accept an EventObject (or subclass I guess). However since the official implementation is broken + // anyways, it's more flexible without the EventObject restriction and we are compatible on everything + // else this can stay this way. + if(arguments != null && arguments.length >= 1/* && arguments[0] instanceof EventObject*/) { + Class[] targetArgTypes = new Class[] { initClass(arguments[0].getClass()) }; + + while(targetArgTypes[0] != null) { + try + { + // If no property exists we expect the first element of the arguments to be + // an EventObject which is then applied to the target method. + + actionMethod = targetClass.getMethod(action, targetArgTypes); + + return actionMethod.invoke(target, new Object[] { arguments[0] }); + } + catch(NoSuchMethodException nsme2) + { + + } + + targetArgTypes[0] = nextClass(targetArgTypes[0]); + } + + } } + // If we do not have a Method instance at this point this means that all our tries + // failed. The JDK throws an ArrayIndexOutOfBoundsException in this case. + if(actionMethod == null) + throw new ArrayIndexOutOfBoundsException(0); + // Invoke target.action(property) - return actionMethod.invoke(target, new Object[] {val}); + return actionMethod.invoke(target, null); + } catch(InvocationTargetException ite) { + throw new RuntimeException(ite.getCause()); + } catch(IllegalAccessException iae) { + // Cannot happen because we always use getMethod() which returns public + // methods only. Otherwise there is something seriously broken in + // GNU Classpath. + throw (InternalError) new InternalError("Non-public method was invoked.").initCause(iae); + } + } + + /** + * <p>Returns the primitive type for every wrapper class or the + * class itself if it is no wrapper class.</p> + * + * <p>This is needed because to be able to find both kinds of methods: + * One that takes a wrapper class as the first argument and one that + * accepts a primitive instead.</p> + */ + private Class initClass(Class klass) { + if(klass == Boolean.class) { + return Boolean.TYPE; + } else if(klass == Byte.class) { + return Byte.TYPE; + } else if(klass == Short.class) { + return Short.TYPE; + } else if(klass == Integer.class) { + return Integer.TYPE; + } else if(klass == Long.class) { + return Long.TYPE; + } else if(klass == Float.class) { + return Float.TYPE; + } else if(klass == Double.class) { + return Double.TYPE; + } else { + return klass; + } } /** - * Construct a new object to dispatch events. - * - * Equivalent to: - * create(listenerInterface, target, action, null, null) + * + * + * @param klass + * @return + */ + private Class nextClass(Class klass) { + if(klass == Boolean.TYPE) { + return Boolean.class; + } else if(klass == Byte.TYPE) { + return Byte.class; + } else if(klass == Short.TYPE) { + return Short.class; + } else if(klass == Integer.TYPE) { + return Integer.class; + } else if(klass == Long.TYPE) { + return Long.class; + } else if(klass == Float.TYPE) { + return Float.class; + } else if(klass == Double.TYPE) { + return Double.class; + } else { + return klass.getSuperclass(); + } + } + + /** + * <p>Constructs an implementation of <code>listenerInterface</code> + * to dispatch events.</p> + * + * <p>You can use such an implementation to simply call a public + * no-argument method of an arbitrary target object or to forward + * the first argument of the listener method to the target method.</p> + * + * <p>Call this method like:</p> + * <code> + * button.addActionListener((ActionListener) + * EventHandler.create(ActionListener.class, target, "dispose")); + * </code> + * + * <p>to achieve the following behavior:</p> + * <code> + * button.addActionListener(new ActionListener() { + * public void actionPerformed(ActionEvent ae) { + * target.dispose(); + * } + * }); + * </code> + * + * <p>That means if you need a listener implementation that simply calls a + * a no-argument method on a given instance for <strong>each</strong> + * method of the listener interface.</p> + * + * <p>Note: The <code>action</code> is interpreted as a method name. If your target object + * has no no-argument method of the given name the EventHandler tries to find + * a method with the same name but which can accept the first argument of the + * listener method. Usually this will be an event object but any other object + * will be forwarded, too. Keep in mind that using a property name instead of a + * real method here is wrong and will throw an <code>ArrayIndexOutOfBoundsException</code> + * whenever one of the listener methods is called.<p/> * - * I.e. all listenerInterface methods are mapped to - * target.action(EventObject) or target.action(), if the first doesn't - * exist. + * <p>The <code>EventHandler</code> will automatically convert primitives + * to their wrapper class and vice versa. Furthermore it will call + * a target method if it accepts a superclass of the type of the + * first argument of the listener method.</p> + * + * <p>In case that the method of the target object throws an exception + * it will be wrapped in a <code>RuntimeException</code> and thrown out + * of the listener method.</p> + * + * <p>In case that the method of the target object cannot be found an + * <code>ArrayIndexOutOfBoundsException</code> will be thrown when the + * listener method is invoked.</p> + * + * <p>A call to this method is equivalent to: + * <code>create(listenerInterface, target, action, null, null)</code></p> * * @param listenerInterface Listener interface to implement. * @param target Object to invoke action on. @@ -307,14 +470,82 @@ public class EventHandler implements InvocationHandler } /** - * Construct a new object to dispatch events. + * <p>Constructs an implementation of <code>listenerInterface</code> + * to dispatch events.</p> * - * Equivalent to: - * create(listenerInterface, target, action, eventPropertyName, null) + * <p>Use this method if you want to create an implementation that retrieves + * a property value from the <b>first</b> argument of the listener method + * and applies it to the target's property or method. This first argument + * of the listener is usually an event object but any other object is + * valid, too.</p> + * + * <p>You can set the value of <code>eventPropertyName</code> to "prop" + * to denote the retrieval of a property named "prop" from the event + * object. In case that no such property exists the <code>EventHandler</code> + * will try to find a method with that name.</p> + * + * <p>If you set <code>eventPropertyName</code> to a value like this "a.b.c" + * <code>EventHandler</code> will recursively evaluate the properties "a", "b" + * and "c". Again if no property can be found the <code>EventHandler</code> + * tries a method name instead. This allows mixing the names, too: "a.toString" + * will retrieve the property "a" from the event object and will then call + * the method "toString" on it.</p> + * + * <p>An exception thrown in any of these methods will provoke a + * <code>RuntimeException</code> to be thrown which contains an + * <code>InvocationTargetException</code> containing the triggering exception.</p> + * + * <p>If you set <code>eventPropertyName</code> to a non-null value the + * <code>action</code> parameter will be interpreted as a property name + * or a method name of the target object.</p> + * + * <p>Any object retrieved from the event object and applied to the + * target will converted from primitives to their wrapper class or + * vice versa or applied to a method that accepts a superclass + * of the object.</p> * - * I.e. all listenerInterface methods are mapped to - * target.action(event.getEventPropertyName) + * <p>Examples:</p> + * <p>The following code:</p><code> + * button.addActionListener( + * new ActionListener() { + * public void actionPerformed(ActionEvent ae) { + * Object o = ae.getSource().getClass().getName(); + * textField.setText((String) o); + * } + * }); + * </code> + * + * <p>Can be expressed using the <code>EventHandler</code> like this:</p> + * <p> + * <code>button.addActionListener((ActionListener) + * EventHandler.create(ActionListener.class, textField, "text", "source.class.name"); + * <code> + * </p> + * + * <p>As said above you can specify the target as a method, too:</p> + * <p> + * <code>button.addActionListener((ActionListener) + * EventHandler.create(ActionListener.class, textField, "setText", "source.class.name"); + * <code> + * </p> + * + * <p>Furthermore you can use method names in the property:</p> + * <p> + * <code>button.addActionListener((ActionListener) + * EventHandler.create(ActionListener.class, textField, "setText", "getSource.getClass.getName"); + * <code> + * </p> * + * <p>Finally you can mix names:</p> + * <p> + * <code>button.addActionListener((ActionListener) + * EventHandler.create(ActionListener.class, textField, "setText", "source.getClass.name"); + * <code> + * </p> + * + * <p>A call to this method is equivalent to: + * <code>create(listenerInterface, target, action, null, null)</code> + * </p> * * @param listenerInterface Listener interface to implement. * @param target Object to invoke action on. @@ -328,41 +559,27 @@ public class EventHandler implements InvocationHandler return create(listenerInterface, target, action, eventPropertyName, null); } - /** - * Construct a new object to dispatch events. - * - * This creates an object that acts as a proxy for the method - * listenerMethodName in listenerInterface. When the listener method is - * activated, the object extracts eventPropertyName from the event. Then it - * passes the property to the method target.setAction, or target.action if - * action is not a property with a setter. - * - * For example, EventHandler.create(MouseListener.class, test, "pushed", - * "button", "mouseClicked") generates a proxy object that implements - * MouseListener, at least for the method mouseClicked(). The other methods - * of MouseListener are null operations. When mouseClicked is invoked, the - * generated object extracts the button property from the MouseEvent, - * i.e. event.getButton(), and calls test.setPushed() with the result. So under - * the covers the following happens: + * <p>Constructs an implementation of <code>listenerInterface</code> + * to dispatch events.</p> * - * <CODE> - * object.mouseClicked(MouseEvent e) { test.setPushed(e.getButton()); } - * </CODE> - * - * The Sun spec specifies a hierarchical property naming scheme. Generally - * if the property is a.b.c, this corresponds to event.getA().getB().getC() - * or event.getA().getB().isC(). I don't see how you specify an indexed - * property, though. This may be a limitation of the Sun implementation as - * well. The spec doesn't seem to address it. + * <p>Besides the functionality described for {@link create(Class, Object, String)} + * and {@link create(Class, Object, String, String)} this method allows you + * to filter the listener method that should have an effect. Look at these + * method's documentation for more information about the <code>EventHandler</code>'s + * usage.</p> * - * If eventPropertyName is null, EventHandler instead uses the event object - * in place of a property, i.e. it calls target.action(EventObject). If - * there is no method named action taking an EventObject argument, - * EventHandler looks for a method target.action() taking no arguments. - * - * If listenerMethodName is null, every method in listenerInterface gets - * mapped to target.action, rather than the specified listener method. + * <p>If you want to call <code>dispose</code> on a <code>JFrame</code> instance + * when the <code>WindowListener.windowClosing()</code> method was invoked use + * the following code:</p> + * <p> + * <code> + * EventHandler.create(WindowListener.class, jframeInstance, "dispose", null, "windowClosing"); + * </code> + * </p> + * + * <p>A <code>NullPointerException</code> is thrown if the <code>listenerInterface</code> + * or <code>target</code> argument are <code>null</code>. * * @param listenerInterface Listener interface to implement. * @param target Object to invoke action on. diff --git a/java/io/DataInputStream.java b/java/io/DataInputStream.java index 9cdbc6955..1eda85584 100644 --- a/java/io/DataInputStream.java +++ b/java/io/DataInputStream.java @@ -1,5 +1,5 @@ /* DataInputStream.java -- FilteredInputStream that implements DataInput - Copyright (C) 1998, 1999, 2000, 2001, 2003 Free Software Foundation + Copyright (C) 1998, 1999, 2000, 2001, 2003, 2005 Free Software Foundation This file is part of GNU Classpath. @@ -56,11 +56,6 @@ package java.io; */ public class DataInputStream extends FilterInputStream implements DataInput { - // readLine() hack to ensure that an '\r' not followed by an '\n' is - // handled correctly. If set, readLine() will ignore the first char it sees - // if that char is a '\n' - boolean ignoreInitialNewline = false; - // Byte buffer, used to make primitive read calls more efficient. byte[] buf = new byte [8]; @@ -352,88 +347,29 @@ public class DataInputStream extends FilterInputStream implements DataInput * * @deprecated */ - public final String readLine () throws IOException + public final String readLine() throws IOException { - StringBuffer strb = new StringBuffer (); + StringBuffer strb = new StringBuffer(); - readloop: while (true) + while (true) { - int c = 0; - char ch = ' '; - boolean getnext = true; - while (getnext) - { - getnext = false; - c = in.read(); - if (c < 0) // got an EOF - return strb.length () > 0 ? strb.toString () : null; - ch = (char) c; - if ((ch &= 0xFF) == '\n') - // hack to correctly handle '\r\n' sequences - if (ignoreInitialNewline) - { - ignoreInitialNewline = false; - getnext = true; - } - else - break readloop; - } - - if (ch == '\r') + int c = in.read(); + if (c == -1) // got an EOF + return strb.length() > 0 ? strb.toString() : null; + if (c == '\r') { - // FIXME: The following code tries to adjust the stream back one - // character if the next char read is '\n'. As a last resort, - // it tries to mark the position before reading but the bottom - // line is that it is possible that this method will not properly - // deal with a '\r' '\n' combination thus not fulfilling the - // DataInput contract for readLine. It's not a particularly - // safe approach threadwise since it is unsynchronized and - // since it might mark an input stream behind the users back. - // Along the same vein it could try the same thing for - // ByteArrayInputStream and PushbackInputStream, but that is - // probably overkill since this is deprecated & BufferedInputStream - // is the most likely type of input stream. - // - // The alternative is to somehow push back the next byte if it - // isn't a '\n' or to have the reading methods of this class - // keep track of whether the last byte read was '\r' by readLine - // and then skip the very next byte if it is '\n'. Either way, - // this would increase the complexity of the non-deprecated methods - // and since it is undesirable to make non-deprecated methods - // less efficient, the following seems like the most reasonable - // approach. - int next_c = 0; - char next_ch = ' '; - if (in instanceof BufferedInputStream) - { - next_c = in.read(); - next_ch = (char) (next_c & 0xFF); - if ((next_ch != '\n') && (next_c >= 0)) - { - BufferedInputStream bin = (BufferedInputStream) in; - if (bin.pos > 0) - bin.pos--; - } - } - else if (markSupported()) - { - next_c = in.read(); - next_ch = (char) (next_c & 0xFF); - if ((next_ch != '\n') && (next_c >= 0)) - { - mark(1); - if ((in.read() & 0xFF) != '\n') - reset(); - } - } - // In order to catch cases where 'in' isn't a BufferedInputStream - // and doesn't support mark() (such as reading from a Socket), set - // a flag that instructs readLine() to ignore the first character - // it sees _if_ that character is a '\n'. - else ignoreInitialNewline = true; - break; + int next_c = in.read(); + if (next_c != '\n' && next_c != -1) + { + if (! (in instanceof PushbackInputStream)) + in = new PushbackInputStream(in); + ((PushbackInputStream) in).unread(next_c); + } + break; } - strb.append(ch); + if (c == '\n') + break; + strb.append((char) c); } return strb.length() > 0 ? strb.toString() : ""; diff --git a/java/io/FileInputStream.java b/java/io/FileInputStream.java index 17aaf799b..ebd5d20ad 100644 --- a/java/io/FileInputStream.java +++ b/java/io/FileInputStream.java @@ -105,9 +105,6 @@ public class FileInputStream extends InputStream if (s != null) s.checkRead(file.getPath()); - if (file.isDirectory()) - throw new FileNotFoundException(file.getPath() + " is a directory"); - ch = new FileChannelImpl (file.getPath(), FileChannelImpl.READ); } diff --git a/java/io/FileOutputStream.java b/java/io/FileOutputStream.java index 34b06cbf1..d5fa2d3bb 100644 --- a/java/io/FileOutputStream.java +++ b/java/io/FileOutputStream.java @@ -155,10 +155,7 @@ public class FileOutputStream extends OutputStream if (s != null) s.checkWrite(file.getPath()); - if (file.isDirectory()) - throw new FileNotFoundException(file.getPath() + " is a directory"); - - ch = new FileChannelImpl (file.getPath(), (append + ch = new FileChannelImpl (file.getPath(), (append ? FileChannelImpl.WRITE | FileChannelImpl.APPEND : FileChannelImpl.WRITE)); diff --git a/java/io/InputStreamReader.java b/java/io/InputStreamReader.java index 09594631f..ef9ea493b 100644 --- a/java/io/InputStreamReader.java +++ b/java/io/InputStreamReader.java @@ -38,6 +38,10 @@ exception statement from your version. */ package java.io; +import java.nio.channels.Channels; +import java.nio.charset.Charset; +import java.nio.charset.CharsetDecoder; + import gnu.java.io.EncodingManager; import gnu.java.io.decode.Decoder; @@ -92,8 +96,10 @@ public class InputStreamReader extends Reader * This is the byte-character decoder class that does the reading and * translation of bytes from the underlying stream. */ - private Decoder in; + private Reader in; + private String encoding; + /** * This method initializes a new instance of <code>InputStreamReader</code> * to read from the specified stream using the default encoding. @@ -104,7 +110,11 @@ public class InputStreamReader extends Reader { if (in == null) throw new NullPointerException(); - this.in = EncodingManager.getDecoder(in); + + Decoder decoder = EncodingManager.getDecoder(in); + encoding = decoder.getSchemeName(); + + this.in = decoder; } /** @@ -126,10 +136,44 @@ public class InputStreamReader extends Reader || encoding_name == null) throw new NullPointerException(); - this.in = EncodingManager.getDecoder(in, encoding_name); + Decoder decoder = EncodingManager.getDecoder(in, encoding_name); + encoding = decoder.getSchemeName(); + + this.in = decoder; + + } + + /** + * Creates an InputStreamReader that uses a decoder of the given + * charset to decode the bytes in the InputStream into + * characters. + * @since 1.4 + */ + public InputStreamReader(InputStream in, Charset charset) + { + /* FIXME: InputStream is wrapped in Channel which is read by a + * Reader-implementation for channels. However to fix this we + * need to completely move to NIO-style character + * encoding/decoding. + */ + this.in = Channels.newReader(Channels.newChannel(in), charset.newDecoder(), + -1); + encoding = charset.name(); } /** + * Creates an InputStreamReader that uses the given charset decoder + * to decode the bytes in the InputStream into characters. + * @since 1.4 + */ + public InputStreamReader(InputStream in, CharsetDecoder decoder) + { + // FIXME: see {@link InputStreamReader(InputStream, Charset) + this.in = Channels.newReader(Channels.newChannel(in), decoder, -1); + encoding = decoder.charset().name(); + } + + /** * This method closes this stream, as well as the underlying * <code>InputStream</code>. * @@ -154,7 +198,7 @@ public class InputStreamReader extends Reader */ public String getEncoding() { - return in != null ? in.getSchemeName() : null; + return in != null ? encoding : null; } /** diff --git a/java/io/ObjectInputStream.java b/java/io/ObjectInputStream.java index 10c68bcb5..e67100cc5 100644 --- a/java/io/ObjectInputStream.java +++ b/java/io/ObjectInputStream.java @@ -508,7 +508,8 @@ public class ObjectInputStream extends InputStream flags, fields); assignNewHandle(osc); - ClassLoader currentLoader = currentLoader(); + if (callersClassLoader == null) + callersClassLoader = currentLoader(); for (int i = 0; i < field_count; i++) { @@ -529,12 +530,40 @@ public class ObjectInputStream extends InputStream class_name = String.valueOf(type_code); fields[i] = - new ObjectStreamField(field_name, class_name, currentLoader); + new ObjectStreamField(field_name, class_name, callersClassLoader); } /* Now that fields have been read we may resolve the class * (and read annotation if needed). */ - Class clazz = resolveClass(osc); + Class clazz; + try + { + clazz = resolveClass(osc); + } + catch (ClassNotFoundException cnfe) + { + // Maybe it was an primitive class? + if (name.equals("void")) + clazz = Void.TYPE; + else if (name.equals("boolean")) + clazz = Boolean.TYPE; + else if (name.equals("byte")) + clazz = Byte.TYPE; + else if (name.equals("short")) + clazz = Short.TYPE; + else if (name.equals("char")) + clazz = Character.TYPE; + else if (name.equals("int")) + clazz = Integer.TYPE; + else if (name.equals("long")) + clazz = Long.TYPE; + else if (name.equals("float")) + clazz = Float.TYPE; + else if (name.equals("double")) + clazz = Double.TYPE; + else + throw cnfe; + } boolean oldmode = setBlockDataMode(true); osc.setClass(clazz, lookupClass(clazz.getSuperclass())); @@ -547,6 +576,7 @@ public class ObjectInputStream extends InputStream // Maybe it is a primitive class, those don't have a super class, // or Object itself. Otherwise we can keep getting the superclass // till we hit the Object class, or some other non-serializable class. + if (first_nonserial == null) first_nonserial = clazz; else @@ -747,35 +777,16 @@ public class ObjectInputStream extends InputStream protected Class resolveClass(ObjectStreamClass osc) throws ClassNotFoundException, IOException { - try + if (callersClassLoader == null) { - return Class.forName(osc.getName(), true, currentLoader()); - } - catch (ClassNotFoundException cnfe) - { - // Maybe it was an primitive class? - String name = osc.getName(); - if (name.equals("void")) - return Void.TYPE; - if (name.equals("boolean")) - return Boolean.TYPE; - if (name.equals("byte")) - return Byte.TYPE; - if (name.equals("short")) - return Short.TYPE; - if (name.equals("char")) - return Character.TYPE; - if (name.equals("int")) - return Integer.TYPE; - if (name.equals("long")) - return Long.TYPE; - if (name.equals("float")) - return Float.TYPE; - if (name.equals("double")) - return Double.TYPE; - - throw cnfe; + callersClassLoader = currentLoader (); + if (Configuration.DEBUG && dump) + { + dumpElementln ("CallersClassLoader = " + callersClassLoader); + } } + + return Class.forName(osc.getName(), true, callersClassLoader); } /** @@ -1926,6 +1937,7 @@ public class ObjectInputStream extends InputStream private Hashtable<Class,ObjectStreamClass> classLookupTable; private GetField prereadFields; + private ClassLoader callersClassLoader; private static boolean dump; // The nesting depth for debugging output diff --git a/java/io/ObjectOutputStream.java b/java/io/ObjectOutputStream.java index 15a76c808..57ee60b01 100644 --- a/java/io/ObjectOutputStream.java +++ b/java/io/ObjectOutputStream.java @@ -358,8 +358,8 @@ public class ObjectOutputStream extends OutputStream { if (dump) dumpElementln ("WRITE FIELDS CALLED FOR: " + obj); - writeFields(obj, currentObjectStreamClass); - } + writeFields(obj, currentObjectStreamClass); + } } this.currentObject = prevObject; @@ -1274,7 +1274,7 @@ public class ObjectOutputStream extends OutputStream if (exception instanceof IOException) throw (IOException) exception; - IOException ioe + IOException ioe = new IOException("Exception thrown from writeObject() on " + osc.forClass().getName() + ": " + exception.getClass().getName()); diff --git a/java/lang/Class.java b/java/lang/Class.java index bf99f91de..375725a5c 100644 --- a/java/lang/Class.java +++ b/java/lang/Class.java @@ -1114,11 +1114,14 @@ public final class Class<T> implements Serializable } if (constructor == null) throw new InstantiationException(getName()); - if (!Modifier.isPublic(constructor.getModifiers())) + if (!Modifier.isPublic(constructor.getModifiers()) + || !Modifier.isPublic(getModifiers())) { final Constructor finalConstructor = constructor; - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { + AccessController.doPrivileged(new PrivilegedAction() + { + public Object run() + { finalConstructor.setAccessible(true); return null; } @@ -1131,7 +1134,8 @@ public final class Class<T> implements Serializable } } int modifiers = constructor.getModifiers(); - if (!Modifier.isPublic(modifiers)) + if (!Modifier.isPublic(modifiers) + || !Modifier.isPublic(getModifiers())) { Class caller = VMStackWalker.getCallingClass(); if (caller != null && diff --git a/java/lang/InheritableThreadLocal.java b/java/lang/InheritableThreadLocal.java index d3d48815b..d64db20d5 100644 --- a/java/lang/InheritableThreadLocal.java +++ b/java/lang/InheritableThreadLocal.java @@ -37,11 +37,7 @@ exception statement from your version. */ package java.lang; -import java.util.ArrayList; -import java.util.Collections; import java.util.Iterator; -import java.util.List; -import java.util.Map; import java.util.WeakHashMap; /** @@ -65,15 +61,6 @@ import java.util.WeakHashMap; */ public class InheritableThreadLocal<T> extends ThreadLocal<T> { - /** - * Maps Threads to a List of InheritableThreadLocals (the heritage of that - * Thread). Uses a WeakHashMap so if the Thread is garbage collected the - * List can be collected, too. Maps to a list in case the user overrides - * equals. - */ - private static final - Map<Thread, ArrayList<InheritableThreadLocal>> threadMap - = Collections.synchronizedMap(new WeakHashMap<Thread, ArrayList<InheritableThreadLocal>>()); /** * Creates a new InheritableThreadLocal that has no values associated @@ -81,16 +68,6 @@ public class InheritableThreadLocal<T> extends ThreadLocal<T> */ public InheritableThreadLocal() { - Thread currentThread = Thread.currentThread(); - // Note that we don't have to synchronize, as only this thread will - // ever modify the returned heritage and threadMap is a synchronizedMap. - ArrayList<InheritableThreadLocal> heritage = threadMap.get(currentThread); - if (heritage == null) - { - heritage = new ArrayList<InheritableThreadLocal>(); - threadMap.put(currentThread, heritage); - } - heritage.add(this); } /** @@ -119,27 +96,23 @@ public class InheritableThreadLocal<T> extends ThreadLocal<T> { // The currentThread is the parent of the new thread. Thread parentThread = Thread.currentThread(); - // Note that we don't have to synchronize, as only this thread will - // ever modify the returned heritage and threadMap is a synchronizedMap. - ArrayList<InheritableThreadLocal> heritage - = threadMap.get(parentThread); - if (heritage != null) + if (parentThread.locals != null) { - threadMap.put(childThread, - (ArrayList<InheritableThreadLocal>) heritage.clone()); - // Perform the inheritance. - Iterator<InheritableThreadLocal> it = heritage.iterator(); - int i = heritage.size(); - while (--i >= 0) + Iterator keys = parentThread.locals.keySet().iterator(); + while (keys.hasNext()) { - InheritableThreadLocal local = it.next(); - Object parentValue = local.valueMap.get(parentThread); - if (parentValue != null) + Key key = (Key)keys.next(); + if (key.get() instanceof InheritableThreadLocal) { + InheritableThreadLocal local = + (InheritableThreadLocal) key.get(); + Object parentValue = parentThread.locals.get(key); Object childValue = local.childValue(parentValue == NULL ? null : parentValue); - local.valueMap.put(childThread, (childValue == null - ? NULL : parentValue)); + if (childThread.locals == null) + childThread.locals = new WeakHashMap(); + childThread.locals.put(key, (childValue == null + ? NULL : childValue)); } } } diff --git a/java/lang/SecurityManager.java b/java/lang/SecurityManager.java index dd125220d..8a9012192 100644 --- a/java/lang/SecurityManager.java +++ b/java/lang/SecurityManager.java @@ -1033,13 +1033,15 @@ public class SecurityManager String permission) { if (packageName == null) - throw new NullPointerException(); + throw new NullPointerException(); - String list = (String)AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - return Security.getProperty(restriction); + String list = (String)AccessController.doPrivileged(new PrivilegedAction() + { + public Object run() + { + return Security.getProperty(restriction); } - }); + }); if (list == null || list.equals("")) return; @@ -1057,4 +1059,4 @@ public class SecurityManager } } } -} // class SecurityManager +} diff --git a/java/lang/Thread.java b/java/lang/Thread.java index 440d401e1..f80b51106 100644 --- a/java/lang/Thread.java +++ b/java/lang/Thread.java @@ -38,6 +38,8 @@ exception statement from your version. */ package java.lang; +import java.util.Map; +import java.util.WeakHashMap; /* Written using "Java Class Libraries", 2nd edition, ISBN 0-201-31002-3 * "The Java Language Specification", ISBN 0-201-63451-1 @@ -131,6 +133,11 @@ public class Thread implements Runnable /** The next thread number to use. */ private static int numAnonymousThreadsCreated; + /** Thread local storage. Package accessible for use by + * InheritableThreadLocal. + */ + WeakHashMap locals; + /** * Allocates a new <code>Thread</code> object. This constructor has * the same effect as <code>Thread(null, null,</code> @@ -973,6 +980,21 @@ public class Thread implements Runnable { group.removeThread(this); vmThread = null; + locals = null; + } + + /** + * Returns the map used by ThreadLocal to store the thread local values. + */ + static Map getThreadLocals() + { + Thread thread = currentThread(); + Map locals = thread.locals; + if (locals == null) + { + locals = thread.locals = new WeakHashMap(); + } + return locals; } /** diff --git a/java/lang/ThreadLocal.java b/java/lang/ThreadLocal.java index 450f75b3e..766d9824c 100644 --- a/java/lang/ThreadLocal.java +++ b/java/lang/ThreadLocal.java @@ -37,7 +37,6 @@ exception statement from your version. */ package java.lang; -import java.util.Collections; import java.util.Map; import java.util.WeakHashMap; @@ -98,18 +97,20 @@ public class ThreadLocal<T> static final Object NULL = new Object(); /** - * The stored value. Package visible for use by InheritableThreadLocal. */ - T value; - - /** - * Maps Threads to values. Uses a WeakHashMap so if a Thread is garbage - * collected the reference to the Value will disappear. A null value means - * uninitialized, while NULL means a user-specified null. Only the - * <code>set(Thread, Object)</code> and <code>get(Thread)</code> methods - * access it. Package visible for use by InheritableThreadLocal. + * Serves as a key for the Thread.locals WeakHashMap. + * We can't use "this", because a subclass may override equals/hashCode + * and we need to use object identity for the map. */ - final Map<Thread, T> valueMap - = Collections.synchronizedMap(new WeakHashMap<Thread, T>()); + final Key key = new Key(); + + class Key + { + ThreadLocal get() + { + return ThreadLocal.this; + } + } + /** * Creates a ThreadLocal object without associating any value to it yet. @@ -141,14 +142,14 @@ public class ThreadLocal<T> */ public T get() { - Thread currentThread = Thread.currentThread(); + Map<Key,T> map = (Map<Key,T>) Thread.getThreadLocals(); // Note that we don't have to synchronize, as only this thread will - // ever modify the returned value and valueMap is a synchronizedMap. - T value = valueMap.get(currentThread); + // ever modify the map. + T value = map.get(key); if (value == null) { value = initialValue(); - valueMap.put(currentThread, value == null ? (T) NULL : value); + map.put(key, value == null ? (T) NULL : value); } return value == (T) NULL ? null : value; } @@ -163,8 +164,9 @@ public class ThreadLocal<T> */ public void set(T value) { + Map map = Thread.getThreadLocals(); // Note that we don't have to synchronize, as only this thread will - // ever modify the returned value and valueMap is a synchronizedMap. - valueMap.put(Thread.currentThread(), value == null ? (T) NULL : value); + // ever modify the map. + map.put(key, value == null ? NULL : value); } } diff --git a/java/lang/annotation/package.html b/java/lang/annotation/package.html new file mode 100644 index 000000000..5ef2edd44 --- /dev/null +++ b/java/lang/annotation/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in java.lang.annotation package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - java.lang.annotation</title></head> + +<body> +<p>Classes to handle annotations.</p> + +</body> +</html> diff --git a/java/net/InetAddress.java b/java/net/InetAddress.java index a99057df8..e1278fd96 100644 --- a/java/net/InetAddress.java +++ b/java/net/InetAddress.java @@ -1,5 +1,5 @@ /* InetAddress.java -- Class to model an Internet address - Copyright (C) 1998, 1999, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -523,7 +523,7 @@ public class InetAddress implements Serializable public String toString() { String addr = getHostAddress(); - String host = (hostName != null) ? hostName : addr; + String host = (hostName != null) ? hostName : ""; return host + "/" + addr; } diff --git a/java/net/URI.java b/java/net/URI.java index 23e3e7c9e..63724a4e5 100644 --- a/java/net/URI.java +++ b/java/net/URI.java @@ -65,7 +65,7 @@ public final class URI implements Comparable, Serializable "^(([^:/?#]+):)?((//([^/?#]*))?([^?#]*)(\\?([^#]*))?)?(#(.*))?"; private static final String AUTHORITY_REGEXP = - "^((([^?#]*)@)?([^?#:]*)(:([^?#]*)))?"; + "(([^?#]*)@)?([^?#:]*)(:([^?#]*))?"; /** * Valid characters (taken from rfc2396) @@ -115,9 +115,9 @@ public final class URI implements Comparable, Serializable */ private static final int FRAGMENT_GROUP = 10; - private static final int AUTHORITY_USERINFO_GROUP = 3; - private static final int AUTHORITY_HOST_GROUP = 4; - private static final int AUTHORITY_PORT_GROUP = 6; + private static final int AUTHORITY_USERINFO_GROUP = 2; + private static final int AUTHORITY_HOST_GROUP = 3; + private static final int AUTHORITY_PORT_GROUP = 5; private transient String scheme; private transient String rawSchemeSpecificPart; diff --git a/java/net/URL.java b/java/net/URL.java index c63d4a49f..11fc3aec7 100644 --- a/java/net/URL.java +++ b/java/net/URL.java @@ -1,5 +1,5 @@ /* URL.java -- Uniform Resource Locator Class - Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004 + Copyright (C) 1998, 1999, 2000, 2002, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -882,7 +882,8 @@ public final class URL implements Serializable { systemClassLoader = (ClassLoader) AccessController.doPrivileged (new PrivilegedAction() { - public Object run() { + public Object run() + { return ClassLoader.getSystemClassLoader(); } }); @@ -904,7 +905,10 @@ public final class URL implements Serializable { throw death; } - catch (Throwable t) { /* ignored */ } + catch (Throwable t) + { + // Ignored. + } } while (ph == null && pkgPrefix.hasMoreTokens()); } diff --git a/java/net/URLClassLoader.java b/java/net/URLClassLoader.java index e01c2227b..0878e86bc 100644 --- a/java/net/URLClassLoader.java +++ b/java/net/URLClassLoader.java @@ -536,7 +536,7 @@ public class URLClassLoader extends SecureClassLoader Resource getResource(String name) { File file = new File(dir, name); - if (file.exists() && ! file.isDirectory()) + if (file.exists()) return new FileResource(this, name, file); return null; } @@ -554,11 +554,36 @@ public class URLClassLoader extends SecureClassLoader InputStream getInputStream() throws IOException { + // Delegate to the URL content handler mechanism to retrieve an + // HTML representation of the directory listing if a directory + if (file.isDirectory()) + { + URL url = getURL(); + return url.openStream(); + } + // Otherwise simply return a FileInputStream return new FileInputStream(file); } public int getLength() { + // Delegate to the URL content handler mechanism to retrieve the + // length of the HTML representation of the directory listing if + // a directory, or -1 if an exception occurs opening the directory. + if (file.isDirectory()) + { + URL url = getURL(); + try + { + URLConnection connection = url.openConnection(); + return connection.getContentLength(); + } + catch (IOException e) + { + return -1; + } + } + // Otherwise simply return the file length return (int) file.length(); } @@ -706,6 +731,9 @@ public class URLClassLoader extends SecureClassLoader if (newUrl == null) return; // Silently ignore... + // Reset the toString() value. + thisString = null; + // Check global cache to see if there're already url loader // for this url. URLLoader loader = (URLLoader) urlloaders.get(newUrl); @@ -919,25 +947,28 @@ public class URLClassLoader extends SecureClassLoader */ public String toString() { - if (thisString == null) + synchronized (urlloaders) { - StringBuffer sb = new StringBuffer(); - sb.append(this.getClass().getName()); - sb.append("{urls=[" ); - URL[] thisURLs = getURLs(); - for (int i = 0; i < thisURLs.length; i++) + if (thisString == null) { - sb.append(thisURLs[i]); - if (i < thisURLs.length - 1) - sb.append(','); + StringBuffer sb = new StringBuffer(); + sb.append(this.getClass().getName()); + sb.append("{urls=[" ); + URL[] thisURLs = getURLs(); + for (int i = 0; i < thisURLs.length; i++) + { + sb.append(thisURLs[i]); + if (i < thisURLs.length - 1) + sb.append(','); + } + sb.append(']'); + sb.append(", parent="); + sb.append(getParent()); + sb.append('}'); + thisString = sb.toString(); } - sb.append(']'); - sb.append(", parent="); - sb.append(getParent()); - sb.append('}'); - thisString = sb.toString(); + return thisString; } - return thisString; } /** diff --git a/java/nio/channels/Channels.java b/java/nio/channels/Channels.java index 7ac550f79..52a2815bf 100644 --- a/java/nio/channels/Channels.java +++ b/java/nio/channels/Channels.java @@ -38,6 +38,7 @@ exception statement from your version. */ package java.nio.channels; +import gnu.java.nio.ChannelReader; import gnu.java.nio.InputStreamChannel; import gnu.java.nio.OutputStreamChannel; @@ -102,7 +103,7 @@ public final class Channels public static Reader newReader(ReadableByteChannel ch, CharsetDecoder dec, int minBufferCap) { - throw new Error("not implemented"); + return new ChannelReader(ch, dec, minBufferCap); } /** @@ -124,6 +125,7 @@ public final class Channels public static Writer newWriter(WritableByteChannel ch, CharsetEncoder enc, int minBufferCap) { + // FIXME: implement java.nio.channels.Channel.newWriter(WritableByteChannel, CharsetEncoder, int) throw new Error("not implemented"); } diff --git a/java/text/CollationElementIterator.java b/java/text/CollationElementIterator.java index 9bace0685..481b286c4 100644 --- a/java/text/CollationElementIterator.java +++ b/java/text/CollationElementIterator.java @@ -369,8 +369,9 @@ public final class CollationElementIterator idx_idx += idxToMove; idxToMove = 0; } - } else - idx_idx += prefix.key.length(); + } + else + idx_idx += prefix.key.length(); } } diff --git a/java/text/RuleBasedCollator.java b/java/text/RuleBasedCollator.java index c2cff5a0c..afb766ff8 100644 --- a/java/text/RuleBasedCollator.java +++ b/java/text/RuleBasedCollator.java @@ -1,5 +1,5 @@ /* RuleBasedCollator.java -- Concrete Collator Class - Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004 Free Software Foundation, Inc. + Copyright (C) 1998, 1999, 2000, 2001, 2003, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -435,56 +435,57 @@ main_parse_loop: continue; } - switch (c) { - case '!': - throw new ParseException - ("Modifier '!' is not yet supported by Classpath", i+base_offset); - case '<': - type = CollationSorter.GREATERP; - break; - case ';': - type = CollationSorter.GREATERS; - break; - case ',': - type = CollationSorter.GREATERT; - break; - case '=': - type = CollationSorter.EQUAL; - break; - case '\'': - eatingChars = !eatingChars; - doubleQuote = true; - break; - case '@': - if (ignoreChars) - throw new ParseException - ("comparison list has not yet been started. You may only use" - + "(<,;=&)", i+base_offset); - // Inverse the order of secondaries from now on. - nextIsModifier = true; - type = CollationSorter.INVERSE_SECONDARY; - break; - case '&': - type = CollationSorter.RESET; - if (stop_on_reset) - break main_parse_loop; - break; - default: - if (operator < 0) - throw new ParseException - ("operator missing at " + (i+base_offset), i+base_offset); - if (!eatingChars && - ((c >= 0x21 && c <= 0x2F) - || (c >= 0x3A && c <= 0x40) - || (c >= 0x5B && c <= 0x60) - || (c >= 0x7B && c <= 0x7E))) + switch (c) + { + case '!': throw new ParseException - ("unquoted punctuation character '"+c+"'", i+base_offset); - - //type = ignoreChars ? CollationSorter.IGNORE : -1; - sb.append(c); - break; - } + ("Modifier '!' is not yet supported by Classpath", i + base_offset); + case '<': + type = CollationSorter.GREATERP; + break; + case ';': + type = CollationSorter.GREATERS; + break; + case ',': + type = CollationSorter.GREATERT; + break; + case '=': + type = CollationSorter.EQUAL; + break; + case '\'': + eatingChars = !eatingChars; + doubleQuote = true; + break; + case '@': + if (ignoreChars) + throw new ParseException + ("comparison list has not yet been started. You may only use" + + "(<,;=&)", i + base_offset); + // Inverse the order of secondaries from now on. + nextIsModifier = true; + type = CollationSorter.INVERSE_SECONDARY; + break; + case '&': + type = CollationSorter.RESET; + if (stop_on_reset) + break main_parse_loop; + break; + default: + if (operator < 0) + throw new ParseException + ("operator missing at " + (i + base_offset), i + base_offset); + if (! eatingChars + && ((c >= 0x21 && c <= 0x2F) + || (c >= 0x3A && c <= 0x40) + || (c >= 0x5B && c <= 0x60) + || (c >= 0x7B && c <= 0x7E))) + throw new ParseException + ("unquoted punctuation character '" + c + "'", i + base_offset); + + //type = ignoreChars ? CollationSorter.IGNORE : -1; + sb.append(c); + break; + } if (type < 0) continue; diff --git a/java/text/SimpleDateFormat.java b/java/text/SimpleDateFormat.java index a99792927..190b4d624 100644 --- a/java/text/SimpleDateFormat.java +++ b/java/text/SimpleDateFormat.java @@ -137,9 +137,9 @@ public class SimpleDateFormat extends DateFormat */ public String toString() { - StringBuilder builder; + StringBuffer builder; - builder = new StringBuilder(getClass().getName()); + builder = new StringBuffer(getClass().getName()); builder.append("[field="); builder.append(field); builder.append(", size="); @@ -341,7 +341,7 @@ public class SimpleDateFormat extends DateFormat */ public String toString() { - StringBuilder output = new StringBuilder(getClass().getName()); + StringBuffer output = new StringBuffer(getClass().getName()); output.append("[tokens="); output.append(tokens); output.append(", formatData="); @@ -916,6 +916,8 @@ public class SimpleDateFormat extends DateFormat boolean is_numeric = true; int offset = 0; boolean maybe2DigitYear = false; + boolean oneBasedHour = false; + boolean oneBasedHourOfDay = false; Integer simpleOffset; String[] set1 = null; String[] set2 = null; @@ -964,12 +966,14 @@ public class SimpleDateFormat extends DateFormat break; case 'h': calendar_field = Calendar.HOUR; + oneBasedHour = true; break; case 'H': calendar_field = Calendar.HOUR_OF_DAY; break; case 'k': calendar_field = Calendar.HOUR_OF_DAY; + oneBasedHourOfDay = true; break; case 'm': calendar_field = Calendar.MINUTE; @@ -1108,6 +1112,14 @@ public class SimpleDateFormat extends DateFormat } } + // Calendar uses 0-based hours. + // I.e. 00:00 AM is midnight, not 12 AM or 24:00 + if (oneBasedHour && value == 12) + value = 0; + + if (oneBasedHourOfDay && value == 24) + value = 0; + // Assign the value and move on. calendar.set(calendar_field, value); } diff --git a/java/util/Calendar.java b/java/util/Calendar.java index 8233530b0..2d1d4ee94 100644 --- a/java/util/Calendar.java +++ b/java/util/Calendar.java @@ -364,6 +364,14 @@ public abstract class Calendar private TimeZone zone; /** + * This is the default calendar class, that is returned on + * java.util.Calendar.getInstance(). + * XXX - this isn't localized anywhere, is it? + * @see java.util.Calendar#getInstance() + */ + private static final String calendarClassName = "java.util.GregorianCalendar"; + + /** * Specifies if the date/time interpretation should be lenient. * If the flag is set, a date such as "February 30, 1996" will be * treated as the 29th day after the February 1. If this flag @@ -417,7 +425,7 @@ public abstract class Calendar /** * The name of the resource bundle. Used only by getBundle() */ - private static final String bundleName = "gnu.java.locale.Calendar"; + private static final String bundleName = "gnu.java.locale.LocaleInformation"; /** * get resource bundle: @@ -449,12 +457,27 @@ public abstract class Calendar { this.zone = zone; lenient = true; + String[] days = { "", "sun", "mon", "tue", "wed", "thu", "fri", "sat" }; ResourceBundle rb = getBundle(locale); + String min = (String) rb.getObject("minNumberOfDaysInFirstWeek"); + String first = (String) rb.getObject("firstDayOfWeek"); + try + { + if (min != null) + minimalDaysInFirstWeek = Integer.parseInt(min); + } + catch (NumberFormatException ex) + { + minimalDaysInFirstWeek = 1; + } + + firstDayOfWeek = 1; + if (first != null) + for (int i = 0; i < 8; i++) + if (days[i].equals(first)) + firstDayOfWeek = i; - firstDayOfWeek = ((Integer) rb.getObject("firstDayOfWeek")).intValue(); - minimalDaysInFirstWeek = ((Integer) rb.getObject("minimalDaysInFirstWeek")) - .intValue(); clear(); } @@ -514,15 +537,9 @@ public abstract class Calendar { if (calendarClass == null) { - ResourceBundle rb = getBundle(locale); - String calendarClassName = rb.getString("calendarClass"); - - if (calendarClassName != null) - { - calendarClass = Class.forName(calendarClassName); - if (Calendar.class.isAssignableFrom(calendarClass)) - cache.put(locale, calendarClass); - } + calendarClass = Class.forName(calendarClassName); + if (Calendar.class.isAssignableFrom(calendarClass)) + cache.put(locale, calendarClass); } // GregorianCalendar is by far the most common case. Optimize by @@ -707,6 +724,8 @@ public abstract class Calendar isSet[WEEK_OF_YEAR] = false; break; case WEEK_OF_MONTH: // pattern 2 + if (! isSet[DAY_OF_WEEK]) + fields[DAY_OF_WEEK] = getFirstDayOfWeek(); isSet[YEAR] = true; isSet[MONTH] = true; isSet[DAY_OF_WEEK] = true; @@ -716,6 +735,8 @@ public abstract class Calendar isSet[WEEK_OF_YEAR] = false; break; case DAY_OF_WEEK_IN_MONTH: // pattern 3 + if (! isSet[DAY_OF_WEEK]) + fields[DAY_OF_WEEK] = getFirstDayOfWeek(); isSet[YEAR] = true; isSet[MONTH] = true; isSet[DAY_OF_WEEK] = true; @@ -734,6 +755,8 @@ public abstract class Calendar isSet[DAY_OF_WEEK_IN_MONTH] = false; break; case WEEK_OF_YEAR: // pattern 5 + if (! isSet[DAY_OF_WEEK]) + fields[DAY_OF_WEEK] = getFirstDayOfWeek(); isSet[YEAR] = true; isSet[DAY_OF_WEEK] = true; isSet[MONTH] = false; diff --git a/java/util/GregorianCalendar.java b/java/util/GregorianCalendar.java index 13beed1af..1b214be60 100644 --- a/java/util/GregorianCalendar.java +++ b/java/util/GregorianCalendar.java @@ -145,14 +145,19 @@ public class GregorianCalendar extends Calendar /** * The point at which the Gregorian calendar rules were used. - * This is locale dependent; the default for most catholic - * countries is midnight (UTC) on October 5, 1582 (Julian), + * This may be changed by using setGregorianChange; + * The default is midnight (UTC) on October 5, 1582 (Julian), * or October 15, 1582 (Gregorian). * * @serial the changeover point from the Julian calendar * system to the Gregorian. */ - private long gregorianCutover; + private long gregorianCutover = (new Date((24 * 60 * 60 * 1000L) * (((1582 * (365 * 4 + + 1)) / 4 + + (java.util.Calendar.OCTOBER * (31 + + 30 + 31 + 30 + 31) - 9) / 5 + 5) + - ((1970 * (365 * 4 + 1)) / 4 + 1 + - 13)))).getTime(); /** * For compatability with Sun's JDK. @@ -160,11 +165,6 @@ public class GregorianCalendar extends Calendar static final long serialVersionUID = -8125100834729963327L; /** - * The name of the resource bundle. Used only by getBundle() - */ - private static final String bundleName = "gnu.java.locale.Calendar"; - - /** * Days in the epoch. Relative Jan 1, year '0' which is not a leap year. * (although there is no year zero, this does not matter.) * This is consistent with the formula: @@ -236,10 +236,6 @@ public class GregorianCalendar extends Calendar private GregorianCalendar(TimeZone zone, Locale locale, boolean unused) { super(zone, locale); - ResourceBundle rb = ResourceBundle.getBundle(bundleName, locale, - ClassLoader - .getSystemClassLoader()); - gregorianCutover = ((Date) rb.getObject("gregorianCutOver")).getTime(); } /** @@ -478,7 +474,7 @@ public class GregorianCalendar extends Calendar if (isSet[AM_PM] && fields[AM_PM] != AM && fields[AM_PM] != PM) throw new IllegalArgumentException("Illegal AM_PM."); - if (isSet[HOUR] && (fields[HOUR] < 0 || fields[HOUR] > 12)) + if (isSet[HOUR] && (fields[HOUR] < 0 || fields[HOUR] > 11)) throw new IllegalArgumentException("Illegal HOUR."); if (isSet[HOUR_OF_DAY] && (fields[HOUR_OF_DAY] < 0 || fields[HOUR_OF_DAY] > 23)) @@ -564,10 +560,18 @@ public class GregorianCalendar extends Calendar // 3: YEAR + MONTH + DAY_OF_WEEK_IN_MONTH + DAY_OF_WEEK if (isSet[DAY_OF_WEEK_IN_MONTH]) { + if (fields[DAY_OF_WEEK_IN_MONTH] < 0) + { + month++; + first = getFirstDayOfMonth(year, month); + day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH]); + } + else + day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); + int offs = fields[DAY_OF_WEEK] - first; if (offs < 0) offs += 7; - day = 1 + 7 * (fields[DAY_OF_WEEK_IN_MONTH] - 1); day += offs; } else @@ -584,7 +588,7 @@ public class GregorianCalendar extends Calendar day = offs + 7 * (fields[WEEK_OF_MONTH] - 1); offs = fields[DAY_OF_WEEK] - getFirstDayOfWeek(); - if (offs < 0) + if (offs <= 0) offs += 7; day += offs; } @@ -602,11 +606,7 @@ public class GregorianCalendar extends Calendar { hour = fields[HOUR]; if (fields[AM_PM] == PM) - if (hour != 12) /* not Noon */ - hour += 12; - /* Fix the problem of the status of 12:00 AM (midnight). */ - if (fields[AM_PM] == AM && hour == 12) - hour = 0; + hour += 12; } else hour = fields[HOUR_OF_DAY]; @@ -858,7 +858,7 @@ public class GregorianCalendar extends Calendar int hourOfDay = millisInDay / (60 * 60 * 1000); fields[AM_PM] = (hourOfDay < 12) ? AM : PM; int hour = hourOfDay % 12; - fields[HOUR] = (hour == 0) ? 12 : hour; + fields[HOUR] = hour; fields[HOUR_OF_DAY] = hourOfDay; millisInDay %= (60 * 60 * 1000); fields[MINUTE] = millisInDay / (60 * 1000); @@ -926,10 +926,7 @@ public class GregorianCalendar extends Calendar isTimeSet = false; int maxDay = getActualMaximum(DAY_OF_MONTH); if (fields[DAY_OF_MONTH] > maxDay) - { - fields[DAY_OF_MONTH] = maxDay; - isTimeSet = false; - } + fields[DAY_OF_MONTH] = maxDay; break; case DAY_OF_MONTH: case DAY_OF_YEAR: diff --git a/java/util/LocaleData.java b/java/util/LocaleData.java new file mode 100644 index 000000000..f6f355013 --- /dev/null +++ b/java/util/LocaleData.java @@ -0,0 +1,323 @@ +/* LocaleData.java -- + Copyright (C) 2004 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package java.util; + +// This file was automatically generated by scripts/generate-locale-list.sh + + +class LocaleData +{ + public static String[] localeNames = + { + "aa_DJ", + "aa_ER", + "aa_ER_SAAHO", + "aa_ET", + "aa", + "af", + "af_ZA", + "am_ET", + "am", + "ar_DZ", + "ar_IN", + "ar_IQ", + "ar", + "ar_JO", + "ar_KW", + "ar_LB", + "ar_LY", + "ar_MA", + "ar_QA", + "ar_SA", + "ar_SY", + "ar_TN", + "ar_YE", + "as_IN", + "as", + "az_Cyrl", + "az", + "be_BY", + "be", + "bg_BG", + "bg", + "bn_IN", + "bn", + "br_FR", + "bs_BA", + "byn_ER", + "byn", + "ca_ES", + "ca", + "cs_CZ", + "cs", + "cy_GB", + "cy", + "da_DK", + "da", + "de_AT", + "de_BE", + "de_CH", + "de_DE", + "de", + "de_LI", + "de_LU", + "dv", + "dv_MV", + "dz_BT", + "dz", + "el_GR", + "el", + "en_AS", + "en_AU", + "en_BE", + "en_BW", + "en_BZ", + "en_CA", + "en_DK", + "en_GB", + "en_GU", + "en_HK", + "en_IE", + "en_IN", + "en", + "en_MH", + "en_MP", + "en_MT", + "en_NZ", + "en_PH", + "en_PK", + "en_SG", + "en_UM", + "en_US", + "en_US_POSIX", + "en_VI", + "en_ZA", + "en_ZW", + "eo", + "es_AR", + "es_BO", + "es_CL", + "es_CO", + "es_CR", + "es_DO", + "es_EC", + "es_ES", + "es_GT", + "es_HN", + "es", + "es_MX", + "es_NI", + "es_PA", + "es_PE", + "es_PR", + "es_PY", + "es_SV", + "es_US", + "es_UY", + "es_VE", + "et_EE", + "et", + "eu_ES", + "eu", + "fa_AF", + "fa_IR", + "fa", + "fi_FI", + "fi", + "fo_FO", + "fo", + "fr_BE", + "fr_CA", + "fr_CH", + "fr", + "fr_LU", + "ga_IE", + "ga", + "gez_ER", + "gez_ET", + "gez", + "gl_ES", + "gl", + "gu_IN", + "gu", + "gv_GB", + "gv", + "haw", + "haw_US", + "he_IL", + "he", + "hi_IN", + "hi", + "hr", + "hu_HU", + "hu", + "hy_AM", + "hy_AM_REVISED", + "hy", + "id_ID", + "id", + "is_IS", + "is", + "it_CH", + "it_IT", + "it", + "iu", + "iw_IL", + "ja", + "ja_JP", + "ka", + "kk", + "kk_KZ", + "kl_GL", + "kl", + "km", + "km_KH", + "kn_IN", + "kn", + "ko", + "kok_IN", + "kok", + "ko_KR", + "kw_GB", + "kw", + "ky", + "lo", + "lo_LA", + "lt", + "lt_LT", + "lv", + "lv_LV", + "mk", + "ml_IN", + "ml", + "mn", + "mn_MN", + "mr_IN", + "mr", + "ms_BN", + "ms", + "ms_MY", + "mt", + "mt_MT", + "nb", + "nb_NO", + "nl_BE", + "nl", + "nl_NL", + "nn", + "nn_NO", + "no_NO", + "oc_FR", + "om_ET", + "om", + "om_KE", + "or_IN", + "or", + "pa_IN", + "pa", + "pl", + "pl_PL", + "ps_AF", + "ps", + "pt_BR", + "pt", + "pt_PT", + "ro", + "ro_RO", + "ru", + "ru_RU", + "ru_UA", + "sa_IN", + "sa", + "se_NO", + "sid_ET", + "sid", + "sk", + "sk_SK", + "sl", + "so_DJ", + "so_ET", + "so", + "so_KE", + "so_SO", + "sq_AL", + "sq", + "sr", + "sr_Latn", + "sv_FI", + "sv", + "sv_SE", + "sw", + "sw_KE", + "sw_TZ", + "syr", + "syr_SY", + "ta_IN", + "ta", + "te_IN", + "te", + "tg_TJ", + "th", + "th_TH", + "ti_ER", + "ti_ET", + "tig_ER", + "tig", + "ti", + "tr", + "tr_TR", + "tt", + "tt_RU", + "uk", + "uk_UA", + "ur", + "uz_AF", + "uz", + "vi", + "wal_ET", + "wal", + "zh_CN_Hans", + "zh_Hant", + "zh_HK_Hant", + "zh", + "zh_MO_Hant", + "zh_SG_Hans", + "zh_TW_Hant", + }; +} diff --git a/java/util/PropertyPermission.java b/java/util/PropertyPermission.java index ec2ca7aba..7b2667a39 100644 --- a/java/util/PropertyPermission.java +++ b/java/util/PropertyPermission.java @@ -1,5 +1,5 @@ /* PropertyPermission.java -- permission to get and set System properties - Copyright (C) 1999, 2000, 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 1999, 2000, 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -154,17 +154,18 @@ public final class PropertyPermission extends BasicPermission actions = WRITE; else if ("read,write".equals(str) || "write,read".equals(str)) actions = READ | WRITE; - else { - String lstr = str.toLowerCase(); - if ("read".equals(lstr)) - actions = READ; - else if ("write".equals(lstr)) - actions = WRITE; - else if ("read,write".equals(lstr) || "write,read".equals(lstr)) - actions = READ | WRITE; - else - throw new IllegalArgumentException("illegal action " + str); - } + else + { + String lstr = str.toLowerCase(); + if ("read".equals(lstr)) + actions = READ; + else if ("write".equals(lstr)) + actions = WRITE; + else if ("read,write".equals(lstr) || "write,read".equals(lstr)) + actions = READ | WRITE; + else + throw new IllegalArgumentException("illegal action " + str); + } } /** diff --git a/java/util/jar/JarFile.java b/java/util/jar/JarFile.java index c66881f19..cb2cbf490 100644 --- a/java/util/jar/JarFile.java +++ b/java/util/jar/JarFile.java @@ -726,7 +726,14 @@ public class JarFile extends ZipFile byte[] entryBytes = null; try { - entryBytes = readManifestEntry(super.getEntry(entry)); + ZipEntry e = super.getEntry(entry); + if (e == null) + { + if (DEBUG) + debug("verifyHashes: no entry '" + entry + "'"); + return false; + } + entryBytes = readManifestEntry(e); } catch (IOException ioe) { diff --git a/javax/swing/BoxLayout.java b/javax/swing/BoxLayout.java index 7b12602a9..edc9a6e47 100644 --- a/javax/swing/BoxLayout.java +++ b/javax/swing/BoxLayout.java @@ -42,6 +42,7 @@ import java.awt.Component; import java.awt.ComponentOrientation; import java.awt.Container; import java.awt.Dimension; +import java.awt.Insets; import java.awt.LayoutManager2; import java.io.Serializable; @@ -146,8 +147,9 @@ public class BoxLayout implements LayoutManager2, Serializable if (parent != container) throw new AWTError("invalid parent"); - int x = 0; - int y = 0; + Insets insets = parent.getInsets(); + int x = insets.left + insets.right; + int y = insets.bottom + insets.top; Component[] children = parent.getComponents(); @@ -191,8 +193,9 @@ public class BoxLayout implements LayoutManager2, Serializable if (parent != container) throw new AWTError("invalid parent"); - int x = 0; - int y = 0; + Insets insets = parent.getInsets(); + int x = insets.left + insets.right; + int y = insets.bottom + insets.top; Component[] children = parent.getComponents(); @@ -235,26 +238,30 @@ public class BoxLayout implements LayoutManager2, Serializable throw new AWTError("invalid parent"); Dimension size = parent.getSize(); - + Insets insets = parent.getInsets(); + Dimension innerSize = new Dimension(size.width - insets.left + - insets.right, size.height + - insets.bottom - insets.top); Component[] children = parent.getComponents(); if (isHorizontalIn(parent)) { - int x = 0; + int x = insets.left; for (int index = 0; index < children.length; index++) { Component comp = children[index]; Dimension sz = comp.getPreferredSize(); int width = sz.width; int height = sz.height; - int cy = 0; - if (height > size.height) + int cy = insets.top; + if (height > innerSize.height) { - height = size.height; + height = innerSize.height; } else { - cy = (int) ((size.height - height) * comp.getAlignmentY()); + cy = (int) ((innerSize.height - height) + * comp.getAlignmentY()); } comp.setSize(width, height); @@ -264,21 +271,21 @@ public class BoxLayout implements LayoutManager2, Serializable } else { - int y = 0; + int y = insets.top; for (int index = 0; index < children.length; index++) { Component comp = children[index]; Dimension sz = comp.getPreferredSize(); int width = sz.width; int height = sz.height; - int cx = 0; - if (width > size.width) + int cx = insets.left; + if (width > innerSize.width) { - width = size.width; + width = innerSize.width; } else { - cx = (int) ((size.width - width) * comp.getAlignmentX()); + cx = (int) ((innerSize.width - width) * comp.getAlignmentX()); } comp.setSize(width, height); @@ -352,8 +359,9 @@ public class BoxLayout implements LayoutManager2, Serializable if (parent != container) throw new AWTError("invalid parent"); - int x = 0; - int y = 0; + Insets insets = parent.getInsets(); + int x = insets.left + insets.right; + int y = insets.top + insets.bottom; Component[] children = parent.getComponents(); diff --git a/javax/swing/CellRendererPane.java b/javax/swing/CellRendererPane.java index 6e6c2cad0..0ef270bf8 100644 --- a/javax/swing/CellRendererPane.java +++ b/javax/swing/CellRendererPane.java @@ -50,11 +50,16 @@ import javax.accessibility.AccessibleContext; import javax.accessibility.AccessibleRole; /** - * CellRendererPane + * The CellRendererPane's purpose is to paint the cells of JList, JTable and + * JTree. It intercepts the usual paint tree, so that we don't walk up and + * repaint everything. + * * @author Andrew Selkirk * @version 1.0 */ -public class CellRendererPane extends Container implements Accessible +public class CellRendererPane + extends Container + implements Accessible { private static final long serialVersionUID = -7642183829532984273L; @@ -83,116 +88,162 @@ public class CellRendererPane extends Container implements Accessible } } - /** - * accessibleContext - */ - protected AccessibleContext accessibleContext = null; - - - //------------------------------------------------------------- - // Initialization --------------------------------------------- - //------------------------------------------------------------- - - /** - * Constructor CellRendererPane - */ - public CellRendererPane() { - // TODO - } // CellRendererPane() - - - //------------------------------------------------------------- - // Methods ---------------------------------------------------- - //------------------------------------------------------------- - - /** - * writeObject - * @param stream TODO - * @exception IOException TODO - */ - private void writeObject(ObjectOutputStream stream) throws IOException { - // TODO - } // writeObject() - - /** - * update - * @param graphics TODO - */ - public void update(Graphics graphics) { - // TODO - } // update() - - /** - * invalidate - */ - public void invalidate() { - // TODO - } // invalidate() - - /** - * paint - * @param graphics TODO - */ - public void paint(Graphics graphics) { - // TODO - } // paint() - - /** - * addImpl - * @param c TODO - * @param constraints TODO - * @param index TODO - */ - protected void addImpl(Component c, Object constraints, int index) { - // TODO - } // addImpl() - - /** - * paintComponent - * @param graphics TODO - * @param c TODO - * @param p TODO - * @param x TODO - * @param y TODO - * @param w TODO - * @param h TODO - * @param shouldValidate TODO - */ - public void paintComponent(Graphics graphics, Component c, - Container p, int x, int y, int w, int h, - boolean shouldValidate) { - // TODO - } // paintComponent() - - /** - * paintComponent - * @param graphics TODO - * @param c TODO - * @param p TODO - * @param x TODO - * @param y TODO - * @param w TODO - * @param h TODO - */ - public void paintComponent(Graphics graphics, Component c, - Container p, int x, int y, int w, int h) { - // TODO - } // paintComponent() - - /** - * paintComponent - * @param graphics TODO - * @param c TODO - * @param p TODO - * @param r TODO - */ - public void paintComponent(Graphics graphics, Component c, - Container p, Rectangle r) { - // TODO - } // paintComponent() + /** + * accessibleContext + */ + protected AccessibleContext accessibleContext = null; + + + //------------------------------------------------------------- + // Initialization --------------------------------------------- + //------------------------------------------------------------- + + /** + * Constructs a new CellRendererPane. + */ + public CellRendererPane() + { + } // CellRendererPane() + + + //------------------------------------------------------------- + // Methods ---------------------------------------------------- + //------------------------------------------------------------- + + /** + * Should not be called. + * + * @param graphics not used here + */ + public void update(Graphics graphics) + { + } // update() + + /** + * Despite normal behaviour this does <em>not</em> cause the container + * to be invalidated. This prevents propagating up the paint tree. + */ + public void invalidate() + { + } // invalidate() + + /** + * Should not be called. + * + * @param graphics not used here + */ + public void paint(Graphics graphics) + { + } + + /** + * Overridden to check if a component is already a child of this Container. + * If it's already a child, nothing is done. Otherwise we pass this to + * <code>super.addImpl()</code>. + * + * @param c the component to add + * @param constraints not used here + * @param index not used here + */ + protected void addImpl(Component c, Object constraints, int index) + { + if (!isAncestorOf(c)) + { + super.addImpl(c, constraints, index); + } + } // addImpl() + + /** + * Paints the specified component <code>c</code> on the {@link Graphics} + * context <code>graphics</code>. The Graphics context is tranlated to + * (x,y) and the components bounds are set to (w,h). If + * <code>shouldValidate</code> + * is set to true, then the component is validated before painting. + * + * @param graphics the graphics context to paint on + * @param c the component to be painted + * @param p the parent of the component + * @param x the X coordinate of the upper left corner where c should + be painted + * @param y the Y coordinate of the upper left corner where c should + be painted + * @param w the width of the components drawing area + * @param h the height of the components drawing area + * @param shouldValidate if <code>c</code> should be validated before + * painting + */ + public void paintComponent(Graphics graphics, Component c, + Container p, int x, int y, int w, int h, + boolean shouldValidate) + { + // reparent c + addImpl(c, null, 0); + + // translate to (x,y) + graphics.translate(x, y); + + // set bounds of c + c.setBounds(0, 0, w, h); + + // validate if necessary + if (shouldValidate) + { + c.validate(); + } + + // paint component + c.paint(graphics); + + // untranslate g + graphics.translate(-x, -y); + + } // paintComponent() + + /** + * Paints the specified component <code>c</code> on the {@link Graphics} + * context <code>graphics</code>. The Graphics context is tranlated to (x,y) + * and the components bounds are set to (w,h). The component is <em>not</em> + * validated before painting. + * + * @param graphics the graphics context to paint on + * @param c the component to be painted + * @param p the parent of the component + * @param x the X coordinate of the upper left corner where c should + be painted + * @param y the Y coordinate of the upper left corner where c should + be painted + * @param w the width of the components drawing area + * @param h the height of the components drawing area + */ + public void paintComponent(Graphics graphics, Component c, + Container p, int x, int y, int w, int h) { + + paintComponent(graphics, c, p, x, y, w, h, false); + + } // paintComponent() + + /** + * Paints the specified component <code>c</code> on the {@link Graphics} + * context <code>g</code>. The Graphics context is tranlated to (r.x,r.y) and + * the components bounds are set to (r.width,r.height). + * The component is <em>not</em> + * validated before painting. + * + * @param graphics the graphics context to paint on + * @param c the component to be painted + * @param p the component on which we paint + * @param r the bounding rectangle of c + */ + public void paintComponent(Graphics graphics, Component c, + Container p, Rectangle r) + { + + paintComponent(graphics, c, p, r.x, r.y, r.width, r.height); + + } // paintComponent() /** - * getAccessibleContext + * getAccessibleContext <em>TODO</em> * @return AccessibleContext */ public AccessibleContext getAccessibleContext() diff --git a/javax/swing/JComboBox.java b/javax/swing/JComboBox.java index 4e2a88110..078c77df4 100644 --- a/javax/swing/JComboBox.java +++ b/javax/swing/JComboBox.java @@ -185,6 +185,9 @@ public class JComboBox extends JComponent implements ItemSelectable, public JComboBox(Object[] itemArray) { this(new DefaultComboBoxModel(itemArray)); + + if (itemArray.length > 0) + setSelectedIndex(0); } /** @@ -195,6 +198,9 @@ public class JComboBox extends JComponent implements ItemSelectable, public JComboBox(Vector itemVector) { this(new DefaultComboBoxModel(itemVector)); + + if (itemVector.size() > 0) + setSelectedIndex(0); } /** diff --git a/javax/swing/JList.java b/javax/swing/JList.java index adb728924..d9e9fee7f 100644 --- a/javax/swing/JList.java +++ b/javax/swing/JList.java @@ -1029,32 +1029,20 @@ public class JList extends JComponent implements Accessible, Scrollable */ public Dimension getPreferredScrollableViewportSize() { - int vis = getVisibleRowCount(); - int nrows = getModel() == null ? 0 : getModel().getSize(); - // FIXME: this is a somewhat arbitrary default, but.. ? - Dimension single = new Dimension(10, 10);; - Rectangle bounds = null; - if (vis > nrows) + Dimension retVal = getPreferredSize(); + if (getLayoutOrientation() == VERTICAL) { - if (fixedCellWidth != -1 && - fixedCellHeight != -1) + if (fixedCellHeight != -1) { - single = new Dimension(fixedCellWidth, fixedCellHeight); - } - else if (nrows != 0 && getUI() != null) - { - Rectangle tmp = getUI().getCellBounds(this, 0, 0); - if (tmp != null) - single = tmp.getSize(); - } - } - else if (getUI() != null) - { - return getUI().getCellBounds(this, 0, vis - 1).getSize(); + if (fixedCellWidth != -1) + { + int size = getModel().getSize(); + retVal = new Dimension(fixedCellWidth, size * fixedCellHeight); + } // TODO: add else clause (preferredSize is ok for now) + } // TODO: add else clause (preferredSize is ok for now) } - - return new Dimension(single.width, single.height * vis); + return retVal; } /** @@ -1193,7 +1181,19 @@ public class JList extends JComponent implements Accessible, Scrollable */ public boolean getScrollableTracksViewportWidth() { - return false; + Component parent = getParent(); + boolean retVal = false; + if (parent instanceof JViewport) + { + JViewport viewport = (JViewport) parent; + Dimension pref = getPreferredSize(); + if (viewport.getSize().width > pref.width) + retVal = true; + if ((getLayoutOrientation() == HORIZONTAL_WRAP) + && (getVisibleRowCount() <= 0)) + retVal = true; + } + return retVal; } /** @@ -1206,7 +1206,19 @@ public class JList extends JComponent implements Accessible, Scrollable */ public boolean getScrollableTracksViewportHeight() { - return false; + Component parent = getParent(); + boolean retVal = false; + if (parent instanceof JViewport) + { + JViewport viewport = (JViewport) parent; + Dimension pref = getPreferredSize(); + if (viewport.getSize().height > pref.height) + retVal = true; + if ((getLayoutOrientation() == VERTICAL_WRAP) + && (getVisibleRowCount() <= 0)) + retVal = true; + } + return retVal; } public int getAnchorSelectionIndex() diff --git a/javax/swing/JTextArea.java b/javax/swing/JTextArea.java index 3510e6dea..87b0721e3 100644 --- a/javax/swing/JTextArea.java +++ b/javax/swing/JTextArea.java @@ -469,12 +469,13 @@ public class JTextArea extends JTextComponent try { - doc.remove(start, end); - doc.insertString(start, text, null); + doc.remove(start, end - start); + doc.insertString(start, text, null); } catch (BadLocationException e) { - // This cannot happen as we check offset above. + // This cannot happen as we check offset above. + throw new Error("Please report a bug", e); } } } diff --git a/javax/swing/Timer.java b/javax/swing/Timer.java index 0906b8d93..ba29cf312 100644 --- a/javax/swing/Timer.java +++ b/javax/swing/Timer.java @@ -1,5 +1,5 @@ /* Timer.java -- - Copyright (C) 2002, 2004 Free Software Foundation, Inc. + Copyright (C) 2002, 2004, 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -46,33 +46,70 @@ import java.util.EventListener; import javax.swing.event.EventListenerList; /** - * DOCUMENT ME! + * Fires one or more action events after the specified delay. + * @author Ronald Veldema + * @author Audrius Meskauskas (audriusa@Bionformatics.org) - bug fixes + * and documentation comments */ -public class Timer implements Serializable +public class Timer + implements Serializable { - /** DOCUMENT ME! */ - private static final long serialVersionUID = -1116180831621385484L; - - /** DOCUMENT ME! */ - protected EventListenerList listenerList = new EventListenerList(); - - // This object manages a "queue" of virtual actionEvents, maintained as a - // simple long counter. When the timer expires, a new event is queued, - // and a dispatcher object is pushed into the system event queue. When - // the system thread runs the dispatcher, it will fire as many - // ActionEvents as have been queued, unless the timer is set to - // coalescing mode, in which case it will fire only one ActionEvent. - - /** DOCUMENT ME! */ - private long queue; - - /** DOCUMENT ME! */ - private Object queueLock = new Object(); + /** + * The timer thread + */ + private class Waker + extends Thread + { + /** + * Fires events, pausing for required intervals. + */ + public void run() + { + running = true; + try + { + sleep(initialDelay); + + queueEvent(); + + while (running) + { + try + { + sleep(delay); + } + catch (InterruptedException e) + { + return; + } + queueEvent(); + + if (logTimers) + System.out.println("javax.swing.Timer -> clocktick"); + + if ( ! repeats) + break; + } + running = false; + } + catch (Exception e) + { + // The timer is no longer running. + running = false; + } + } + } - /** DOCUMENT ME! */ - private Waker waker; + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1116180831621385484L; - private Runnable drainer = new Runnable() + /** + * The encloding class, used with {@link SwingUtilities#invokeLater} + * to invoke the {@link #drainEvents()}. + */ + private Runnable drainer = new Runnable() { public void run() { @@ -81,165 +118,136 @@ public class Timer implements Serializable }; /** - * DOCUMENT ME! + * If <code>true</code>, the timer prints a message to + * {@link System#out} when firing each event. */ - private void queueEvent() - { - synchronized (queueLock) - { - queue++; - if (queue == 1) - SwingUtilities.invokeLater(drainer); - } - } + static boolean logTimers; /** - * DOCUMENT ME! + * A field to store all listeners who are listening to this timer. */ - private void drainEvents() - { - synchronized (queueLock) - { - if (isCoalesce()) - { - if (queue > 0) - fireActionPerformed(); - } - else - { - while (queue > 0) - { - fireActionPerformed(); - queue--; - } - } - queue = 0; - } - } - - static boolean logTimers; + protected EventListenerList listenerList = new EventListenerList(); - /** DOCUMENT ME! */ + /** + * <code>true</code> if the timer coalesces events. + */ boolean coalesce = true; - /** DOCUMENT ME! */ + /** + * <code>true</code> if the timer is firing repetetive events. + */ boolean repeats = true; - /** DOCUMENT ME! */ + /** + * <code>true</code> if the timer is currently active, firing events + * as scheduled. + */ boolean running; - /** DOCUMENT ME! */ - int ticks; - - /** DOCUMENT ME! */ + /** + * The delay between subsequent repetetive events. + */ int delay; - /** DOCUMENT ME! */ + /** + * The initial delay before the first event. + */ int initialDelay; /** - * DOCUMENT ME! + * The number of events that have been already fired by this timer. + * This is used as a numeric identifier for the next event that would + * be fired. */ - private class Waker extends Thread - { - /** - * DOCUMENT ME! - */ - public void run() - { - running = true; - try - { - sleep(initialDelay); - - while (running) - { - try - { - sleep(delay); - } - catch (InterruptedException e) - { - return; - } - queueEvent(); - - if (logTimers) - System.out.println("javax.swing.Timer -> clocktick"); - - if (! repeats) - break; - } - running = false; - } - catch (Exception e) - { -// System.out.println("swing.Timer::" + e); - } - } - } + int ticks; + + /** + * Stores the thread that posts events to the queue at required time + * intervals. + */ + private Waker waker; + + /** + * This object manages a "queue" of virtual actionEvents, maintained as a + * simple long counter. When the timer expires, a new event is queued, + * and a dispatcher object is pushed into the system event queue. When + * the system thread runs the dispatcher, it will fire as many + * ActionEvents as have been queued, unless the timer is set to + * coalescing mode, in which case it will fire only one ActionEvent. + */ + private long queue; + + /** + * <code>synchronized(queueLock)</code> replaces + * <code>synchronized(queue)</code> that is not supported by this language. + */ + private Object queueLock = new Object(); /** * Creates a new Timer object. * - * @param d DOCUMENT ME! - * @param listener DOCUMENT ME! + * @param d the default value for both initial and between event delay, in + * milliseconds. + * @param listener the first action listener, can be <code>null</code>. */ public Timer(int d, ActionListener listener) { delay = d; + initialDelay = d; if (listener != null) addActionListener(listener); } /** - * DOCUMENT ME! + * Get the array of action listeners. * - * @param c DOCUMENT ME! - */ - public void setCoalesce(boolean c) - { - coalesce = c; - } - - /** - * DOCUMENT ME! + * @return the array of action listeners that are listening for the events, + * fired by this timer * - * @return DOCUMENT ME! + * @since 1.4 */ - public boolean isCoalesce() + public ActionListener[] getActionListeners() { - return coalesce; + return (ActionListener[]) listenerList.getListeners(ActionListener.class); } /** - * DOCUMENT ME! + * Sets whether the Timer coalesces multiple pending event firings. + * If the coalescing is enabled, the multiple events that have not been + * fired on time are replaced by the single event. The events may not + * be fired on time if the application is busy. * - * @param listener DOCUMENT ME! + * @param c <code>true</code> (default) to enable the event coalescing, + * <code>false</code> otherwise */ - public void addActionListener(ActionListener listener) + public void setCoalesce(boolean c) { - listenerList.add(ActionListener.class, listener); + coalesce = c; } /** - * DOCUMENT ME! + * Checks if the Timer coalesces multiple pending event firings. + * If the coalescing is enabled, the multiple events that have not been + * fired on time are replaced by the single event. The events may not + * be fired on time if the application is busy. * - * @param listener DOCUMENT ME! + * @return <code>true</code> if the coalescing is enabled, + * <code>false</code> otherwise */ - public void removeActionListener(ActionListener listener) + public boolean isCoalesce() { - listenerList.remove(ActionListener.class, listener); + return coalesce; } /** - * DOCUMENT ME! - * - * @param listenerType DOCUMENT ME! + * Get the event listeners of the given type that are listening for the + * events, fired by this timer. * - * @return DOCUMENT ME! + * @param listenerType the listener type (for example, ActionListener.class) * + * @return the array of event listeners that are listening for the events, + * fired by this timer * @since 1.3 */ public EventListener[] getListeners(Class listenerType) @@ -248,42 +256,12 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! - * - * @return DOCUMENT ME! - * - * @since 1.4 - */ - public ActionListener[] getActionListeners() - { - return (ActionListener[]) listenerList.getListeners(ActionListener.class); - } - - /** - * DOCUMENT ME! - * - * @param event DOCUMENT ME! - */ - protected void fireActionPerformed(ActionEvent event) - { - ActionListener[] listeners = getActionListeners(); - - for (int i = 0; i < listeners.length; i++) - listeners[i].actionPerformed(event); - } - - /** - * DOCUMENT ME! - */ - void fireActionPerformed() - { - fireActionPerformed(new ActionEvent(this, ticks++, "Timer")); - } - - /** - * DOCUMENT ME! + * Set the timer logging state. If it is set to <code>true</code>, the + * timer prints a message to {@link System#out} when firing each + * action event. * - * @param lt DOCUMENT ME! + * @param lt <code>true</code> if logging is enabled, <code>false</code> + * (default value) otherwise */ public static void setLogTimers(boolean lt) { @@ -291,9 +269,11 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Return the logging state. * - * @return DOCUMENT ME! + * @return <code>true</code> if the timer is printing a message to + * {@link System#out} + * when firing each action event */ public static boolean getLogTimers() { @@ -301,9 +281,11 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Set the delay between firing the subsequent events. + * This parameter does not change the value of the initial delay before + * firing the first event. * - * @param d DOCUMENT ME! + * @param d The time gap between the subsequent events, in milliseconds */ public void setDelay(int d) { @@ -311,9 +293,9 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Get the delay between firing the subsequent events. * - * @return DOCUMENT ME! + * @return The delay between subsequent events, in milliseconds */ public int getDelay() { @@ -321,9 +303,12 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Set the intial delay before firing the first event since calling + * the {@link #start()} method. If the initial delay has not been + * set, it is assumed having the same value as the delay between the + * subsequent events. * - * @param i DOCUMENT ME! + * @param i the initial delay, in milliseconds */ public void setInitialDelay(int i) { @@ -331,9 +316,11 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Get the intial delay before firing the first event since calling + * the {@link #start()} method. If the initial delay has not been + * set, returns the same value as {@link #getDelay()}. * - * @return DOCUMENT ME! + * @return the initial delay before firing the first action event. */ public int getInitialDelay() { @@ -341,9 +328,11 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Enable firing the repetetive events. * - * @param r DOCUMENT ME! + * @param r <code>true</code> (default value) to fire repetetive events. + * <code>false</code> to fire + * only one event after the initial delay */ public void setRepeats(boolean r) { @@ -351,9 +340,11 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Check is this timer fires repetetive events. * - * @return DOCUMENT ME! + * @return <code>true</code> if the timer fires repetetive events, + * <code>false</code> if it fires + * only one event after the initial delay */ public boolean isRepeats() { @@ -361,9 +352,11 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Get the timer state. * - * @return DOCUMENT ME! + * @return <code>true</code> if the timer has been started and is firing + * the action events as scheduled. <code>false</code> + * if the timer is inactive. */ public boolean isRunning() { @@ -371,18 +364,28 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Add the action listener + * + * @param listener the action listener to add */ - public void start() + public void addActionListener(ActionListener listener) { - if (isRunning()) - return; - waker = new Waker(); - waker.start(); + listenerList.add(ActionListener.class, listener); + } + + /** + * Remove the action listener. + * + * @param listener the action listener to remove + */ + public void removeActionListener(ActionListener listener) + { + listenerList.remove(ActionListener.class, listener); } /** - * DOCUMENT ME! + * Cancel all pending tasks and fire the first event after the initial + * delay. */ public void restart() { @@ -391,7 +394,18 @@ public class Timer implements Serializable } /** - * DOCUMENT ME! + * Start firing the action events. + */ + public void start() + { + if (isRunning()) + return; + waker = new Waker(); + waker.start(); + } + + /** + * Stop firing the action events. */ public void stop() { @@ -400,7 +414,70 @@ public class Timer implements Serializable waker.interrupt(); synchronized (queueLock) { - queue = 0; + queue = 0; + } + } + + /** + * Fire the given action event to the action listeners. + * + * @param event the event to fire + */ + protected void fireActionPerformed(ActionEvent event) + { + ActionListener[] listeners = getActionListeners(); + + for (int i = 0; i < listeners.length; i++) + listeners [ i ].actionPerformed(event); + } + + /** + * Fire the action event, named "Timer" and having the numeric + * identifier, equal to the numer of events that have been + * already fired before. + */ + void fireActionPerformed() + { + fireActionPerformed(new ActionEvent(this, ticks++, "Timer")); + } + + /** + * Fire the queued action events. + * In the coalescing mode, a single event is fired as a replacement + * for all queued events. In non coalescing mode, a series of + * all queued events is fired. + */ + private void drainEvents() + { + synchronized (queueLock) + { + if (isCoalesce()) + { + if (queue > 0) + fireActionPerformed(); + } + else + { + while (queue > 0) + { + fireActionPerformed(); + queue--; + } + } + queue = 0; + } + } + + /** + * Post a scheduled event to the event queue. + */ + private void queueEvent() + { + synchronized (queueLock) + { + queue++; + if (queue == 1) + SwingUtilities.invokeLater(drainer); } } } diff --git a/javax/swing/plaf/basic/BasicListUI.java b/javax/swing/plaf/basic/BasicListUI.java index b39421798..8cb0cb4c6 100644 --- a/javax/swing/plaf/basic/BasicListUI.java +++ b/javax/swing/plaf/basic/BasicListUI.java @@ -44,14 +44,19 @@ import java.awt.Dimension; import java.awt.Graphics; import java.awt.Point; import java.awt.Rectangle; +import java.awt.event.ComponentAdapter; +import java.awt.event.ComponentEvent; +import java.awt.event.ComponentListener; import java.awt.event.FocusEvent; import java.awt.event.FocusListener; import java.awt.event.MouseEvent; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; +import javax.swing.CellRendererPane; import javax.swing.JComponent; import javax.swing.JList; +import javax.swing.JViewport; import javax.swing.ListCellRenderer; import javax.swing.ListModel; import javax.swing.ListSelectionModel; @@ -71,11 +76,27 @@ import javax.swing.plaf.ListUI; */ public class BasicListUI extends ListUI { + + /** + * A helper class which listens for {@link ComponentEvent}s from + * the JList. + */ + private class ComponentHandler extends ComponentAdapter { + + /** + * Called when the component is hidden. Invalidates the internal + * layout. + */ + public void componentResized(ComponentEvent ev) { + BasicListUI.this.damageLayout(); + } + } + /** * A helper class which listens for {@link FocusEvents} * from the JList. */ - class FocusHandler implements FocusListener + public class FocusHandler implements FocusListener { /** * Called when the JList acquires focus. @@ -112,7 +133,7 @@ public class BasicListUI extends ListUI * * @see javax.swing.JList#model */ - class ListDataHandler implements ListDataListener + public class ListDataHandler implements ListDataListener { /** * Called when a general change has happened in the model which cannot @@ -150,7 +171,7 @@ public class BasicListUI extends ListUI * A helper class which listens for {@link ListSelectionEvent}s * from the {@link JList}'s {@link ListSelectionModel}. */ - class ListSelectionHandler implements ListSelectionListener + public class ListSelectionHandler implements ListSelectionListener { /** * Called when the list selection changes. @@ -166,7 +187,7 @@ public class BasicListUI extends ListUI * A helper class which listens for {@link MouseEvent}s * from the {@link JList}. */ - class MouseInputHandler implements MouseInputListener + public class MouseInputHandler implements MouseInputListener { /** * Called when a mouse button press/release cycle completes @@ -186,11 +207,12 @@ public class BasicListUI extends ListUI */ public void mousePressed(MouseEvent event) { - int row = BasicListUI.this.convertYToRow(event.getY()); - if (row == -1) + Point click = event.getPoint(); + int index = BasicListUI.this.locationToIndex(list, click); + if (index == -1) return; - BasicListUI.this.list.setSelectedIndex(row); + BasicListUI.this.list.setSelectedIndex(index); } /** @@ -248,7 +270,7 @@ public class BasicListUI extends ListUI * Helper class which listens to {@link PropertyChangeEvent}s * from the {@link JList}. */ - class PropertyChangeHandler implements PropertyChangeListener + public class PropertyChangeHandler implements PropertyChangeListener { /** * Called when the {@link JList} changes one of its bound properties. @@ -282,41 +304,50 @@ public class BasicListUI extends ListUI } /** The current focus listener. */ - FocusHandler focusListener; + protected FocusHandler focusListener; /** The data listener listening to the model. */ - ListDataHandler listDataListener; + protected ListDataHandler listDataListener; /** The selection listener listening to the selection model. */ - ListSelectionHandler listSelectionListener; + protected ListSelectionHandler listSelectionListener; /** The mouse listener listening to the list. */ - MouseInputHandler mouseInputListener; + protected MouseInputHandler mouseInputListener; /** The property change listener listening to the list. */ - PropertyChangeHandler propertyChangeListener; + protected PropertyChangeHandler propertyChangeListener; + + /** The component listener that receives notification for resizing the + * JList component.*/ + private ComponentListener componentListener; /** Saved reference to the list this UI was created for. */ - JList list; + protected JList list; /** The height of a single cell in the list. */ - int cellHeight; + protected int cellHeight; /** The width of a single cell in the list. */ - int cellWidth; + protected int cellWidth; /** * An array of varying heights of cells in the list, in cases where each * cell might have a different height. */ - int[] cellHeights; + protected int[] cellHeights; /** * A simple counter. When nonzero, indicates that the UI class is out of * date with respect to the underlying list, and must recalculate the * list layout before painting or performing size calculations. */ - int updateLayoutStateNeeded; + protected int updateLayoutStateNeeded; + + /** + * The {@link CellRendererPane} that is used for painting. + */ + protected CellRendererPane rendererPane; /** * Calculate the height of a particular row. If there is a fixed {@link @@ -328,7 +359,7 @@ public class BasicListUI extends ListUI * * @return The height, in pixels, of the specified row */ - int getRowHeight(int row) + protected int getRowHeight(int row) { if (row < 0 || row >= cellHeights.length) return -1; @@ -356,14 +387,21 @@ public class BasicListUI extends ListUI if (l != list || cellWidth == -1) return null; - int lo = Math.min(index1, index2); - int hi = Math.max(index1, index2); - Rectangle lobounds = new Rectangle(0, convertRowToY(lo), cellWidth, - getRowHeight(lo)); - Rectangle hibounds = new Rectangle(0, convertRowToY(hi), cellWidth, - getRowHeight(hi)); + int minIndex = Math.min(index1, index2); + int maxIndex = Math.max(index1, index2); + Point loc = indexToLocation(list, minIndex); + Rectangle bounds = new Rectangle(loc.x, loc.y, cellWidth, + getRowHeight(minIndex)); - return lobounds.union(hibounds); + for (int i = minIndex + 1; i <= maxIndex; i++) + { + Point hiLoc = indexToLocation(list, i); + Rectangle hibounds = new Rectangle(hiLoc.x, hiLoc.y, cellWidth, + getRowHeight(i)); + bounds = bounds.union(hibounds); + } + + return bounds; } /** @@ -376,7 +414,7 @@ public class BasicListUI extends ListUI * @return The Y coordinate of the specified row, or <code>-1</code> if * the specified row number is invalid */ - int convertRowToY(int row) + protected int convertRowToY(int row) { int y = 0; for (int i = 0; i < row; ++i) @@ -399,7 +437,7 @@ public class BasicListUI extends ListUI * @return The row number containing the specified Y value, or <code>-1</code> * if the specified Y coordinate is invalid */ - int convertYToRow(int y0) + protected int convertYToRow(int y0) { for (int row = 0; row < cellHeights.length; ++row) { @@ -417,7 +455,7 @@ public class BasicListUI extends ListUI * #cellWidth} properties by examining the variouis properties of the * {@link JList}. */ - void updateLayoutState() + protected void updateLayoutState() { int nrows = list.getModel().getSize(); cellHeight = -1; @@ -436,7 +474,11 @@ public class BasicListUI extends ListUI false); Dimension dim = flyweight.getPreferredSize(); cellHeights[i] = dim.height; + // compute average cell height (little hack here) + cellHeight = (cellHeight * i + cellHeights[i]) / (i + 1); cellWidth = Math.max(cellWidth, dim.width); + if (list.getLayoutOrientation() == JList.VERTICAL) + cellWidth = Math.max(cellWidth, list.getSize().width); } } else @@ -452,7 +494,7 @@ public class BasicListUI extends ListUI * * @see #updateLayoutStateNeeded */ - void damageLayout() + private void damageLayout() { updateLayoutStateNeeded = 1; list.revalidate(); @@ -462,7 +504,7 @@ public class BasicListUI extends ListUI * Calls {@link #updateLayoutState} if {@link #updateLayoutStateNeeded} * is nonzero, then resets {@link #updateLayoutStateNeeded} to zero. */ - void maybeUpdateLayoutState() + protected void maybeUpdateLayoutState() { if (updateLayoutStateNeeded != 0) { @@ -481,7 +523,9 @@ public class BasicListUI extends ListUI listSelectionListener = new ListSelectionHandler(); mouseInputListener = new MouseInputHandler(); propertyChangeListener = new PropertyChangeHandler(); + componentListener = new ComponentHandler(); updateLayoutStateNeeded = 1; + rendererPane = new CellRendererPane(); } /** @@ -490,7 +534,7 @@ public class BasicListUI extends ListUI * * @see #uninstallDefaults */ - void installDefaults() + protected void installDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); list.setForeground(defaults.getColor("List.foreground")); @@ -504,7 +548,7 @@ public class BasicListUI extends ListUI * Resets to <code>null</code> those defaults which were installed in * {@link #installDefaults} */ - void uninstallDefaults() + protected void uninstallDefaults() { UIDefaults defaults = UIManager.getLookAndFeelDefaults(); list.setForeground(null); @@ -519,7 +563,7 @@ public class BasicListUI extends ListUI * * @see #uninstallListeners */ - void installListeners() + protected void installListeners() { list.addFocusListener(focusListener); list.getModel().addListDataListener(listDataListener); @@ -527,12 +571,13 @@ public class BasicListUI extends ListUI list.addMouseListener(mouseInputListener); list.addMouseMotionListener(mouseInputListener); list.addPropertyChangeListener(propertyChangeListener); + list.addComponentListener(componentListener); } /** * Detaches all the listeners we attached in {@link #installListeners}. */ - void uninstallListeners() + protected void uninstallListeners() { list.removeFocusListener(focusListener); list.getModel().removeListDataListener(listDataListener); @@ -545,14 +590,14 @@ public class BasicListUI extends ListUI /** * Installs keyboard actions for this UI in the {@link JList}. */ - void installKeyboardActions() + protected void installKeyboardActions() { } /** * Uninstalls keyboard actions for this UI in the {@link JList}. */ - void uninstallKeyboardActions() + protected void uninstallKeyboardActions() { } @@ -591,18 +636,6 @@ public class BasicListUI extends ListUI } /** - * Gets the maximum size this list can assume. - * - * @param c The component to measure the size of - * - * @return A new Dimension representing the component's maximum size - */ - public Dimension getMaximumSize(JComponent c) - { - return new Dimension(Integer.MAX_VALUE, Integer.MAX_VALUE); - } - - /** * Gets the size this list would prefer to assume. This is calculated by * calling {@link #getCellBounds} over the entire list. * @@ -612,10 +645,34 @@ public class BasicListUI extends ListUI */ public Dimension getPreferredSize(JComponent c) { - if (list.getModel().getSize() == 0) + int size = list.getModel().getSize(); + if (size == 0) return new Dimension(0, 0); + int visibleRows = list.getVisibleRowCount(); + int layoutOrientation = list.getLayoutOrientation(); Rectangle bounds = getCellBounds(list, 0, list.getModel().getSize() - 1); - return bounds.getSize(); + Dimension retVal = bounds.getSize(); + Component parent = list.getParent(); + if ((visibleRows == -1) && (parent instanceof JViewport)) + { + JViewport viewport = (JViewport) parent; + + if (layoutOrientation == JList.HORIZONTAL_WRAP) + { + int h = viewport.getSize().height; + int cellsPerCol = h / cellHeight; + int w = size / cellsPerCol * cellWidth; + retVal = new Dimension(w, h); + } + else if (layoutOrientation == JList.VERTICAL_WRAP) + { + int w = viewport.getSize().width; + int cellsPerRow = Math.max(w / cellWidth, 1); + int h = size / cellsPerRow * cellHeight; + retVal = new Dimension(w, h); + } + } + return retVal; } /** @@ -625,7 +682,7 @@ public class BasicListUI extends ListUI * @param g The graphics context to paint in * @param c The component to paint the background of */ - public void paintBackground(Graphics g, JComponent c) + private void paintBackground(Graphics g, JComponent c) { Dimension size = getPreferredSize(c); Color save = g.getColor(); @@ -647,18 +704,18 @@ public class BasicListUI extends ListUI * @param sel A selection model to provide to the cell renderer * @param lead The lead selection index of the list */ - void paintCell(Graphics g, int row, Rectangle bounds, ListCellRenderer rend, - ListModel data, ListSelectionModel sel, int lead) + protected void paintCell(Graphics g, int row, Rectangle bounds, + ListCellRenderer rend, ListModel data, + ListSelectionModel sel, int lead) { boolean is_sel = list.isSelectedIndex(row); boolean has_focus = false; Component comp = rend.getListCellRendererComponent(list, data.getElementAt(row), 0, is_sel, has_focus); - g.translate(bounds.x, bounds.y); - comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height)); - comp.paint(g); - g.translate(-bounds.x, -bounds.y); + //comp.setBounds(new Rectangle(0, 0, bounds.width, bounds.height)); + //comp.paint(g); + rendererPane.paintComponent(g, comp, list, bounds); } /** @@ -690,13 +747,123 @@ public class BasicListUI extends ListUI } } + /** + * Computes the index of a list cell given a point within the list. + * + * @param list the list which on which the computation is based on + * @param location the coordinates + * + * @return the index of the list item that is located at the given + * coordinates or <code>null</code> if the location is invalid + */ public int locationToIndex(JList list, Point location) { - return convertYToRow(location.y); + int layoutOrientation = list.getLayoutOrientation(); + int index = -1; + switch (layoutOrientation) + { + case JList.VERTICAL: + index = convertYToRow(location.y); + break; + case JList.HORIZONTAL_WRAP: + // determine visible rows and cells per row + int visibleRows = list.getVisibleRowCount(); + int cellsPerRow = -1; + int numberOfItems = list.getModel().getSize(); + Dimension listDim = list.getSize(); + if (visibleRows <= 0) + { + try + { + cellsPerRow = listDim.width / cellWidth; + } + catch (ArithmeticException ex) + { + cellsPerRow = 1; + } + } + else + { + cellsPerRow = numberOfItems / visibleRows + 1; + } + + // determine index for the given location + int cellsPerColumn = numberOfItems / cellsPerRow + 1; + int gridX = Math.min(location.x / cellWidth, cellsPerRow - 1); + int gridY = Math.min(location.y / cellHeight, cellsPerColumn); + index = gridX + gridY * cellsPerRow; + break; + case JList.VERTICAL_WRAP: + // determine visible rows and cells per column + int visibleRows2 = list.getVisibleRowCount(); + if (visibleRows2 <= 0) + { + Dimension listDim2 = list.getSize(); + visibleRows2 = listDim2.height / cellHeight; + } + int numberOfItems2 = list.getModel().getSize(); + int cellsPerRow2 = numberOfItems2 / visibleRows2 + 1; + + Dimension listDim2 = list.getSize(); + int gridX2 = Math.min(location.x / cellWidth, cellsPerRow2 - 1); + int gridY2 = Math.min(location.y / cellHeight, visibleRows2); + index = gridY2 + gridX2 * visibleRows2; + break; + } + return index; } public Point indexToLocation(JList list, int index) { - return new Point(0, convertRowToY(index)); + int layoutOrientation = list.getLayoutOrientation(); + Point loc = null; + switch (layoutOrientation) + { + case JList.VERTICAL: + loc = new Point(0, convertRowToY(index)); + break; + case JList.HORIZONTAL_WRAP: + // determine visible rows and cells per row + int visibleRows = list.getVisibleRowCount(); + int numberOfCellsPerRow = -1; + if (visibleRows <= 0) + { + Dimension listDim = list.getSize(); + numberOfCellsPerRow = Math.max(listDim.width / cellWidth, 1); + } + else + { + int numberOfItems = list.getModel().getSize(); + numberOfCellsPerRow = numberOfItems / visibleRows + 1; + } + // compute coordinates inside the grid + int gridX = index % numberOfCellsPerRow; + int gridY = index / numberOfCellsPerRow; + int locX = gridX * cellWidth; + int locY = gridY * cellHeight; + loc = new Point(locX, locY); + break; + case JList.VERTICAL_WRAP: + // determine visible rows and cells per column + int visibleRows2 = list.getVisibleRowCount(); + if (visibleRows2 <= 0) + { + Dimension listDim2 = list.getSize(); + visibleRows2 = listDim2.height / cellHeight; + } + // compute coordinates inside the grid + if (visibleRows2 > 0) + { + int gridY2 = index % visibleRows2; + int gridX2 = index / visibleRows2; + int locX2 = gridX2 * cellWidth; + int locY2 = gridY2 * cellHeight; + loc = new Point(locX2, locY2); + } + else + loc = new Point(0, convertRowToY(index)); + break; + } + return loc; } } diff --git a/javax/swing/plaf/basic/BasicLookAndFeel.java b/javax/swing/plaf/basic/BasicLookAndFeel.java index 40bf972f2..4a0f6d757 100644 --- a/javax/swing/plaf/basic/BasicLookAndFeel.java +++ b/javax/swing/plaf/basic/BasicLookAndFeel.java @@ -255,7 +255,7 @@ public abstract class BasicLookAndFeel extends LookAndFeel "Button.foreground", new ColorUIResource(Color.black), "Button.highlight", new ColorUIResource(Color.white), "Button.light", new ColorUIResource(Color.lightGray.brighter()), - "Button.margin", new InsetsUIResource(2, 14, 2, 14), + "Button.margin", new InsetsUIResource(2, 2, 2, 2), "Button.shadow", new ColorUIResource(Color.gray), "Button.textIconGap", new Integer(4), "Button.textShiftOffset", new Integer(0), diff --git a/javax/swing/text/ChangedCharSetException.java b/javax/swing/text/ChangedCharSetException.java new file mode 100644 index 000000000..bf592a65a --- /dev/null +++ b/javax/swing/text/ChangedCharSetException.java @@ -0,0 +1,100 @@ +/* ChangedCharSetException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text; + +import java.io.IOException; +import java.io.Serializable; + +/** + * The exception is thrown when the document charset is changed. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class ChangedCharSetException + extends IOException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + * This value corresponds the version 1.4. + */ + private static final long serialVersionUID = 9119851554465432389L; + + /** + * The char set specification. + */ + private final String m_charSetSpec; + + /** + * The char set key. + */ + private final boolean m_charSetKey; + + /** + * Constructs a new char set exception with two additional parameters, + * defining the circumstances under that the exception was raised. + */ + public ChangedCharSetException(String charSetSpec, boolean charSetKey) + { + m_charSetSpec = charSetSpec; + m_charSetKey = charSetKey; + } + + /** + * Get the value of the first parameter, previously passed to the + * constructor. + * + * @return the value of the first parameter + */ + public String getCharSetSpec() + { + return m_charSetSpec; + } + + /** + * Get the value of the second parameter, previously passed to the + * constructor. + * + * @return the value of the second parameter + */ + public boolean keyEqualsCharSet() + { + return m_charSetKey; + } +} diff --git a/javax/swing/text/html/HTML.java b/javax/swing/text/html/HTML.java index 098a14715..06e0ef403 100644 --- a/javax/swing/text/html/HTML.java +++ b/javax/swing/text/html/HTML.java @@ -35,38 +35,1260 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.text.html; import java.io.Serializable; +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +import java.util.Map; +import java.util.TreeMap; + +import javax.swing.text.AttributeSet; + /** - * Stub implementation. - * Just enough to get gjdoc working. - * - * @author Mark Wielaard (mark@klomp.org) + * HTML attribute and tag definitions. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ public class HTML { - public static class Tag + /** + * Represents a HTML attribute. + */ + public static class Attribute + implements Serializable { - private final String id; + /** + * The action attribute + */ + public static final Attribute ACTION = new Attribute("action"); - protected Tag(String id) + /** + * The align attribute + */ + public static final Attribute ALIGN = new Attribute("align"); + + /** + * The alink attribute + */ + public static final Attribute ALINK = new Attribute("alink"); + + /** + * The alt attribute + */ + public static final Attribute ALT = new Attribute("alt"); + + /** + * The archive attribute + */ + public static final Attribute ARCHIVE = new Attribute("archive"); + + /** + * The background attribute + */ + public static final Attribute BACKGROUND = new Attribute("background"); + + /** + * The bgcolor attribute + */ + public static final Attribute BGCOLOR = new Attribute("bgcolor"); + + /** + * The border attribute + */ + public static final Attribute BORDER = new Attribute("border"); + + /** + * The cellpadding attribute + */ + public static final Attribute CELLPADDING = new Attribute("cellpadding"); + + /** + * The cellspacing attribute + */ + public static final Attribute CELLSPACING = new Attribute("cellspacing"); + + /** + * The checked attribute + */ + public static final Attribute CHECKED = new Attribute("checked"); + + /** + * The class attribute + */ + public static final Attribute CLASS = new Attribute("class"); + + /** + * The classid attribute + */ + public static final Attribute CLASSID = new Attribute("classid"); + + /** + * The clear attribute + */ + public static final Attribute CLEAR = new Attribute("clear"); + + /** + * The code attribute + */ + public static final Attribute CODE = new Attribute("code"); + + /** + * The codebase attribute + */ + public static final Attribute CODEBASE = new Attribute("codebase"); + + /** + * The codetype attribute + */ + public static final Attribute CODETYPE = new Attribute("codetype"); + + /** + * The color attribute + */ + public static final Attribute COLOR = new Attribute("color"); + + /** + * The cols attribute + */ + public static final Attribute COLS = new Attribute("cols"); + + /** + * The colspan attribute + */ + public static final Attribute COLSPAN = new Attribute("colspan"); + + /** + * The comment attribute + */ + public static final Attribute COMMENT = new Attribute("comment"); + + /** + * The compact attribute + */ + public static final Attribute COMPACT = new Attribute("compact"); + + /** + * The content attribute + */ + public static final Attribute CONTENT = new Attribute("content"); + + /** + * The coords attribute + */ + public static final Attribute COORDS = new Attribute("coords"); + + /** + * The data attribute + */ + public static final Attribute DATA = new Attribute("data"); + + /** + * The declare attribute + */ + public static final Attribute DECLARE = new Attribute("declare"); + + /** + * The dir attribute + */ + public static final Attribute DIR = new Attribute("dir"); + + /** + * The dummy attribute + */ + public static final Attribute DUMMY = new Attribute("dummy"); + + /** + * The enctype attribute + */ + public static final Attribute ENCTYPE = new Attribute("enctype"); + + /** + * The endtag attribute + */ + public static final Attribute ENDTAG = new Attribute("endtag"); + + /** + * The face attribute + */ + public static final Attribute FACE = new Attribute("face"); + + /** + * The frameborder attribute + */ + public static final Attribute FRAMEBORDER = new Attribute("frameborder"); + + /** + * The halign attribute + */ + public static final Attribute HALIGN = new Attribute("halign"); + + /** + * The height attribute + */ + public static final Attribute HEIGHT = new Attribute("height"); + + /** + * The href attribute + */ + public static final Attribute HREF = new Attribute("href"); + + /** + * The hspace attribute + */ + public static final Attribute HSPACE = new Attribute("hspace"); + + /** + * The http-equiv attribute + */ + public static final Attribute HTTPEQUIV = new Attribute("http-equiv"); + + /** + * The id attribute + */ + public static final Attribute ID = new Attribute("id"); + + /** + * The ismap attribute + */ + public static final Attribute ISMAP = new Attribute("ismap"); + + /** + * The lang attribute + */ + public static final Attribute LANG = new Attribute("lang"); + + /** + * The language attribute + */ + public static final Attribute LANGUAGE = new Attribute("language"); + + /** + * The link attribute + */ + public static final Attribute LINK = new Attribute("link"); + + /** + * The lowsrc attribute + */ + public static final Attribute LOWSRC = new Attribute("lowsrc"); + + /** + * The marginheight attribute + */ + public static final Attribute MARGINHEIGHT = new Attribute("marginheight"); + + /** + * The marginwidth attribute + */ + public static final Attribute MARGINWIDTH = new Attribute("marginwidth"); + + /** + * The maxlength attribute + */ + public static final Attribute MAXLENGTH = new Attribute("maxlength"); + + /** + * The media attribute + */ + public static final Attribute MEDIA = new Attribute("media"); + + /** + * The method attribute + */ + public static final Attribute METHOD = new Attribute("method"); + + /** + * The multiple attribute + */ + public static final Attribute MULTIPLE = new Attribute("multiple"); + + /** + * The n attribute + */ + public static final Attribute N = new Attribute("n"); + + /** + * The name attribute + */ + public static final Attribute NAME = new Attribute("name"); + + /** + * The nohref attribute + */ + public static final Attribute NOHREF = new Attribute("nohref"); + + /** + * The noresize attribute + */ + public static final Attribute NORESIZE = new Attribute("noresize"); + + /** + * The noshade attribute + */ + public static final Attribute NOSHADE = new Attribute("noshade"); + + /** + * The nowrap attribute + */ + public static final Attribute NOWRAP = new Attribute("nowrap"); + + /** + * The prompt attribute + */ + public static final Attribute PROMPT = new Attribute("prompt"); + + /** + * The rel attribute + */ + public static final Attribute REL = new Attribute("rel"); + + /** + * The rev attribute + */ + public static final Attribute REV = new Attribute("rev"); + + /** + * The rows attribute + */ + public static final Attribute ROWS = new Attribute("rows"); + + /** + * The rowspan attribute + */ + public static final Attribute ROWSPAN = new Attribute("rowspan"); + + /** + * The scrolling attribute + */ + public static final Attribute SCROLLING = new Attribute("scrolling"); + + /** + * The selected attribute + */ + public static final Attribute SELECTED = new Attribute("selected"); + + /** + * The shape attribute + */ + public static final Attribute SHAPE = new Attribute("shape"); + + /** + * The shapes attribute + */ + public static final Attribute SHAPES = new Attribute("shapes"); + + /** + * The size attribute + */ + public static final Attribute SIZE = new Attribute("size"); + + /** + * The src attribute + */ + public static final Attribute SRC = new Attribute("src"); + + /** + * The standby attribute + */ + public static final Attribute STANDBY = new Attribute("standby"); + + /** + * The start attribute + */ + public static final Attribute START = new Attribute("start"); + + /** + * The style attribute + */ + public static final Attribute STYLE = new Attribute("style"); + + /** + * The target attribute + */ + public static final Attribute TARGET = new Attribute("target"); + + /** + * The text attribute + */ + public static final Attribute TEXT = new Attribute("text"); + + /** + * The title attribute + */ + public static final Attribute TITLE = new Attribute("title"); + + /** + * The type attribute + */ + public static final Attribute TYPE = new Attribute("type"); + + /** + * The usemap attribute + */ + public static final Attribute USEMAP = new Attribute("usemap"); + + /** + * The valign attribute + */ + public static final Attribute VALIGN = new Attribute("valign"); + + /** + * The value attribute + */ + public static final Attribute VALUE = new Attribute("value"); + + /** + * The valuetype attribute + */ + public static final Attribute VALUETYPE = new Attribute("valuetype"); + + /** + * The version attribute + */ + public static final Attribute VERSION = new Attribute("version"); + + /** + * The vlink attribute + */ + public static final Attribute VLINK = new Attribute("vlink"); + + /** + * The vspace attribute + */ + public static final Attribute VSPACE = new Attribute("vspace"); + + /** + * The width attribute + */ + public static final Attribute WIDTH = new Attribute("width"); + private final String name; + + /** + * Creates the attribute with the given name. + */ + protected Attribute(String a_name) + { + name = a_name; + } + + /** + * Calls compareTo on the tag names (Strings) + */ + public int compareTo(Object other) + { + return name.compareTo(((Attribute) other).name); + } + + /** + * The attributes are equal if the names are equal + * (ignoring case) + */ + public boolean equals(Object other) + { + if (other == this) + return true; + + if (!(other instanceof Attribute)) + return false; + + Attribute that = (Attribute) other; + + return that.name.equalsIgnoreCase(name); + } + + /** + * Returns the hash code which corresponds to the string for this tag. + */ + public int hashCode() + { + return name == null ? 0 : name.hashCode(); + } + + /** + * Returns the attribute name. The names of the built-in attributes + * are always returned in lowercase. + */ + public String toString() { - this.id = id; + return name; + } + + /** + * Return an array of all attributes, declared in the HTML.Attribute + * class. WARNING: attributes are the only public fields, + * expected in this class. + */ + static Attribute[] getAllAttributes() + { + Field[] f = Attribute.class.getFields(); + Attribute[] attrs = new Attribute[ f.length ]; + Field x; + int p = 0; + Attribute a; + + for (int i = 0; i < f.length; i++) + { + x = f [ i ]; + + if ((x.getModifiers() & Modifier.STATIC) != 0) + { + if (x.getType().equals(Attribute.class)) + { + try + { + a = (Attribute) x.get(null); + attrs [ p++ ] = a; + } + catch (Exception ex) + { + ex.printStackTrace(System.err); + throw new Error("This should never happen, report a bug"); + } + } + } + } + + return attrs; } } - public static class UnknownTag extends Tag implements Serializable + /** + * Represents a HTML tag. + */ + public static class Tag + implements Comparable, Serializable { /** - * For compatability with Sun's JDK 1.4.2 rev. 5 + * The <a> tag + */ + public static final Tag A = new Tag("a"); + + /** + * The <address> tag + */ + public static final Tag ADDRESS = new Tag("address"); + + /** + * The <applet> tag + */ + public static final Tag APPLET = new Tag("applet"); + + /** + * The <area> tag + */ + public static final Tag AREA = new Tag("area"); + + /** + * The <b> tag + */ + public static final Tag B = new Tag("b"); + + /** + * The <base> tag + */ + public static final Tag BASE = new Tag("base"); + + /** + * The <basefont> tag + */ + public static final Tag BASEFONT = new Tag("basefont"); + + /** + * The <big> tag + */ + public static final Tag BIG = new Tag("big"); + + /** + * The <blockquote> tag , breaks flow, block tag. + */ + public static final Tag BLOCKQUOTE = new Tag("blockquote", BREAKS | BLOCK); + + /** + * The <body> tag , breaks flow, block tag. + */ + public static final Tag BODY = new Tag("body", BREAKS | BLOCK); + + /** + * The <br> tag , breaks flow. + */ + public static final Tag BR = new Tag("br", BREAKS); + + /** + * The <caption> tag + */ + public static final Tag CAPTION = new Tag("caption"); + + /** + * The <center> tag , breaks flow. + */ + public static final Tag CENTER = new Tag("center", BREAKS); + + /** + * The <cite> tag + */ + public static final Tag CITE = new Tag("cite"); + + /** + * The <code> tag + */ + public static final Tag CODE = new Tag("code"); + + /** + * The <dd> tag , breaks flow, block tag. + */ + public static final Tag DD = new Tag("dd", BREAKS | BLOCK); + + /** + * The <dfn> tag + */ + public static final Tag DFN = new Tag("dfn"); + + /** + * The <dir> tag , breaks flow, block tag. + */ + public static final Tag DIR = new Tag("dir", BREAKS | BLOCK); + + /** + * The <div> tag , breaks flow, block tag. + */ + public static final Tag DIV = new Tag("div", BREAKS | BLOCK); + + /** + * The <dl> tag , breaks flow, block tag. + */ + public static final Tag DL = new Tag("dl", BREAKS | BLOCK); + + /** + * The <dt> tag , breaks flow, block tag. + */ + public static final Tag DT = new Tag("dt", BREAKS | BLOCK); + + /** + * The <em> tag + */ + public static final Tag EM = new Tag("em"); + + /** + * The <font> tag + */ + public static final Tag FONT = new Tag("font"); + + /** + * The <form> tag , breaks flow. + */ + public static final Tag FORM = new Tag("form", BREAKS); + + /** + * The <frame> tag + */ + public static final Tag FRAME = new Tag("frame"); + + /** + * The <frameset> tag + */ + public static final Tag FRAMESET = new Tag("frameset"); + + /** + * The <h1> tag , breaks flow, block tag. + */ + public static final Tag H1 = new Tag("h1", BREAKS | BLOCK); + + /** + * The <h2> tag , breaks flow, block tag. + */ + public static final Tag H2 = new Tag("h2", BREAKS | BLOCK); + + /** + * The <h3> tag , breaks flow, block tag. + */ + public static final Tag H3 = new Tag("h3", BREAKS | BLOCK); + + /** + * The <h4> tag , breaks flow, block tag. + */ + public static final Tag H4 = new Tag("h4", BREAKS | BLOCK); + + /** + * The <h5> tag , breaks flow, block tag. + */ + public static final Tag H5 = new Tag("h5", BREAKS | BLOCK); + + /** + * The <h6> tag , breaks flow, block tag. + */ + public static final Tag H6 = new Tag("h6", BREAKS | BLOCK); + + /** + * The <head> tag , breaks flow, block tag. + */ + public static final Tag HEAD = new Tag("head", BREAKS | BLOCK); + + /** + * The <hr> tag , breaks flow. + */ + public static final Tag HR = new Tag("hr", BREAKS); + + /** + * The <html> tag , breaks flow. + */ + public static final Tag HTML = new Tag("html", BREAKS); + + /** + * The <i> tag + */ + public static final Tag I = new Tag("i"); + + /** + * The <img> tag + */ + public static final Tag IMG = new Tag("img"); + + /** + * The <input> tag + */ + public static final Tag INPUT = new Tag("input"); + + /** + * The <isindex> tag , breaks flow. + */ + public static final Tag ISINDEX = new Tag("isindex", BREAKS); + + /** + * The <kbd> tag + */ + public static final Tag KBD = new Tag("kbd"); + + /** + * The <li> tag , breaks flow, block tag. + */ + public static final Tag LI = new Tag("li", BREAKS | BLOCK); + + /** + * The <link> tag + */ + public static final Tag LINK = new Tag("link"); + + /** + * The <map> tag + */ + public static final Tag MAP = new Tag("map"); + + /** + * The <menu> tag , breaks flow, block tag. + */ + public static final Tag MENU = new Tag("menu", BREAKS | BLOCK); + + /** + * The <meta> tag + */ + public static final Tag META = new Tag("meta"); + + /** + * The <nobr> tag + */ + public static final Tag NOBR = new Tag("nobr"); + + /** + * The <noframes> tag , breaks flow, block tag. + */ + public static final Tag NOFRAMES = new Tag("noframes", BREAKS | BLOCK); + + /** + * The <object> tag + */ + public static final Tag OBJECT = new Tag("object"); + + /** + * The <ol> tag , breaks flow, block tag. + */ + public static final Tag OL = new Tag("ol", BREAKS | BLOCK); + + /** + * The <option> tag + */ + public static final Tag OPTION = new Tag("option"); + + /** + * The <p> tag , breaks flow, block tag. + */ + public static final Tag P = new Tag("p", BREAKS | BLOCK); + + /** + * The <param> tag + */ + public static final Tag PARAM = new Tag("param"); + + /** + * The <pre> tag , breaks flow, block tag, preformatted. */ + public static final Tag PRE = new Tag("pre", BREAKS | BLOCK | PREFORMATTED); + + /** + * The <s> tag + */ + public static final Tag S = new Tag("s"); + + /** + * The <samp> tag + */ + public static final Tag SAMP = new Tag("samp"); + + /** + * The <script> tag + */ + public static final Tag SCRIPT = new Tag("script"); + + /** + * The <select> tag + */ + public static final Tag SELECT = new Tag("select"); + + /** + * The <small> tag + */ + public static final Tag SMALL = new Tag("small"); + + /** + * The <span> tag + */ + public static final Tag SPAN = new Tag("span"); + + /** + * The <strike> tag + */ + public static final Tag STRIKE = new Tag("strike"); + + /** + * The <strong> tag + */ + public static final Tag STRONG = new Tag("strong"); + + /** + * The <style> tag + */ + public static final Tag STYLE = new Tag("style"); + + /** + * The <sub> tag + */ + public static final Tag SUB = new Tag("sub"); + + /** + * The <sup> tag + */ + public static final Tag SUP = new Tag("sup"); + + /** + * The <table> tag , block tag. + */ + public static final Tag TABLE = new Tag("table", BLOCK); + + /** + * The <td> tag , breaks flow, block tag. + */ + public static final Tag TD = new Tag("td", BREAKS | BLOCK); + + /** + * The <textarea> tag , preformatted. + */ + public static final Tag TEXTAREA = new Tag("textarea", PREFORMATTED); + + /** + * The <th> tag , breaks flow, block tag. + */ + public static final Tag TH = new Tag("th", BREAKS | BLOCK); + + /** + * The <title> tag , breaks flow, block tag. + */ + public static final Tag TITLE = new Tag("title", BREAKS | BLOCK); + + /** + * The <tr> tag , block tag. + */ + public static final Tag TR = new Tag("tr", BLOCK); + + /** + * The <tt> tag + */ + public static final Tag TT = new Tag("tt"); + + /** + * The <u> tag + */ + public static final Tag U = new Tag("u"); + + /** + * The <ul> tag , breaks flow, block tag. + */ + public static final Tag UL = new Tag("ul", BREAKS | BLOCK); + + /** + * The <var> tag + */ + public static final Tag VAR = new Tag("var"); + + /* Special tags */ + + /** + * Total number of syntetic tags, delared in the Tag class. + * This must be adjusted if the new synthetic tags are declared. + * Otherwise the HTML.getAllTags() will not work as expected. + */ + private static final int TOTAL_SYNTHETIC_TAGS = 3; + + /** + * All comments are labeled with this tag. + * This tag is not included into the array, returned by getAllTags(). + * toString() returns 'comment'. HTML reader synthesizes this tag. + */ + public static final Tag COMMENT = new Tag("comment", SYNTETIC); + + /** + * All text content is labeled with this tag. + * This tag is not included into the array, returned by getAllTags(). + * toString() returns 'content'. HTML reader synthesizes this tag. + */ + public static final Tag CONTENT = new Tag("content", SYNTETIC); + + /** + * All text content must be in a paragraph element. + * If a paragraph didn't exist when content was encountered, + * a paragraph is manufactured. + * toString() returns 'implied'. HTML reader synthesizes this tag. + */ + public static final Tag IMPLIED = new Tag("implied", SYNTETIC); + final String name; + final int flags; + + /** + * Creates a new Tag with the specified id, and with causesBreak + * and isBlock set to false. + */ + protected Tag(String id) + { + name = id; + flags = 0; + } + + /** + * Creates a new Tag with the specified tag name and + * causesBreak and isBlock properties. + */ + protected Tag(String id, boolean causesBreak, boolean isBlock) + { + int f = 0; + + if (causesBreak) + { + f |= BREAKS; + } + + if (isBlock) + { + f |= BLOCK; + } + + flags = f; + name = id; + } + + /** + * Create a tag taking flags. + */ + Tag(String id, int a_flags) + { + name = id; + flags = a_flags; + } + + /** + * Returns true if this tag is a block tag, which is a tag used to + * add structure to a document. + */ + public boolean isBlock() + { + return (flags & BLOCK) != 0; + } + + /** + * Returns true if this tag is pre-formatted, which is true if + * the tag is either PRE or TEXTAREA + */ + public boolean isPreformatted() + { + return (flags & PREFORMATTED) != 0; + } + + /** + * Returns true if this tag causes a line break to the flow of text + */ + public boolean breaksFlow() + { + return (flags & BREAKS) != 0; + } + + /** + * Calls compareTo on the tag names (Strings) + */ + public int compareTo(Object other) + { + return name.compareTo(((Tag) other).name); + } + + /** + * The tags are equal if the names are equal (ignoring case). + */ + public boolean equals(Object other) + { + if (other == this) + { + return true; + } + + if (!(other instanceof Tag)) + { + return false; + } + + Tag that = (Tag) other; + + return that.name.equalsIgnoreCase(name); + } + + /** + * Returns the hash code which corresponds to the string for this tag. + */ + public int hashCode() + { + return name == null ? 0 : name.hashCode(); + } + + /** + * Returns the tag name. The names of the built-in tags are always + * returned in lowercase. + */ + public String toString() + { + return name; + } + + /** + * Return an array of HTML tags, declared in HTML.Tag class. + * WARNING: This method expects that the Tags are the only + * public fields declared in the Tag class. + */ + static Tag[] getAllTags() + { + Field[] f = Tag.class.getFields(); + Field x; + + // The syntetic tags are not included. + Tag[] tags = new Tag[ f.length - TOTAL_SYNTHETIC_TAGS ]; + int p = 0; + Tag t; + + for (int i = 0; i < f.length; i++) + { + x = f [ i ]; + + if ((x.getModifiers() & Modifier.STATIC) != 0) + { + if (x.getType().equals(Tag.class)) + { + try + { + t = (Tag) x.get(null); + + if (!t.isSyntetic()) + { + tags [ p++ ] = t; + } + } + catch (IllegalAccessException ex) + { + unexpected(ex); + } + catch (IllegalArgumentException ex) + { + unexpected(ex); + } + } + } + } + + return tags; + } + + /** + * Returns true for tags, generated by the html reader + * (COMMENT, CONTENT and IMPLIED). + */ + boolean isSyntetic() + { + return (flags & SYNTETIC) != 0; + } + + private static void unexpected(Exception ex) + throws Error + { + throw new Error("This should never happen, report a bug", ex); + } + } + + /** + * Represents an unknown HTML tag. + * @author Mark Wielaard (mark@klomp.org) + */ + public static class UnknownTag + extends Tag + implements Serializable + { private static final long serialVersionUID = -1534369342247250625L; - public UnknownTag(String id) + /** + * Creates a new UnknownTag with the specified name + * @param name The tag name. + * + */ + public UnknownTag(String name) { - super(id); + super(name); } } + + /** + * This value is returned for attributes without value that have no + * default value defined in the DTD. + */ + public static final String NULL_ATTRIBUTE_VALUE = "#DEFAULT"; + + /* Package level html tag flags */ + static final int BREAKS = 1; + static final int BLOCK = 2; + static final int PREFORMATTED = 4; + static final int SYNTETIC = 8; + private static Map tagMap; + private static Map attrMap; + + /** + * The public constructor (does nothing). It it seldom required to have + * an instance of this class, because all public fields and methods + * are static. + */ + public HTML() + { + } + + /** + * Returns the set of the recognized HTML attributes. + */ + public static HTML.Attribute[] getAllAttributeKeys() + { + return Attribute.getAllAttributes(); + } + + /** + * Returns the set of actual HTML tags that are recognized by + * the default HTML reader. The returned array does not include the + * COMMENT, CONTENT and IMPLIED tags. + */ + public static HTML.Tag[] getAllTags() + { + return Tag.getAllTags(); + } + + /** + * Returns an htl attribute constant for the given attribute name. + * @param attName the attribute name, case insensitive + */ + public static Attribute getAttributeKey(String attName) + { + if (attrMap == null) + { + // Create the map on demand. + attrMap = new TreeMap(); + + Attribute[] attrs = getAllAttributeKeys(); + + for (int i = 0; i < attrs.length; i++) + { + attrMap.put(attrs [ i ].toString(), attrs [ i ]); + } + } + + return (Attribute) attrMap.get(attName.toLowerCase()); + } + + /** + * Searches the value of given attribute in the provided set. + * If the value is found (String type expected), tries to parse it as + * an integer value. If succeded, returns the obtained integer value. + * + * For example:<p><code> + * SimpleAttributeSet ase = new SimpleAttributeSet(); + * ase.addAttribute(HTML.getAttributeKey("size"),"222"); + * System.out.println( + * HTML.getIntegerAttributeValue + * (ase, HTML.getAttributeKey("size"), 333)); // prints "222" + * System.out.println( + * HTML.getIntegerAttributeValue + * (ase, HTML.getAttributeKey("width"), 333)); // prints "333". + * </code></p> + * + * + * @param set The attribute set to search in. If the set contains the + * given attribute, it must by a type of String. + * @param attribute The html attribute to search in + * @param defaultValue The value that is returned if the attribute is not + * found in the given set or if the NumberFormatException was thrown + * during the parsing. + */ + public static int getIntegerAttributeValue(AttributeSet set, + HTML.Attribute attribute, + int defaultValue + ) + { + Object v = set.getAttribute(attribute); + + if (v == null) + { + return defaultValue; + } + + try + { + return Integer.parseInt(v.toString().trim()); + } + catch (Exception ex) + { + return defaultValue; + } + } + + /** + * Returns a HTML tag constant for the given HTML attribute name. + * If the tag is unknown, the null is returned. + * @param tagName the tag name, case insensitive + */ + public static Tag getTag(String tagName) + { + if (tagMap == null) + { + // Create the mao on demand. + tagMap = new TreeMap(); + + Tag[] tags = getAllTags(); + + for (int i = 0; i < tags.length; i++) + { + tagMap.put(tags [ i ].toString(), tags [ i ]); + } + } + + return (Tag) tagMap.get(tagName.toLowerCase()); + } } diff --git a/javax/swing/text/html/HTMLEditorKit.java b/javax/swing/text/html/HTMLEditorKit.java new file mode 100644 index 000000000..742eab36e --- /dev/null +++ b/javax/swing/text/html/HTMLEditorKit.java @@ -0,0 +1,173 @@ +/* HTMLEditorKit.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html; + +import java.io.Reader; + +import javax.swing.text.BadLocationException; +import javax.swing.text.MutableAttributeSet; + +/** + * This class is NOT implemented. This file currently holds only + * declarations of the two enclosing classes, necessary for testing + * the implemented javax.swing.text.html.parser package. + * @author No authorship is taken, implement the class and be! + * TODO: replace this header after implementing the class. + */ +public class HTMLEditorKit +{ + /** + * The abstract HTML parser declaration. + */ + public abstract static class Parser + { + /** + * Parse the HTML text, calling various methods of the provided callback + * in response to the occurence of the corresponding HTML constructions. + * @param reader The reader to read the source HTML from. + * @param callback The callback to receive information about the parsed + * HTML structures + * @param ignoreCharSet If true, the parser ignores all charset information + * that may be present in HTML documents. + * @throws IOException, normally if the reader throws one. + */ + public abstract void parse(Reader reader, ParserCallback callback, + boolean ignoreCharSet + ) + throws java.io.IOException; + } + + /** + * The "hook" that receives all information about the HTML document + * structure while parsing it. The methods are invoked by parser + * and should be normally overridden. + */ + public static class ParserCallback + { + /** + * If the tag does not occurs in the html stream directly, but + * is supposed by parser, the tag attribute set contains this additional + * attribute, having value Boolean.True. + */ + public static final Object IMPLIED = "_implied_"; + + /** + * The parser calls this method after it finishes parsing the document. + */ + public void flush() + throws BadLocationException + { + } + + /** + * Handle HTML comment, present in the given position. + * @param comment the comment + * @position the position of the comment in the text being parsed. + */ + public void handleComment(char[] comment, int position) + { + } + + /** + * Notifies about the character sequences, used to separate lines in + * this document. The parser calls this method after it finishes + * parsing the document, but before flush(). + * @param end_of_line The "end of line sequence", one of: \r or \n or \r\n. + */ + public void handleEndOfLineString(String end_of_line) + { + } + + /** + * The method is called when the HTML closing tag ((like </table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param The tag being handled + * @position the tag position in the text being parsed. + */ + public void handleEndTag(HTML.Tag tag, int position) + { + } + + /** + * Handle the error. + * @param message The message, explaining the error. + * @param position The starting position of the fragment that has caused + * the error in the html document being parsed. + */ + public void handleError(String message, int position) + { + } + + /** + * Handle the tag with no content, like <br>. The method is + * called for the elements that, in accordance with the current DTD, + * has an empty content. + * @param tag The tag being handled. + * @param position The tag position in the text being parsed. + */ + public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, + int position + ) + { + } + + /** + * The method is called when the HTML opening tag ((like <table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param tag The tag being handled + * @param position The tag position in the text bein parsed + */ + public void handleStartTag(HTML.Tag tag, MutableAttributeSet attributes, + int position + ) + { + } + + /** + * Handle the text section. + * @param text A section text. + * @param position The text position in the HTML document text being parsed. + */ + public void handleText(char[] text, int position) + { + } + } +} diff --git a/javax/swing/text/html/HTMLFrameHyperlinkEvent.java b/javax/swing/text/html/HTMLFrameHyperlinkEvent.java new file mode 100644 index 000000000..1e20a9913 --- /dev/null +++ b/javax/swing/text/html/HTMLFrameHyperlinkEvent.java @@ -0,0 +1,136 @@ +/* HTMLFrameHyperlinkEvent.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html; + +import java.net.URL; + +import javax.swing.event.HyperlinkEvent; +import javax.swing.event.HyperlinkEvent.EventType; +import javax.swing.text.Element; + +/** + * HTMLFrameHyperlinkEvent transfers information about the link that was + * activated in a frame. + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class HTMLFrameHyperlinkEvent + extends HyperlinkEvent +{ + private final String target_frame; + + /** + * Creates a new hypertext link event. + * + * @param source The object this link is associated to. + * @param type The type of event. + * @param url The URL this link pointing too. + * @param element The element in the document representing the anchor. + * @param frame - the Frame to display the document in. + */ + public HTMLFrameHyperlinkEvent(Object source, EventType type, URL url, + Element element, String frame + ) + { + super(source, type, url, frame, element); + target_frame = frame; + } + + /** + * Creates a new hypertext link event. + * + * @param source The object this link is associated to. + * @param type The type of event. + * @param url The URL this link pointing too. + * @param frame - the Frame to display the document in. + */ + public HTMLFrameHyperlinkEvent(Object source, EventType type, URL url, + String frame + ) + { + super(source, type, url, frame); + target_frame = frame; + } + + /** + * Creates a new hypertext link event. + * + * @param source The object this link is associated to. + * @param type The type of event. + * @param url The URL this link pointing too. + * @param description The description for this link. + * @param element The element in the document representing the anchor. + * @param frame - the Frame to display the document in. + */ + public HTMLFrameHyperlinkEvent(Object source, EventType type, URL url, + String description, Element element, + String frame + ) + { + super(source, type, url, description, element); + target_frame = frame; + } + + /** + * Creates a new hypertext link event. + * + * @param source The object this link is associated to. + * @param type The type of event. + * @param url The URL this link pointing too. + * @param description The description for this link. + * @param frame - the Frame to display the document in. + */ + public HTMLFrameHyperlinkEvent(Object source, EventType type, URL url, + String description, String frame + ) + { + super(source, type, url, description); + target_frame = frame; + } + + /** + * Gets the string, passed as the target frame identifier. + * + * @return the target for the link. + */ + public String getTarget() + { + return target_frame; + } +} diff --git a/javax/swing/text/html/package.html b/javax/swing/text/html/package.html index 28f98c61c..622c4fcc1 100644 --- a/javax/swing/text/html/package.html +++ b/javax/swing/text/html/package.html @@ -40,7 +40,11 @@ exception statement from your version. --> <head><title>GNU Classpath - javax.swing.text.html</title></head> <body> -<p></p> +<p> Provides supporting classes for web browsers, + web robots, web page content analysers, web editors and + other applications applications working with Hypertext + Markup Language (HTML). +</p> </body> </html> diff --git a/javax/swing/text/html/parser/AttributeList.java b/javax/swing/text/html/parser/AttributeList.java new file mode 100644 index 000000000..faf3ae8b1 --- /dev/null +++ b/javax/swing/text/html/parser/AttributeList.java @@ -0,0 +1,293 @@ +/* AttributeList.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.support.gnuStringIntMapper; + +import java.io.Serializable; + +import java.util.Vector; + +/** + * <p> + * Stores the attribute information, obtained by parsing SGML (DTD) tag + * <code><!ATTLIST .. ></code></p> + * <p> + * Elements can have a associated named properties (attributes) having the + * assigned values. The element start tag can have any number of attribute + * value pairs, separated by spaces. They can appear in any order. + * SGML requires you to delimit the attribute values using either double (") + * or single (') quotation marks. In HTML, it is possible + * (but not recommended) to specify the value of an attribute without + * quotation marks. Such attribute value may only contain + * letters, digits, hyphens (-) and periods (.) . + * </p> + * <p> + * The <code>AttributeList</code> defines a single attribute that additionally + * has a pointer referencing the possible subsequent attribute. + * The whole structure is just a simple linked list, storing all attributes of + * some <code>Element</code>. + * Use the <code>getNext()</code> method repeatedly to see all attributes in + * the list. + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class AttributeList + implements DTDConstants, Serializable +{ + /** Maps between type names and they string values. */ + private final static gnuStringIntMapper mapper = + new gnuStringIntMapper() + { + protected void create() + { + add("CDATA", DTDConstants.CDATA); + add("ENTITY", DTDConstants.ENTITY); + add("ENTITIES", DTDConstants.ENTITIES); + add("ID", DTDConstants.ID); + add("IDREF", DTDConstants.IDREF); + add("IDREFS", DTDConstants.IDREFS); + add("NAME", DTDConstants.NAME); + add("NAMES", DTDConstants.NAMES); + add("NMTOKEN", DTDConstants.NMTOKEN); + add("NMTOKENS", DTDConstants.NMTOKENS); + add("NOTATION", DTDConstants.NOTATION); + add("NUMBER", DTDConstants.NUMBER); + add("NUMBERS", DTDConstants.NUMBERS); + add("NUTOKEN", DTDConstants.NUTOKEN); + add("NUTOKENS", DTDConstants.NUTOKENS); + } + }; + + /** Use serialVersionUID for interoperability. */ + private final static long serialVersionUID = -1361214058742015233L; + + /** + * The value of ( = pointer to ) the next attribute in the linked list, + * storing all attributes of some Element. Contains null for the + * last attribute. + */ + public AttributeList next; + + /** + * The name of the attribute. The attribute names are case insensitive. + */ + public String name; + + /** + * The default value of this attribute. Equals to null if no default value + * is specified. + */ + public String value; + + /** + * The explicit set of the allowed values of this attribute. Equals to + * null, if this parameter was not specified. + * Values, defined in DTD, are case insensitive. + */ + public Vector values; + + /** + * The modifier of this attribute. This field contains one of the + * following DTD constants: + * <ul> + * <li> REQUIRED if the attribute value is always required,</li> + * <li> IMPLIED if the user agent must supply the default value itself,</li> + * <li> FIXED if the attribute value is fixed to some value and cannot + * be changed.</li> + * <li> DEFAULT if the attribute default value has been supplied.</li> + * <li> CURRENT the value that at any point in the document is + * the last value supplied for that element. A value is required to be + * supplied for the first* occurrence of an element</li> + * <li> CONREF specifies the IDREF value of + * the reference to content in another location of the document. + * The element with this attribute is empty, the content from + * that another location must be used instead.</li> + * </ul> + */ + public int modifier; + + /** + * The type of the attribute. The possible values of this field + * (NUMBER, NAME, ID, CDATA and so on) are defined in DTDConstants. + */ + public int type; + + /** + * Creates the attribute with the given name, initializing other fields + * to the default values ( 0 and null ). + * + * @param a_name The name of the attribute. + */ + public AttributeList(String a_name) + { + name = a_name; + } + + /** + * Creates the attribute with the given properties. + * @param a_name The name of the attribute + * @param a_type The type of the attribute. The possible values are defined + * in <code> DTDConstants</code>. + * @param a_modifier The modifier of this attribute. The possible values + * are defined in <code> DTDConstants</code>. + * @param a_default The default value of this attribute + * @param allowed_values The explicit set of the allowed values of + * this attribute + * @param a_next The value of the subsequent instance of the AttributeList, + * representing the next attribute definition for the same element. + * Equals to null for the last attribute definition. + */ + public AttributeList(String a_name, int a_type, int a_modifier, + String a_default, Vector allowed_values, + AttributeList a_next + ) + { + this(a_name); + type = a_type; + modifier = a_modifier; + value = a_default; + values = allowed_values; + next = a_next; + } + + /** + * Get the modifier of this attribute. This field contains one of the + * following DTD constants: + * <ul> + * <li> REQUIRED if the attribute value is always required,</li> + * <li> IMPLIED if the user agent must supply the default value itself,</li> + * <li> FIXED if the attribute value is fixed to some value and cannot + * be changed.</li> + * <li> DEFAULT if the attribute default value has been supplied.</li> + * <li> CURRENT the value that at any point in the document is + * the last value supplied for that element. A value is required to be + * supplied for the first* occurrence of an element</li> + * <li> CONREF specifies the IDREF value of + * the reference to content in another location of the document. + * The element with this attribute is empty, the content from + * that another location must be used instead.</li> + * </ul> + */ + public int getModifier() + { + return modifier; + } + + /** + * Get the name of the attribute. + * The value is returned as it was supplied to a + * constructor, preserving the character case. + */ + public String getName() + { + return name; + } + + /** + * Get the value of ( = pointer to ) the next attribute in the linked list, + * storing all attributes of some Element. Contains null for the + * last attribute. + */ + public AttributeList getNext() + { + return next; + } + + /** + * Get the type of the attribute. The possible values of this field + * (NUMBER, NAME, ID, CDATA and so on) are defined in DTDConstants. + */ + public int getType() + { + return type; + } + + /** + * Get the default value of this attribute. + */ + public String getValue() + { + return value; + } + + /** + * Get the allowed values of this attribute. + */ + public Vector getValues() + { + return values; + } + + /** + * Converts a string value, representing a valid SGLM attribute type, + * into the corresponding value, defined in DTDConstants. + * @param typeName the name of the type (character case is ignored). + * @return a value from DTDConstants or DTDConstants.ANY if the + * string is not representing a known type. The known attribute types + * in this implementation are CDATA, ENTITY, ENTITIES, ID, IDREF, IDREFS, + * NAME, NAMES, NMTOKEN, NMTOKENS, NOTATION, NUMBER, NUMBERS, NUTOKEN and + * NUTOKENS. + * @throws NullPointerException if the passed parameter is null. + */ + public static int name2type(String typeName) + { + return mapper.get(typeName.toUpperCase()); + } + + /** + * Returns the attribute name. + */ + public String toString() + { + return name; + } + + /** + * Converts a value from DTDConstants into the string representation. + * @param type - an integer value of the public static integer field, + * defined in the DTDConstants class. + * @return a corresponding SGML DTD keyword (UPPERCASE) or null if there + * are no attribute type constant having the given value. + */ + public static String type2name(int type) + { + return mapper.get(type); + } +} diff --git a/javax/swing/text/html/parser/ContentModel.java b/javax/swing/text/html/parser/ContentModel.java new file mode 100644 index 000000000..16f6bb876 --- /dev/null +++ b/javax/swing/text/html/parser/ContentModel.java @@ -0,0 +1,218 @@ +/* ContentModel.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.models.transformer; + +import java.io.Serializable; + +import java.util.Vector; + +/** + * A representation of the element content. The instances of this class + * can be arranged into the linked list, representing a BNF expression. + * The content model is constructed as a branched tree structure in the + * following way: + * <pre> + * a = new ContentModel('+', A, null); // a reprensents A+ + * b = new ContentModel('&', B, a); // b represents B & A+ + * c = new ContentModel('*', b, null); // c represents ( B & A+) * + * d = new ContentModel('|', new ContentModel('*', A, null), + * new ContentModel('?', B, null)); // d represents ( A* | B? ) + * </pre> + * where the valid operations are: + * <ul> + * <li><code>E* </code> E occurs zero or more times</li> + * <li><code>E+ </code> E occurs one or more times</li> + * <li><code>E? </code> E occurs once or not atl all</li> + * <li><code>A,B</code> A occurs before B</li> + * <li><code>A|B</code> both A and B are permitted in any order. + * The '|' alone does not permit the repetetive occurence of A or B + * (use <code>(A|B)*</code>.</li> + * <li><code>A&B both A and B must occur once (in any order)</li> + * </ul> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class ContentModel + implements Serializable +{ + /** Use serialVersionUID for interoperability. */ + private final static long serialVersionUID = -1130825523866321257L; + + /** + * The next content model model ( = pointer to the next element of + * the linked list) for the binary expression (',','&' or '|'). Null + * for the last element in the list. + */ + public ContentModel next; + + /** + * The document content, containing either Element or the enclosed + * content model (that would be in the parentheses in BNF expression). + */ + public Object content; + + /** + * Specifies the BNF operation between this node and the node, + * stored in the field <code>next</code> (or for this node, if it is + * an unary operation. + */ + public int type; + + /** Create a content model initializing all fields to default values. */ + public ContentModel() + { + } + + /** + * Create a content model, consisting of the single element. + * Examples: + *<code> + * a = new ContentModel('+', A, null); // a reprensents A+ + * b = new ContentModel('&', B, a); // b represents B & A+ + * c = new ContentModel('*', b, null); // c represents ( B & A+) * + * d = new ContentModel('|', A, + * new ContentModel('?',b, null); + * // d represents + * </code> + */ + public ContentModel(Element a_content) + { + content = a_content; + } + + /** + * Create a content model, involving expression of the given type. + * @param a_type The expression operation type ('*','?' or '+' + * @param a_content The content for that the expression is applied. + */ + public ContentModel(int a_type, ContentModel a_content) + { + content = a_content; + type = a_type; + } + + /** + * Create a content model, involving binary expression of the given type. + * @param a_type The expression operation type ( ',', '|' or '&'). + * @param a_content The content of the left part of the expression. + * @param a_next The content model, representing the right part of the + * expression. + */ + public ContentModel(int a_type, Object a_content, ContentModel a_next) + { + content = a_content; + type = a_type; + next = a_next; + } + + /** + * Adds all list elements to the given vector, ignoring the + * operations between the elements. The old vector values are not + * discarded. + * @param elements - a vector to add the values to. + */ + public void getElements(Vector elements) + { + ContentModel c = this; + + while (c != null) + { + elements.add(c.content); + c = c.next; + } + } + + /** + * Checks if the content model matches an empty input stream. + * The empty content is created using SGML DTD keyword EMPTY. + * The empty model is a model with the content field equal to null. + * + * @return true if the content field is equal to null. + */ + public boolean empty() + { + return content == null; + } + + /** + * Get the element, stored in the <code>next.content</code>. + * The method is programmed as the part of the standard API, but not + * used in this implementation. + * @return the value of the field <code>next</code>. + */ + public Element first() + { + return (Element) next.content; + } + + /** + * Checks if this object can potentially be the first token in the + * ContenModel list. The method is programmed as the part of the + * standard API, but not used in this implementation. + */ + public boolean first(Object token) + { + ContentModel c = this; + while (c.next != null) + { + if (c.content != null && c.content.toString().equals(token.toString()) && + c.type != ',' + ) + + // Agree if the operation with the preceeding element + // is not the comma operation. + return true; + c = c.next; + } + return false; + } + + /** + * Returns a string representation (an expression) of this content model. + * The expression has BNF-like syntax, except the absence of the + * unary operator is additionally indicated by " ' ". It is + * advisable to check the created models for correctness using this + * method. + */ + public String toString() + { + return transformer.transform(this).toString(); + } +} diff --git a/javax/swing/text/html/parser/DTD.java b/javax/swing/text/html/parser/DTD.java new file mode 100644 index 000000000..22b27f19b --- /dev/null +++ b/javax/swing/text/html/parser/DTD.java @@ -0,0 +1,611 @@ +/* DTD.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + +import java.io.DataInputStream; +import java.io.EOFException; +import java.io.IOException; +import java.io.ObjectInputStream; +import java.io.Serializable; + +import java.lang.reflect.Field; +import java.lang.reflect.Modifier; + +import java.util.BitSet; +import java.util.Hashtable; +import java.util.StringTokenizer; +import java.util.Vector; + +/** + * <p>Representation or the SGML DTD document. + * Provides basis for describing a syntax of the + * HTML documents. The fields of this class are NOT initialized in + * constructor. You need to do this separately before passing this data + * structure to the HTML parser. The subclasses with the fields, pre- + * initialized, for example, for HTML 4.01, can be available only between + * the implementation specific classes + * ( for example, {@link gnu.javax.swing.text.html.parser.HTML_401F } + * in this implementation).</p> + * <p> + * If you need more information about SGML DTD documents, + * the author suggests to read SGML tutorial on + * {@link http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html}. + * We also recommend Goldfarb C.F (1991) <i>The SGML Handbook</i>, + * Oxford University Press, 688 p, ISBN: 0198537379. + * </p> + * <p> + * Warning: the html, head and other tag fields will only be automatically + * assigned if the VM has the correctly implemented reflection mechanism. + * As these fields are not used anywhere in the implementation, not + * exception will be thrown in the opposite case. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class DTD + implements DTDConstants, Serializable +{ + /** + * The version of the persistent data format. + */ + public static int FILE_VERSION = 1; + + /** + * The table of existing available DTDs. + */ + static Hashtable dtdHash = new Hashtable(); + + /** + * The applet element for this DTD. + */ + public Element applet; + + /** + * The base element for this DTD. + */ + public Element base; + + /** + * The body element for this DTD. + */ + public Element body; + + /** + * The head element for this DTD. + */ + public Element head; + + /** + * The html element for this DTD. + */ + public Element html; + + /** + * The isindex element of for this DTD. + */ + public Element isindex; + + /** + * The meta element for this DTD. + */ + public Element meta; + + /** + * The p element for this DTD. + */ + public Element p; + + /** + * The param element for this DTD. + */ + public Element param; + + /** + * The pcdata for this DTD. + */ + public Element pcdata; + + /** + * The title element for this DTD. + */ + public Element title; + + /** + * The element for accessing all DTD elements by name. + */ + public Hashtable elementHash = new Hashtable(); + + /** + * The entity table for accessing all DTD entities by name. + */ + public Hashtable entityHash = new Hashtable(); + + /** + * The name of this DTD. + */ + public String name; + + /** + * Contains all elements in this DTD. The + * javax.swing.text.html.parser.Element#index field of all elements + * in this vector is set to the element position in this vector. + */ + public Vector elements = new Vector(); + + /** Create a new DTD with the specified name. */ + protected DTD(String a_name) + { + name = a_name; + } + + /** Get this DTD by name. The current implementation + * only looks in the internal table of DTD documents. If no corresponding + * entry is found, the new entry is created, placed into + * the table and returned. */ + public static DTD getDTD(String name) + throws IOException + { + DTD d = (DTD) dtdHash.get(name); + + if (d == null) + { + d = new DTD(name); + dtdHash.put(d.name, d); + } + + return d; + } + + /** + * Get the element by the element name. If the element is not yet + * defined, it is newly created and placed into the element table. + * If the element name matches (ingoring case) a public non static + * element field in this class, this field is assigned to the value + * of the newly created element. + */ + public Element getElement(String element_name) + { + Element e = newElement(element_name); + return e; + } + + /** + * Get the element by the value of its + * {@link javax.swing.text.html.parser.Element#index} field. + */ + public Element getElement(int index) + { + return (Element) elements.get(index); + } + + /** + * Get the entity with the given identifier. + * @param id that can be returned by + * {@link javax.swing.text.html.parser.Entity#name2type(String an_entity)} + * @return The entity from this DTD or null if there is no entity with + * such id or such entity is not present in the table of this instance. + */ + public Entity getEntity(int id) + { + String name = Entity.mapper.get(id); + + if (name != null) + return (Entity) entityHash.get(name); + else + return null; + } + + /** + * Get the named entity by its name. + */ + public Entity getEntity(String entity_name) + { + return (Entity) entityHash.get(entity_name); + } + + /** + * Get the name of this instance of DTD + */ + public String getName() + { + return name; + } + + /** + * Creates, adds into the entity table and returns the + * character entity like <code>&lt;</code> + * (means '<code><</code>' ); + * @param name The entity name (without heading & and closing ;) + * @param type The entity type + * @param character The entity value (single character) + * @return The created entity + */ + public Entity defEntity(String name, int type, int character) + { + Entity e = newEntity(name, type); + e.data = new char[] { (char) character }; + return e; + } + + /** + * Define the attributes for the element with the given name. + * If the element is not exist, it is created. + * @param forElement + * @param attributes + */ + public void defineAttributes(String forElement, AttributeList attributes) + { + Element e = (Element) elementHash.get(forElement.toLowerCase()); + + if (e == null) + e = newElement(forElement); + + e.atts = attributes; + } + + /** + * Defines the element and adds it to the element table. Sets the + * <code>Element.index</code> field to the value, unique for this + * instance of DTD. If the element with the given name already exists, + * replaces all other its settings by the method argument values. + * @param name the name of the element + * @param type the type of the element + * @param headless true if the element needs no starting tag + * (should not occur in HTML). + * @param tailless true if the element needs no ending tag (like + * <code><hr></code> + * @param content the element content + * @param exclusions the set of elements that must not occur inside + * this element. The <code>Element.index</code> value defines which + * bit in this bitset corresponds to that element. + * @param inclusions the set of elements that can occur inside this + * element. the <code>Element.index</code> value defines which + * bit in this bitset corresponds to that element. + * @param attributes the element attributes. + * @return the newly defined element. + */ + public Element defineElement(String name, int type, boolean headless, + boolean tailless, ContentModel content, + BitSet exclusions, BitSet inclusions, + AttributeList attributes + ) + { + Element e = newElement(name); + e.type = type; + e.oStart = headless; + e.oEnd = tailless; + e.content = content; + e.exclusions = exclusions; + e.inclusions = inclusions; + e.atts = attributes; + + return e; + } + + /** + * Creates, intializes and adds to the entity table the new + * entity. + * @param name the name of the entity + * @param type the type of the entity + * @param data the data section of the entity + * @return the created entity + */ + public Entity defineEntity(String name, int type, char[] data) + { + Entity e = newEntity(name, type); + e.data = data; + + return e; + } + + /** Place this DTD into the DTD table. */ + public static void putDTDHash(String name, DTD dtd) + { + dtdHash.put(name, dtd); + } + + /** + * <p>Reads DTD from an archived format. This format is not standardized + * and differs between implementations.</p><p> This implementation + * reads and defines all entities and elements using + * ObjectInputStream. The elements and entities can be written into the + * stream in any order. The objects other than elements and entities + * are ignored.</p> + * @param stream A data stream to read from. + * @throws java.io.IOException If one is thrown by the input stream + */ + public void read(DataInputStream stream) + throws java.io.IOException + { + ObjectInputStream oi = new ObjectInputStream(stream); + Object def; + try + { + while (true) + { + def = oi.readObject(); + if (def instanceof Element) + { + Element e = (Element) def; + elementHash.put(e.name.toLowerCase(), e); + assignField(e); + } + else if (def instanceof Entity) + { + Entity e = (Entity) def; + entityHash.put(e.name, e); + } + } + } + catch (ClassNotFoundException ex) + { + throw new IOException(ex.getMessage()); + } + catch (EOFException ex) + { + // ok EOF + } + } + + /** + * Returns the name of this instance of DTD. + */ + public String toString() + { + return name; + } + + /** + * Creates and returns new attribute (not an attribute list). + * @param name the name of this attribute + * @param type the type of this attribute (FIXED, IMPLIED or + * REQUIRED from <code>DTDConstants</code>). + * @param modifier the modifier of this attribute + * @param default_value the default value of this attribute + * @param allowed_values the allowed values of this attribute. The multiple + * possible values in this parameter are supposed to be separated by + * '|', same as in SGML DTD <code><!ATTLIST </code>tag. This parameter + * can be null if no list of allowed values is specified. + * @param atts the previous attribute of this element. This is + * placed to the field + * {@link javax.swing.text.html.parser.AttributeList#next }, + * creating a linked list. + * @return + */ + protected AttributeList defAttributeList(String name, int type, int modifier, + String default_value, + String allowed_values, + AttributeList atts + ) + { + AttributeList al = new AttributeList(name); + al.modifier = modifier; + al.value = default_value; + al.next = atts; + + if (allowed_values != null) + { + StringTokenizer st = new StringTokenizer(allowed_values, " \t|"); + Vector v = new Vector(st.countTokens()); + + while (st.hasMoreTokens()) + v.add(st.nextToken()); + + al.values = v; + } + + return al; + } + + /** + * Creates a new content model. + * @param type specifies the BNF operation for this content model. + * The valid operations are documented in the + * {@link javax.swing.text.html.parser.ContentModel#type }. + * @param content the content of this content model + * @param next if the content model is specified by BNF-like + * expression, contains the rest of this expression. + * @return The newly created content model. + */ + protected ContentModel defContentModel(int type, Object content, + ContentModel next + ) + { + ContentModel model = new ContentModel(); + model.type = type; + model.next = next; + model.content = content; + + return model; + } + + /** + * Defines a new element and adds it to the element table. + * If the element alredy exists, + * overrides it settings with the specified values. + * @param name the name of the new element + * @param type the type of the element + * @param headless true if the element needs no starting tag + * @param tailless true if the element needs no closing tag + * @param content the element content. + * @param exclusions the elements that must be excluded from the + * content of this element, in all levels of the hierarchy. + * @param inclusions the elements that can be included as the + * content of this element. + * @param attributes the element attributes. + * @return the created or updated element. + */ + protected Element defElement(String name, int type, boolean headless, + boolean tailless, ContentModel content, + String[] exclusions, String[] inclusions, + AttributeList attributes + ) + { + // compute the bit sets + BitSet exclude = bitSet(exclusions); + BitSet include = bitSet(inclusions); + + Element e = + defineElement(name, type, headless, tailless, content, exclude, include, + attributes + ); + + return e; + } + + /** + * Creates, intializes and adds to the entity table the new + * entity. + * @param name the name of the entity + * @param type the type of the entity + * @param data the data section of the entity + * @return the created entity + */ + protected Entity defEntity(String name, int type, String data) + { + Entity e = newEntity(name, type); + e.data = data.toCharArray(); + + return e; + } + + private void assignField(Element e) + { + String element_name = e.name; + try + { + // Assign the field via reflection. + Field f = getClass().getField(element_name.toLowerCase()); + if ((f.getModifiers() & Modifier.PUBLIC) != 0) + if ((f.getModifiers() & Modifier.STATIC) == 0) + if (f.getType().isAssignableFrom(e.getClass())) + f.set(this, e); + } + catch (IllegalAccessException ex) + { + unexpected(ex); + } + catch (NoSuchFieldException ex) + { + // This is ok. + } + + // Some virtual machines may still lack the proper + // implementation of reflection. As the tag fields + // are not used anywhere in this implementation, + // (and this class is also rarely used by the end user), + // it may be better not to crash everything by throwing an error + // for each case when the HTML parsing is required. + catch (Throwable t) + { + // This VM has no reflection mechanism implemented! + if (t instanceof OutOfMemoryError) + throw (Error) t; + } + } + + /** + * Create the bit set for this array of elements. + * The unknown elements are automatically defined and added + * to the element table. + * @param elements + * @return + */ + private BitSet bitSet(String[] elements) + { + BitSet b = new BitSet(); + + for (int i = 0; i < elements.length; i++) + { + Element e = getElement(elements [ i ]); + + if (e == null) + e = newElement(elements [ i ]); + + b.set(e.index); + } + + return b; + } + + /** + * Find the element with the given name in the element table. + * If not find, create a new element with this name and add to the + * table. + * @param name the name of the element + * @return the found or created element. + */ + private Element newElement(String name) + { + Element e = (Element) elementHash.get(name.toLowerCase()); + + if (e == null) + { + e = new Element(); + e.name = name; + e.index = elements.size(); + elements.add(e); + elementHash.put(e.name.toLowerCase(), e); + assignField(e); + } + return e; + } + + /** + * Creates and adds to the element table the entity with an + * unitialized data section. Used internally. + * @param name the name of the entity + * @param type the type of the entity, a bitwise combination + * of GENERAL, PARAMETER, SYSTEM and PUBLIC. + * @throws an error if the parameter is both GENERAL and PARAMETER + * of both PUBLIC and SYSTEM. + * @return the created entity + */ + private Entity newEntity(String name, int type) + { + Entity e = new Entity(name, type, null); + entityHash.put(e.name, e); + return e; + } + + private void unexpected(Exception ex) + { + throw new Error("This should never happen, report a bug", ex); + } +} diff --git a/javax/swing/text/html/parser/DTDConstants.java b/javax/swing/text/html/parser/DTDConstants.java new file mode 100644 index 000000000..a5da3d32d --- /dev/null +++ b/javax/swing/text/html/parser/DTDConstants.java @@ -0,0 +1,291 @@ +/* DTDConstants.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + + +/** + * <p>This class defines the SGML basic types, used for describing HTML 4.01 + * at {@link http://www.w3.org/TR/html4/types.html }. Not all constants, + * defined here, are actually used in HTML 4.01 SGML specification. Some others + * are defined just as part of the required implementation. + * </p> + * <p> + * If you need more information about SGML DTD documents, + * the author suggests to read SGML tutorial on + * {@link http://www.w3.org/TR/WD-html40-970708/intro/sgmltut.html}. + * We also recommend Goldfarb C.F (1991) <i>The SGML Handbook</i>, + * Oxford University Press, 688 p, ISBN: 0198537379. + * </p> + * + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public interface DTDConstants +{ + /* ----- The data types, used in HTML 4.01 SGML definition: ---- */ + + /** + * The CDATA (Character data) constant, specifes the content model, + * consisting of characters only. In SGML for HTML 4.01, the character + * entities must be replaced by characters, the line feeds must be + * ignored and any number of the subsequent carriage returns or tabs + * must be replaced by a single space. + */ + int CDATA = 1; + + /** + * The EMPTY constant, means the element with no content. + */ + int EMPTY = 17; + + /** + * The ID constant, means that the token is the unique identifier. + * This identifier can be referenced by attribute with value of IDREF. + * The identifier must begin with letter, followed by any number of + * letters, digits, hyphens, underscores, colons and periods. + */ + int ID = 4; + + /** + * The IDREF constant, specifies reference to a valid ID within + * the document. + */ + int IDREF = 5; + + /** + * The IDREFS constant, a space separated list of IDREFs + */ + int IDREFS = 6; + + /** + * The NAME constant, means the token that + * must begin with letter, followed by any number of + * letters, digits, hyphens, underscores, colons and periods. + */ + int NAME = 7; + + /** + * The NAMES constant, specifies a space separated of NAMEs. + */ + int NAMES = 8; + + /** + * The NMTOKEN constant, specifies the attribute, consisting of + * characters that can be either digits or alphabetic characters). + */ + int NMTOKEN = 9; + + /** + * The NMTOKENS constant, specifies a list of NMTOKENs. + */ + int NMTOKENS = 10; + + /** + * The NOTATION constant, a previously defined data type. + */ + int NOTATION = 11; + + /** + * The NUMBER constant (means that the attribute consists of at least + * one decimal digit). + */ + int NUMBER = 12; + + /** + * The NUMBERS constant, specifies a space separated list of NUMBERs. + */ + int NUMBERS = 13; + + /** + * The NUTOKEN constant. + */ + int NUTOKEN = 14; + + /** + * The NUTOKENS constant. + */ + int NUTOKENS = 15; + + /* ------- + The entity scope constants. + As these four constants are combined with the bitwise OR, + they are defined in the hexadecimal notation. + The reason of setting the two bits at once (for PUBLIC and SYSTEM) + is probably historical. ----- */ + + /** + * The PUBLIC constant, specifies the public entity. The PUBLIC entities + * are assumed to be known to many systems so that a full declaration + * need not be transmitted. For example, + * <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.0//EN"> + */ + int PUBLIC = 0xA; + + /** + * The SYSTEM constant, specifies the system entitiy. The system entities + * are assumed to be known but require the clear identifer + * (like the file path), where they can be found in the system. + * For example, <code> + * <DOCTYPE html SYSTEM "/path/to/file.dtd"> </code>. + */ + int SYSTEM = 0x11; + + /** + * The PARAMETER constant, specifies that entity is only valid + * inside SGML DTD scope. + */ + int PARAMETER = 0x40000; + + /** + * The GENERAL constant, specifies theat the entity is valid in the + * whole HTML document scope. + */ + int GENERAL = 0x10000; + + /* ---- The constants, defining if the element attribute is required, + fixed or implied. ---- */ + + /** + * The attribute modifier #REQUIRED constant, indicates that the + * value must be supplied. + */ + int REQUIRED = 2; + + /** + * The attribute modifier #FIXED constant, means that the attribute has + * the fixed value that cannot be changed. + */ + int FIXED = 1; + + /** + * The attribute modifier #IMPLIED constant, + * indicating that for this attribute the user agent must provide + * the value itself. + */ + int IMPLIED = 5; + + /** + * The attribute modifier #CURRENT constant, specifies the value + * that at any point in the document is the last value supplied for + * that element. A value is required to be supplied for the first + * occurrence of an element + */ + int CURRENT = 3; + + /** + * The attribute modifier #CONREF constant, specifies the IDREF value of + * the reference to content in another location of the document. + * The element with this attribute is empty, the content from + * that another location must be used instead. + */ + int CONREF = 4; + + /* ----- Constants, defining if the element + start and end tags are required. ---- */ + + /** + * The STARTTAG, meaning that the element needs a starting tag. + */ + int STARTTAG = 13; + + /** + * The ENDTAG constant, meaning that the element needs a closing tag. + */ + int ENDTAG = 14; + + /* ----- Other constants: ----- */ + + /** + * The ANY constant, specifies + * an attribute, consisting from arbitrary characters. + */ + int ANY = 19; + + /** + * The DEFAULT constant, specifies the default value. + */ + int DEFAULT = 131072; + + /** + * The ENTITIES constant (list of ENTITYes) + */ + int ENTITIES = 3; + + /** + * The ENTITY constant, meaning the numeric or symbolic name of some + * HTML data. + */ + int ENTITY = 2; + + /** + * The MD constant. + */ + int MD = 16; + + /** + * The MODEL constant. + */ + int MODEL = 18; + + /** + * The MS constant. + */ + int MS = 15; + + /** + * The PI (Processing Instruction) constant, specifies a processing + * instruction. Processing instructions are used to embed information + * intended for specific applications. + */ + int PI = 12; + + /** + * The RCDATA constant (Entity References and Character Data), specifies + * the content model, consisting of characters AND entities. The + * "<" is threated as an ordinary character, but + * "<code>&name;</code>" still means the general entity with + * the given name. + */ + int RCDATA = 16; + + /** + * The SDATA constant. Means that the value contains the entity name + * and the replacement value of a character entity reference. + */ + int SDATA = 11; +} diff --git a/javax/swing/text/html/parser/DocumentParser.java b/javax/swing/text/html/parser/DocumentParser.java new file mode 100644 index 000000000..26abe8bf7 --- /dev/null +++ b/javax/swing/text/html/parser/DocumentParser.java @@ -0,0 +1,151 @@ +/* DocumentParser.java -- A parser for HTML documents. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + +import java.io.IOException; +import java.io.Reader; + +/** + * <p>A simple error-tolerant HTML parser that uses a DTD document + * to access data on the possible tokens, arguments and syntax.</p> + * <p> The parser reads an HTML content from a Reader and calls various + * notifying methods (which should be overridden in a subclass) + * when tags or data are encountered.</p> + * <p>Some HTML elements need no opening or closing tags. The + * task of this parser is to invoke the tag handling methods also when + * the tags are not explicitly specified and must be supposed using + * information, stored in the DTD. + * For example, parsing the document + * <p><table><tr><td>a<td>b<td>c</tr> <br> + * will invoke exactly the handling methods exactly in the same order + * (and with the same parameters) as if parsing the document: <br> + * <em><html><head></head><body><table>< + * tbody></em><tr><td>a<em></td></em><td>b<em> + * </td></em><td>c<em></td></tr></em>< + * <em>/tbody></table></body></html></em></p> + * (supposed tags are given in italics). The parser also supports + * obsolete elements of HTML syntax.<p> + * </p> + * In this implementation, DocumentParser is directly derived from its + * ancestor without changes of functionality. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class DocumentParser + extends Parser + implements DTDConstants +{ + /** + * Creates a new parser that uses the given DTD to access data on the + * possible tokens, arguments and syntax. There is no single - step way + * to get a default DTD; you must either refer to the implementation - + * specific packages, write your own DTD or obtain the working instance + * of parser in other way, for example, by calling + * {@link javax.swing.text.html.HTMLEditorKit#getParser() }. + * @param a_dtd A DTD to use. + */ + public DocumentParser(DTD a_dtd) + { + super(a_dtd); + } + + /** + * Parse the HTML text, calling various methods in response to the + * occurence of the corresponding HTML constructions. + * @param reader The reader to read the source HTML from. + * @throws IOException If the reader throws one. + */ + public synchronized void parse(Reader reader) + throws IOException + { + super.parse(reader); + } + + /** + * Handle HTML comment. The default method returns without action. + * @param comment The comment being handled + */ + protected void handleComment(char[] comment) + { + } + + /** + * Handle the tag with no content, like <br>. The method is + * called for the elements that, in accordance with the current DTD, + * has an empty content. + * @param tag The tag being handled. + * @throws javax.swing.text.ChangedCharSetException + */ + protected void handleEmptyTag(TagElement tag) + throws javax.swing.text.ChangedCharSetException + { + } + + /** + * The method is called when the HTML closing tag ((like </table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param The tag being handled + */ + protected void handleEndTag(TagElement tag) + { + } + + /* Handle error that has occured in the given line. */ + protected void handleError(int line, String message) + { + } + + /** + * The method is called when the HTML opening tag ((like <table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param The tag being handled + */ + protected void handleStartTag(TagElement tag) + { + } + + /** + * Handle the text section. + * @param text A section text. + */ + protected void handleText(char[] text) + { + } +} diff --git a/javax/swing/text/html/parser/Element.java b/javax/swing/text/html/parser/Element.java new file mode 100644 index 000000000..3431a426c --- /dev/null +++ b/javax/swing/text/html/parser/Element.java @@ -0,0 +1,317 @@ +/* Element.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.support.gnuStringIntMapper; + +import java.io.Serializable; + +import java.util.BitSet; + +/** + * <p> + * Stores the element information, obtained by parsing SGML DTD + * tag <code><!ELEMENT .. ></code>. This class has no public + * constructor and can only be instantiated using the + * {@link javax.swing.text.html.parser.DTD } methods</p> + * + * <p>SGML defines elements that represent structures or + * behavior. An element typically consists of a start tag, content, and an + * end tag. Hence the elements are not tags. The HTML 4.0 definition specifies + * that some elements are not required to have the end tags. Also, some + * HTML elements (like <code><hr></code>) have no content. Element names + * are case sensitive.</p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class Element + implements DTDConstants, Serializable +{ + /** + * Package level mapper between type names and they string values. + */ + final static gnuStringIntMapper mapper = + new gnuStringIntMapper() + { + protected void create() + { + add("CDATA", DTDConstants.CDATA); + add("RCDATA", DTDConstants.RCDATA); + add("EMPTY", DTDConstants.EMPTY); + add("ANY", DTDConstants.ANY); + } + }; + + /** Use serialVersionUID for interoperability. */ + private final static long serialVersionUID = -6717939384601675586L; + + /** + * The element attributes. + */ + public AttributeList atts; + + /** + * Contains refernces to elements that must NOT occur inside this element, + * at any level of hierarchy. + */ + public BitSet exclusions; + + /** + * Contains refernces to elements that must CAN occur inside this element, + * at any level of hierarchy. + */ + public BitSet inclusions; + + /** + * The content model, defining elements, entities and DTD text + * that may/may not occur inside this element. + */ + public ContentModel content; + + /** + * A field to store additional user data for this Element. + */ + public Object data; + + /** + * The element name. + */ + public String name; + + /** + * True is this element need not to have the closing tag, false + * otherwise. The HTML 4.0 definition specifies + * that some elements (like <code><hr></code>are + * not required to have the end tags. + */ + public boolean oEnd; + + /** + * True is this element need not to have the starting tag, false + * otherwise. The HTML 4.0 definition specifies + * that some elements (like <code><head></code> or + * <code><body></code>) are + * not required to have the start tags. + + */ + public boolean oStart; + + /** + * This field contains the unique integer identifier of this Element, + * used to refer the element (more exactly, the element flag) + * in <code>inclusions</code> and <code>exclusions</code> bit set. + */ + public int index; + + /** + * The element type, containing value, defined in DTDConstants. + * In this implementation, the element type can be + * CDATA, RCDATA, EMPTY or ANY. + */ + public int type; + + /** + * The default constructor must have package level access in this + * class. Use DTD.defineElement(..) to create an element when required. + * @todo MAKE THIS PACKAGE in the final version. Now the Parser needs it! + */ + Element() + { + } + + /** + * Converts the string representation of the element type + * into its unique integer identifier, defined in DTDConstants. + * @param a_type A name of the type + * @return DTDConstants.CDATA, DTDConstants.RCDATA, DTDConstants.EMPTY, + * DTDConstants.ANY or null if the type name is not + * "CDATA", "RCDATA", "EMPTY" or "ANY". This function is case sensitive. + * @throws NullPointerException if <code>a_type</code> is null. + */ + public static int name2type(String a_type) + { + return mapper.get(a_type); + } + + /** + * Get the element attribute by name. + * @param attribute the attribute name, case insensitive. + * @return the correspoding attribute of this element. The class, + * for storing as attribute list, as a single attribute, is used to + * store a single attribute in this case. + * @throws NullPointerException if the attribute name is null. + */ + public AttributeList getAttribute(String attribute) + { + AttributeList a = atts; + + while (a != null && !attribute.equalsIgnoreCase(a.name)) + a = a.next; + + return a; + } + + /** + * Get the element attribute by its value. + * @param a_value the attribute value, case insensitive. + * @return the correspoding attribute of this element. The class, + * for storing as attribute list, as a single attribute, is used to + * store a single attribute in this case. If there are several + * attributes with the same value, there is no garranty, which one + * is returned. + */ + public AttributeList getAttributeByValue(String a_value) + { + AttributeList a = atts; + + if (a_value == null) + { + while (a != null) + { + if (a.value == null) + return a; + + a = a.next; + } + } + else + { + while (a != null) + { + if (a.value != null && a_value.equalsIgnoreCase(a.value)) + return a; + + a = a.next; + } + } + + return null; + } + + /** + * Get all attributes of this document as an attribute list. + * @return + */ + public AttributeList getAttributes() + { + return atts; + } + + /** + * Get the content model, defining elements, entities and DTD text + * that may/may not occur inside this element. + */ + public ContentModel getContent() + { + return content; + } + + /** + * Returns true for the element with no content. + * Empty elements are defined with the SGML DTD keyword "EMPTY". + * @return true if content model field (content) method is equal to + * null or its method empty() returns true. + */ + public boolean isEmpty() + { + return content == null || content.empty(); + } + + /** + * Get the unique integer identifier of this Element, + * used to refer the element (more exactly, the element flag) + * in <code>inclusions</code> and <code>exclusions</code> bit set. + * WARNING: This value may not be the same between different + * implementations. + */ + public int getIndex() + { + return index; + } + + /** + * Get the element name. + */ + public String getName() + { + return name; + } + + /** + * Get the element type. + * @return one of the values, defined DTDConstants. + * In this implementation, the element type can be + * CDATA, RCDATA, EMPTY or ANY. + */ + public int getType() + { + return type; + } + + /** + * True is this element need not to have the starting tag, false + * otherwise.s element need not to have the closing tag, false + * otherwise. The HTML 4.0 definition specifies + * that some elements (like <code><hr></code>are + * not required to have the end tags. + */ + public boolean omitEnd() + { + return oEnd; + } + + /** + * True is this element need not to have the closing tag, false + * otherwise. The HTML 4.0 definition specifies + * that some elements (like <code><head></code> or + * <code><body></code>) are + * not required to have the start tags. + */ + public boolean omitStart() + { + return oStart; + } + + /** + * Returns the name of this element. + */ + public String toString() + { + return name; + } +} diff --git a/javax/swing/text/html/parser/Entity.java b/javax/swing/text/html/parser/Entity.java new file mode 100644 index 000000000..bf527e7e1 --- /dev/null +++ b/javax/swing/text/html/parser/Entity.java @@ -0,0 +1,175 @@ +/* Entity.java -- Stores information, obtained by parsing SGML DTL + * <!ENTITY % .. > tag + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.support.gnuStringIntMapper; + +import java.io.Serializable; + +/** + * <p>Stores information, obtained by parsing SGML DTL + * <!ENTITY % .. > tag.</p> + * <p> + * The entity defines some kind of macro that can be used elsewhere in + * the document. + * When the macro is referred to by the name in the DTD, it is expanded into + * a string + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public final class Entity + implements Serializable +{ + /** + * Package level mapper between type names and they string values. + */ + final static gnuStringIntMapper mapper = + new gnuStringIntMapper() + { + protected void create() + { + add("ANY", DTDConstants.ANY); + add("CDATA", DTDConstants.CDATA); + add("PUBLIC", DTDConstants.PUBLIC); + add("SDATA", DTDConstants.SDATA); + add("PI", DTDConstants.PI); + add("STARTTAG", DTDConstants.STARTTAG); + add("ENDTAG", DTDConstants.ENDTAG); + add("MS", DTDConstants.MS); + add("MD", DTDConstants.MD); + add("SYSTEM", DTDConstants.SYSTEM); + } + }; + + /** + * The entity name. + */ + public String name; + + /** + * The entity data + */ + public char[] data; + + /** + * The entity type. + */ + public int type; + + /** + * String representation of the entity data. + */ + private String sdata; + + /** + * Create a new entity + * @param a_name the entity name + * @param a_type the entity type + * @param a_data the data replacing the entity reference + */ + public Entity(String a_name, int a_type, char[] a_data) + { + name = a_name; + type = a_type; + data = a_data; + } + + /** + * Converts a given string to the corresponding entity type. + * @return a value, defined in DTDConstants (one of + * PUBLIC, CDATA, SDATA, PI, STARTTAG, ENDTAG, MS, MD, SYSTEM) + * or CDATA if the parameter is not a valid entity type. + */ + public static int name2type(String an_entity) + { + int r = mapper.get(an_entity); + return (r == 0) ? DTDConstants.CDATA : r; + } + + /** + * Get the entity data. + */ + public char[] getData() + { + return data; + } + + /** + * Returns true for general entities. Each general entity can be + * referenced as <code>&entity-name;</code>. Such entities are + * defined by the SGML DTD tag + * <code><!ENTITY <i>name</i> "<i>value</i>"></code>. The general + * entities can be used anywhere in the document. + */ + public boolean isGeneral() + { + return (type & DTDConstants.GENERAL) != 0; + } + + /** + * Get the entity name. + */ + public String getName() + { + return name; + } + + /** + * Returns true for parameter entities. Each parameter entity can be + * referenced as <code>&entity-name;</code>. Such entities are + * defined by the SGML DTD tag + * <code><!ENTITY % <i>name</i> "<i>value</i>"></code>. The parameter + * entities can be used only in SGML context. + */ + public boolean isParameter() + { + return (type & DTDConstants.PARAMETER) != 0; + } + + /** + * Returns a data as String + */ + public String getString() + { + if (sdata == null) + sdata = new String(data); + + return sdata; + } +} diff --git a/javax/swing/text/html/parser/Parser.java b/javax/swing/text/html/parser/Parser.java new file mode 100644 index 000000000..68593669f --- /dev/null +++ b/javax/swing/text/html/parser/Parser.java @@ -0,0 +1,434 @@ +/* Parser.java -- HTML parser. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +/* +* FOR DEVELOPERS: To avoid regression, please run the package test +* textsuite/javax.swing.text.html.parser/AllParserTests after your +* modifications. +*/ + +package javax.swing.text.html.parser; + +import java.io.IOException; +import java.io.Reader; + +import javax.swing.text.ChangedCharSetException; +import javax.swing.text.SimpleAttributeSet; + +/** + * <p>A simple error-tolerant HTML parser that uses a DTD document + * to access data on the possible tokens, arguments and syntax.</p> + * <p> The parser reads an HTML content from a Reader and calls various + * notifying methods (which should be overridden in a subclass) + * when tags or data are encountered.</p> + * <p>Some HTML elements need no opening or closing tags. The + * task of this parser is to invoke the tag handling methods also when + * the tags are not explicitly specified and must be supposed using + * information, stored in the DTD. + * For example, parsing the document + * <p><table><tr><td>a<td>b<td>c</tr> <br> + * will invoke exactly the handling methods exactly in the same order + * (and with the same parameters) as if parsing the document: <br> + * <em><html><head></head><body><table>< + * tbody></em><tr><td>a<em></td></em><td>b<em> + * </td></em><td>c<em></td></tr></em>< + * <em>/tbody></table></body></html></em></p> + * (supposed tags are given in italics). The parser also supports + * obsolete elements of HTML syntax.<p> + * </p> + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class Parser +{ + /** + * The document template description that will be used to parse the documents. + */ + protected DTD dtd; + + /** + * The value of this field determines whether or not the Parser will be + * strict in enforcing SGML compatibility. The default value is false, + * stating that the parser should do everything to parse and get at least + * some information even from the incorrectly written HTML input. + */ + protected boolean strict; + + /** + * The package level reference to the working HTML parser in this + * implementation. + */ + final gnu.javax.swing.text.html.parser.support.Parser gnu; + + /** + * Creates a new parser that uses the given DTD to access data on the + * possible tokens, arguments and syntax. There is no single - step way + * to get a default DTD; you must either refer to the implementation - + * specific packages, write your own DTD or obtain the working instance + * of parser in other way, for example, by calling + * {@link javax.swing.text.html.HTMLEditorKit#getParser() }. + * @param a_dtd A DTD to use. + */ + public Parser(DTD a_dtd) + { + dtd = a_dtd; + + final Parser j = this; + + gnu = + new gnu.javax.swing.text.html.parser.support.Parser(dtd) + { + protected final void handleComment(char[] comment) + { + j.handleComment(comment); + } + + protected final void handleEOFInComment() + { + j.handleEOFInComment(); + } + + protected final void handleEmptyTag(TagElement tag) + throws javax.swing.text.ChangedCharSetException + { + j.handleEmptyTag(tag); + } + + protected final void handleStartTag(TagElement tag) + { + j.handleStartTag(tag); + } + + protected final void handleEndTag(TagElement tag) + { + j.handleEndTag(tag); + } + + protected final void handleError(int line, String message) + { + j.handleError(line, message); + } + + protected final void handleText(char[] text) + { + j.handleText(text); + } + + protected final void handleTitle(char[] title) + { + j.handleTitle(title); + } + + protected final void markFirstTime(Element element) + { + j.markFirstTime(element); + } + + protected final void startTag(TagElement tag) + throws ChangedCharSetException + { + j.startTag(tag); + } + + protected final void endTag(boolean omitted) + { + j.endTag(omitted); + } + + protected TagElement makeTag(Element element) + { + return j.makeTag(element); + } + + protected TagElement makeTag(Element element, boolean isSupposed) + { + return j.makeTag(element, isSupposed); + } + }; + } + + /** + * Parse the HTML text, calling various methods in response to the + * occurence of the corresponding HTML constructions. + * @param reader The reader to read the source HTML from. + * @throws IOException If the reader throws one. + */ + public synchronized void parse(Reader reader) + throws IOException + { + gnu.parse(reader); + } + + /** + * Parses DTD markup declaration. Currently returns without action. + * @return null. + * @throws java.io.IOException + */ + public String parseDTDMarkup() + throws IOException + { + return gnu.parseDTDMarkup(); + } + + /** + * Parse DTD document declarations. Currently only parses the document + * type declaration markup. + * @param strBuff + * @return true if this is a valid DTD markup declaration. + * @throws IOException + */ + public boolean parseMarkupDeclarations(StringBuffer strBuff) + throws IOException + { + return gnu.parseMarkupDeclarations(strBuff); + } + + /** + * Get the attributes of the current tag. + * @return The attribute set, representing the attributes of the current tag. + */ + protected SimpleAttributeSet getAttributes() + { + return gnu.getAttributes(); + } + + /** + * Get the number of the document line being parsed. + * @return The current line. + */ + protected int getCurrentLine() + { + return gnu.hTag.where.beginLine; + } + + /** + * Get the current position in the document being parsed. + * @return The current position. + */ + protected int getCurrentPos() + { + return gnu.hTag.where.startPosition; + } + + /** + * The method is called when the HTML end (closing) tag is found or if + * the parser concludes that the one should be present in the + * current position. The method is called immediatly + * before calling the handleEndTag(). + * @param omitted True if the tag is no actually present in the document, + * but is supposed by the parser (like </html> at the end of the + * document). + */ + protected void endTag(boolean omitted) + { + } + + /** + * Invokes the error handler. The default method in this implementation + * finally delegates the call to handleError, also providing the number of the + * current line. + */ + protected void error(String msg) + { + gnu.error(msg); + } + + /** + * Invokes the error handler. The default method in this implementation + * finally delegates the call to error (msg+": '"+invalid+"'"). + */ + protected void error(String msg, String invalid) + { + gnu.error(msg, invalid); + } + + /** + * Invokes the error handler. The default method in this implementation + * finally delegates the call to error (parm1+" "+ parm2+" "+ parm3). + */ + protected void error(String parm1, String parm2, String parm3) + { + gnu.error(parm1, parm2, parm3); + } + + /** + * Invokes the error handler. The default method in this implementation + * finally delegates the call to error + * (parm1+" "+ parm2+" "+ parm3+" "+ parm4). + */ + protected void error(String parm1, String parm2, String parm3, String parm4) + { + gnu.error(parm1, parm2, parm3, parm4); + } + + /** + * In this implementation, this is never called and returns without action. + */ + protected void flushAttributes() + { + gnu.flushAttributes(); + } + + /** + * Handle HTML comment. The default method returns without action. + * @param comment The comment being handled + */ + protected void handleComment(char[] comment) + { + } + + /** + * This is additionally called in when the HTML content terminates + * without closing the HTML comment. This can only happen if the + * HTML document contains errors (for example, the closing --;gt is + * missing. The default method calls the error handler. + */ + protected void handleEOFInComment() + { + gnu.error("Unclosed comment"); + } + + /** + * Handle the tag with no content, like <br>. The method is + * called for the elements that, in accordance with the current DTD, + * has an empty content. + * @param The tag being handled. + * @throws javax.swing.text.ChangedCharSetException + */ + protected void handleEmptyTag(TagElement tag) + throws javax.swing.text.ChangedCharSetException + { + } + + /** + * The method is called when the HTML closing tag ((like </table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param The tag being handled + */ + protected void handleEndTag(TagElement tag) + { + } + + /* Handle error that has occured in the given line. */ + protected void handleError(int line, String message) + { + } + + /** + * The method is called when the HTML opening tag ((like <table>) + * is found or if the parser concludes that the one should be present + * in the current position. + * @param The tag being handled + */ + protected void handleStartTag(TagElement tag) + { + } + + /** + * Handle the text section. + * <p> For non-preformatted section, the parser replaces + * \t, \r and \n by spaces and then multiple spaces + * by a single space. Additionaly, all whitespace around + * tags is discarded. + * </p> + * <p> For pre-formatted text (inside TEXAREA and PRE), the parser preserves + * all tabs and spaces, but removes <b>one</b> bounding \r, \n or \r\n, + * if it is present. Additionally, it replaces each occurence of \r or \r\n + * by a single \n.</p> + * + * @param text A section text. + */ + protected void handleText(char[] text) + { + } + + /** + * Handle HTML <title> tag. This method is invoked when + * both title starting and closing tags are already behind. + * The passed argument contains the concatenation of all + * title text sections. + * @param The title text. + */ + protected void handleTitle(char[] title) + { + } + + /** + * Constructs the tag from the given element. In this implementation, + * this is defined, but never called. + * @param element the base element of the tag. + * @return the tag + */ + protected TagElement makeTag(Element element) + { + return makeTag(element, false); + } + + /** + * Constructs the tag from the given element. + * @param the tag base {@link javax.swing.text.html.parser.Element} + * @param isSupposed true if the tag is not actually present in the + * html input, but the parser supposes that it should to occur in + * the current location. + * @return the tag + */ + protected TagElement makeTag(Element element, boolean isSupposed) + { + return new TagElement(element, isSupposed); + } + + /** + * This is called when the tag, representing the given element, + * occurs first time in the document. + * @param element + */ + protected void markFirstTime(Element element) + { + } + + /** + * The method is called when the HTML opening tag ((like <table>) + * is found or if the parser concludes that the one should be present + * in the current position. The method is called immediately before + * calling the handleStartTag. + * @param The tag + */ + protected void startTag(TagElement tag) + throws ChangedCharSetException + { + } +} diff --git a/javax/swing/text/html/parser/ParserDelegator.java b/javax/swing/text/html/parser/ParserDelegator.java index 58c2bc37b..a7b592680 100644 --- a/javax/swing/text/html/parser/ParserDelegator.java +++ b/javax/swing/text/html/parser/ParserDelegator.java @@ -1,5 +1,5 @@ -/* ParserDelegator - Delegator for ParserDocument. - Copyright (C) 2002 Free Software Foundation, Inc. +/* ParserDelegator.java -- Delegator for ParserDocument. + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -35,12 +35,172 @@ this exception to your version of the library, but you are not obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ + package javax.swing.text.html.parser; +import gnu.javax.swing.text.html.parser.HTML_401F; +import gnu.javax.swing.text.html.parser.htmlAttributeSet; + +import java.io.IOException; +import java.io.Reader; +import java.io.Serializable; + +import javax.swing.text.BadLocationException; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.HTMLEditorKit.ParserCallback; + /** - * Stub implementeation to get gjdoc working. + * This class instantiates and starts the working instance of + * html parser, being responsible for providing the default DTD. + * + * TODO Later this class must be derived from the totally abstract class + * HTMLEditorKit.Parser. HTMLEditorKit that does not yet exist. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) */ -//public class ParserDelegator extends HTMLEditorKit.Parser public class ParserDelegator + extends javax.swing.text.html.HTMLEditorKit.Parser + implements Serializable { + private class gnuParser + extends gnu.javax.swing.text.html.parser.support.Parser + { + private final static long serialVersionUID = 1; + + private gnuParser(DTD d) + { + super(d); + } + + protected final void handleComment(char[] comment) + { + callBack.handleComment(comment, hTag.where.startPosition); + } + + protected final void handleEmptyTag(TagElement tag) + throws javax.swing.text.ChangedCharSetException + { + callBack.handleSimpleTag(tag.getHTMLTag(), getAttributes(), + hTag.where.startPosition + ); + } + + protected final void handleEndTag(TagElement tag) + { + callBack.handleEndTag(tag.getHTMLTag(), hTag.where.startPosition); + } + + protected final void handleError(int line, String message) + { + callBack.handleError(message, hTag.where.startPosition); + } + + protected final void handleStartTag(TagElement tag) + { + htmlAttributeSet attributes = gnu.getAttributes(); + + if (tag.fictional()) + attributes.addAttribute(ParserCallback.IMPLIED, Boolean.TRUE); + + callBack.handleStartTag(tag.getHTMLTag(), attributes, + hTag.where.startPosition + ); + } + + protected final void handleText(char[] text) + { + callBack.handleText(text, hTag.where.startPosition); + } + + DTD getDTD() + { + return dtd; + } + } + + /** + * Use serialVersionUID for interoperability. + */ + private final static long serialVersionUID = -1276686502624777206L; + private static DTD dtd = HTML_401F.getInstance(); + + /** + * The callback. + */ + private HTMLEditorKit.ParserCallback callBack; + + /** + * The reference to the working class of HTML parser that is + * actually used to parse the document. + */ + private gnuParser gnu; + + /** + * Parses the HTML document, calling methods of the provided + * callback. This method must be multithread - safe. + * @param reader The reader to read the HTML document from + * @param callback The callback that is notifyed about the presence + * of HTML elements in the document. + * @param ignoreCharSet If thrue, any charset changes during parsing + * are ignored. + * @throws java.io.IOException + */ + public void parse(Reader reader, HTMLEditorKit.ParserCallback a_callback, + boolean ignoreCharSet + ) + throws IOException + { + callBack = a_callback; + + if (gnu == null || !dtd.equals(gnu.getDTD())) + { + gnu = new gnuParser(dtd); + } + + gnu.parse(reader); + + callBack.handleEndOfLineString(gnu.getEndOfLineSequence()); + try + { + callBack.flush(); + } + catch (BadLocationException ex) + { + // Convert this into the supported type of exception. + throw new IOException(ex.getMessage()); + } + } + + /** + * Calling this method instructs that, if not specified directly, + * the documents will be parsed using the default + * DTD of the implementation. + */ + protected static void setDefaultDTD() + { + dtd = HTML_401F.getInstance(); + } + + /** + * Registers the user - written DTD under the given name, also + * making it default for the subsequent parsings. This has effect on + * all subsequent calls to the parse(...) . If you need to specify + * your DTD locally, simply {@link javax.swing.text.html.parser.Parser} + * instead. + * @param dtd The DTD that will be used to parse documents by this class. + * @param name The name of this DTD. + * @return No standard is specified on which instance of DTD must be + * returned by this method, and it is recommended to leave the returned + * value without consideration. This implementation returns the DTD + * that was previously set as the default DTD, or the implementations + * default DTD if none was set. + */ + protected static DTD createDTD(DTD a_dtd, String name) + { + DTD.putDTDHash(name, a_dtd); + + DTD dtd_prev = dtd; + dtd = a_dtd; + return dtd_prev; + } } diff --git a/javax/swing/text/html/parser/TagElement.java b/javax/swing/text/html/parser/TagElement.java new file mode 100644 index 000000000..ab9465261 --- /dev/null +++ b/javax/swing/text/html/parser/TagElement.java @@ -0,0 +1,142 @@ +/* TagElement.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.html.parser; + +import javax.swing.text.html.HTML; + +/** + * The SGML element, defining a single html tag. + * @author Audrius Meskauskas, Lithuania (AudriusA@Bioinformatics.org) + */ +public class TagElement +{ + /** + * The Element the tag was constructed from. + */ + private final Element element; + + /** + * The coresponding HTML tag, assigned once in constructor. + */ + private final HTML.Tag tag; + + /** + * The 'fictional' flag. + */ + private final boolean fictional; + + /** + * Creates the html tag element from the defintion, stored in the + * given element. Sets the flag 'fictional' to false. + * @param an_element + */ + public TagElement(Element an_element) + { + this(an_element, false); + } + + /** + * Creates the html tag element from the defintion, stored in the + * given element, setting the flag 'fictional' to the given value. + */ + public TagElement(Element an_element, boolean is_fictional) + { + element = an_element; + fictional = is_fictional; + + HTML.Tag t = HTML.getTag(element.getName()); + + if (t != null) + tag = t; + else + tag = new HTML.UnknownTag(element.getName()); + } + + /** + * Get the element from that the tag was constructed. + */ + public Element getElement() + { + return element; + } + + /** + * Get the corresponding HTML tag. This is either one of the + * pre-defined HTML tags or the instance of the UnknownTag with the + * element name. + */ + public HTML.Tag getHTMLTag() + { + return tag; + } + + /** + * Calls isPreformatted() for the corresponding html tag and returns + * the obtained value. + */ + public boolean isPreformatted() + { + return tag.isPreformatted(); + } + + /** + * Calls breaksFlow() for the corresponding html tag and returns + * the obtained value. + */ + public boolean breaksFlow() + { + return tag.breaksFlow(); + } + + /** + * Get the value of the flag 'fictional'. + */ + public boolean fictional() + { + return fictional; + } + + /** + * Returns string representation of this object. + */ + public String toString() + { + return getElement() + (fictional ? "?" : ""); + } +} diff --git a/javax/swing/text/html/parser/package.html b/javax/swing/text/html/parser/package.html index 07beaea12..d9cceb01c 100644 --- a/javax/swing/text/html/parser/package.html +++ b/javax/swing/text/html/parser/package.html @@ -1,5 +1,5 @@ <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> -<!-- package.html - describes classes in javax.swing.text.html.parser package. +<!-- package.html - describes classes in javax.swing.text.html package. Copyright (C) 2002 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -40,7 +40,11 @@ exception statement from your version. --> <head><title>GNU Classpath - javax.swing.text.html.parser</title></head> <body> -<p></p> +<p> Provides the DTD driven for web browsers, + web robots, web page content analysers, web editors and + other applications applications working with Hypertext + Markup Language (HTML). +</p> </body> </html> diff --git a/javax/swing/text/rtf/ControlWordToken.java b/javax/swing/text/rtf/ControlWordToken.java new file mode 100644 index 000000000..043cae412 --- /dev/null +++ b/javax/swing/text/rtf/ControlWordToken.java @@ -0,0 +1,86 @@ +/* ControlWordToken.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * A special {@link Token} that represents a control word in RTF like + * '\deff0' where 'deff' is the name of the control word and '0' is an + * optional parameter. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class ControlWordToken extends Token +{ + + /** + * The name of the control word. + */ + public String name; + + /** + * The optional parameter of the control word. Absence of a parameter is + * expressed through Integer.MIN_VALUE. + */ + public int param; + + /** + * Constructs a new ControlWordToken with the specified name and without + * a parameter. + * + * @param name the name of the control word + */ + public ControlWordToken(String name) + { + this(name, Integer.MIN_VALUE); + } + + + /** + * Constructs a new ControlWordToken with the specified name and parameter. + * + * @param name the name of the control word + */ + public ControlWordToken(String name, int param) + { + super(Token.CONTROL_WORD); + this.name = name; + this.param = param; + } + +} diff --git a/javax/swing/text/rtf/RTFEditorKit.java b/javax/swing/text/rtf/RTFEditorKit.java new file mode 100644 index 000000000..8a6e88a84 --- /dev/null +++ b/javax/swing/text/rtf/RTFEditorKit.java @@ -0,0 +1,114 @@ +/* RTFEditorKit.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; + +import javax.swing.text.BadLocationException; +import javax.swing.text.Document; +import javax.swing.text.StyledEditorKit; + +/** + * Provides support for RTF data for use in + * {@link javax.swing.JEditorPane}s. + * + * @author Roman Kennke (roman@ontographics.com) + */ +public class RTFEditorKit + extends StyledEditorKit +{ + + /** + * Constructs a new RTFEditorKit. + */ + public RTFEditorKit() + { + super(); + } + + /** + * Returns the MIME content type. In the case of RTFEditorKit this is + * 'text/rtf' + * + * @return the MIME content type for RTFEditorKit + */ + public String getContentType() + { + return "text/rtf"; + } + + /** + * Reads RTF data from <code>stream</code> into <code>doc</code> at the + * specified position <code>pos</code>. + * + * @param stream the {@link InputStream} from where we read RTF data + * @param doc the {@link Document} into which we read the RTF data + * @param pos the position where to start + * + * @throws IOException if an IO error occurs + * @throws BadLocationException if the position is not valid + */ + public void read(InputStream stream, Document doc, int pos) + throws IOException, BadLocationException + { + RTFParser parser = new RTFParser(stream, doc, pos); + parser.parse(); + } + + + /** + * Reads RTF data from <code>reader</code> into <code>doc</code> at the + * specified position <code>pos</code>. + * + * @param reader the {@link Reader} from where we read RTF data + * @param doc the {@link Document} into which we read the RTF data + * @param pos the position where to start + * + * @throws IOException if an IO error occurs + * @throws BadLocationException if the position is not valid + */ + public void read(Reader reader, Document doc, int pos) + throws IOException, BadLocationException + { + RTFParser parser = new RTFParser(reader, doc, pos); + parser.parse(); + } +} diff --git a/javax/swing/text/rtf/RTFParseException.java b/javax/swing/text/rtf/RTFParseException.java new file mode 100644 index 000000000..dba51d2e0 --- /dev/null +++ b/javax/swing/text/rtf/RTFParseException.java @@ -0,0 +1,65 @@ +/* RTFParseException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * Indicates a parsing error during RTF processing. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFParseException + extends RuntimeException +{ + /** + * Constructs a new RTFParseException without message. + */ + public RTFParseException() + { + super(); + } + + /** + * Constructs a new RTFParseException with the specified message. + */ + public RTFParseException(String message) + { + super(message); + } + +} diff --git a/javax/swing/text/rtf/RTFParser.java b/javax/swing/text/rtf/RTFParser.java new file mode 100644 index 000000000..b90e023a3 --- /dev/null +++ b/javax/swing/text/rtf/RTFParser.java @@ -0,0 +1,194 @@ +/* RTFParser.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.IOException; +import java.io.InputStream; +import java.io.Reader; +import javax.swing.text.Document; +import javax.swing.text.BadLocationException; + +/** + * Parses an RTF file into a {@link Document}. The parser utilizes + * {@link RTFScanner}. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFParser +{ + + /** + * Our scanner. + */ + private RTFScanner scanner; + + /** + * The document into which we parse. + */ + private Document doc; + + /** + * The current position. + */ + private int pos; + + /** + * Constructs a new RTFParser for the specified document and position, + * without initializing the scanner. This is only used internally. + * + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + private RTFParser(Document doc, int pos) + { + this.doc = doc; + this.pos = pos; + } + + /** + * Constructs a new RTFParser for the specified <code>stream</code>. + * + * @param stream the stream from which we parse + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + public RTFParser(InputStream stream, Document doc, int pos) + { + this(doc, pos); + scanner = new RTFScanner(stream); + } + + /** + * Constructs a new RTFParser for the specified <code>reader</code>. + * + * @param reader the reader from which we parse + * @param doc the {@link Document} into which we should parse + * @param pos the position to start + */ + public RTFParser(Reader reader, Document doc, int pos) + { + this(doc, pos); + scanner = new RTFScanner(reader); + } + + /** + * Returns the {@link Document} in which we parsed the RTF data. + * + * @return the {@link Document} in which we parsed the RTF data + */ + public Document getDocument() + { + return doc; + } + + /** + * Starts the parsing process. + */ + public void parse() + throws IOException, BadLocationException + { + parseFile(); + } + + /** + * The parse rules for <file>. + */ + private void parseFile() + throws IOException, BadLocationException + { + Token t1 = scanner.readToken(); + if (t1.type != Token.LCURLY) + throw new RTFParseException("expected left curly braces"); + + parseHeader(); + parseDocument(); + + Token t2 = scanner.readToken(); + if (t2.type != Token.RCURLY) + throw new RTFParseException("expected right curly braces"); + + } + + /** + * The parse rules for <header>. + * + * TODO: implement this properly + */ + private void parseHeader() + //throws IOException, BadLocationException + { + // TODO add parse rules here + } + + + /** + * The parse rules for <document>. + * + * TODO: implement this properly + */ + private void parseDocument() + throws IOException, BadLocationException + { + // !!! TODO !!! + // This simply emits every TEXT Token as text to the document + // which is plain stupid + + boolean eof = false; + + do { + Token token = scanner.readToken(); + switch (token.type) + { + case Token.TEXT: + TextToken textToken = (TextToken) token; + doc.insertString(pos, textToken.text, null); + pos += textToken.text.length(); + break; + case Token.EOF: + eof = true; + break; + default: + // FIXME + break; + } + } while (!eof); + + } + +} diff --git a/javax/swing/text/rtf/RTFScanner.java b/javax/swing/text/rtf/RTFScanner.java new file mode 100644 index 000000000..07a202676 --- /dev/null +++ b/javax/swing/text/rtf/RTFScanner.java @@ -0,0 +1,270 @@ +/* RTFScanner.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +import java.io.BufferedInputStream; +import java.io.BufferedReader; +import java.io.IOException; +import java.io.InputStream; +import java.io.InputStreamReader; +import java.io.Reader; + + +/** + * Provides a scanner that scans an {@link InputStream} for tokens of the + * RTF syntax. + * + * This scanner is based upon the RTF specification 1.6 + * available at: + * + * <a + * href="http://msdn.microsoft.com/library/en-us/dnrtfspec/html/rtfspec.asp"> + * RTF specification at MSDN</a> + * + * @author Roman Kennke (roman@ontographics.com) + */ +class RTFScanner +{ + + /** + * The reader from which we read the RTF data. + */ + private Reader in; + + /** + * This is used to constuct strings from the read in chars. + */ + private StringBuffer buffer; + + /** + * Constructs a new RTFScanner without initializing the {@link Reader}. + */ + private RTFScanner() + { + buffer = new StringBuffer(); + } + + /** + * Constructs a new RTFScanner for the given {@link InputStream}. + * The stream is wrapped into an {@link InputStreamReader} and if it's + * not yet buffered then the Reader is wrapped in a {@link BufferedReader} + * + * @param stream the {@link InputStream} to read RTF data from + */ + public RTFScanner(InputStream stream) + { + this(); + InputStreamReader reader = new InputStreamReader(stream); + in = new BufferedReader(reader); + } + + /** + * Constructs a new RTFScanner for the given {@link Reader}. + * + * If the reader is not an instance of {@link BufferedReader} then it + * is wrapped into a BufferedReader. + * + * @param reader the {@link BufferedReader} to read RTF data from + */ + public RTFScanner(Reader reader) + { + this(); + if (reader instanceof BufferedReader) + { + in = reader; + } + else + { + in = new BufferedReader(reader); + } + } + + /** + * Reads in the next {@link Token} from the stream. + * + * @return the read {@link Token} + * + * @throws IOException if the underlying stream has problems + */ + public Token readToken() + throws IOException + { + Token token = null; + + int c = in.read(); + switch(c) + { + case -1: + token = new Token(Token.EOF); + break; + + case '{': + token = new Token(Token.LCURLY); + break; + + case '}': + token = new Token(Token.RCURLY); + break; + + case '\\': + buffer.delete(0, buffer.length()); + buffer.append((char) c); + token = readControlWord(); + break; + + default: + buffer.delete(0, buffer.length()); + buffer.append((char) c); + token = readText(); + break; + } + + return token; + } + + /** + * Reads in a control word and optional parameter. + * + * @return the read in control word as {@link ControlWordToken} + * + * @throws IOException if the underlying stream has problems + */ + private Token readControlWord() + throws IOException + { + // this flag indicates if we are still reading the name or are already + // in the parameter + boolean readingName = true; + String name = null; + String param = null; + + while (true) + { + in.mark(1); + int c = in.read(); + + // check for 'a'..'z' + if (readingName && (c >= 'a') && (c <= 'z')) + { + buffer.append((char) c); + } + else if ((c >= '0') && (c <= '9')) + { + // if the last char was in the name, then finish reading the name + if (readingName) + { + name = buffer.toString(); + buffer.delete(0, buffer.length()); + readingName = false; + } + buffer.append((char) c); + } + else + { + // if we were in the name, then finish this + if (readingName) + { + name = buffer.toString(); + } + // otherwise finish the parameter + else + { + param = buffer.toString(); + } + + // clear up + buffer.delete(0, buffer.length()); + // reset input buffer to last char + in.reset(); + // break while loop + break; + } + } + + ControlWordToken token = null; + + if (param == null) + token = new ControlWordToken(name); + else + token =new ControlWordToken(name, Integer.parseInt(param)); + + return token; + + } + + /** + * Reads in a block of text. + * + * @return the token for the text + */ + private Token readText() + throws IOException + { + + boolean readingText = true; + while (readingText) + { + in.mark(1); + int c = in.read(); + switch(c) + { + case '\\': + case '{': + case '}': + case -1: + readingText = false; + in.reset(); + break; + + default: + buffer.append((char) c); + break; + } + + } + + String text = buffer.toString(); + Token token = new TextToken(text); + + buffer.delete(0, buffer.length()); + + return token; + + } +} diff --git a/gnu/java/locale/Calendar_nl.java b/javax/swing/text/rtf/TextToken.java index ea4ce7ee5..e326792cc 100644 --- a/gnu/java/locale/Calendar_nl.java +++ b/javax/swing/text/rtf/TextToken.java @@ -1,5 +1,5 @@ -/* Calendar_nl.java -- Dutch calendar locale data - Copyright (C) 1999 Free Software Foundation, Inc. +/* TextToken.java -- + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ GNU Classpath 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 2, or (at your option) any later version. - + GNU Classpath 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 @@ -36,39 +36,30 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -package gnu.java.locale; - -import java.util.Calendar; -import java.util.ListResourceBundle; +package javax.swing.text.rtf; /** - * This class contains locale data for java.util.Calendar specific for - * dutch language. - * @author Mark Wielaard + * A special {@link Token} that represents a piece of text in RTF. + * + * @author Roman Kennke (roman@ontographics.com) */ -public class Calendar_nl extends ListResourceBundle +class TextToken extends Token { + /** - * This is the object array used to hold the keys and values - * for this bundle + * The text. */ - private static final Object[][] contents = - { - { "firstDayOfWeek", new Integer(Calendar.MONDAY) }, - - /* XXX - I guess the default for gregorianCutover - * is also true for the Netherlands. But is it? - */ - }; + public String text; /** - * This method returns the object array of key, value pairs containing - * the data for this bundle. + * Constructs a new TextToken with the specified textual data. * - * @return The key, value information. + * @param text the text for this token */ - public Object[][] getContents() + public TextToken(String text) { - return contents; + super(Token.TEXT); + this.text = text; } + } diff --git a/javax/swing/text/rtf/Token.java b/javax/swing/text/rtf/Token.java new file mode 100644 index 000000000..a7a955269 --- /dev/null +++ b/javax/swing/text/rtf/Token.java @@ -0,0 +1,91 @@ +/* Token.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package javax.swing.text.rtf; + +/** + * Represents a simple token that the RTFScanner can read. A simple + * only has a type (like LCURLY or RCURLY). More complex tokens may + * attach data to the token. + * + * @author Roman Kennke (roman@ontographics.com) + */ +class Token +{ + + /** + * This special type inidicates the end of the input stream. + */ + public static final int EOF = -1; + + /** + * A left curly brace '{'. + */ + public static final int LCURLY = 1; + + /** + * A right curly brace '}'. + */ + public static final int RCURLY = 2; + + /** + * A control word like '\rtf1'. Tokens with this type are represented + * through the subclass {@link ControlWordToken}. + */ + public static final int CONTROL_WORD = 3; + + /** + * A token that contains text. This is represented through the subclass + * {@link TextToken}. + */ + public static final int TEXT = 4; + + + /** The token type. */ + public int type; + + /** + * Constructs a new Token with the specified type. + * + * @param type the Token type + */ + public Token(int type) + { + this.type = type; + } +} diff --git a/lib/.cvsignore b/lib/.cvsignore index d1591316a..c458ac479 100644 --- a/lib/.cvsignore +++ b/lib/.cvsignore @@ -9,6 +9,7 @@ classes classes.awt classes.locale1 classes.locale2 +classes.locale classes.standard classes.standardx classes.xml diff --git a/native/fdlibm/dtoa.c b/native/fdlibm/dtoa.c index 9a398b43d..6d5ad3b42 100644 --- a/native/fdlibm/dtoa.c +++ b/native/fdlibm/dtoa.c @@ -245,15 +245,16 @@ _DEFUN (_dtoa_r, to hold the suppressed trailing zeros. */ - int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1, j, j1, k, k0, - k_check, leftright, m2, m5, s2, s5, spec_case, try_quick; + int bbits, b2, b5, be, dig, i, ieps, ilim0, j, j1, k, k0, + k_check, leftright, m2, m5, s2, s5, try_quick; + int ilim = 0, ilim1 = 0, spec_case = 0; union double_union d, d2, eps; long L; #ifndef Sudden_Underflow int denorm; unsigned long x; #endif - _Jv_Bigint *b, *b1, *delta, *mlo, *mhi, *S; + _Jv_Bigint *b, *b1, *delta, *mlo = NULL, *mhi, *S; double ds; char *s, *s0; diff --git a/native/fdlibm/e_asin.c b/native/fdlibm/e_asin.c index 6b131e65a..90fc77ffc 100644 --- a/native/fdlibm/e_asin.c +++ b/native/fdlibm/e_asin.c @@ -75,7 +75,7 @@ qS4 = 7.70381505559019352791e-02; /* 0x3FB3B8C5, 0xB12E9282 */ double x; #endif { - double t,w,p,q,c,r,s; + double t = 0., w, p, q, c, r, s; int32_t hx,ix; GET_HIGH_WORD(hx,x); ix = hx&0x7fffffff; diff --git a/native/fdlibm/e_exp.c b/native/fdlibm/e_exp.c index e11ca8b38..ad37f86b0 100644 --- a/native/fdlibm/e_exp.c +++ b/native/fdlibm/e_exp.c @@ -108,8 +108,8 @@ P5 = 4.13813679705723846039e-08; /* 0x3E663769, 0x72BEA4D0 */ double x; #endif { - double y,hi,lo,c,t; - int32_t k,xsb; + double y,hi = 0., lo = 0.,c,t; + int32_t k = 0, xsb; uint32_t hx; GET_HIGH_WORD(hx,x); diff --git a/native/fdlibm/e_rem_pio2.c b/native/fdlibm/e_rem_pio2.c index 6d3fd19a4..543234c60 100644 --- a/native/fdlibm/e_rem_pio2.c +++ b/native/fdlibm/e_rem_pio2.c @@ -89,7 +89,7 @@ pio2_3t = 8.47842766036889956997e-32; /* 0x397B839A, 0x252049C1 */ double x,y[]; #endif { - double z,w,t,r,fn; + double z = 0., w, t, r, fn; double tx[3]; int32_t i,j,n,ix,hx; int e0,nx; diff --git a/native/fdlibm/ieeefp.h b/native/fdlibm/ieeefp.h index 397480bd9..666d77cb9 100644 --- a/native/fdlibm/ieeefp.h +++ b/native/fdlibm/ieeefp.h @@ -35,6 +35,14 @@ #define __IEEE_BIG_ENDIAN #endif +#ifdef __m32r__ +#ifdef __LITTLE_ENDIAN__ +#define __IEEE_LITTLE_ENDIAN +#else +#define __IEEE_BIG_ENDIAN +#endif +#endif + #if defined(__m68k__) || defined(__mc68000__) #define __IEEE_BIG_ENDIAN #endif diff --git a/native/fdlibm/strtod.c b/native/fdlibm/strtod.c index 1777b1aae..b3e091247 100644 --- a/native/fdlibm/strtod.c +++ b/native/fdlibm/strtod.c @@ -118,7 +118,7 @@ _DEFUN (_strtod_r, (ptr, s00, se), unsigned long y, z; union double_union rv, rv0; - _Jv_Bigint *bb, *bb1, *bd, *bd0, *bs, *delta; + _Jv_Bigint *bb = NULL, *bb1, *bd = NULL, *bd0, *bs = NULL, *delta = NULL; sign = nz0 = nz = 0; rv.d = 0.; for (s = s00;; s++) diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c index 7ad20b890..8d3dda93a 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkEvents.c @@ -58,11 +58,11 @@ button_to_awt_mods (int button) switch (button) { case 1: - return AWT_BUTTON1_DOWN_MASK; + return AWT_BUTTON1_MASK; case 2: - return AWT_BUTTON2_DOWN_MASK; + return AWT_BUTTON2_MASK; case 3: - return AWT_BUTTON3_DOWN_MASK; + return AWT_BUTTON3_MASK; } return 0; diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c index d3aa7a1f7..ecd5de1a3 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkToolkit.c @@ -62,6 +62,9 @@ jmethodID choicePostItemEventID; jmethodID postListItemEventID; jmethodID postTextEventID; jmethodID postWindowEventID; +jmethodID postInsetsChangedEventID; +jmethodID windowGetWidthID; +jmethodID windowGetHeightID; jmethodID beginNativeRepaintID; jmethodID endNativeRepaintID; @@ -219,6 +222,14 @@ Java_gnu_java_awt_peer_gtk_GtkToolkit_gtkInit (JNIEnv *env, postWindowEventID = (*env)->GetMethodID (env, gtkwindowpeer, "postWindowEvent", "(ILjava/awt/Window;I)V"); + postInsetsChangedEventID = (*env)->GetMethodID (env, gtkwindowpeer, + "postInsetsChangedEvent", + "(IIII)V"); + windowGetWidthID = (*env)->GetMethodID (env, gtkwindowpeer, + "getWidth", "()I"); + windowGetHeightID = (*env)->GetMethodID (env, gtkwindowpeer, + "getHeight", "()I"); + postExposeEventID = (*env)->GetMethodID (env, gtkcomponentpeer, "postExposeEvent", "(IIII)V"); postKeyEventID = (*env)->GetMethodID (env, gtkcomponentpeer, diff --git a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c index 2ca7f8398..b0177c90a 100644 --- a/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c +++ b/native/jni/gtk-peer/gnu_java_awt_peer_gtk_GtkWindowPeer.c @@ -80,6 +80,7 @@ static jint window_get_new_state (GtkWidget *widget); static gboolean window_property_changed_cb (GtkWidget *widget, GdkEventProperty *event, jobject peer); +static void realize_cb (GtkWidget *widget, jobject peer); /* Union used for type punning. */ union extents_union @@ -94,23 +95,14 @@ union atom_list_union Atom **atom_list; }; -JNIEXPORT void JNICALL -Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create - (JNIEnv *env, jobject obj, jint type, jboolean decorated, - jint width, jint height, jobject parent, jintArray jinsets) +JNIEXPORT void JNICALL +Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create + (JNIEnv *env, jobject obj, jint type, jboolean decorated, jobject parent) { GtkWidget *window_widget; GtkWindow *window; void *window_parent; GtkWidget *fixed; - int top = 0; - int left = 0; - int bottom = 0; - int right = 0; - jint *insets; - - insets = (*env)->GetIntArrayElements (env, jinsets, 0); - insets[0] = insets[1] = insets[2] = insets[3] = 0; NSA_SET_GLOBAL_REF (env, obj); @@ -137,31 +129,8 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_create gtk_widget_show (fixed); - if (decorated) - window_get_frame_extents (window_widget, &top, &left, &bottom, &right); - - gtk_window_set_default_size (window, - MAX (1, width - left - right), - MAX (1, height - top - bottom)); - - /* We must set this window's size requisition. Otherwise when a - resize is queued (when gtk_widget_queue_resize is called) the - window will snap to its default requisition of 0x0. If we omit - this call, Frames and Dialogs shrink to degenerate 1x1 windows - when their resizable property changes. */ - gtk_widget_set_size_request (window_widget, - MAX (1, width - left - right), - MAX (1, height - top - bottom)); - - insets[0] = top; - insets[1] = left; - insets[2] = bottom; - insets[3] = right; - gdk_threads_leave (); - (*env)->ReleaseIntArrayElements (env, jinsets, insets, 0); - NSA_SET_PTR (env, obj, window_widget); } @@ -278,6 +247,9 @@ Java_gnu_java_awt_peer_gtk_GtkWindowPeer_connectSignals G_CALLBACK (window_property_changed_cb), *gref); g_signal_connect_after (G_OBJECT (ptr), "realize", + G_CALLBACK (realize_cb), *gref); + + g_signal_connect_after (G_OBJECT (ptr), "realize", G_CALLBACK (connect_awt_hook_cb), *gref); gdk_threads_leave (); @@ -428,9 +400,7 @@ request_frame_extents (GtkWidget *window) /* Check if the current window manager supports _NET_REQUEST_FRAME_EXTENTS. */ - /* FIXME: The window->window != NULL check is a workaround for bug - http://bugzilla.gnome.org/show_bug.cgi?id=17952. */ - if (gdk_net_wm_supports (request_extents) && window->window != NULL) + if (gdk_net_wm_supports (request_extents)) { GdkDisplay *display = gtk_widget_get_display (window); Display *xdisplay = GDK_DISPLAY_XDISPLAY (display); @@ -700,19 +670,6 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)), unsigned long *extents; union extents_union gu_ex; - static int id_set = 0; - static jmethodID postInsetsChangedEventID; - - if (!id_set) - { - jclass gtkwindowpeer = (*gdk_env())->FindClass (gdk_env(), - "gnu/java/awt/peer/gtk/GtkWindowPeer"); - postInsetsChangedEventID = (*gdk_env())->GetMethodID (gdk_env(), - gtkwindowpeer, - "postInsetsChangedEvent", - "(IIII)V"); - id_set = 1; - } gu_ex.extents = &extents; if (gdk_atom_intern ("_NET_FRAME_EXTENTS", FALSE) == event->atom && gdk_property_get (event->window, @@ -739,3 +696,36 @@ window_property_changed_cb (GtkWidget *widget __attribute__((unused)), return FALSE; } + +static void +realize_cb (GtkWidget *widget, jobject peer) +{ + jint top = 0; + jint left = 0; + jint bottom = 0; + jint right = 0; + jint width = 0; + jint height = 0; + + width = (*gdk_env())->CallIntMethod (gdk_env(), peer, windowGetWidthID); + height = (*gdk_env())->CallIntMethod (gdk_env(), peer, windowGetHeightID); + + window_get_frame_extents (widget, &top, &left, &bottom, &right); + + (*gdk_env())->CallVoidMethod (gdk_env(), peer, + postInsetsChangedEventID, + top, left, bottom, right); + + gtk_window_set_default_size (GTK_WINDOW (widget), + MAX (1, width - left - right), + MAX (1, height - top - bottom)); + + /* set the size like we do in nativeSetBounds */ + gtk_widget_set_size_request (widget, + MAX (1, width - left - right), + MAX (1, height - top - bottom)); + + gtk_window_resize (GTK_WINDOW (widget), + MAX (1, width - left - right), + MAX (1, height - top - bottom)); +} diff --git a/native/jni/gtk-peer/gthread-jni.c b/native/jni/gtk-peer/gthread-jni.c index ee7942447..d66c5a080 100644 --- a/native/jni/gtk-peer/gthread-jni.c +++ b/native/jni/gtk-peer/gthread-jni.c @@ -223,8 +223,8 @@ exception statement from your version. */ #elif defined HAVE_INTTYPES_H #include <inttypes.h> #endif -#include <stdio.h> /* snprintf */ #include <stdarg.h> /* va_list */ +#include <glib.h> #include "gthread-jni.h" #include <assert.h> /* assert() */ @@ -464,7 +464,7 @@ throw (JNIEnv * env, jthrowable cause, const char *message, if ((buf = malloc (len))) { memset (buf, 0, len); - snprintf (buf, len, fmt, message, file, line); + g_snprintf (buf, len, fmt, message, file, line); jmessage = (*env)->NewStringUTF (env, buf); free (buf); } diff --git a/native/jni/gtk-peer/gtkpeer.h b/native/jni/gtk-peer/gtkpeer.h index 9b04bb116..02613c4e3 100644 --- a/native/jni/gtk-peer/gtkpeer.h +++ b/native/jni/gtk-peer/gtkpeer.h @@ -465,6 +465,10 @@ extern jmethodID syncAttrsID; extern jclass gdkColor; extern jmethodID gdkColorID; +extern jmethodID postInsetsChangedEventID; +extern jmethodID windowGetWidthID; +extern jmethodID windowGetHeightID; + JNIEnv *gdk_env(void); extern double dpi_conversion_factor; diff --git a/native/jni/java-lang/java_lang_VMProcess.c b/native/jni/java-lang/java_lang_VMProcess.c index 5455c81ee..ded3fc807 100644 --- a/native/jni/java-lang/java_lang_VMProcess.c +++ b/native/jni/java-lang/java_lang_VMProcess.c @@ -177,6 +177,8 @@ Java_java_lang_VMProcess_nativeSpawn(JNIEnv *env, jobject this, * directory into a single array for simplicity of (de)allocation. */ cmdArrayLen = (*env)->GetArrayLength(env, cmdArray); + if (cmdArrayLen == 0) + goto null_pointer_exception; if (envArray != NULL) envArrayLen = (*env)->GetArrayLength(env, envArray); if ((strings = malloc(((cmdArrayLen + 1) diff --git a/org/omg/CORBA/ARG_IN.java b/org/omg/CORBA/ARG_IN.java new file mode 100644 index 000000000..aed995c51 --- /dev/null +++ b/org/omg/CORBA/ARG_IN.java @@ -0,0 +1,55 @@ +/* ARG_IN.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package org.omg.CORBA; + +/** + * This simple interface defines just one constant, normally used + * to mark the parameter as an "input parameter". + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see NamedValue + */ +public interface ARG_IN +{ + /** + * The flag, specifying that the parameter is used to pass and not to + * return the data. + */ + static final int value = 1; +} diff --git a/org/omg/CORBA/ARG_INOUT.java b/org/omg/CORBA/ARG_INOUT.java new file mode 100644 index 000000000..2f06909bc --- /dev/null +++ b/org/omg/CORBA/ARG_INOUT.java @@ -0,0 +1,57 @@ +/* ARG_IN.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package org.omg.CORBA; + +/** + * This simple interface defines just one constant, normally used + * to mark that the the parameter is used both to pass and to + * return some value. It is a similar conception like passing a + * parameter "by reference" in C or Pascal. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see NamedValue + */ +public interface ARG_INOUT +{ + /** + * The constant, specifying that the parameter is used both + * to pass and to return the data. + */ + static final int value = 3; +} diff --git a/org/omg/CORBA/ARG_OUT.java b/org/omg/CORBA/ARG_OUT.java new file mode 100644 index 000000000..06fca771c --- /dev/null +++ b/org/omg/CORBA/ARG_OUT.java @@ -0,0 +1,55 @@ +/* ARG_IN.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package org.omg.CORBA; + +/** + * This simple interface defines just one constant, normally used + * to mark the parameter as an "output parameter". + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + * @see NamedValue + */ +public interface ARG_OUT +{ + /** + * The flag, indicating that the parameter is used to return, and + * not to pass the data. + */ + static final int value = 2; +} diff --git a/org/omg/CORBA/Any.java b/org/omg/CORBA/Any.java new file mode 100644 index 000000000..a4f5e8526 --- /dev/null +++ b/org/omg/CORBA/Any.java @@ -0,0 +1,446 @@ +/* Any.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * A container that can store a value of either user defined or + * primitive IDL type. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class Any +{ + /** + * Creates an input stream from that this Any object's value can be + * read (unmarshalled). + */ + public abstract org.omg.CORBA.portable.InputStream create_input_stream(); + + /** + * Creates an output stream into which this <code>Any</code> object's + * value can be written (marshalled). + * + * @return the newly created output stream. + */ + public abstract org.omg.CORBA.portable.OutputStream create_output_stream(); + + /** + * Compare this <code>Any</code> with another <code>Any</code>. + * + * @param other the other instance to compare with. + * + * @return true if both values and value typecodes are equal, + * false otherwise. + */ + public abstract boolean equal(Any other); + + /** + * Extract the CORBA <code>Object</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>Object</code> or the value has not been set. + */ + public abstract org.omg.CORBA.Object extract_Object() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>Principal</code> from this <code>Any</code> + * + * @throws NO_IMPLEMENT, always. + * + * @deprecated by CORBA 2.2. + */ + public Principal extract_Principal() + { + throw new NO_IMPLEMENT(); + } + + /** + * Extract an arbitrary {@link org.omg.CORBA.portable.Streamable } from + * this <code>Any</code>. + * + * @throws BAD_INV_ORDER if the caller has invoked operations in the + * wrong order. + * + * @throws NO_IMPLEMENT, always (override to get functionality). + */ + public org.omg.CORBA.portable.Streamable extract_Streamable() + throws org.omg.CORBA.BAD_INV_ORDER + { + throw new NO_IMPLEMENT(); + } + + /** + * Extract the TypeCode from this <code>Any</code> value field. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>TypeCode</code> or the value has not been set. + */ + public abstract TypeCode extract_TypeCode() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>Value</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>Value</code> or the value has not been set. + */ + public abstract java.io.Serializable extract_Value() + throws BAD_OPERATION; + + /** + * Extract another code>Any</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>any</code> or the value has not been set. + */ + public abstract Any extract_any() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>boolean</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>boolean</code> or the value has not been set. + */ + public abstract boolean extract_boolean() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>char</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>char</code> or the value has not been set. + */ + public abstract char extract_char() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>double</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>double</code> or the value has not been set. + */ + public abstract double extract_double() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>fixed</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>fixed</code> or the value has not been set. + * + * @throws NO_IMPLEMENT, always (override to get functionality). + */ + public java.math.BigDecimal extract_fixed() + throws BAD_OPERATION + { + throw new NO_IMPLEMENT(); + } + + /** + * Extract the CORBA <code>float</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>float</code> or the value has not been set. + */ + public abstract float extract_float() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>long</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>long</code> or the value has not been set. + */ + public abstract int extract_long() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>long long</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>longlong</code> or the value has not been set. + */ + public abstract long extract_longlong() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>octet</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>octet</code> or the value has not been set. + */ + public abstract byte extract_octet() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>short</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>short</code> or the value has not been set. + */ + public abstract short extract_short() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>string</code> from this <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than <code>string</code> or the value has not been set. + */ + public abstract String extract_string() + throws BAD_OPERATION; + + /** + * Extract the CORBA unsigned <code>long</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than unsigned <code>long</code> or the value has not been set. + */ + public abstract int extract_ulong() + throws BAD_OPERATION; + + /** + * Extract the CORBA unsigned <code>long long</code> from this + * <code>Any</code>. + * + * @throws BAD_OPERATION if this instance contains value other + * than unsigned <code>long long</code> or the value has not been set. + */ + public abstract long extract_ulonglong() + throws BAD_OPERATION; + + /** + * Extract the CORBA unsigned <code>short</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than unsigned <code>short</code> or the value has not been set. + */ + public abstract short extract_ushort() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>wchar</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>wchar</code> or the value has not been set. + */ + public abstract char extract_wchar() + throws BAD_OPERATION; + + /** + * Extract the CORBA <code>wstring</code> from this <code>Any</code> + * @throws BAD_OPERATION if this instance contains value other + * than <code>wstring</code> or the value has not been set. + */ + public abstract String extract_wstring() + throws BAD_OPERATION; + + /** + * Insert the CORBA <code>Object</code> into this <code>Any</code> + */ + public abstract void insert_Object(org.omg.CORBA.Object x, TypeCode typecode); + + /** + * Insert the CORBA <code>Object</code> into this <code>Any</code> + */ + public abstract void insert_Object(org.omg.CORBA.Object x); + + /** + * Insert the CORBA <code>Principal</code> into this <code>Any</code>. + * @deprecated by CORBA 2.2. + */ + public void insert_Principal(Principal x) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>Streamable</code> into this <code>Any</code> + */ + public void insert_Streamable(org.omg.CORBA.portable.Streamable x) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>TypeCode</code> into this <code>Any</code> + * value field. + */ + public abstract void insert_TypeCode(TypeCode typecode); + + /** + * Insert the CORBA <code>Value</code> into this <code>Any</code> + */ + public abstract void insert_Value(Serializable x, TypeCode typecode); + + /** + * Insert the CORBA <code>Value</code> into this <code>Any</code> + */ + public abstract void insert_Value(Serializable x); + + /** + * Insert the CORBA <code>any</code> into this <code>Any</code> + */ + public abstract void insert_any(Any x); + + /** + * Insert the CORBA <code>boolean</code> into this <code>Any</code> + */ + public abstract void insert_boolean(boolean x); + + /** + * Insert the CORBA <code>char</code> into this <code>Any</code> + */ + public abstract void insert_char(char x); + + /** + * Insert the CORBA <code>double</code> into this <code>Any</code> + */ + public abstract void insert_double(double x); + + /** + * Insert the CORBA <code>fixed</code> into this <code>Any</code> + */ + public void insert_fixed(java.math.BigDecimal x, TypeCode typecode) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>fixed</code> into this <code>Any</code> + */ + public void insert_fixed(java.math.BigDecimal x) + { + throw new NO_IMPLEMENT(); + } + + /** + * Insert the CORBA <code>float</code> into this <code>Any</code> + */ + public abstract void insert_float(float x); + + /** + * Insert the CORBA <code>long</code> into this <code>Any</code> + */ + public abstract void insert_long(int x); + + /** + * Insert the CORBA <code>longlong</code> into this <code>Any</code> + */ + public abstract void insert_longlong(long x); + + /** + * Insert the CORBA <code>octet</code> into this <code>Any</code> + */ + public abstract void insert_octet(byte x); + + /** + * Insert the CORBA <code>short</code> into this <code>Any</code> + */ + public abstract void insert_short(short x); + + /** + * Insert the CORBA <code>string</code> into this <code>Any</code> + */ + public abstract void insert_string(String x); + + /** + * Insert the CORBA <code>ulong</code> into this <code>Any</code> + */ + public abstract void insert_ulong(int x); + + /** + * Insert the CORBA <code>ulonglong</code> into this <code>Any</code> + */ + public abstract void insert_ulonglong(long x); + + /** + * Insert the CORBA <code>ushort</code> into this <code>Any</code> + */ + public abstract void insert_ushort(short x); + + /** + * Insert the CORBA <code>wchar</code> into this <code>Any</code> + */ + public abstract void insert_wchar(char x); + + /** + * Insert the CORBA <code>wstring</code> into this <code>Any</code> + */ + public abstract void insert_wstring(String x); + + /** + * Read the value into this <code>Any</code> from the given input stream. + * + * @param input a CORBA stream to read from. + * @param type a TypeCode of the object being read. + * + * @throws org.omg.CORBA.MARSHAL if the given TypeCode does not match + * the TypeCode of the object, found in the stream. + */ + public abstract void read_value(org.omg.CORBA.portable.InputStream input, + TypeCode type + ) + throws MARSHAL; + + /** + * Set the type of the object, stored in this <code>Any</code>, to the + * given TypeCode. Clear the value. + * + * @param valueTypeCode the type of the object that is expected to be stored + * in this <code>any</code>. + */ + public abstract void type(TypeCode valueTypeCode); + + /** + * Returns the TypeCode of the object, stored in this <code>Any</code> + * @return the TypeCode + */ + public abstract TypeCode type(); + + /** + * Writes out the value (without the typecode of the value), stored in + * this <coe>Any</code>. + * + * @param output the CORBA stream to write into. + * + * @throws NullPointerException if the value of this <code>Any</code> + * has not been set. + */ + public abstract void write_value(org.omg.CORBA.portable.OutputStream output); +} diff --git a/org/omg/CORBA/AnyHolder.java b/org/omg/CORBA/AnyHolder.java new file mode 100644 index 000000000..a8c02b63d --- /dev/null +++ b/org/omg/CORBA/AnyHolder.java @@ -0,0 +1,119 @@ +/* AnyHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for storing an instance of {@link Any}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class AnyHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_any = new primitiveTypeCode(TCKind.tk_any); + + /** + * The instance of {@link Any} (not the "any value"), held by this holder. + */ + public Any value; + + /** + * Constructs an instance of AnyHolder, + * initializing {@link #value} to <code>null</code>. + */ + public AnyHolder() + { + } + + /** + * Constructs an instance of AnyHolder, + * initializing {@link #value} to the passed parameter. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public AnyHolder(Any initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For {@link Any}, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_any}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_any(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_any; + } + + /** + * Write the {@link value } field to the given stream. + * For {@link Any} the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_any(Any) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_any(value); + } +} diff --git a/org/omg/CORBA/BAD_CONTEXT.java b/org/omg/CORBA/BAD_CONTEXT.java new file mode 100644 index 000000000..f99ea8351 --- /dev/null +++ b/org/omg/CORBA/BAD_CONTEXT.java @@ -0,0 +1,97 @@ +/* BAD_CONTEXT.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the operation is invoked by a client but the passed + * context has no values required by this operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class BAD_CONTEXT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -5025677944847478264L; + + /** + * Creates a BAD_CONTEXT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public BAD_CONTEXT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_CONTEXT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_CONTEXT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_CONTEXT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + BAD_CONTEXT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_CONTEXT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + BAD_CONTEXT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/BAD_INV_ORDER.java b/org/omg/CORBA/BAD_INV_ORDER.java new file mode 100644 index 000000000..002c9be0d --- /dev/null +++ b/org/omg/CORBA/BAD_INV_ORDER.java @@ -0,0 +1,96 @@ +/* BAD_INV_ORDER.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the caller has invoked operations in the wrong order. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class BAD_INV_ORDER + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 7273325995832240406L; + + /** + * Creates a BAD_INV_ORDER with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public BAD_INV_ORDER(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_INV_ORDER with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_INV_ORDER() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_INV_ORDER exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + BAD_INV_ORDER(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_INV_ORDER exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + BAD_INV_ORDER(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/BAD_OPERATION.java b/org/omg/CORBA/BAD_OPERATION.java new file mode 100755 index 000000000..04475d58e --- /dev/null +++ b/org/omg/CORBA/BAD_OPERATION.java @@ -0,0 +1,97 @@ +/* BAD_OPERATION.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the object exists but does not support the operation that + * was invoked on it. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class BAD_OPERATION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1654621651720499682L; + + /** + * Creates a BAD_OPERATION with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public BAD_OPERATION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_OPERATION with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_OPERATION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_OPERATION exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + BAD_OPERATION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_OPERATION exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + BAD_OPERATION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/BAD_PARAM.java b/org/omg/CORBA/BAD_PARAM.java new file mode 100644 index 000000000..32935f46f --- /dev/null +++ b/org/omg/CORBA/BAD_PARAM.java @@ -0,0 +1,96 @@ +/* BAD_PARAM.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * The exception thrown when a parameter passed to a call is considered + * illegal. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class BAD_PARAM + extends SystemException + implements Serializable +{ + /** + * Creates BAD_PARAM with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public BAD_PARAM(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Use serialVersionUID for interoperability. + */ + private final static long serialVersionUID = 1917109334939470379L; + + /** + * Creates BAD_PARAM with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_PARAM() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_PARAM exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + BAD_PARAM(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_PARAM exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + BAD_PARAM(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/BAD_TYPECODE.java b/org/omg/CORBA/BAD_TYPECODE.java new file mode 100644 index 000000000..c46da3b57 --- /dev/null +++ b/org/omg/CORBA/BAD_TYPECODE.java @@ -0,0 +1,97 @@ +/* BAD_TYPECODE.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the some TypeCode has been realized to be invalid + * (for example, has an invalid TCKind value). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class BAD_TYPECODE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 6193364410915696901L; + + /** + * Creates a BAD_TYPECODE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public BAD_TYPECODE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates BAD_TYPECODE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public BAD_TYPECODE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a BAD_TYPECODE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + BAD_TYPECODE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created BAD_TYPECODE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + BAD_TYPECODE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/BooleanHolder.java b/org/omg/CORBA/BooleanHolder.java new file mode 100644 index 000000000..d71e221de --- /dev/null +++ b/org/omg/CORBA/BooleanHolder.java @@ -0,0 +1,127 @@ +/* BooleanHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>boolean</code> that is mapped into + * java <code>boolean</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BooleanHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_boolean = + new primitiveTypeCode(TCKind.tk_boolean); + + /** + * The <code>boolean</code> (CORBA <code>boolean</code>) value, + * held by this BooleanHolder. + */ + public boolean value; + + /** + * Constructs an instance of BooleanHolder, + * initializing {@link #value} to <code>false</code>. + */ + public BooleanHolder() + { + } + + /** + * Constructs an instance of BooleanHolder, + * initializing {@link #value} to the given <code>boolean</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public BooleanHolder(boolean initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>boolean</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_boolean}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_boolean(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_boolean; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>boolean</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_boolean(boolean) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_boolean(value); + } +} diff --git a/org/omg/CORBA/BooleanSeqHelper.java b/org/omg/CORBA/BooleanSeqHelper.java new file mode 100644 index 000000000..cfead72b8 --- /dev/null +++ b/org/omg/CORBA/BooleanSeqHelper.java @@ -0,0 +1,148 @@ +/* BooleanSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>boolean</code> + * (<code>BooleanSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class BooleanSeqHelper +{ + /** + * Extract the <code>boolean[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link BooleanSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link BooleanSeqHolder}. + */ + public static boolean[] extract(Any a) + { + BooleanSeqHolder h = (BooleanSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>boolean[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link BooleanSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, boolean[] that) + { + BooleanSeqHolder holder = new BooleanSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>boolean[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link BooleanSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static boolean[] read(InputStream input) + { + BooleanSeqHolder h = new BooleanSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>BooleanSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_boolean); + } + + /** + * Writes the <code>boolean[]</code> into the given stream. + * This implementation first creates an instance of + * {@link BooleanSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, boolean[] value) + { + BooleanSeqHolder h = new BooleanSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/BooleanSeqHolder.java b/org/omg/CORBA/BooleanSeqHolder.java new file mode 100644 index 000000000..f753941bf --- /dev/null +++ b/org/omg/CORBA/BooleanSeqHolder.java @@ -0,0 +1,126 @@ +/* BooleanSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>BooleanSeq</code> that is mapped into + * java <code>boolean[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class BooleanSeqHolder + implements Streamable +{ + /** + * The <code>boolean[]</code> (CORBA <code>BooleanSeq</code>) value, + * held by this BooleanSeqHolder. + */ + public boolean[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_boolean); + + /** + * Constructs an instance of BooleanSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public BooleanSeqHolder() + { + } + + /** + * Constructs an instance of BooleanSeqHolder, + * initializing {@link #value} to the given <code>boolean[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public BooleanSeqHolder(boolean[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_boolean_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new boolean[ input.read_long() ]; + input.read_boolean_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_boolean_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_boolean_array(value, 0, value.length); + } +} diff --git a/gnu/java/locale/Calendar_en.java b/org/omg/CORBA/Bounds.java index 83320ebcf..2478f80c4 100644 --- a/gnu/java/locale/Calendar_en.java +++ b/org/omg/CORBA/Bounds.java @@ -1,5 +1,5 @@ -/* Calendar_en.java -- English calendar locale data - Copyright (C) 1999 Free Software Foundation, Inc. +/* Bounds.java -- Exception thrown due to out-of-bounds parameter + Copyright (C) 2005 Free Software Foundation, Inc. This file is part of GNU Classpath. @@ -7,7 +7,7 @@ GNU Classpath 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 2, or (at your option) any later version. - + GNU Classpath 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 @@ -36,34 +36,36 @@ obligated to do so. If you do not wish to do so, delete this exception statement from your version. */ -package gnu.java.locale; - -import java.util.ListResourceBundle; +package org.omg.CORBA; /** - * This class contains locale data for java.util.Calendar specific for - * english language. - * @author Jochen Hoenicke + * Thrown when a parameter is outside the bounds for a particular + * object a method is trying to access. + * + * @author Andrew John Hughes (gnu_andrew@member.fsf.org) */ -public class Calendar_en extends ListResourceBundle +public final class Bounds + extends UserException { + /** - * This is the object array used to hold the keys and values - * for this bundle + * Constructs a default <code>Bounds</code> exception, with + * no detail message. */ - private static final Object[][] contents = + public Bounds() { - /* Use default values. */ - }; + super(); + } /** - * This method returns the object array of key, value pairs containing - * the data for this bundle. + * Constructs a <code>Bounds</code> exception using the specified + * message as the reason for throwing it. * - * @return The key, value information. + * @param reason the reason the exception was thrown. */ - public Object[][] getContents() + public Bounds(String reason) { - return contents; + super(reason); } + } diff --git a/org/omg/CORBA/ByteHolder.java b/org/omg/CORBA/ByteHolder.java new file mode 100644 index 000000000..dce5149f1 --- /dev/null +++ b/org/omg/CORBA/ByteHolder.java @@ -0,0 +1,127 @@ +/* ByteHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>octet</code> that is mapped into + * java <code>byte</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ByteHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_octet = + new primitiveTypeCode(TCKind.tk_octet); + + /** + * The <code>byte</code> (CORBA <code>octet</code>) value, + * held by this ByteHolder. + */ + public byte value; + + /** + * Constructs an instance of ByteHolder, + * initializing {@link #value} to <code>0x0 </code>. + */ + public ByteHolder() + { + } + + /** + * Constructs an instance of ByteHolder, + * initializing {@link #value} to the given <code>byte</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ByteHolder(byte initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>octet</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_octet}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_octet(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_octet; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>octet</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_octet(byte) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_octet(value); + } +} diff --git a/org/omg/CORBA/COMM_FAILURE.java b/org/omg/CORBA/COMM_FAILURE.java new file mode 100644 index 000000000..fa945ba1c --- /dev/null +++ b/org/omg/CORBA/COMM_FAILURE.java @@ -0,0 +1,97 @@ +/* COMM_FAILURE.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the communication has been lost while an operation + * was in progress + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class COMM_FAILURE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 294856734784364267L; + + /** + * Creates a COMM_FAILURE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public COMM_FAILURE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates COMM_FAILURE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public COMM_FAILURE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a COMM_FAILURE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + COMM_FAILURE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created COMM_FAILURE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + COMM_FAILURE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/CharHolder.java b/org/omg/CORBA/CharHolder.java new file mode 100644 index 000000000..797364117 --- /dev/null +++ b/org/omg/CORBA/CharHolder.java @@ -0,0 +1,126 @@ +/* CharHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>char</code> that is mapped into + * java <code>char</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class CharHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_char = new primitiveTypeCode(TCKind.tk_char); + + /** + * The <code>char</code> (CORBA <code>char</code>) value, + * held by this CharHolder. + */ + public char value; + + /** + * Constructs an instance of CharHolder, + * initializing {@link #value} to <code>0 </code>. + */ + public CharHolder() + { + } + + /** + * Constructs an instance of CharHolder, + * initializing {@link #value} to the given <code>char</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public CharHolder(char initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>char</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_char}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_char(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_char; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>char</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_char(char) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_char(value); + } +} diff --git a/org/omg/CORBA/CharSeqHelper.java b/org/omg/CORBA/CharSeqHelper.java new file mode 100644 index 000000000..3d9872353 --- /dev/null +++ b/org/omg/CORBA/CharSeqHelper.java @@ -0,0 +1,148 @@ +/* CharSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>char</code> + * (<code>CharSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class CharSeqHelper +{ + /** + * Extract the <code>char[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link CharSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link CharSeqHolder}. + */ + public static char[] extract(Any a) + { + CharSeqHolder h = (CharSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>char[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link CharSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, char[] that) + { + CharSeqHolder holder = new CharSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>char[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link CharSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static char[] read(InputStream input) + { + CharSeqHolder h = new CharSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>CharSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_char); + } + + /** + * Writes the <code>char[]</code> into the given stream. + * This implementation first creates an instance of + * {@link CharSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, char[] value) + { + CharSeqHolder h = new CharSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/CharSeqHolder.java b/org/omg/CORBA/CharSeqHolder.java new file mode 100644 index 000000000..e85e27f69 --- /dev/null +++ b/org/omg/CORBA/CharSeqHolder.java @@ -0,0 +1,126 @@ +/* CharSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>CharSeq</code> that is mapped into + * java <code>char[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class CharSeqHolder + implements Streamable +{ + /** + * The <code>char[]</code> (CORBA <code>CharSeq</code>) value, + * held by this CharSeqHolder. + */ + public char[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_char); + + /** + * Constructs an instance of CharSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public CharSeqHolder() + { + } + + /** + * Constructs an instance of CharSeqHolder, + * initializing {@link #value} to the given <code>char[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public CharSeqHolder(char[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_char_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new char[ input.read_long() ]; + input.read_char_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_char_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_char_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/CompletionStatus.java b/org/omg/CORBA/CompletionStatus.java new file mode 100644 index 000000000..684023c5d --- /dev/null +++ b/org/omg/CORBA/CompletionStatus.java @@ -0,0 +1,158 @@ +/* CompletionStatus.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +import org.omg.CORBA.portable.IDLEntity; + +/** + * Defines the method completion status, usually for the time moment, + * when the exception has been thrown. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class CompletionStatus + implements Serializable, IDLEntity +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = -9047319660881406859L; + + /** + * The method was completed when the exception was thrown. + */ + static final int _COMPLETED_YES = 0; + + /** + * The method was running when the exception was thrown. + */ + static final int _COMPLETED_NO = 1; + + /** + * The method was either running or complete (no exact information availabe) + * when the exception was thrown. + */ + static final int _COMPLETED_MAYBE = 2; + + /** + * An instance of CompletionStatus, initialized to {@link #COMPLETED_YES } + */ + public static final CompletionStatus COMPLETED_YES = + new CompletionStatus(_COMPLETED_YES); + + /** + * An instance of CompletionStatus, initialized to {@link #COMPLETED_NO } + */ + public static final CompletionStatus COMPLETED_NO = + new CompletionStatus(_COMPLETED_NO); + + /** + * An instance of CompletionStatus, initialized to {@link #COMPLETED_MAYBE } + */ + public static final CompletionStatus COMPLETED_MAYBE = + new CompletionStatus(_COMPLETED_MAYBE); + + /** + * The private array of all states. As long as the states form the uniform + * sequence, from_int can find the needed value directly indexing this array. + */ + private static final CompletionStatus[] states = + new CompletionStatus[] { COMPLETED_YES, COMPLETED_NO, COMPLETED_MAYBE }; + private final int _value; + + /** + * No other instances can be created. + */ + private CompletionStatus(int a_value) + { + _value = a_value; + } + + /** + * Returns the CompletionStatus, matching the given integer constant + * @param completion one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE. + * @return one of COMPLETED_YES, COMPLETED_NO or COMPLEED_MAYBE. + * @throws BAD_PARAM if the parameter is not one of these three valid values. + */ + public static CompletionStatus from_int(int completion) + { + try + { + return states [ completion ]; + } + catch (ArrayIndexOutOfBoundsException ex) + { + throw new BAD_OPERATION("Invalid completion status " + completion); + } + } + + /** + * Returns a short string representation. + * @return a string, defining the completion status. + */ + public String toString() + { + switch (value()) + { + case _COMPLETED_YES : + return "completed"; + + case _COMPLETED_NO : + return "not completed"; + + case _COMPLETED_MAYBE : + return "maybe completed"; + + default : + return "invalid completion status instance"; + } + } + + /** + * Returns the value, representing the completion + * status of this object. + * @return one of COMPLETED_MAYBE, COMPLETED_YES or COMPLETED_NO + */ + public int value() + { + return _value; + } +} diff --git a/org/omg/CORBA/Context.java b/org/omg/CORBA/Context.java new file mode 100644 index 000000000..9e37c9d0b --- /dev/null +++ b/org/omg/CORBA/Context.java @@ -0,0 +1,93 @@ +/* Context.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +/** + * + * This class holds the list of the named properties. It is normally + * used to represent information about various circumstances of the + * invocation. A Context if first created by + * {@link org.omg.CORBA.ORB#get_default_context() } and then invoking + * {@link create_child(String)} of the default context. + * + * The contexts are named. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + * + */ +public abstract class Context +{ + public Context() + { + } + + /** + * Get the context name. + * @return the name of this context. + */ + public abstract String context_name(); + + /** + * Create a child of this Context, giving it a name. + * @param name a name of the child context. + * + * @return the newly created context. + */ + public abstract Context create_child(String parm1); + + /** + * Delete one or several (identically named) given properties. + * + * @param property the name of the property to delet. + */ + public abstract void delete_values(String property); + + /** + * Get the parent of this context. + * @return the parent of this context. + */ + public abstract Context parent(); + + /** + * Set a property. + * @param name the property name. + * @param value the property value. + */ + public abstract void set_one_value(String name, Any value); +} diff --git a/org/omg/CORBA/ContextList.java b/org/omg/CORBA/ContextList.java new file mode 100644 index 000000000..a2e57d5b2 --- /dev/null +++ b/org/omg/CORBA/ContextList.java @@ -0,0 +1,85 @@ +/* ContextList.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + + +/** + * Stores a modifiable list of String objects representing the property names. + * The property values are normally stored in the {@link Context }. + * + * The context list is created by invoking {@link ORB#create_context_list()}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ContextList +{ + /** + * Add a name object + * @param name a name to add. + */ + public abstract void add(String name); + + /** + * Return the number of stored names + * + * @return a number of names. + */ + public abstract int count(); + + /** + * Return the name at the given index. + * + * @param at the index + * @return the name at the given index + * + * @throws Bounds if the index is out of bounds. + */ + public abstract String item(int at) + throws Bounds; + + /** + * Remove the name at the given index. + * + * @param at the index + * + * @throws Bounds if the index is out of bounds. + */ + public abstract void remove(int at) + throws Bounds; +} diff --git a/org/omg/CORBA/DATA_CONVERSION.java b/org/omg/CORBA/DATA_CONVERSION.java new file mode 100644 index 000000000..b0eac5621 --- /dev/null +++ b/org/omg/CORBA/DATA_CONVERSION.java @@ -0,0 +1,97 @@ +/* DATA_CONVERSION.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the ORB cannot convert between the marshalled and + * native data representation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class DATA_CONVERSION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1874869932271600956L; + + /** + * Creates a DATA_CONVERSION with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public DATA_CONVERSION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates DATA_CONVERSION with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public DATA_CONVERSION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a DATA_CONVERSION exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + DATA_CONVERSION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created DATA_CONVERSION exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + DATA_CONVERSION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/DoubleHolder.java b/org/omg/CORBA/DoubleHolder.java new file mode 100644 index 000000000..5709b7bcd --- /dev/null +++ b/org/omg/CORBA/DoubleHolder.java @@ -0,0 +1,127 @@ +/* DoubleHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>double</code> that is mapped into + * java <code>double</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class DoubleHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_double = + new primitiveTypeCode(TCKind.tk_double); + + /** + * The <code>double</code> (CORBA <code>double</code>) value, + * held by this DoubleHolder. + */ + public double value; + + /** + * Constructs an instance of DoubleHolder, + * initializing {@link #value} to <code>0.0</code>. + */ + public DoubleHolder() + { + } + + /** + * Constructs an instance of DoubleHolder, + * initializing {@link #value} to the given <code>double</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public DoubleHolder(double initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>double</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_double}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_double(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_double; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>double</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_double(double) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_double(value); + } +} diff --git a/org/omg/CORBA/DoubleSeqHelper.java b/org/omg/CORBA/DoubleSeqHelper.java new file mode 100644 index 000000000..1828ca518 --- /dev/null +++ b/org/omg/CORBA/DoubleSeqHelper.java @@ -0,0 +1,148 @@ +/* DoubleSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>double</code> + * (<code>DoubleSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class DoubleSeqHelper +{ + /** + * Extract the <code>double[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link DoubleSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link DoubleSeqHolder}. + */ + public static double[] extract(Any a) + { + DoubleSeqHolder h = (DoubleSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>double[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link DoubleSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, double[] that) + { + DoubleSeqHolder holder = new DoubleSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>double[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link DoubleSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static double[] read(InputStream input) + { + DoubleSeqHolder h = new DoubleSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>DoubleSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_double); + } + + /** + * Writes the <code>double[]</code> into the given stream. + * This implementation first creates an instance of + * {@link DoubleSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, double[] value) + { + DoubleSeqHolder h = new DoubleSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/DoubleSeqHolder.java b/org/omg/CORBA/DoubleSeqHolder.java new file mode 100644 index 000000000..701c61263 --- /dev/null +++ b/org/omg/CORBA/DoubleSeqHolder.java @@ -0,0 +1,126 @@ +/* DoubleSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>DoubleSeq</code> that is mapped into + * java <code>double[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class DoubleSeqHolder + implements Streamable +{ + /** + * The <code>double[]</code> (CORBA <code>DoubleSeq</code>) value, + * held by this DoubleSeqHolder. + */ + public double[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_double); + + /** + * Constructs an instance of DoubleSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public DoubleSeqHolder() + { + } + + /** + * Constructs an instance of DoubleSeqHolder, + * initializing {@link #value} to the given <code>double[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public DoubleSeqHolder(double[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_double_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new double[ input.read_long() ]; + input.read_double_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_double_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_double_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/FREE_MEM.java b/org/omg/CORBA/FREE_MEM.java new file mode 100644 index 000000000..55563907f --- /dev/null +++ b/org/omg/CORBA/FREE_MEM.java @@ -0,0 +1,96 @@ +/* FREE_MEM.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means errors, related to freing the allocated memory. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class FREE_MEM + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1333559476995791982L; + + /** + * Creates a FREE_MEM with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public FREE_MEM(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates FREE_MEM with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public FREE_MEM() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a FREE_MEM exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + FREE_MEM(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created FREE_MEM exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + FREE_MEM(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/FixedHolder.java b/org/omg/CORBA/FixedHolder.java new file mode 100644 index 000000000..e92041d2b --- /dev/null +++ b/org/omg/CORBA/FixedHolder.java @@ -0,0 +1,129 @@ +/* FixedHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +import java.math.BigDecimal; + +/** + * A holder for CORBA <code>fixed</code> that is mapped into + * java <code>BigDecimal</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class FixedHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_fixed = + new primitiveTypeCode(TCKind.tk_fixed); + + /** + * The <code>BigDecimal</code> (CORBA <code>fixed</code>) value, + * held by this FixedHolder. + */ + public BigDecimal value; + + /** + * Constructs an instance of FixedHolder, + * initializing {@link #value} to <code>null</code>. + */ + public FixedHolder() + { + } + + /** + * Constructs an instance of FixedHolder, + * initializing {@link #value} to the given <code>BigDecimal</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public FixedHolder(BigDecimal initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>fixed</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_fixed}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_fixed(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_fixed; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>fixed</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_fixed(BigDecimal) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_fixed(value); + } +} diff --git a/org/omg/CORBA/FloatHolder.java b/org/omg/CORBA/FloatHolder.java new file mode 100644 index 000000000..5681f3b44 --- /dev/null +++ b/org/omg/CORBA/FloatHolder.java @@ -0,0 +1,127 @@ +/* FloatHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>float</code> that is mapped into + * java <code>float</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class FloatHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_float = + new primitiveTypeCode(TCKind.tk_float); + + /** + * The <code>float</code> (CORBA <code>float</code>) value, + * held by this FloatHolder. + */ + public float value; + + /** + * Constructs an instance of FloatHolder, + * initializing {@link #value} to <code>0.0</code>. + */ + public FloatHolder() + { + } + + /** + * Constructs an instance of FloatHolder, + * initializing {@link #value} to the given <code>float</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public FloatHolder(float initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>float</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_float}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_float(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_float; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>float</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_float(float) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_float(value); + } +} diff --git a/org/omg/CORBA/FloatSeqHelper.java b/org/omg/CORBA/FloatSeqHelper.java new file mode 100644 index 000000000..e34980569 --- /dev/null +++ b/org/omg/CORBA/FloatSeqHelper.java @@ -0,0 +1,148 @@ +/* FloatSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>float</code> + * (<code>FloatSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class FloatSeqHelper +{ + /** + * Extract the <code>float[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link FloatSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link FloatSeqHolder}. + */ + public static float[] extract(Any a) + { + FloatSeqHolder h = (FloatSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>float[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link FloatSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, float[] that) + { + FloatSeqHolder holder = new FloatSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>float[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link FloatSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static float[] read(InputStream input) + { + FloatSeqHolder h = new FloatSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>FloatSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_float); + } + + /** + * Writes the <code>float[]</code> into the given stream. + * This implementation first creates an instance of + * {@link FloatSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, float[] value) + { + FloatSeqHolder h = new FloatSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/FloatSeqHolder.java b/org/omg/CORBA/FloatSeqHolder.java new file mode 100644 index 000000000..e7998a3c8 --- /dev/null +++ b/org/omg/CORBA/FloatSeqHolder.java @@ -0,0 +1,126 @@ +/* FloatSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>FloatSeq</code> that is mapped into + * java <code>float[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class FloatSeqHolder + implements Streamable +{ + /** + * The <code>float[]</code> (CORBA <code>FloatSeq</code>) value, + * held by this FloatSeqHolder. + */ + public float[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_float); + + /** + * Constructs an instance of FloatSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public FloatSeqHolder() + { + } + + /** + * Constructs an instance of FloatSeqHolder, + * initializing {@link #value} to the given <code>float[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public FloatSeqHolder(float[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_float_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new float[ input.read_long() ]; + input.read_float_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_float_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_float_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/IDLEntity.java b/org/omg/CORBA/IDLEntity.java new file mode 100644 index 000000000..c72e8844e --- /dev/null +++ b/org/omg/CORBA/IDLEntity.java @@ -0,0 +1,50 @@ +/* IDLEntity.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Indicates that this class has a corresponding Helper class. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface IDLEntity + extends Serializable +{ +} diff --git a/org/omg/CORBA/IMP_LIMIT.java b/org/omg/CORBA/IMP_LIMIT.java new file mode 100644 index 000000000..b3b956922 --- /dev/null +++ b/org/omg/CORBA/IMP_LIMIT.java @@ -0,0 +1,97 @@ +/* IMP_LIMIT.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the server have reached some implementation limit + * (too many clients, too many references, too long parameters and so on). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class IMP_LIMIT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -8086463494577448422L; + + /** + * Creates a IMP_LIMIT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public IMP_LIMIT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates IMP_LIMIT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public IMP_LIMIT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a IMP_LIMIT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + IMP_LIMIT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created IMP_LIMIT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + IMP_LIMIT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INITIALIZE.java b/org/omg/CORBA/INITIALIZE.java new file mode 100644 index 000000000..9ba0b3901 --- /dev/null +++ b/org/omg/CORBA/INITIALIZE.java @@ -0,0 +1,96 @@ +/* INITIALIZE.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Mans that the server cannot be initialized because of the some reason. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INITIALIZE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -3753094599663690309L; + + /** + * Creates a INITIALIZE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INITIALIZE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INITIALIZE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INITIALIZE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INITIALIZE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INITIALIZE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INITIALIZE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INITIALIZE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INTERNAL.java b/org/omg/CORBA/INTERNAL.java new file mode 100644 index 000000000..56027e0db --- /dev/null +++ b/org/omg/CORBA/INTERNAL.java @@ -0,0 +1,96 @@ +/* INTERNAL.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means the internal failure in ORB. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INTERNAL + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 3771336866139357605L; + + /** + * Creates a INTERNAL with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INTERNAL(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INTERNAL with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INTERNAL() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INTERNAL exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INTERNAL(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INTERNAL exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INTERNAL(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INTF_REPOS.java b/org/omg/CORBA/INTF_REPOS.java new file mode 100644 index 000000000..4f3867980 --- /dev/null +++ b/org/omg/CORBA/INTF_REPOS.java @@ -0,0 +1,96 @@ +/* INTF_REPOS.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means errors, related to the interface repository. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INTF_REPOS + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 722572694720671863L; + + /** + * Creates a INTF_REPOS with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INTF_REPOS(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INTF_REPOS with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INTF_REPOS() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INTF_REPOS exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INTF_REPOS(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INTF_REPOS exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INTF_REPOS(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INVALID_TRANSACTION.java b/org/omg/CORBA/INVALID_TRANSACTION.java new file mode 100644 index 000000000..2387d612a --- /dev/null +++ b/org/omg/CORBA/INVALID_TRANSACTION.java @@ -0,0 +1,96 @@ +/* INVALID_TRANSACTION.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that request carried an invalid transaction context. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INVALID_TRANSACTION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -4265126403821571697L; + + /** + * Creates a INVALID_TRANSACTION with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INVALID_TRANSACTION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INVALID_TRANSACTION with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INVALID_TRANSACTION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INVALID_TRANSACTION exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INVALID_TRANSACTION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INVALID_TRANSACTION exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INVALID_TRANSACTION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INV_FLAG.java b/org/omg/CORBA/INV_FLAG.java new file mode 100644 index 000000000..a4804624a --- /dev/null +++ b/org/omg/CORBA/INV_FLAG.java @@ -0,0 +1,96 @@ +/* INV_FLAG.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means invalid flag, passed during operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INV_FLAG + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -4863924749863817671L; + + /** + * Creates a INV_FLAG with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INV_FLAG(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_FLAG with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_FLAG() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_FLAG exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INV_FLAG(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_FLAG exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INV_FLAG(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INV_IDENT.java b/org/omg/CORBA/INV_IDENT.java new file mode 100644 index 000000000..487e50d11 --- /dev/null +++ b/org/omg/CORBA/INV_IDENT.java @@ -0,0 +1,96 @@ +/* INV_IDENT.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that some IDL identifier has a wrong syntax. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INV_IDENT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 4399295047946553530L; + + /** + * Creates a INV_IDENT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INV_IDENT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_IDENT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_IDENT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_IDENT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INV_IDENT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_IDENT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INV_IDENT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INV_OBJREF.java b/org/omg/CORBA/INV_OBJREF.java new file mode 100644 index 000000000..146e80b2a --- /dev/null +++ b/org/omg/CORBA/INV_OBJREF.java @@ -0,0 +1,96 @@ +/* INV_OBJREF.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that some object reference is internally malformed. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INV_OBJREF + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -7238811948257685034L; + + /** + * Creates a INV_OBJREF with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INV_OBJREF(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_OBJREF with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_OBJREF() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_OBJREF exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INV_OBJREF(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_OBJREF exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INV_OBJREF(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/INV_POLICY.java b/org/omg/CORBA/INV_POLICY.java new file mode 100644 index 000000000..387f3f498 --- /dev/null +++ b/org/omg/CORBA/INV_POLICY.java @@ -0,0 +1,98 @@ +/* INV_POLICY.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * This exception is thrown when an invocation cannot be made because of + * an incompatibility between Policy overrides that apply to the + * particular invocation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class INV_POLICY + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -7823113107689030975L; + + /** + * Creates a INV_POLICY with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public INV_POLICY(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates INV_POLICY with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public INV_POLICY() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a INV_POLICY exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + INV_POLICY(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created INV_POLICY exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + INV_POLICY(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/IntHolder.java b/org/omg/CORBA/IntHolder.java new file mode 100644 index 000000000..3b7077475 --- /dev/null +++ b/org/omg/CORBA/IntHolder.java @@ -0,0 +1,126 @@ +/* IntHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>long</code> that is mapped into + * java <code>int</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class IntHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_long = new primitiveTypeCode(TCKind.tk_long); + + /** + * The <code>int</code> (CORBA <code>long</code>) value, + * held by this IntHolder. + */ + public int value; + + /** + * Constructs an instance of IntHolder, + * initializing {@link #value} to <code>0</code>. + */ + public IntHolder() + { + } + + /** + * Constructs an instance of IntHolder, + * initializing {@link #value} to the given <code>int</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public IntHolder(int initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_long}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_long(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_long; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_long(int) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value); + } +} diff --git a/org/omg/CORBA/LongHolder.java b/org/omg/CORBA/LongHolder.java new file mode 100644 index 000000000..42e927692 --- /dev/null +++ b/org/omg/CORBA/LongHolder.java @@ -0,0 +1,127 @@ +/* LongHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>long long</code> that is mapped into + * java <code>long</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class LongHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_longlong = + new primitiveTypeCode(TCKind.tk_longlong); + + /** + * The <code>long</code> (CORBA <code>long long</code>) value, + * held by this LongHolder. + */ + public long value; + + /** + * Constructs an instance of LongHolder, + * initializing {@link #value} to <code>0 </code>. + */ + public LongHolder() + { + } + + /** + * Constructs an instance of LongHolder, + * initializing {@link #value} to the given <code>long</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public LongHolder(long initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>long long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_longlong}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_longlong(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_longlong; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>long long</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_longlong(long) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_longlong(value); + } +} diff --git a/org/omg/CORBA/LongLongSeqHelper.java b/org/omg/CORBA/LongLongSeqHelper.java new file mode 100644 index 000000000..37e3cb918 --- /dev/null +++ b/org/omg/CORBA/LongLongSeqHelper.java @@ -0,0 +1,148 @@ +/* LongLongSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>long</code> + * (<code>LongLongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class LongLongSeqHelper +{ + /** + * Extract the <code>long[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link LongLongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link LongLongSeqHolder}. + */ + public static long[] extract(Any a) + { + LongLongSeqHolder h = (LongLongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>long[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link LongLongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, long[] that) + { + LongLongSeqHolder holder = new LongLongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>long[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link LongLongSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static long[] read(InputStream input) + { + LongLongSeqHolder h = new LongLongSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>LongLongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_long); + } + + /** + * Writes the <code>long[]</code> into the given stream. + * This implementation first creates an instance of + * {@link LongLongSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, long[] value) + { + LongLongSeqHolder h = new LongLongSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/LongLongSeqHolder.java b/org/omg/CORBA/LongLongSeqHolder.java new file mode 100644 index 000000000..cbe25091c --- /dev/null +++ b/org/omg/CORBA/LongLongSeqHolder.java @@ -0,0 +1,126 @@ +/* LongLongSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>LongLongSeq</code> that is mapped into + * java <code>long[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class LongLongSeqHolder + implements Streamable +{ + /** + * The <code>long[]</code> (CORBA <code>LongLongSeq</code>) value, + * held by this LongLongSeqHolder. + */ + public long[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_longlong); + + /** + * Constructs an instance of LongLongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public LongLongSeqHolder() + { + } + + /** + * Constructs an instance of LongLongSeqHolder, + * initializing {@link #value} to the given <code>long[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public LongLongSeqHolder(long[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_longlong_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new long[ input.read_long() ]; + input.read_longlong_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_longlong_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_longlong_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/LongSeqHelper.java b/org/omg/CORBA/LongSeqHelper.java new file mode 100644 index 000000000..49ff87774 --- /dev/null +++ b/org/omg/CORBA/LongSeqHelper.java @@ -0,0 +1,148 @@ +/* LongSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>int</code> + * (<code>LongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class LongSeqHelper +{ + /** + * Extract the <code>int[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link LongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link LongSeqHolder}. + */ + public static int[] extract(Any a) + { + LongSeqHolder h = (LongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>int[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link LongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, int[] that) + { + LongSeqHolder holder = new LongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>int[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link LongSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static int[] read(InputStream input) + { + LongSeqHolder h = new LongSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>LongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_long); + } + + /** + * Writes the <code>int[]</code> into the given stream. + * This implementation first creates an instance of + * {@link LongSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, int[] value) + { + LongSeqHolder h = new LongSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/LongSeqHolder.java b/org/omg/CORBA/LongSeqHolder.java new file mode 100644 index 000000000..6e5a3ce6b --- /dev/null +++ b/org/omg/CORBA/LongSeqHolder.java @@ -0,0 +1,128 @@ +/* LongSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>LongSeq</code> that is mapped into + * java <code>int[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class LongSeqHolder + implements Streamable +{ + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_long); + + /** + * The <code>int[]</code> (CORBA <code>LongSeq</code>) value, + * held by this LongSeqHolder. + */ + public int[] value; + + /** + * Constructs an instance of LongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public LongSeqHolder() + { + } + + /** + * Constructs an instance of LongSeqHolder, + * initializing {@link #value} to the given <code>int</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public LongSeqHolder(int[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>and then calls the + * {@link org.omg.CORBA.portable.InputStream#input.read_long_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new int[ input.read_long() ]; + input.read_long_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>and then calls the + * {@link org.omg.CORBA.portable.OutputStream#input.write_long_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_long_array(value, 0, value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + +} diff --git a/org/omg/CORBA/MARSHAL.java b/org/omg/CORBA/MARSHAL.java new file mode 100644 index 000000000..52a6725f2 --- /dev/null +++ b/org/omg/CORBA/MARSHAL.java @@ -0,0 +1,97 @@ +/* MARSHAL.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that some request or reply from the network has a wrong + * size or is structurally invalid. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class MARSHAL + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 7416408250336395546L; + + /** + * Creates a MARSHAL with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public MARSHAL(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates MARSHAL with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public MARSHAL() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a MARSHAL exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + MARSHAL(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created MARSHAL exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + MARSHAL(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/NO_IMPLEMENT.java b/org/omg/CORBA/NO_IMPLEMENT.java new file mode 100644 index 000000000..6b7a9ab3b --- /dev/null +++ b/org/omg/CORBA/NO_IMPLEMENT.java @@ -0,0 +1,97 @@ +/* NO_IMPLEMENT.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that while the operation being invoked does exists, no + * implementation for it exists. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class NO_IMPLEMENT + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 3519190655657192112L; + + /** + * Creates a NO_IMPLEMENT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public NO_IMPLEMENT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_IMPLEMENT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_IMPLEMENT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_IMPLEMENT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + NO_IMPLEMENT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_IMPLEMENT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + NO_IMPLEMENT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/NO_MEMORY.java b/org/omg/CORBA/NO_MEMORY.java new file mode 100644 index 000000000..bda5209b3 --- /dev/null +++ b/org/omg/CORBA/NO_MEMORY.java @@ -0,0 +1,96 @@ +/* NO_MEMORY.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the server has runned out of memory. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class NO_MEMORY + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -4591569617929689285L; + + /** + * Creates a NO_MEMORY with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public NO_MEMORY(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_MEMORY with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_MEMORY() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_MEMORY exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + NO_MEMORY(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_MEMORY exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + NO_MEMORY(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/NO_PERMISSION.java b/org/omg/CORBA/NO_PERMISSION.java new file mode 100644 index 000000000..4233d6619 --- /dev/null +++ b/org/omg/CORBA/NO_PERMISSION.java @@ -0,0 +1,96 @@ +/* NO_PERMISSION.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the caller has no rights to invoke the operation. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class NO_PERMISSION + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1533969523582458479L; + + /** + * Creates a NO_PERMISSION with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public NO_PERMISSION(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_PERMISSION with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_PERMISSION() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_PERMISSION exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + NO_PERMISSION(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_PERMISSION exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + NO_PERMISSION(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/NO_RESPONSE.java b/org/omg/CORBA/NO_RESPONSE.java new file mode 100644 index 000000000..25b1ed20a --- /dev/null +++ b/org/omg/CORBA/NO_RESPONSE.java @@ -0,0 +1,97 @@ +/* NO_RESPONSE.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the client attempts to retrieve the result that is not + * yet available. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class NO_RESPONSE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1971973765161647047L; + + /** + * Creates a NO_RESPONSE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public NO_RESPONSE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates NO_RESPONSE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public NO_RESPONSE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a NO_RESPONSE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + NO_RESPONSE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created NO_RESPONSE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + NO_RESPONSE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/NamedValue.java b/org/omg/CORBA/NamedValue.java new file mode 100644 index 000000000..c7492c747 --- /dev/null +++ b/org/omg/CORBA/NamedValue.java @@ -0,0 +1,71 @@ +/* NamedValue.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + +package org.omg.CORBA; + +/** + * The class is used to describe a call parameter, having name, + * value and the passing mode flags ({@link ARG_IN}, {@link ARG_OUT} or + * {@link ARG_INOUT}. The same class is also used in {@link Context} to + * pass the property names and values. This class is normally created by + * {@link ORB#create_named_value(String, Any, int)}. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class NamedValue +{ + /** + * Get the parameter flags. + * @return normally one of ({@link ARG_IN}, {@link ARG_OUT} or + * {@link ARG_INOUT}). + */ + public abstract int flags(); + + /** + * Get the name of this parameter. + * @return the name of this instance. + */ + public abstract String name(); + + /** + * Get the value of this parameter. The parameter value is wrapped into + * the instance of {@link Any}. + * + * @return the value of this parameter. + */ + public abstract Any value(); +} diff --git a/org/omg/CORBA/OBJECT_NOT_EXIST.java b/org/omg/CORBA/OBJECT_NOT_EXIST.java new file mode 100644 index 000000000..3466f7140 --- /dev/null +++ b/org/omg/CORBA/OBJECT_NOT_EXIST.java @@ -0,0 +1,95 @@ +/* OBJECT_NOT_EXIST.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means an attempt to perform some operation of the deleted object. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class OBJECT_NOT_EXIST + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 7226958015420512389L; + + /** + * Creates a OBJECT_NOT_EXIST with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public OBJECT_NOT_EXIST(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates OBJECT_NOT_EXIST with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public OBJECT_NOT_EXIST() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a OBJECT_NOT_EXIST exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + OBJECT_NOT_EXIST(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created OBJECT_NOT_EXIST exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + OBJECT_NOT_EXIST(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/OBJ_ADAPTER.java b/org/omg/CORBA/OBJ_ADAPTER.java new file mode 100644 index 000000000..c39efe8fb --- /dev/null +++ b/org/omg/CORBA/OBJ_ADAPTER.java @@ -0,0 +1,96 @@ +/* OBJ_ADAPTER.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * This exception typically indicates an administrative mismatch. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class OBJ_ADAPTER + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1516541344234786928L; + + /** + * Creates a OBJ_ADAPTER with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public OBJ_ADAPTER(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates OBJ_ADAPTER with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public OBJ_ADAPTER() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a OBJ_ADAPTER exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + OBJ_ADAPTER(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created OBJ_ADAPTER exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + OBJ_ADAPTER(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/ORB.java b/org/omg/CORBA/ORB.java new file mode 100644 index 000000000..f1f3e70b4 --- /dev/null +++ b/org/omg/CORBA/ORB.java @@ -0,0 +1,50 @@ +/* ORB.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +/** + * FIXME + * Not implemented yet, defined here to keep the package code compilable. + */ +public class ORB +{ + public ORB() + { + } +} diff --git a/org/omg/CORBA/Object.java b/org/omg/CORBA/Object.java new file mode 100644 index 000000000..e50da51c0 --- /dev/null +++ b/org/omg/CORBA/Object.java @@ -0,0 +1,48 @@ +/* Object.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + + +/** + * FIXME + * Not implemented, defined to keep the code compilable. + */ +public class Object +{ +} diff --git a/org/omg/CORBA/OctetSeqHelper.java b/org/omg/CORBA/OctetSeqHelper.java new file mode 100644 index 000000000..dabf8c829 --- /dev/null +++ b/org/omg/CORBA/OctetSeqHelper.java @@ -0,0 +1,148 @@ +/* OctetSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>byte</code> + * (<code>OctetSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class OctetSeqHelper +{ + /** + * Extract the <code>byte[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link OctetSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link OctetSeqHolder}. + */ + public static byte[] extract(Any a) + { + OctetSeqHolder h = (OctetSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>byte[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link OctetSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, byte[] that) + { + OctetSeqHolder holder = new OctetSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>byte[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link OctetSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static byte[] read(InputStream input) + { + OctetSeqHolder h = new OctetSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>OctetSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_octet); + } + + /** + * Writes the <code>byte[]</code> into the given stream. + * This implementation first creates an instance of + * {@link OctetSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, byte[] value) + { + OctetSeqHolder h = new OctetSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/OctetSeqHolder.java b/org/omg/CORBA/OctetSeqHolder.java new file mode 100644 index 000000000..891f986f9 --- /dev/null +++ b/org/omg/CORBA/OctetSeqHolder.java @@ -0,0 +1,126 @@ +/* OctetSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>OctetSeq</code> that is mapped into + * java <code>byte[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class OctetSeqHolder + implements Streamable +{ + /** + * The <code>byte[]</code> (CORBA <code>OctetSeq</code>) value, + * held by this OctetSeqHolder. + */ + public byte[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_octet); + + /** + * Constructs an instance of OctetSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public OctetSeqHolder() + { + } + + /** + * Constructs an instance of OctetSeqHolder, + * initializing {@link #value} to the given <code>byte[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public OctetSeqHolder(byte[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_octet_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new byte[ input.read_long() ]; + input.read_octet_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_octet_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_octet_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/PERSIST_STORE.java b/org/omg/CORBA/PERSIST_STORE.java new file mode 100644 index 000000000..ea31d1f71 --- /dev/null +++ b/org/omg/CORBA/PERSIST_STORE.java @@ -0,0 +1,96 @@ +/* PERSIST_STORE.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Indicates a persistent storage failure like database crash. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class PERSIST_STORE + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -6835478548864681965L; + + /** + * Creates a PERSIST_STORE with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public PERSIST_STORE(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates PERSIST_STORE with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public PERSIST_STORE() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a PERSIST_STORE exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + PERSIST_STORE(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created PERSIST_STORE exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + PERSIST_STORE(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/Principal.java b/org/omg/CORBA/Principal.java new file mode 100644 index 000000000..e75c6d80e --- /dev/null +++ b/org/omg/CORBA/Principal.java @@ -0,0 +1,89 @@ +/* Principal.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +/** + * This class was used to store the client identity in the past. + * The client identity is stored in the form of the <code>byte</byte> + * array. + * + * @deprecated by CORBA 2.2. + * + * @author Audrius Meskauskas(AudriusA@Bioinformatics.org) + * + */ +public class Principal +{ + /** + * The field, holding the client identity. + */ + private byte[] m_name; + + /** + * @deprecated + */ + public Principal() + { + } + + /** + * Gets the name of the Principal. + * + * @deprecated by CORBA 2.2 + * + * @return a name of the Pricipal. + */ + public byte[] name() + { + /**@todo Override this org.omg.CORBA.Principal method*/ + return m_name; + } + + /** + * Sets the name of the Principal to the given value. + * + * @deprecated by CORBA 2.2 + * + * @param a_name a value to set the name to. + */ + public void name(byte[] a_name) + { + m_name = a_name; + } +} diff --git a/org/omg/CORBA/ShortHolder.java b/org/omg/CORBA/ShortHolder.java new file mode 100644 index 000000000..ff67aeb4a --- /dev/null +++ b/org/omg/CORBA/ShortHolder.java @@ -0,0 +1,127 @@ +/* ShortHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>short</code> that is mapped into + * java <code>short</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ShortHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_short = + new primitiveTypeCode(TCKind.tk_short); + + /** + * The <code>short</code> (CORBA <code>short</code>) value, + * held by this ShortHolder. + */ + public short value; + + /** + * Constructs an instance of ShortHolder, + * initializing {@link #value} to <code>0</code>. + */ + public ShortHolder() + { + } + + /** + * Constructs an instance of ShortHolder, + * initializing {@link #value} to the given <code>short</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ShortHolder(short initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>short</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_short}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_short(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_short; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>short</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_short(short) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_short(value); + } +} diff --git a/org/omg/CORBA/ShortSeqHelper.java b/org/omg/CORBA/ShortSeqHelper.java new file mode 100644 index 000000000..cd4198a7b --- /dev/null +++ b/org/omg/CORBA/ShortSeqHelper.java @@ -0,0 +1,148 @@ +/* ShortSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>short</code> + * (<code>ShortSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ShortSeqHelper +{ + /** + * Extract the <code>short[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link ShortSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link ShortSeqHolder}. + */ + public static short[] extract(Any a) + { + ShortSeqHolder h = (ShortSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>short[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link ShortSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, short[] that) + { + ShortSeqHolder holder = new ShortSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>short[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link ShortSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static short[] read(InputStream input) + { + ShortSeqHolder h = new ShortSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>ShortSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_short); + } + + /** + * Writes the <code>short[]</code> into the given stream. + * This implementation first creates an instance of + * {@link ShortSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, short[] value) + { + ShortSeqHolder h = new ShortSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/ShortSeqHolder.java b/org/omg/CORBA/ShortSeqHolder.java new file mode 100644 index 000000000..528b43458 --- /dev/null +++ b/org/omg/CORBA/ShortSeqHolder.java @@ -0,0 +1,126 @@ +/* ShortSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>ShortSeq</code> that is mapped into + * java <code>short[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ShortSeqHolder + implements Streamable +{ + /** + * The <code>short[]</code> (CORBA <code>ShortSeq</code>) value, + * held by this ShortSeqHolder. + */ + public short[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_short); + + /** + * Constructs an instance of ShortSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public ShortSeqHolder() + { + } + + /** + * Constructs an instance of ShortSeqHolder, + * initializing {@link #value} to the given <code>short[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ShortSeqHolder(short[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_short_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new short[ input.read_long() ]; + input.read_short_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_short_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_short_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/StringHolder.java b/org/omg/CORBA/StringHolder.java new file mode 100644 index 000000000..f15a6e32e --- /dev/null +++ b/org/omg/CORBA/StringHolder.java @@ -0,0 +1,127 @@ +/* StringHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>string</code> that is mapped into + * java <code>String</code>. + * + * The holders have several application areas. The end user usually + * sees them implementing CORBA methods where the primitive type + * is passed by reference. While CORBA (or, for example, C) supports + * this, the java does not and a wrapper class is required. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class StringHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_string = + new primitiveTypeCode(TCKind.tk_string); + + /** + * The <code>String</code> (CORBA <code>string</code>) value, + * held by this StringHolder. + */ + public String value; + + /** + * Constructs an instance of StringHolder, + * initializing {@link #value} to <code>null</code>. + */ + public StringHolder() + { + } + + /** + * Constructs an instance of StringHolder, + * initializing {@link #value} to the given <code>String</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public StringHolder(String initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>string</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_string}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_string(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_string; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>string</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_string(String) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_string(value); + } +} diff --git a/org/omg/CORBA/StringSeqHelper.java b/org/omg/CORBA/StringSeqHelper.java new file mode 100644 index 000000000..0a5a305fc --- /dev/null +++ b/org/omg/CORBA/StringSeqHelper.java @@ -0,0 +1,147 @@ +/* StringSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA <code>string</code> array. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class StringSeqHelper +{ + /** + * Extract the <code>String[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link StringSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link StringSeqHolder}. + */ + public static String[] extract(Any a) + { + StringSeqHolder h = (StringSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>String[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link StringSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, String[] that) + { + StringSeqHolder holder = new StringSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>String[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link StringSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static String[] read(InputStream input) + { + StringSeqHolder h = new StringSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>string[]</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_string); + } + + /** + * Writes the <code>String[]</code> into the given stream. + * This implementation first creates an instance of + * {@link StringSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, String[] value) + { + StringSeqHolder h = new StringSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/StringSeqHolder.java b/org/omg/CORBA/StringSeqHolder.java new file mode 100755 index 000000000..0844ce80a --- /dev/null +++ b/org/omg/CORBA/StringSeqHolder.java @@ -0,0 +1,131 @@ +/* StringSeqHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.*;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A sequence holder for CORBA <code>string[]</code> that is mapped into
+ * java <code>String[]</code>.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public final class StringSeqHolder
+ implements Streamable
+{
+ /**
+ * The <code>String[]</code> (CORBA <code>string[]</code>) value,
+ * held by this StringSeqHolder.
+ */
+ public String[] value;
+
+ /**
+ * The type code for this holder. Each holder has a different instance.
+ */
+ private final primitiveArrayTypeCode typecode =
+ new primitiveArrayTypeCode(TCKind.tk_char);
+
+ /**
+ * Constructs an instance of StringSeqHolder,
+ * initializing {@link #value} to <code>null</code>.
+ */
+ public StringSeqHolder()
+ {
+ }
+
+ /**
+ * Constructs an instance of StringSeqHolder,
+ * initializing {@link #value} to the given <code>String</code>.
+ *
+ * @param initial_value a value that will be assigned to the
+ * {@link #value} field.
+ */
+ public StringSeqHolder(String[] initial_value)
+ {
+ value = initial_value;
+ typecode.setLength(value.length);
+ }
+
+ /**
+ * Fill in the {@link value } field by reading the required data
+ * from the given stream. This method first reads the array size
+ * (as CORBA <code>long</code>and then all strings.
+ *
+ * @param input the input stream to read from.
+ */
+ public void _read(InputStream input)
+ {
+ value = new String[ input.read_long() ];
+ for (int i = 0; i < value.length; i++)
+ {
+ value [ i ] = input.read_wstring();
+ }
+ typecode.setLength(value.length);
+ }
+
+ /**
+ * Returns the TypeCode, corresponding the CORBA type that is stored
+ * using this holder.
+ */
+ public TypeCode _type()
+ {
+ return typecode;
+ }
+
+ /**
+ * Write the {@link value } field to the given stream.
+ * This method first writes the array size
+ * (as CORBA <code>long</code> and then all strings.
+ *
+ * @param output the output stream to write into.
+ */
+ public void _write(OutputStream output)
+ {
+ output.write_long(value.length);
+
+ for (int i = 0; i < value.length; i++)
+ {
+ output.write_wstring(value [ i ]);
+ }
+ }
+}
diff --git a/org/omg/CORBA/SystemException.java b/org/omg/CORBA/SystemException.java new file mode 100644 index 000000000..a76a169ef --- /dev/null +++ b/org/omg/CORBA/SystemException.java @@ -0,0 +1,82 @@ +/* SystemException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * The root class for all CORBA standard exceptions. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class SystemException + extends RuntimeException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = -8486391734674855519L; + + /** + * The status of the operation that have thrown this exception. + */ + public CompletionStatus completed; + + /** + * The additional exception error code ("minor"). + */ + public int minor; + + /** + * Constructs an instance of the CORBA standard exception. + * @param a_reason a string, explaining the reason why the + * exceptions has been thrown. + * @param a_minor an additional error code (known as the "minor") + * @param a_completed the task completion status. + */ + protected SystemException(String a_reason, int a_minor, + CompletionStatus a_completed + ) + { + super(a_reason); + minor = a_minor; + completed = a_completed; + } +} diff --git a/org/omg/CORBA/TCKind.java b/org/omg/CORBA/TCKind.java new file mode 100644 index 000000000..e45fee42d --- /dev/null +++ b/org/omg/CORBA/TCKind.java @@ -0,0 +1,504 @@ +/* TCKind.java -- java to IDL mapping constants. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + + +/** + * The basic constants, used in java to IDL mapping. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TCKind +{ + /** + * The integer constant, indicating IDL data type + * <code>null</code>. + */ + public static final int _tk_null = 0; + + /** + * The integer constant, indicating IDL data type + * <code>void</code>. + */ + public static final int _tk_void = 1; + + /** + * The integer constant, indicating IDL data type + * <code>short</code>. + */ + public static final int _tk_short = 2; + + /** + * The integer constant, indicating IDL data type + * <code>long</code>. + */ + public static final int _tk_long = 3; + + /** + * The integer constant, indicating IDL data type + * <code>ushort</code>. + */ + public static final int _tk_ushort = 4; + + /** + * The integer constant, indicating IDL data type + * <code>ulong</code>. + */ + public static final int _tk_ulong = 5; + + /** + * The integer constant, indicating IDL data type + * <code>float</code>. + */ + public static final int _tk_float = 6; + + /** + * The integer constant, indicating IDL data type + * <code>double</code>. + */ + public static final int _tk_double = 7; + + /** + * The integer constant, indicating IDL data type + * <code>boolean</code>. + */ + public static final int _tk_boolean = 8; + + /** + * The integer constant, indicating IDL data type + * <code>char</code>. + */ + public static final int _tk_char = 9; + + /** + * The integer constant, indicating IDL data type + * <code>octet</code>. + */ + public static final int _tk_octet = 10; + + /** + * The integer constant, indicating IDL data type + * <code>any</code>. + */ + public static final int _tk_any = 11; + + /** + * The integer constant, indicating IDL data type + * <code>TypeCode</code>. + */ + public static final int _tk_TypeCode = 12; + + /** + * The integer constant, indicating IDL data type + * <code>Principal</code>. + */ + public static final int _tk_Principal = 13; + + /** + * The integer constant, indicating IDL data type + * <code>objref</code>. + */ + public static final int _tk_objref = 14; + + /** + * The integer constant, indicating IDL data type + * <code>struct</code>. + */ + public static final int _tk_struct = 15; + + /** + * The integer constant, indicating IDL data type + * <code>union</code>. + */ + public static final int _tk_union = 16; + + /** + * The integer constant, indicating IDL data type + * <code>enum</code>. + */ + public static final int _tk_enum = 17; + + /** + * The integer constant, indicating IDL data type + * <code>string</code>. + */ + public static final int _tk_string = 18; + + /** + * The integer constant, indicating IDL data type + * <code>sequence</code>. + */ + public static final int _tk_sequence = 19; + + /** + * The integer constant, indicating IDL data type + * <code>array</code>. + */ + public static final int _tk_array = 20; + + /** + * The integer constant, indicating IDL data type + * <code>alias</code>. + */ + public static final int _tk_alias = 21; + + /** + * The integer constant, indicating IDL data type + * <code>except</code>. + */ + public static final int _tk_except = 22; + + /** + * The integer constant, indicating IDL data type + * <code>longlong</code>. + */ + public static final int _tk_longlong = 23; + + /** + * The integer constant, indicating IDL data type + * <code>ulonglong</code>. + */ + public static final int _tk_ulonglong = 24; + + /** + * The integer constant, indicating IDL data type + * <code>longdouble</code>. + */ + public static final int _tk_longdouble = 25; + + /** + * The integer constant, indicating IDL data type + * <code>wchar</code>. + */ + public static final int _tk_wchar = 26; + + /** + * The integer constant, indicating IDL data type + * <code>wstring</code>. + */ + public static final int _tk_wstring = 27; + + /** + * The integer constant, indicating IDL data type + * <code>fixed</code>. + */ + public static final int _tk_fixed = 28; + + /** + * The integer constant, indicating IDL data type + * <code>value</code>. + */ + public static final int _tk_value = 29; + + /** + * The integer constant, indicating IDL data type + * <code>value_box</code>. + */ + public static final int _tk_value_box = 30; + + /** + * The integer constant, indicating IDL data type + * <code>native</code>. + */ + public static final int _tk_native = 31; + + /** + * The integer constant, indicating IDL data type + * <code>abstract_interface</code>. + */ + public static final int _tk_abstract_interface = 32; + + /** + * The TCKind constant, indicating IDL data type + * <code>null</code> + */ + public static final TCKind tk_null = new TCKind(_tk_null); + + /** + * The TCKind constant, indicating IDL data type + * <code>void</code> + */ + public static final TCKind tk_void = new TCKind(_tk_void); + + /** + * The TCKind constant, indicating IDL data type + * <code>short</code> + */ + public static final TCKind tk_short = new TCKind(_tk_short); + + /** + * The TCKind constant, indicating IDL data type + * <code>long</code> + */ + public static final TCKind tk_long = new TCKind(_tk_long); + + /** + * The TCKind constant, indicating IDL data type + * <code>ushort</code> + */ + public static final TCKind tk_ushort = new TCKind(_tk_ushort); + + /** + * The TCKind constant, indicating IDL data type + * <code>ulong</code> + */ + public static final TCKind tk_ulong = new TCKind(_tk_ulong); + + /** + * The TCKind constant, indicating IDL data type + * <code>float</code> + */ + public static final TCKind tk_float = new TCKind(_tk_float); + + /** + * The TCKind constant, indicating IDL data type + * <code>double</code> + */ + public static final TCKind tk_double = new TCKind(_tk_double); + + /** + * The TCKind constant, indicating IDL data type + * <code>boolean</code> + */ + public static final TCKind tk_boolean = new TCKind(_tk_boolean); + + /** + * The TCKind constant, indicating IDL data type + * <code>char</code> + */ + public static final TCKind tk_char = new TCKind(_tk_char); + + /** + * The TCKind constant, indicating IDL data type + * <code>octet</code> + */ + public static final TCKind tk_octet = new TCKind(_tk_octet); + + /** + * The TCKind constant, indicating IDL data type + * <code>any</code> + */ + public static final TCKind tk_any = new TCKind(_tk_any); + + /** + * The TCKind constant, indicating IDL data type + * <code>TypeCode</code> + */ + public static final TCKind tk_TypeCode = new TCKind(_tk_TypeCode); + + /** + * The TCKind constant, indicating IDL data type + * <code>Principal</code> + */ + public static final TCKind tk_Principal = new TCKind(_tk_Principal); + + /** + * The TCKind constant, indicating IDL data type + * <code>objref</code> + */ + public static final TCKind tk_objref = new TCKind(_tk_objref); + + /** + * The TCKind constant, indicating IDL data type + * <code>struct</code> + */ + public static final TCKind tk_struct = new TCKind(_tk_struct); + + /** + * The TCKind constant, indicating IDL data type + * <code>union</code> + */ + public static final TCKind tk_union = new TCKind(_tk_union); + + /** + * The TCKind constant, indicating IDL data type + * <code>enum</code> + */ + public static final TCKind tk_enum = new TCKind(_tk_enum); + + /** + * The TCKind constant, indicating IDL data type + * <code>string</code> + */ + public static final TCKind tk_string = new TCKind(_tk_string); + + /** + * The TCKind constant, indicating IDL data type + * <code>sequence</code> + */ + public static final TCKind tk_sequence = new TCKind(_tk_sequence); + + /** + * The TCKind constant, indicating IDL data type + * <code>array</code> + */ + public static final TCKind tk_array = new TCKind(_tk_array); + + /** + * The TCKind constant, indicating IDL data type + * <code>alias</code> + */ + public static final TCKind tk_alias = new TCKind(_tk_alias); + + /** + * The TCKind constant, indicating IDL data type + * <code>except</code> + */ + public static final TCKind tk_except = new TCKind(_tk_except); + + /** + * The TCKind constant, indicating IDL data type + * <code>longlong</code> + */ + public static final TCKind tk_longlong = new TCKind(_tk_longlong); + + /** + * The TCKind constant, indicating IDL data type + * <code>ulonglong</code> + */ + public static final TCKind tk_ulonglong = new TCKind(_tk_ulonglong); + + /** + * The TCKind constant, indicating IDL data type + * <code>longdouble</code> + */ + public static final TCKind tk_longdouble = new TCKind(_tk_longdouble); + + /** + * The TCKind constant, indicating IDL data type + * <code>wchar</code> + */ + public static final TCKind tk_wchar = new TCKind(_tk_wchar); + + /** + * The TCKind constant, indicating IDL data type + * <code>wstring</code> + */ + public static final TCKind tk_wstring = new TCKind(_tk_wstring); + + /** + * The TCKind constant, indicating IDL data type + * <code>fixed</code> + */ + public static final TCKind tk_fixed = new TCKind(_tk_fixed); + + /** + * The TCKind constant, indicating IDL data type + * <code>value</code> + */ + public static final TCKind tk_value = new TCKind(_tk_value); + + /** + * The TCKind constant, indicating IDL data type + * <code>value_box</code> + */ + public static final TCKind tk_value_box = new TCKind(_tk_value_box); + + /** + * The TCKind constant, indicating IDL data type + * <code>native</code> + */ + public static final TCKind tk_native = new TCKind(_tk_native); + + /** + * The TCKind constant, indicating IDL data type + * <code>abstract_interface</code> + */ + public static final TCKind tk_abstract_interface = + new TCKind(_tk_abstract_interface); + + /** + * The kind value for this instance. + */ + private final int _value; + + /** + * The array of all tk_... instances, sorted by the kind number. + * + * As long as the kind numbers make the continuos sequence, starting from 0, + * the members can be found just by direct indexing. + */ + private static final TCKind[] tk = + new TCKind[] + { + tk_null, tk_void, tk_short, tk_long, tk_ushort, tk_ulong, tk_float, + tk_double, tk_boolean, tk_char, tk_octet, tk_any, tk_TypeCode, + tk_Principal, tk_objref, tk_struct, tk_union, tk_enum, tk_string, + tk_sequence, tk_array, tk_alias, tk_except, tk_longlong, tk_ulonglong, + tk_longdouble, tk_wchar, tk_wstring, tk_fixed, tk_value, tk_value_box, + tk_native, tk_abstract_interface + }; + + /** + * Creates a new TCKind instance with the given integer constant value. + * @deprecated it is recommended to use {@link #from_int(int)} that + * reuses existing TCKind object instead of allocating the new instance. + * @param kind one of the <code>_tk_..</code> constants. + */ + protected TCKind(int kind) + { + _value = kind; + } + + /** + * Returns the integer value, corresponding this instance of TCKind. + * @return the <code>_tk_..</code> value, matching this instance. + */ + public int value() + { + return _value; + } + + /** + * Return a TCKind object, matching the given integer code. + * @param _tk_nnn the TCKind code, one of <code>_tk_..</code> constants. + * @return the matching instance of TCKind, on of tk_.. constants. + * @throws BAD_PARAM if the given integer constant is not one of the + * valid <code>_tk_..</code> constants. + */ + public static TCKind from_int(int _tk_nnn) + { + try { + return tk[_tk_nnn]; + } + catch (ArrayIndexOutOfBoundsException aex) { + throw new BAD_PARAM("Invalid _tk_ code "+_tk_nnn); + } + } + +} diff --git a/org/omg/CORBA/TRANSACTION_REQUIRED.java b/org/omg/CORBA/TRANSACTION_REQUIRED.java new file mode 100644 index 000000000..89ee2a989 --- /dev/null +++ b/org/omg/CORBA/TRANSACTION_REQUIRED.java @@ -0,0 +1,96 @@ +/* TRANSACTION_REQUIRED.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that request carried a null transaction context, but an + * active transaction is required. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TRANSACTION_REQUIRED + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -1900254548742148576L; + + /** + * Creates a TRANSACTION_REQUIRED with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public TRANSACTION_REQUIRED(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TRANSACTION_REQUIRED with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSACTION_REQUIRED() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSACTION_REQUIRED exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + TRANSACTION_REQUIRED(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSACTION_REQUIRED exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + TRANSACTION_REQUIRED(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java b/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java new file mode 100644 index 000000000..f31fdc711 --- /dev/null +++ b/org/omg/CORBA/TRANSACTION_ROLLEDBACK.java @@ -0,0 +1,97 @@ +/* TRANSACTION_ROLLEDBACK.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that transaction associated with the request has already + * been rolled back or marked to roll back. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TRANSACTION_ROLLEDBACK + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -343903462439281571L; + + /** + * Creates a TRANSACTION_ROLLEDBACK with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public TRANSACTION_ROLLEDBACK(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TRANSACTION_ROLLEDBACK with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSACTION_ROLLEDBACK() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSACTION_ROLLEDBACK exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + TRANSACTION_ROLLEDBACK(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSACTION_ROLLEDBACK exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + TRANSACTION_ROLLEDBACK(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/TRANSIENT.java b/org/omg/CORBA/TRANSIENT.java new file mode 100644 index 000000000..eae22296e --- /dev/null +++ b/org/omg/CORBA/TRANSIENT.java @@ -0,0 +1,92 @@ +/* TRANSIENT.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the ORB cannot <i>reach</i> the object. It is not an + * indication that this object does not exist. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TRANSIENT + extends SystemException + implements Serializable +{ + /** + * Creates a TRANSIENT with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public TRANSIENT(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates TRANSIENT with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public TRANSIENT() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a TRANSIENT exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + TRANSIENT(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created TRANSIENT exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + TRANSIENT(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/TypeCode.java b/org/omg/CORBA/TypeCode.java new file mode 100644 index 000000000..0b60b0498 --- /dev/null +++ b/org/omg/CORBA/TypeCode.java @@ -0,0 +1,271 @@ +/* TypeCode.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import org.omg.CORBA.portable.IDLEntity; +import org.omg.CORBA.TypeCodePackage.BadKind; + +/** + * An information about a CORBA data type. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +import java.io.Serializable; + +public abstract class TypeCode + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID = -6521025782489515676L; + + /** + * Returns the concrete base type for this TypeCode. + * @return a TypeCode, defining the concrete base type for this + * Typecode. + * @throws org.omg.CORBA.TypeCodePackage.BadKind + */ + public abstract TypeCode concrete_base_type() + throws BadKind; + + /** + * For sequences, arrays, aliases and value boxes, returns the IDL type for + * the members of the object. + * @return a TypeCode of the memebers of this type. + * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than + * sequences, arrays, aliases and value boxes. + */ + public abstract TypeCode content_type() + throws BadKind; + + /** + * For unions, returs the index of the default member. + * @return the index of the default member, -1 if there is + * no default member. + * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not + * a union. + */ + public abstract int default_index() + throws BadKind; + + /** + * Returs definition of member labels for untions + * @return a TypeCode, describing all non-default member labels. + * @throws org.omg.CORBA.TypeCodePackage.BadKind if this type is not a + * union. + */ + public abstract TypeCode discriminator_type() + throws BadKind; + + /** + * Test two types for equality. The default implementation + * returs true of the types of the same kind. + * @param other the other type to compere with + * @return true if the types are interchangeable. + */ + public abstract boolean equal(TypeCode other); + + /** + * Following the current 1.4 API specifcation, this should just throw + * NO_IMPLEMENT. + * @throws org.omg.CORBA.NO_IMPLEMENT, always. + */ + public abstract boolean equivalent(TypeCode other); + + /** + * For the fixed type, returns the number of digits. + * @return the number of digits for the fixed type + * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed + * type. + */ + public abstract short fixed_digits() + throws BadKind; + + /** + * Returns the scale for the fixed type. The returned value can be either + * positive (the number of digits to the right of the decimal point) or + * negative (adds zeros to the left of the decimal point). + * @return the scale. + * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a fixed + * type. + */ + public abstract short fixed_scale() + throws BadKind; + + /** + * Returns a version of this instance without the optional memeber and + * member name fields. + * @return the truncated version. + */ + public abstract TypeCode get_compact_typecode(); + + /** + * Returns the RepositoryId globally identifying the type, defined by + * this TypeCode. + * @return tje RepositoryId. In some cases, it may be an empty string. + * @throws org.omg.CORBA.TypeCodePackage.BadKind if the type is other than + * reference, structure, union, enumeration, alias, exception, valuetype, + * boxed valuetype and also native and abstract interfaces. + */ + public abstract String id() + throws BadKind; + + /** + * Return the kind of this type code object. + * @return one of the <code>TCKind.t_..</code> fields. + */ + public abstract TCKind kind(); + + /** + * Returns the number of elements in the type. For arrays, this + * method returns the length of the array. For strings and sequences, + * it returns the bound of the type, zero indicating the unbounded + * type. + * + * @return length or bound + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than + * string, sequence and array. + */ + public abstract int length() + throws BadKind; + + /** + * Returns the number of type memebers. + * + * @return the number of memebers + * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than + * structure, union, enumeration or exception. + */ + public abstract int member_count() + throws BadKind; + + /** + * Retrieves the label of the union member at the given index. + * For the default member, this label is the zero octet. + * + * @param index the index of the union memeber. + * + * @return the label + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a union + * type. + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract Any member_label(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + /** + * Retrieves the simple name of the member identified by the given index. + * + * @param index the index of the memeber. + * + * @return the member name that in some cases can be an empty string. + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than + * structure, union or enumeration. + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract String member_name(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + /** + * Retrieves the member type of the member identified by the given index. + * + * @param index the index of the memeber. + * + * @return the member type. + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than + * structure, union, enumeration or exception. + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract TypeCode member_type(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + /** + * Returns the visibility scope of the member at the given index. + * This operation can only be invoked on non-boxed value types. + * + * @param index the index of the member + * + * @return either PRIVATE_MEMBER.value or PUBLIC_MEMBER.value + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind if this is not a non boxed + * value type. + * + * @throws org.omg.CORBA.TypeCodePackage.Bounds if the index is out of + * valid bounds. + */ + public abstract short member_visibility(int index) + throws BadKind, + org.omg.CORBA.TypeCodePackage.Bounds; + + + /** + * Retrieves the simple name identifying this TypeCode object + * within its enclosing scope. + * @return the name, can be an empty string. + * @throws org.omg.CORBA.TypeCodePackage.BadKind for typer other than + * reference, structure, union, enumeration, alias, exception, + * valuetype, boxed valuetype, native, and abstract interface + */ + public abstract String name() + throws BadKind; + + /** + * Returns a constant indicating the modifier of the value type. + * + * @return one of the following constants: + * VM_NONE.value, VM_ABSTRACT.value, VM_CUSTOM.value, or + * VM_TRUNCATABLE.value, + * + * @throws org.omg.CORBA.TypeCodePackage.BadKind for types other than + * value type. + */ + public abstract short type_modifier() + throws BadKind; +} diff --git a/org/omg/CORBA/TypeCodeHolder.java b/org/omg/CORBA/TypeCodeHolder.java new file mode 100644 index 000000000..9b63545de --- /dev/null +++ b/org/omg/CORBA/TypeCodeHolder.java @@ -0,0 +1,123 @@ +/* TypeCodeHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A holder for CORBA <code>TypeCode</code> that is mapped into + * java <code>TypeCode</code>. + * + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TypeCodeHolder + implements Streamable +{ + /** + * The default type code for this holder. + */ + private static final TypeCode t_TypeCode = + new primitiveTypeCode(TCKind.tk_TypeCode); + + /** + * The <code>TypeCode</code> (CORBA <code>TypeCode</code>) value, + * held by this TypeCodeHolder. + */ + public TypeCode value; + + /** + * Constructs an instance of TypeCodeHolder, + * initializing {@link #value} to <code>null</code>. + */ + public TypeCodeHolder() + { + } + + /** + * Constructs an instance of TypeCodeHolder, + * initializing {@link #value} to the given <code>TypeCode</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public TypeCodeHolder(TypeCode initial_value) + { + value = initial_value; + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. For <code>TypeCode</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.InputStream#read_TypeCode}. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = input.read_TypeCode(); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return t_TypeCode; + } + + /** + * Write the {@link value } field to the given stream. + * For <code>TypeCode</code>, the functionality + * is delegated to + * {@link org.omg.CORBA.portable.OutputStream#write_TypeCode(TypeCode) }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_TypeCode(value); + } +} diff --git a/org/omg/CORBA/TypeCodePackage/BadKind.java b/org/omg/CORBA/TypeCodePackage/BadKind.java new file mode 100644 index 000000000..9de829021 --- /dev/null +++ b/org/omg/CORBA/TypeCodePackage/BadKind.java @@ -0,0 +1,76 @@ +/* BadKind.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA.TypeCodePackage; + +import org.omg.CORBA.IDLEntity; +import org.omg.CORBA.UserException; + +import java.io.Serializable; + +/** + * This exception is thrown when an inappropriate operation is invoked on + * a {@link org.omg.CORBA.TypeCode} object. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class BadKind + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = 1030443154456771956L; + + /** + * Constructs a the exception. + */ + public BadKind() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + public BadKind(String reason) + { + super(reason); + } +} diff --git a/org/omg/CORBA/TypeCodePackage/Bounds.java b/org/omg/CORBA/TypeCodePackage/Bounds.java new file mode 100644 index 000000000..533597a6f --- /dev/null +++ b/org/omg/CORBA/TypeCodePackage/Bounds.java @@ -0,0 +1,79 @@ +/* Bounds.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA.TypeCodePackage; + +import org.omg.CORBA.IDLEntity; +import org.omg.CORBA.UserException; + +import java.io.Serializable; + +/** + * The {@link org.omg.CORBA.TypeCode#member_name(int) }, + * {@link org.omg.CORBA.TypeCode#member_type(int) } and + * {@link org.omg.CORBA.TypeCode#member_label(int) } raise Bounds when + * the parameter is larger than the index of the last member, + * constituting the type. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Bounds + extends UserException + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -5418177951071152101L; + + /** + * Constructs a the exception. + */ + public Bounds() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + public Bounds(String reason) + { + super(reason); + } +} diff --git a/org/omg/CORBA/TypeCodePackage/package.html b/org/omg/CORBA/TypeCodePackage/package.html new file mode 100644 index 000000000..e718ef8c2 --- /dev/null +++ b/org/omg/CORBA/TypeCodePackage/package.html @@ -0,0 +1,46 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN"> +<!-- package.html - describes classes in javax.sql package. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. --> + +<html> +<head><title>GNU Classpath - org.omg.CORBA.TypeCodePackage</title></head> + +<body> +<p>Provides a couple of exceptions, thrown by methods in the <code>TypeCode</code> class.</p> + +</body> +</html> diff --git a/org/omg/CORBA/ULongLongSeqHelper.java b/org/omg/CORBA/ULongLongSeqHelper.java new file mode 100644 index 000000000..f6d2177b1 --- /dev/null +++ b/org/omg/CORBA/ULongLongSeqHelper.java @@ -0,0 +1,148 @@ +/* ULongLongSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>long</code> + * (<code>ULongLongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ULongLongSeqHelper +{ + /** + * Extract the <code>long[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link ULongLongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link ULongLongSeqHolder}. + */ + public static long[] extract(Any a) + { + ULongLongSeqHolder h = (ULongLongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>long[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link ULongLongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, long[] that) + { + ULongLongSeqHolder holder = new ULongLongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>long[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link ULongLongSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static long[] read(InputStream input) + { + ULongLongSeqHolder h = new ULongLongSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>ULongLongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_long); + } + + /** + * Writes the <code>long[]</code> into the given stream. + * This implementation first creates an instance of + * {@link ULongLongSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, long[] value) + { + ULongLongSeqHolder h = new ULongLongSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/ULongLongSeqHolder.java b/org/omg/CORBA/ULongLongSeqHolder.java new file mode 100644 index 000000000..dfaee4cec --- /dev/null +++ b/org/omg/CORBA/ULongLongSeqHolder.java @@ -0,0 +1,126 @@ +/* ULongLongSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>ULongLongSeq</code> that is mapped into + * java <code>long[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ULongLongSeqHolder + implements Streamable +{ + /** + * The <code>long[]</code> (CORBA <code>ULongLongSeq</code>) value, + * held by this ULongLongSeqHolder. + */ + public long[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_ulonglong); + + /** + * Constructs an instance of ULongLongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public ULongLongSeqHolder() + { + } + + /** + * Constructs an instance of ULongLongSeqHolder, + * initializing {@link #value} to the given <code>long[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ULongLongSeqHolder(long[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_ulonglong_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new long[ input.read_long() ]; + input.read_ulonglong_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_ulonglong_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_ulonglong_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/ULongSeqHelper.java b/org/omg/CORBA/ULongSeqHelper.java new file mode 100644 index 000000000..a0db40216 --- /dev/null +++ b/org/omg/CORBA/ULongSeqHelper.java @@ -0,0 +1,148 @@ +/* ULongSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>int</code> + * (<code>ULongSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class ULongSeqHelper +{ + /** + * Extract the <code>int[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link ULongSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link ULongSeqHolder}. + */ + public static int[] extract(Any a) + { + ULongSeqHolder h = (ULongSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>int[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link ULongSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, int[] that) + { + ULongSeqHolder holder = new ULongSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>int[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link ULongSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static int[] read(InputStream input) + { + ULongSeqHolder h = new ULongSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>ULongSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_long); + } + + /** + * Writes the <code>int[]</code> into the given stream. + * This implementation first creates an instance of + * {@link ULongSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, int[] value) + { + ULongSeqHolder h = new ULongSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/ULongSeqHolder.java b/org/omg/CORBA/ULongSeqHolder.java new file mode 100644 index 000000000..94da7446e --- /dev/null +++ b/org/omg/CORBA/ULongSeqHolder.java @@ -0,0 +1,126 @@ +/* ULongSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>ULongSeq</code> that is mapped into + * java <code>int[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class ULongSeqHolder + implements Streamable +{ + /** + * The <code>int[]</code> (CORBA <code>ULongSeq</code>) value, + * held by this ULongSeqHolder. + */ + public int[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_ulong); + + /** + * Constructs an instance of ULongSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public ULongSeqHolder() + { + } + + /** + * Constructs an instance of ULongSeqHolder, + * initializing {@link #value} to the given <code>int[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public ULongSeqHolder(int[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_ulong_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new int[ input.read_long() ]; + input.read_ulong_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_ulong_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_ulong_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/UNKNOWN.java b/org/omg/CORBA/UNKNOWN.java new file mode 100644 index 000000000..5f1d37e8c --- /dev/null +++ b/org/omg/CORBA/UNKNOWN.java @@ -0,0 +1,95 @@ +/* UNKNOWN.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * Means that the operation implementation has thrown a non-CORBA exception. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class UNKNOWN + extends SystemException + implements Serializable +{ + /** + * Use serialVersionUID for interoperability. + */ + private static final long serialVersionUID = -3556426185741898205L; + + /** + * Creates a UNKNOWN with the default minor code of 0, + * completion state COMPLETED_NO and the given explaining message. + * @param reasom the explaining message. + */ + public UNKNOWN(String message) + { + super(message, 0, CompletionStatus.COMPLETED_NO); + } + + /** + * Creates UNKNOWN with the default minor code of 0 and a + * completion state COMPLETED_NO. + */ + public UNKNOWN() + { + super("", 0, CompletionStatus.COMPLETED_NO); + } + + /** Creates a UNKNOWN exception with the specified minor + * code and completion status. + * @param minor additional error code. + * @param completed the method completion status. + */ + UNKNOWN(int minor, CompletionStatus completed) + { + super("", minor, completed); + } + + /** + * Created UNKNOWN exception, providing full information. + * @param reason explaining message. + * @param minor additional error code (the "minor"). + * @param completed the method completion status. + */ + UNKNOWN(String reason, int minor, CompletionStatus completed) + { + super(reason, minor, completed); + } +} diff --git a/org/omg/CORBA/UShortSeqHelper.java b/org/omg/CORBA/UShortSeqHelper.java new file mode 100644 index 000000000..d899a06ba --- /dev/null +++ b/org/omg/CORBA/UShortSeqHelper.java @@ -0,0 +1,148 @@ +/* UShortSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>short</code> + * (<code>UShortSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class UShortSeqHelper +{ + /** + * Extract the <code>short[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link UShortSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link UShortSeqHolder}. + */ + public static short[] extract(Any a) + { + UShortSeqHolder h = (UShortSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>short[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link UShortSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, short[] that) + { + UShortSeqHolder holder = new UShortSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>short[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link UShortSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static short[] read(InputStream input) + { + UShortSeqHolder h = new UShortSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>UShortSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_short); + } + + /** + * Writes the <code>short[]</code> into the given stream. + * This implementation first creates an instance of + * {@link UShortSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, short[] value) + { + UShortSeqHolder h = new UShortSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/UShortSeqHolder.java b/org/omg/CORBA/UShortSeqHolder.java new file mode 100644 index 000000000..86f6eae66 --- /dev/null +++ b/org/omg/CORBA/UShortSeqHolder.java @@ -0,0 +1,126 @@ +/* UShortSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>UShortSeq</code> that is mapped into + * java <code>short[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class UShortSeqHolder + implements Streamable +{ + /** + * The <code>short[]</code> (CORBA <code>UShortSeq</code>) value, + * held by this UShortSeqHolder. + */ + public short[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_ushort); + + /** + * Constructs an instance of UShortSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public UShortSeqHolder() + { + } + + /** + * Constructs an instance of UShortSeqHolder, + * initializing {@link #value} to the given <code>short[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public UShortSeqHolder(short[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#read_ushort_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new short[ input.read_long() ]; + input.read_ushort_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#write_ushort_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_ushort_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/UserException.java b/org/omg/CORBA/UserException.java new file mode 100644 index 000000000..c003516db --- /dev/null +++ b/org/omg/CORBA/UserException.java @@ -0,0 +1,72 @@ +/* UserException.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import java.io.Serializable; + +/** + * The root class for CORBA IDL-defined user exceptions. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class UserException + extends Exception + implements IDLEntity, Serializable +{ + /** + * Use serialVersionUID for interoperability. + * Using the version 1.4 UID. + */ + private static final long serialVersionUID =-6594940734566091244L; + + /** + * Constructs a the exception. + */ + public UserException() + { + } + + /** + * Constructs the exception, explaining the reason of throwing it. + * @param reason a string, explaining, why the exception has been thrown. + */ + public UserException(String reason) + { + super(reason); + } +} diff --git a/org/omg/CORBA/WCharSeqHelper.java b/org/omg/CORBA/WCharSeqHelper.java new file mode 100644 index 000000000..61958bc51 --- /dev/null +++ b/org/omg/CORBA/WCharSeqHelper.java @@ -0,0 +1,148 @@ +/* WCharSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA sequence of <code>char</code> + * (<code>WCharSeq</code>). + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class WCharSeqHelper +{ + /** + * Extract the <code>char[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link WCharSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link WCharSeqHolder}. + */ + public static char[] extract(Any a) + { + WCharSeqHolder h = (WCharSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>char[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link WCharSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, char[] that) + { + WCharSeqHolder holder = new WCharSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>char[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link WCharSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static char[] read(InputStream input) + { + WCharSeqHolder h = new WCharSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>WCharSeq</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_char); + } + + /** + * Writes the <code>char[]</code> into the given stream. + * This implementation first creates an instance of + * {@link WCharSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, char[] value) + { + WCharSeqHolder h = new WCharSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/WCharSeqHolder.java b/org/omg/CORBA/WCharSeqHolder.java new file mode 100644 index 000000000..674cd4149 --- /dev/null +++ b/org/omg/CORBA/WCharSeqHolder.java @@ -0,0 +1,126 @@ +/* WCharSeqHolder.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; +import org.omg.CORBA.portable.Streamable; + +/** + * A sequence holder for CORBA <code>WCharSeq</code> that is mapped into + * java <code>char[]</code>. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public final class WCharSeqHolder + implements Streamable +{ + /** + * The <code>char[]</code> (CORBA <code>WCharSeq</code>) value, + * held by this WCharSeqHolder. + */ + public char[] value; + + /** + * The type code for this holder. Each holder has a different instance. + */ + private final primitiveArrayTypeCode typecode = + new primitiveArrayTypeCode(TCKind.tk_wchar); + + /** + * Constructs an instance of WCharSeqHolder, + * initializing {@link #value} to <code>null</code>. + */ + public WCharSeqHolder() + { + } + + /** + * Constructs an instance of WCharSeqHolder, + * initializing {@link #value} to the given <code>char[]</code>. + * + * @param initial_value a value that will be assigned to the + * {@link #value} field. + */ + public WCharSeqHolder(char[] initial_value) + { + value = initial_value; + typecode.setLength(value.length); + } + + /** + * Fill in the {@link value } field by reading the required data + * from the given stream. This method first reads the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.InputStream#input.read_wchar_array }. + * + * @param input the input stream to read from. + */ + public void _read(InputStream input) + { + value = new char[ input.read_long() ]; + input.read_wchar_array(value, 0, value.length); + typecode.setLength(value.length); + } + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + public TypeCode _type() + { + return typecode; + } + + /** + * Write the {@link value } field to the given stream. + * This method first writes the array size + * (as CORBA <code>long</code>) and then calls the + * {@link org.omg.CORBA.portable.OutputStream#input.write_wchar_array }. + * + * @param output the output stream to write into. + */ + public void _write(OutputStream output) + { + output.write_long(value.length); + output.write_wchar_array(value, 0, value.length); + } +} diff --git a/org/omg/CORBA/WStringSeqHelper.java b/org/omg/CORBA/WStringSeqHelper.java new file mode 100644 index 000000000..62f22473c --- /dev/null +++ b/org/omg/CORBA/WStringSeqHelper.java @@ -0,0 +1,147 @@ +/* WStringSeqHelper.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA; + +import gnu.CORBA.primitiveArrayTypeCode; + +import org.omg.CORBA.TypeCodePackage.BadKind; +import org.omg.CORBA.portable.InputStream; +import org.omg.CORBA.portable.OutputStream; + +/** + * Provides static helper methods for working with + * CORBA <code>wstring</code> array. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class WStringSeqHelper +{ + /** + * Extract the <code>String[]</code> from the + * given {@link Any}. This implementation expects the + * {@link Any} to hold the instance of {@link WStringSeqHolder} + * that is returned by {@link Any#extract_Streamable() }. + * + * @param a an Any to extract the array from. + * + * @return the extracted array. + * + * @throws ClassCastException if the Any contains something other than the + * the {@link WStringSeqHolder}. + */ + public static String[] extract(Any a) + { + WStringSeqHolder h = (WStringSeqHolder) a.extract_Streamable(); + return h.value; + } + + /** + * Returns the agreed Id, delegating functionality to + * the {@link #type()}.id(). + */ + public static String id() + { + try + { + return type().id(); + } + catch (BadKind ex) + { + // Should never happen under correct work. + throw new Error("Please report this bug.", ex); + } + } + + /** + * Insert into the given <code>String[]</code> into the + * given {@link Any}. This implementation first creates + * a {@link WStringSeqHolder} and then calls + * {@link Any#insert_Streamable(Streamable)}. + * + * @param into the target Any. + * @param that the array to insert. + */ + public static void insert(Any into, String[] that) + { + WStringSeqHolder holder = new WStringSeqHolder(that); + into.insert_Streamable(holder); + } + + /** + * Reads the <code>String[]</code> from the CORBA input stream. + * This implementation first creates an instance of + * {@link WStringSeqHolder} and then delegates functionality + * to its <code>_read()</code> method. + * + * @param input the CORBA (not java.io) stream to read from. + * @return the value from the stream. + */ + public static String[] read(InputStream input) + { + WStringSeqHolder h = new WStringSeqHolder(); + h._read(input); + return h.value; + } + + /** + * Creates and returns a new instance of the TypeCode, + * corresponding the CORBA <code>wstring[]</code>. + * The length of the sequence is left with the initial + * value 0. + */ + public static TypeCode type() + { + return new primitiveArrayTypeCode(TCKind.tk_string); + } + + /** + * Writes the <code>String[]</code> into the given stream. + * This implementation first creates an instance of + * {@link WStringSeqHolder} and then delegates functionality + * to its <code>_write()</code> method. + * + * @param output the CORBA (not java.io) output stream to write. + * @param value the value that must be written. + */ + public static void write(OutputStream output, String[] value) + { + WStringSeqHolder h = new WStringSeqHolder(value); + h._write(output); + } +} diff --git a/org/omg/CORBA/WStringSeqHolder.java b/org/omg/CORBA/WStringSeqHolder.java new file mode 100755 index 000000000..b80977872 --- /dev/null +++ b/org/omg/CORBA/WStringSeqHolder.java @@ -0,0 +1,131 @@ +/* WStringSeqHolder.java --
+ Copyright (C) 2005 Free Software Foundation, Inc.
+
+This file is part of GNU Classpath.
+
+GNU Classpath 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 2, or (at your option)
+any later version.
+
+GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the
+Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+02111-1307 USA.
+
+Linking this library statically or dynamically with other modules is
+making a combined work based on this library. Thus, the terms and
+conditions of the GNU General Public License cover the whole
+combination.
+
+As a special exception, the copyright holders of this library give you
+permission to link this library with independent modules to produce an
+executable, regardless of the license terms of these independent
+modules, and to copy and distribute the resulting executable under
+terms of your choice, provided that you also meet, for each linked
+independent module, the terms and conditions of the license of that
+module. An independent module is a module which is not derived from
+or based on this library. If you modify this library, you may extend
+this exception to your version of the library, but you are not
+obligated to do so. If you do not wish to do so, delete this
+exception statement from your version. */
+
+
+package org.omg.CORBA;
+
+import gnu.CORBA.*;
+
+import org.omg.CORBA.portable.InputStream;
+import org.omg.CORBA.portable.OutputStream;
+import org.omg.CORBA.portable.Streamable;
+
+/**
+ * A sequence holder for CORBA <code>wstring[]</code> that is mapped into
+ * java <code>String[]</code>.
+ *
+ * @author Audrius Meskauskas (AudriusA@Bioinformatics.org)
+ */
+public final class WStringSeqHolder
+ implements Streamable
+{
+ /**
+ * The <code>String[]</code> (CORBA <code>wstring[]</code>) value,
+ * held by this WStringSeqHolder.
+ */
+ public String[] value;
+
+ /**
+ * The type code for this holder. Each holder has a different instance.
+ */
+ private final primitiveArrayTypeCode typecode =
+ new primitiveArrayTypeCode(TCKind.tk_wchar);
+
+ /**
+ * Constructs an instance of WStringSeqHolder,
+ * initializing {@link #value} to <code>null</code>.
+ */
+ public WStringSeqHolder()
+ {
+ }
+
+ /**
+ * Constructs an instance of WStringSeqHolder,
+ * initializing {@link #value} to the given <code>String</code>.
+ *
+ * @param initial_value a value that will be assigned to the
+ * {@link #value} field.
+ */
+ public WStringSeqHolder(String[] initial_value)
+ {
+ value = initial_value;
+ typecode.setLength(value.length);
+ }
+
+ /**
+ * Fill in the {@link value } field by reading the required data
+ * from the given stream. This method first reads the array size
+ * (as CORBA <code>long</code>and then all strings.
+ *
+ * @param input the input stream to read from.
+ */
+ public void _read(InputStream input)
+ {
+ value = new String[ input.read_long() ];
+ for (int i = 0; i < value.length; i++)
+ {
+ value [ i ] = input.read_wstring();
+ }
+ typecode.setLength(value.length);
+ }
+
+ /**
+ * Returns the TypeCode, corresponding the CORBA type that is stored
+ * using this holder.
+ */
+ public TypeCode _type()
+ {
+ return typecode;
+ }
+
+ /**
+ * Write the {@link value } field to the given stream.
+ * This method first writes the array size
+ * (as CORBA <code>long</code> and then all strings.
+ *
+ * @param output the output stream to write into.
+ */
+ public void _write(OutputStream output)
+ {
+ output.write_long(value.length);
+
+ for (int i = 0; i < value.length; i++)
+ {
+ output.write_wstring(value [ i ]);
+ }
+ }
+}
diff --git a/org/omg/CORBA/portable/IDLEntity.java b/org/omg/CORBA/portable/IDLEntity.java new file mode 100644 index 000000000..ce1c2beb7 --- /dev/null +++ b/org/omg/CORBA/portable/IDLEntity.java @@ -0,0 +1,50 @@ +/* IDLEntity.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA.portable; + +import java.io.Serializable; + +/** + * Indicates that this class has a corresponding Helper class. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface IDLEntity + extends Serializable +{ +} diff --git a/org/omg/CORBA/portable/InputStream.java b/org/omg/CORBA/portable/InputStream.java new file mode 100644 index 000000000..2481ee0e0 --- /dev/null +++ b/org/omg/CORBA/portable/InputStream.java @@ -0,0 +1,286 @@ +/* InputStream.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA.portable; + +import java.math.BigDecimal; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Context; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Object; +import org.omg.CORBA.Principal; +import org.omg.CORBA.TypeCode; + +/** + * This class is used to read CORBA IDL data types. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class InputStream + extends java.io.InputStream +{ + /** + * Return the Object Request Broker that has created this stream. + * @return the ORB. This must be overridden, as the default + * method always returns null. + */ + public ORB orb() + { + return null; + } + + /** + * This should read the CORBA context, but following the 1.4 API + * specification, it must not be implemented. + * + * @throws NO_IMPLEMENT, always. + */ + public Context read_Context() + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a CORBA (not java) object + * @return an object. + */ + public abstract org.omg.CORBA.Object read_Object(); + + /** + * Read a CORBA <code>char</code>. + * @return a value, corresponding the value of the CORBA <code>char</code>. + */ + public abstract char read_char(); + + /** + * Read a CORBA <code>double</code>. + * @return a value, corresponding the value of the CORBA <code>double</code>. + */ + public abstract double read_double(); + + /** + * Read a CORBA <code>float</code>. + * @return a value, corresponding the value of the CORBA <code>float</code>. + */ + public abstract float read_float(); + + /** + * Read a and array of CORBA float. + */ + public abstract void read_float_array(float[] value, int offset, int length); + + /** + * Read a CORBA <code>long</code> that is mapped into java <code>int</code>. + * @return an integer, corresponding the CORBA <code>long</code>. + */ + public abstract int read_long(); + + /** + * Read a CORBA <code>long long</code> that is mapped into java <code> + * long</code>. + * @return a value, corresponding the CORBA <code>long long</code> + */ + public abstract long read_longlong(); + + /** + * Read an array of CORBA <code>long long</code> + */ + public abstract void read_longlong_array(long[] value, int offset, int length); + + /** + * Read a CORBA <code>octed</code> that is mapped into java <code>byte</code>. + * @return a byte, corresponding the CORBA <code>octet</code>. + */ + public abstract byte read_octet(); + + /** + * Read a and array of CORBA octets that are mapped into java array of + * bytes. + */ + public abstract void read_octet_array(byte[] value, int offset, int length); + + /** + * Read a CORBA <code>short</code>. + * @return a value, corresponding the value of the CORBA <code>short</code>. + */ + public abstract short read_short(); + + public abstract void read_short_array(short[] value, int offset, int length); + + /** + * Read a CORBA unsigned long that is mapped into java <code>int</code>. + * @return an integer, matching the CORBA unsigned <code>long</code>. + */ + public abstract int read_ulong(); + + /** + * Read an array of CORBA unsigned long. + */ + public abstract void read_ulong_array(int[] value, int offset, int length); + + /** + * Should read from the stream, but following specification it does not. + * @throws java.io.IOException + * @throws NO_IMPLEMENT, always. + */ + public int read() + throws java.io.IOException + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a TypeCode. + * @return a TypeCode. + */ + public abstract TypeCode read_TypeCode(); + + /** + * Read a CORBA <code>boolean</code>. + * @return a value, corresponding the value of the CORBA <code>boolean</code>. + */ + public abstract boolean read_boolean(); + + /** + * Read a and array of CORBA boolean values. + */ + public abstract void read_boolean_array(boolean[] value, int offset, + int length + ); + + /** + * Read a and array of CORBA characters. + */ + public abstract void read_char_array(char[] value, int offset, int length); + + /** + * Read a and array of CORBA doubles. + */ + public abstract void read_double_array(double[] value, int offset, int length); + + /** + * Read a and array of CORBA longs. + */ + public abstract void read_long_array(int[] value, int offset, int length); + + /** + * Read a CORBA <code>string</code> that is mapped into java + * <code>String</code>. + * @return a value, corresponding the value of the CORBA + * <code>string</code>. + */ + public abstract String read_string(); + + /** + * Read a and array of CORBA unsigned longs. + */ + public abstract long read_ulonglong(); + + /** + * Read a and array of CORBA unsigned longs. + */ + public abstract void read_ulonglong_array(long[] value, int offset, int length); + + /** + * Read a CORBA unsigned short that is mapped into java <code>short</code>. + * @return a value of the CORBA unsigned <code>short</code>. + */ + public abstract short read_ushort(); + + /** + * Read a and array of CORBA unsigned shorts. + */ + public abstract void read_ushort_array(short[] value, int offset, int length); + + /** + * Read a CORBA object that is an instance of the class, passed + * as an argument. This method is not abstract, but following the + * specifications it must not be implemented. + * + * @param klass a CORBA class + * @throws NO_IMPLEMENT, always. + */ + public Object read_Object(Class klass) + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a CORBA <code>Any</code>. + * @return an <code>Any</code>. + */ + public abstract Any read_any(); + + /** + * Read a CORBA <code>fixed</code>. This method is not abstract, + * but following the specifications it must not be implemented. + * + * @throws NO_IMPLEMENT, always. + */ + public BigDecimal read_fixed() + { + throw new NO_IMPLEMENT(); + } + + /** + * Read a CORBA <code>wchar</code> that is mapped into java <code>char</code>. + * @return a value, corresponding the value of the CORBA <code>wchar</code>. + */ + public abstract char read_wchar(); + + public abstract void read_wchar_array(char[] value, int offset, int length); + + /** + * Read a CORBA <code>wstring</code> that is mapped into + * java <code>String</code>. + * @return a string, corresponding CORBA <code>wstring</code>. + */ + public abstract String read_wstring(); + + /** + * Read a CORBA <code>Principal</code>. + * @deprecated by CORBA 2.2 + * @return a Principal. + */ + public Principal read_Principal() + { + throw new NO_IMPLEMENT(); + } +} diff --git a/org/omg/CORBA/portable/OutputStream.java b/org/omg/CORBA/portable/OutputStream.java new file mode 100644 index 000000000..3a200bb02 --- /dev/null +++ b/org/omg/CORBA/portable/OutputStream.java @@ -0,0 +1,272 @@ +/* OutputStream.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA.portable; + +import org.omg.CORBA.Any; +import org.omg.CORBA.Context; +import org.omg.CORBA.ContextList; +import org.omg.CORBA.NO_IMPLEMENT; +import org.omg.CORBA.ORB; +import org.omg.CORBA.Principal; +import org.omg.CORBA.TypeCode; + +import java.math.BigDecimal; + +/** + * This class is used to write CORBA IDL data types. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public abstract class OutputStream + extends java.io.OutputStream +{ + /** + * Returns an input stream with the same buffer. + * @return an input stream + */ + public abstract InputStream create_input_stream(); + + /** + * Return the Object Request Broker that has created this stream. + * @return the ORB. This must be overridden, as the default + * method always returns null. + */ + public ORB orb() + { + return null; + } + + /** + * Should write an integer to the output stream, but, + * following specification, it does not and + * must be overridden to get a functionality. + * + * @param n an integer to write. + * + * @throws NO_IMPLEMENT, always. + */ + public void write(int n) + { + throw new NO_IMPLEMENT(); + } + + /** + * Write CORBA Context. + */ + public abstract void write_Context(Context context, ContextList contexts); + + /** + * Write CORBA (not java) Object. + */ + public abstract void write_Object(org.omg.CORBA.Object x); + + /** + * Should write a principal to the output stream, but, + * following specification, it does not and + * must be overridden to get a functionality. + * + * @deprecated by CORBA 2.2 + * + * @param principal a Principal to write + * + * @throws NO_IMPLEMENT, always. + */ + public void write_Principal(Principal principal) + { + throw new NO_IMPLEMENT(); + } + + /** + * Write TypeCode. + */ + public abstract void write_TypeCode(TypeCode x); + + /** + * Write CORBA <code>Any</code>. + */ + public abstract void write_any(Any x); + + /** + * Write CORBA <code>boolean</code>. + */ + public abstract void write_boolean(boolean x); + + /** + * Write CORBA <code>booelan[]</code>. + */ + public abstract void write_boolean_array(boolean[] x, int ofs, int len); + + /** + * Write CORBA <code>char</code>. + */ + public abstract void write_char(char x); + + /** + * Write CORBA <code>char[]</code>. + */ + public abstract void write_char_array(char[] chars, int offset, int length); + + /** + * Write CORBA <code>double</code>. + */ + public abstract void write_double(double x); + + /** + * Write CORBA <code>double[]</code>. + */ + public abstract void write_double_array(double[] x, int ofs, int len); + + /** + * Should write a BigDecimal number, but, following specification, + * it does not and must be overridden to get a functionality. + * + * @param fixed a number to write + * @throws NO_IMPLEMENT, always. + */ + public void write_fixed(BigDecimal fixed) + { + throw new NO_IMPLEMENT(); + } + + /** + * Write CORBA <code>float</code>. + */ + public abstract void write_float(float x); + + /** + * Write CORBA <code>float[]</code>. + */ + public abstract void write_float_array(float[] x, int ofs, int len); + + /** + * Write CORBA <code>long</code> that is mapped into java <code>int</code>. + */ + public abstract void write_long(int x); + + /** + * Write CORBA <code>long[]</code>. + */ + public abstract void write_long_array(int[] x, int ofs, int len); + + /** + * Write CORBA <code>long long</code> that is mapped into + * java <code>long</code>. + */ + public abstract void write_longlong(long x); + + /** + * Write CORBA <code>long long []</code>. + */ + public abstract void write_longlong_array(long[] x, int ofs, int len); + + /** + * Write CORBA <code>octed</code> that is mapped into java <code>byte</code> + */ + public abstract void write_octet(byte x); + + /** + * Write CORBA <code>octet[]</code>. + */ + public abstract void write_octet_array(byte[] x, int ofs, int len); + + /** + * Write CORBA <code>short</code>. + */ + public abstract void write_short(short x); + + /** + * Write CORBA <code>short[]</code>. + */ + public abstract void write_short_array(short[] x, int ofs, int len); + + /** + * Write CORBA <code>string</code>. + */ + public abstract void write_string(String x); + + /** + * Write unsigned CORBA <code>long</code> that is mapped into + * java <code>int</code>. + */ + public abstract void write_ulong(int x); + + /** + * Write array of CORBA unsigned longs. + */ + public abstract void write_ulong_array(int[] x, int ofs, int len); + + /** + * Write unsigned CORBA <code>long long </code> that is mapped into + * java <code>long</code>. + */ + public abstract void write_ulonglong(long x); + + /** + * Write array of unsigned CORBA long-longs. + */ + public abstract void write_ulonglong_array(long[] x, int ofs, int len); + + /** + * Write unsigned CORBA <code>short</code> that is mapped into + * java <code>short</code>. + */ + public abstract void write_ushort(short x); + + /** + * Write array of unsigned CORBA shorts. + */ + public abstract void write_ushort_array(short[] x, int ofs, int len); + + /** + * Write CORBA <code>wchar</code> that is mapped into + * java <code>char</code>. + */ + public abstract void write_wchar(char x); + + /** + * Write array of CORBA wchars. + */ + public abstract void write_wchar_array(char[] chars, int offset, int length); + + /** + * Write CORBA <code>wstring</code> that is mapped into + * java <code>string</code>. + */ + public abstract void write_wstring(String x); +} diff --git a/org/omg/CORBA/portable/Streamable.java b/org/omg/CORBA/portable/Streamable.java new file mode 100644 index 000000000..86436e585 --- /dev/null +++ b/org/omg/CORBA/portable/Streamable.java @@ -0,0 +1,70 @@ +/* Streamable.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package org.omg.CORBA.portable; + +import org.omg.CORBA.TypeCode; + +/** + * The base class for the Holder classess of IDL types. + * + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public interface Streamable +{ + /** + * Fill in the value field for this holder by reading the required data + * from the given stream. + * + * @param input the input stream to read from. + */ + void _read(InputStream input); + + /** + * Returns the TypeCode, corresponding the CORBA type that is stored + * using this holder. + */ + TypeCode _type(); + + /** + * Write the value field to the given stream. + * + * @param output the output stream to write into. + */ + void _write(OutputStream output); +} diff --git a/testsuite/javax.swing.text.html.parser/AllParserTests.java b/testsuite/javax.swing.text.html.parser/AllParserTests.java new file mode 100644 index 000000000..8e9413a6d --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/AllParserTests.java @@ -0,0 +1,149 @@ +/* AllParserTests.java -- The comprehensive HTML parser test. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +import test.gnu.javax.swing.text.html.HTML_Test; +import test.gnu.javax.swing.text.html.parser.AttributeList_test; +import test.gnu.javax.swing.text.html.parser.DTD_test; +import test.gnu.javax.swing.text.html.parser.Element_Test; +import test.gnu.javax.swing.text.html.parser.Entity_Test; +import test.gnu.javax.swing.text.html.parser.HTML_parsing; +import test.gnu.javax.swing.text.html.parser.HTML_randomTable; +import test.gnu.javax.swing.text.html.parser.ParserEntityResolverTest; +import test.gnu.javax.swing.text.html.parser.TagElement_Test; +import test.gnu.javax.swing.text.html.parser.Text; +import test.gnu.javax.swing.text.html.parser.Token_locations; +import test.gnu.javax.swing.text.html.parser.parameterDefaulter_Test; +import test.gnu.javax.swing.text.html.parser.supplementaryNotifications; +import test.gnu.javax.swing.text.html.parser.textPreProcessor_Test; +import test.gnu.javax.swing.text.html.parser.low.Buffer_Test; +import test.gnu.javax.swing.text.html.parser.low.Constants_Test; +import test.gnu.javax.swing.text.html.parser.low.ReaderTokenizer_Test; + +/** + * This is a complete test for javax.swing.text.html.parser package. + * Apart javax.* classes, it also tests the implementation specific + * gnu.javax.* classes and in this way is more strict than + * Mauve tests. To avoid regression it is strongly recommended to run + * this test after you modify clases in javax.swing.text.html.parser or + * gnu.javax.swing.text.html.parser. + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class AllParserTests +{ + public static void main(String[] args) + { + try + { + HTML_Test a_HTML_Test = new HTML_Test(); + a_HTML_Test.testGetAttributeKey(); + a_HTML_Test.testGetIntegerAttributeValue(); + a_HTML_Test.testGetTag(); + a_HTML_Test.testCaseSensitivity(); + a_HTML_Test.testConstructor(); + + Buffer_Test a_Buffer_Test = new Buffer_Test(); + a_Buffer_Test.testDelete(); + a_Buffer_Test.testAppend(); + + Constants_Test a_Constants_Test = new Constants_Test(); + a_Constants_Test.testCases(); + + ReaderTokenizer_Test a_ReaderTokenizer_Test = + new ReaderTokenizer_Test(); + a_ReaderTokenizer_Test.testReadingAndAhead(); + a_ReaderTokenizer_Test.testComplexToken(); + + AttributeList_test a_AttributeList_test = new AttributeList_test(); + a_AttributeList_test.testSame(); + + DTD_test a_DTD_test = new DTD_test(); + a_DTD_test.testGetElement(); + + Element_Test a_Element_Test = new Element_Test(); + a_Element_Test.testName2type(); + a_Element_Test.testAttributeGetter(); + + Entity_Test a_Entity_Test = new Entity_Test(); + a_Entity_Test.testName2type(); + a_Entity_Test.testPublicSystemGeneralParameter(); + + HTML_parsing a_HTML_parsing = new HTML_parsing(); + a_HTML_parsing.testHTMLParsing(); + + HTML_randomTable a_HTML_randomTable = new HTML_randomTable(); + a_HTML_randomTable.testTableParsing(); + + parameterDefaulter_Test a_parameterDefaulter_Test = + new parameterDefaulter_Test(); + a_parameterDefaulter_Test.testDefaultValues(); + + ParserEntityResolverTest a_ParserEntityResolverTest = + new ParserEntityResolverTest(); + a_ParserEntityResolverTest.testResolver(); + + supplementaryNotifications a_supplementaryNotifications = + new supplementaryNotifications(); + a_supplementaryNotifications.testHTMLParsing(); + + TagElement_Test a_TagElement_Test = new TagElement_Test(); + a_TagElement_Test.testTagElement(); + + textPreProcessor_Test a_textPreProcessor_Test = + new textPreProcessor_Test(); + a_textPreProcessor_Test.testStandardPreProcessing(); + a_textPreProcessor_Test.testPreFormattedPreProcessing(); + + Text a_Text = new Text(); + a_Text.testTextParsing(); + + Token_locations a_Token_locations = new Token_locations(); + a_Token_locations.testHTMLParsing(); + } + catch (Exception ex) + { + System.err.println("The tests have FAILED.\nPlease either correct your " + + "changes\nor, if you are absolutely sure, correct the tests.\n" + + "See the following exception for details" + ); + ex.printStackTrace(System.err); + System.exit(1); + } + System.out.println("HTML parser tests have passed."); + System.exit(0); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/HTML_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/HTML_Test.java new file mode 100644 index 000000000..7a0220c05 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/HTML_Test.java @@ -0,0 +1,130 @@ +/* HTML_Test.java -- HTML parser test. + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html; + +import test.gnu.javax.swing.text.html.parser.TestCase; + +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.html.HTML; + +public class HTML_Test + extends TestCase +{ + /** + * By the language definition, HTML tags and attributes are case + * insensitive. Hence if it is not clearly specified, in which case + * the tag name must be, it should be expected to come as in + * lowercase, as in uppercase. This should be true for HTML.getTag(String) + * and for HTML.getAttributeKey(String). + * + * In some implementations these two functions may be case sensitive. + * As this requirement is not mentioned in the documentation, + * and also it is not documented, in which case the name must be supplied, + * this will be reported as an error in this test. + * The GNU CLASSPATH implementation is case insensitive. + */ + public void testCaseSensitivity() + { + String def = "case sensitivity"; + assertEquals("html=Html", HTML.getTag("html"), HTML.getTag("HtmL")); + assertEquals("html=HTML", HTML.getTag("html"), HTML.getTag("HTML")); + assertEquals("size=SIZE", HTML.getAttributeKey("size"), + HTML.getAttributeKey("SIZE") + ); + assertEquals("size=SizE", HTML.getAttributeKey("size"), + HTML.getAttributeKey("SizE") + ); + } + + public void testConstructor() + { + new HTML(); + } + + public void testGetAttributeKey() + { + // Test the known tags. + String[] mine = toStrings(HTML.getAllAttributeKeys()); + + for (int i = 0; i < mine.length; i++) + assertNotNull(mine [ i ], HTML.getAttributeKey(mine [ i ])); + + // Test the unknown tag. + assertNull("surely unknown", HTML.getTag("audrius")); + } + + public void testGetIntegerAttributeValue() + { + SimpleAttributeSet ase = new SimpleAttributeSet(); + ase.addAttribute(HTML.getAttributeKey("size"), "222"); + assertEquals(222, + HTML.getIntegerAttributeValue(ase, + HTML.getAttributeKey("size"), 333 + ) + ); + + assertEquals(333, + HTML.getIntegerAttributeValue(ase, + HTML.getAttributeKey("href"), 333 + ) + ); + } + + public void testGetTag() + { + // known tags: + String[] mine = toStrings(HTML.getAllTags()); + + for (int i = 0; i < mine.length; i++) + assertNotNull(mine [ i ], HTML.getTag(mine [ i ])); + + // unknown tag + assertNull("surely unknown", HTML.getTag("audrius")); + } + + private String[] toStrings(Object[] objs) + { + String[] a = new String[ objs.length ]; + + for (int i = 0; i < a.length; i++) + a [ i ] = objs [ i ].toString(); + + return a; + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/AttributeList_test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/AttributeList_test.java new file mode 100644 index 000000000..02d174dba --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/AttributeList_test.java @@ -0,0 +1,68 @@ +/* AttributeList_test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.html.parser.AttributeList; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class AttributeList_test + extends TestCase +{ + private AttributeList attributeList = null; + + public void testSame() + { + for (int i = 0; i < 100; i++) + { + String t = AttributeList.type2name(i); + if (t != null) + assertEquals(i, AttributeList.name2type(t)); + } + } + + protected void setUp() + throws Exception + { + super.setUp(); + attributeList = new AttributeList("ku"); + assertEquals(attributeList.toString(), "ku"); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/DTD_test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/DTD_test.java new file mode 100644 index 000000000..d539fff75 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/DTD_test.java @@ -0,0 +1,102 @@ +/* DTD_test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.html.HTML; +import javax.swing.text.html.parser.DTD; +import javax.swing.text.html.parser.Element; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class DTD_test + extends TestCase +{ + static class D + extends DTD + { + public D() + { + super("audrius"); + } + + public Element createElement(String n) + { + return getElement(n); + } + } + + public void testGetElement() + { + D d = new D(); + HTML.Tag[] tags = HTML.getAllTags(); + + Element prehead = d.createElement("head"); + + for (int i = 0; i < tags.length; i++) + { + Element e = d.createElement(tags [ i ].toString()); + String name = tags [ i ].toString(); + assertNotNull("Element creation", e); + assertTrue("Element name", e.getName().equalsIgnoreCase(name)); + } + + // Test upper/lowercase + Element e = d.createElement("head"); + + assertNotNull("Element creation", e); + assertTrue("Element name", e.getName().equalsIgnoreCase("head")); + assertEquals(HTML.Tag.HEAD, HTML.getTag(e.name)); + assertEquals("Field assignment", d.head, e); + + assertEquals(prehead, e); + } + + protected void setUp() + throws Exception + { + super.setUp(); + } + + protected void tearDown() + throws Exception + { + super.tearDown(); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Element_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Element_Test.java new file mode 100644 index 000000000..355d9384e --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Element_Test.java @@ -0,0 +1,117 @@ +/* Element_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.html.parser.AttributeList; +import javax.swing.text.html.parser.DTD; +import javax.swing.text.html.parser.DTDConstants; +import javax.swing.text.html.parser.Element; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Element_Test + extends TestCase +{ + private Element element = null; + + public void testAttributeGetter() + throws Exception + { + // Create a chain of 24 attributes: + AttributeList list = new AttributeList("heading"); + AttributeList head = list; + list.value = null; + for (int i = 0; i < 24; i++) + { + AttributeList a = new AttributeList("a" + i); + a.value = "v" + i; + list.next = a; + list = a; + } + + Element e = DTD.getDTD("test").getElement("e"); + e.atts = head; + + for (int i = 0; i < 24; i++) + { + // Check if the name is found. + assertEquals(e.getAttribute("a" + i).toString(), "a" + i); + + // Check if the attribute value is correct. + assertEquals(e.getAttribute("a" + i).value, "v" + i); + + // Check if the attribute can be found by value. + assertEquals(e.getAttributeByValue("v" + i).name, "a" + i); + } + + // Check is the null value is searched correctly. + assertEquals(e.getAttributeByValue(null).toString(), "heading"); + + // Check for unknown attribute + assertEquals(e.getAttribute("audrius"), null); + + // Check for unknown value + assertEquals(e.getAttributeByValue("audrius"), null); + } + + public void testName2type() + { + assertEquals(Element.name2type("CDATA"), DTDConstants.CDATA); + assertEquals(Element.name2type("RCDATA"), DTDConstants.RCDATA); + assertEquals(Element.name2type("EMPTY"), DTDConstants.EMPTY); + assertEquals(Element.name2type("ANY"), DTDConstants.ANY); + + assertEquals(Element.name2type("audrius"), 0); + assertEquals(Element.name2type("rcdata"), 0); + } + + protected void setUp() + throws Exception + { + super.setUp(); + } + + protected void tearDown() + throws Exception + { + element = null; + super.tearDown(); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Entity_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Entity_Test.java new file mode 100644 index 000000000..ff1dc118d --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Entity_Test.java @@ -0,0 +1,119 @@ +/* Entity_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.html.parser.DTDConstants; +import javax.swing.text.html.parser.Element; +import javax.swing.text.html.parser.Entity; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Entity_Test + extends TestCase +{ + private Element element = null; + + public void testName2type() + { + assertEquals("PUBLIC", Entity.name2type("PUBLIC"), DTDConstants.PUBLIC); + assertEquals("SDATA", Entity.name2type("SDATA"), DTDConstants.SDATA); + assertEquals("PI", Entity.name2type("PI"), DTDConstants.PI); + assertEquals("STARTTAG", Entity.name2type("STARTTAG"), DTDConstants.STARTTAG); + assertEquals("ENDTAG", Entity.name2type("ENDTAG"), DTDConstants.ENDTAG); + assertEquals("MS", Entity.name2type("MS"), DTDConstants.MS); + assertEquals("MD", Entity.name2type("MD"), DTDConstants.MD); + assertEquals("SYSTEM", Entity.name2type("SYSTEM"), DTDConstants.SYSTEM); + + assertEquals("surely unknown ", Entity.name2type("audrius"), + DTDConstants.CDATA + ); + } + + public void testPublicSystemGeneralParameter() + { + int[] pu_sy = new int[] { DTDConstants.PUBLIC, DTDConstants.SYSTEM, 0 }; + + int[] gen_par = + new int[] { DTDConstants.GENERAL, DTDConstants.PARAMETER, 0 }; + + for (int ps = 0; ps < pu_sy.length; ps++) + { + for (int gp = 0; gp < gen_par.length; gp++) + { + Entity e = new Entity(null, 0, null); + e.type = pu_sy [ ps ] | gen_par [ gp ]; + + assertEquals(e.isGeneral(), gen_par [ gp ] == DTDConstants.GENERAL); + assertEquals(e.isParameter(), + gen_par [ gp ] == DTDConstants.PARAMETER + ); + + assertEquals((e.type & DTDConstants.SYSTEM) != 0, + pu_sy [ ps ] == DTDConstants.SYSTEM + ); + + assertEquals((e.type & DTDConstants.PUBLIC) != 0, + pu_sy [ ps ] == DTDConstants.PUBLIC + ); + + assertEquals((e.type & DTDConstants.GENERAL) != 0, + gen_par [ gp ] == DTDConstants.GENERAL + ); + + assertEquals((e.type & DTDConstants.PARAMETER) != 0, + gen_par [ gp ] == DTDConstants.PARAMETER + ); + } + } + } + + protected void setUp() + throws Exception + { + super.setUp(); + } + + protected void tearDown() + throws Exception + { + element = null; + super.tearDown(); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_parsing.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_parsing.java new file mode 100644 index 000000000..6f81c23ee --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_parsing.java @@ -0,0 +1,281 @@ +/* HTML_parsing.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class HTML_parsing + extends TestCase +{ + /** + * This is used for profiling. + */ + public static void main(String[] args) + { + long t = System.currentTimeMillis(); + try + { + HTML_parsing p = new HTML_parsing(); + for (int i = 0; i < 2000; i++) + { + p.testHTMLParsing(); + if (i % 10 == 0) + System.out.print('.'); + } + } + catch (Exception ex) + { + } + System.out.println("TIME " + (System.currentTimeMillis() - t)); + } + + public void testHTMLParsing() + throws Exception + { + Parser_Test v = new Parser_Test(); + v.hideImplied = false; + + // Test subsequent tags. + v.verify("<b><i><u>text</b><i></u>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><b><i><u>'text'</b><i></u></i></i></body></html>" + ); + + // Test entities. + v.verify("hex: U eqdec: = ampnamed: &", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'hex: U eqdec: = ampnamed: &'</body></html>" + ); + + // Test comments. + v.verify("<html><head></head><body><!--a-->< !--b--><! --c--><!-- d--><!--e --><!--f-- ><!--g--><!---h---><!-- i --><!--- j ---><!-- -- --> <b> <!---------->", + "<html><head></head><body>{a}{b}{c}{ d}{e }{f}{g}{-h-}{ i }{- j -}{ -- }<b>{------}</b></body></html>" + ); + + // Test unclosed tags. + v.verify("<hr id = 1 class = c<hr id=2>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr class='c' id='1'/><hr id='2'/></body></html>" + ); + + // Test errors and unclosed tags. + v.verify("<b#r><hr id = 1 # class = c<hr id=2>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><b><hr id='1'/>'# class = c'<hr id='2'/></b></body></html>" + ); + + // Test script. + v.verify("<hr id=1><script a=b c=d><hr id=1></script><hr id=1>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr id='1'/><script a='b' c='d'>'<hr id=1>'</script><hr id='1'/></body></html>" + ); + + // Test valid attributes. + v.verify("<hr id='i' title=\"tit\" class=cl><hr><hr id = 2>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr class='cl' id='i' title='tit'/><hr/><hr id='2'/></body></html>" + ); + + // Test unknown attribute without value. + v.verify("<hr audrius title=\"tit\">", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr audrius='#DEFAULT' title='tit'/></body></html>" + ); + + // Test known attributes witout value. + v.verify("<option id=a selected><option id=b selected = selected class=cC><input checked>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><option id='a' selected='selected'></option></body><body _implied_='true'><option class='cC' id='b' selected='selected'></option><input checked='checked'/></body></html>" + ); + + // Test table content model. + v.verify("<table>a</table>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr _implied_='true'><td _implied_='true'>'a'</td></tr></tbody></table></body></html>" + ); + + // Test table content model. + v.verify("<table><caption>cap</caption>a</table>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><caption>'cap'</caption><tbody _implied_='true'><tr _implied_='true'><td _implied_='true'>'a'</td></tr></tbody></table></body></html>" + ); + + // Test typical table. + v.verify("<table><tr><td>x</td><td>y</td><td>z</td></table>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'x'</td><td>'y'</td><td>'z'</td></tr></tbody></table></body></html>" + ); + + // Test nested table. + v.verify("<table><tr><td><table>nested</table>x</td><td>y</td><td>z</td></table>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td><table><tbody _implied_='true'><tr _implied_='true'><td _implied_='true'>'nested'</td></tr></tbody></table>'x'</td><td>'y'</td><td>'z'</td></tr></tbody></table></body></html>" + ); + + // Test simple nested list. + v.verify("<ul><li>a</li><ul><li>na</li><li>nb</li></ul><li>b</li></ul>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'</li><ul><li>'na'</li><li>'nb'</li></ul><li>'b'</li></ul></body></html>" + ); + + // Test simple non-nested list. + v.verify("<ul><li>a</li><li>na</li><li>nb</li><li>b</li></ul>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'</li><li>'na'</li><li>'nb'</li><li>'b'</li></ul></body></html>" + ); + + // Test list without closing tags (obsolete list form). + v.verify("<ul><li>a<li>na<li>nb<li>b</ul>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'</li><li>'na'</li><li>'nb'</li><li>'b'</li></ul></body></html>" + ); + + // Test list without closing tags (obsolete list form). + v.verify("<ul><li>a<ul><li>na<li>nb</ul><li>b</ul>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><ul><li>'a'<ul><li>'na'</li><li>'nb'</li></ul></li><li>'b'</li></ul></body></html>" + ); + + // Test Obsolete table. + v.verify("<table><tr><td>a<td>b<td>c</tr>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'a'</td><td>'b'</td><td>'c'</td></tr></tbody></table></body></html>" + ); + + // Test html no head no body. + v.verify("<html>text</html>", + "<html><head _implied_='true'></head><body _implied_='true'>'text'</body></html>" + ); + + // Test head only. + v.verify("<head></head>text", + "<html _implied_='true'><head></head><body _implied_='true'>'text'</body></html>" + ); + + // Test head and body. + v.verify("<head><title>ti</title></head><body>text", + "<html _implied_='true'><head><title>'ti'</title></head><body>'text'</body></html>" + ); + + // Test title and text. + v.verify("<title>title</title>text", + "<html _implied_='true'><head _implied_='true'><title>'title'</title></head><body _implied_='true'>'text'</body></html>" + ); + + // Test html only. + v.verify("<html>text</html>", + "<html><head _implied_='true'></head><body _implied_='true'>'text'</body></html>" + ); + + // Test body only. + v.verify("<body>text</body>", + "<html _implied_='true'><head _implied_='true'></head><body>'text'</body></html>" + ); + + // Test head only. + v.verify("<head></head>text", + "<html _implied_='true'><head></head><body _implied_='true'>'text'</body></html>" + ); + + // Test obsolete table. + v.verify("<table><tr><td>a</td><tr><td>a</td>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'a'</td></tr><tr><td>'a'</td></tr></tbody></table></body></html>" + ); + + // Test obsolete table. + v.verify("<table><tr><td>a<td>b<tr><td>a<td>b<td>c", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><tbody _implied_='true'><tr><td>'a'</td><td>'b'</td></tr><tr><td>'a'</td><td>'b'</td><td>'c'</td></tr></tbody></table></body></html>" + ); + + // Test style. + v.verify("<html><head><style><hr id=2></style></head><hr id = b>", + "<html><head><style>'<hr id=2>'</style></head><body _implied_='true'><hr id='b'/></body></html>" + ); + + // Test style. + v.verify("<style><hr id=2></style>x", + "<html _implied_='true'><head _implied_='true'><style>'<hr id=2>'</style></head><body _implied_='true'>'x'</body></html>" + ); + + // Test entities in attributes. + v.verify("<hr id='id_AZ' class= \"Y_&\" >", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><hr class='Y_&' id='id_AZ'/></body></html>" + ); + + // Test colgroup. + v.verify("<table><COLGROUP width=\"25\"><COL span=\"45\"><COL id=\"identifier\"></COLGROUP><td>a<td>b<tr>x", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><table><colgroup width='25'><col span='45'/><col id='identifier'/></colgroup><tbody _implied_='true'><tr _implied_='true'><td>'a'</td><td>'b'</td></tr><tr><td _implied_='true'>'x'</td></tr></tbody></table></body></html>" + ); + + // Test definition list, obsolete. + v.verify("<dl><dt>ha<dd>a<dt>hb<dd>b", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><dl><dt>'ha'</dt><dd>'a'</dd><dt>'hb'</dt><dd>'b'</dd></dl></body></html>" + ); + + // Test definition list. + v.verify("<html><head></head><body><dl><dt>'ha'</dt><dd>'a'</dd><dt>'hb'</dt><dd>'b'</dd></dl></body></html>", + "<html><head></head><body><dl><dt>''ha''</dt><dd>''a''</dd><dt>''hb''</dt><dd>''b''</dd></dl></body></html>" + ); + + // Test paragraphs. + v.verify("<p>b<p>c<p>d", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><p>'b'</p><p>'c'</p><p>'d'</p></body></html>" + ); + + // Test paragraphs. + v.verify("<p>'b'</p><p>'c'</p><p>'d'</p>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><p>''b''</p><p>''c''</p><p>''d''</p></body></html>" + ); + + // Test select obsolete. + v.verify("<form><select><option value='hi' disabled>a<option selected>b<option>normal", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><form><select><option disabled='disabled' value='hi'>'a'</option><option selected='selected'>'b'</option><option>'normal'</option></select></form></body></html>" + ); + + // Test select current. + v.verify("<form><select><option>'a'</option><option SELECTED='selected'>'b'</option></select></form>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><form><select><option>''a''</option><option selected='selected'>''b''</option></select></form></body></html>" + ); + + // Test select current. + v.verify("<form><select><option>after<optgroup><option>'a'</option><option SELECTED='selected'>'b'</option></optgroup></select></form>", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'><form><select><option>'after'</option><optgroup><option>''a''</option><option selected='selected'>''b''</option></optgroup></select></form></body></html>" + ); + + // Test << antihang. + v.verify("<<i>text", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'<'<i>'text'</i></body></html>" + ); + + // Test << antihang with spaces. + v.verify(" < < i>text", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'<'<i>'text'</i></body></html>" + ); + + // Test Standalone <. + v.verify("Text <wrong tag is it! <b> text ", + "<html _implied_='true'><head _implied_='true'></head><body _implied_='true'>'Text''<wrong tag is it!'<b>'text'</b></body></html>" + ); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_randomTable.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_randomTable.java new file mode 100644 index 000000000..ee3db8951 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/HTML_randomTable.java @@ -0,0 +1,155 @@ +/* HTML_randomTable.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import java.util.Random; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class HTML_randomTable + extends TestCase +{ + class table + { + final String[][] rows; + final boolean caption = r.nextBoolean(); + + table() + { + int nrows = r.nextInt(5) + 1; + rows = new String[ nrows ][]; + for (int i = 0; i < rows.length; i++) + { + int ncol = r.nextInt(5) + 1; + rows [ i ] = new String[ ncol ]; + for (int j = 0; j < rows [ i ].length; j++) + { + rows [ i ] [ j ] = "C_" + i + "_" + j; + } + } + } + + public String getHtml() + { + StringBuffer b = new StringBuffer("<html><head></head><body><table>"); + if (caption) + b.append("<caption>capt</caption>"); + if (r.nextBoolean()) + b.append("<" + s() + "tbody" + s() + ">"); + for (int row = 0; row < rows.length; row++) + { + b.append("<" + s() + "tr" + s() + ">"); + for (int col = 0; col < rows [ row ].length; col++) + { + b.append("<" + s() + "td" + s() + ">"); + b.append(rows [ row ] [ col ]); + if (r.nextBoolean()) + b.append("<" + s() + "/" + "td" + s() + ">"); + } + if (r.nextBoolean()) + b.append("<" + s() + "/" + "tr" + s() + ">"); + } + b.append("</tbody></table></body></html>"); + return b.toString(); + } + + public String getTrace() + { + StringBuffer b = new StringBuffer("<html><head></head><body><table>"); + if (caption) + b.append("<caption>'capt'</caption>"); + b.append("<tbody>"); + for (int row = 0; row < rows.length; row++) + { + b.append("<tr>"); + for (int col = 0; col < rows [ row ].length; col++) + { + b.append("<td>'" + rows [ row ] [ col ] + "'</td>"); + } + b.append("</tr>"); + } + b.append("</tbody></table></body></html>"); + return b.toString(); + } + + void test() + throws Exception + { + String trace = getTrace(); + String html = getHtml(); + v.verify(html, trace); + } + } + + Parser_Test v = new Parser_Test(); + Random r = new Random(); + + public HTML_randomTable() + throws Exception + { + } + + public String s() + { + if (r.nextBoolean()) + return ""; + + StringBuffer b = new StringBuffer(); + int spc = r.nextInt(4); + for (int i = 0; i < spc; i++) + { + b.append(' '); + } + return b.toString(); + } + + /** + * Try 1001 variable randomly generated table. + */ + public void testTableParsing() + throws Exception + { + v.hideImplied = true; + for (int i = 0; i < 1001; i++) + { + new table().test(); + } + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserEntityResolverTest.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserEntityResolverTest.java new file mode 100644 index 000000000..1ce8a1afd --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserEntityResolverTest.java @@ -0,0 +1,99 @@ +/* ParserEntityResolverTest.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.HTML_401F; +import gnu.javax.swing.text.html.parser.support.Parser; + +import java.lang.reflect.Method; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class ParserEntityResolverTest + extends TestCase +{ + /* Testing private methods of entity resolver. */ + public void testResolver() + throws Exception + { + Parser p = + new Parser(HTML_401F.getInstance()) + { + public void error(String a, String b) + { + } + }; + + Method rn = + p.getClass().getSuperclass().getDeclaredMethod("resolveNamedEntity", + new Class[] { String.class } + ); + rn.setAccessible(true); + + assertEquals(exe(p, rn, "&"), "&"); + assertEquals(exe(p, rn, "&"), "&"); + assertEquals(exe(p, rn, "&"), "&"); + assertEquals(exe(p, rn, "&amP"), "&"); + + assertEquals(exe(p, rn, "&;"), "&;"); + assertEquals(exe(p, rn, "&audrius;"), "&audrius;"); + + rn = + p.getClass().getSuperclass().getDeclaredMethod("resolveNumericEntity", + new Class[] { String.class } + ); + rn.setAccessible(true); + + assertEquals(exe(p, rn, "U"), "U"); + assertEquals(exe(p, rn, "U"), "U"); + assertEquals(exe(p, rn, "="), "="); + assertEquals(exe(p, rn, "="), "="); + + assertEquals(exe(p, rn, "&#audrius"), "?"); + } + + private String exe(Parser p, Method m, String arg) + throws Exception + { + Object[] o = new Object[ 1 ]; + o [ 0 ] = arg; + return m.invoke(p, o).toString(); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserTest.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserTest.java new file mode 100644 index 000000000..6b9146383 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/ParserTest.java @@ -0,0 +1,150 @@ +/* ParserTest.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.support.Parser; + +import java.io.PrintStream; + +import java.util.Enumeration; + +import javax.swing.text.AttributeSet; +import javax.swing.text.html.parser.Element; +import javax.swing.text.html.parser.TagElement; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class ParserTest + extends gnu.javax.swing.text.html.parser.support.Parser +{ + PrintStream out = System.out; + StringBuffer errors = new StringBuffer(); + + public ParserTest() + { + super(gnu.javax.swing.text.html.parser.HTML_401F.getInstance()); + } + + public static void main(String[] args) + { + String sx; + sx = + "<html><head></head><body><table>< tbody><tr >< td >C_0_0< td>C_0_1< td >C_0_2< /td >< td >C_0_3<td>C_0_4< /td></tr ></tbody></table></body></html>"; + try + { + System.out.println(sx); + + ParserTest t = new ParserTest(); + t.parse(new java.io.StringReader(sx)); + System.out.println("\nErrors:"); + System.out.println(t.errors); + } + catch (Exception ex) + { + ex.printStackTrace(); + } + } + + protected void handleComment(char[] parm1) + { + out.print("{" + new String(parm1) + "}"); + } + + protected void handleEOFInComment() + { + out.print(" [EOF in comment] "); + } + + protected void handleEmptyTag(TagElement tag) + throws javax.swing.text.ChangedCharSetException + { + out.print("<" + tag); + + javax.swing.text.AttributeSet atts = getAttributes(); + dumpAttributes(atts); + out.print("/>"); + } + + protected void handleEndTag(TagElement tag) + { + out.print("</" + tag + "> "); + } + + protected void handleError(int line, String message) + { + errors.append(message); + errors.append('\n'); + } + + protected void handleStartTag(TagElement tag) + { + out.print("<" + tag); + + javax.swing.text.AttributeSet atts = getAttributes(); + dumpAttributes(atts); + out.print('>'); + } + + protected void handleText(char[] parm1) + { + out.print("'" + new String(parm1) + "'"); + } + + protected void handleTitle(char[] parm1) + { + out.print(" [ Title: " + new String(parm1) + "] "); + } + + protected void markFirstTime(Element element) + { + out.print("(1:" + element + ")"); + } + + private void dumpAttributes(AttributeSet atts) + { + Enumeration enum = atts.getAttributeNames(); + while (enum.hasMoreElements()) + { + String a = enum.nextElement().toString(); + String v = (String) atts.getAttribute(a); + out.print(" " + a + "='" + v + "'"); + } + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Parser_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Parser_Test.java new file mode 100644 index 000000000..b15185760 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Parser_Test.java @@ -0,0 +1,162 @@ +/* Parser_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + + +package test.gnu.javax.swing.text.html.parser; + +import java.io.StringReader; + +import java.util.Enumeration; +import java.util.Iterator; +import java.util.TreeSet; + +import javax.swing.text.AttributeSet; +import javax.swing.text.MutableAttributeSet; +import javax.swing.text.SimpleAttributeSet; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTMLEditorKit; +import javax.swing.text.html.HTMLEditorKit.ParserCallback; +import javax.swing.text.html.parser.ParserDelegator; +import javax.swing.text.html.parser.TagElement; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Parser_Test + extends HTMLEditorKit.ParserCallback +{ + public boolean hideImplied = true; + protected StringBuffer out = new StringBuffer(); + AttributeSet atts = new SimpleAttributeSet(); + + public void generate(String x, String comment) + throws Exception + { + String prolog = "<html><head></head><body>"; + String epilog = "</body></html>"; + String html = x; // prolog+x+epilog; + System.out.println("// Test " + comment + "."); + System.out.println("v.verify(\"" + html + "\",\n \"" + verify(html, null) + + "\");" + ); + } + + public void handleComment(char[] parm1, int position) + { + out.append("{" + new String(parm1) + "}"); + } + + public void handleEndTag(HTML.Tag tag, int position) + { + out.append("</" + tag + ">"); + } + + public void handleSimpleTag(HTML.Tag tag, MutableAttributeSet attributes, + int position + ) + { + if (tag.toString().equals("#pcdata")) + return; + out.append("<" + tag); + dumpAttributes(attributes); + out.append("/>"); + } + + public void handleStartTag(HTML.Tag tag, MutableAttributeSet attributes, + int position + ) + { + out.append("<" + tag); + dumpAttributes(attributes); + out.append('>'); + } + + public void handleText(char[] chars, int position) + { + out.append("'" + new String(chars) + "'"); + } + + public String verify(String html, String trace) + throws Exception + { + out.setLength(0); + + HTMLEditorKit.ParserCallback callback = this; + ParserDelegator delegator = new ParserDelegator(); + delegator.parse(new StringReader(html), callback, true); + + String ou = out.toString(); + if (trace != null) + { + if (!ou.equals(trace)) + { + System.err.println("Unable to parse '" + html + "':"); + System.err.println(" expected: '" + trace + "',"); + System.out.println(" returned: '" + ou + "'."); + throw new Exception("'" + html + "' -> '" + ou + "' expected '" + + trace + "'" + ); + } + } + return ou; + } + + protected void dumpAttributes(AttributeSet atts) + { + Enumeration enum = atts.getAttributeNames(); + + // Sort them to ensure the same order every time: + TreeSet t = new TreeSet(); + while (enum.hasMoreElements()) + t.add(enum.nextElement().toString()); + + Iterator iter = t.iterator(); + + while (iter.hasNext()) + { + String a = iter.next().toString(); + + if (hideImplied) + if (a.equals("_implied_")) + continue; + + String v = atts.getAttribute(a).toString(); + out.append(" " + a + "='" + v + "'"); + } + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TagElement_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TagElement_Test.java new file mode 100644 index 000000000..dcf2edd42 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TagElement_Test.java @@ -0,0 +1,87 @@ +/* TagElement_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.html.HTML; +import javax.swing.text.html.parser.DTD; +import javax.swing.text.html.parser.Element; +import javax.swing.text.html.parser.TagElement; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TagElement_Test + extends TestCase +{ + public void testTagElement() + throws Exception + { + HTML.Tag[] tags = HTML.getAllTags(); + + for (int i = 0; i < tags.length; i++) + { + HTML.Tag t = tags [ i ]; + String tn = t.toString(); + Element e = DTD.getDTD("test").getElement("e"); + e.name = tn; + + TagElement te = new TagElement(e, true); + assertTrue(" must be fictional", te.fictional()); + + te = new TagElement(e); + assertFalse("must be non fictional", te.fictional()); + + assertEquals(te.getHTMLTag().toString(), t.toString()); + assertEquals(t.breaksFlow(), te.breaksFlow()); + assertEquals(t.isPreformatted(), te.isPreformatted()); + } + } + + protected void setUp() + throws Exception + { + super.setUp(); + } + + protected void tearDown() + throws Exception + { + super.tearDown(); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TestCase.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TestCase.java new file mode 100644 index 000000000..c0ce61413 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/TestCase.java @@ -0,0 +1,138 @@ +/* TestCase.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class TestCase +{ + public TestCase() + { + try + { + setUp(); + } + catch (Exception ex) + { + throw new RuntimeException(ex); + } + } + + public void assertEquals(String msg, Object a, Object b) + { + if (a == b) + return; + if (!a.equals(b)) + throw new RuntimeException(msg); + } + + public void assertEquals(Object a, Object b) + { + if (a == b) + return; + if (!a.equals(b)) + throw new RuntimeException("Objects must be equal"); + } + + public void assertEquals(int a, int b) + { + if (a != b) + throw new RuntimeException(a + "!=" + b); + } + + public void assertEquals(String msg, int a, int b) + { + if (a != b) + throw new RuntimeException(msg + ":" + a + "!=" + b); + } + + public void assertEquals(boolean a, boolean b) + { + if (a != b) + throw new RuntimeException(a + "!=" + b); + } + + public void assertFalse(String msg, boolean a) + { + if (a) + throw new RuntimeException(msg); + } + + public void assertFalse(boolean a) + { + if (a) + throw new RuntimeException("Must be false"); + } + + public void assertNotNull(String msg, Object a) + { + if (a == null) + throw new RuntimeException(msg); + } + + public void assertNull(String msg, Object a) + { + if (a != null) + throw new RuntimeException(msg); + } + + public void assertTrue(String msg, boolean a) + { + if (!a) + throw new RuntimeException(msg); + } + + public void assertTrue(boolean a) + { + if (!a) + throw new RuntimeException("Must be true"); + } + + protected void setUp() + throws Exception + { + } + + protected void tearDown() + throws Exception + { + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Text.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Text.java new file mode 100644 index 000000000..e7d08bd14 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Text.java @@ -0,0 +1,155 @@ +/* Text.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.MutableAttributeSet; +import javax.swing.text.html.HTML; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Text + extends TestCase +{ + public void testTextParsing() + throws Exception + { + Parser_Test v = + new Parser_Test() + { + public void handleSimpleTag(HTML.Tag tag, + MutableAttributeSet attributes, int position + ) + { + if (!tag.toString().equalsIgnoreCase("#pcdata")) + out.append("<" + tag + ">"); + } + + public void handleStartTag(HTML.Tag tag, + MutableAttributeSet attributes, int position + ) + { + out.append("<" + tag + ">"); + } + + public void handleText(char[] chars, int position) + { + for (int i = 0; i < chars.length; i++) + { + out.append(Integer.toHexString(chars [ i ])); + if (chars [ i ] > ' ') + out.append("'" + chars [ i ]); + out.append(" "); + } + } + + public void handleEndTag(HTML.Tag tag, int position) + { + out.append("</" + tag + ">"); + } + }; + + v.hideImplied = true; + + // NON - preformatted mode: + // Everything mutates into spaces, multiple spaces mustates + // into single one, all whitespace around tags is consumed. + v.verify("\r \n \t {abc r\rn\nt}\t \r\n \r \t", + "<html><head></head><body>7b'{ 61'a 62'b 63'c 20 72'r 20" + + " 6e'n 20 74't 7d'} </body></html>" + ); + + v.verify(" abba ", + "<html><head></head><body>61'a 62'b 62'b 61'a </body></html>" + ); + + v.verify(" \r ab \t \r \n ba ", + "<html><head></head><body>61'a 62'b 20 62'b 61'a </body></html>" + ); + + // Preformatted mode (in PRE tag): + // Heading/closing spaces and tabs preserve. ONE \r, \n or \r\n is removed. + // /r mutates into \n + v.verify("<pre>\n\n\n\n abba \r\t \r\n</pre>", + "<html><head></head><body><pre>a a a 20 20 20 61'a 62'b 62'b" + + " 61'a 20 20 20 a 9 20 </pre></body></html>" + ); + + v.verify("<pre> abba </pre>", + "<html><head></head><body><pre>20 20 20 61'a 62'b 62'b 61'a 20 " + + "20 20 </pre></body></html>" + ); + + v.verify("<pre>\r\n abba </pre>", + "<html><head></head><body><pre>20 20 20 61'a 62'b 62'b 61'a 20 " + + "20 20 </pre></body></html>" + ); + + v.verify("<pre>\r\n\r\n abba \r\n</pre>", + "<html><head></head><body><pre>a 20 20 20 61'a 62'b 62'b 61'a 20 20" + + " 20 </pre></body></html>" + ); + + v.verify("<pre> \r ab \t \r \n ba </pre>", + "<html><head></head><body><pre>20 a 20 61'a 62'b 20 20 9 20 a" + + " 20 a 20 20 62'b 61'a 20 20 20 </pre></body></html>" + ); + + v.verify("<pre> \r\n ab \t \r\n \n ba </pre>", + "<html><head></head><body><pre>20 a 20 61'a 62'b 20 20 9 20 a" + + " 20 a 20 20 62'b 61'a 20 20 20 </pre></body></html>" + ); + + // In TEXTAREA tag, same. + v.verify("<textarea>\n\n\n\n abba \r\n</textarea>", + "<html><head></head><body><textarea>a a a 20 20 20 61'a " + + "62'b 62'b 61'a 20 </textarea></body></html>" + ); + + v.verify("<textarea> abba </textarea>", + "<html><head></head><body><textarea>20 20 20 61'a 62'b 62'b 61'a 20 " + + "20 20 </textarea></body></html>" + ); + + v.verify("<textarea> \r ab \t \r \n ba </textarea>", + "<html><head></head><body><textarea>20 a 20 61'a 62'b 20 20 9 20 a" + + " 20 a 20 20 62'b 61'a 20 20 20 </textarea></body></html>" + ); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Token_locations.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Token_locations.java new file mode 100644 index 000000000..a13b4b481 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/Token_locations.java @@ -0,0 +1,124 @@ +/* Token_locations.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.MutableAttributeSet; +import javax.swing.text.html.HTML; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Token_locations + extends TestCase +{ + public void testHTMLParsing() + throws Exception + { + Parser_Test v = + new Parser_Test() + { + public void handleSimpleTag(HTML.Tag tag, + MutableAttributeSet attributes, int position + ) + { + if (tag.toString().equals("#pcdata")) + return; + out.append("<" + tag + "[" + position + "]"); + dumpAttributes(attributes); + out.append("/>"); + } + + public void handleStartTag(HTML.Tag tag, + MutableAttributeSet attributes, int position + ) + { + if (tag.toString().equalsIgnoreCase("tbody")) + return; + out.append("<" + tag + "[" + position + "]"); + dumpAttributes(attributes); + out.append('>'); + } + + public void handleText(char[] chars, int position) + { + out.append("'" + new String(chars) + "[" + position + "]'"); + } + + public void handleEndTag(HTML.Tag tag, int position) + { + if (tag.toString().equalsIgnoreCase("tbody")) + return; + out.append("</" + tag + "[" + position + "]>"); + } + + public void handleComment(char[] parm1, int position) + { + out.append("{" + new String(parm1) + "[" + position + "]}"); + } + }; + + v.hideImplied = true; + + // 0123456789012345678901234567890 + v.verify("<table><tr><td>a<td>b<td>c</tr>", + "<html[0]><head[0]></head[0]><body[0]><table[0]>" + + "<tr[7]><td[11]>'a[15]'</td[16]><td[16]>'b[20]'</td[21]>" + + "<td[21]>'c[25]'</td[26]></tr[26]></table[26]></body[26]>" + + "</html[26]>" + ); + + // 0123456789012345678901234567890 + v.verify("a<!-- comment -->b<!-- comment2 -->", + "<html[0]><head[0]></head[0]><body[0]>'a[0]'{ comment [1]}'b[17]'" + + "{ comment2 [18]}</body[18]></html[18]>" + ); + + // 012345678901234567 + v.verify("<p>b<p>c<p>d", + "<html[0]><head[0]></head[0]><body[0]><p[0]>'b[3]'</p[4]><p[4]>'" + + "c[7]'</p[8]><p[8]>'d[11]'</p[11]></body[11]></html[11]>" + ); + + // Test SGML + v.verify("<! the sgml construct >sgml", + "<html[23]><head[23]></head[23]><body[23]>" + + "'sgml[23]'</body[23]></html[23]>" + ); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Buffer_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Buffer_Test.java new file mode 100644 index 000000000..ed21b5676 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Buffer_Test.java @@ -0,0 +1,67 @@ +/* Buffer_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser.low; + +import test.gnu.javax.swing.text.html.parser.TestCase; + +import gnu.javax.swing.text.html.parser.support.low.Buffer; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Buffer_Test + extends TestCase +{ + public void testAppend() + { + Buffer.INITIAL_SIZE = 2; + + Buffer b = new Buffer("01"); + b.append('A', 0); + b.append('B', 0); + assertEquals(b.toString(), "01AB"); + } + + public void testDelete() + { + Buffer b = new Buffer("0123456789ABCDEFGHIJKLMN"); + b.delete(2, 7); + assertEquals(b.toString(), "01789ABCDEFGHIJKLMN"); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Constants_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Constants_Test.java new file mode 100644 index 000000000..5c422a121 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/Constants_Test.java @@ -0,0 +1,89 @@ +/* Constants_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser.low; + +import test.gnu.javax.swing.text.html.parser.TestCase; + +import gnu.javax.swing.text.html.parser.support.low.Buffer; +import gnu.javax.swing.text.html.parser.support.low.Constants; +import gnu.javax.swing.text.html.parser.support.low.Token; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class Constants_Test + extends TestCase +{ + Constants c = new Constants(); + + public void testCases() + { + verify("x stYle ", c.STYLE, "stYle"); + verify("x !style!", c.STYLE, "style"); + verify("x !Script!", c.SCRIPT, "Script"); + verify(" \r\t\n z", c.WS, " \r\t\n "); + verify("123 ", c.NUMTOKEN, "123"); + verify("AaB123#", c.NUMTOKEN, "AaB123"); + verify("x-- ", c.DOUBLE_DASH, "--"); + verify("x--- ", c.DOUBLE_DASH, "--"); + + verify("z&entitu ", c.ENTITY, "&entitu"); + + verifyNull("x stYle"); + verifyNull("x !style"); + verifyNull("x !Script"); + verifyNull(" \r\t\n "); + verifyNull("123"); + verifyNull("AaB123"); + verifyNull("x--"); + } + + public void verify(String sequence, int kind, String image) + { + Token t = c.endMatches(new Buffer(sequence)); + assertEquals(kind, t.kind); + assertEquals(image, t.getImage()); + } + + public void verifyNull(String sequence) + { + Token t = c.endMatches(new Buffer(sequence)); + assertNull("The end should not match any token", t); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/ReaderTokenizer_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/ReaderTokenizer_Test.java new file mode 100644 index 000000000..60ff030e4 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/low/ReaderTokenizer_Test.java @@ -0,0 +1,159 @@ +/* ReaderTokenizer_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser.low; + +import test.gnu.javax.swing.text.html.parser.TestCase; + +import gnu.javax.swing.text.html.parser.support.low.Constants; +import gnu.javax.swing.text.html.parser.support.low.ReaderTokenizer; +import gnu.javax.swing.text.html.parser.support.low.Token; +import gnu.javax.swing.text.html.parser.support.low.node; +import gnu.javax.swing.text.html.parser.support.low.pattern; + +import java.io.StringReader; + +import java.util.ArrayList; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class ReaderTokenizer_Test + extends TestCase +{ + ReaderTokenizer rt = new ReaderTokenizer(); + + public void testComplexToken() + throws Exception + { + String x = "< style >x"; + + pattern a = + new pattern(new node[] + { + new node(Constants.BEGIN), new node(Constants.NUMTOKEN), + new node(Constants.END), new node(Constants.NUMTOKEN) + } + ); + + pattern b = + new pattern(new node[] + { + new node(Constants.BEGIN), new node(Constants.STYLE), + new node(Constants.END), new node(Constants.NUMTOKEN) + } + ); + + pattern c = + new pattern(new node[] + { + new node(Constants.BEGIN), new node(Constants.WS, true), + new node(Constants.STYLE), new node(Constants.WS, true), + new node(Constants.END), new node(Constants.NUMTOKEN) + } + ); + + pattern d = + new pattern(new node[] + { + new node(Constants.BEGIN), new node(Constants.WS, true), + new node(Constants.STYLE), new node(Constants.WS, true), + new node(Constants.END), new node(Constants.BEGIN) + } + ); + + ReaderTokenizer rt = new ReaderTokenizer(); + rt.reset(new StringReader(x)); + + assertFalse(a.matches(rt)); + assertFalse(b.matches(rt)); + assertTrue(c.matches(rt)); + assertFalse(d.matches(rt)); + } + + public void testReadingAndAhead() + throws Exception + { + ArrayList tokens = new ArrayList(); + StringBuffer b = new StringBuffer(); + for (int i = 0; i < 10; i++) + { + String r = rs(); + b.append(" "); + b.append(r + i); + tokens.add(" "); + tokens.add(r + i); + } + rt.reset(new StringReader(b.toString())); + + for (int i = 0; i < 10; i++) + { + for (int ah = 0; ah < 10; ah++) + { + Token ahead = rt.getTokenAhead(ah); + if (i + ah >= tokens.size()) + { + assertEquals(ahead.kind, rt.EOF); + } + else + { + if ((i + ah) % 2 == 0) + assertEquals(ahead.kind, rt.WS); + else + { + assertEquals(ahead.getImage(), tokens.get(i + ah)); + assertEquals(ahead.kind, rt.NUMTOKEN); + } + } + } + + Token r = rt.getNextToken(); + assertEquals(r.getImage(), tokens.get(i)); + } + } + + private String rs() + { + StringBuffer b = new StringBuffer(); + for (int i = 0; i < 10 * Math.random(); i++) + { + b.append("l"); + } + return b.toString(); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/parameterDefaulter_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/parameterDefaulter_Test.java new file mode 100644 index 000000000..ad6667f9a --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/parameterDefaulter_Test.java @@ -0,0 +1,92 @@ +/* parameterDefaulter_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.HTML_401F; +import gnu.javax.swing.text.html.parser.htmlAttributeSet; +import gnu.javax.swing.text.html.parser.support.parameterDefaulter; + +import javax.swing.text.AttributeSet; +import javax.swing.text.html.HTML; +import javax.swing.text.html.HTML.Attribute; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class parameterDefaulter_Test + extends TestCase +{ + parameterDefaulter defaulter; + + public void testDefaultValues() + { + AttributeSet d; + d = defaulter.getDefaultParameters("FrAmE"); + assertEquals(d.getAttribute("scrolling"), "auto"); + d = defaulter.getDefaultParameters("input"); + assertEquals(d.getAttribute("type"), "text"); + + htmlAttributeSet hma = new htmlAttributeSet(); + hma.setResolveParent(d); + hma.addAttribute("ku", "1"); + hma.addAttribute(Attribute.ACTION, "sleep"); + + assertEquals(hma.getAttribute("action"), "sleep"); + assertEquals(hma.getAttribute(Attribute.ACTION), "sleep"); + assertEquals(hma.getAttribute("ku"), "1"); + + // Calling the parent: + assertEquals(hma.getAttribute(Attribute.TYPE), "text"); + + d = defaulter.getDefaultParameters("audrius"); + assertEquals(d.getAttribute("scrolling"), null); + } + + protected void setUp() + { + defaulter = new parameterDefaulter(HTML_401F.getInstance()); + } + + protected void tearDown() + throws java.lang.Exception + { + defaulter = null; + super.tearDown(); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/supplementaryNotifications.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/supplementaryNotifications.java new file mode 100644 index 000000000..9cccfe91d --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/supplementaryNotifications.java @@ -0,0 +1,86 @@ +/* supplementaryNotifications.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import javax.swing.text.MutableAttributeSet; +import javax.swing.text.html.HTML; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class supplementaryNotifications + extends TestCase +{ + String eoln = null; + int flushed = 0; + + public void testHTMLParsing() + throws Exception + { + Parser_Test v = + new Parser_Test() + { + public void handleEndOfLineString(String end_of_line) + { + eoln = end_of_line; + } + + public void flush() + { + flushed++; + } + }; + + v.hideImplied = true; + + v.verify("a \n b", "<html><head></head><body>'a b'</body></html>"); + + assertEquals(eoln, "\n"); + + v.verify("a \r b", "<html><head></head><body>'a b'</body></html>"); + + assertEquals(eoln, "\r"); + + v.verify("a \r\n b", "<html><head></head><body>'a b'</body></html>"); + + assertEquals(eoln, "\r\n"); + + assertEquals(flushed, 3); + } +} diff --git a/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/textPreProcessor_Test.java b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/textPreProcessor_Test.java new file mode 100644 index 000000000..cf13b7f06 --- /dev/null +++ b/testsuite/javax.swing.text.html.parser/test/gnu/javax/swing/text/html/parser/textPreProcessor_Test.java @@ -0,0 +1,150 @@ +/* textPreProcessor_Test.java -- + Copyright (C) 2005 Free Software Foundation, Inc. + +This file is part of GNU Classpath. + +GNU Classpath 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 2, or (at your option) +any later version. + +GNU Classpath 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 GNU Classpath; see the file COPYING. If not, write to the +Free Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA +02111-1307 USA. + +Linking this library statically or dynamically with other modules is +making a combined work based on this library. Thus, the terms and +conditions of the GNU General Public License cover the whole +combination. + +As a special exception, the copyright holders of this library give you +permission to link this library with independent modules to produce an +executable, regardless of the license terms of these independent +modules, and to copy and distribute the resulting executable under +terms of your choice, provided that you also meet, for each linked +independent module, the terms and conditions of the license of that +module. An independent module is a module which is not derived from +or based on this library. If you modify this library, you may extend +this exception to your version of the library, but you are not +obligated to do so. If you do not wish to do so, delete this +exception statement from your version. */ + + +package test.gnu.javax.swing.text.html.parser; + +import gnu.javax.swing.text.html.parser.support.textPreProcessor; + +/** + * @author Audrius Meskauskas (AudriusA@Bioinformatics.org) + */ +public class textPreProcessor_Test + extends TestCase +{ + textPreProcessor p = new textPreProcessor(); + + public void testPreFormattedPreProcessing() + { + verifyF("rnrn...r.n.Q.Q.r.n.rn.Q...r.r.rn", "n...n.n.Q.Q.n.n.n.Q...n.n."); + verifyF("...r.n.Q.Q.r.n.rn.Q...r.r.n", "...n.n.Q.Q.n.n.n.Q...n.n."); + verifyF("r...r.n.Q.Q.r.n.rn.Q...r.r.n", "...n.n.Q.Q.n.n.n.Q...n.n."); + verifyF("Q", "Q"); + verifyF(".", "."); + verifyF("abc..\t..xyz", "abc..\t..xyz"); + verifyF("abcxyz", "abcxyz"); + } + + public void testStandardPreProcessing() + { + verifyS("...r.n.Q.Q.r.n.rn.Q...r.r.n", "Q.Q.Q"); + verifyS("r...r.n.Q.Q.r.n.rn.Q...r.r.n", "Q.Q.Q"); + verifyS("Q", "Q"); + verifyS(" ", null); + verifyS(" \r\n", null); + verifyS("abc..\t..xyz", "abc.xyz"); + verifyS("abcxyz", "abcxyz"); + } + + StringBuffer fromText(String x) + { + StringBuffer b = new StringBuffer(); + char c; + for (int i = 0; i < x.length(); i++) + { + c = x.charAt(i); + + if (c == 'n') + b.append('\n'); + else if (c == 'r') + b.append('\r'); + else if (c == '.') + b.append(' '); + else + b.append(c); + } + return b; + } + + StringBuffer toText(String x) + { + StringBuffer b = new StringBuffer(); + char c; + for (int i = 0; i < x.length(); i++) + { + c = x.charAt(i); + + if (c == '\n') + b.append('n'); + else if (c == '\r') + b.append('r'); + else if (c == ' ') + b.append('.'); + else + b.append(c); + } + return b; + } + + void verifyF(String text, String result) + { + char[] pp = p.preprocessPreformatted(fromText(text)); + + if (result == null && pp == null) + return; + + String processed = new String(pp); + + processed = toText(processed).toString(); + + if (!processed.equals(result)) + { + System.err.println(result); + System.out.println(processed); + } + assertEquals(text, result, processed); + } + + void verifyS(String text, String result) + { + char[] pp = p.preprocess(fromText(text)); + + if (result == null && pp == null) + return; + + String processed = new String(pp); + + processed = toText(processed).toString(); + + if (!processed.equals(result)) + { + System.err.println(result); + System.out.println(processed); + } + assertEquals(text, result, processed); + } +} |