Update CSS tests to revision 31d63cc79bd4c929ed582229e936d7b389f3e6ab

This commit is contained in:
James Graham
2015-03-27 09:18:12 +00:00
parent 1a81b18b9f
commit 2c9faf5363
91915 changed files with 5979820 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
obj/
test/valid/obj
test/invalid/obj

View File

@@ -0,0 +1,202 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright [yyyy] [name of copyright owner]
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

View File

@@ -0,0 +1,158 @@
########################################################################
# $Id$
# Copyright 2009 Aplix Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########################################################################
UNAME = $(shell uname)
INCDIRS = $(OBJDIR)
SRCDIR = src
DOCDIR = doc
EXAMPLESDIR = examples
OBJDIR = obj
########################################################################
# Linux configuration
#
ifneq (,$(filter Linux%, $(UNAME)))
CFLAGS = -g -Wall -Werror -O0 $(patsubst %, -I%, $(INCDIRS))
OBJSUFFIX = .o
EXESUFFIX =
#LIBS = -lefence
OBJOPTION = -o
EXEOPTION = -o
else
########################################################################
# Darwin configuration
#
ifneq (,$(filter Darwin%, $(UNAME)))
CFLAGS = -g -Wall -Werror -O2 $(patsubst %, -I%, $(INCDIRS))
OBJSUFFIX = .o
EXESUFFIX =
OBJOPTION = -o
# The -o in the following line has a space after it, which must not be removed.
EXEOPTION = -o
else
########################################################################
# Windows (cygwin but using MS compiler) configuration
#
# this is messy - should probably use vcvars.bat
ifneq (,$(filter CYGWIN%, $(UNAME)))
VISUALSTUDIODIR = $(wildcard /cygdrive/c/Program*Files/Microsoft*Visual*Studio*8)
SDKDIR = $(wildcard /cygdrive/c/Program*Files/Microsoft*SDKs/Windows/*/Lib)
ifeq (,$(VISUALSTUDIODIR))
VISUALSTUDIODIR = $(wildcard /cygdrive/c/Program\ Files\ */Microsoft*Visual*Studio*10*)
endif
ifeq (,$(VISUALSTUDIODIR))
VISUALSTUDIODIR = $(wildcard /cygdrive/c/Program\ Files\ */Microsoft*Visual*Studio*11*)
endif
# this is revelvant for vs2012 and windows 8 - sdk location has changed
ifeq (,$(SDKDIR))
SDKDIR = $(wildcard /cygdrive/c/Program\ Files\ */Windows*Kits)
endif
ifeq (,$(VISUALSTUDIODIR))
$(error Could not find MS Visual Studio)
else
WINVISUALSTUDIODIR = $(shell cygpath -w '$(VISUALSTUDIODIR)')
WINSDKDIR = $(shell cygpath -w '$(SDKDIR)')
#$(error $(VISUALSTUDIODIR))
CC = \
Lib='$(WINVISUALSTUDIODIR)\VC\LIB;$(WINVISUALSTUDIODIR)\VC\PlatformSDK\Lib;$(WINSDKDIR)' \
PATH='$(VISUALSTUDIODIR)/Common7/IDE:$(VISUALSTUDIODIR)/VC/BIN:$(VISUALSTUDIODIR)/Common7/Tools:$(VISUALSTUDIODIR)/SDK/v2.0/bin:$(VISUALSTUDIODIR)/8.0/Lib/win8/um/x86:'$$PATH \
Include='$(WINVISUALSTUDIODIR)\VC\INCLUDE;$(WINVISUALSTUDIODIR)\VC\PlatformSDK\Include' \
cl
endif
CFLAGS = /nologo /WX /W3 /wd4996 /Zi /O2 $(patsubst %, /I%, $(INCDIRS))
OBJSUFFIX = .obj
EXESUFFIX = .exe
OBJOPTION = /Fo
EXEOPTION = /Fe
endif
endif
endif
########################################################################
# Common makefile
#
WIDLPROC = $(OBJDIR)/widlproc$(EXESUFFIX)
DTD = $(OBJDIR)/widlprocxml.dtd
ALL = $(WIDLPROC) $(DTD)
all : $(ALL)
SRCS = \
comment.c \
lex.c \
main.c \
misc.c \
node.c \
parse.c \
process.c
OBJS = $(patsubst %.c, $(OBJDIR)/%$(OBJSUFFIX), $(SRCS))
$(WIDLPROC) : $(OBJS)
$(CC) $(CFLAGS) $(EXEOPTION)$@ $^ $(LIBS)
$(OBJDIR)/%$(OBJSUFFIX) : $(SRCDIR)/%.c
mkdir -p $(dir $@)
$(CC) $(CFLAGS) $(OBJOPTION)$@ -c $<
$(OBJDIR)/%.d : $(SRCDIR)/%.c
mkdir -p $(dir $@)
cc $(patsubst %, -I%, $(INCDIRS)) -MM -MG -MT $(patsubst %.d, %$(OBJSUFFIX), $@) $< | sed '$(patsubst %, s| \(%\)| $(OBJDIR)/\1|;, $(AUTOGENHEADERS))' >$@
include $(patsubst %.c, $(OBJDIR)/%.d, $(SRCS))
$(DTD) : $(DOCDIR)/htmltodtd.xsl $(DOCDIR)/widlproc.html
xsltproc -html $^ >$@
clean :
rm -f $(ALL) $(OBJS)
veryclean :
rm -rf $(OBJDIR)
SVNFILES = $(shell test -d .svn && svn info -R . | sed -n 's/^Path: \(.*\)$$/\1/p')
SVNBRANCH = $(shell test -d .svn && svn info . | sed -n 's|^URL:.*/\([^/]*\)$$|\1|p')
SVNREV = $(shell test -d .svn && svn info -R . | sed -n 's/^Last Changed Rev: \([0-9][0-9]*\)$$/\1/p' | sort -g | tail -1)
SVNLOG = history
$(SVNLOG) : $(SVNFILES)
svn log -vrHEAD:311 >$@
zip : $(OBJDIR)/widlproc-$(SVNBRANCH)$(SVNREV).zip
$(OBJDIR)/widlproc-$(SVNBRANCH)$(SVNREV).zip : $(WIDLPROC) $(DTD) $(DOCDIR)/widlproc.html $(SRCDIR)/widlprocxmltohtml.xsl Makefile $(SVNLOG)
rm -f $@
zip -j $@ $^ -x Makefile
zip $@ examples/*.widl examples/*.css examples/Makefile examples/README examples/*.xsl examples/*.html
srczip : widlproc-src-$(SVNBRANCH)$(SVNREV).zip
widlproc-src-%.zip : $(SVNFILES) $(SVNLOG)
zip $@ $^
examples :
$(MAKE) -C examples SRCDIR=../src OBJDIR=../obj EXAMPLESOBJDIR=../obj/examples
test : $(OBJS)
$(MAKE) -C test SRCDIR=../src OBJDIR=../obj
.DELETE_ON_ERROR:

View File

@@ -0,0 +1,40 @@
# Uses
widlproc can be used to validate WebIDL in W3C specifications. It serves as the basis for the [W3C Web IDL on-line checker](http://www.w3.org/2009/07/webidl-check).
widlproc's generated XML is used to generate [webinos JavaScript APIs specifications](http://dev.webinos.org/specifications/draft/).
# License
widlproc is licensed under the Apache 2 License.
# Others
See also [webidl.js](https://github.com/darobin/webidl.js), a JavaScript-based Web IDL parser used by various tools in W3C.
# Credits
Most of the work on widlproc was done by Tim Renouf and Paddy Byers. Aplix corporation owns the copyright of the code up to June 2011.
The tool is kept up to date with the changes in the spec by Dominique Hazael-Massieux, through funding from the [webinos project](http://webinos.org/) since June 2011.
# Documentation
See doc/widlproc.html in the tree.
# Build Instructions
## Windows
Install requirements
* Cygwin - must install must install libs/libxslt
* Visual Studio express 2012 or 2010 (see difference below)
makefile uses cygwin make. References are coded in the make file to detect teh current version of visual studio
# Future work
windows build could be improved to handle multipe versions with vcvars.bat
http://stackoverflow.com/questions/62029/vs2008-command-prompt-cygwin

View File

@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="us-ascii"?>
<!--====================================================================
$Id$
Copyright 2009 Aplix Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Stylesheet to extract DTD for widlprocxml from widlproc.html
=====================================================================-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="us-ascii" indent="no"/>
<!-- <pre class="dtd"> element -->
<xsl:template match="pre[@class='dtd']">
<xsl:value-of select="."/>
</xsl:template>
<!--Ignore other text. -->
<xsl:template match="text()" priority="-100"/>
</xsl:stylesheet>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,79 @@
########################################################################
# $Id$
# Copyright 2009 Aplix Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########################################################################
UNAME = $(shell uname)
EXAMPLESDIR = .
# The settings of SRCDIR (where to find the xsl style sheets), OBJDIR (where to
# find widlproc and widlprocxml.dtd) and EXAMPLESOBJDIR (where to put the
# resulting html files and any intermediate files) reflect the directory
# structure of the released widlproc.zip file when unzipped. ../Makefile calls
# this Makefile with these settings overridden to reflect the directory
# structure in svn.
SRCDIR = ..
OBJDIR = ..
EXAMPLESOBJDIR = obj
########################################################################
# Linux configuration
#
ifneq (,$(filter Linux%, $(UNAME)))
EXESUFFIX =
else
########################################################################
# Darwin configuration
#
ifneq (,$(filter Darwin%, $(UNAME)))
EXESUFFIX =
else
########################################################################
# Windows (cygwin but using MS compiler) configuration
#
ifneq (,$(filter CYGWIN%, $(UNAME)))
EXESUFFIX = .exe
endif
endif
endif
########################################################################
# Common makefile
#
WIDLPROC = $(OBJDIR)/widlproc$(EXESUFFIX)
DTD = $(OBJDIR)/widlprocxml.dtd
WIDLS = $(patsubst $(EXAMPLESDIR)/%, %, $(wildcard $(EXAMPLESDIR)/*.widl))
test : $(patsubst %.widl, $(EXAMPLESOBJDIR)/%.html, $(WIDLS)) $(EXAMPLESOBJDIR)/widlhtml.css
@echo "$@ pass"
$(EXAMPLESOBJDIR)/%.html : $(EXAMPLESOBJDIR)/%.widlprocxml $(SRCDIR)/widlprocxmltohtml.xsl Makefile
cp $(SRCDIR)/widlprocxmltohtml.xsl $(dir $@)/
xsltproc $(dir $@)/widlprocxmltohtml.xsl $< >$@
$(EXAMPLESOBJDIR)/%.widlprocxml : $(EXAMPLESDIR)/%.widl $(WIDLPROC) $(DTD) Makefile
mkdir -p $(dir $@)
$(WIDLPROC) $< >$@
cp $(OBJDIR)/widlprocxml.dtd $(dir $@)/
xmllint --noout --dtdvalid $(DTD) $@
$(EXAMPLESOBJDIR)/widlhtml.css : $(EXAMPLESDIR)/widlhtml.css
cp $< $@
.DELETE_ON_ERROR:

View File

@@ -0,0 +1,41 @@
########################################################################
# $Id$
# Copyright 2009 Aplix Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########################################################################
This examples directory contains two of the BONDI .widl files, a Makefile
that processes them to generate html, and a .css file that the resulting
html uses.
The Makefile processes the .widl files as follows:
1. For each .widl, generate the .widlprocxml file (an XML representation
of the information in the .widl) using widlproc.
2. Validate (using xmllint) each .widlprocxml against the DTD.
3. We want any reference in the resulting html to a type elsewhere in the
API to be a link. This is where we achieve this. First generate a
list of fqids (fully qualified identifiers) from fqid attributes in
the XML by running all .widlprocxml files through the style sheet
widlprocxmlfqids.xsl.
4. Turn that list of fqids into a sed script that turns a <ref> to an
fqid into a <ref ref=".."> to the fqid in the right .html file.
5. For each .widlprocxml file, generate a .widlprocxml2 file by running
it through the sed script generated above.
6. For each .widlprocxml2 file, generate a .html file by running it through
the widlprocxmltohtml.xsl style sheet.
See the Makefile for details.

View File

@@ -0,0 +1,227 @@
/*
* Licensed to OMTP Ltd. (OMTP) under one or more contributor license agreements.
* See the NOTICE file distributed with this work for additional information regarding
* copyright ownership.
*
* The Reference Implementation (save for such parts of the reference implementation made
* available under separate terms and conditions) is made available under the terms of the
* Apache License, version 2.0, subject to the condition that any "Works" and "Derivative
* Works" used or distributed for commercial purposes must be and remain compliant with the
* BONDI specification as promulgated by OMTP in each release. Your implementation of the
* Reference Implementation (whether object or source) must maintain these conditions, and
* you must notify any recipient of this condition in a conspicuous way.
*
* You may not use this BONDI Reference Implementation except in compliance with the License.
*
* You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 or at
* http://bondi.omtp.org/BONDI-LICENSE-2.0
*/
/**
* \brief Common BONDI functionality.
*
* These definitions can be used in all other BONDI modules as dependencies.
* \version 1.1
*/
module bondi {
/**
* \brief Array of DOMStrings.
*/
typedef sequence<DOMString> StringArray;
/**
* \brief Array of 8-bit unsigned integer values.
*/
typedef sequence<octet> ByteArray;
/**
* \brief Array of 16-bit signed integer values.
*/
typedef sequence<short> ShortArray;
/**
* \brief Array of 32-bit signed integer values.
*/
typedef sequence<long> LongArray;
/**
* \brief Array of floating point values.
*/
typedef sequence<float> FloatArray;
/**
* \brief Generic Map object.
*/
typedef Object Map;
/**
* \brief Generic success callback interface.
*/
[Callback=FunctionOnly, NoInterfaceObject] interface SuccessCallback {
/**
* \brief Method invoked when the asynchronous call completes successfully
*/
void onSuccess();
};
/**
* \brief Success callback interface for requestFeature invocations
*/
[Callback=FunctionOnly, NoInterfaceObject] interface RequestFeatureSuccessCallback {
/**
* \brief Method invoked upon a succesful requestFeature invocation
*
* \param ob Object implementing the JavaScript API associated with the requested Feature.
*/
void onSuccess(in Object ob);
};
/**
* \brief Generic error callback interface.
*/
[Callback=FunctionOnly, NoInterfaceObject] interface ErrorCallback {
/**
* \brief Method invoked when an error occurs
*
* \param error The error that is raised.
*/
void onError(in GenericError error);
};
/**
* \brief Generic error interface.
*
*
*/
interface GenericError {
/**
* \brief 16-bit error code.
*/
readonly attribute unsigned short code;
};
/**
* \brief DeviceApiError error interface.
*
* The error codes must be in the range 10000-19999.
*/
interface DeviceAPIError : GenericError {
/**
* \brief Unknown error.
*/
const unsigned short UNKNOWN_ERROR = 10000;
/**
* \brief Invalid value was specified as input parameter.
*/
const unsigned short INVALID_ARGUMENT_ERROR = 10001;
/**
* \brief The searched value or object was not found.
*/
const unsigned short NOT_FOUND_ERROR = 10002;
/**
* \brief Operation is pending.
*/
const unsigned short PENDING_OPERATION_ERROR = 10003;
/**
* \brief Input/Output error.
*/
const unsigned short IO_ERROR = 10004;
/**
* \brief Not supported error.
*/
const unsigned short NOT_SUPPORTED_ERROR = 10005;
};
/**
* \brief Security error interface.
*
* The error codes must be in the range 20000-29999
*/
interface SecurityError : GenericError {
const unsigned short PERMISSION_DENIED_ERROR = 20000;
};
/**
* \brief PendingOperation.
*
* Interface that is returned by asynchronous operations in order to
* provide a cancellation operation.
*/
interface PendingOperation {
/**
* \brief Call to cancel the underlying asynchronous operation.
*
* This call is always successful, i.e. the pending operation i.e.
* either cancelled or one of the callback is called.
*
* \return <em>false</em> if the cancellation did not succeed
* either because the pending operation finished already or because
* the cancellation cannot succeed due to technical limitations in
* the underlying implementation. Consquently the pending operation
* completes and depending on the success or failure the appropriate
* callbacks will be called.
* <em>true</em> if the cancellation did succeed. No callbacks will
* be called by the cancelled pending operation.
*/
boolean cancel();
};
/**
* \brief BONDI root API.
* bondi root property exists in the global object
* \def-api-feature http://bondi.omtp.org/api/bondi.requestfeature
*/
interface Bondi {
/**
* \brief Requests a feature.
*
* This function requests a named feature
* asynchronously and returns a pending operation object.
* If it succeeds it calls the successCallback and passes in
* the object of the requested feature. If it fails it calls
* the errorCallback passing in a DeviceAPIError which provides
* an error message and error code indicating the nature of the error.
*
* If the requested feature binds itself to a root namespace
* ( for example, "bondi.pim.contact") this will happen prior to the
* successCallback being invoked.
*
* \param successCallback the success callback function
* \param errorCallback the error callback function
* \param name the feature name IRI
*
* \return PendingOperation enabling the requester to cancel this request.
*
* The errorCallback will receive one of the following errors:
* \throw DeviceAPIError INVALID_ARGUMENT_ERROR if a malformed
* argument has been supplied or a required argument has been omitted.
* \throw DeviceAPIError NOT_FOUND_ERROR if the requested feature could not be found.
* \throw SecurityError PERMISSION_DENIED_ERROR if the
* requested feature is not permitted to load/bind or that
* access to a required device capability has been denied.
* \throw DeviceAPIError UNKNOWN_ERROR if an error occurred and a pending
* operation object can't be returned.
*/
PendingOperation requestFeature(in RequestFeatureSuccessCallback successCallback,
in ErrorCallback errorCallback,
in DOMString name)
raises(DeviceAPIError, SecurityError);
};
interface BondiObject {
readonly attribute Bondi bondi;
};
Window implements bondiObject;
};

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--====================================================================
$Id$
Copyright 2009 Aplix Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
XSLT stylesheet to extract Web IDL snippets from Web IDL spec.
=====================================================================-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="text" encoding="utf-8"/>
<xsl:template match="code[@class='idl-code']">
<xsl:value-of select="."/><xsl:text>
</xsl:text>
</xsl:template>
<xsl:template match="text()"/>
</xsl:stylesheet>

View File

@@ -0,0 +1,100 @@
body {
padding: 2em;
margin: 0;
font-family: sans-serif;
color: black;
background: white;
background-position: top left;
background-attachment: fixed;
background-repeat: no-repeat;
}
:link { color: #00C; background: transparent }
:visited { color: #609; background: transparent }
a:active { color: #C00; background: transparent }
a:link img, a:visited img { border-style: none } /* no border on img links */
h1, h2, h3, h4, h5, h6 { text-align: left }
/* background should be transparent, but WebTV has a bug */
h1, h2, h3 { color: #009393; background: white }
h1 { font: 170% sans-serif }
h2 { font: 140% sans-serif }
h3 { font: 120% sans-serif }
h4 { font: bold 100% sans-serif }
h5 { font: italic 100% sans-serif }
h6 { font: small-caps 100% sans-serif; margin-bottom: 0 }
.hide { display: none }
code { font-size: 120% }
ul.toc, ol.toc, ul.authors {
list-style: none;
}
.hide { display: none }
div.head { margin-bottom: 1em }
div.head h1 { margin-top: 2em; clear: both }
div.head table { margin-left: 2em; margin-top: 2em }
div.constraint, div.issue, div.note, div.notice { margin-left: 2em; }
div.exampleInner pre { margin-left: 1em; margin-top: 0em; margin-bottom: 0em}
div.exampleOuter {border: 4px double gray; margin: 0em; padding: 0em}
div.exampleInner { background-color: #d5dee3;
border-top-width: 4px;
border-top-style: double;
border-top-color: #d3d3d3;
border-bottom-width: 4px;
border-bottom-style: double;
border-bottom-color: #d3d3d3;
padding: 4px; margin: 0em }
div.exampleWrapper { margin: 4px }
div.exampleHeader { font-weight: bold; margin: 4px}
div.term { font: 100% sans-serif; color:#000000; font-weight: bold; line-height: 60%}
div.list { font: 100% sans-serif; color:#000000; font-weight: normal; line-height: 60%}
.optional {text-decoration: line-through; display: none;}
.copyright,.legalnotice { font-size: small }
.copyright small { font-size: small }
@media screen { /* hide from IE3 */
a[href]:hover { background: #ffa }
}
ol.enumar { list-style-type: decimal; }
ol.enumla { list-style-type: lower-alpha; }
ol.enumlr { list-style-type: lower-roman; }
ol.enumua { list-style-type: upper-alpha; }
ol.enumur { list-style-type: upper-roman; }
/* BONDI additions */
.toc {
list-style-type: none;
}
pre {
background-color:#D5DEE3;
overflow: auto;
padding: 1em;
}
.examplecode {
background-color: #EEE;
}
.def-api-feature-set dt, .def-api-feature dt, dt .def-device-cap, dt.const code { font: bold 100% sans-serif; }
dt.attribute code, dt.method code { font: italic 100% sans-serif; }
.def-device-caps dd { margin-bottom: 2em }
dt.method { margin-top: 2em }
.summary td {
text-align: left;
background-color: #BBDDDD;
color: inherit;
font-family: monospace;
white-space:pre;
padding: .3em 1em .3em 1em;
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,25 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef comment_h
#define comment_h
struct tok;
struct node;
void addcomment(struct tok *tok);
void setcommentnode(struct node *node2);
void processcomments(struct node *root);
void outputdescriptive(struct node *node, unsigned int indent);
#endif /* ndef comment_h */

View File

@@ -0,0 +1,271 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef entities_h
#define entities_h
#define ENTITIES \
"nbsp\0&#160;\0" \
"iexcl\0&#161;\0" \
"cent\0&#162;\0" \
"pound\0&#163;\0" \
"curren\0&#164;\0" \
"yen\0&#165;\0" \
"brvbar\0&#166;\0" \
"sect\0&#167;\0" \
"uml\0&#168;\0" \
"copy\0&#169;\0" \
"ordf\0&#170;\0" \
"laquo\0&#171;\0" \
"not\0&#172;\0" \
"shy\0&#173;\0" \
"reg\0&#174;\0" \
"macr\0&#175;\0" \
"deg\0&#176;\0" \
"plusmn\0&#177;\0" \
"sup2\0&#178;\0" \
"sup3\0&#179;\0" \
"acute\0&#180;\0" \
"micro\0&#181;\0" \
"para\0&#182;\0" \
"middot\0&#183;\0" \
"cedil\0&#184;\0" \
"sup1\0&#185;\0" \
"ordm\0&#186;\0" \
"raquo\0&#187;\0" \
"frac14\0&#188;\0" \
"frac12\0&#189;\0" \
"frac34\0&#190;\0" \
"iquest\0&#191;\0" \
"Agrave\0&#192;\0" \
"Aacute\0&#193;\0" \
"Acirc\0&#194;\0" \
"Atilde\0&#195;\0" \
"Auml\0&#196;\0" \
"Aring\0&#197;\0" \
"AElig\0&#198;\0" \
"Ccedil\0&#199;\0" \
"Egrave\0&#200;\0" \
"Eacute\0&#201;\0" \
"Ecirc\0&#202;\0" \
"Euml\0&#203;\0" \
"Igrave\0&#204;\0" \
"Iacute\0&#205;\0" \
"Icirc\0&#206;\0" \
"Iuml\0&#207;\0" \
"ETH\0&#208;\0" \
"Ntilde\0&#209;\0" \
"Ograve\0&#210;\0" \
"Oacute\0&#211;\0" \
"Ocirc\0&#212;\0" \
"Otilde\0&#213;\0" \
"Ouml\0&#214;\0" \
"times\0&#215;\0" \
"Oslash\0&#216;\0" \
"Ugrave\0&#217;\0" \
"Uacute\0&#218;\0" \
"Ucirc\0&#219;\0" \
"Uuml\0&#220;\0" \
"Yacute\0&#221;\0" \
"THORN\0&#222;\0" \
"szlig\0&#223;\0" \
"agrave\0&#224;\0" \
"aacute\0&#225;\0" \
"acirc\0&#226;\0" \
"atilde\0&#227;\0" \
"auml\0&#228;\0" \
"aring\0&#229;\0" \
"aelig\0&#230;\0" \
"ccedil\0&#231;\0" \
"egrave\0&#232;\0" \
"eacute\0&#233;\0" \
"ecirc\0&#234;\0" \
"euml\0&#235;\0" \
"igrave\0&#236;\0" \
"iacute\0&#237;\0" \
"icirc\0&#238;\0" \
"iuml\0&#239;\0" \
"eth\0&#240;\0" \
"ntilde\0&#241;\0" \
"ograve\0&#242;\0" \
"oacute\0&#243;\0" \
"ocirc\0&#244;\0" \
"otilde\0&#245;\0" \
"ouml\0&#246;\0" \
"divide\0&#247;\0" \
"oslash\0&#248;\0" \
"ugrave\0&#249;\0" \
"uacute\0&#250;\0" \
"ucirc\0&#251;\0" \
"uuml\0&#252;\0" \
"yacute\0&#253;\0" \
"thorn\0&#254;\0" \
"yuml\0&#255;\0" \
"fnof\0&#402;\0" \
"Alpha\0&#913;\0" \
"Beta\0&#914;\0" \
"Gamma\0&#915;\0" \
"Delta\0&#916;\0" \
"Epsilon\0&#917;\0" \
"Zeta\0&#918;\0" \
"Eta\0&#919;\0" \
"Theta\0&#920;\0" \
"Iota\0&#921;\0" \
"Kappa\0&#922;\0" \
"Lambda\0&#923;\0" \
"Mu\0&#924;\0" \
"Nu\0&#925;\0" \
"Xi\0&#926;\0" \
"Omicron\0&#927;\0" \
"Pi\0&#928;\0" \
"Rho\0&#929;\0" \
"Sigma\0&#931;\0" \
"Tau\0&#932;\0" \
"Upsilon\0&#933;\0" \
"Phi\0&#934;\0" \
"Chi\0&#935;\0" \
"Psi\0&#936;\0" \
"Omega\0&#937;\0" \
"alpha\0&#945;\0" \
"beta\0&#946;\0" \
"gamma\0&#947;\0" \
"delta\0&#948;\0" \
"epsilon\0&#949;\0" \
"zeta\0&#950;\0" \
"eta\0&#951;\0" \
"theta\0&#952;\0" \
"iota\0&#953;\0" \
"kappa\0&#954;\0" \
"lambda\0&#955;\0" \
"mu\0&#956;\0" \
"nu\0&#957;\0" \
"xi\0&#958;\0" \
"omicron\0&#959;\0" \
"pi\0&#960;\0" \
"rho\0&#961;\0" \
"sigmaf\0&#962;\0" \
"sigma\0&#963;\0" \
"tau\0&#964;\0" \
"upsilon\0&#965;\0" \
"phi\0&#966;\0" \
"chi\0&#967;\0" \
"psi\0&#968;\0" \
"omega\0&#969;\0" \
"thetasym\0&#977;\0" \
"upsih\0&#978;\0" \
"piv\0&#982;\0" \
"bull\0&#8226;\0" \
"hellip\0&#8230;\0" \
"prime\0&#8242;\0" \
"Prime\0&#8243;\0" \
"oline\0&#8254;\0" \
"frasl\0&#8260;\0" \
"weierp\0&#8472;\0" \
"image\0&#8465;\0" \
"real\0&#8476;\0" \
"trade\0&#8482;\0" \
"alefsym\0&#8501;\0" \
"larr\0&#8592;\0" \
"uarr\0&#8593;\0" \
"rarr\0&#8594;\0" \
"darr\0&#8595;\0" \
"harr\0&#8596;\0" \
"crarr\0&#8629;\0" \
"lArr\0&#8656;\0" \
"uArr\0&#8657;\0" \
"rArr\0&#8658;\0" \
"dArr\0&#8659;\0" \
"hArr\0&#8660;\0" \
"forall\0&#8704;\0" \
"part\0&#8706;\0" \
"exist\0&#8707;\0" \
"empty\0&#8709;\0" \
"nabla\0&#8711;\0" \
"isin\0&#8712;\0" \
"notin\0&#8713;\0" \
"ni\0&#8715;\0" \
"prod\0&#8719;\0" \
"sum\0&#8721;\0" \
"minus\0&#8722;\0" \
"lowast\0&#8727;\0" \
"radic\0&#8730;\0" \
"prop\0&#8733;\0" \
"infin\0&#8734;\0" \
"ang\0&#8736;\0" \
"and\0&#8743;\0" \
"or\0&#8744;\0" \
"cap\0&#8745;\0" \
"cup\0&#8746;\0" \
"int\0&#8747;\0" \
"there4\0&#8756;\0" \
"sim\0&#8764;\0" \
"cong\0&#8773;\0" \
"asymp\0&#8776;\0" \
"ne\0&#8800;\0" \
"equiv\0&#8801;\0" \
"le\0&#8804;\0" \
"ge\0&#8805;\0" \
"sub\0&#8834;\0" \
"sup\0&#8835;\0" \
"nsub\0&#8836;\0" \
"sube\0&#8838;\0" \
"supe\0&#8839;\0" \
"oplus\0&#8853;\0" \
"otimes\0&#8855;\0" \
"perp\0&#8869;\0" \
"sdot\0&#8901;\0" \
"lceil\0&#8968;\0" \
"rceil\0&#8969;\0" \
"lfloor\0&#8970;\0" \
"rfloor\0&#8971;\0" \
"lang\0&#9001;\0" \
"rang\0&#9002;\0" \
"loz\0&#9674;\0" \
"spades\0&#9824;\0" \
"clubs\0&#9827;\0" \
"hearts\0&#9829;\0" \
"diams\0&#9830;\0" \
"quot\0&#34;\0" \
"amp\0&#38;\0" \
"lt\0&#60;\0" \
"gt\0&#62;\0" \
"OElig\0&#338;\0" \
"oelig\0&#339;\0" \
"Scaron\0&#352;\0" \
"scaron\0&#353;\0" \
"Yuml\0&#376;\0" \
"circ\0&#710;\0" \
"tilde\0&#732;\0" \
"ensp\0&#8194;\0" \
"emsp\0&#8195;\0" \
"thinsp\0&#8201;\0" \
"zwnj\0&#8204;\0" \
"zwj\0&#8205;\0" \
"lrm\0&#8206;\0" \
"rlm\0&#8207;\0" \
"ndash\0&#8211;\0" \
"mdash\0&#8212;\0" \
"lsquo\0&#8216;\0" \
"rsquo\0&#8217;\0" \
"sbquo\0&#8218;\0" \
"ldquo\0&#8220;\0" \
"rdquo\0&#8221;\0" \
"bdquo\0&#8222;\0" \
"dagger\0&#8224;\0" \
"Dagger\0&#8225;\0" \
"permil\0&#8240;\0" \
"lsaquo\0&#8249;\0" \
"rsaquo\0&#8250;\0" \
"euro\0&#8364;\0"
#endif /* ndef entities_h */

View File

@@ -0,0 +1,560 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#include <assert.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#include "lex.h"
#include "misc.h"
#include "node.h"
#include "process.h"
struct file {
struct file *next;
const char *filename;
char *buf;
const char *pos, *end;
unsigned int linenum;
};
const char keywords[] = KEYWORDS;
static struct file *file, *firstfile;
static struct tok tok;
/***********************************************************************
* readinput : read all input files into memory
*
* Enter: argv = 0-terminated array of filenames
*/
void
readinput(const char *const *argv)
{
struct file **pfile = &file;
for (;;) {
struct file *file;
const char *filename = *argv++;
char *buf = 0;
int len = 0, thislen, isstdin;
FILE *handle;
if (!filename)
break;
/* Read the file. */
isstdin = !strcmp(filename, "-");
if (isstdin) {
handle = stdin;
filename = "<stdin>";
} else {
handle = fopen(filename, "rb");
if (!handle)
errorexit("%s: %s", filename, strerror(errno));
}
for (;;) {
thislen = len ? len * 2 : 4096;
buf = memrealloc(buf, len + thislen + 1);
thislen = fread(buf + len, 1, thislen, handle);
if (!thislen)
break;
len += thislen;
}
if (ferror(handle))
errorexit("%s: I/O error", filename);
if (!isstdin)
fclose(handle);
buf[len] = 0;
buf = memrealloc(buf, len + 1);
/* Create the file struct for it. */
file = memalloc(sizeof(struct file));
*pfile = file;
pfile = &file->next;
file->filename = filename;
file->pos = file->buf = buf;
file->end = buf + len;
file->linenum = 1;
}
*pfile = 0;
firstfile = file;
}
/***********************************************************************
* lexerrorexit : error and exit with line number
*/
static void
lexerrorexit(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vlocerrorexit(file->filename, file->linenum, format, ap);
va_end(ap);
}
/***********************************************************************
* lexblockcomment : lex a block comment
*
* Enter: start = start of comment
*
* Return: tok struct, lifetime until next call to lex
*/
static struct tok *
lexblockcomment(const char *start)
{
const char *p = start + 1;
tok.filename = file->filename;
tok.linenum = file->linenum;
for (;;) {
int ch = *++p;
if (!ch)
lexerrorexit("unterminated block comment");
if (ch != '*') {
if (ch == '\n')
file->linenum++;
continue;
}
ch = p[1];
if (!ch)
lexerrorexit("unterminated block comment");
if (ch == '/')
break;
}
p += 2;
file->pos = p;
tok.type = TOK_BLOCKCOMMENT;
tok.start = start + 2;
tok.len = p - start - 4;
return &tok;
}
/***********************************************************************
* lexinlinecomment : lex an inline comment
*
* Enter: start = start of comment, starts with "//"
*
* Return: tok struct, lifetime until next call to lex
*/
static struct tok *
lexinlinecomment(const char *start)
{
const char *p = start + 2;
p = start + 1;
for (;;) {
int ch = *++p;
if (!ch || ch == '\n')
break;
}
p++;
file->pos = p;
tok.type = TOK_INLINECOMMENT;
tok.start = start + 2;
tok.len = p - start - 2;
tok.filename = file->filename;
tok.linenum = file->linenum++;
return &tok;
}
/***********************************************************************
* lexnumber : lex a number (or just a '-' symbol)
*
* Enter: start = start of token
*
* Return: tok struct, lifetime until next call to lex
*
* The IDL grammar seems to say that a float can't start with a
* decimal point, so that's what we have implemented here.
*/
static struct tok *
lexnumber(const char *start)
{
for (;;) {
const char *p = start;
const char *octalend = start;
int ch = *p;
enum { STATE_START, STATE_INT, STATE_HEX, STATE_OCTAL, STATE_BADOCTAL,
STATE_DP, STATE_EXPSTART, STATE_EXPSIGN, STATE_EXP
} state = STATE_START;
if (ch == '-') {
ch = *++p;
if (ch == 'I') { // starts of Infinity
char * infinity = "-Infinity";
unsigned int len = strlen(infinity);
if (!memcmp(start, infinity, len)) {
tok.type = TOK_minusinfinity;
tok.start = start;
tok.len = len;
tok.filename = file->filename;
tok.linenum = file->linenum;
file->pos = start + len;
return &tok;
}
}
}
if (ch == '0') {
state = STATE_OCTAL;
ch = *++p;
if ((ch & ~0x20) == 'X') {
state = STATE_HEX;
ch = *++p;
}
}
for (;;) {
if ((unsigned)(ch - '0') >= 8) {
if ((ch & -2) == '8') {
if (state == STATE_OCTAL) {
state = STATE_BADOCTAL;
octalend = p;
}
} else if ((unsigned)((ch & ~0x20) - 'A') <= 'F' - 'A') {
if (state != STATE_HEX) {
if ((ch & ~0x20) != 'E')
break;
if (state == STATE_HEX || state >= STATE_EXPSTART || state == STATE_START)
break;
state = STATE_EXPSTART;
}
} else if (ch == '.') {
if (state == STATE_HEX || state >= STATE_DP)
break;
state = STATE_DP;
} else if (ch == '-') {
if (state != STATE_EXPSTART)
break;
state = STATE_EXPSIGN;
} else
break;
}
ch = *++p;
if (state == STATE_START)
state = STATE_INT;
else if (state == STATE_EXPSTART || state == STATE_EXPSIGN)
state = STATE_EXP;
}
switch (state) {
case STATE_START:
/* Must have just been a - character by itself. */
tok.type = '-';
p = start + 1;
break;
case STATE_BADOCTAL:
p = octalend;
/* fall through... */
case STATE_INT:
case STATE_OCTAL:
tok.type = TOK_INTEGER;
break;
case STATE_HEX:
if (p - start == 2 || (p - start == 3 && *start == '-'))
p = start + 1;
tok.type = TOK_INTEGER;
break;
case STATE_EXP:
case STATE_DP:
tok.type = TOK_FLOAT;
break;
case STATE_EXPSIGN:
p--;
/* fall through... */
case STATE_EXPSTART:
p--;
tok.type = TOK_FLOAT;
break;
}
tok.start = start;
tok.len = p - start;
tok.filename = file->filename;
tok.linenum = file->linenum;
file->pos = p;
return &tok;
}
}
/***********************************************************************
* lexstring : lex a quoted string
*
* Enter: start = start of token
*
* Return: tok struct, lifetime until next call to lex
*/
static struct tok *
lexstring(const char *start)
{
for (;;) {
const char *p = start + 1;
int ch = *p;
for (;;) {
if (!ch || ch == '\n')
lexerrorexit("unterminated string");
if (ch == '"') {
tok.type = TOK_STRING;
tok.start = start + 1;
tok.len = p - start - 1;
tok.filename = file->filename;
tok.linenum = file->linenum;
file->pos = p + 1;
return &tok;
}
/* Note the IDL spec doesn't seem to allow for escape sequences
* in strings. */
ch = *++p;
}
}
}
/***********************************************************************
* lexidentifier : lex an identifier
*
* Enter: start = start of token
*
* Return: tok struct, lifetime until next call to lex
*/
static struct tok *
lexidentifier(const char *start)
{
const char *p = start + 1;
for (;;) {
int ch = *p;
if (ch != '_' && (unsigned)(ch - '0') >= 10
&& (unsigned)((ch & ~0x20) - 'A') > 'Z' - 'A')
{
break;
}
p++;
}
tok.type = TOK_IDENTIFIER;
tok.start = start;
tok.len = p - start;
tok.filename = file->filename;
tok.linenum = file->linenum;
file->pos = p;
/* See if this is a keyword. (This search is a bit n-squared.) */
{
unsigned int type = TOK_DOMString;
p = keywords;
for (;;) {
unsigned int len = strlen(p);
if (!len)
break;
if (len == tok.len && !memcmp(start, p, len)) {
tok.type = type;
break;
}
p += len + 1;
type++;
}
}
return &tok;
}
/***********************************************************************
* lex : retrieve next token
*
* Return: tok struct, lifetime until next call to lex
*/
struct tok *
lex(void)
{
const char *p;
int ch;
for (;;) {
if (!file) {
tok.type = TOK_EOF;
tok.start = "end of file";
tok.len = strlen(tok.start);
return &tok;
}
tok.prestart = p = file->pos;
/* Flush whitespace. */
for (;;) {
ch = *p++;
switch (ch) {
case ' ':
case '\t':
case '\r':
continue;
case '\n':
++file->linenum;
tok.prestart = p;
continue;
}
break;
}
p--;
if (ch)
break;
if (p != file->end)
lexerrorexit("\\0 byte not allowed");
file = file->next;
}
/* See if we have a comment. */
tok.start = p;
if (ch == '/') {
switch (*++p) {
case '*':
return lexblockcomment(p - 1);
case '/':
return lexinlinecomment(p - 1);
}
tok.type = '/';
} else {
/* Handle things that start with '-', which is either '-' as a token,
* or a number. Handle numbers. */
if (ch == '-' || (unsigned)(ch - '0') < 10)
return lexnumber(p);
/* Handle string. */
if (ch == '"')
return lexstring(p);
/* Handle identifier. */
if (ch == '_' || (unsigned)((ch & ~0x20) - 'A') <= 'Z' - 'A')
return lexidentifier(p);
/* The only multi-symbol token are ... and [] */
if (ch == '.') {
tok.type = '.';
if (*++p == '.' && p[1] == '.') {
tok.type = TOK_ELLIPSIS;
p += 2;
}
goto done;
}
if (ch == '[') {
tok.type = '[';
if (*++p == ']') {
tok.type = TOK_DOUBLEBRACKET;
p++;
}
goto done;
}
}
/* Single symbol token. */
tok.type = ch;
p++;
done:
tok.filename = file->filename;
tok.linenum = file->linenum;
tok.len = p - tok.start;
file->pos = p;
return &tok;
}
/***********************************************************************
* outputwidl : output literal Web IDL input that node was parsed from
*
* Enter: node = parse node to output literal Web IDL for
*/
void
outputwidl(struct node *node)
{
const char *start = node->wsstart, *end = node->end;
/* Find the file that start is in. */
struct file *file = firstfile;
while (start < file->buf || start >= file->end) {
file = file->next;
assert(file);
}
/* Find the (current or) next node that has node->start set. Any such
* node needs to be put inside a <ref> element. */
while (node && !node->start)
node = nodewalk(node);
/* Output until we get to the end. This has to cope with the text
* spanning multiple input files. */
for (;;) {
int final = end >= file->buf && end <= file->end;
const char *thisend = final ? end : file->end;
/* Output the Web IDL, omitting comments. */
while (start != end) {
const char *p, *p2, *comment, *endcomment;
int ch;
if (node && start == node->start) {
/* We are on the start of the present node in the tree
* walk. Put it in a <ref>. */
fputs("<ref>", stdout);
printtext(node->start, node->end - node->start, 1);
fputs("</ref>", stdout);
start = node->end;
/* Skip to the next node with node->start set if any. */
do
node = nodewalk(node);
while (node && !node->start);
continue;
}
p2 = thisend;
if (node && node->start >= file->buf && node->start < p2)
p2 = node->start;
p = memchr(start, '/', p2 - start);
if (!p) {
printtext(start, p2 - start, 1);
if (p2 != thisend) {
start = p2;
continue;
}
break;
}
/* See if we're at the start of a comment. If so find the end. */
comment = 0;
if (p + 1 != thisend) {
switch (p[1]) {
case '*':
/* Block comment. */
comment = p;
p++;
do
p = memchr(p + 1, '*', thisend - p - 1);
while (p[1] != '/');
endcomment = p + 2;
break;
case '/':
/* Inline comment. */
comment = p;
p = memchr(p, '\n', thisend - p);
if (!p)
p = thisend;
endcomment = p;
break;
}
}
if (!comment) {
/* Not at start of comment. */
p++;
printtext(start, p - start, 1);
start = p;
assert(start <= end);
continue;
}
/* If the comment has only whitespace before it on the line,
* eat that up. */
p = comment;
while (p != start && ((ch = p[-1]) == ' ' || ch == '\t'))
p--;
if (p == start || p[-1] == '\n') {
comment = p;
/* If the comment has only whitespace after it to the end
* of the line, eat that and the newline up. This always
* happens for an inline comment on a line by itself. */
p = endcomment;
while (p != thisend && ((ch = *p) == ' ' || ch == '\t'))
p++;
if (p != thisend && *p == '\n')
p++;
endcomment = p;
}
printtext(start, comment - start, 1);
start = endcomment;
if (start > thisend)
start = thisend;
}
if (final)
break;
file = file->next;
assert(file);
start = file->buf;
}
}

View File

@@ -0,0 +1,141 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef lex_h
#define lex_h
// starting from "attribute" are the list of names allowed as arguments identifier
#define KEYWORDS \
"DOMString\0" \
"ByteString\0" \
"Date\0" \
"RegExp\0" \
"false\0" \
"object\0" \
"true\0" \
"any\0" \
"boolean\0" \
"byte\0" \
"double\0" \
"float\0" \
"Infinity\0" \
"-Infinity\0" \
"iterator\0" \
"long\0" \
"NaN\0" \
"null\0" \
"octet\0" \
"optional\0" \
"or\0" \
"readonly\0" \
"sequence\0" \
"short\0" \
"unsigned\0" \
"void\0" \
"attribute\0" \
"callback\0" \
"const\0" \
"creator\0" \
"deleter\0" \
"dictionary\0" \
"enum\0" \
"exception\0" \
"getter\0" \
"implements\0" \
"inherit\0" \
"interface\0" \
"legacycaller\0" \
"partial\0" \
"serializer\0" \
"setter\0" \
"static\0" \
"stringifier\0" \
"typedef\0" \
"unrestricted\0"
enum toktype {
TOK_EOF = -1,
TOK_BLOCKCOMMENT = 0x80,
TOK_INLINECOMMENT, TOK_INTEGER, TOK_FLOAT, TOK_IDENTIFIER,
TOK_STRING, TOK_ELLIPSIS, TOK_DOUBLEBRACKET,
/* Keywords must be in the same order as above. */
TOK_DOMString,
TOK_ByteString,
TOK_Date,
TOK_RegExp,
TOK_false,
TOK_object,
TOK_true,
TOK_any,
TOK_boolean,
TOK_byte,
TOK_double,
TOK_float,
TOK_infinity,
TOK_minusinfinity,
TOK_iterator,
TOK_long,
TOK_NaN,
TOK_null,
TOK_octet,
TOK_optional,
TOK_or,
TOK_readonly,
TOK_sequence,
TOK_short,
TOK_unsigned,
TOK_void,
/* Below that line are keywords that are allowed as arguments names */
TOK_attribute,
TOK_callback,
TOK_const,
TOK_creator,
TOK_deleter,
TOK_dictionary,
TOK_enum,
TOK_exception,
TOK_getter,
TOK_implements,
TOK_inherit,
TOK_interface,
TOK_legacycaller,
TOK_partial,
TOK_serializer,
TOK_setter,
TOK_static,
TOK_stringifier,
TOK_typedef,
TOK_unrestricted,
};
struct tok {
enum toktype type;
const char *filename;
unsigned int linenum;
const char *prestart;
const char *start;
unsigned int len;
};
extern const char *filename;
extern const char keywords[];
struct node;
void readinput(const char *const *argv);
struct tok *lex(void);
void outputwidl(struct node *node);
#endif /* ndef lex_h */

View File

@@ -0,0 +1,63 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#include <string.h>
#include "misc.h"
#include "process.h"
static const char nodtdopt[] = "-no-dtd-ref";
const char *progname;
/***********************************************************************
* options : process command line options
*
* Enter: argv
*
* Return: argv stepped to point to first non-option argument
*/
static const char *const *
options(int argc, const char *const *argv)
{
/* Set progname for error messages etc. */
{
const char *base;
progname = argv[0];
base = strrchr(progname, '/');
#ifdef DIRSEP
{
const char *base2 = strrchr(base, '\\');
if (base2 > base)
base = base2;
}
#endif /* def DIRSEP */
if (base)
progname = base + 1;
}
return (argc > 1 && strncmp(argv[1], nodtdopt, sizeof nodtdopt) == 0)
? argv + 2 : argv + 1;
}
/***********************************************************************
* main : main code for bondiidl command
*/
int
main(int argc, char **argv)
{
const char *const *parg;
parg = options(argc, (const char *const *)argv);
if (!*parg)
errorexit("usage: %s [-no-dtd-ref] <interface>.widl ...", progname);
processfiles(parg, parg == (const char *const *)argv + 1);
return 0;
}

View File

@@ -0,0 +1,119 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "misc.h"
#include "os.h" /* to get va_copy on windows */
extern const char *progname;
/***********************************************************************
* memory allocation wrappers
*/
void *
memalloc(size_t size)
{
void *ptr = malloc(size);
if (!ptr)
errorexit("out of memory");
/* Zero initialise memory from memalloc. */
memset(ptr, 0, size);
return ptr;
}
void *
memrealloc(void *ptr, size_t size)
{
void *newptr = realloc(ptr, size);
if (!newptr)
errorexit("out of memory");
return newptr;
}
void
memfree(void *ptr)
{
*(int *)ptr = 0xfefefefe;
free(ptr);
}
/***********************************************************************
* vmemprintf, memprintf : allocate buffer and sprintf into it
*/
char *
memprintf(const char *format, ...)
{
va_list ap;
char *buf;
va_start(ap, format);
buf = vmemprintf(format, ap);
va_end(ap);
return buf;
}
char *
vmemprintf(const char *format, va_list ap)
{
char *buf;
unsigned int max, len;
va_list ap2;
max = 16;
for (;;) {
va_copy(ap2, ap);
buf = memalloc(max);
len = vsnprintf(buf, max, format, ap2);
va_end(ap2);
if (len < max)
break;
memfree(buf);
max *= 2;
}
return buf;
}
/***********************************************************************
* errorexit : print error message then exit
*/
void
vlocerrorexit(const char *filename, unsigned int linenum,
const char *format, va_list ap)
{
if (filename)
fprintf(stderr, linenum ? "%s: %i: " : "%s: ", filename, linenum);
vfprintf(stderr, format, ap);
fputc('\n', stderr);
exit(1);
}
void
locerrorexit(const char *filename, unsigned int linenum,
const char *format, ...)
{
va_list ap;
va_start(ap, format);
vlocerrorexit(filename, linenum, format, ap);
va_end(ap);
}
void
errorexit(const char *format, ...)
{
va_list ap;
va_start(ap, format);
vlocerrorexit(0, 0, format, ap);
va_end(ap);
}

View File

@@ -0,0 +1,31 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef misc_h
#define misc_h
#include <stdarg.h>
#include <stdlib.h>
void *memalloc(size_t size);
void *memrealloc(void *ptr, size_t size);
void memfree(void *ptr);
char *vmemprintf(const char *format, va_list ap);
char *memprintf(const char *format, ...);
void vlocerrorexit(const char *filename, unsigned int linenum, const char *format, va_list ap);
void locerrorexit(const char *filename, unsigned int linenum, const char *format, ...);
void errorexit(const char *format, ...);
#endif /* ndef misc_h */

View File

@@ -0,0 +1,331 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* Node-specific functions
***********************************************************************/
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "comment.h"
#include "lex.h"
#include "misc.h"
#include "node.h"
#include "process.h"
struct node *
newelement(const char *name)
{
struct element *element = memalloc(sizeof(struct element));
element->n.type = NODE_ELEMENT;
element->name = name;
return &element->n;
}
struct node *
newattr(const char *name, const char *val)
{
struct attr *attr = memalloc(sizeof(struct attr));
attr->n.type = NODE_ATTR;
attr->name = name;
attr->value = val;
return &attr->n;
}
struct node *
newattrlist(void)
{
struct attrlist *attrlist = memalloc(sizeof(struct attrlist));
attrlist->n.type = NODE_ATTRLIST;
return &attrlist->n;
}
/***********************************************************************
* addnode : add node as child of another node
*
* Enter: parent node
* child node
*
* The children list is constructed backwards. This is fixed later with
* a call to reversechildren.
*
* If child is an attrlist, its children are added to parent and the
* attrlist is freed.
*/
void
addnode(struct node *parent, struct node *child)
{
if (!child)
return;
if (child->type == NODE_ATTRLIST) {
/* Add the attrs in the attrlist to parent. */
struct node *child2;
reversechildren(child);
child2 = child->children;
memfree(child);
while (child2) {
struct node *next = child2->next;
addnode(parent, child2);
child2 = next;
}
} else {
child->next = parent->children;
parent->children = child;
child->parent = parent;
}
}
/***********************************************************************
* reversechildren : recursively reverse child lists
*
* Also sets parent field on each node.
*/
void
reversechildren(struct node *node)
{
struct node *newlist = 0;
struct node *child = node->children;
while (child) {
struct node *next = child->next;
child->parent = node;
child->next = newlist;
newlist = child;
reversechildren(child);
child = next;
}
node->children = newlist;
}
/***********************************************************************
* nodeisempty : test if node is empty (has no children)
*/
int
nodeisempty(struct node *node)
{
return !node->children;
}
/***********************************************************************
* nodewalk : single step of depth last traversal of node tree
*
* Return: next node in walk, 0 if finished
*/
struct node *
nodewalk(struct node *node)
{
if (node->children)
return node->children;
if (node->next)
return node->next;
do {
node = node->parent;
if (!node)
return 0;
} while (!node->next);
return node->next;
}
/***********************************************************************
* findchildelement : find child element of a particular name
*
* Enter: node = element
* name = name to find
*
* Return: 0 else child element of that name
*/
static struct node *
findchildelement(struct node *node, const char *name)
{
node = node->children;
while (node) {
if (node->type == NODE_ELEMENT) {
struct element *element = (void *)node;
if (!strcmp(element->name, name))
break;
}
node = node->next;
}
return node;
}
/***********************************************************************
* getattr : get value of attribute
*
* Enter: node = element to find attribute in
* name = name of attribute
*
* Return: 0 if not found, else 0-terminated string value
*/
const char *
getattr(struct node *node, const char *name)
{
node = node->children;
while (node) {
if (node->type == NODE_ATTR) {
struct attr *attr = (void *)node;
if (!strcmp(attr->name, name))
return attr->value;
}
node = node->next;
}
return 0;
}
/***********************************************************************
* findchildelementwithnameattr : find child element with a name attribute
* of a particular value
*
* Enter: node = element
* name = name to find
*
* Return: 0 else child element with name attr of that value
*/
static struct node *
findchildelementwithnameattr(struct node *node, const char *name)
{
node = node->children;
while (node) {
if (node->type == NODE_ELEMENT) {
const char *s = getattr(node, "name");
if (s && !strcmp(s, name))
break;
}
node = node->next;
}
return node;
}
/***********************************************************************
* findreturntype : find Type parse node for return type
*
* Enter: node = Operation element
*
* Return: 0 if not found, else Type parse node for return type
*/
struct node *
findreturntype(struct node *node)
{
return findchildelement(node, "Type");
}
/***********************************************************************
* findparamidentifier : find identifier parse node for parameter
*
* Enter: node = Operation element
* name = parameter name to find
*
* Return: 0 if not found, else node struct for parameter identifier
*/
struct node *
findparamidentifier(struct node *node, const char *name)
{
node = findchildelement(node, "ArgumentList");
if (node)
node = findchildelementwithnameattr(node, name);
return node;
}
/***********************************************************************
* findthrowidentifier : find identifier parse node for exception name
*
* Enter: node = Operation element
* name = exception name to find
*
* Return: 0 if not found, else node for Name element, child of Raises
* or SetRaises
*/
struct node *
findthrowidentifier(struct node *node, const char *name)
{
struct node *node2 = findchildelement(node, "Raises");
if (node2)
node2 = findchildelementwithnameattr(node2, name);
if (!node2) {
node2 = findchildelement(node, "SetRaises");
if (node2)
node2 = findchildelementwithnameattr(node2, name);
}
return node2;
}
/***********************************************************************
* outputid : output the id of a node
*/
static void
outputid(struct node *node)
{
if (node->parent)
outputid(node->parent);
if (node->id) {
fputs("::", stdout);
printtext(node->id, strlen(node->id), 1);
}
}
/***********************************************************************
* outputnode : output node and its children
*
* Enter: node = node to output, assumed to be an element
* indent
*/
void
outputnode(struct node *node, unsigned int indent)
{
struct element *element = (void *)node;
struct node *child;
int empty = 1;
printf("%*s<%s", indent, "", element->name);
child = element->n.children;
while (child) {
switch(child->type) {
case NODE_ELEMENT:
empty = 0;
break;
case NODE_ATTR:
{
struct attr *attr = (void *)child;
printf(" %s=\"", attr->name);
printtext(attr->value, strlen(attr->value), 1);
printf("\"");
}
break;
}
child = child->next;
}
if (node->id) {
printf(" id=\"");
outputid(node);
printf("\"");
}
if (!empty || node->comments || node->wsstart) {
printf(">\n");
if (node->wsstart) {
printf("%*s <webidl>", indent, "");
outputwidl(node);
printf("</webidl>\n");
}
outputdescriptive(node, indent + 2);
child = element->n.children;
while (child) {
switch(child->type) {
case NODE_ELEMENT:
outputnode(child, indent + 2);
break;
}
child = child->next;
}
printf("%*s</%s>\n", indent, "", element->name);
} else
printf("/>\n");
}

View File

@@ -0,0 +1,65 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef node_h
#define node_h
/* struct node : a node in the parse tree (excluding comments) */
enum { NODE_ELEMENT, NODE_ATTR, NODE_ATTRLIST };
struct node {
int type;
struct node *next;
struct node *parent;
struct node *children;
struct comment *comments; /* list of comments attached to this node */
/* If wsstart and end are set, they give the literal Web IDL that can
* be output in a <webidl> element. */
const char *wsstart;
/* If start and end are set, they give the text of a scoped name that
* can be enclosed in a <ref> when outputting a <webidl> element for
* an ancestor element. */
const char *start;
const char *end;
const char *id;
};
struct element {
struct node n;
const char *name;
};
struct attr {
struct node n;
const char *name;
const char *value;
};
struct attrlist {
struct node n;
};
struct node *newelement(const char *name);
struct node *newattr(const char *name, const char *val);
struct node *newattrlist(void);
void addnode(struct node *parent, struct node *child);
void reversechildren(struct node *node);
int nodeisempty(struct node *node);
const char *getattr(struct node *node, const char *name);
struct node *nodewalk(struct node *node);
struct node *findreturntype(struct node *node);
struct node *findparamidentifier(struct node *node, const char *name);
struct node *findthrowidentifier(struct node *node, const char *name);
void outputnode(struct node *node, unsigned int indent);
#endif /* ndef node_h */

View File

@@ -0,0 +1,31 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef os_h
#define os_h
/* Linux configuration */
#if defined(__gnu_linux__)
/* Windows configuration */
#elif defined(_MSC_VER)
#define inline __inline
#define strncasecmp strnicmp
#define snprintf _snprintf
#define va_copy(a,b) ((a)=(b))
#endif
#endif /* ndef os_h */

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,19 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef parse_h
#define parse_h
struct node *parse(void);
#endif /* ndef parse_h */

View File

@@ -0,0 +1,319 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#include <assert.h>
#include <stdio.h>
#include <string.h>
#include "comment.h"
#include "lex.h"
#include "misc.h"
#include "node.h"
#include "os.h"
#include "parse.h"
#include "process.h"
#if 0
static const char ntnames[] = { NTNAMES };
#endif /*0*/
/***********************************************************************
* printtext : print text with xml entity escapes
*
* Enter: s = text
* len = number of bytes
* escamp = whether to escape &
*
* This also escapes double quote mark so it can be used for an
* attribute value. It also turns a tab into spaces.
*/
void
printtext(const char *s, unsigned int len, int escamp)
{
const char *p = s, *end = s + len;
unsigned int count = 0;
while (p != end) {
int ch = *p;
char buf[9];
const char *seq = 0;
count++;
switch (ch) {
case '<':
seq = "&lt;";
break;
case '&':
seq = escamp ? "&amp;" : "&";
break;
case '"':
seq = "&quot;";
break;
case '\n':
p++;
count = 0;
continue;
case '\t':
seq = " " + ((count - 1) & 7);
count = 0;
break;
default:
if ((unsigned char)ch >= 0x20) {
p++;
continue;
}
snprintf(buf, 9, "&#%i;", ch);
seq = buf;
break;
}
if (p - s != fwrite(s, 1, p - s, stdout))
errorexit("write error");
fputs(seq, stdout);
s = ++p;
}
if (p - s != fwrite(s, 1, p - s, stdout))
errorexit("write error");
}
#if 0
/***********************************************************************
* outputnodeastext : output parse node and descendants as deparsed text
*
* Enter: node = parse node
* needspace = true if last output char was an identifier char
*
* Return: updated needspace value
*/
static int
outputnodeastext(struct node *node, int needspace)
{
if (node->type >= NT_START) {
struct node *child = node->children;
while (child) {
needspace = outputnodeastext(child, needspace);
child = child->next;
}
} else {
unsigned int len = strlen(node->name);
if (len) {
int ch = node->name[0];
if (ch == '_' || ((unsigned)(ch - '0') < 10
|| (unsigned)((ch & ~0x20) - 'A') < 26))
{
if (needspace) putchar(' ');
}
ch = node->name[len - 1];
if (ch == '_' || ((unsigned)(ch - '0') < 10
|| (unsigned)((ch & ~0x20) - 'A') < 26))
{
needspace = 1;
}
printtext(node->name, len, 1);
}
}
return needspace;
}
/***********************************************************************
* printfqid : print fully-qualified id
*
* Enter: node struct
*
* Return: whether anything printed
*/
static int
printfqid(struct node *node)
{
int any = 0;
struct node *identifier;
if (node->parent) {
any = printfqid(node->parent);
}
switch (node->type) {
case NT_Module:
case NT_Interface:
case NT_Typedef:
case NT_Operation:
case NT_Attribute:
case NT_Const:
if (any)
printf(":");
/* Find identifier child if any. */
identifier = node->children;
while (identifier) {
if (identifier->type == TOK_IDENTIFIER)
break;
if (identifier->type == NT_TypedefRest) {
identifier = identifier->children;
continue;
}
identifier = identifier->next;
}
if (identifier) {
printtext(identifier->name, strlen(identifier->name), 1);
any = 1;
}
break;
}
return any;
}
/***********************************************************************
* output : output subtree of parse tree
*
* Enter: node = root of subtree
* extendedattributelist = 0 else extended attribute list node
* applying to node
* indent = indent (nesting) level
*/
static void outputchildren(struct node *node, struct node *identifier, unsigned int indent);
static void
output(struct node *node, struct node *extendedattributelist,
unsigned int indent)
{
if (extendedattributelist) {
node->wsstart = extendedattributelist->wsstart;
node->start = extendedattributelist->start;
}
if (node->type == NT_ExtendedAttribute) {
printf("%*s<ExtendedAttribute value=\"", indent, "");
outputnodeastext(node, 0);
printf("\"/>\n");
} else if (node->type == NT_BooleanLiteral) {
printf("%*s<BooleanLiteral value=\"%s\"/>", indent, "",
node->children->name);
} else if (node->type == NT_ReadOnly) {
printf("%*s<ReadOnly/>\n", indent, "");
} else if (node->type >= NT_START) {
const char *ntname;
/* Find identifier child if any. */
struct node *identifier = node->children;
while (identifier) {
if (identifier->type == TOK_IDENTIFIER)
break;
identifier = identifier->next;
}
/* Find nonterminal name. */
ntname = ntnames + 2;
while (node->type - NT_START != ((unsigned char)ntname[-2] | (unsigned char)ntname[-1] << 8))
ntname += strlen(ntname) + 3;
/* Output start of element. */
printf("%*s<%s", indent, "", ntname);
/* Output identifier if any as attribute. */
if (identifier) {
printf(" identifier=\"");
printtext(identifier->name, strlen(identifier->name), 1);
printf("\"");
}
switch (node->type) {
case NT_Module:
case NT_Interface:
case NT_Typedef:
case NT_Const:
/* Output fully qualified id. */
printf(" fqid=\"");
printfqid(node);
printf("\"");
break;
}
if (!identifier && !extendedattributelist && !node->children && !node->comments)
printf("/>\n");
else {
printf(">\n");
/* Output descriptive elements (doxygen comments) for node. */
outputdescriptive(node, indent + 2);
/* Output descriptive elements (doxygen comments) for identifier. */
if (identifier)
outputdescriptive(identifier, indent + 2);
/* Output extended attribute list. */
if (extendedattributelist)
output(extendedattributelist, 0, indent + 2);
/* Output children (excluding identifier child). */
outputchildren(node, identifier, indent + 2);
printf("%*s</%s>\n", indent, "", ntname);
}
} else switch (node->type) {
case TOK_DOMString:
case TOK_any:
case TOK_boolean:
case TOK_octet:
case TOK_float:
case TOK_double:
case TOK_Object:
case TOK_unsigned:
case TOK_short:
case TOK_long:
case TOK_void:
printf("%*s<%s/>\n", indent, "", node->name);
break;
case TOK_INTEGER:
printf("%*s<integer value=\"", indent, "");
printtext(node->name, strlen(node->name), 1);
printf("\"/>\n");
break;
case TOK_FLOAT:
printf("%*s<Float value=\"", indent, "");
printtext(node->name, strlen(node->name), 1);
printf("\"/>\n");
break;
case TOK_STRING:
printf("%*s<string value=\"", indent, "");
printtext(node->name, strlen(node->name), 1);
printf("\"/>\n");
break;
}
}
/***********************************************************************
* outputchildren : call output for each child of node
*
* Enter: node
* identifier = child node to omit from output
* indent = indent (nesting) level
*/
static void
outputchildren(struct node *node, struct node *identifier, unsigned int indent)
{
struct node *extendedattributelist;
struct node *child;
child = node->children;
extendedattributelist = 0;
while (child) {
if (child->type == NT_ExtendedAttributeList && node->type != NT_Argument)
extendedattributelist = child;
else {
if (identifier != child)
output(child, extendedattributelist, indent);
extendedattributelist = 0;
}
child = child->next;
}
}
#endif /*0*/
/***********************************************************************
* processfiles : process input files
*
* Enter: name = filename
*/
void
processfiles(const char *const *names, int dtdref)
{
struct node *root;
readinput(names);
root = parse();
processcomments(root);
printf("<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n");
if(dtdref)
printf("<!DOCTYPE Definitions SYSTEM \"widlprocxml.dtd\">\n");
outputnode(root, 0);
}

View File

@@ -0,0 +1,27 @@
/***********************************************************************
* $Id$
* Copyright 2009 Aplix Corporation. All rights reserved.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
***********************************************************************/
#ifndef process_h
#define process_h
#if 0
#define NT_START 0x100
#include "nonterminals.h"
#endif/*0*/
void printtext(const char *s, unsigned int len, int escamp);
void processfiles(const char *const *names, int dtdref);
#endif /* ndef process_h */

View File

@@ -0,0 +1,828 @@
<?xml version="1.0" encoding="utf-8"?>
<!--====================================================================
$Id: widlprocxmltohtml.xsl 407 2009-10-26 13:48:48Z tpr $
Copyright 2009 Aplix Corporation. All rights reserved.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
XSLT stylesheet to convert widlprocxml into html documentation.
=====================================================================-->
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" encoding="utf-8" indent="yes" doctype-public="html"/>
<xsl:param name="date" select="'error: missing date'"/>
<xsl:variable name="title" select="concat('The ',/Definitions/descriptive/name,' Module - Version ',/Definitions/descriptive/version)"/>
<!--Root of document.-->
<xsl:template match="/">
<html>
<head>
<link rel="stylesheet" type="text/css" href="widlhtml.css" media="screen"/>
<title>
<xsl:value-of select="$title"/>
</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<!--Root of Definitions.-->
<xsl:template match="Definitions">
<div class="api" id="{@id}">
<a href="http://bondi.omtp.org"><img src="http://www.omtp.org/images/BondiSmall.jpg" alt="Bondi logo"/></a>
<h1><xsl:value-of select="$title"/></h1>
<h3>12 May 2009</h3>
<h2>Authors</h2>
<ul class="authors">
<xsl:apply-templates select="descriptive/author"/>
</ul>
<p class="copyright"><small>© The authors, 2012. All rights reserved.</small></p>
<hr/>
<h2>Abstract</h2>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive/description"/>
<xsl:apply-templates select="descriptive/Code"/>
<h2>Table of Contents</h2>
<ul class="toc">
<li><a href="#intro">Introduction</a>
<ul>
<xsl:if test="descriptive/def-api-feature-set">
<li><a href="#def-api-feature-sets">Feature set</a></li>
</xsl:if>
<xsl:if test="descriptive/def-api-feature">
<li><a href="#def-api-features">Features</a></li>
</xsl:if>
<xsl:if test="descriptive/def-device-cap">
<li><a href="#def-device-caps">Device Capabilities</a></li>
</xsl:if>
</ul>
</li>
<xsl:if test="Typedef">
<li><a href="#typedefs">Type Definitions</a>
<ul class="toc">
<xsl:for-each select="Typedef[descriptive]">
<li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="Interface">
<li><a href="#interfaces">Interfaces</a>
<ul class="toc">
<xsl:for-each select="Interface[descriptive]">
<li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="Dictionary">
<li><a href="#dictionaries">Dictionary types</a>
<ul class="toc">
<xsl:for-each select="Dictionary[descriptive]">
<li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="Callback">
<li><a href="#callbacks">Callbacks</a>
<ul class="toc">
<xsl:for-each select="Callback[descriptive]">
<li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
<xsl:if test="Enum">
<li><a href="#enums">Enums</a>
<ul class="toc">
<xsl:for-each select="Enum[descriptive]">
<li><a href="#{@id}"><code><xsl:value-of select="@name"/></code></a></li>
</xsl:for-each>
</ul>
</li>
</xsl:if>
</ul>
<hr/>
<h2>Summary of Methods</h2>
<xsl:call-template name="summary"/>
<h2 id="intro">Introduction</h2>
<xsl:apply-templates select="descriptive/description"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:if test="descriptive/def-api-feature-set">
<div id="def-api-feature-sets" class="def-api-feature-sets">
<h3 id="features">Feature set</h3>
<p>This is the URI used to declare this API's feature set, for use in bondi.requestFeature. For the URL, the list of features included by the feature set is provided.</p>
<xsl:apply-templates select="descriptive/def-api-feature-set"/>
</div>
</xsl:if>
<xsl:if test="descriptive/def-api-feature">
<div id="def-api-features" class="def-api-features">
<h3 id="features">Features</h3>
<p>This is the list of URIs used to declare this API's features, for use in bondi.requestFeature. For each URL, the list of functions covered is provided.</p>
<xsl:apply-templates select="Interface/descriptive/def-instantiated"/>
<xsl:apply-templates select="descriptive/def-api-feature"/>
</div>
</xsl:if>
<xsl:if test="descriptive/def-device-cap">
<div class="def-device-caps" id="def-device-caps">
<h3>Device capabilities</h3>
<dl>
<xsl:apply-templates select="descriptive/def-device-cap"/>
</dl>
</div>
</xsl:if>
<xsl:if test="Typedef">
<div class="typedefs" id="typedefs">
<h2>Type Definitions</h2>
<xsl:apply-templates select="Typedef[descriptive]"/>
</div>
</xsl:if>
<xsl:if test="Interface">
<div class="interfaces" id="interfaces">
<h2>Interfaces</h2>
<xsl:apply-templates select="Interface"/>
</div>
</xsl:if>
<xsl:if test="Dictionary">
<div class="dictionaries" id="dictionaries">
<h2>Dictionary types</h2>
<xsl:apply-templates select="Dictionary"/>
</div>
</xsl:if>
<xsl:if test="Callback">
<div class="callbacks" id="callbacks">
<h2>Callbacks</h2>
<xsl:apply-templates select="Callback"/>
</div>
</xsl:if>
<xsl:if test="Enum">
<div class="enums" id="enums">
<h2>Enums</h2>
<xsl:apply-templates select="Enum"/>
</div>
</xsl:if>
</div>
</xsl:template>
<!--def-api-feature-set-->
<xsl:template match="def-api-feature-set">
<dl class="def-api-feature-set">
<dt><xsl:value-of select="@identifier"/></dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:if test="descriptive/api-feature">
<div class="api-features">
<p>
Includes API features:
</p>
<ul>
<xsl:for-each select="descriptive/api-feature">
<li><code><xsl:value-of select="@identifier"/></code></li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</dd>
</dl>
</xsl:template>
<!--def-api-feature-->
<xsl:template match="def-api-feature">
<dl class="def-api-feature">
<dt><xsl:value-of select="@identifier"/></dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:if test="descriptive/device-cap">
<div class="device-caps">
<p>
Device capabilities:
</p>
<ul>
<xsl:for-each select="descriptive/device-cap">
<li><code><xsl:value-of select="@identifier"/></code></li>
</xsl:for-each>
</ul>
</div>
</xsl:if>
</dd>
</dl>
</xsl:template>
<!--def-device-cap-->
<xsl:template match="def-device-cap">
<dt class="def-device-cap"><code><xsl:value-of select="@identifier"/></code></dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:if test="descriptive/param">
<div class="device-caps">
<p>Security parameters:</p>
<ul>
<xsl:apply-templates select="descriptive/param"/>
</ul>
</div>
</xsl:if>
</dd>
</xsl:template>
<!--Exception: not implemented-->
<!--Valuetype: not implemented-->
<xsl:template match="Exception|Valuetype|Const">
<xsl:if test="descriptive">
<xsl:message terminate="yes">element <xsl:value-of select="name()"/> not supported</xsl:message>
</xsl:if>
</xsl:template>
<!--Typedef.-->
<xsl:template match="Typedef[descriptive]">
<div class="typedef" id="{@id}">
<h3>2.<xsl:number value="position()"/>. <code><xsl:value-of select="@name"/></code></h3>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
</div>
</xsl:template>
<!--Interface.-->
<xsl:template match="Interface[descriptive]">
<xsl:variable name="name" select="@name"/>
<div class="interface" id="{@id}">
<h3><code><xsl:value-of select="@name"/></code></h3>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="../Implements[@name2=$name]/webidl"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:apply-templates select="InterfaceInheritance"/>
<xsl:if test="Const/descriptive">
<div class="consts">
<h4>Constants</h4>
<dl>
<xsl:apply-templates select="Const"/>
</dl>
</div>
</xsl:if>
<xsl:if test="ExtendedAttributeList/ExtendedAttribute/descriptive">
<div class="constructors">
<h4>Constructors</h4>
<dl>
<xsl:apply-templates select="ExtendedAttributeList/ExtendedAttribute"/>
</dl>
</div>
</xsl:if>
<xsl:if test="Attribute/descriptive">
<div class="attributes">
<h4>Attributes</h4>
<dl>
<xsl:apply-templates select="Attribute"/>
</dl>
</div>
</xsl:if>
<xsl:if test="Operation/descriptive">
<div class="methods">
<h4>Methods</h4>
<dl>
<xsl:apply-templates select="Operation"/>
</dl>
</div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="Interface[not(descriptive)]">
</xsl:template>
<!--Dictionary.-->
<xsl:template match="Dictionary[descriptive]">
<xsl:variable name="name" select="@name"/>
<div class="dictionary" id="{@id}">
<h3><code><xsl:value-of select="@name"/></code></h3>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:apply-templates select="InterfaceInheritance"/>
<xsl:if test="Const/descriptive">
<div class="consts">
<h4>Constants</h4>
<dl>
<xsl:apply-templates select="Const"/>
</dl>
</div>
</xsl:if>
<xsl:if test="Attribute/descriptive">
<div class="attributes">
<h4>Attributes</h4>
<dl>
<xsl:apply-templates select="Attribute"/>
</dl>
</div>
</xsl:if>
</div>
</xsl:template>
<xsl:template match="Dictionary[not(descriptive)]">
</xsl:template>
<xsl:template match="InterfaceInheritance/ScopedNameList">
<p>
<xsl:text>This interface inherits from: </xsl:text>
<xsl:for-each select="Name">
<code><xsl:value-of select="@name"/></code>
<xsl:if test="position!=last()">, </xsl:if>
</xsl:for-each>
</p>
</xsl:template>
<!--Attribute-->
<xsl:template match="Attribute">
<dt class="attribute" id="{@name}">
<code>
<xsl:if test="@stringifier">
stringifier
</xsl:if>
<xsl:if test="@readonly">
readonly
</xsl:if>
<xsl:apply-templates select="Type"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
</code></dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="GetRaises"/>
<xsl:apply-templates select="SetRaises"/>
<xsl:apply-templates select="descriptive/Code"/>
</dd>
</xsl:template>
<!--Const-->
<xsl:template match="Const">
<dt class="const" id="{@id}">
<code>
<xsl:apply-templates select="Type"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
</code>
</dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
</dd>
</xsl:template>
<!--ExtendedAttribute name==Constructor || name==NamedConstructor-->
<xsl:template match="ExtendedAttributeList/ExtendedAttribute">
<dt class="constructor" id="{concat(@name,generate-id(.))}">
<code>
<xsl:value-of select="../../@name"/>
<xsl:text>(</xsl:text>
<xsl:apply-templates select="ArgumentList">
<xsl:with-param name="nodesc" select="1"/>
</xsl:apply-templates>
<xsl:text>);</xsl:text>
</code>
</dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="ArgumentList"/>
<xsl:apply-templates select="Raises"/>
<xsl:if test="descriptive/api-feature">
<div class="api-features">
<h6>API features</h6>
<dl>
<xsl:apply-templates select="descriptive/api-feature"/>
</dl>
</div>
</xsl:if>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="descriptive/Code"/>
</dd>
</xsl:template>
<!--Operation-->
<xsl:template match="Operation">
<dt class="method" id="{concat(@name,generate-id(.))}">
<code>
<xsl:if test="@stringifier">
<xsl:value-of select="concat(@stringifier, ' ')"/>
</xsl:if>
<xsl:if test="@omittable">
<xsl:value-of select="concat(@omittable, ' ')"/>
</xsl:if>
<xsl:if test="@getter">
<xsl:value-of select="concat(@getter, ' ')"/>
</xsl:if>
<xsl:if test="@setter">
<xsl:value-of select="concat(@setter, ' ')"/>
</xsl:if>
<xsl:if test="@creator">
<xsl:value-of select="concat(@creator, ' ')"/>
</xsl:if>
<xsl:if test="@deleter">
<xsl:value-of select="concat(@deleter, ' ')"/>
</xsl:if>
<xsl:if test="@caller">
<xsl:value-of select="concat(@caller, ' ')"/>
</xsl:if>
<xsl:apply-templates select="Type"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>(</xsl:text>
<xsl:apply-templates select="ArgumentList">
<xsl:with-param name="nodesc" select="1"/>
</xsl:apply-templates>
<xsl:text>);</xsl:text>
</code>
</dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="descriptive/Code"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="ArgumentList"/>
<xsl:if test="Type/descriptive">
<div class="returntype">
<h5>Return value</h5>
<xsl:apply-templates select="Type/descriptive"/>
</div>
</xsl:if>
<xsl:apply-templates select="Raises"/>
<xsl:if test="descriptive/api-feature">
<div class="api-features">
<h6>API features</h6>
<dl>
<xsl:apply-templates select="descriptive/api-feature"/>
</dl>
</div>
</xsl:if>
<xsl:apply-templates select="descriptive/Code"/>
</dd>
</xsl:template>
<!--Callback-->
<xsl:template match="Callback">
<xsl:variable name="name" select="@name"/>
<div class="callback" id="{@id}">
<h3><code><xsl:value-of select="@name"/></code></h3>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="descriptive"/>
<div class="synopsis">
<h6>Signature</h6>
<pre>
<xsl:apply-templates select="Type"/>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:text>(</xsl:text>
<xsl:apply-templates select="ArgumentList">
<xsl:with-param name="nodesc" select="1"/>
</xsl:apply-templates>
<xsl:text>);
</xsl:text></pre>
</div>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="ArgumentList"/>
<xsl:if test="Type/descriptive">
<div class="returntype">
<h5>Return value</h5>
<xsl:apply-templates select="Type/descriptive"/>
</div>
</xsl:if>
<xsl:apply-templates select="descriptive/Code"/>
</dd>
</div>
</xsl:template>
<!--ArgumentList. This is passed $nodesc=true to output just the argument
types and names, and not any documentation for them.-->
<xsl:template match="ArgumentList">
<xsl:param name="nodesc"/>
<xsl:choose>
<xsl:when test="$nodesc">
<!--$nodesc is true: just output the types and names-->
<xsl:apply-templates select="Argument[1]">
<xsl:with-param name="nodesc" select="'nocomma'"/>
</xsl:apply-templates>
<xsl:apply-templates select="Argument[position() != 1]">
<xsl:with-param name="nodesc" select="'comma'"/>
</xsl:apply-templates>
</xsl:when>
<xsl:when test="Argument">
<!--$nodesc is false: output the documentation-->
<div class="parameters">
<h6>Parameters</h6>
<ul>
<xsl:apply-templates/>
</ul>
</div>
</xsl:when>
</xsl:choose>
</xsl:template>
<!--Argument. This is passed $nodesc=false to output the documentation,
or $nodesc="nocomma" to output the type and name, or $nodesc="comma"
to output a comma then the type and name. -->
<xsl:template match="Argument">
<xsl:param name="nodesc"/>
<xsl:choose>
<xsl:when test="$nodesc">
<!--$nodesc is true: just output the types and names-->
<xsl:if test="$nodesc = 'comma'">
<!--Need a comma first.-->
<xsl:text>, </xsl:text>
</xsl:if>
<xsl:if test="@in"><xsl:value-of select="concat(@in, ' ')"/></xsl:if>
<xsl:if test="@optional"><xsl:value-of select="concat(@optional, ' ')"/></xsl:if>
<xsl:apply-templates select="Type"/>
<xsl:if test="@ellipsis"><xsl:text>...</xsl:text></xsl:if>
<xsl:text> </xsl:text>
<xsl:value-of select="@name"/>
<xsl:if test="@value">
<xsl:text>Default value: </xsl:text><xsl:value-of select="@value"/>
</xsl:if>
<xsl:if test="@stringvalue">
<xsl:text>Default value: "</xsl:text><xsl:value-of select="@stringvalue"/><xsl:text>"</xsl:text>
</xsl:if>
</xsl:when>
<xsl:otherwise>
<!--$nodesc is false: output the documentation-->
<li class="param">
<xsl:value-of select="@name"/>:
<xsl:apply-templates select="descriptive"/>
</li>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--Raises (for an Operation). It is already known that the list
is not empty.-->
<xsl:template match="Raises">
<div class="exceptionlist">
<h5>Exceptions</h5>
<ul>
<xsl:apply-templates/>
</ul>
</div>
</xsl:template>
<!--RaiseException, the name of an exception in a Raises.-->
<xsl:template match="RaiseException">
<li class="exception">
<xsl:value-of select="@name"/>:
<xsl:apply-templates select="descriptive"/>
</li>
</xsl:template>
<!--Type.-->
<xsl:template match="Type">
<xsl:choose>
<xsl:when test="Type">
<xsl:text>sequence &lt;</xsl:text>
<xsl:apply-templates/>
<xsl:text>></xsl:text>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="@name"/>
<xsl:value-of select="@type"/>
<xsl:if test="@nullable">
<xsl:text>?</xsl:text>
</xsl:if>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--Enum.-->
<xsl:template match="Enum[descriptive]">
<xsl:variable name="name" select="@name"/>
<div class="enum" id="{@id}">
<h3><code><xsl:value-of select="@name"/></code></h3>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="webidl"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
<div class="enumvalues">
<h4>Values</h4>
<dl>
<xsl:apply-templates select="EnumValue"/>
</dl>
</div>
</div>
</xsl:template>
<xsl:template match="Enum[not(descriptive)]">
</xsl:template>
<!--EnumValue-->
<xsl:template match="EnumValue">
<dt class="enumvalue" id="{@id}">
<code>
<xsl:value-of select="@stringvalue"/>
</code>
</dt>
<dd>
<xsl:apply-templates select="descriptive/brief"/>
<xsl:apply-templates select="descriptive"/>
<xsl:apply-templates select="descriptive/Code"/>
</dd>
</xsl:template>
<xsl:template match="descriptive[not(author)]">
<xsl:apply-templates select="version"/>
<xsl:if test="author">
</xsl:if>
<xsl:apply-templates select="description"/>
</xsl:template>
<!--brief-->
<xsl:template match="brief">
<div class="brief">
<p>
<xsl:apply-templates/>
</p>
</div>
</xsl:template>
<!--description in ReturnType or Argument or ScopedName-->
<xsl:template match="Type/descriptive/description|Argument/descriptive/description|Name/descriptive/description">
<!--If the description contains just a single <p> then we omit
the <p> and just do its contents.-->
<xsl:choose>
<xsl:when test="p and count(*) = 1">
<xsl:apply-templates select="p/*|p/text()"/>
</xsl:when>
<xsl:otherwise>
<div class="description">
<xsl:apply-templates/>
</div>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
<!--Other description-->
<xsl:template match="description">
<div class="description">
<xsl:apply-templates/>
</div>
</xsl:template>
<!--Code-->
<xsl:template match="Code">
<div class="example">
<xsl:choose>
<xsl:when test="@lang">
<h5><xsl:value-of select="@lang"/></h5>
</xsl:when>
<xsl:otherwise>
<h5>Code example</h5>
</xsl:otherwise>
</xsl:choose>
<pre class="examplecode"><xsl:apply-templates/></pre>
</div>
</xsl:template>
<!--webidl : literal Web IDL from input-->
<xsl:template match="webidl">
<h5>WebIDL</h5>
<pre class="webidl"><xsl:apply-templates/></pre>
</xsl:template>
<!--author-->
<xsl:template match="author">
<li class="author"><xsl:apply-templates/></li>
</xsl:template>
<!--version-->
<xsl:template match="version">
<div class="version">
<h2>
Version: <xsl:apply-templates/>
</h2>
</div>
</xsl:template>
<!--api-feature-->
<xsl:template match="api-feature">
<dt>
<xsl:value-of select="@identifier"/>
</dt>
<dd>
<xsl:apply-templates/>
</dd>
</xsl:template>
<!--param-->
<xsl:template match="param">
<li>
<code><xsl:value-of select="@identifier"/></code>:
<xsl:apply-templates/>
</li>
</xsl:template>
<!--def-instantiated.
This assumes that only one interface in the module has a def-instantiated,
and that interface contains just one attribute.-->
<xsl:template match="def-instantiated">
<xsl:variable name="ifacename" select="../../@name"/>
<p>
<xsl:choose>
<xsl:when test="count(descriptive/api-feature)=1">
When the feature
</xsl:when>
<xsl:otherwise>
When any of the features
</xsl:otherwise>
</xsl:choose>
</p>
<ul>
<xsl:for-each select="descriptive/api-feature">
<li><code>
<xsl:value-of select="@identifier"/>
</code></li>
</xsl:for-each>
</ul>
<p>
is successfully requested, the interface
<code><xsl:apply-templates select="../../Attribute/Type"/></code>
is instantiated, and the resulting object appears in the global
namespace as
<code><xsl:value-of select="../../../Implements[@name2=$ifacename]/@name1"/>.<xsl:value-of select="../../Attribute/@name"/></code>.
</p>
</xsl:template>
<!--html elements-->
<xsl:template match="a|b|br|dd|dl|dt|em|li|p|table|td|th|tr|ul">
<xsl:element name="{name()}"><xsl:for-each select="@*"><xsl:attribute name="{name()}"><xsl:value-of select="."/></xsl:attribute></xsl:for-each><xsl:apply-templates/></xsl:element>
</xsl:template>
<xsl:template name="summary">
<table class="summary">
<thead>
<tr><th>Interface</th><th>Method</th></tr>
</thead>
<tbody>
<xsl:for-each select="Interface[descriptive]">
<tr><td><a href="#{@id}"><xsl:value-of select="@name"/></a></td>
<td>
<xsl:for-each select="Operation">
<xsl:apply-templates select="Type"/>
<xsl:text> </xsl:text>
<a href="#{concat(@name,generate-id(.))}"><xsl:value-of select="@name"/></a>
<xsl:text>(</xsl:text>
<xsl:for-each select="ArgumentList/Argument">
<xsl:variable name="type"><xsl:apply-templates select="Type"/></xsl:variable>
<xsl:value-of select="concat(normalize-space($type),' ',@name)"/>
<xsl:if test="position() != last()">, </xsl:if>
</xsl:for-each>
<xsl:text>)</xsl:text>
<xsl:if test="position()!=last()"><br/></xsl:if>
</xsl:for-each>
</td>
</tr>
</xsl:for-each>
</tbody>
</table>
</xsl:template>
<!--<ref> element in literal Web IDL.-->
<xsl:template match="ref[@ref]">
<a href="{@ref}">
<xsl:apply-templates/>
</a>
</xsl:template>
</xsl:stylesheet>

View File

@@ -0,0 +1,91 @@
########################################################################
# $Id: Makefile 418 2010-06-16 15:26:51Z tpr $
# Copyright 2009 Aplix Corporation. All rights reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
########################################################################
UNAME = $(shell uname)
VALIDTESTDIR = valid/idl
VALIDTESTREFDIR = valid/xml
VALIDTESTOBJDIR = valid/obj
INVALIDTESTDIR = invalid/idl
INVALIDTESTREFDIR = invalid/error
INVALIDTESTOBJDIR = invalid/obj
# The settings of SRCDIR (where to find the xsl style sheets), OBJDIR (where to
# find widlproc and widlprocxml.dtd) and VALDTESTOBJDIR (where to put the
# resulting XML files) reflect the directory
# structure of the released widlproc.zip file when unzipped. ../Makefile calls
# this Makefile with these settings overridden to reflect the directory
# structure in svn.
SRCDIR = ..
OBJDIR = ..
########################################################################
# Linux configuration
#
ifneq (,$(filter Linux%, $(UNAME)))
EXESUFFIX =
else
########################################################################
# Darwin configuration
#
ifneq (,$(filter Darwin%, $(UNAME)))
EXESUFFIX =
else
########################################################################
# Windows (cygwin but using MS compiler) configuration
#
ifneq (,$(filter CYGWIN%, $(UNAME)))
EXESUFFIX = .exe
endif
endif
endif
########################################################################
# Common makefile
#
WIDLPROC = $(OBJDIR)/widlproc$(EXESUFFIX)
DTD = $(OBJDIR)/widlprocxml.dtd
VALID_WIDLS = $(patsubst $(VALIDTESTDIR)/%, %, $(wildcard $(VALIDTESTDIR)/*.widl))
INVALID_WIDLS = $(patsubst $(INVALIDTESTDIR)/%, %, $(wildcard $(INVALIDTESTDIR)/*.widl))
test : $(patsubst %.widl, $(VALIDTESTOBJDIR)/%.widlprocxml, $(VALID_WIDLS)) $(patsubst %.widl, $(INVALIDTESTOBJDIR)/%.txt, $(INVALID_WIDLS)) $(WIDLPROC)
@echo "$@ pass"
#$(EXAMPLESOBJDIR)/%.html : $(EXAMPLESOBJDIR)/%.widlprocxml $(SRCDIR)/widlprocxmltohtml.xsl Makefile
# cp $(SRCDIR)/widlprocxmltohtml.xsl $(dir $@)/
# xsltproc $(dir $@)/widlprocxmltohtml.xsl $< >$@
$(VALIDTESTOBJDIR)/%.widlprocxml : $(VALIDTESTDIR)/%.widl $(WIDLPROC) $(DTD) Makefile $(patsubst %.widl, $(VALIDTESTREFDIR)/%.widlprocxml, $(VALID_WIDLS))
mkdir -p $(dir $@)
$(WIDLPROC) $< >$@
cp $(OBJDIR)/widlprocxml.dtd $(dir $@)/
xmllint --noout --dtdvalid $(DTD) $@
diff $@ $(VALIDTESTREFDIR)/`basename $@`
$(INVALIDTESTOBJDIR)/%.txt : $(INVALIDTESTDIR)/%.widl $(WIDLPROC) Makefile $(patsubst %.widl, $(INVALIDTESTREFDIR)/%.txt, $(INVALID_WIDLS))
mkdir -p $(dir $@)
-$(WIDLPROC) $< >$@ 2>&1
diff $@ $(INVALIDTESTREFDIR)/`basename $@`
.DELETE_ON_ERROR:

View File

@@ -0,0 +1 @@
invalid/idl/enum.widl: 1: at '1': expected string in enum

View File

@@ -0,0 +1 @@
invalid/idl/module.widl: 2: at 'gfx': expected 'implements'

View File

@@ -0,0 +1 @@
invalid/idl/nonnullableany.widl: 2: at '?': expected identifier

View File

@@ -0,0 +1 @@
invalid/idl/nonnullableobjects.widl: 4: at '?': expected identifier

View File

@@ -0,0 +1 @@
invalid/idl/scopedname.widl: 2: at ':': expected identifier

View File

@@ -0,0 +1 @@
invalid/idl/sequenceAsAttribute.widl: 2: at 'sequence': expected type

View File

@@ -0,0 +1 @@
invalid/idl/stringconstants.idl: 2: at 'DOMString': expected acceptable constant type

View File

@@ -0,0 +1 @@
enum foo { 1, 2, 3};

View File

@@ -0,0 +1,25 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
module gfx {
module geom {
interface Shape { /* ... */ };
interface Rectangle : Shape { /* ... */ };
interface Path : Shape { /* ... */ };
};
interface GraphicsContext {
void fillShape(geom::Shape s);
void strokeShape(geom::Shape s);
};
};
module gui {
interface Widget { /* ... */ };
interface Window : Widget {
gfx::GraphicsContext getGraphicsContext();
};
interface Button : Widget { /* ... */ };
};

View File

@@ -0,0 +1,3 @@
interface NonNullable {
attribute any? foo;
};

View File

@@ -0,0 +1,5 @@
interface Foo {};
interface NonNullable {
attribute Foo?? foo;
};

View File

@@ -0,0 +1,18 @@
// getraises and setraises are not longer valid Web IDL
interface Person {
// An attribute that can raise an exception if it is set to an invalid value.
attribute DOMString name setraises (InvalidName);
// An attribute whose value cannot be assigned to, and which can raise an
// exception some circumstances.
readonly attribute DOMString petName getraises (NoSuchPet);
};
exception SomeException {
};
interface ExceptionThrower {
// This attribute always throws a SomeException and never returns a value.
attribute long valueOf getraises(SomeException);
};

View File

@@ -0,0 +1,2 @@
// scoped names are no longer valid in WebIDL
typedef gfx::geom::geom2d::Point Point;

View File

@@ -0,0 +1,3 @@
interface sequenceAsAttribute {
attribute sequence<short> invalid;
};

View File

@@ -0,0 +1,8 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
// omittable is no longer a recognized keywoard as of 20110905
interface Dictionary {
readonly attribute unsigned long propertyCount;
omittable getter float getProperty(DOMString propertyName);
omittable setter void setProperty(DOMString propertyName, float propertyValue);
};

View File

@@ -0,0 +1,3 @@
interface Util {
const DOMString hello = "world";
};

View File

@@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface B {
void g();
void g(B b);
void g([AllowAny] DOMString s);
};

View File

@@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor]
interface LotteryResults {
readonly attribute unsigned short[][] numbers;
};

View File

@@ -0,0 +1,14 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
exception InvalidName {
DOMString reason;
};
exception NoSuchPet { };
interface Person {
// A simple attribute that can be set to any value the range an unsigned
// short can take.
attribute unsigned short age;
};

View File

@@ -0,0 +1,5 @@
callback AsyncOperationCallback = void (DOMString status);
callback interface EventHandler {
void eventOccurred(DOMString details);
};

View File

@@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface NumberQuadrupler {
// This operation simply returns four times the given number x.
legacycaller float compute(float x);
};

View File

@@ -0,0 +1,18 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Util {
const boolean DEBUG = false;
const short negative = -1;
const octet LF = 10;
const unsigned long BIT_MASK = 0x0000fc00;
const float AVOGADRO = 6.022e23;
const unrestricted float sobig = Infinity;
const unrestricted double minusonedividedbyzero = -Infinity;
const short notanumber = NaN;
};
exception Error {
const short ERR_UNKNOWN = 0;
const short ERR_OUT_OF_MEMORY = 1;
short errorCode;
};

View File

@@ -0,0 +1,9 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor,
Constructor(float radius)]
interface Circle {
attribute float r;
attribute float cx;
attribute float cy;
readonly attribute float circumference;
};

View File

@@ -0,0 +1,9 @@
dictionary PaintOptions {
DOMString? fillPattern = "black";
DOMString? strokePattern = null;
Point position;
};
dictionary WetPaintOptions : PaintOptions {
float hydrometry;
};

View File

@@ -0,0 +1,11 @@
// Extracted from Web IDL editors draft May 31 2011
dictionary PaintOptions {
DOMString? fillPattern = "black";
DOMString? strokePattern = null;
Point position;
};
partial dictionary A {
long h;
long d;
};

View File

@@ -0,0 +1,33 @@
/**
* \brief Testing documentation features
*
* This is a
* single paragraph
*
* <p>This is valid.</p>
* <p>This is <em>valid</em>.</p>
* <p>This is <b>valid</b>.</p>
* <p>This is <a href=''>valid</a>.</p>
* <ul>
* <li>This</li>
* <li>is</li>
* <li>valid</li>
* </ul>
* <dl>
* <dt>This</dt>
* <dd>valid</dd>
* </dl>
* <table>
* <tr>
* <td>this</td>
* <td>is</td>
* </tr>
* <tr>
* <td>valid</td>
* </tr>
* </table>
* <p>This is <br> valid.</p>
* <p>This is <br /> valid.</p>
* <p>This is <br/> valid.</p>
*/
interface Documentation {};

View File

@@ -0,0 +1,34 @@
/**
* \brief Testing documentation features
*
* This is a
* single paragraph
*
* <p>This is valid.</p>
* <p>This is <em>valid</em>.</p>
* <p>This is <b>valid</b>.</p>
* <p>This is <a href=''>valid</a>.</p>
* <ul>
* <li>This</li>
* <li>is</li>
* <li>valid</li>
* </ul>
* <dl>
* <dt>This</dt>
* <dd>valid</dd>
* </dl>
* <table>
* <tr>
* <td>this</td>
* <td>is</td>
* </tr>
* <tr>
* <td>valid</td>
* </tr>
* </table>
* <p>This is <br> valid.</p>
* <p>This is <br /> valid.</p>
* <p>This is <br/> valid.</p>
* <p><img src="foo.png" alt="Valid"/></p>
*/
interface Documentation {};

View File

@@ -0,0 +1,8 @@
enum MealType { "rice", "noodles", "other" };
interface Meal {
attribute MealType type;
attribute float size; // in grams
void initialize(MealType type, float size);
};

View File

@@ -0,0 +1,18 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dictionary {
readonly attribute unsigned long propertyCount;
getter float getProperty(DOMString propertyName);
setter void setProperty(DOMString propertyName, float propertyValue);
};
interface Dictionary {
readonly attribute unsigned long propertyCount;
float getProperty(DOMString propertyName);
void setProperty(DOMString propertyName, float propertyValue);
getter float (DOMString propertyName);
setter void (DOMString propertyName, float propertyValue);
};

View File

@@ -0,0 +1,7 @@
// from http://lists.w3.org/Archives/Public/public-script-coord/2010OctDec/0112.html
exception DOMException {
unsigned short code;
};
exception HierarchyRequestError : DOMException { };
exception NoModificationAllowedError : DOMException { };

View File

@@ -0,0 +1,8 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dahut {
attribute DOMString type;
};
exception SomeException {
};

View File

@@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dictionary {
readonly attribute unsigned long propertyCount;
getter float (DOMString propertyName);
setter void (DOMString propertyName, float propertyValue);
};

View File

@@ -0,0 +1,44 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
// Typedef identifier: "number"
// Qualified name: "::framework::number"
typedef float number;
// Exception identifier: "FrameworkException"
// Qualified name: "::framework::FrameworkException"
exception FrameworkException {
// Constant identifier: "ERR_NOT_FOUND"
// Qualified name: "::framework::FrameworkException::ERR_NOT_FOUND"
const long ERR_NOT_FOUND = 1;
// Exception field identifier: "code"
long code;
};
// Interface identifier: "System"
// Qualified name: "::framework::System"
interface System {
// Operation identifier: "createObject"
// Operation argument identifier: "interface"
object createObject(DOMString _interface);
// Operation has no identifier; it declares a getter.
getter DOMString (DOMString keyName);
};
// Interface identifier: "TextField"
// Qualified name: "::framework::gui::TextField"
interface TextField {
// Attribute identifier: "const"
attribute boolean _const;
// Attribute identifier: "value"
attribute DOMString? _value;
};
interface Foo {
void op(object interface);
};

View File

@@ -0,0 +1,14 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Node {
readonly attribute unsigned short nodeType;
// ...
};
interface EventTarget {
void addEventListener(DOMString type,
EventListener listener,
boolean useCapture);
// ...
};
Node implements EventTarget;

View File

@@ -0,0 +1,12 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface OrderedMap {
readonly attribute unsigned long size;
getter any getByIndex(unsigned long index);
setter void setByIndex(unsigned long index, any value);
deleter void removeByIndex(unsigned long index);
getter any get(DOMString name);
setter creator void set(DOMString name, any value);
deleter void remove(DOMString name);
};

View File

@@ -0,0 +1,16 @@
interface Animal {
// A simple attribute that can be set to any string value.
readonly attribute DOMString name;
};
interface Person : Animal {
// An attribute whose value cannot be assigned to.
readonly attribute unsigned short age;
// An attribute that can raise an exception if it is set to an invalid value.
// Its getter behavior is inherited from Animal, and need not be specified
// the description of Person.
inherit attribute DOMString name;
};

View File

@@ -0,0 +1,12 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Animal {
attribute DOMString name;
};
interface Human : Animal {
attribute Dog pet;
};
interface Dog : Animal {
attribute Human owner;
};

View File

@@ -0,0 +1,35 @@
interface SessionManager {
Session getSessionForUser(DOMString username);
readonly attribute unsigned long sessionCount;
Session iterator;
};
interface Session {
readonly attribute DOMString username;
// ...
};
interface SessionManager2 {
Session2 getSessionForUser(DOMString username);
readonly attribute unsigned long sessionCount;
Session2 iterator = SessionIterator;
};
interface Session2 {
readonly attribute DOMString username;
// ...
};
interface SessionIterator {
readonly attribute unsigned long remainingSessions;
};
interface NodeList {
Node iterator = NodeIterator;
};
interface NodeIterator {
Node iterator object;
};

View File

@@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[NamedConstructor=Audio,
NamedConstructor=Audio(DOMString src)]
interface HTMLAudioElement : HTMLMediaElement {
// ...
};

View File

@@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[NoInterfaceObject]
interface Query {
any lookupEntry(unsigned long key);
};

View File

@@ -0,0 +1,9 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface MyConstants {
const boolean? ARE_WE_THERE_YET = false;
};
interface Node {
readonly attribute DOMString? namespaceURI;
// ...
};

View File

@@ -0,0 +1,13 @@
// Extracted from WebIDL spec 2011-05-23
interface A {
// ...
};
interface B {
// ...
};
interface C {
void f(A? x);
void f(B? x);
};

View File

@@ -0,0 +1,4 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface ColorCreator {
object createColor(float v1, float v2, float v3, optional float alpha = 3.5);
};

View File

@@ -0,0 +1,20 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface A {
// ...
};
interface B {
// ...
};
interface C {
void f(A x);
void f(B x);
};
interface A {
/* f1 */ void f(DOMString a);
/* f2 */ void f([AllowAny] DOMString a, DOMString b, float... c);
/* f3 */ void f();
/* f4 */ void f(long a, DOMString b, optional DOMString c, float... d);
};

View File

@@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[OverrideBuiltins]
interface StringMap2 {
readonly attribute unsigned long length;
getter DOMString lookup(DOMString key);
};

View File

@@ -0,0 +1,7 @@
interface Foo {
attribute DOMString bar;
};
partial interface Foo {
attribute DOMString quux;
};

View File

@@ -0,0 +1,19 @@
interface Primitives {
attribute boolean truth;
attribute byte character;
attribute octet value;
attribute short number;
attribute unsigned short positive;
attribute long big;
attribute unsigned long bigpositive;
attribute long long bigbig;
attribute unsigned long long bigbigpositive;
attribute float real;
attribute double bigreal;
attribute unrestricted float realwithinfinity;
attribute unrestricted double bigrealwithinfinity;
attribute DOMString string;
attribute ByteString bytes;
attribute Date date;
attribute RegExp regexp;
};

View File

@@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[PrototypeRoot]
interface Node {
readonly attribute unsigned short nodeType;
};

View File

@@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Person {
[PutForwards=full] readonly attribute Name name;
attribute unsigned short age;
};

View File

@@ -0,0 +1,17 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dimensions {
attribute unsigned long width;
attribute unsigned long height;
};
exception NoPointerDevice { };
interface Button {
// An operation that takes no arguments, returns a boolean
boolean isMouseOver();
// Overloaded operations.
void setDimensions(Dimensions size);
void setDimensions(unsigned long width, unsigned long height);
};

View File

@@ -0,0 +1,5 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Counter {
[Replaceable] readonly attribute unsigned long value;
void increment();
};

View File

@@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
// edited to remove sequence as attributes, now invalid
interface Canvas {
void drawPolygon(sequence<float> coordinates);
sequence<float> getInflectionPoints();
// ...
};

View File

@@ -0,0 +1,64 @@
interface Transaction {
readonly attribute Account from;
readonly attribute Account to;
readonly attribute float amount;
readonly attribute DOMString description;
readonly attribute unsigned long number;
serializer;
};
interface Account {
attribute DOMString name;
attribute unsigned long number;
serializer DOMString serialize();
};
interface Transaction2 {
readonly attribute Account2 from;
readonly attribute Account2 to;
readonly attribute float amount;
readonly attribute DOMString description;
readonly attribute unsigned long number;
serializer = { from, to, amount, description };
};
interface Account2 {
attribute DOMString name;
attribute unsigned long number;
serializer = number;
};
interface Account3 {
attribute DOMString name;
attribute unsigned long number;
serializer = { attribute };
};
interface Account4 {
getter object getItem(unsigned long index);
serializer = { getter };
};
interface Account5 : Account {
attribute DOMString secondname;
serializer = { inherit, secondname };
};
interface Account6 : Account {
attribute DOMString secondname;
serializer = { inherit, attribute };
};
interface Account7 {
attribute DOMString name;
attribute unsigned long number;
serializer = [ name, number ];
};
interface Account8 {
getter object getItem(unsigned long index);
serializer = [ getter ];
};

View File

@@ -0,0 +1,11 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Point { /* ... */ };
interface Circle {
attribute float cx;
attribute float cy;
attribute float radius;
static readonly attribute long triangulationCount;
static Point triangulate(Circle c1, Circle c2, Circle c3);
};

View File

@@ -0,0 +1,6 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor]
interface Student {
attribute unsigned long id;
stringifier attribute DOMString name;
};

View File

@@ -0,0 +1,9 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
[Constructor]
interface Student {
attribute unsigned long id;
attribute DOMString? familyName;
attribute DOMString givenName;
stringifier DOMString ();
};

View File

@@ -0,0 +1,8 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface A {
stringifier DOMString ();
};
interface A {
stringifier;
};

View File

@@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Dog {
attribute DOMString name;
attribute DOMString owner;
boolean isMemberOfBreed([TreatNullAs=EmptyString] DOMString breedName);
};

View File

@@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Cat {
attribute DOMString name;
attribute DOMString owner;
boolean isMemberOfBreed([TreatUndefinedAs=EmptyString] DOMString breedName);
};

View File

@@ -0,0 +1,22 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface Point {
attribute float x;
attribute float y;
};
typedef sequence<Point> PointSequence;
interface Rect {
attribute Point topleft;
attribute Point bottomright;
};
interface Widget {
readonly attribute Rect bounds;
boolean pointWithinBounds(Point p);
boolean allPointsWithinBounds(PointSequence ps);
};
typedef [Clamp] octet value;

View File

@@ -0,0 +1,3 @@
interface Suffixes {
void test(sequence<DOMString[]?>? foo);
};

View File

@@ -0,0 +1,3 @@
interface Union {
attribute (float or (Date or Event) or (Node or DOMString)?) test;
};

View File

@@ -0,0 +1,7 @@
// Extracted from http://dev.w3.org/2006/webapi/WebIDL/ on 2011-05-06
interface IntegerSet {
readonly attribute unsigned long cardinality;
void union(long... ints);
void intersection(long... ints);
};

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>interface B {
void g();
void g(<ref>B</ref> b);
void g([AllowAny] DOMString s);
};</webidl>
<Interface name="B" id="::B">
<webidl>interface B {
void g();
void g(<ref>B</ref> b);
void g([AllowAny] DOMString s);
};</webidl>
<Operation name="g" id="::B::g">
<webidl> void g();</webidl>
<Type type="void"/>
<ArgumentList/>
</Operation>
<Operation name="g" id="::B::g">
<webidl> void g(<ref>B</ref> b);</webidl>
<Type type="void"/>
<ArgumentList>
<Argument name="b">
<Type name="B"/>
</Argument>
</ArgumentList>
</Operation>
<Operation name="g" id="::B::g">
<webidl> void g([AllowAny] DOMString s);</webidl>
<Type type="void"/>
<ArgumentList>
<Argument name="s">
<ExtendedAttributeList>
<ExtendedAttribute name="AllowAny">
<webidl>AllowAny</webidl>
</ExtendedAttribute>
</ExtendedAttributeList>
<Type type="DOMString"/>
</Argument>
</ArgumentList>
</Operation>
</Interface>
</Definitions>

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>[Constructor]
interface LotteryResults {
readonly attribute unsigned short[][] numbers;
};</webidl>
<Interface name="LotteryResults" id="::LotteryResults">
<webidl>[Constructor]
interface LotteryResults {
readonly attribute unsigned short[][] numbers;
};</webidl>
<ExtendedAttributeList>
<ExtendedAttribute name="Constructor">
<webidl>Constructor</webidl>
</ExtendedAttribute>
</ExtendedAttributeList>
<Attribute readonly="readonly" name="numbers" id="::LotteryResults::numbers">
<webidl> readonly attribute unsigned short[][] numbers;</webidl>
<Type type="array">
<Type type="array">
<Type type="unsigned short"/>
</Type>
</Type>
</Attribute>
</Interface>
</Definitions>

View File

@@ -0,0 +1,38 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>exception InvalidName {
DOMString reason;
};
exception NoSuchPet { };
interface Person {
attribute unsigned short age;
};</webidl>
<Exception name="InvalidName" id="::InvalidName">
<webidl>exception InvalidName {
DOMString reason;
};</webidl>
<ExceptionField name="reason" id="::InvalidName::reason">
<webidl> DOMString reason;</webidl>
<Type type="DOMString"/>
</ExceptionField>
</Exception>
<Exception name="NoSuchPet" id="::NoSuchPet">
<webidl>exception NoSuchPet { };</webidl>
</Exception>
<Interface name="Person" id="::Person">
<webidl>interface Person {
attribute unsigned short age;
};</webidl>
<Attribute name="age" id="::Person::age">
<webidl> attribute unsigned short age;</webidl>
<Type type="unsigned short"/>
</Attribute>
</Interface>
</Definitions>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>callback AsyncOperationCallback = void (DOMString status);
callback interface EventHandler {
void eventOccurred(DOMString details);
};</webidl>
<Callback name="AsyncOperationCallback" id="::AsyncOperationCallback">
<webidl>callback AsyncOperationCallback = void (DOMString status);</webidl>
<Type type="void"/>
<ArgumentList>
<Argument name="status">
<Type type="DOMString"/>
</Argument>
</ArgumentList>
</Callback>
<Interface name="EventHandler" callback="callback" id="::EventHandler">
<webidl>callback interface EventHandler {
void eventOccurred(DOMString details);
};</webidl>
<Operation name="eventOccurred" id="::EventHandler::eventOccurred">
<webidl> void eventOccurred(DOMString details);</webidl>
<Type type="void"/>
<ArgumentList>
<Argument name="details">
<Type type="DOMString"/>
</Argument>
</ArgumentList>
</Operation>
</Interface>
</Definitions>

View File

@@ -0,0 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>interface NumberQuadrupler {
legacycaller float compute(float x);
};</webidl>
<Interface name="NumberQuadrupler" id="::NumberQuadrupler">
<webidl>interface NumberQuadrupler {
legacycaller float compute(float x);
};</webidl>
<Operation legacycaller="legacycaller" name="compute" id="::NumberQuadrupler::compute">
<webidl> legacycaller float compute(float x);</webidl>
<Type type="float"/>
<ArgumentList>
<Argument name="x">
<Type type="float"/>
</Argument>
</ArgumentList>
</Operation>
</Interface>
</Definitions>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>interface Util {
const boolean DEBUG = false;
const short negative = -1;
const octet LF = 10;
const unsigned long BIT_MASK = 0x0000fc00;
const float AVOGADRO = 6.022e23;
const unrestricted float sobig = Infinity;
const unrestricted double minusonedividedbyzero = -Infinity;
const short notanumber = NaN;
};
exception Error {
const short ERR_UNKNOWN = 0;
const short ERR_OUT_OF_MEMORY = 1;
short errorCode;
};</webidl>
<Interface name="Util" id="::Util">
<webidl>interface Util {
const boolean DEBUG = false;
const short negative = -1;
const octet LF = 10;
const unsigned long BIT_MASK = 0x0000fc00;
const float AVOGADRO = 6.022e23;
const unrestricted float sobig = Infinity;
const unrestricted double minusonedividedbyzero = -Infinity;
const short notanumber = NaN;
};</webidl>
<Const name="DEBUG" value="false" id="::Util::DEBUG">
<webidl> const boolean DEBUG = false;</webidl>
<Type type="boolean"/>
</Const>
<Const name="negative" value="-1" id="::Util::negative">
<webidl> const short negative = -1;</webidl>
<Type type="short"/>
</Const>
<Const name="LF" value="10" id="::Util::LF">
<webidl> const octet LF = 10;</webidl>
<Type type="octet"/>
</Const>
<Const name="BIT_MASK" value="0x0000fc00" id="::Util::BIT_MASK">
<webidl> const unsigned long BIT_MASK = 0x0000fc00;</webidl>
<Type type="unsigned long"/>
</Const>
<Const name="AVOGADRO" value="6.022e23" id="::Util::AVOGADRO">
<webidl> const float AVOGADRO = 6.022e23;</webidl>
<Type type="float"/>
</Const>
<Const name="sobig" value="Infinity" id="::Util::sobig">
<webidl> const unrestricted float sobig = Infinity;</webidl>
<Type type="unrestricted float"/>
</Const>
<Const name="minusonedividedbyzero" value="-Infinity" id="::Util::minusonedividedbyzero">
<webidl> const unrestricted double minusonedividedbyzero = -Infinity;</webidl>
<Type type="unrestricted double"/>
</Const>
<Const name="notanumber" value="NaN" id="::Util::notanumber">
<webidl> const short notanumber = NaN;</webidl>
<Type type="short"/>
</Const>
</Interface>
<Exception name="Error" id="::Error">
<webidl>exception Error {
const short ERR_UNKNOWN = 0;
const short ERR_OUT_OF_MEMORY = 1;
short errorCode;
};</webidl>
<Const name="ERR_UNKNOWN" value="0" id="::Error::ERR_UNKNOWN">
<webidl> const short ERR_UNKNOWN = 0;</webidl>
<Type type="short"/>
</Const>
<Const name="ERR_OUT_OF_MEMORY" value="1" id="::Error::ERR_OUT_OF_MEMORY">
<webidl> const short ERR_OUT_OF_MEMORY = 1;</webidl>
<Type type="short"/>
</Const>
<ExceptionField name="errorCode" id="::Error::errorCode">
<webidl> short errorCode;</webidl>
<Type type="short"/>
</ExceptionField>
</Exception>
</Definitions>

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>[Constructor,
Constructor(float radius)]
interface Circle {
attribute float r;
attribute float cx;
attribute float cy;
readonly attribute float circumference;
};</webidl>
<Interface name="Circle" id="::Circle">
<webidl>[Constructor,
Constructor(float radius)]
interface Circle {
attribute float r;
attribute float cx;
attribute float cy;
readonly attribute float circumference;
};</webidl>
<ExtendedAttributeList>
<ExtendedAttribute name="Constructor">
<webidl>Constructor</webidl>
</ExtendedAttribute>
<ExtendedAttribute name="Constructor">
<webidl> Constructor(float radius)</webidl>
<ArgumentList>
<Argument name="radius">
<Type type="float"/>
</Argument>
</ArgumentList>
</ExtendedAttribute>
</ExtendedAttributeList>
<Attribute name="r" id="::Circle::r">
<webidl> attribute float r;</webidl>
<Type type="float"/>
</Attribute>
<Attribute name="cx" id="::Circle::cx">
<webidl> attribute float cx;</webidl>
<Type type="float"/>
</Attribute>
<Attribute name="cy" id="::Circle::cy">
<webidl> attribute float cy;</webidl>
<Type type="float"/>
</Attribute>
<Attribute readonly="readonly" name="circumference" id="::Circle::circumference">
<webidl> readonly attribute float circumference;</webidl>
<Type type="float"/>
</Attribute>
</Interface>
</Definitions>

View File

@@ -0,0 +1,44 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE Definitions SYSTEM "widlprocxml.dtd">
<Definitions>
<webidl>dictionary PaintOptions {
DOMString? fillPattern = &quot;black&quot;;
DOMString? strokePattern = null;
<ref>Point</ref> position;
};
dictionary WetPaintOptions : <ref>PaintOptions</ref> {
float hydrometry;
};</webidl>
<Dictionary name="PaintOptions" id="::PaintOptions">
<webidl>dictionary PaintOptions {
DOMString? fillPattern = &quot;black&quot;;
DOMString? strokePattern = null;
<ref>Point</ref> position;
};</webidl>
<DictionaryMember name="fillPattern" stringvalue="black" id="::PaintOptions::fillPattern">
<webidl> DOMString? fillPattern = &quot;black&quot;;</webidl>
<Type type="DOMString" nullable="nullable"/>
</DictionaryMember>
<DictionaryMember name="strokePattern" value="null" id="::PaintOptions::strokePattern">
<webidl> DOMString? strokePattern = null;</webidl>
<Type type="DOMString" nullable="nullable"/>
</DictionaryMember>
<DictionaryMember name="position" id="::PaintOptions::position">
<webidl> <ref>Point</ref> position;</webidl>
<Type name="Point"/>
</DictionaryMember>
</Dictionary>
<Dictionary name="WetPaintOptions" id="::WetPaintOptions">
<webidl>dictionary WetPaintOptions : <ref>PaintOptions</ref> {
float hydrometry;
};</webidl>
<DictionaryInheritance>
<Name name="PaintOptions"/>
</DictionaryInheritance>
<DictionaryMember name="hydrometry" id="::WetPaintOptions::hydrometry">
<webidl> float hydrometry;</webidl>
<Type type="float"/>
</DictionaryMember>
</Dictionary>
</Definitions>

Some files were not shown because too many files have changed in this diff Show More