changed wxXML to XRC, wx/xml/*.h->wx/xrc/*.h

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@10490 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Václav Slavík 2001-06-09 22:43:51 +00:00
parent 999d9a9f79
commit 78d14f80e9
130 changed files with 31432 additions and 0 deletions

324
contrib/src/xrc/FORMAT.txt Normal file
View File

@ -0,0 +1,324 @@
XML resources file format
===============================
1. Basics
-----------
XML resource is well-formed XML document, i.e. all tags are paired
and there is only one root node, which is always <resource>.
In the following text, I will use standard XML terminology:
<tag_one prop1="prop" prop2='yes'>
<tag_two/>
</tag_one>
Here, tag_one is a node (the word 'tag' refers to the type of the node),
prop1 and prop2 are properties and tag_two is a child node of tag_one.
Property's default value is the value that will be assigned to the property
if you do not specify it explicitly.
I will use the term "primary node" to refer to nodes than represent controls,
dialogs etc. "Secondary nodes" are nodes used to store data:
<dialog name="my_dlg"> primary
<title>Demo Dialog...</title> secondary
<size>100,200d</size> secondary
<children> secondary
<button name="wxID_OK"> primary
<label>Ok</label> secondary
<pos>10,10d</pos> secondary
</button>
</children>
</dialog>
In the example above, <label>, <pos>, <size> and <title> are "variables",
i.e. they contain a value and not a list of children (unlike <children> node).
Any node (but the root one) may have property "platform" with possible
values "unix", "win", "mac" or "os2". All nodes with "platform" property
specified and other than the platform the program is currently being executed
on will be removed when reading XML resource file.
Root node may have children of these and only these types: <menu>, <menubar>,
<dialog>, <panel>
2. IDs
--------
Any primary node may have property "name" used to identify it. Default value
is "-1", any string is legal name. Names
wxID_OPEN, wxID_CLOSE, wxID_NEW,
wxID_SAVE, wxID_SAVEAS, wxID_REVERT,
wxID_EXIT, wxID_UNDO, wxID_REDO,
wxID_HELP, wxID_PRINT, wxID_PRINT_SETUP,
wxID_PREVIEW, wxID_ABOUT, wxID_HELP_CONTENTS,
wxID_HELP_COMMANDS, wxID_HELP_PROCEDURES,
wxID_CUT, wxID_COPY, wxID_PASTE,
wxID_CLEAR, wxID_FIND, wxID_DUPLICATE,
wxID_SELECTALL, wxID_OK, wxID_CANCEL,
wxID_APPLY, wxID_YES, wxID_NO,
wxID_STATIC, wxID_FORWARD, wxID_BACKWARD,
wxID_DEFAULT, wxID_MORE, wxID_SETUP,
wxID_RESET, wxID_HELP_CONTEXT
are translated into corresponding wxWindows ID constant, XMLID macro is used
otherwise to generate unique ID. wxWindows control created from named node
will have name=name and id=XMLID(name) or wxID_XXXX.
3. Common variables types
---------------------------
Variables are always of a known type:
bool - boolean value. "1", "true", "t", "on" mean TRUE, anything
else (namely "0", "false", "f", "off") means FALSE.
FIXME: maybe use only 1/0 ??
integer - integer value, i.e. digits 0-9 plus optional minus sign.
text - anything. Within text node all occurences of $ are replaced
by & (used for shortcuts, e.g. "E&xit"), $$ by $, \\, \n, \r,
\t as usual in C++.
style - (also called flags) list of flags delimined by any combination
of spaces and | characters. Resources parser accepts only
_registered_ flags -- i.e. flags that are valid for given
node/control. Example:
<flag>wxEXPAND | wxTOP|wxBOTTOM</flag>
color - color in HTML format: #rrggbb where rr,gg,bb are hexadecimal
values (00-FF) for red, green and blue components in
the RGB color model
coord - size or position information. Consists of two integers
separated by comma ("x,y"). The values are in pixels
unless "d" is attached to the right side of it --
in which case the values are interpreted as dialog units.
Value of -1 means "use default". Examples:
30,30
-1,-1
50,-1
145,56d
67,-1d
4. Layout
-----------
Most common nodes layout is as follows:
<primary_node name="name" platform="platform">
<var_1>...</var_1>
.
.
.
<var_n>...</var_n>
<children>
(n primary nodes)
</children>
</primary_node>
where children node is supported only by panels, dialogs etc. -- see
nodes description for details.
In the following text,
TYPE var_name [ (= default_value) ]
means that given primary node may have child node with name var_name
and content type TYPE. If default value is given, the node is optional
and default_value will be used if not specified. Otherwise, the node
is mandatory and must always be present. For example, "color fg" means
than variable tag fg, e.g. <fg>#rr0000</fg> is expected.
5. Common controls variables
------------------------------
_All_ nodes that represent wxWindows controls (gauge, panel, dialog,
textctrl etc.) accept the following properties:
coord pos (= -1,-1) position of the control. Default value
equals to wxDefaultPosition
coord size (= -1,-1) size of the control. Default value equals to
wxDefaultSize
text tooltip window's tooltip
color bg background color of the control
color fg foreground/text color of the control
style style control style flag. Default value is
control-dependent (but 0 is common value)
style exstyle control extended style flag
bool enabled (= 1) is the control enabled?
bool hidden (= 0) is the control hidden?
bool focused (= 0) has the control focus?
_Usually_ (but not always, only when it makes sense) controls support text
variable label which contains displayed text and/or value which contains
editable text. These are always explicitly mentioned in tag description.
6. Tags description
---------------------
If 'Control' is derived from wxControl, it supports all variables from '5.'
'Styles' section lists all acceptable flags for style and exstyle variables.
<panel>
---------
Control:
wxPanel
Variables:
only common controls variables
Styles:
wxNO_3D, wxTAB_TRAVERSAL, wxWS_EX_VALIDATE_RECURSIVELY
<dialog>
----------
Control:
wxDialog
Variables:
style style (= wxDEFAULT_DIALOG_style)
text title dialog's title
Styles:
wxSTAY_ON_TOP, wxCAPTION, wxDEFAULT_DIALOG_style, wxTHICK_FRAME,
wxSYSTEM_MENU, wxRESIZE_BORDER, wxRESIZE_BOX, wxDIALOG_MODAL,
wxDIALOG_MODELESS, wxNO_3D, wxTAB_TRAVERSAL,
wxWS_EX_VALIDATE_RECURSIVELY
<boxsizer>
--------------
Control:
wxBoxSizer (not a control)
Behaviour:
boxsizer's parent must be either <panel>, <dialog> or another
sizer, nothing else!
If the sizer does not have parent sizer, the sizer will attach itself
to the parent panel/dialog using SetAutoLayout(TRUE) and SetSizer().
If the parent panel/dialog has default size (i.e. not specified in
the resource), the sizer will fit it using wxSizer::Fit(). If the
parent panel/dialog is resizable, size hints will be set
automatically.
Variables:
style orient (= wxHORIZONTAL) orientation, either
wxHORIZONTAL or wxVERTICAL
Styles:
wxHORIZONTAL, wxVERTICAL (for orient variable)
wxLEFT, wxRIGHT, wxTOP, wxBOTTOM, wxNORTH, wxSOUTH, wxEAST, wxWEST,
wxALL, wxGROW, wxEXPAND, wxSHAPED, wxSTRETCH_NOT, wxALIGN_CENTER,
wxALIGN_CENTRE, wxALIGN_LEFT, wxALIGN_TOP, wxALIGN_RIGHT,
wxALIGN_BOTTOM, wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL,
wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL (for flag
variable of <item> or <spacer> child nodes)
Child nodes:
Contains child node <children> which has arbitrary number of
<sizeritem> and <spacer> child nodes.
<sizeritem>
-------------
Variables:
integer option (= 0) relative size of the widget
style flag (= 0) style flag
integer border (= 0) surrounding border
Has exactly one child node <window> that contains the control
(or child sizer because sizers may be nested)
to be inserted into the sizer.
<spacer>
----------
Variables:
integer option (= 0) relative size of the widget
style flag (= 0) style flag
integer border (= 0) surrounding border
Inserts empty space into the sizer
<staticboxsizer>
------------------
Control:
wxStaticBoxSizer (not a control)
Same as <boxsizer> except that it has additional variable:
text label (= "") label of surrounding static box
wxStaticBox required by wxStaticBoxSizer is created automatically!
<notebooksizer>
-----------------
Control:
wxNotebookSizer (not a control)
Behaviour:
notebooksizer's parent must be a sizer (not notebooksizer,
see below)!
Variables:
none
Styles:
none
Child nodes:
Has exactly one child node <window> that contains the notebook
(nothing else is allowed!) to be inserted into the sizer.
<textctrl>
------------
Control:
wxTextCtrl
Variables:
text value (= "")default text of the control
Styles:
wxTE_PROCESS_ENTER, wxTE_PROCESS_TAB, wxTE_MULTILINE, wxTE_PASSWORD,
wxTE_READONLY, wxHSCROLL
<htmlwindow>
--------------
Control:
wxHtmlWindow
Variables:
integer borders (= 0) window's borders
(see wxHtmlWindow::SetBorders)
text url (= "") if present, given page will be loaded
text htmlcode (= "") if present, given _text_ will be displayed
(you will have to use CDATA section
to embed HTML code into XML document)
Styles:
wxHW_SCROLLBAR_NEVER, wxHW_SCROLLBAR_AUTO

View File

@ -0,0 +1,41 @@
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
expat_dir = $(top_srcdir)/contrib/src/xrc/expat
libsrc_dir = contrib/src/xrc@PATH_IFS@$(expat_dir)/xmlparse@PATH_IFS@$(expat_dir)/xmltok
TARGET_LIBNAME=libwxxrc
LIBVERSION_CURRENT=0
LIBVERSION_REVISION=1
LIBVERSION_AGE=0
HEADER_PATH=$(top_srcdir)/contrib/include/wx
HEADER_SUBDIR=xrc
EXPAT_DEFS=-I$(expat_dir)/xmlparse -I$(expat_dir)/xmltok
EXPAT_OBJECTS=xmltok.o xmlrole.o xmlparse.o
HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \
xh_dlg.h xh_gauge.h xh_html.h xh_menu.h xh_notbk.h xh_panel.h \
xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \
xh_sttxt.h xh_text.h xh_listb.h xml.h xmlio.h xmlres.h xh_toolb.h \
xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \
xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h
OBJECTS=$(EXPAT_OBJECTS) \
xml.o xmlbin.o xmlbinz.o xmlexpat.o xmlwrite.o xmlres.o xmlrsall.o \
xh_bttn.o xh_chckb.o xh_chckl.o xh_choic.o xh_combo.o xh_dlg.o \
xh_gauge.o xh_html.o xh_menu.o xh_notbk.o xh_panel.o xh_radbt.o \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o
APPEXTRADEFS=-I$(top_srcdir)/contrib/include $(EXPAT_DEFS)
include $(top_builddir)/src/makelib.env

View File

@ -0,0 +1,39 @@
./expat directory contains stripped-down version of Expat parser distribution
by J. Clark. I removed stuff not neccessary for wxXML (docs, samples), if you
are interested in it, please download full distribution from Clark's site
(http://www.jclark.com).
Version used is expat-1.2.
The Expat parser is available is licensed under the MIT license as follows:
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
In other words, there shouldn't be any legal issues with using Expat in
your application.
Vaclav Slavik <v.slavik@volny.cz>

View File

@ -0,0 +1,20 @@
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,527 @@
/*
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#ifndef XmlParse_INCLUDED
#define XmlParse_INCLUDED 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef XMLPARSEAPI
#define XMLPARSEAPI /* as nothing */
#endif
typedef void *XML_Parser;
#ifdef XML_UNICODE_WCHAR_T
/* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
uses Unicode. */
/* Information is UTF-16 encoded as wchar_ts */
#ifndef XML_UNICODE
#define XML_UNICODE
#endif
#include <stddef.h>
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
#else /* not XML_UNICODE_WCHAR_T */
#ifdef XML_UNICODE
/* Information is UTF-16 encoded as unsigned shorts */
typedef unsigned short XML_Char;
typedef char XML_LChar;
#else /* not XML_UNICODE */
/* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
#endif /* not XML_UNICODE */
#endif /* not XML_UNICODE_WCHAR_T */
/* Constructs a new parser; encoding is the encoding specified by the external
protocol or null if there is none specified. */
XML_Parser XMLPARSEAPI
XML_ParserCreate(const XML_Char *encoding);
/* Constructs a new parser and namespace processor. Element type names
and attribute names that belong to a namespace will be expanded;
unprefixed attribute names are never expanded; unprefixed element type
names are expanded only if there is a default namespace. The expanded
name is the concatenation of the namespace URI, the namespace separator character,
and the local part of the name. If the namespace separator is '\0' then
the namespace URI and the local part will be concatenated without any
separator. When a namespace is not declared, the name and prefix will be
passed through without expansion. */
XML_Parser XMLPARSEAPI
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
/* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated. */
typedef void (*XML_StartElementHandler)(void *userData,
const XML_Char *name,
const XML_Char **atts);
typedef void (*XML_EndElementHandler)(void *userData,
const XML_Char *name);
/* s is not 0 terminated. */
typedef void (*XML_CharacterDataHandler)(void *userData,
const XML_Char *s,
int len);
/* target and data are 0 terminated */
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
const XML_Char *target,
const XML_Char *data);
/* data is 0 terminated */
typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
typedef void (*XML_StartCdataSectionHandler)(void *userData);
typedef void (*XML_EndCdataSectionHandler)(void *userData);
/* This is called for any characters in the XML document for
which there is no applicable handler. This includes both
characters that are part of markup which is of a kind that is
not reported (comments, markup declarations), or characters
that are part of a construct which could be reported but
for which no handler has been supplied. The characters are passed
exactly as they were in the XML document except that
they will be encoded in UTF-8. Line boundaries are not normalized.
Note that a byte order mark character is not passed to the default handler.
There are no guarantees about how characters are divided between calls
to the default handler: for example, a comment might be split between
multiple calls. */
typedef void (*XML_DefaultHandler)(void *userData,
const XML_Char *s,
int len);
/* This is called for the start of the DOCTYPE declaration when the
name of the DOCTYPE is encountered. */
typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
const XML_Char *doctypeName);
/* This is called for the start of the DOCTYPE declaration when the
closing > is encountered, but after processing any external subset. */
typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
/* This is called for a declaration of an unparsed (NDATA)
entity. The base argument is whatever was set by XML_SetBase.
The entityName, systemId and notationName arguments will never be null.
The other arguments may be. */
typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
const XML_Char *entityName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName);
/* This is called for a declaration of notation.
The base argument is whatever was set by XML_SetBase.
The notationName will never be null. The other arguments can be. */
typedef void (*XML_NotationDeclHandler)(void *userData,
const XML_Char *notationName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
typedef void (*XML_ExternalParsedEntityDeclHandler)(void *userData,
const XML_Char *entityName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
typedef void (*XML_InternalParsedEntityDeclHandler)(void *userData,
const XML_Char *entityName,
const XML_Char *replacementText,
int replacementTextLength);
/* When namespace processing is enabled, these are called once for
each namespace declaration. The call to the start and end element
handlers occur between the calls to the start and end namespace
declaration handlers. For an xmlns attribute, prefix will be null.
For an xmlns="" attribute, uri will be null. */
typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
const XML_Char *prefix,
const XML_Char *uri);
typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
const XML_Char *prefix);
/* This is called if the document is not standalone (it has an
external subset or a reference to a parameter entity, but does not
have standalone="yes"). If this handler returns 0, then processing
will not continue, and the parser will return a
XML_ERROR_NOT_STANDALONE error. */
typedef int (*XML_NotStandaloneHandler)(void *userData);
/* This is called for a reference to an external parsed general entity.
The referenced entity is not automatically parsed.
The application can parse it immediately or later using
XML_ExternalEntityParserCreate.
The parser argument is the parser parsing the entity containing the reference;
it can be passed as the parser argument to XML_ExternalEntityParserCreate.
The systemId argument is the system identifier as specified in the entity declaration;
it will not be null.
The base argument is the system identifier that should be used as the base for
resolving systemId if systemId was relative; this is set by XML_SetBase;
it may be null.
The publicId argument is the public identifier as specified in the entity declaration,
or null if none was specified; the whitespace in the public identifier
will have been normalized as required by the XML spec.
The context argument specifies the parsing context in the format
expected by the context argument to
XML_ExternalEntityParserCreate; context is valid only until the handler
returns, so if the referenced entity is to be parsed later, it must be copied.
The handler should return 0 if processing should not continue because of
a fatal error in the handling of the external entity.
In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING
error.
Note that unlike other handlers the first argument is the parser, not userData. */
typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
/* This structure is filled in by the XML_UnknownEncodingHandler
to provide information to the parser about encodings that are unknown
to the parser.
The map[b] member gives information about byte sequences
whose first byte is b.
If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c.
If map[b] is -1, then the byte sequence is malformed.
If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
sequence that encodes a single Unicode scalar value.
The data member will be passed as the first argument to the convert function.
The convert function is used to convert multibyte sequences;
s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
The convert function must return the Unicode scalar value
represented by this byte sequence or -1 if the byte sequence is malformed.
The convert function may be null if the encoding is a single-byte encoding,
that is if map[b] >= -1 for all bytes b.
When the parser is finished with the encoding, then if release is not null,
it will call release passing it the data member;
once release has been called, the convert function will not be called again.
Expat places certain restrictions on the encodings that are supported
using this mechanism.
1. Every ASCII character that can appear in a well-formed XML document,
other than the characters
$@\^`{}~
must be represented by a single byte, and that byte must be the
same byte that represents that character in ASCII.
2. No character may require more than 4 bytes to encode.
3. All characters encoded must have Unicode scalar values <= 0xFFFF,
(ie characters that would be encoded by surrogates in UTF-16
are not allowed). Note that this restriction doesn't apply to
the built-in support for UTF-8 and UTF-16.
4. No Unicode character may be encoded by more than one distinct sequence
of bytes. */
typedef struct {
int map[256];
void *data;
int (*convert)(void *data, const char *s);
void (*release)(void *data);
} XML_Encoding;
/* This is called for an encoding that is unknown to the parser.
The encodingHandlerData argument is that which was passed as the
second argument to XML_SetUnknownEncodingHandler.
The name argument gives the name of the encoding as specified in
the encoding declaration.
If the callback can provide information about the encoding,
it must fill in the XML_Encoding structure, and return 1.
Otherwise it must return 0.
If info does not describe a suitable encoding,
then the parser will return an XML_UNKNOWN_ENCODING error. */
typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
const XML_Char *name,
XML_Encoding *info);
void XMLPARSEAPI
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end);
void XMLPARSEAPI
XML_SetCharacterDataHandler(XML_Parser parser,
XML_CharacterDataHandler handler);
void XMLPARSEAPI
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler);
void XMLPARSEAPI
XML_SetCommentHandler(XML_Parser parser,
XML_CommentHandler handler);
void XMLPARSEAPI
XML_SetCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start,
XML_EndCdataSectionHandler end);
/* This sets the default handler and also inhibits expansion of internal entities.
The entity reference will be passed to the default handler. */
void XMLPARSEAPI
XML_SetDefaultHandler(XML_Parser parser,
XML_DefaultHandler handler);
/* This sets the default handler but does not inhibit expansion of internal entities.
The entity reference will not be passed to the default handler. */
void XMLPARSEAPI
XML_SetDefaultHandlerExpand(XML_Parser parser,
XML_DefaultHandler handler);
void XMLPARSEAPI
XML_SetDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end);
void XMLPARSEAPI
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
XML_UnparsedEntityDeclHandler handler);
void XMLPARSEAPI
XML_SetNotationDeclHandler(XML_Parser parser,
XML_NotationDeclHandler handler);
void XMLPARSEAPI
XML_SetExternalParsedEntityDeclHandler(XML_Parser parser,
XML_ExternalParsedEntityDeclHandler handler);
void XMLPARSEAPI
XML_SetInternalParsedEntityDeclHandler(XML_Parser parser,
XML_InternalParsedEntityDeclHandler handler);
void XMLPARSEAPI
XML_SetNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start,
XML_EndNamespaceDeclHandler end);
void XMLPARSEAPI
XML_SetNotStandaloneHandler(XML_Parser parser,
XML_NotStandaloneHandler handler);
void XMLPARSEAPI
XML_SetExternalEntityRefHandler(XML_Parser parser,
XML_ExternalEntityRefHandler handler);
/* If a non-null value for arg is specified here, then it will be passed
as the first argument to the external entity ref handler instead
of the parser object. */
void XMLPARSEAPI
XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
void XMLPARSEAPI
XML_SetUnknownEncodingHandler(XML_Parser parser,
XML_UnknownEncodingHandler handler,
void *encodingHandlerData);
/* This can be called within a handler for a start element, end element,
processing instruction or character data. It causes the corresponding
markup to be passed to the default handler. */
void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser);
/* This value is passed as the userData argument to callbacks. */
void XMLPARSEAPI
XML_SetUserData(XML_Parser parser, void *userData);
/* Returns the last value set by XML_SetUserData or null. */
#define XML_GetUserData(parser) (*(void **)(parser))
/* This is equivalent to supplying an encoding argument
to XML_ParserCreate. It must not be called after XML_Parse
or XML_ParseBuffer. */
int XMLPARSEAPI
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
/* If this function is called, then the parser will be passed
as the first argument to callbacks instead of userData.
The userData will still be accessible using XML_GetUserData. */
void XMLPARSEAPI
XML_UseParserAsHandlerArg(XML_Parser parser);
/* Sets the base to be used for resolving relative URIs in system identifiers in
declarations. Resolving relative identifiers is left to the application:
this value will be passed through as the base argument to the
XML_ExternalEntityRefHandler, XML_NotationDeclHandler
and XML_UnparsedEntityDeclHandler. The base argument will be copied.
Returns zero if out of memory, non-zero otherwise. */
int XMLPARSEAPI
XML_SetBase(XML_Parser parser, const XML_Char *base);
const XML_Char XMLPARSEAPI *
XML_GetBase(XML_Parser parser);
/* Returns the number of the attribute/value pairs passed in last call
to the XML_StartElementHandler that were specified in the start-tag
rather than defaulted. Each attribute/value pair counts as 2; thus
this correspondds to an index into the atts array passed to the
XML_StartElementHandler. */
int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
/* Returns the index of the ID attribute passed in the last call to
XML_StartElementHandler, or -1 if there is no ID attribute. Each
attribute/value pair counts as 2; thus this correspondds to an index
into the atts array passed to the XML_StartElementHandler. */
int XMLPARSEAPI XML_GetIdAttributeIndex(XML_Parser parser);
/* Parses some input. Returns 0 if a fatal error is detected.
The last call to XML_Parse must have isFinal true;
len may be zero for this call (or any other). */
int XMLPARSEAPI
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
void XMLPARSEAPI *
XML_GetBuffer(XML_Parser parser, int len);
int XMLPARSEAPI
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
/* Creates an XML_Parser object that can parse an external general entity;
context is a '\0'-terminated string specifying the parse context;
encoding is a '\0'-terminated string giving the name of the externally specified encoding,
or null if there is no externally specified encoding.
The context string consists of a sequence of tokens separated by formfeeds (\f);
a token consisting of a name specifies that the general entity of the name
is open; a token of the form prefix=uri specifies the namespace for a particular
prefix; a token of the form =uri specifies the default namespace.
This can be called at any point after the first call to an ExternalEntityRefHandler
so longer as the parser has not yet been freed.
The new parser is completely independent and may safely be used in a separate thread.
The handlers and userData are initialized from the parser argument.
Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
XML_Parser XMLPARSEAPI
XML_ExternalEntityParserCreate(XML_Parser parser,
const XML_Char *context,
const XML_Char *encoding);
enum XML_ParamEntityParsing {
XML_PARAM_ENTITY_PARSING_NEVER,
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
XML_PARAM_ENTITY_PARSING_ALWAYS
};
/* Controls parsing of parameter entities (including the external DTD
subset). If parsing of parameter entities is enabled, then references
to external parameter entities (including the external DTD subset)
will be passed to the handler set with
XML_SetExternalEntityRefHandler. The context passed will be 0.
Unlike external general entities, external parameter entities can only
be parsed synchronously. If the external parameter entity is to be
parsed, it must be parsed during the call to the external entity ref
handler: the complete sequence of XML_ExternalEntityParserCreate,
XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
this call. After XML_ExternalEntityParserCreate has been called to
create the parser for the external parameter entity (context must be 0
for this call), it is illegal to make any calls on the old parser
until XML_ParserFree has been called on the newly created parser. If
the library has been compiled without support for parameter entity
parsing (ie without XML_DTD being defined), then
XML_SetParamEntityParsing will return 0 if parsing of parameter
entities is requested; otherwise it will return non-zero. */
int XMLPARSEAPI
XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing parsing);
enum XML_Error {
XML_ERROR_NONE,
XML_ERROR_NO_MEMORY,
XML_ERROR_SYNTAX,
XML_ERROR_NO_ELEMENTS,
XML_ERROR_INVALID_TOKEN,
XML_ERROR_UNCLOSED_TOKEN,
XML_ERROR_PARTIAL_CHAR,
XML_ERROR_TAG_MISMATCH,
XML_ERROR_DUPLICATE_ATTRIBUTE,
XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
XML_ERROR_PARAM_ENTITY_REF,
XML_ERROR_UNDEFINED_ENTITY,
XML_ERROR_RECURSIVE_ENTITY_REF,
XML_ERROR_ASYNC_ENTITY,
XML_ERROR_BAD_CHAR_REF,
XML_ERROR_BINARY_ENTITY_REF,
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
XML_ERROR_MISPLACED_XML_PI,
XML_ERROR_UNKNOWN_ENCODING,
XML_ERROR_INCORRECT_ENCODING,
XML_ERROR_UNCLOSED_CDATA_SECTION,
XML_ERROR_EXTERNAL_ENTITY_HANDLING,
XML_ERROR_NOT_STANDALONE
};
/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
returns information about the error. */
enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
/* These functions return information about the current parse location.
They may be called when XML_Parse or XML_ParseBuffer return 0;
in this case the location is the location of the character at which
the error was detected.
They may also be called from any other callback called to report
some parse event; in this the location is the location of the first
of the sequence of characters that generated the event. */
int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
/* Return the number of bytes in the current event.
Returns 0 if the event is in an internal entity. */
int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser);
/* For backwards compatibility with previous versions. */
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
/* Frees memory used by the parser. */
void XMLPARSEAPI
XML_ParserFree(XML_Parser parser);
/* Returns a string describing the error. */
const XML_LChar XMLPARSEAPI *XML_ErrorString(int code);
#ifdef __cplusplus
}
#endif
#endif /* not XmlParse_INCLUDED */

View File

@ -0,0 +1,86 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#define ASCII_A 0x41
#define ASCII_B 0x42
#define ASCII_C 0x43
#define ASCII_D 0x44
#define ASCII_E 0x45
#define ASCII_F 0x46
#define ASCII_G 0x47
#define ASCII_H 0x48
#define ASCII_I 0x49
#define ASCII_J 0x4A
#define ASCII_K 0x4B
#define ASCII_L 0x4C
#define ASCII_M 0x4D
#define ASCII_N 0x4E
#define ASCII_O 0x4F
#define ASCII_P 0x50
#define ASCII_Q 0x51
#define ASCII_R 0x52
#define ASCII_S 0x53
#define ASCII_T 0x54
#define ASCII_U 0x55
#define ASCII_V 0x56
#define ASCII_W 0x57
#define ASCII_X 0x58
#define ASCII_Y 0x59
#define ASCII_Z 0x5A
#define ASCII_a 0x61
#define ASCII_b 0x62
#define ASCII_c 0x63
#define ASCII_d 0x64
#define ASCII_e 0x65
#define ASCII_f 0x66
#define ASCII_g 0x67
#define ASCII_h 0x68
#define ASCII_i 0x69
#define ASCII_j 0x6A
#define ASCII_k 0x6B
#define ASCII_l 0x6C
#define ASCII_m 0x6D
#define ASCII_n 0x6E
#define ASCII_o 0x6F
#define ASCII_p 0x70
#define ASCII_q 0x71
#define ASCII_r 0x72
#define ASCII_s 0x73
#define ASCII_t 0x74
#define ASCII_u 0x75
#define ASCII_v 0x76
#define ASCII_w 0x77
#define ASCII_x 0x78
#define ASCII_y 0x79
#define ASCII_z 0x7A
#define ASCII_0 0x30
#define ASCII_1 0x31
#define ASCII_2 0x32
#define ASCII_3 0x33
#define ASCII_4 0x34
#define ASCII_5 0x35
#define ASCII_6 0x36
#define ASCII_7 0x37
#define ASCII_8 0x38
#define ASCII_9 0x39
#define ASCII_TAB 0x09
#define ASCII_SPACE 0x20
#define ASCII_EXCL 0x21
#define ASCII_QUOT 0x22
#define ASCII_AMP 0x26
#define ASCII_APOS 0x27
#define ASCII_MINUS 0x2D
#define ASCII_PERIOD 0x2E
#define ASCII_COLON 0x3A
#define ASCII_SEMI 0x3B
#define ASCII_LT 0x3C
#define ASCII_EQUALS 0x3D
#define ASCII_GT 0x3E
#define ASCII_LSQB 0x5B
#define ASCII_RSQB 0x5D
#define ASCII_UNDERSCORE 0x5F

View File

@ -0,0 +1,37 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,

View File

@ -0,0 +1,15 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#define STRICT 1
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}

View File

@ -0,0 +1,38 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,

View File

@ -0,0 +1,37 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,

View File

@ -0,0 +1,150 @@
static const unsigned namingBitmap[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
0x40000000, 0xF580C900, 0x00000007, 0x02010800,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
0x00000000, 0x00004C40, 0x00000000, 0x00000000,
0x00000007, 0x00000000, 0x00000000, 0x00000000,
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
};
static const unsigned char nmstrtPages[] = {
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char namePages[] = {
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

View File

@ -0,0 +1,38 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,

View File

@ -0,0 +1,52 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#include <string.h>
#ifdef XML_WINLIB
#define WIN32_LEAN_AND_MEAN
#define STRICT
#include <windows.h>
#define malloc(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define calloc(x, y) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x)*(y))
#define free(x) HeapFree(GetProcessHeap(), 0, (x))
#define realloc(x, y) HeapReAlloc(GetProcessHeap(), 0, x, y)
#define abort() /* as nothing */
#else /* not XML_WINLIB */
#include <stdlib.h>
#endif /* not XML_WINLIB */
/* This file can be used for any definitions needed in
particular environments. */
/* Mozilla specific defines */
#ifdef MOZILLA_CLIENT
#include "nspr.h"
#define malloc(x) PR_Malloc((size_t)(x))
#define realloc(x, y) PR_Realloc((x), (size_t)(y))
#define calloc(x, y) PR_Calloc((x),(y))
#define free(x) PR_Free(x)
#if PR_BYTES_PER_INT != 4
#define int int32
#endif
/* Enable Unicode string processing in expat. */
#ifndef XML_UNICODE
#define XML_UNICODE
#endif
/* Enable external parameter entity parsing in expat */
#ifndef XML_DTD
#define XML_DTD 1
#endif
#endif /* MOZILLA_CLIENT */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#ifndef XmlRole_INCLUDED
#define XmlRole_INCLUDED 1
#include "xmltok.h"
#ifdef __cplusplus
extern "C" {
#endif
enum {
XML_ROLE_ERROR = -1,
XML_ROLE_NONE = 0,
XML_ROLE_XML_DECL,
XML_ROLE_INSTANCE_START,
XML_ROLE_DOCTYPE_NAME,
XML_ROLE_DOCTYPE_SYSTEM_ID,
XML_ROLE_DOCTYPE_PUBLIC_ID,
XML_ROLE_DOCTYPE_CLOSE,
XML_ROLE_GENERAL_ENTITY_NAME,
XML_ROLE_PARAM_ENTITY_NAME,
XML_ROLE_ENTITY_VALUE,
XML_ROLE_ENTITY_SYSTEM_ID,
XML_ROLE_ENTITY_PUBLIC_ID,
XML_ROLE_ENTITY_NOTATION_NAME,
XML_ROLE_NOTATION_NAME,
XML_ROLE_NOTATION_SYSTEM_ID,
XML_ROLE_NOTATION_NO_SYSTEM_ID,
XML_ROLE_NOTATION_PUBLIC_ID,
XML_ROLE_ATTRIBUTE_NAME,
XML_ROLE_ATTRIBUTE_TYPE_CDATA,
XML_ROLE_ATTRIBUTE_TYPE_ID,
XML_ROLE_ATTRIBUTE_TYPE_IDREF,
XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
XML_ROLE_ATTRIBUTE_ENUM_VALUE,
XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
XML_ROLE_ATTLIST_ELEMENT_NAME,
XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
XML_ROLE_FIXED_ATTRIBUTE_VALUE,
XML_ROLE_ELEMENT_NAME,
XML_ROLE_CONTENT_ANY,
XML_ROLE_CONTENT_EMPTY,
XML_ROLE_CONTENT_PCDATA,
XML_ROLE_GROUP_OPEN,
XML_ROLE_GROUP_CLOSE,
XML_ROLE_GROUP_CLOSE_REP,
XML_ROLE_GROUP_CLOSE_OPT,
XML_ROLE_GROUP_CLOSE_PLUS,
XML_ROLE_GROUP_CHOICE,
XML_ROLE_GROUP_SEQUENCE,
XML_ROLE_CONTENT_ELEMENT,
XML_ROLE_CONTENT_ELEMENT_REP,
XML_ROLE_CONTENT_ELEMENT_OPT,
XML_ROLE_CONTENT_ELEMENT_PLUS,
#ifdef XML_DTD
XML_ROLE_TEXT_DECL,
XML_ROLE_IGNORE_SECT,
XML_ROLE_INNER_PARAM_ENTITY_REF,
#endif /* XML_DTD */
XML_ROLE_PARAM_ENTITY_REF,
XML_ROLE_EXTERNAL_GENERAL_ENTITY_NO_NOTATION
};
typedef struct prolog_state {
int (*handler)(struct prolog_state *state,
int tok,
const char *ptr,
const char *end,
const ENCODING *enc);
unsigned level;
#ifdef XML_DTD
unsigned includeLevel;
int documentEntity;
#endif /* XML_DTD */
} PROLOG_STATE;
void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *);
#ifdef XML_DTD
void XMLTOKAPI XmlPrologStateInitExternalEntity(PROLOG_STATE *);
#endif /* XML_DTD */
#define XmlTokenRole(state, tok, ptr, end, enc) \
(((state)->handler)(state, tok, ptr, end, enc))
#ifdef __cplusplus
}
#endif
#endif /* not XmlRole_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,301 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#ifndef XmlTok_INCLUDED
#define XmlTok_INCLUDED 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef XMLTOKAPI
#define XMLTOKAPI /* as nothing */
#endif
/* The following token may be returned by XmlContentTok */
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of
illegal ]]> sequence */
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
#define XML_TOK_NONE -4 /* The string to be scanned is empty */
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
might be part of CRLF sequence */
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
#define XML_TOK_PARTIAL -1 /* only part of a token */
#define XML_TOK_INVALID 0
/* The following tokens are returned by XmlContentTok; some are also
returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */
#define XML_TOK_START_TAG_WITH_ATTS 1
#define XML_TOK_START_TAG_NO_ATTS 2
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
#define XML_TOK_END_TAG 5
#define XML_TOK_DATA_CHARS 6
#define XML_TOK_DATA_NEWLINE 7
#define XML_TOK_CDATA_SECT_OPEN 8
#define XML_TOK_ENTITY_REF 9
#define XML_TOK_CHAR_REF 10 /* numeric character reference */
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
#define XML_TOK_PI 11 /* processing instruction */
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
#define XML_TOK_COMMENT 13
#define XML_TOK_BOM 14 /* Byte order mark */
/* The following tokens are returned only by XmlPrologTok */
#define XML_TOK_PROLOG_S 15
#define XML_TOK_DECL_OPEN 16 /* <!foo */
#define XML_TOK_DECL_CLOSE 17 /* > */
#define XML_TOK_NAME 18
#define XML_TOK_NMTOKEN 19
#define XML_TOK_POUND_NAME 20 /* #name */
#define XML_TOK_OR 21 /* | */
#define XML_TOK_PERCENT 22
#define XML_TOK_OPEN_PAREN 23
#define XML_TOK_CLOSE_PAREN 24
#define XML_TOK_OPEN_BRACKET 25
#define XML_TOK_CLOSE_BRACKET 26
#define XML_TOK_LITERAL 27
#define XML_TOK_PARAM_ENTITY_REF 28
#define XML_TOK_INSTANCE_START 29
/* The following occur only in element type declarations */
#define XML_TOK_NAME_QUESTION 30 /* name? */
#define XML_TOK_NAME_ASTERISK 31 /* name* */
#define XML_TOK_NAME_PLUS 32 /* name+ */
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
#define XML_TOK_COMMA 38
/* The following token is returned only by XmlAttributeValueTok */
#define XML_TOK_ATTRIBUTE_VALUE_S 39
/* The following token is returned only by XmlCdataSectionTok */
#define XML_TOK_CDATA_SECT_CLOSE 40
/* With namespace processing this is returned by XmlPrologTok
for a name with a colon. */
#define XML_TOK_PREFIXED_NAME 41
#ifdef XML_DTD
#define XML_TOK_IGNORE_SECT 42
#endif /* XML_DTD */
#ifdef XML_DTD
#define XML_N_STATES 4
#else /* not XML_DTD */
#define XML_N_STATES 3
#endif /* not XML_DTD */
#define XML_PROLOG_STATE 0
#define XML_CONTENT_STATE 1
#define XML_CDATA_SECTION_STATE 2
#ifdef XML_DTD
#define XML_IGNORE_SECTION_STATE 3
#endif /* XML_DTD */
#define XML_N_LITERAL_TYPES 2
#define XML_ATTRIBUTE_VALUE_LITERAL 0
#define XML_ENTITY_VALUE_LITERAL 1
/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
#define XML_UTF8_ENCODE_MAX 4
/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
#define XML_UTF16_ENCODE_MAX 2
typedef struct position {
/* first line and first column are 0 not 1 */
unsigned long lineNumber;
unsigned long columnNumber;
} POSITION;
typedef struct {
const char *name;
const char *valuePtr;
const char *valueEnd;
char normalized;
} ATTRIBUTE;
struct encoding;
typedef struct encoding ENCODING;
struct encoding {
int (*scanners[XML_N_STATES])(const ENCODING *,
const char *,
const char *,
const char **);
int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
const char *,
const char *,
const char **);
int (*sameName)(const ENCODING *,
const char *, const char *);
int (*nameMatchesAscii)(const ENCODING *,
const char *, const char *, const char *);
int (*nameLength)(const ENCODING *, const char *);
const char *(*skipS)(const ENCODING *, const char *);
int (*getAtts)(const ENCODING *enc, const char *ptr,
int attsMax, ATTRIBUTE *atts);
int (*charRefNumber)(const ENCODING *enc, const char *ptr);
int (*predefinedEntityName)(const ENCODING *, const char *, const char *);
void (*updatePosition)(const ENCODING *,
const char *ptr,
const char *end,
POSITION *);
int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
const char **badPtr);
void (*utf8Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
char **toP,
const char *toLim);
void (*utf16Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
unsigned short **toP,
const unsigned short *toLim);
int minBytesPerChar;
char isUtf8;
char isUtf16;
};
/*
Scan the string starting at ptr until the end of the next complete token,
but do not scan past eptr. Return an integer giving the type of token.
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
Return XML_TOK_PARTIAL when the string does not contain a complete token;
nextTokPtr will not be set.
Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr
will be set to point to the character which made the token invalid.
Otherwise the string starts with a valid token; nextTokPtr will be set to point
to the character following the end of that token.
Each data character counts as a single token, but adjacent data characters
may be returned together. Similarly for characters in the prolog outside
literals, comments and processing instructions.
*/
#define XmlTok(enc, state, ptr, end, nextTokPtr) \
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
#ifdef XML_DTD
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
#endif /* XML_DTD */
/* This is used for performing a 2nd-level tokenization on
the content of a literal that has already been returned by XmlTok. */
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
#define XmlNameLength(enc, ptr) \
(((enc)->nameLength)(enc, ptr))
#define XmlSkipS(enc, ptr) \
(((enc)->skipS)(enc, ptr))
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
(((enc)->getAtts)(enc, ptr, attsMax, atts))
#define XmlCharRefNumber(enc, ptr) \
(((enc)->charRefNumber)(enc, ptr))
#define XmlPredefinedEntityName(enc, ptr, end) \
(((enc)->predefinedEntityName)(enc, ptr, end))
#define XmlUpdatePosition(enc, ptr, end, pos) \
(((enc)->updatePosition)(enc, ptr, end, pos))
#define XmlIsPublicId(enc, ptr, end, badPtr) \
(((enc)->isPublicId)(enc, ptr, end, badPtr))
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
typedef struct {
ENCODING initEnc;
const ENCODING **encPtr;
} INIT_ENCODING;
int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingNamePtr,
const ENCODING **namedEncodingPtr,
int *standalonePtr);
int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding(void);
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding(void);
int XMLTOKAPI XmlUtf8Encode(int charNumber, char *buf);
int XMLTOKAPI XmlUtf16Encode(int charNumber, unsigned short *buf);
int XMLTOKAPI XmlSizeOfUnknownEncoding(void);
ENCODING XMLTOKAPI *
XmlInitUnknownEncoding(void *mem,
int *table,
int (*conv)(void *userData, const char *p),
void *userData);
int XMLTOKAPI XmlParseXmlDeclNS(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingNamePtr,
const ENCODING **namedEncodingPtr,
int *standalonePtr);
int XMLTOKAPI XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncodingNS(void);
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncodingNS(void);
ENCODING XMLTOKAPI *
XmlInitUnknownEncodingNS(void *mem,
int *table,
int (*conv)(void *userData, const char *p),
void *userData);
#ifdef __cplusplus
}
#endif
#endif /* not XmlTok_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
enum {
BT_NONXML,
BT_MALFORM,
BT_LT,
BT_AMP,
BT_RSQB,
BT_LEAD2,
BT_LEAD3,
BT_LEAD4,
BT_TRAIL,
BT_CR,
BT_LF,
BT_GT,
BT_QUOT,
BT_APOS,
BT_EQUALS,
BT_QUEST,
BT_EXCL,
BT_SOL,
BT_SEMI,
BT_NUM,
BT_LSQB,
BT_S,
BT_NMSTRT,
BT_COLON,
BT_HEX,
BT_DIGIT,
BT_NAME,
BT_MINUS,
BT_OTHER, /* known not to be a name or name start character */
BT_NONASCII, /* might be a name or name start character */
BT_PERCNT,
BT_LPAR,
BT_RPAR,
BT_AST,
BT_PLUS,
BT_COMMA,
BT_VERBAR
};
#include <stddef.h>

View File

@ -0,0 +1,96 @@
const ENCODING *NS(XmlGetUtf8InternalEncoding)(void)
{
return &ns(internal_utf8_encoding).enc;
}
const ENCODING *NS(XmlGetUtf16InternalEncoding)(void)
{
#if XML_BYTE_ORDER == 12
return &ns(internal_little2_encoding).enc;
#elif XML_BYTE_ORDER == 21
return &ns(internal_big2_encoding).enc;
#else
const short n = 1;
return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc;
#endif
}
static
const ENCODING *NS(encodings)[] = {
&ns(latin1_encoding).enc,
&ns(ascii_encoding).enc,
&ns(utf8_encoding).enc,
&ns(big2_encoding).enc,
&ns(big2_encoding).enc,
&ns(little2_encoding).enc,
&ns(utf8_encoding).enc /* NO_ENC */
};
static
int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr);
}
static
int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr);
}
int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
{
int i = getEncodingIndex(name);
if (i == UNKNOWN_ENC)
return 0;
SET_INIT_ENC_INDEX(p, i);
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
p->initEnc.updatePosition = initUpdatePosition;
p->encPtr = encPtr;
*encPtr = &(p->initEnc);
return 1;
}
static
const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
{
#define ENCODING_MAX 128
char buf[ENCODING_MAX];
char *p = buf;
int i;
XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
if (ptr != end)
return 0;
*p = 0;
if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
return enc;
i = getEncodingIndex(buf);
if (i == UNKNOWN_ENC)
return 0;
return NS(encodings)[i];
}
int NS(XmlParseXmlDecl)(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingName,
const ENCODING **encoding,
int *standalone)
{
return doParseXmlDecl(NS(findEncoding),
isGeneralTextEntity,
enc,
ptr,
end,
badPtr,
versionPtr,
encodingName,
encoding,
standalone);
}

View File

@ -0,0 +1,40 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright:
#
# Makefile : Builds BC++ library for 32-bit BC++
WXDIR = $(WXWIN)
expat_dir = $(WXDIR)\contrib\src\xrc\expat
XMLPARSEDIR = $(expat_dir)\xmlparse
XMLTOKDIR = $(expat_dir)\xmltok
EXPAT_DEFS=-I$(expat_dir)\xmlparse -I$(expat_dir)\xmltok
EXPAT_OBJECTS=xmltok.obj xmlrole.obj xmlparse.obj
EXTRACPPFLAGS=$(wxLIBXMLDIR) $(EXPAT_DEFS)
LIBTARGET=$(WXDIR)\lib\wxxrc.lib
OBJECTS=$(EXPAT_OBJECTS) \
xml.obj xmlbin.obj xmlbinz.obj xmlexpat.obj xmlwrite.obj xmlres.obj xmlrsall.obj \
xh_bttn.obj xh_chckb.obj xh_chckl.obj xh_choic.obj xh_combo.obj xh_dlg.obj \
xh_gauge.obj xh_html.obj xh_menu.obj xh_notbk.obj xh_panel.obj xh_radbt.obj \
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj \
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj \
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj \
xh_tree.obj xh_unkwn.obj xh_frame.obj
!include $(WXDIR)\src\makelib.b32
{$(XMLPARSEDIR)}.c.obj:
bcc32 $(EXPAT_DEFS) -c -w-ccc -w-rch -w-par {$< }
{$(XMLTOKDIR)}.c.obj:
bcc32 $(EXPAT_DEFS) -c -w-ccc -w-rch -w-par {$< }

View File

@ -0,0 +1,40 @@
#
# File: makefile.g95
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright: (c) Julian Smart, 2000
#
# Makefile for wxWindows wxXML library (Cygwin/Mingw32).
WXDIR = ../../..
expat_dir = $(WXDIR)/contrib/src/xrc/expat
XMLPARSEDIR = $(expat_dir)/xmlparse
XMLTOKDIR=$(expat_dir)/xmltok
EXPAT_DEFS=-I$(expat_dir)/xmlparse -I$(expat_dir)/xmltok
EXTRACPPFLAGS=$(EXPAT_DEFS)
XMLPARSEDIR_OBJECTS=xmlparse.o
XMLTOKDIR_OBJECTS=xmltok.o xmlrole.o
LIBTARGET=$(WXDIR)/lib/libwxxrc.a
OBJECTS= $(XMLPARSEDIR_OBJECTS) $(XMLTOKDIR_OBJECTS) \
xml.o xmlbin.o xmlbinz.o xmlexpat.o xmlwrite.o xmlres.o xmlrsall.o \
xh_bttn.o xh_chckb.o xh_chckl.o xh_choic.o xh_combo.o xh_dlg.o \
xh_gauge.o xh_html.o xh_menu.o xh_notbk.o xh_panel.o xh_radbt.o \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o
include $(WXDIR)/src/makelib.g95
$(XMLPARSEDIR_OBJECTS):
$(CC) -g $(EXPAT_DEFS) -c -o $@ $(XMLPARSEDIR)/$(patsubst %.o,%.c, $@)
$(XMLTOKDIR_OBJECTS):
$(CC) -g $(EXPAT_DEFS) -c -o $@ $(XMLTOKDIR)/$(patsubst %.o,%.c, $@)

149
contrib/src/xrc/makefile.vc Normal file
View File

@ -0,0 +1,149 @@
# File: makefile.vc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds wxXML classes library (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
wxXMLDIR = $(WXDIR)\contrib\src\xrc
wxXMLINC = $(WXDIR)\contrib\include\wx\xml
THISDIR = $(WXDIR)\contrib\src\xrc
DOCDIR=$(WXDIR)\contrib\docs
LOCALDOCDIR=$(WXDIR)\contrib\docs\latex\xml
NOPCH=1
EXPAT_DIR=$(THISDIR)\expat
E1=$(EXPAT_DIR)\xmlparse
E2=$(EXPAT_DIR)\xmltok
EXPAT_INCS=-I$(THISDIR)\expat\xmlparse -I$(THISDIR)\expat\xmltok
EXPAT_OBJS=$(D)\xmlparse.obj $(D)\xmlrole.obj $(D)\xmltok.obj
# Set this to where your libxml directory is
EXTRAFLAGS=$(EXPAT_INCS)
# Unfortunately we need this _before_ we include makelib.vc
!if "$(FINAL)" == "1"
D=Release
!else
D=Debug
LIBEXT=d
!endif
LIBTARGET=$(WXDIR)\lib\wxxrc$(LIBEXT).lib
EXTRATARGETS=$(D)
OBJECTS=$(EXPAT_OBJS) \
$(D)\xml.obj $(D)\xmlbin.obj $(D)\xmlbinz.obj $(D)\xmlres.obj \
$(D)\xmlrsall.obj $(D)\xh_bttn.obj $(D)\xh_chckb.obj $(D)\xh_chckl.obj \
$(D)\xh_choic.obj $(D)\xh_combo.obj $(D)\xh_dlg.obj \
$(D)\xh_frame.obj $(D)\xh_gauge.obj $(D)\xh_html.obj $(D)\xh_menu.obj \
$(D)\xh_notbk.obj $(D)\xh_panel.obj $(D)\xh_radbt.obj \
$(D)\xh_radbx.obj $(D)\xh_sizer.obj $(D)\xh_slidr.obj $(D)\xh_spin.obj \
$(D)\xh_stbmp.obj $(D)\xh_sttxt.obj \
$(D)\xh_text.obj $(D)\xh_listb.obj $(D)\xh_toolb.obj \
$(D)\xh_bmpbt.obj $(D)\xh_cald.obj $(D)\xh_listc.obj $(D)\xh_scrol.obj \
$(D)\xh_stbox.obj $(D)\xh_tree.obj $(D)\xh_stlin.obj $(D)\xh_bmp.obj \
$(D)\xh_unkwn.obj $(D)\xmlwrite.obj $(D)\xmlexpat.obj
!include $(WXDIR)\src\makelib.vc
{$(E1)}.c{$(D)}.obj:
$(cc) @<<
$(CPPFLAGS) /c /Fo$@ /Tc $<
<<
{$(E2)}.c{$(D)}.obj:
$(cc) @<<
$(CPPFLAGS) /c /Fo$@ /Tc $<
<<
DOCSOURCES=$(LOCALDOCDIR)\xml.tex \
$(LOCALDOCDIR)\bugs.tex $(LOCALDOCDIR)\changes.tex\
$(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\intro.tex\
$(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex
html: $(DOCDIR)\html\xml\xml.htm
htmlhelp: $(DOCDIR)\htmlhelp\xml.chm
htb: $(DOCDIR)\htb\xml.htb
hlp: $(DOCDIR)\winhelp\xml.hlp
pdfrtf: $(DOCDIR)\pdf\xml.rtf
ps: $(DOCDIR)\ps\xml.ps
touchmanual:
touch $(LOCALDOCDIR)\xml.tex
$(DOCDIR)\winhelp\xml.hlp: $(LOCALDOCDIR)\xml.rtf $(LOCALDOCDIR)\xml.hpj
cd $(LOCALDOCDIR)
-erase xml.ph
hc xml
move xml.hlp $(DOCDIR)\winhelp\xml.hlp
move xml.cnt $(DOCDIR)\winhelp\xml.cnt
cd $(THISDIR)
$(LOCALDOCDIR)\xml.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(LOCALDOCDIR)\xml.rtf -twice -winhelp
cd $(THISDIR)
$(DOCDIR)\pdf\xml.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-copy *.bmp $(DOCDIR)\pdf
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(DOCDIR)\pdf\xml.rtf -twice -rtf
cd $(THISDIR)
$(DOCDIR)\html\xml\xml.htm: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-mkdir $(DOCDIR)\html\xml
copy *.gif $(DOCDIR)\html\xml
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(DOCDIR)\html\xml\xml.htm -twice -html
-erase $(DOCDIR)\html\xml\*.con
-erase *.con
-erase $(DOCDIR)\html\xml\*.ref
cd $(THISDIR)
$(DOCDIR)\htmlhelp\xml.chm: $(DOCDIR)\html\xml\xml.htm $(DOCDIR)\html\xml\xml.hhp
cd $(DOCDIR)\html\xml
-hhc xml.hhp
move xml.chm $(DOCDIR)\htmlhelp\xml.chm
cd $(THISDIR)
# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk
# files, renamed to htb.
# This can then be used with e.g. helpview.
# Optionally, a cached version of the .hhp file can be generated with hhp2cached.
$(DOCDIR)\htb\xml.htb: $(DOCDIR)\html\xml\xml.htm
cd $(DOCDIR)\html\xml
-erase xml.zip xml.htb
zip xml.zip *.htm *.gif *.hhp *.hhc *.hhk
-mkdir $(DOCDIR)\htb
move xml.zip $(DOCDIR)\htb\xml.htb
cd $(THISDIR)
$(LOCALDOCDIR)\xml.dvi: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-latex xml
-latex xml
-makeindx xml
-bibtex xml
-latex xml
-latex xml
cd $(THISDIR)
$(WXDIR)\docs\ps\xml.ps: $(LOCALDOCDIR)\xml.dvi
cd $(LOCALDOCDIR)
-dvips32 -o xml.ps xml
move xml.ps $(WXDIR)\docs\ps\xml.ps
cd $(THISDIR)

View File

@ -0,0 +1,31 @@
# wxXML makefile
WXDIR = ..\..\..
EXTRACPPFLAGS=/Id:\libxml\libxml2-2.1.1
!include $(WXDIR)\src\makewat.env
WXXMLLIB = $(WXDIR)\lib\wxxrc.lib
THISDIR = $(WXDIR)\contrib\src\xrc
NAME = wxxrc
LNK = $(name).lnk
OBJECTS=xml.obj xmlbin.obj xmlbinz.obj xmlpars.obj xmlres.obj xmlrsall.obj &
xh_bttn.obj xh_chckb.obj xh_chckl.obj xh_choic.obj xh_combo.obj xh_dlg.obj &
xh_gauge.obj xh_html.obj xh_menu.obj xh_notbk.obj xh_panel.obj xh_radbt.obj &
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj &
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj &
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj &
xh_tree.obj xh_unkwn.obj xh_frame.obj
all: $(WXXMLLIB)
$(WXXMLLIB): $(OBJECTS)
*wlib /b /c /n /P=256 $(WXXMLLIB) $(OBJECTS)
clean: .SYMBOLIC
-erase *.obj *.bak *.err *.pch $(WXXMLLIB) *.lbc

254
contrib/src/xrc/wxXMLVC.dsp Normal file
View File

@ -0,0 +1,254 @@
# Microsoft Developer Studio Project File - Name="wxXMLVC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=wxXMLVC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "wxXMLVC.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "wxXMLVC.mak" CFG="wxXMLVC - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wxXMLVC - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "wxXMLVC - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "wxXMLVC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /I "expat/xmlparse" /I "expat/xmltok" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\wxxrc.lib"
!ELSEIF "$(CFG)" == "wxXMLVC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /I "expat/xmlparse" /I "expat/xmltok" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\wxxrcd.lib"
!ENDIF
# Begin Target
# Name "wxXMLVC - Win32 Release"
# Name "wxXMLVC - Win32 Debug"
# Begin Group "Expat"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\expat\xmlparse\xmlparse.c
# End Source File
# Begin Source File
SOURCE=.\expat\xmltok\xmlrole.c
# End Source File
# Begin Source File
SOURCE=.\expat\xmltok\xmltok.c
# End Source File
# End Group
# Begin Source File
SOURCE=.\xh_bmp.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_bmpbt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_bttn.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_cald.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_chckb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_chckl.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_choic.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_combo.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_dlg.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_frame.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_gauge.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_html.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_listb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_listc.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_menu.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_notbk.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_panel.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_radbt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_radbx.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_scrol.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_sizer.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_slidr.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_spin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbmp.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbox.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stlin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_sttxt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_text.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_toolb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_tree.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_unkwn.cpp
# End Source File
# Begin Source File
SOURCE=.\xml.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlbin.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlbinz.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlexpat.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlres.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlrsall.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlwrite.cpp
# End Source File
# End Target
# End Project

View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "wxXMLVC"=.\wxXMLVC.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

View File

@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmp.cpp
// Purpose: XML resource for wxBitmap and wxIcon
// Author: Vaclav Slavik
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bmp.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_bmp.h"
#include "wx/bitmap.h"
wxBitmapXmlHandler::wxBitmapXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxBitmapXmlHandler::DoCreateResource()
{
return new wxBitmap(GetBitmap(wxT("")));
}
bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmap"));
}
wxIconXmlHandler::wxIconXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxIconXmlHandler::DoCreateResource()
{
return new wxIcon(GetIcon(wxT("")));
}
bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxIcon"));
}

View File

@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmpbt.cpp
// Purpose: XML resource for bitmap buttons
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bmpbt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_bmpbt.h"
#include <wx/bmpbuttn.h>
wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_AUTODRAW);
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
{
wxBitmapButton *button = new wxBitmapButton(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
if (!GetParamValue(wxT("selected")).IsEmpty())
button->SetBitmapSelected(GetBitmap(wxT("selected")));
if (!GetParamValue(wxT("focus")).IsEmpty())
button->SetBitmapFocus(GetBitmap(wxT("focus")));
if (!GetParamValue(wxT("disabled")).IsEmpty())
button->SetBitmapDisabled(GetBitmap(wxT("disabled")));
return button;
}
bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmapButton"));
}

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bttn.cpp
// Purpose: XML resource for buttons
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bttn.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_bttn.h"
#include "wx/button.h"
wxButtonXmlHandler::wxButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxButtonXmlHandler::DoCreateResource()
{
wxButton *button = new wxButton(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
return button;
}
bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxButton"));
}

View File

@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_cald.cpp
// Purpose: XML resource for wxCalendarCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_cald.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_cald.h"
#include "wx/event.h"
#include "wx/calctrl.h"
wxCalendarCtrlXmlHandler::wxCalendarCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxCAL_SUNDAY_FIRST);
ADD_STYLE(wxCAL_MONDAY_FIRST);
ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
AddWindowStyles();
}
wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
{
wxCalendarCtrl *calendar = new wxCalendarCtrl(m_parentAsWindow,
GetID(),
wxDefaultDateTime,
/*TODO: take it from resource*/
GetPosition(), GetSize(),
GetStyle(),
GetName());
SetupWindow(calendar);
return calendar;
}
bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCalendarCtrl"));
}

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_chckb.cpp
// Purpose: XML resource for wxCheckBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_chckb.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_chckb.h"
#include "wx/checkbox.h"
#if wxUSE_CHECKBOX
wxCheckBoxXmlHandler::wxCheckBoxXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxCheckBoxXmlHandler::DoCreateResource()
{
wxCheckBox *control = new wxCheckBox(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetValue( GetBool( wxT("checked")));
SetupWindow(control);
return control;
}
bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCheckBox"));
}
#endif

View File

@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_chckl.cpp
// Purpose: XML resource for wxCheckList
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_chckl.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_chckl.h"
#include "wx/checklst.h"
wxCheckListXmlHandler::wxCheckListXmlHandler()
: wxXmlResourceHandler(), m_insideBox(FALSE)
{
// no styles
AddWindowStyles();
}
wxObject *wxCheckListXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxCheckList"))
{
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxCheckListBox *control = new wxCheckListBox(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
// step through children myself (again.)
wxXmlNode *n = GetParamNode(wxT("content"));
if (n) n = n->GetChildren();
int i = 0;
while (n)
{
if (n->GetType() != wxXML_ELEMENT_NODE ||
n->GetName() != wxT("item"))
{ n = n->GetNext(); continue; }
// checking boolean is a bit ugly here (see GetBool() )
wxString v = n->GetPropVal(wxT("checked"), wxEmptyString);
v.MakeLower();
if (v && v == wxT("1"))
control->Check( i, TRUE );
i++;
n = n->GetNext();
}
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item checked="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxCheckListXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxCheckList")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}

View File

@ -0,0 +1,95 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_choic.cpp
// Purpose: XML resource for wxChoice
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_choic.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_choic.h"
#include "wx/choice.h"
wxChoiceXmlHandler::wxChoiceXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SORT);
AddWindowStyles();
}
wxObject *wxChoiceXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxChoice"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxChoice *control = new wxChoice(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxChoiceXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxChoice")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}

View File

@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_combo.cpp
// Purpose: XML resource for wxRadioBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_combo.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_combo.h"
#include "wx/combobox.h"
#if wxUSE_COMBOBOX
wxComboBoxXmlHandler::wxComboBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SIMPLE);
ADD_STYLE(wxCB_SORT);
ADD_STYLE(wxCB_READONLY);
ADD_STYLE(wxCB_DROPDOWN);
AddWindowStyles();
}
wxObject *wxComboBoxXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxComboBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxComboBox *control = new wxComboBox(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxComboBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}
#endif

View File

@ -0,0 +1,80 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_dlg.cpp
// Purpose: XML resource for dialogs
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_dlg.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_dlg.h"
#include "wx/dialog.h"
#include "wx/log.h"
#include "wx/intl.h"
wxDialogXmlHandler::wxDialogXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxDIALOG_MODAL);
ADD_STYLE(wxDIALOG_MODELESS);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxDialogXmlHandler::DoCreateResource()
{
wxDialog *dlg = wxDynamicCast(m_instance, wxDialog);
wxASSERT_MSG(dlg, _("XML resource: Cannot create dialog without instance."));
dlg->Create(m_parentAsWindow,
GetID(),
GetText(wxT("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(wxT("style"), wxDEFAULT_DIALOG_STYLE),
GetName());
dlg->SetClientSize(GetSize());
dlg->Move(GetPosition());
SetupWindow(dlg);
CreateChildren(dlg);
if (GetBool(_("centered"), FALSE))
dlg->Centre();
return dlg;
}
bool wxDialogXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxDialog"));
}

View File

@ -0,0 +1,85 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_frame.cpp
// Purpose: XML resource for dialogs
// Author: Vaclav Slavik & Aleks.
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_frame.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_frame.h"
#include "wx/frame.h"
#include "wx/log.h"
#include "wx/intl.h"
wxFrameXmlHandler::wxFrameXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxCAPTION);
ADD_STYLE(wxDEFAULT_DIALOG_STYLE);
ADD_STYLE(wxDEFAULT_FRAME_STYLE);
ADD_STYLE(wxTHICK_FRAME);
ADD_STYLE(wxSYSTEM_MENU);
ADD_STYLE(wxRESIZE_BORDER);
ADD_STYLE(wxRESIZE_BOX);
ADD_STYLE(wxFRAME_TOOL_WINDOW);
ADD_STYLE(wxFRAME_FLOAT_ON_PARENT);
ADD_STYLE(wxMAXIMIZE_BOX);
ADD_STYLE(wxMINIMIZE_BOX);
ADD_STYLE(wxSTAY_ON_TOP);
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxFrameXmlHandler::DoCreateResource()
{
wxFrame *frame = wxDynamicCast(m_instance, wxFrame);
wxASSERT_MSG(frame, _("XML resource: Cannot create dialog without instance."));
frame->Create(m_parentAsWindow,
GetID(),
GetText(_T("title")),
wxDefaultPosition, wxDefaultSize,
GetStyle(_T("style"), wxDEFAULT_FRAME_STYLE),
GetName());
frame->SetClientSize(GetSize());
frame->Move(GetPosition());
SetupWindow(frame);
CreateChildren(frame);
if (GetBool(_("centered"), FALSE))
frame->Centre();
return frame;
}
bool wxFrameXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, _T("wxFrame"));
}

View File

@ -0,0 +1,74 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_gauge.cpp
// Purpose: XML resource for wxGauge
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_gauge.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_gauge.h"
#include "wx/gauge.h"
#if wxUSE_GAUGE
wxGaugeXmlHandler::wxGaugeXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxGA_HORIZONTAL );
ADD_STYLE( wxGA_VERTICAL );
ADD_STYLE( wxGA_PROGRESSBAR );
ADD_STYLE( wxGA_SMOOTH ); // windows only
AddWindowStyles();
}
wxObject *wxGaugeXmlHandler::DoCreateResource()
{
wxGauge *control = new wxGauge(m_parentAsWindow,
GetID(),
GetLong( wxT("range"), wxGAUGE_DEFAULT_RANGE),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( HasParam( wxT("value") ))
{
control->SetValue( GetLong( wxT("value") ));
}
if( HasParam( wxT("shadow") ))
{
control->SetShadowWidth( GetDimension( wxT("shadow") ));
}
if( HasParam( wxT("bezel") ))
{
control->SetBezelFace( GetDimension( wxT("bezel") ));
}
SetupWindow(control);
return control;
}
bool wxGaugeXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxGauge"));
}
#endif // wxUSE_GAUGE

View File

@ -0,0 +1,72 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_html.cpp
// Purpose: XML resource for wxHtmlWindow
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_html.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_html.h"
#if wxUSE_HTML
#include "wx/html/htmlwin.h"
wxHtmlWindowXmlHandler::wxHtmlWindowXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxHW_SCROLLBAR_NEVER );
ADD_STYLE( wxHW_SCROLLBAR_AUTO );
AddWindowStyles();
}
wxObject *wxHtmlWindowXmlHandler::DoCreateResource()
{
wxHtmlWindow *control = new wxHtmlWindow(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style" ), wxHW_SCROLLBAR_AUTO),
GetName()
);
if( HasParam( wxT("borders") ))
{
control->SetBorders( GetDimension( wxT("borders" )));
}
if( HasParam( wxT("url") ))
{
control->LoadPage( GetParamValue( wxT("url" )));
}
else if( HasParam( wxT("htmlcode") ))
{
control->SetPage( GetText(wxT("htmlcode")) );
}
SetupWindow(control);
return control;
}
bool wxHtmlWindowXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxHtmlWindow"));
}
#endif // wxUSE_HTML

View File

@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_listb.cpp
// Purpose: XML resource for wxListBox
// Author: Bob Mitchell & Vaclav Slavik
// Created: 2000/07/29
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_listb.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_listb.h"
#include "wx/listbox.h"
wxListBoxXmlHandler::wxListBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxLB_SINGLE);
ADD_STYLE(wxLB_MULTIPLE);
ADD_STYLE(wxLB_EXTENDED);
ADD_STYLE(wxLB_HSCROLL);
ADD_STYLE(wxLB_ALWAYS_SB);
ADD_STYLE(wxLB_NEEDED_SB);
ADD_STYLE(wxLB_SORT);
AddWindowStyles();
}
wxObject *wxListBoxXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxListBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxListBox *control = new wxListBox(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxListBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxListBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}

View File

@ -0,0 +1,67 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_listc.cpp
// Purpose: XML resource for wxListCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_listc.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/textctrl.h"
#include "wx/xrc/xh_listc.h"
#include "wx/listctrl.h"
wxListCtrlXmlHandler::wxListCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLC_LIST);
ADD_STYLE(wxLC_REPORT);
ADD_STYLE(wxLC_ICON);
ADD_STYLE(wxLC_SMALL_ICON);
ADD_STYLE(wxLC_ALIGN_TOP);
ADD_STYLE(wxLC_ALIGN_LEFT);
ADD_STYLE(wxLC_AUTOARRANGE);
ADD_STYLE(wxLC_USER_TEXT);
ADD_STYLE(wxLC_EDIT_LABELS);
ADD_STYLE(wxLC_NO_HEADER);
ADD_STYLE(wxLC_SINGLE_SEL);
ADD_STYLE(wxLC_SORT_ASCENDING);
ADD_STYLE(wxLC_SORT_DESCENDING);
AddWindowStyles();
}
wxObject *wxListCtrlXmlHandler::DoCreateResource()
{
wxListCtrl *list = new wxListCtrl(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
/* TODO: columns definition */
SetupWindow(list);
return list;
}
bool wxListCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxListCtrl"));
}

135
contrib/src/xrc/xh_menu.cpp Normal file
View File

@ -0,0 +1,135 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_menu.cpp
// Purpose: XML resource for menus and menubars
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_menu.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_menu.h"
#include "wx/menu.h"
wxMenuXmlHandler::wxMenuXmlHandler() :
wxXmlResourceHandler(), m_insideMenu(FALSE)
{
ADD_STYLE(wxMENU_TEAROFF);
}
wxObject *wxMenuXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxMenu"))
{
wxMenu *menu = new wxMenu(GetStyle());
wxString title = GetText(wxT("label"));
wxString help = GetText(wxT("help"));
bool oldins = m_insideMenu;
m_insideMenu = TRUE;
CreateChildren(menu, TRUE/*only this handler*/);
m_insideMenu = oldins;
wxMenuBar *p_bar = wxDynamicCast(m_parent, wxMenuBar);
if (p_bar)
p_bar->Append(menu, title);
else
{
wxMenu *p_menu = wxDynamicCast(m_parent, wxMenu);
if (p_menu)
p_menu->Append(GetID(), title, menu, help);
}
return menu;
}
else
{
wxMenu *p_menu = wxDynamicCast(m_parent, wxMenu);
if (m_class == wxT("separator"))
p_menu->AppendSeparator();
else if (m_class == wxT("break"))
p_menu->Break();
else /*wxMenuItem*/
{
int id = GetID();
bool checkable = GetBool(wxT("checkable"));
wxString label = GetText(wxT("label"));
wxString accel = GetText(wxT("accel"));
wxString fullLabel = label;
if (!accel.IsEmpty())
fullLabel << wxT("\t") << accel;
wxMenuItem *mitem = new wxMenuItem(p_menu, id, fullLabel,
GetText(wxT("help")), checkable);
#if wxCHECK_VERSION(2,3,0) || defined(__WXMSW__)
if (HasParam(wxT("bitmap")))
mitem->SetBitmap(GetBitmap(wxT("bitmap")));
#endif
p_menu->Append(mitem);
mitem->Enable(GetBool(wxT("enabled"), TRUE));
if (checkable) mitem->Check(GetBool(wxT("checked")));
}
return NULL;
}
}
bool wxMenuXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxMenu")) ||
(m_insideMenu &&
(IsOfClass(node, wxT("wxMenuItem")) ||
IsOfClass(node, wxT("break")) ||
IsOfClass(node, wxT("separator")))
);
}
wxMenuBarXmlHandler::wxMenuBarXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxMB_DOCKABLE);
}
wxObject *wxMenuBarXmlHandler::DoCreateResource()
{
wxMenuBar *menubar = new wxMenuBar(GetStyle());
CreateChildren(menubar);
return menubar;
}
bool wxMenuBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxMenuBar"));
}

View File

@ -0,0 +1,100 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_notbk.cpp
// Purpose: XML resource for wxNotebook
// Author: Vaclav Slavik
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_notbk.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_notbk.h"
#if wxUSE_NOTEBOOK
#include "wx/log.h"
#include "wx/notebook.h"
#include "wx/sizer.h"
wxNotebookXmlHandler::wxNotebookXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_notebook(NULL)
{
ADD_STYLE(wxNB_FIXEDWIDTH);
ADD_STYLE(wxNB_LEFT);
ADD_STYLE(wxNB_RIGHT);
ADD_STYLE(wxNB_BOTTOM);
AddWindowStyles();
}
wxObject *wxNotebookXmlHandler::DoCreateResource()
{
if (m_class == wxT("notebookpage"))
{
wxXmlNode *n = GetParamNode(wxT("object"));
if (n)
{
bool old_ins = m_isInside;
m_isInside = FALSE;
m_isInside = old_ins;
wxObject *item = CreateResFromNode(n, m_notebook, NULL);
wxWindow *wnd = wxDynamicCast(item, wxWindow);
if (wnd)
m_notebook->AddPage(wnd, GetText(wxT("label")),
GetBool(wxT("selected"), 0));
else
wxLogError(wxT("Error in resource."));
return wnd;
}
else
{
wxLogError(wxT("Error in resource: no control within notebook's <page> tag."));
return NULL;
}
}
else {
wxNotebook *nb = new wxNotebook(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style" )),
GetName());
wxNotebook *old_par = m_notebook;
m_notebook = nb;
bool old_ins = m_isInside;
m_isInside = TRUE;
CreateChildren(m_notebook, TRUE/*only this handler*/);
m_isInside = old_ins;
m_notebook = old_par;
if (GetBool(wxT("usenotebooksizer"), FALSE))
return new wxNotebookSizer(nb);
else
return nb;
}
}
bool wxNotebookXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_isInside && IsOfClass(node, wxT("wxNotebook"))) ||
(m_isInside && IsOfClass(node, wxT("notebookpage"))));
}
#endif

View File

@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_panel.cpp
// Purpose: XML resource for panels
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_panel.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_panel.h"
#include "wx/panel.h"
wxPanelXmlHandler::wxPanelXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxNO_3D);
ADD_STYLE(wxTAB_TRAVERSAL);
ADD_STYLE(wxWS_EX_VALIDATE_RECURSIVELY);
ADD_STYLE(wxCLIP_CHILDREN);
AddWindowStyles();
}
wxObject *wxPanelXmlHandler::DoCreateResource()
{
wxPanel *panel = wxDynamicCast(m_instance, wxPanel);
if (panel == NULL)
panel = new wxPanel(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxTAB_TRAVERSAL),
GetName());
else
panel->Create(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxTAB_TRAVERSAL),
GetName());
SetupWindow(panel);
CreateChildren(panel);
return panel;
}
bool wxPanelXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxPanel"));
}

View File

@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_radbt.cpp
// Purpose: XML resource for wxRadioButton
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_radbt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_radbt.h"
#include "wx/radiobut.h"
#if wxUSE_RADIOBOX
wxRadioButtonXmlHandler::wxRadioButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxRB_GROUP );
AddWindowStyles();
}
wxObject *wxRadioButtonXmlHandler::DoCreateResource()
{
/* BOBM - implementation note.
* once the wxBitmapRadioButton is implemented.
* look for a bitmap property. If not null,
* make it a wxBitmapRadioButton instead of the
* normal radio button.
*/
wxRadioButton *control = new wxRadioButton(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetValue( GetBool(wxT("value"), 0));
SetupWindow(control);
return control;
}
bool wxRadioButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxRadioButton"));
}
#endif

View File

@ -0,0 +1,102 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_radbx.cpp
// Purpose: XML resource for wxRadioBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_radbx.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_radbx.h"
#include "wx/radiobox.h"
#if wxUSE_RADIOBOX
wxRadioBoxXmlHandler::wxRadioBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxRA_SPECIFY_COLS);
ADD_STYLE(wxRA_HORIZONTAL);
ADD_STYLE(wxRA_SPECIFY_ROWS);
ADD_STYLE(wxRA_VERTICAL);
AddWindowStyles();
}
wxObject *wxRadioBoxXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxRadioBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxRadioBox *control = new wxRadioBox(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetLong( wxT("dimension"), 1 ),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item selected="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxRadioBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxRadioBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}
#endif

View File

@ -0,0 +1,63 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_scrol.cpp
// Purpose: XML resource for wxScrollBar
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_scrol.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_scrol.h"
#include "wx/scrolbar.h"
wxScrollBarXmlHandler::wxScrollBarXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSB_HORIZONTAL );
ADD_STYLE( wxSB_VERTICAL );
AddWindowStyles();
}
wxObject *wxScrollBarXmlHandler::DoCreateResource()
{
wxScrollBar *control = new wxScrollBar(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetScrollbar(GetLong( wxT("value"), 0),
GetLong( wxT("thumbsize"),1),
GetLong( wxT("range"), 10),
GetLong( wxT("pagesize"),1)
);
SetupWindow(control);
return control;
}
bool wxScrollBarXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxScrollBar"));
}

View File

@ -0,0 +1,219 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_sizer.cpp
// Purpose: XML resource for wxBoxSizer
// Author: Vaclav Slavik
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_sizer.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_sizer.h"
#include "wx/sizer.h"
#include "wx/log.h"
#include "wx/statbox.h"
#include "wx/notebook.h"
#include "wx/tokenzr.h"
bool wxSizerXmlHandler::IsSizerNode(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxBoxSizer"))) ||
(IsOfClass(node, wxT("wxStaticBoxSizer"))) ||
(IsOfClass(node, wxT("wxGridSizer"))) ||
(IsOfClass(node, wxT("wxFlexGridSizer")));
}
wxSizerXmlHandler::wxSizerXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_parentSizer(NULL)
{
ADD_STYLE(wxHORIZONTAL);
ADD_STYLE(wxVERTICAL);
// and flags
ADD_STYLE(wxLEFT);
ADD_STYLE(wxRIGHT);
ADD_STYLE(wxTOP);
ADD_STYLE(wxBOTTOM);
ADD_STYLE(wxNORTH);
ADD_STYLE(wxSOUTH);
ADD_STYLE(wxEAST);
ADD_STYLE(wxWEST);
ADD_STYLE(wxALL);
ADD_STYLE(wxGROW);
ADD_STYLE(wxEXPAND);
ADD_STYLE(wxSHAPED);
ADD_STYLE(wxSTRETCH_NOT);
ADD_STYLE(wxALIGN_CENTER);
ADD_STYLE(wxALIGN_CENTRE);
ADD_STYLE(wxALIGN_LEFT);
ADD_STYLE(wxALIGN_TOP);
ADD_STYLE(wxALIGN_RIGHT);
ADD_STYLE(wxALIGN_BOTTOM);
ADD_STYLE(wxALIGN_CENTER_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTRE_HORIZONTAL);
ADD_STYLE(wxALIGN_CENTER_VERTICAL);
ADD_STYLE(wxALIGN_CENTRE_VERTICAL);
}
wxObject *wxSizerXmlHandler::DoCreateResource()
{
if (m_class == wxT("sizeritem"))
{
wxXmlNode *n = GetParamNode(wxT("object"));
if (n)
{
bool old_ins = m_isInside;
wxSizer *old_par = m_parentSizer;
m_isInside = FALSE;
if (!IsSizerNode(n)) m_parentSizer = NULL;
wxObject *item = CreateResFromNode(n, m_parent, NULL);
m_isInside = old_ins;
m_parentSizer = old_par;
wxSizer *sizer = wxDynamicCast(item, wxSizer);
wxWindow *wnd = wxDynamicCast(item, wxWindow);
wxSize minsize = GetSize(wxT("minsize"));
if (sizer)
{
m_parentSizer->Add(sizer, GetLong(wxT("option")),
GetStyle(wxT("flag")), GetDimension(wxT("border")));
if (!(minsize == wxDefaultSize))
m_parentSizer->SetItemMinSize(sizer, minsize.x, minsize.y);
}
else if (wnd)
{
m_parentSizer->Add(wnd, GetLong(wxT("option")),
GetStyle(wxT("flag")), GetDimension(wxT("border")));
if (!(minsize == wxDefaultSize))
m_parentSizer->SetItemMinSize(wnd, minsize.x, minsize.y);
}
else
wxLogError(wxT("Error in resource."));
return item;
}
else /*n == NULL*/
{
wxLogError(wxT("Error in resource: no control/sizer within sizer's <item> tag."));
return NULL;
}
}
else if (m_class == wxT("spacer"))
{
wxCHECK_MSG(m_parentSizer, NULL, wxT("Incorrect syntax of XML resource: spacer not within sizer!"));
wxSize sz = GetSize();
m_parentSizer->Add(sz.x, sz.y,
GetLong(wxT("option")), GetStyle(wxT("flag")), GetDimension(wxT("border")));
return NULL;
}
else {
wxSizer *sizer = NULL;
wxXmlNode *parentNode = m_node->GetParent();
wxCHECK_MSG(m_parentSizer != NULL ||
((IsOfClass(parentNode, wxT("wxPanel")) ||
IsOfClass(parentNode, wxT("wxDialog"))) &&
parentNode->GetType() == wxXML_ELEMENT_NODE), NULL,
wxT("Incorrect use of sizer: parent is not 'wxDialog' or 'wxPanel'."));
if (m_class == wxT("wxBoxSizer"))
sizer = new wxBoxSizer(GetStyle(wxT("orient"), wxHORIZONTAL));
else if (m_class == wxT("wxStaticBoxSizer"))
{
sizer = new wxStaticBoxSizer(
new wxStaticBox(m_parentAsWindow, -1, GetText(wxT("label"))),
GetStyle(wxT("orient"), wxHORIZONTAL));
}
else if (m_class == wxT("wxGridSizer"))
sizer = new wxGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")),
GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
else if (m_class == wxT("wxFlexGridSizer"))
{
wxFlexGridSizer *fsizer =
new wxFlexGridSizer(GetLong(wxT("rows")), GetLong(wxT("cols")),
GetDimension(wxT("vgap")), GetDimension(wxT("hgap")));
sizer = fsizer;
wxStringTokenizer tkn;
unsigned long l;
tkn.SetString(GetParamValue(wxT("growablerows")), wxT(","));
while (tkn.HasMoreTokens())
{
if (!tkn.GetNextToken().ToULong(&l))
wxLogError(wxT("growablerows must be comma-separated list of row numbers"));
else
fsizer->AddGrowableRow(l);
}
tkn.SetString(GetParamValue(wxT("growablecols")), wxT(","));
while (tkn.HasMoreTokens())
{
if (!tkn.GetNextToken().ToULong(&l))
wxLogError(wxT("growablecols must be comma-separated list of column numbers"));
else
fsizer->AddGrowableCol(l);
}
}
wxSize minsize = GetSize(wxT("minsize"));
if (!(minsize == wxDefaultSize))
sizer->SetMinSize(minsize);
wxSizer *old_par = m_parentSizer;
m_parentSizer = sizer;
bool old_ins = m_isInside;
m_isInside = TRUE;
CreateChildren(m_parent, TRUE/*only this handler*/);
m_isInside = old_ins;
m_parentSizer = old_par;
if (m_parentSizer == NULL) // setup window:
{
m_parentAsWindow->SetAutoLayout(TRUE);
m_parentAsWindow->SetSizer(sizer);
wxXmlNode *nd = m_node;
m_node = parentNode;
if (GetSize() == wxDefaultSize)
sizer->Fit(m_parentAsWindow);
m_node = nd;
if (m_parentAsWindow->GetWindowStyle() & (wxRESIZE_BOX | wxRESIZE_BORDER))
sizer->SetSizeHints(m_parentAsWindow);
}
return sizer;
}
}
bool wxSizerXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_isInside && IsSizerNode(node)) ||
(m_isInside && IsOfClass(node, wxT("sizeritem"))) ||
(m_isInside && IsOfClass(node, wxT("spacer"))));
}

View File

@ -0,0 +1,94 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_slidr.cpp
// Purpose: XML resource for wxSlider
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_slidr.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_slidr.h"
#include "wx/slider.h"
#if wxUSE_SLIDER
wxSliderXmlHandler::wxSliderXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSL_HORIZONTAL );
ADD_STYLE( wxSL_VERTICAL );
ADD_STYLE( wxSL_AUTOTICKS );
ADD_STYLE( wxSL_LABELS );
ADD_STYLE( wxSL_LEFT );
ADD_STYLE( wxSL_TOP );
ADD_STYLE( wxSL_RIGHT );
ADD_STYLE( wxSL_BOTTOM );
ADD_STYLE( wxSL_BOTH );
ADD_STYLE( wxSL_SELRANGE );
AddWindowStyles();
}
wxObject *wxSliderXmlHandler::DoCreateResource()
{
wxSlider *control = new wxSlider(m_parentAsWindow,
GetID(),
GetLong( wxT("value"), wxSL_DEFAULT_VALUE),
GetLong( wxT("min"), wxSL_DEFAULT_MIN),
GetLong( wxT("max"), wxSL_DEFAULT_MAX),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
if( HasParam( wxT("tickfreq") ))
{
control->SetTickFreq( GetLong( wxT("tickfreq") ), 0 );
}
if( HasParam( wxT("pagesize") ))
{
control->SetPageSize( GetLong( wxT("pagesize") ) );
}
if( HasParam( wxT("linesize") ))
{
control->SetLineSize( GetLong( wxT("linesize") ));
}
if( HasParam( wxT("thumb") ))
{
control->SetThumbLength( GetLong( wxT("thumb") ));
}
if( HasParam( wxT("tick") ))
{
control->SetTick( GetLong( wxT("tick") ));
}
if( HasParam( wxT("selmin") ) && HasParam( wxT("selmax")) )
{
control->SetSelection( GetLong( wxT("selmin") ), GetLong( wxT("selmax")) );
}
SetupWindow(control);
return control;
}
bool wxSliderXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSlider"));
}
#endif

View File

@ -0,0 +1,99 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_spin.cpp
// Purpose: XML resource for wxSpinButton
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_spin.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_spin.h"
#include "wx/spinctrl.h"
#if wxUSE_SPINBTN
wxSpinButtonXmlHandler::wxSpinButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
AddWindowStyles();
}
wxObject *wxSpinButtonXmlHandler::DoCreateResource()
{
wxSpinButton *control = new wxSpinButton(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle( wxT("style"), wxSP_VERTICAL | wxSP_ARROW_KEYS ),
GetName()
);
control->SetValue( GetLong( wxT("value"), wxSP_DEFAULT_VALUE) );
control->SetRange( GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX) );
SetupWindow(control);
return control;
}
bool wxSpinButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSpinButton"));
}
#endif // wxUSE_SPINBTN
#if wxUSE_SPINCTRL
wxSpinCtrlXmlHandler::wxSpinCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE( wxSP_HORIZONTAL );
ADD_STYLE( wxSP_VERTICAL );
ADD_STYLE( wxSP_ARROW_KEYS );
ADD_STYLE( wxSP_WRAP );
}
wxObject *wxSpinCtrlXmlHandler::DoCreateResource()
{
wxSpinCtrl *control = new wxSpinCtrl(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle( wxT("style"), wxSP_ARROW_KEYS ),
GetLong( wxT("min"), wxSP_DEFAULT_MIN),
GetLong( wxT("max"), wxSP_DEFAULT_MAX),
GetLong( wxT("value"), wxSP_DEFAULT_VALUE),
GetName()
);
SetupWindow(control);
return control;
}
bool wxSpinCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxSpinCtrl"));
}
#endif // wxUSE_SPINCTRL

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stbmp.cpp
// Purpose: XML resource for wxStaticBitmap
// Author: Vaclav Slavik
// Created: 2000/04/22
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_stbmp.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_stbmp.h"
#include "wx/statbmp.h"
wxStaticBitmapXmlHandler::wxStaticBitmapXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxStaticBitmapXmlHandler::DoCreateResource()
{
wxStaticBitmap *bmp = new wxStaticBitmap(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap"), GetSize()),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(bmp);
return bmp;
}
bool wxStaticBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBitmap"));
}

View File

@ -0,0 +1,52 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stbox.cpp
// Purpose: XML resource for wxStaticBox
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_stbox.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_stbox.h"
#include "wx/statbox.h"
wxStaticBoxXmlHandler::wxStaticBoxXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxStaticBoxXmlHandler::DoCreateResource()
{
wxStaticBox *box = new wxStaticBox(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(box);
return box;
}
bool wxStaticBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticBox"));
}

View File

@ -0,0 +1,55 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_stbox.cpp
// Purpose: XML resource for wxStaticLine
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_stlin.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_stlin.h"
#include "wx/statline.h"
#if wxUSE_STATLINE
wxStaticLineXmlHandler::wxStaticLineXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxLI_HORIZONTAL);
ADD_STYLE(wxLI_VERTICAL);
AddWindowStyles();
}
wxObject *wxStaticLineXmlHandler::DoCreateResource()
{
wxStaticLine *line = new wxStaticLine(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxLI_HORIZONTAL),
GetName()
);
SetupWindow(line);
return line;
}
bool wxStaticLineXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticLine"));
}
#endif

View File

@ -0,0 +1,56 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_sttxt.cpp
// Purpose: XML resource for wxStaticText
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_sttxt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_sttxt.h"
#include "wx/stattext.h"
wxStaticTextXmlHandler::wxStaticTextXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxST_NO_AUTORESIZE);
ADD_STYLE(wxALIGN_LEFT);
ADD_STYLE(wxALIGN_RIGHT);
ADD_STYLE(wxALIGN_CENTRE);
AddWindowStyles();
}
wxObject *wxStaticTextXmlHandler::DoCreateResource()
{
wxStaticText *text = new wxStaticText(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
GetName()
);
SetupWindow(text);
return text;
}
bool wxStaticTextXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxStaticText"));
}

View File

@ -0,0 +1,58 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_text.cpp
// Purpose: XML resource for wxTextCtrl
// Author: Aleksandras Gluchovas
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Aleksandras Gluchovas
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_text.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_text.h"
#include "wx/textctrl.h"
wxTextCtrlXmlHandler::wxTextCtrlXmlHandler() : wxXmlResourceHandler()
{
ADD_STYLE(wxTE_PROCESS_ENTER);
ADD_STYLE(wxTE_PROCESS_TAB);
ADD_STYLE(wxTE_MULTILINE);
ADD_STYLE(wxTE_PASSWORD);
ADD_STYLE(wxTE_READONLY);
ADD_STYLE(wxHSCROLL);
AddWindowStyles();
}
wxObject *wxTextCtrlXmlHandler::DoCreateResource()
{
wxTextCtrl *text = new wxTextCtrl(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
SetupWindow(text);
return text;
}
bool wxTextCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTextCtrl"));
}

View File

@ -0,0 +1,129 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_toolb.cpp
// Purpose: XML resource for wxBoxSizer
// Author: Vaclav Slavik
// Created: 2000/08/11
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_toolb.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_toolb.h"
#include "wx/toolbar.h"
#if wxUSE_TOOLBAR
wxToolBarXmlHandler::wxToolBarXmlHandler()
: wxXmlResourceHandler(), m_isInside(FALSE), m_toolbar(NULL)
{
ADD_STYLE(wxTB_FLAT);
ADD_STYLE(wxTB_DOCKABLE);
ADD_STYLE(wxTB_VERTICAL);
ADD_STYLE(wxTB_HORIZONTAL);
}
wxObject *wxToolBarXmlHandler::DoCreateResource()
{
if (m_class == wxT("tool"))
{
wxCHECK_MSG(m_toolbar, NULL, wxT("Incorrect syntax of XML resource: tool not within a toolbar!"));
m_toolbar->AddTool(GetID(),
GetBitmap(wxT("bitmap")),
GetBitmap(wxT("bitmap2")),
GetBool(wxT("toggle")),
GetPosition().x,
GetPosition().y,
NULL,
GetText(wxT("tooltip")),
GetText(wxT("longhelp")));
return m_toolbar; // must return non-NULL
}
else if (m_class == wxT("separator"))
{
wxCHECK_MSG(m_toolbar, NULL, wxT("Incorrect syntax of XML resource: separator not within a toolbar!"));
m_toolbar->AddSeparator();
return m_toolbar; // must return non-NULL
}
else /*<object class="wxToolBar">*/
{
int style = GetStyle(wxT("style"), wxNO_BORDER | wxTB_HORIZONTAL);
#ifdef __WXMSW__
if (!(style & wxNO_BORDER)) style |= wxNO_BORDER;
#endif
wxToolBar *toolbar = new wxToolBar(m_parentAsWindow,
GetID(),
GetPosition(),
GetSize(),
style,
GetName());
wxSize bmpsize = GetSize(wxT("bitmapsize"));
if (!(bmpsize == wxDefaultSize))
toolbar->SetToolBitmapSize(bmpsize);
wxSize margins = GetSize(wxT("margins"));
if (!(margins == wxDefaultSize))
toolbar->SetMargins(margins.x, margins.y);
long packing = GetLong(wxT("packing"), -1);
if (packing != -1)
toolbar->SetToolPacking(packing);
long separation = GetLong(wxT("separation"), -1);
if (separation != -1)
toolbar->SetToolSeparation(separation);
wxXmlNode *children_node = GetParamNode(wxT("object"));
if (children_node == NULL) return toolbar;
m_isInside = TRUE;
m_toolbar = toolbar;
wxXmlNode *n = children_node;
while (n)
{
if (n->GetType() == wxXML_ELEMENT_NODE &&
n->GetName() == wxT("object"))
{
wxObject *created = CreateResFromNode(n, toolbar, NULL);
wxControl *control = wxDynamicCast(created, wxControl);
if (IsOfClass(n, wxT("tool")) &&
IsOfClass(n, wxT("separator")) &&
control != NULL)
toolbar->AddControl(control);
}
n = n->GetNext();
}
m_isInside = FALSE;
m_toolbar = NULL;
toolbar->Realize();
return toolbar;
}
}
bool wxToolBarXmlHandler::CanHandle(wxXmlNode *node)
{
return ((!m_isInside && IsOfClass(node, wxT("wxToolBar"))) ||
(m_isInside && IsOfClass(node, wxT("tool"))) ||
(m_isInside && IsOfClass(node, wxT("separator"))));
}
#endif

View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_tree.cpp
// Purpose: XML resource for wxTreeCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_tree.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_tree.h"
#include "wx/treectrl.h"
wxTreeCtrlXmlHandler::wxTreeCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxTR_HAS_BUTTONS);
ADD_STYLE(wxTR_EDIT_LABELS);
ADD_STYLE(wxTR_MULTIPLE);
AddWindowStyles();
}
wxObject *wxTreeCtrlXmlHandler::DoCreateResource()
{
wxTreeCtrl *tree = new wxTreeCtrl(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
SetupWindow(tree);
return tree;
}
bool wxTreeCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxTreeCtrl"));
}

View File

@ -0,0 +1,91 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_unkwn.cpp
// Purpose: XML resource for unknown widget
// Author: Vaclav Slavik
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_unkwn.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_unkwn.h"
#include "wx/window.h"
#include "wx/log.h"
#include "wx/sizer.h"
class wxUnknownControlContainer : public wxPanel
{
public:
wxUnknownControlContainer(wxWindow *parent,
const wxString& controlName,
wxWindowID id = -1,
const wxPoint& pos = wxDefaultPosition,
const wxSize& size = wxDefaultSize)
: wxPanel(parent, id, pos, size, wxTAB_TRAVERSAL | wxNO_BORDER,
controlName + wxT("_container")),
m_controlName(controlName), m_controlAdded(FALSE)
{
m_bg = GetBackgroundColour();
SetBackgroundColour(wxColour(255, 0, 255));
}
virtual void AddChild(wxWindowBase *child);
protected:
wxString m_controlName;
bool m_controlAdded;
wxColour m_bg;
};
void wxUnknownControlContainer::AddChild(wxWindowBase *child)
{
wxASSERT_MSG( !m_controlAdded, wxT("Couldn't add two unknown controls to the same container!") )
wxPanel::AddChild(child);
SetBackgroundColour(m_bg);
child->SetName(m_controlName);
child->SetId(XMLID(m_controlName));
m_controlAdded = TRUE;
wxSizer *sizer = new wxBoxSizer(wxHORIZONTAL);
sizer->Add((wxWindow*)child, 1, wxEXPAND);
SetSizer(sizer);
SetAutoLayout(TRUE);
Layout();
}
wxUnknownWidgetXmlHandler::wxUnknownWidgetXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxUnknownWidgetXmlHandler::DoCreateResource()
{
wxPanel *panel =
new wxUnknownControlContainer(m_parentAsWindow,
GetName(), -1,
GetPosition(), GetSize());
SetupWindow(panel);
return panel;
}
bool wxUnknownWidgetXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("unknown"));
}

441
contrib/src/xrc/xml.cpp Normal file
View File

@ -0,0 +1,441 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xml.cpp
// Purpose: wxXmlDocument - XML parser & data holder class
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xml.h"
#pragma implementation "xmlio.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/wfstream.h"
#include "wx/datstrm.h"
#include "wx/zstream.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/xrc/xml.h"
#include "wx/xrc/xmlio.h"
wxXmlNode::wxXmlNode(wxXmlNode *parent,wxXmlNodeType type,
const wxString& name, const wxString& content,
wxXmlProperty *props, wxXmlNode *next)
: m_type(type), m_name(name), m_content(content),
m_properties(props), m_parent(parent),
m_children(NULL), m_next(next)
{
if (m_parent)
{
if (m_parent->m_children)
{
m_next = m_parent->m_children;
m_parent->m_children = this;
}
else
m_parent->m_children = this;
}
}
wxXmlNode::wxXmlNode(wxXmlNodeType type, const wxString& name,
const wxString& content)
: m_type(type), m_name(name), m_content(content),
m_properties(NULL), m_parent(NULL),
m_children(NULL), m_next(NULL)
{}
wxXmlNode::wxXmlNode(const wxXmlNode& node)
{
m_next = NULL;
m_parent = NULL;
DoCopy(node);
}
wxXmlNode& wxXmlNode::operator=(const wxXmlNode& node)
{
delete m_properties;
delete m_children;
DoCopy(node);
return *this;
}
void wxXmlNode::DoCopy(const wxXmlNode& node)
{
m_type = node.m_type;
m_name = node.m_name;
m_content = node.m_content;
m_children = NULL;
wxXmlNode *n = node.m_children;
while (n)
{
AddChild(new wxXmlNode(*n));
n = n->GetNext();
}
m_properties = NULL;
wxXmlProperty *p = node.m_properties;
while (p)
{
AddProperty(p->GetName(), p->GetValue());
p = p->GetNext();
}
}
bool wxXmlNode::HasProp(const wxString& propName) const
{
wxXmlProperty *prop = GetProperties();
while (prop)
{
if (prop->GetName() == propName) return TRUE;
prop = prop->GetNext();
}
return FALSE;
}
bool wxXmlNode::GetPropVal(const wxString& propName, wxString *value) const
{
wxXmlProperty *prop = GetProperties();
while (prop)
{
if (prop->GetName() == propName)
{
*value = prop->GetValue();
return TRUE;
}
prop = prop->GetNext();
}
return FALSE;
}
wxString wxXmlNode::GetPropVal(const wxString& propName, const wxString& defaultVal) const
{
wxString tmp;
if (GetPropVal(propName, &tmp))
return tmp;
else
return defaultVal;
}
void wxXmlNode::AddChild(wxXmlNode *child)
{
if (m_children == NULL)
m_children = child;
else
{
wxXmlNode *ch = m_children;
while (ch->m_next) ch = ch->m_next;
ch->m_next = child;
}
child->m_next = NULL;
child->m_parent = this;
}
void wxXmlNode::InsertChild(wxXmlNode *child, wxXmlNode *before_node)
{
wxASSERT_MSG(before_node->GetParent() == this, wxT("wxXmlNode::InsertChild - the node has incorrect parent"));
if (m_children == before_node)
m_children = child;
else
{
wxXmlNode *ch = m_children;
while (ch->m_next != before_node) ch = ch->m_next;
ch->m_next = child;
}
child->m_parent = this;
child->m_next = before_node;
}
bool wxXmlNode::RemoveChild(wxXmlNode *child)
{
if (m_children == NULL)
return FALSE;
else if (m_children == child)
{
m_children = child->m_next;
child->m_parent = NULL;
child->m_next = NULL;
return TRUE;
}
else
{
wxXmlNode *ch = m_children;
while (ch->m_next)
{
if (ch->m_next == child)
{
ch->m_next = child->m_next;
child->m_parent = NULL;
child->m_next = NULL;
return TRUE;
}
ch = ch->m_next;
}
return FALSE;
}
}
void wxXmlNode::AddProperty(const wxString& name, const wxString& value)
{
AddProperty(new wxXmlProperty(name, value, NULL));
}
void wxXmlNode::AddProperty(wxXmlProperty *prop)
{
if (m_properties == NULL)
m_properties = prop;
else
{
wxXmlProperty *p = m_properties;
while (p->GetNext()) p = p->GetNext();
p->SetNext(prop);
}
}
bool wxXmlNode::DeleteProperty(const wxString& name)
{
if (m_properties == NULL)
return FALSE;
else if (m_properties->GetName() == name)
{
wxXmlProperty *prop = m_properties;
m_properties = prop->GetNext();
prop->SetNext(NULL);
delete prop;
return TRUE;
}
else
{
wxXmlProperty *p = m_properties;
while (p->GetNext())
{
if (p->GetNext()->GetName() == name)
{
wxXmlProperty *prop = p->GetNext();
p->SetNext(prop->GetNext());
prop->SetNext(NULL);
delete prop;
return TRUE;
}
p = p->GetNext();
}
return FALSE;
}
}
wxList *wxXmlDocument::sm_handlers = NULL;
wxXmlDocument::wxXmlDocument(const wxString& filename, wxXmlIOType io_type)
: wxObject(), m_root(NULL)
{
if (!Load(filename, io_type))
{
delete m_root;
m_root = NULL;
}
}
wxXmlDocument::wxXmlDocument(wxInputStream& stream, wxXmlIOType io_type)
: wxObject(), m_root(NULL)
{
if (!Load(stream, io_type))
{
delete m_root;
m_root = NULL;
}
}
wxXmlDocument::wxXmlDocument(const wxXmlDocument& doc)
{
DoCopy(doc);
}
wxXmlDocument& wxXmlDocument::operator=(const wxXmlDocument& doc)
{
delete m_root;
DoCopy(doc);
return *this;
}
void wxXmlDocument::DoCopy(const wxXmlDocument& doc)
{
m_version = doc.m_version;
m_encoding = doc.m_encoding;
m_root = new wxXmlNode(*doc.m_root);
}
bool wxXmlDocument::Load(const wxString& filename, wxXmlIOType io_type)
{
wxFileInputStream stream(filename);
return Load(stream, io_type);
}
bool wxXmlDocument::Load(wxInputStream& stream, wxXmlIOType io_type)
{
wxNode *n = sm_handlers->GetFirst();
while (n)
{
wxXmlIOHandler *h = (wxXmlIOHandler*) n->GetData();
if ((io_type == wxXML_IO_AUTO || io_type == h->GetType()) &&
h->CanLoad(stream))
{
return h->Load(stream, *this);
}
n = n->GetNext();
}
wxLogError(_("Cannot find XML I/O handler capable of loading this format."));
return FALSE;
}
bool wxXmlDocument::Save(const wxString& filename, wxXmlIOType io_type) const
{
wxFileOutputStream stream(filename);
return Save(stream, io_type);
}
bool wxXmlDocument::Save(wxOutputStream& stream, wxXmlIOType io_type) const
{
wxNode *n = sm_handlers->GetFirst();
while (n)
{
wxXmlIOHandler *h = (wxXmlIOHandler*) n->GetData();
if (io_type == h->GetType() && h->CanSave())
{
return h->Save(stream, *this);
}
n = n->GetNext();
}
wxLogError(_("Cannot find XML I/O handler capable of saving in this format."));
return FALSE;
}
void wxXmlDocument::AddHandler(wxXmlIOHandler *handler)
{
if (sm_handlers == NULL)
{
sm_handlers = new wxList;
sm_handlers->DeleteContents(TRUE);
}
sm_handlers->Append(handler);
}
void wxXmlDocument::CleanUpHandlers()
{
delete sm_handlers;
sm_handlers = NULL;
}
void wxXmlDocument::InitStandardHandlers()
{
AddHandler(new wxXmlIOHandlerBin);
#if wxUSE_ZLIB
AddHandler(new wxXmlIOHandlerBinZ);
#endif
AddHandler(new wxXmlIOHandlerExpat);
AddHandler(new wxXmlIOHandlerWriter);
}
#include "wx/module.h"
class wxXmlModule: public wxModule
{
DECLARE_DYNAMIC_CLASS(wxXmlModule)
public:
wxXmlModule() {}
bool OnInit() { wxXmlDocument::InitStandardHandlers(); return TRUE; };
void OnExit() { wxXmlDocument::CleanUpHandlers(); };
};
IMPLEMENT_DYNAMIC_CLASS(wxXmlModule, wxModule)
// When wxXml is loaded dynamically after the application is already running
// then the built-in module system won't pick this one up. Add it manually.
void wxXmlInitXmlModule()
{
wxModule* module = new wxXmlModule;
module->Init();
wxModule::RegisterModule(module);
}

161
contrib/src/xrc/xmlbin.cpp Normal file
View File

@ -0,0 +1,161 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlbin.cpp
// Purpose: wxXmlIOHandlerBin
// Author: Vaclav Slavik
// Created: 2000/07/24
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// nothing, already in xml.cpp
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/datstrm.h"
#include "wx/log.h"
#include "wx/intl.h"
#include "wx/xrc/xmlio.h"
bool wxXmlIOHandlerBin::CanLoad(wxInputStream& stream)
{
bool canread;
canread = (ReadHeader(stream) == wxT("XMLBIN "));
stream.SeekI(-9, wxFromCurrent);
return canread;
}
wxString wxXmlIOHandlerBin::ReadHeader(wxInputStream& stream)
{
wxUint8 version;
char cheader[8];
stream.Read(cheader, 8);
cheader[7] = 0;
stream.Read(&version, 1);
if (version != 1) return wxEmptyString;
else return wxString(cheader);
}
void wxXmlIOHandlerBin::WriteHeader(wxOutputStream& stream, const wxString& header)
{
char cheader[8];
size_t i;
wxUint8 version = 1;
for (i = 0; i < header.Length(); i++) cheader[i] = header[i];
for (; i < 7; i++) cheader[i] = ' ';
cheader[7] = 0;
stream.Write(cheader, 8);
stream.Write(&version, 1);
}
static bool SaveBinNode(wxDataOutputStream& ds, wxXmlNode *node)
{
if (node)
{
ds << (wxUint8)1 <<
(wxUint8)node->GetType() <<
node->GetName() << node->GetContent();
wxXmlProperty *prop = node->GetProperties();
while (prop)
{
ds << (wxUint8)1;
ds << prop->GetName() << prop->GetValue();
prop = prop->GetNext();
}
ds << (wxUint8)0;
SaveBinNode(ds, node->GetNext());
SaveBinNode(ds, node->GetChildren());
}
else
ds << (wxUint8)0;
return TRUE;
}
bool wxXmlIOHandlerBin::Save(wxOutputStream& stream, const wxXmlDocument& doc)
{
WriteHeader(stream, "XMLBIN ");
wxDataOutputStream ds(stream);
ds << doc.GetVersion() << doc.GetEncoding();
SaveBinNode(ds, doc.GetRoot());
return stream.LastError() == wxSTREAM_NOERROR;
}
static wxXmlProperty *LoadBinProp(wxDataInputStream& ds)
{
wxUint8 dummy;
ds >> dummy;
if (dummy == 0) return NULL;
wxString name, value;
ds >> name >> value;
return new wxXmlProperty(name, value, LoadBinProp(ds));
}
static wxXmlNode *LoadBinNode(wxDataInputStream& ds, wxXmlNode *parent)
{
wxUint8 type;
wxString name, content;
wxUint8 dummy;
ds >> dummy;
if (dummy == 0) return NULL;
ds >> type >> name >> content;
wxXmlProperty *prop = LoadBinProp(ds);
wxXmlNode *nd = new wxXmlNode(parent, (wxXmlNodeType)type, name, content,
prop, LoadBinNode(ds, parent));
LoadBinNode(ds, nd);
return nd;
}
bool wxXmlIOHandlerBin::Load(wxInputStream& stream, wxXmlDocument& doc)
{
ReadHeader(stream);
wxDataInputStream ds(stream);
wxString tmp;
ds >> tmp;
doc.SetVersion(tmp);
ds >> tmp;
doc.SetEncoding(tmp);
doc.SetRoot(LoadBinNode(ds, NULL));
return (doc.GetRoot() != NULL);
}

View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlbinz.cpp
// Purpose: wxXmlIOHandlerBinZ
// Author: Vaclav Slavik
// Created: 2000/07/24
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// nothing, already in xml.cpp
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/datstrm.h"
#include "wx/log.h"
#include "wx/zstream.h"
#include "wx/xrc/xmlio.h"
#if wxUSE_ZLIB
bool wxXmlIOHandlerBinZ::CanLoad(wxInputStream& stream)
{
bool canread;
canread = (ReadHeader(stream) == wxT("XMLBINZ"));
stream.SeekI(-9, wxFromCurrent);
return canread;
}
bool wxXmlIOHandlerBinZ::Save(wxOutputStream& stream, const wxXmlDocument& doc)
{
WriteHeader(stream, "XMLBINZ");
wxZlibOutputStream costr(stream, 9);
return wxXmlIOHandlerBin::Save(costr, doc);
}
bool wxXmlIOHandlerBinZ::Load(wxInputStream& stream, wxXmlDocument& doc)
{
ReadHeader(stream);
wxZlibInputStream costr(stream);
return wxXmlIOHandlerBin::Load(costr, doc);
}
#endif

View File

@ -0,0 +1,198 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlexpat.cpp
// Purpose: wxXmlDocument - XML reader via Expat
// Author: Vaclav Slavik
// Created: 2001/04/30
// RCS-ID: $Id$
// Copyright: (c) 2001 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// nothing - already in xml.cpp
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/wfstream.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/strconv.h"
#include "wx/xrc/xmlio.h"
#include "xmlparse.h"
/*
FIXME:
- handle unknown encodings
- process all elements, including CDATA
- XML resources should automatically select desired encoding besed on
runtime environment (?) (would need BIN and BINZ formats modification,
too)
*/
// converts Expat-produced string in UTF-8 into wxString.
inline static wxString CharToString(const char *s, size_t len = wxSTRING_MAXLEN)
{
#if wxUSE_UNICODE
return wxString(s, wxMBConvUTF8, len);
#else
return wxString(s, len);
#endif
}
bool wxXmlIOHandlerExpat::CanLoad(wxInputStream& stream)
{
char cheader[7];
cheader[6] = 0;
stream.Read(cheader, 6);
stream.SeekI(-6, wxFromCurrent);
return (strcmp(cheader, "<?xml ") == 0);
}
struct wxXmlParsingContext
{
wxXmlNode *root;
wxXmlNode *node;
wxXmlNode *lastAsText;
wxString encoding;
wxString version;
};
static void StartElementHnd(void *userData, const char *name, const char **atts)
{
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
wxXmlNode *node = new wxXmlNode(wxXML_ELEMENT_NODE, CharToString(name));
const char **a = atts;
while (*a)
{
node->AddProperty(CharToString(a[0]), CharToString(a[1]));
a += 2;
}
if (ctx->root == NULL)
ctx->root = node;
else
ctx->node->AddChild(node);
ctx->node = node;
ctx->lastAsText = NULL;
}
static void EndElementHnd(void *userData, const char* WXUNUSED(name))
{
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
ctx->node = ctx->node->GetParent();
ctx->lastAsText = NULL;
}
static void TextHnd(void *userData, const char *s, int len)
{
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
char *buf = new char[len + 1];
buf[len] = '\0';
memcpy(buf, s, (size_t)len);
if (ctx->lastAsText)
{
ctx->lastAsText->SetContent(ctx->lastAsText->GetContent() +
CharToString(buf));
}
else
{
bool whiteOnly = TRUE;
for (char *c = buf; *c != '\0'; c++)
if (*c != ' ' && *c != '\t' && *c != '\n' && *c != '\r')
{
whiteOnly = FALSE;
break;
}
if (!whiteOnly)
{
ctx->lastAsText = new wxXmlNode(wxXML_TEXT_NODE, wxT("text"),
CharToString(buf));
ctx->node->AddChild(ctx->lastAsText);
}
}
delete[] buf;
}
static void CommentHnd(void *userData, const char *data)
{
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
if (ctx->node)
{
// VS: ctx->node == NULL happens if there is a comment before
// the root element (e.g. wxDesigner's output). We ignore such
// comments, no big deal...
ctx->node->AddChild(new wxXmlNode(wxXML_COMMENT_NODE,
wxT("comment"), CharToString(data)));
}
ctx->lastAsText = NULL;
}
static void DefaultHnd(void *userData, const char *s, int len)
{
// XML header:
if (len > 6 && memcmp(s, "<?xml ", 6) == 0)
{
wxXmlParsingContext *ctx = (wxXmlParsingContext*)userData;
wxString buf = CharToString(s, (size_t)len);
int pos;
pos = buf.Find(wxT("encoding="));
if (pos != wxNOT_FOUND)
ctx->encoding = buf.Mid(pos + 10).BeforeFirst(buf[(size_t)pos+9]);
pos = buf.Find(wxT("version="));
if (pos != wxNOT_FOUND)
ctx->version = buf.Mid(pos + 9).BeforeFirst(buf[(size_t)pos+8]);
}
}
bool wxXmlIOHandlerExpat::Load(wxInputStream& stream, wxXmlDocument& doc)
{
const size_t BUFSIZE = 1024;
char buf[BUFSIZE];
wxXmlParsingContext ctx;
bool done;
XML_Parser parser = XML_ParserCreate(NULL);
ctx.root = ctx.node = NULL;
XML_SetUserData(parser, (void*)&ctx);
XML_SetElementHandler(parser, StartElementHnd, EndElementHnd);
XML_SetCharacterDataHandler(parser, TextHnd);
XML_SetCommentHandler(parser, CommentHnd);
XML_SetDefaultHandler(parser, DefaultHnd);
do
{
size_t len = stream.Read(buf, BUFSIZE).LastRead();
done = (len < BUFSIZE);
if (!XML_Parse(parser, buf, len, done))
{
wxLogError(_("XML parsing error: '%s' at line %d"),
XML_ErrorString(XML_GetErrorCode(parser)),
XML_GetCurrentLineNumber(parser));
return FALSE;
}
} while (!done);
doc.SetVersion(ctx.version);
doc.SetEncoding(ctx.encoding);
doc.SetRoot(ctx.root);
XML_ParserFree(parser);
return TRUE;
}

1001
contrib/src/xrc/xmlres.cpp Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,97 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlrsall.cpp
// Purpose: wxXmlResource::InitAllHandlers
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
// -- Already done in xmlres.cpp
//#ifdef __GNUG__
//#pragma implementation "xmlres.h"
//#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xmlres.h"
#include "wx/xrc/xh_all.h"
void wxXmlResource::InitAllHandlers()
{
AddHandler(new wxBitmapXmlHandler);
AddHandler(new wxIconXmlHandler);
AddHandler(new wxMenuXmlHandler);
AddHandler(new wxMenuBarXmlHandler);
AddHandler(new wxDialogXmlHandler);
AddHandler(new wxPanelXmlHandler);
AddHandler(new wxSizerXmlHandler);
//Controls
AddHandler(new wxButtonXmlHandler);
AddHandler(new wxBitmapButtonXmlHandler);
AddHandler(new wxStaticTextXmlHandler);
AddHandler(new wxStaticBoxXmlHandler);
AddHandler(new wxStaticBitmapXmlHandler);
AddHandler(new wxTreeCtrlXmlHandler);
AddHandler(new wxCalendarCtrlXmlHandler);
AddHandler(new wxListCtrlXmlHandler);
#if CHECKLISTBOX
AddHandler(new wxCheckListXmlHandler);
#endif
#if wxUSE_CHOICE
AddHandler(new wxChoiceXmlHandler);
#endif
#if wxUSE_SLIDER
AddHandler(new wxSliderXmlHandler);
#endif
#if wxUSE_GAUGE
AddHandler(new wxGaugeXmlHandler);
#endif
#if wxUSE_CHECKBOX
AddHandler(new wxCheckBoxXmlHandler);
#endif
#if wxUSE_HTML
AddHandler(new wxHtmlWindowXmlHandler);
#endif
#if wxUSE_SPINBTN
AddHandler(new wxSpinButtonXmlHandler);
#endif
#if wxUSE_SPINCTRL
AddHandler(new wxSpinCtrlXmlHandler);
#endif
#if wxUSE_SCROLLBAR
AddHandler(new wxScrollBarXmlHandler);
#endif
#if wxUSE_RADIOBOX
AddHandler(new wxRadioBoxXmlHandler);
AddHandler(new wxRadioButtonXmlHandler);
#endif
#if wxUSE_COMBOBOX
AddHandler(new wxComboBoxXmlHandler);
#endif
#if wxUSE_NOTEBOOK
AddHandler(new wxNotebookXmlHandler);
#endif
AddHandler(new wxTextCtrlXmlHandler);
#if wxUSE_LISTBOX
AddHandler(new wxListBoxXmlHandler);
#endif
#if wxUSE_TOOLBAR
AddHandler(new wxToolBarXmlHandler);
#endif
#if wxUSE_STATLINE
AddHandler(new wxStaticLineXmlHandler);
#endif
AddHandler(new wxUnknownWidgetXmlHandler);
AddHandler(new wxFrameXmlHandler);
}

View File

@ -0,0 +1,152 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xmlwrite.cpp
// Purpose: wxXmlDocument - XML text writer
// Author: Vaclav Slavik
// Created: 2001/04/30
// RCS-ID: $Id$
// Copyright: (c) 2001 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
// nothing - already in xml.cpp
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/wfstream.h"
#include "wx/intl.h"
#include "wx/log.h"
#include "wx/strconv.h"
#include "wx/xrc/xml.h"
#include "wx/xrc/xmlio.h"
// write string to output:
inline static void OutputString(wxOutputStream& stream, const wxString& str)
{
if (str.IsEmpty()) return;
#if wxUSE_UNICODE
char *buf = str.mb_str(wxMBConvUTF8);
stream.Write(buf, strlen(buf));
#else
stream.Write(str.mb_str(), str.Len());
#endif
}
// Same as above, but create entities first.
// Translates '<' to "&lt;", '>' to "&gt;" and '&' to "&amp;"
static void OutputStringEnt(wxOutputStream& stream, const wxString& str)
{
wxString buf;
size_t i, last, len;
char c;
len = str.Len();
last = 0;
for (i = 0; i < len; i++)
{
c = str.GetChar(i);
if (c == '<' || c == '>' ||
(c == '&' && str.Mid(i+1, 4) != wxT("amp;")))
{
OutputString(stream, str.Mid(last, i - last));
switch (c)
{
case '<': OutputString(stream, wxT("&lt;")); break;
case '>': OutputString(stream, wxT("&gt;")); break;
case '&': OutputString(stream, wxT("&amp;")); break;
default: break;
}
last = i + 1;
}
}
OutputString(stream, str.Mid(last, i - last));
}
inline static void OutputIndentation(wxOutputStream& stream, int indent)
{
wxString str = wxT("\n");
for (int i = 0; i < indent; i++)
str << wxT(' ') << wxT(' ');
OutputString(stream, str);
}
static void OutputNode(wxOutputStream& stream, wxXmlNode *node, int indent)
{
wxXmlNode *n, *prev;
wxXmlProperty *prop;
switch (node->GetType())
{
case wxXML_TEXT_NODE:
OutputStringEnt(stream, node->GetContent());
break;
case wxXML_ELEMENT_NODE:
OutputString(stream, wxT("<"));
OutputString(stream, node->GetName());
prop = node->GetProperties();
while (prop)
{
OutputString(stream, wxT(" ") + prop->GetName() +
wxT("=\"") + prop->GetValue() + wxT("\""));
// FIXME - what if prop contains '"'?
prop = prop->GetNext();
}
if (node->GetChildren())
{
OutputString(stream, wxT(">"));
prev = NULL;
n = node->GetChildren();
while (n)
{
if (n && n->GetType() != wxXML_TEXT_NODE)
OutputIndentation(stream, indent + 1);
OutputNode(stream, n, indent + 1);
prev = n;
n = n->GetNext();
}
if (prev && prev->GetType() != wxXML_TEXT_NODE)
OutputIndentation(stream, indent);
OutputString(stream, wxT("</"));
OutputString(stream, node->GetName());
OutputString(stream, wxT(">"));
}
else
OutputString(stream, wxT("/>"));
break;
case wxXML_COMMENT_NODE:
OutputString(stream, wxT("<!--"));
OutputString(stream, node->GetContent());
OutputString(stream, wxT("-->"));
break;
default:
wxFAIL_MSG(wxT("unsupported node type"));
}
}
bool wxXmlIOHandlerWriter::Save(wxOutputStream& stream, const wxXmlDocument& doc)
{
if (!doc.IsOk())
return FALSE;
wxString s;
s = wxT("<?xml version=\"") + doc.GetVersion() +
wxT("\" encoding=\"utf-8\"?>\n");
OutputString(stream, s);
OutputNode(stream, doc.GetRoot(), 0);
OutputString(stream, wxT("\n"));
return TRUE;
}

324
src/xrc/FORMAT.txt Normal file
View File

@ -0,0 +1,324 @@
XML resources file format
===============================
1. Basics
-----------
XML resource is well-formed XML document, i.e. all tags are paired
and there is only one root node, which is always <resource>.
In the following text, I will use standard XML terminology:
<tag_one prop1="prop" prop2='yes'>
<tag_two/>
</tag_one>
Here, tag_one is a node (the word 'tag' refers to the type of the node),
prop1 and prop2 are properties and tag_two is a child node of tag_one.
Property's default value is the value that will be assigned to the property
if you do not specify it explicitly.
I will use the term "primary node" to refer to nodes than represent controls,
dialogs etc. "Secondary nodes" are nodes used to store data:
<dialog name="my_dlg"> primary
<title>Demo Dialog...</title> secondary
<size>100,200d</size> secondary
<children> secondary
<button name="wxID_OK"> primary
<label>Ok</label> secondary
<pos>10,10d</pos> secondary
</button>
</children>
</dialog>
In the example above, <label>, <pos>, <size> and <title> are "variables",
i.e. they contain a value and not a list of children (unlike <children> node).
Any node (but the root one) may have property "platform" with possible
values "unix", "win", "mac" or "os2". All nodes with "platform" property
specified and other than the platform the program is currently being executed
on will be removed when reading XML resource file.
Root node may have children of these and only these types: <menu>, <menubar>,
<dialog>, <panel>
2. IDs
--------
Any primary node may have property "name" used to identify it. Default value
is "-1", any string is legal name. Names
wxID_OPEN, wxID_CLOSE, wxID_NEW,
wxID_SAVE, wxID_SAVEAS, wxID_REVERT,
wxID_EXIT, wxID_UNDO, wxID_REDO,
wxID_HELP, wxID_PRINT, wxID_PRINT_SETUP,
wxID_PREVIEW, wxID_ABOUT, wxID_HELP_CONTENTS,
wxID_HELP_COMMANDS, wxID_HELP_PROCEDURES,
wxID_CUT, wxID_COPY, wxID_PASTE,
wxID_CLEAR, wxID_FIND, wxID_DUPLICATE,
wxID_SELECTALL, wxID_OK, wxID_CANCEL,
wxID_APPLY, wxID_YES, wxID_NO,
wxID_STATIC, wxID_FORWARD, wxID_BACKWARD,
wxID_DEFAULT, wxID_MORE, wxID_SETUP,
wxID_RESET, wxID_HELP_CONTEXT
are translated into corresponding wxWindows ID constant, XMLID macro is used
otherwise to generate unique ID. wxWindows control created from named node
will have name=name and id=XMLID(name) or wxID_XXXX.
3. Common variables types
---------------------------
Variables are always of a known type:
bool - boolean value. "1", "true", "t", "on" mean TRUE, anything
else (namely "0", "false", "f", "off") means FALSE.
FIXME: maybe use only 1/0 ??
integer - integer value, i.e. digits 0-9 plus optional minus sign.
text - anything. Within text node all occurences of $ are replaced
by & (used for shortcuts, e.g. "E&xit"), $$ by $, \\, \n, \r,
\t as usual in C++.
style - (also called flags) list of flags delimined by any combination
of spaces and | characters. Resources parser accepts only
_registered_ flags -- i.e. flags that are valid for given
node/control. Example:
<flag>wxEXPAND | wxTOP|wxBOTTOM</flag>
color - color in HTML format: #rrggbb where rr,gg,bb are hexadecimal
values (00-FF) for red, green and blue components in
the RGB color model
coord - size or position information. Consists of two integers
separated by comma ("x,y"). The values are in pixels
unless "d" is attached to the right side of it --
in which case the values are interpreted as dialog units.
Value of -1 means "use default". Examples:
30,30
-1,-1
50,-1
145,56d
67,-1d
4. Layout
-----------
Most common nodes layout is as follows:
<primary_node name="name" platform="platform">
<var_1>...</var_1>
.
.
.
<var_n>...</var_n>
<children>
(n primary nodes)
</children>
</primary_node>
where children node is supported only by panels, dialogs etc. -- see
nodes description for details.
In the following text,
TYPE var_name [ (= default_value) ]
means that given primary node may have child node with name var_name
and content type TYPE. If default value is given, the node is optional
and default_value will be used if not specified. Otherwise, the node
is mandatory and must always be present. For example, "color fg" means
than variable tag fg, e.g. <fg>#rr0000</fg> is expected.
5. Common controls variables
------------------------------
_All_ nodes that represent wxWindows controls (gauge, panel, dialog,
textctrl etc.) accept the following properties:
coord pos (= -1,-1) position of the control. Default value
equals to wxDefaultPosition
coord size (= -1,-1) size of the control. Default value equals to
wxDefaultSize
text tooltip window's tooltip
color bg background color of the control
color fg foreground/text color of the control
style style control style flag. Default value is
control-dependent (but 0 is common value)
style exstyle control extended style flag
bool enabled (= 1) is the control enabled?
bool hidden (= 0) is the control hidden?
bool focused (= 0) has the control focus?
_Usually_ (but not always, only when it makes sense) controls support text
variable label which contains displayed text and/or value which contains
editable text. These are always explicitly mentioned in tag description.
6. Tags description
---------------------
If 'Control' is derived from wxControl, it supports all variables from '5.'
'Styles' section lists all acceptable flags for style and exstyle variables.
<panel>
---------
Control:
wxPanel
Variables:
only common controls variables
Styles:
wxNO_3D, wxTAB_TRAVERSAL, wxWS_EX_VALIDATE_RECURSIVELY
<dialog>
----------
Control:
wxDialog
Variables:
style style (= wxDEFAULT_DIALOG_style)
text title dialog's title
Styles:
wxSTAY_ON_TOP, wxCAPTION, wxDEFAULT_DIALOG_style, wxTHICK_FRAME,
wxSYSTEM_MENU, wxRESIZE_BORDER, wxRESIZE_BOX, wxDIALOG_MODAL,
wxDIALOG_MODELESS, wxNO_3D, wxTAB_TRAVERSAL,
wxWS_EX_VALIDATE_RECURSIVELY
<boxsizer>
--------------
Control:
wxBoxSizer (not a control)
Behaviour:
boxsizer's parent must be either <panel>, <dialog> or another
sizer, nothing else!
If the sizer does not have parent sizer, the sizer will attach itself
to the parent panel/dialog using SetAutoLayout(TRUE) and SetSizer().
If the parent panel/dialog has default size (i.e. not specified in
the resource), the sizer will fit it using wxSizer::Fit(). If the
parent panel/dialog is resizable, size hints will be set
automatically.
Variables:
style orient (= wxHORIZONTAL) orientation, either
wxHORIZONTAL or wxVERTICAL
Styles:
wxHORIZONTAL, wxVERTICAL (for orient variable)
wxLEFT, wxRIGHT, wxTOP, wxBOTTOM, wxNORTH, wxSOUTH, wxEAST, wxWEST,
wxALL, wxGROW, wxEXPAND, wxSHAPED, wxSTRETCH_NOT, wxALIGN_CENTER,
wxALIGN_CENTRE, wxALIGN_LEFT, wxALIGN_TOP, wxALIGN_RIGHT,
wxALIGN_BOTTOM, wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL,
wxALIGN_CENTER_HORIZONTAL, wxALIGN_CENTRE_HORIZONTAL (for flag
variable of <item> or <spacer> child nodes)
Child nodes:
Contains child node <children> which has arbitrary number of
<sizeritem> and <spacer> child nodes.
<sizeritem>
-------------
Variables:
integer option (= 0) relative size of the widget
style flag (= 0) style flag
integer border (= 0) surrounding border
Has exactly one child node <window> that contains the control
(or child sizer because sizers may be nested)
to be inserted into the sizer.
<spacer>
----------
Variables:
integer option (= 0) relative size of the widget
style flag (= 0) style flag
integer border (= 0) surrounding border
Inserts empty space into the sizer
<staticboxsizer>
------------------
Control:
wxStaticBoxSizer (not a control)
Same as <boxsizer> except that it has additional variable:
text label (= "") label of surrounding static box
wxStaticBox required by wxStaticBoxSizer is created automatically!
<notebooksizer>
-----------------
Control:
wxNotebookSizer (not a control)
Behaviour:
notebooksizer's parent must be a sizer (not notebooksizer,
see below)!
Variables:
none
Styles:
none
Child nodes:
Has exactly one child node <window> that contains the notebook
(nothing else is allowed!) to be inserted into the sizer.
<textctrl>
------------
Control:
wxTextCtrl
Variables:
text value (= "")default text of the control
Styles:
wxTE_PROCESS_ENTER, wxTE_PROCESS_TAB, wxTE_MULTILINE, wxTE_PASSWORD,
wxTE_READONLY, wxHSCROLL
<htmlwindow>
--------------
Control:
wxHtmlWindow
Variables:
integer borders (= 0) window's borders
(see wxHtmlWindow::SetBorders)
text url (= "") if present, given page will be loaded
text htmlcode (= "") if present, given _text_ will be displayed
(you will have to use CDATA section
to embed HTML code into XML document)
Styles:
wxHW_SCROLLBAR_NEVER, wxHW_SCROLLBAR_AUTO

41
src/xrc/Makefile.in Normal file
View File

@ -0,0 +1,41 @@
# $Id$
top_srcdir = @top_srcdir@/..
top_builddir = ../../..
expat_dir = $(top_srcdir)/contrib/src/xrc/expat
libsrc_dir = contrib/src/xrc@PATH_IFS@$(expat_dir)/xmlparse@PATH_IFS@$(expat_dir)/xmltok
TARGET_LIBNAME=libwxxrc
LIBVERSION_CURRENT=0
LIBVERSION_REVISION=1
LIBVERSION_AGE=0
HEADER_PATH=$(top_srcdir)/contrib/include/wx
HEADER_SUBDIR=xrc
EXPAT_DEFS=-I$(expat_dir)/xmlparse -I$(expat_dir)/xmltok
EXPAT_OBJECTS=xmltok.o xmlrole.o xmlparse.o
HEADERS=xh_all.h xh_bttn.h xh_chckb.h xh_chckl.h xh_choic.h xh_combo.h \
xh_dlg.h xh_gauge.h xh_html.h xh_menu.h xh_notbk.h xh_panel.h \
xh_radbt.h xh_radbx.h xh_sizer.h xh_slidr.h xh_spin.h xh_stbmp.h \
xh_sttxt.h xh_text.h xh_listb.h xml.h xmlio.h xmlres.h xh_toolb.h \
xh_bmpbt.h xh_cald.h xh_listc.h xh_scrol.h xh_stbox.h xh_tree.h \
xh_stlin.h xh_bmp.h xh_unkwn.h xh_frame.h
OBJECTS=$(EXPAT_OBJECTS) \
xml.o xmlbin.o xmlbinz.o xmlexpat.o xmlwrite.o xmlres.o xmlrsall.o \
xh_bttn.o xh_chckb.o xh_chckl.o xh_choic.o xh_combo.o xh_dlg.o \
xh_gauge.o xh_html.o xh_menu.o xh_notbk.o xh_panel.o xh_radbt.o \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o
APPEXTRADEFS=-I$(top_srcdir)/contrib/include $(EXPAT_DEFS)
include $(top_builddir)/src/makelib.env

39
src/xrc/README.EXPAT Normal file
View File

@ -0,0 +1,39 @@
./expat directory contains stripped-down version of Expat parser distribution
by J. Clark. I removed stuff not neccessary for wxXML (docs, samples), if you
are interested in it, please download full distribution from Clark's site
(http://www.jclark.com).
Version used is expat-1.2.
The Expat parser is available is licensed under the MIT license as follows:
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
In other words, there shouldn't be any legal issues with using Expat in
your application.
Vaclav Slavik <v.slavik@volny.cz>

20
src/xrc/expat/copying.txt Normal file
View File

@ -0,0 +1,20 @@
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,527 @@
/*
Copyright (c) 1998, 1999, 2000 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#ifndef XmlParse_INCLUDED
#define XmlParse_INCLUDED 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef XMLPARSEAPI
#define XMLPARSEAPI /* as nothing */
#endif
typedef void *XML_Parser;
#ifdef XML_UNICODE_WCHAR_T
/* XML_UNICODE_WCHAR_T will work only if sizeof(wchar_t) == 2 and wchar_t
uses Unicode. */
/* Information is UTF-16 encoded as wchar_ts */
#ifndef XML_UNICODE
#define XML_UNICODE
#endif
#include <stddef.h>
typedef wchar_t XML_Char;
typedef wchar_t XML_LChar;
#else /* not XML_UNICODE_WCHAR_T */
#ifdef XML_UNICODE
/* Information is UTF-16 encoded as unsigned shorts */
typedef unsigned short XML_Char;
typedef char XML_LChar;
#else /* not XML_UNICODE */
/* Information is UTF-8 encoded. */
typedef char XML_Char;
typedef char XML_LChar;
#endif /* not XML_UNICODE */
#endif /* not XML_UNICODE_WCHAR_T */
/* Constructs a new parser; encoding is the encoding specified by the external
protocol or null if there is none specified. */
XML_Parser XMLPARSEAPI
XML_ParserCreate(const XML_Char *encoding);
/* Constructs a new parser and namespace processor. Element type names
and attribute names that belong to a namespace will be expanded;
unprefixed attribute names are never expanded; unprefixed element type
names are expanded only if there is a default namespace. The expanded
name is the concatenation of the namespace URI, the namespace separator character,
and the local part of the name. If the namespace separator is '\0' then
the namespace URI and the local part will be concatenated without any
separator. When a namespace is not declared, the name and prefix will be
passed through without expansion. */
XML_Parser XMLPARSEAPI
XML_ParserCreateNS(const XML_Char *encoding, XML_Char namespaceSeparator);
/* atts is array of name/value pairs, terminated by 0;
names and values are 0 terminated. */
typedef void (*XML_StartElementHandler)(void *userData,
const XML_Char *name,
const XML_Char **atts);
typedef void (*XML_EndElementHandler)(void *userData,
const XML_Char *name);
/* s is not 0 terminated. */
typedef void (*XML_CharacterDataHandler)(void *userData,
const XML_Char *s,
int len);
/* target and data are 0 terminated */
typedef void (*XML_ProcessingInstructionHandler)(void *userData,
const XML_Char *target,
const XML_Char *data);
/* data is 0 terminated */
typedef void (*XML_CommentHandler)(void *userData, const XML_Char *data);
typedef void (*XML_StartCdataSectionHandler)(void *userData);
typedef void (*XML_EndCdataSectionHandler)(void *userData);
/* This is called for any characters in the XML document for
which there is no applicable handler. This includes both
characters that are part of markup which is of a kind that is
not reported (comments, markup declarations), or characters
that are part of a construct which could be reported but
for which no handler has been supplied. The characters are passed
exactly as they were in the XML document except that
they will be encoded in UTF-8. Line boundaries are not normalized.
Note that a byte order mark character is not passed to the default handler.
There are no guarantees about how characters are divided between calls
to the default handler: for example, a comment might be split between
multiple calls. */
typedef void (*XML_DefaultHandler)(void *userData,
const XML_Char *s,
int len);
/* This is called for the start of the DOCTYPE declaration when the
name of the DOCTYPE is encountered. */
typedef void (*XML_StartDoctypeDeclHandler)(void *userData,
const XML_Char *doctypeName);
/* This is called for the start of the DOCTYPE declaration when the
closing > is encountered, but after processing any external subset. */
typedef void (*XML_EndDoctypeDeclHandler)(void *userData);
/* This is called for a declaration of an unparsed (NDATA)
entity. The base argument is whatever was set by XML_SetBase.
The entityName, systemId and notationName arguments will never be null.
The other arguments may be. */
typedef void (*XML_UnparsedEntityDeclHandler)(void *userData,
const XML_Char *entityName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId,
const XML_Char *notationName);
/* This is called for a declaration of notation.
The base argument is whatever was set by XML_SetBase.
The notationName will never be null. The other arguments can be. */
typedef void (*XML_NotationDeclHandler)(void *userData,
const XML_Char *notationName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
typedef void (*XML_ExternalParsedEntityDeclHandler)(void *userData,
const XML_Char *entityName,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
typedef void (*XML_InternalParsedEntityDeclHandler)(void *userData,
const XML_Char *entityName,
const XML_Char *replacementText,
int replacementTextLength);
/* When namespace processing is enabled, these are called once for
each namespace declaration. The call to the start and end element
handlers occur between the calls to the start and end namespace
declaration handlers. For an xmlns attribute, prefix will be null.
For an xmlns="" attribute, uri will be null. */
typedef void (*XML_StartNamespaceDeclHandler)(void *userData,
const XML_Char *prefix,
const XML_Char *uri);
typedef void (*XML_EndNamespaceDeclHandler)(void *userData,
const XML_Char *prefix);
/* This is called if the document is not standalone (it has an
external subset or a reference to a parameter entity, but does not
have standalone="yes"). If this handler returns 0, then processing
will not continue, and the parser will return a
XML_ERROR_NOT_STANDALONE error. */
typedef int (*XML_NotStandaloneHandler)(void *userData);
/* This is called for a reference to an external parsed general entity.
The referenced entity is not automatically parsed.
The application can parse it immediately or later using
XML_ExternalEntityParserCreate.
The parser argument is the parser parsing the entity containing the reference;
it can be passed as the parser argument to XML_ExternalEntityParserCreate.
The systemId argument is the system identifier as specified in the entity declaration;
it will not be null.
The base argument is the system identifier that should be used as the base for
resolving systemId if systemId was relative; this is set by XML_SetBase;
it may be null.
The publicId argument is the public identifier as specified in the entity declaration,
or null if none was specified; the whitespace in the public identifier
will have been normalized as required by the XML spec.
The context argument specifies the parsing context in the format
expected by the context argument to
XML_ExternalEntityParserCreate; context is valid only until the handler
returns, so if the referenced entity is to be parsed later, it must be copied.
The handler should return 0 if processing should not continue because of
a fatal error in the handling of the external entity.
In this case the calling parser will return an XML_ERROR_EXTERNAL_ENTITY_HANDLING
error.
Note that unlike other handlers the first argument is the parser, not userData. */
typedef int (*XML_ExternalEntityRefHandler)(XML_Parser parser,
const XML_Char *context,
const XML_Char *base,
const XML_Char *systemId,
const XML_Char *publicId);
/* This structure is filled in by the XML_UnknownEncodingHandler
to provide information to the parser about encodings that are unknown
to the parser.
The map[b] member gives information about byte sequences
whose first byte is b.
If map[b] is c where c is >= 0, then b by itself encodes the Unicode scalar value c.
If map[b] is -1, then the byte sequence is malformed.
If map[b] is -n, where n >= 2, then b is the first byte of an n-byte
sequence that encodes a single Unicode scalar value.
The data member will be passed as the first argument to the convert function.
The convert function is used to convert multibyte sequences;
s will point to a n-byte sequence where map[(unsigned char)*s] == -n.
The convert function must return the Unicode scalar value
represented by this byte sequence or -1 if the byte sequence is malformed.
The convert function may be null if the encoding is a single-byte encoding,
that is if map[b] >= -1 for all bytes b.
When the parser is finished with the encoding, then if release is not null,
it will call release passing it the data member;
once release has been called, the convert function will not be called again.
Expat places certain restrictions on the encodings that are supported
using this mechanism.
1. Every ASCII character that can appear in a well-formed XML document,
other than the characters
$@\^`{}~
must be represented by a single byte, and that byte must be the
same byte that represents that character in ASCII.
2. No character may require more than 4 bytes to encode.
3. All characters encoded must have Unicode scalar values <= 0xFFFF,
(ie characters that would be encoded by surrogates in UTF-16
are not allowed). Note that this restriction doesn't apply to
the built-in support for UTF-8 and UTF-16.
4. No Unicode character may be encoded by more than one distinct sequence
of bytes. */
typedef struct {
int map[256];
void *data;
int (*convert)(void *data, const char *s);
void (*release)(void *data);
} XML_Encoding;
/* This is called for an encoding that is unknown to the parser.
The encodingHandlerData argument is that which was passed as the
second argument to XML_SetUnknownEncodingHandler.
The name argument gives the name of the encoding as specified in
the encoding declaration.
If the callback can provide information about the encoding,
it must fill in the XML_Encoding structure, and return 1.
Otherwise it must return 0.
If info does not describe a suitable encoding,
then the parser will return an XML_UNKNOWN_ENCODING error. */
typedef int (*XML_UnknownEncodingHandler)(void *encodingHandlerData,
const XML_Char *name,
XML_Encoding *info);
void XMLPARSEAPI
XML_SetElementHandler(XML_Parser parser,
XML_StartElementHandler start,
XML_EndElementHandler end);
void XMLPARSEAPI
XML_SetCharacterDataHandler(XML_Parser parser,
XML_CharacterDataHandler handler);
void XMLPARSEAPI
XML_SetProcessingInstructionHandler(XML_Parser parser,
XML_ProcessingInstructionHandler handler);
void XMLPARSEAPI
XML_SetCommentHandler(XML_Parser parser,
XML_CommentHandler handler);
void XMLPARSEAPI
XML_SetCdataSectionHandler(XML_Parser parser,
XML_StartCdataSectionHandler start,
XML_EndCdataSectionHandler end);
/* This sets the default handler and also inhibits expansion of internal entities.
The entity reference will be passed to the default handler. */
void XMLPARSEAPI
XML_SetDefaultHandler(XML_Parser parser,
XML_DefaultHandler handler);
/* This sets the default handler but does not inhibit expansion of internal entities.
The entity reference will not be passed to the default handler. */
void XMLPARSEAPI
XML_SetDefaultHandlerExpand(XML_Parser parser,
XML_DefaultHandler handler);
void XMLPARSEAPI
XML_SetDoctypeDeclHandler(XML_Parser parser,
XML_StartDoctypeDeclHandler start,
XML_EndDoctypeDeclHandler end);
void XMLPARSEAPI
XML_SetUnparsedEntityDeclHandler(XML_Parser parser,
XML_UnparsedEntityDeclHandler handler);
void XMLPARSEAPI
XML_SetNotationDeclHandler(XML_Parser parser,
XML_NotationDeclHandler handler);
void XMLPARSEAPI
XML_SetExternalParsedEntityDeclHandler(XML_Parser parser,
XML_ExternalParsedEntityDeclHandler handler);
void XMLPARSEAPI
XML_SetInternalParsedEntityDeclHandler(XML_Parser parser,
XML_InternalParsedEntityDeclHandler handler);
void XMLPARSEAPI
XML_SetNamespaceDeclHandler(XML_Parser parser,
XML_StartNamespaceDeclHandler start,
XML_EndNamespaceDeclHandler end);
void XMLPARSEAPI
XML_SetNotStandaloneHandler(XML_Parser parser,
XML_NotStandaloneHandler handler);
void XMLPARSEAPI
XML_SetExternalEntityRefHandler(XML_Parser parser,
XML_ExternalEntityRefHandler handler);
/* If a non-null value for arg is specified here, then it will be passed
as the first argument to the external entity ref handler instead
of the parser object. */
void XMLPARSEAPI
XML_SetExternalEntityRefHandlerArg(XML_Parser, void *arg);
void XMLPARSEAPI
XML_SetUnknownEncodingHandler(XML_Parser parser,
XML_UnknownEncodingHandler handler,
void *encodingHandlerData);
/* This can be called within a handler for a start element, end element,
processing instruction or character data. It causes the corresponding
markup to be passed to the default handler. */
void XMLPARSEAPI XML_DefaultCurrent(XML_Parser parser);
/* This value is passed as the userData argument to callbacks. */
void XMLPARSEAPI
XML_SetUserData(XML_Parser parser, void *userData);
/* Returns the last value set by XML_SetUserData or null. */
#define XML_GetUserData(parser) (*(void **)(parser))
/* This is equivalent to supplying an encoding argument
to XML_ParserCreate. It must not be called after XML_Parse
or XML_ParseBuffer. */
int XMLPARSEAPI
XML_SetEncoding(XML_Parser parser, const XML_Char *encoding);
/* If this function is called, then the parser will be passed
as the first argument to callbacks instead of userData.
The userData will still be accessible using XML_GetUserData. */
void XMLPARSEAPI
XML_UseParserAsHandlerArg(XML_Parser parser);
/* Sets the base to be used for resolving relative URIs in system identifiers in
declarations. Resolving relative identifiers is left to the application:
this value will be passed through as the base argument to the
XML_ExternalEntityRefHandler, XML_NotationDeclHandler
and XML_UnparsedEntityDeclHandler. The base argument will be copied.
Returns zero if out of memory, non-zero otherwise. */
int XMLPARSEAPI
XML_SetBase(XML_Parser parser, const XML_Char *base);
const XML_Char XMLPARSEAPI *
XML_GetBase(XML_Parser parser);
/* Returns the number of the attribute/value pairs passed in last call
to the XML_StartElementHandler that were specified in the start-tag
rather than defaulted. Each attribute/value pair counts as 2; thus
this correspondds to an index into the atts array passed to the
XML_StartElementHandler. */
int XMLPARSEAPI XML_GetSpecifiedAttributeCount(XML_Parser parser);
/* Returns the index of the ID attribute passed in the last call to
XML_StartElementHandler, or -1 if there is no ID attribute. Each
attribute/value pair counts as 2; thus this correspondds to an index
into the atts array passed to the XML_StartElementHandler. */
int XMLPARSEAPI XML_GetIdAttributeIndex(XML_Parser parser);
/* Parses some input. Returns 0 if a fatal error is detected.
The last call to XML_Parse must have isFinal true;
len may be zero for this call (or any other). */
int XMLPARSEAPI
XML_Parse(XML_Parser parser, const char *s, int len, int isFinal);
void XMLPARSEAPI *
XML_GetBuffer(XML_Parser parser, int len);
int XMLPARSEAPI
XML_ParseBuffer(XML_Parser parser, int len, int isFinal);
/* Creates an XML_Parser object that can parse an external general entity;
context is a '\0'-terminated string specifying the parse context;
encoding is a '\0'-terminated string giving the name of the externally specified encoding,
or null if there is no externally specified encoding.
The context string consists of a sequence of tokens separated by formfeeds (\f);
a token consisting of a name specifies that the general entity of the name
is open; a token of the form prefix=uri specifies the namespace for a particular
prefix; a token of the form =uri specifies the default namespace.
This can be called at any point after the first call to an ExternalEntityRefHandler
so longer as the parser has not yet been freed.
The new parser is completely independent and may safely be used in a separate thread.
The handlers and userData are initialized from the parser argument.
Returns 0 if out of memory. Otherwise returns a new XML_Parser object. */
XML_Parser XMLPARSEAPI
XML_ExternalEntityParserCreate(XML_Parser parser,
const XML_Char *context,
const XML_Char *encoding);
enum XML_ParamEntityParsing {
XML_PARAM_ENTITY_PARSING_NEVER,
XML_PARAM_ENTITY_PARSING_UNLESS_STANDALONE,
XML_PARAM_ENTITY_PARSING_ALWAYS
};
/* Controls parsing of parameter entities (including the external DTD
subset). If parsing of parameter entities is enabled, then references
to external parameter entities (including the external DTD subset)
will be passed to the handler set with
XML_SetExternalEntityRefHandler. The context passed will be 0.
Unlike external general entities, external parameter entities can only
be parsed synchronously. If the external parameter entity is to be
parsed, it must be parsed during the call to the external entity ref
handler: the complete sequence of XML_ExternalEntityParserCreate,
XML_Parse/XML_ParseBuffer and XML_ParserFree calls must be made during
this call. After XML_ExternalEntityParserCreate has been called to
create the parser for the external parameter entity (context must be 0
for this call), it is illegal to make any calls on the old parser
until XML_ParserFree has been called on the newly created parser. If
the library has been compiled without support for parameter entity
parsing (ie without XML_DTD being defined), then
XML_SetParamEntityParsing will return 0 if parsing of parameter
entities is requested; otherwise it will return non-zero. */
int XMLPARSEAPI
XML_SetParamEntityParsing(XML_Parser parser,
enum XML_ParamEntityParsing parsing);
enum XML_Error {
XML_ERROR_NONE,
XML_ERROR_NO_MEMORY,
XML_ERROR_SYNTAX,
XML_ERROR_NO_ELEMENTS,
XML_ERROR_INVALID_TOKEN,
XML_ERROR_UNCLOSED_TOKEN,
XML_ERROR_PARTIAL_CHAR,
XML_ERROR_TAG_MISMATCH,
XML_ERROR_DUPLICATE_ATTRIBUTE,
XML_ERROR_JUNK_AFTER_DOC_ELEMENT,
XML_ERROR_PARAM_ENTITY_REF,
XML_ERROR_UNDEFINED_ENTITY,
XML_ERROR_RECURSIVE_ENTITY_REF,
XML_ERROR_ASYNC_ENTITY,
XML_ERROR_BAD_CHAR_REF,
XML_ERROR_BINARY_ENTITY_REF,
XML_ERROR_ATTRIBUTE_EXTERNAL_ENTITY_REF,
XML_ERROR_MISPLACED_XML_PI,
XML_ERROR_UNKNOWN_ENCODING,
XML_ERROR_INCORRECT_ENCODING,
XML_ERROR_UNCLOSED_CDATA_SECTION,
XML_ERROR_EXTERNAL_ENTITY_HANDLING,
XML_ERROR_NOT_STANDALONE
};
/* If XML_Parse or XML_ParseBuffer have returned 0, then XML_GetErrorCode
returns information about the error. */
enum XML_Error XMLPARSEAPI XML_GetErrorCode(XML_Parser parser);
/* These functions return information about the current parse location.
They may be called when XML_Parse or XML_ParseBuffer return 0;
in this case the location is the location of the character at which
the error was detected.
They may also be called from any other callback called to report
some parse event; in this the location is the location of the first
of the sequence of characters that generated the event. */
int XMLPARSEAPI XML_GetCurrentLineNumber(XML_Parser parser);
int XMLPARSEAPI XML_GetCurrentColumnNumber(XML_Parser parser);
long XMLPARSEAPI XML_GetCurrentByteIndex(XML_Parser parser);
/* Return the number of bytes in the current event.
Returns 0 if the event is in an internal entity. */
int XMLPARSEAPI XML_GetCurrentByteCount(XML_Parser parser);
/* For backwards compatibility with previous versions. */
#define XML_GetErrorLineNumber XML_GetCurrentLineNumber
#define XML_GetErrorColumnNumber XML_GetCurrentColumnNumber
#define XML_GetErrorByteIndex XML_GetCurrentByteIndex
/* Frees memory used by the parser. */
void XMLPARSEAPI
XML_ParserFree(XML_Parser parser);
/* Returns a string describing the error. */
const XML_LChar XMLPARSEAPI *XML_ErrorString(int code);
#ifdef __cplusplus
}
#endif
#endif /* not XmlParse_INCLUDED */

View File

@ -0,0 +1,86 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#define ASCII_A 0x41
#define ASCII_B 0x42
#define ASCII_C 0x43
#define ASCII_D 0x44
#define ASCII_E 0x45
#define ASCII_F 0x46
#define ASCII_G 0x47
#define ASCII_H 0x48
#define ASCII_I 0x49
#define ASCII_J 0x4A
#define ASCII_K 0x4B
#define ASCII_L 0x4C
#define ASCII_M 0x4D
#define ASCII_N 0x4E
#define ASCII_O 0x4F
#define ASCII_P 0x50
#define ASCII_Q 0x51
#define ASCII_R 0x52
#define ASCII_S 0x53
#define ASCII_T 0x54
#define ASCII_U 0x55
#define ASCII_V 0x56
#define ASCII_W 0x57
#define ASCII_X 0x58
#define ASCII_Y 0x59
#define ASCII_Z 0x5A
#define ASCII_a 0x61
#define ASCII_b 0x62
#define ASCII_c 0x63
#define ASCII_d 0x64
#define ASCII_e 0x65
#define ASCII_f 0x66
#define ASCII_g 0x67
#define ASCII_h 0x68
#define ASCII_i 0x69
#define ASCII_j 0x6A
#define ASCII_k 0x6B
#define ASCII_l 0x6C
#define ASCII_m 0x6D
#define ASCII_n 0x6E
#define ASCII_o 0x6F
#define ASCII_p 0x70
#define ASCII_q 0x71
#define ASCII_r 0x72
#define ASCII_s 0x73
#define ASCII_t 0x74
#define ASCII_u 0x75
#define ASCII_v 0x76
#define ASCII_w 0x77
#define ASCII_x 0x78
#define ASCII_y 0x79
#define ASCII_z 0x7A
#define ASCII_0 0x30
#define ASCII_1 0x31
#define ASCII_2 0x32
#define ASCII_3 0x33
#define ASCII_4 0x34
#define ASCII_5 0x35
#define ASCII_6 0x36
#define ASCII_7 0x37
#define ASCII_8 0x38
#define ASCII_9 0x39
#define ASCII_TAB 0x09
#define ASCII_SPACE 0x20
#define ASCII_EXCL 0x21
#define ASCII_QUOT 0x22
#define ASCII_AMP 0x26
#define ASCII_APOS 0x27
#define ASCII_MINUS 0x2D
#define ASCII_PERIOD 0x2E
#define ASCII_COLON 0x3A
#define ASCII_SEMI 0x3B
#define ASCII_LT 0x3C
#define ASCII_EQUALS 0x3D
#define ASCII_GT 0x3E
#define ASCII_LSQB 0x5B
#define ASCII_RSQB 0x5D
#define ASCII_UNDERSCORE 0x5F

View File

@ -0,0 +1,37 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_CR, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,

View File

@ -0,0 +1,15 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#define STRICT 1
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
BOOL WINAPI DllMain(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved)
{
return TRUE;
}

View File

@ -0,0 +1,38 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* Like asciitab.h, except that 0xD has code BT_S rather than BT_CR */
/* 0x00 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x04 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x08 */ BT_NONXML, BT_S, BT_LF, BT_NONXML,
/* 0x0C */ BT_NONXML, BT_S, BT_NONXML, BT_NONXML,
/* 0x10 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x14 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x18 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x1C */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0x20 */ BT_S, BT_EXCL, BT_QUOT, BT_NUM,
/* 0x24 */ BT_OTHER, BT_PERCNT, BT_AMP, BT_APOS,
/* 0x28 */ BT_LPAR, BT_RPAR, BT_AST, BT_PLUS,
/* 0x2C */ BT_COMMA, BT_MINUS, BT_NAME, BT_SOL,
/* 0x30 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x34 */ BT_DIGIT, BT_DIGIT, BT_DIGIT, BT_DIGIT,
/* 0x38 */ BT_DIGIT, BT_DIGIT, BT_COLON, BT_SEMI,
/* 0x3C */ BT_LT, BT_EQUALS, BT_GT, BT_QUEST,
/* 0x40 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x44 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x48 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x4C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x50 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x54 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x58 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_LSQB,
/* 0x5C */ BT_OTHER, BT_RSQB, BT_OTHER, BT_NMSTRT,
/* 0x60 */ BT_OTHER, BT_HEX, BT_HEX, BT_HEX,
/* 0x64 */ BT_HEX, BT_HEX, BT_HEX, BT_NMSTRT,
/* 0x68 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x6C */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x70 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x74 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0x78 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0x7C */ BT_VERBAR, BT_OTHER, BT_OTHER, BT_OTHER,

View File

@ -0,0 +1,37 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* 0x80 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x84 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x88 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x8C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x90 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x94 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x98 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0x9C */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA4 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xA8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xAC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB0 */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xB4 */ BT_OTHER, BT_NMSTRT, BT_OTHER, BT_NAME,
/* 0xB8 */ BT_OTHER, BT_OTHER, BT_NMSTRT, BT_OTHER,
/* 0xBC */ BT_OTHER, BT_OTHER, BT_OTHER, BT_OTHER,
/* 0xC0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xC8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xCC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xD4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xD8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xDC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xE8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xEC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF0 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xF4 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_OTHER,
/* 0xF8 */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,
/* 0xFC */ BT_NMSTRT, BT_NMSTRT, BT_NMSTRT, BT_NMSTRT,

View File

@ -0,0 +1,150 @@
static const unsigned namingBitmap[] = {
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0x00000000, 0x04000000, 0x87FFFFFE, 0x07FFFFFE,
0x00000000, 0x00000000, 0xFF7FFFFF, 0xFF7FFFFF,
0xFFFFFFFF, 0x7FF3FFFF, 0xFFFFFDFE, 0x7FFFFFFF,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFE00F, 0xFC31FFFF,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
0xFFFFFFFF, 0xF80001FF, 0x00000003, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFD740, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0xFFFF0003, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0x0000007F, 0x00000000, 0xFFFF0000, 0x000707FF,
0x00000000, 0x07FFFFFE, 0x000007FE, 0xFFFE0000,
0xFFFFFFFF, 0x7CFFFFFF, 0x002F7FFF, 0x00000060,
0xFFFFFFE0, 0x23FFFFFF, 0xFF000000, 0x00000003,
0xFFF99FE0, 0x03C5FDFF, 0xB0000000, 0x00030003,
0xFFF987E0, 0x036DFDFF, 0x5E000000, 0x001C0000,
0xFFFBAFE0, 0x23EDFDFF, 0x00000000, 0x00000001,
0xFFF99FE0, 0x23CDFDFF, 0xB0000000, 0x00000003,
0xD63DC7E0, 0x03BFC718, 0x00000000, 0x00000000,
0xFFFDDFE0, 0x03EFFDFF, 0x00000000, 0x00000003,
0xFFFDDFE0, 0x03EFFDFF, 0x40000000, 0x00000003,
0xFFFDDFE0, 0x03FFFDFF, 0x00000000, 0x00000003,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x000D7FFF, 0x0000003F, 0x00000000,
0xFEF02596, 0x200D6CAE, 0x0000001F, 0x00000000,
0x00000000, 0x00000000, 0xFFFFFEFF, 0x000003FF,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0xFFFFFFFF, 0xFFFF003F, 0x007FFFFF,
0x0007DAED, 0x50000000, 0x82315001, 0x002C62AB,
0x40000000, 0xF580C900, 0x00000007, 0x02010800,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0x0FFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0x03FFFFFF,
0x3F3FFFFF, 0xFFFFFFFF, 0xAAFF3F3F, 0x3FFFFFFF,
0xFFFFFFFF, 0x5FDFFFFF, 0x0FCF1FDC, 0x1FDC1FFF,
0x00000000, 0x00004C40, 0x00000000, 0x00000000,
0x00000007, 0x00000000, 0x00000000, 0x00000000,
0x00000080, 0x000003FE, 0xFFFFFFFE, 0xFFFFFFFF,
0x001FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x07FFFFFF,
0xFFFFFFE0, 0x00001FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0x0000003F, 0x00000000, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF,
0xFFFFFFFF, 0x0000000F, 0x00000000, 0x00000000,
0x00000000, 0x07FF6000, 0x87FFFFFE, 0x07FFFFFE,
0x00000000, 0x00800000, 0xFF7FFFFF, 0xFF7FFFFF,
0x00FFFFFF, 0x00000000, 0xFFFF0000, 0xFFFFFFFF,
0xFFFFFFFF, 0xF80001FF, 0x00030003, 0x00000000,
0xFFFFFFFF, 0xFFFFFFFF, 0x0000003F, 0x00000003,
0xFFFFD7C0, 0xFFFFFFFB, 0x547F7FFF, 0x000FFFFD,
0xFFFFDFFE, 0xFFFFFFFF, 0xDFFEFFFF, 0xFFFFFFFF,
0xFFFF007B, 0xFFFFFFFF, 0xFFFF199F, 0x033FCFFF,
0x00000000, 0xFFFE0000, 0x027FFFFF, 0xFFFFFFFE,
0xFFFE007F, 0xBBFFFFFB, 0xFFFF0016, 0x000707FF,
0x00000000, 0x07FFFFFE, 0x0007FFFF, 0xFFFF03FF,
0xFFFFFFFF, 0x7CFFFFFF, 0xFFEF7FFF, 0x03FF3DFF,
0xFFFFFFEE, 0xF3FFFFFF, 0xFF1E3FFF, 0x0000FFCF,
0xFFF99FEE, 0xD3C5FDFF, 0xB080399F, 0x0003FFCF,
0xFFF987E4, 0xD36DFDFF, 0x5E003987, 0x001FFFC0,
0xFFFBAFEE, 0xF3EDFDFF, 0x00003BBF, 0x0000FFC1,
0xFFF99FEE, 0xF3CDFDFF, 0xB0C0398F, 0x0000FFC3,
0xD63DC7EC, 0xC3BFC718, 0x00803DC7, 0x0000FF80,
0xFFFDDFEE, 0xC3EFFDFF, 0x00603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3EFFDFF, 0x40603DDF, 0x0000FFC3,
0xFFFDDFEC, 0xC3FFFDFF, 0x00803DCF, 0x0000FFC3,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0xFFFFFFFE, 0x07FF7FFF, 0x03FF7FFF, 0x00000000,
0xFEF02596, 0x3BFF6CAE, 0x03FF3F5F, 0x00000000,
0x03000000, 0xC2A003FF, 0xFFFFFEFF, 0xFFFE03FF,
0xFEBF0FDF, 0x02FE3FFF, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x1FFF0000, 0x00000002,
0x000000A0, 0x003EFFFE, 0xFFFFFFFE, 0xFFFFFFFF,
0x661FFFFF, 0xFFFFFFFE, 0xFFFFFFFF, 0x77FFFFFF,
};
static const unsigned char nmstrtPages[] = {
0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x00,
0x00, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
0x00, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x15, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};
static const unsigned char namePages[] = {
0x19, 0x03, 0x1A, 0x1B, 0x1C, 0x1D, 0x1E, 0x00,
0x00, 0x1F, 0x20, 0x21, 0x22, 0x23, 0x24, 0x25,
0x10, 0x11, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x12, 0x13,
0x26, 0x14, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x27, 0x16, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x17,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,
0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x18,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
};

View File

@ -0,0 +1,38 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
/* 0x80 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x84 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x88 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x8C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x90 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x94 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x98 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0x9C */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xA8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xAC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB0 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB4 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xB8 */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xBC */ BT_TRAIL, BT_TRAIL, BT_TRAIL, BT_TRAIL,
/* 0xC0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xC8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xCC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD0 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD4 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xD8 */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xDC */ BT_LEAD2, BT_LEAD2, BT_LEAD2, BT_LEAD2,
/* 0xE0 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE4 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xE8 */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xEC */ BT_LEAD3, BT_LEAD3, BT_LEAD3, BT_LEAD3,
/* 0xF0 */ BT_LEAD4, BT_LEAD4, BT_LEAD4, BT_LEAD4,
/* 0xF4 */ BT_LEAD4, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xF8 */ BT_NONXML, BT_NONXML, BT_NONXML, BT_NONXML,
/* 0xFC */ BT_NONXML, BT_NONXML, BT_MALFORM, BT_MALFORM,

View File

@ -0,0 +1,52 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#include <string.h>
#ifdef XML_WINLIB
#define WIN32_LEAN_AND_MEAN
#define STRICT
#include <windows.h>
#define malloc(x) HeapAlloc(GetProcessHeap(), 0, (x))
#define calloc(x, y) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (x)*(y))
#define free(x) HeapFree(GetProcessHeap(), 0, (x))
#define realloc(x, y) HeapReAlloc(GetProcessHeap(), 0, x, y)
#define abort() /* as nothing */
#else /* not XML_WINLIB */
#include <stdlib.h>
#endif /* not XML_WINLIB */
/* This file can be used for any definitions needed in
particular environments. */
/* Mozilla specific defines */
#ifdef MOZILLA_CLIENT
#include "nspr.h"
#define malloc(x) PR_Malloc((size_t)(x))
#define realloc(x, y) PR_Realloc((x), (size_t)(y))
#define calloc(x, y) PR_Calloc((x),(y))
#define free(x) PR_Free(x)
#if PR_BYTES_PER_INT != 4
#define int int32
#endif
/* Enable Unicode string processing in expat. */
#ifndef XML_UNICODE
#define XML_UNICODE
#endif
/* Enable external parameter entity parsing in expat */
#ifndef XML_DTD
#define XML_DTD 1
#endif
#endif /* MOZILLA_CLIENT */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,99 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#ifndef XmlRole_INCLUDED
#define XmlRole_INCLUDED 1
#include "xmltok.h"
#ifdef __cplusplus
extern "C" {
#endif
enum {
XML_ROLE_ERROR = -1,
XML_ROLE_NONE = 0,
XML_ROLE_XML_DECL,
XML_ROLE_INSTANCE_START,
XML_ROLE_DOCTYPE_NAME,
XML_ROLE_DOCTYPE_SYSTEM_ID,
XML_ROLE_DOCTYPE_PUBLIC_ID,
XML_ROLE_DOCTYPE_CLOSE,
XML_ROLE_GENERAL_ENTITY_NAME,
XML_ROLE_PARAM_ENTITY_NAME,
XML_ROLE_ENTITY_VALUE,
XML_ROLE_ENTITY_SYSTEM_ID,
XML_ROLE_ENTITY_PUBLIC_ID,
XML_ROLE_ENTITY_NOTATION_NAME,
XML_ROLE_NOTATION_NAME,
XML_ROLE_NOTATION_SYSTEM_ID,
XML_ROLE_NOTATION_NO_SYSTEM_ID,
XML_ROLE_NOTATION_PUBLIC_ID,
XML_ROLE_ATTRIBUTE_NAME,
XML_ROLE_ATTRIBUTE_TYPE_CDATA,
XML_ROLE_ATTRIBUTE_TYPE_ID,
XML_ROLE_ATTRIBUTE_TYPE_IDREF,
XML_ROLE_ATTRIBUTE_TYPE_IDREFS,
XML_ROLE_ATTRIBUTE_TYPE_ENTITY,
XML_ROLE_ATTRIBUTE_TYPE_ENTITIES,
XML_ROLE_ATTRIBUTE_TYPE_NMTOKEN,
XML_ROLE_ATTRIBUTE_TYPE_NMTOKENS,
XML_ROLE_ATTRIBUTE_ENUM_VALUE,
XML_ROLE_ATTRIBUTE_NOTATION_VALUE,
XML_ROLE_ATTLIST_ELEMENT_NAME,
XML_ROLE_IMPLIED_ATTRIBUTE_VALUE,
XML_ROLE_REQUIRED_ATTRIBUTE_VALUE,
XML_ROLE_DEFAULT_ATTRIBUTE_VALUE,
XML_ROLE_FIXED_ATTRIBUTE_VALUE,
XML_ROLE_ELEMENT_NAME,
XML_ROLE_CONTENT_ANY,
XML_ROLE_CONTENT_EMPTY,
XML_ROLE_CONTENT_PCDATA,
XML_ROLE_GROUP_OPEN,
XML_ROLE_GROUP_CLOSE,
XML_ROLE_GROUP_CLOSE_REP,
XML_ROLE_GROUP_CLOSE_OPT,
XML_ROLE_GROUP_CLOSE_PLUS,
XML_ROLE_GROUP_CHOICE,
XML_ROLE_GROUP_SEQUENCE,
XML_ROLE_CONTENT_ELEMENT,
XML_ROLE_CONTENT_ELEMENT_REP,
XML_ROLE_CONTENT_ELEMENT_OPT,
XML_ROLE_CONTENT_ELEMENT_PLUS,
#ifdef XML_DTD
XML_ROLE_TEXT_DECL,
XML_ROLE_IGNORE_SECT,
XML_ROLE_INNER_PARAM_ENTITY_REF,
#endif /* XML_DTD */
XML_ROLE_PARAM_ENTITY_REF,
XML_ROLE_EXTERNAL_GENERAL_ENTITY_NO_NOTATION
};
typedef struct prolog_state {
int (*handler)(struct prolog_state *state,
int tok,
const char *ptr,
const char *end,
const ENCODING *enc);
unsigned level;
#ifdef XML_DTD
unsigned includeLevel;
int documentEntity;
#endif /* XML_DTD */
} PROLOG_STATE;
void XMLTOKAPI XmlPrologStateInit(PROLOG_STATE *);
#ifdef XML_DTD
void XMLTOKAPI XmlPrologStateInitExternalEntity(PROLOG_STATE *);
#endif /* XML_DTD */
#define XmlTokenRole(state, tok, ptr, end, enc) \
(((state)->handler)(state, tok, ptr, end, enc))
#ifdef __cplusplus
}
#endif
#endif /* not XmlRole_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,301 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
#ifndef XmlTok_INCLUDED
#define XmlTok_INCLUDED 1
#ifdef __cplusplus
extern "C" {
#endif
#ifndef XMLTOKAPI
#define XMLTOKAPI /* as nothing */
#endif
/* The following token may be returned by XmlContentTok */
#define XML_TOK_TRAILING_RSQB -5 /* ] or ]] at the end of the scan; might be start of
illegal ]]> sequence */
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
#define XML_TOK_NONE -4 /* The string to be scanned is empty */
#define XML_TOK_TRAILING_CR -3 /* A CR at the end of the scan;
might be part of CRLF sequence */
#define XML_TOK_PARTIAL_CHAR -2 /* only part of a multibyte sequence */
#define XML_TOK_PARTIAL -1 /* only part of a token */
#define XML_TOK_INVALID 0
/* The following tokens are returned by XmlContentTok; some are also
returned by XmlAttributeValueTok, XmlEntityTok, XmlCdataSectionTok */
#define XML_TOK_START_TAG_WITH_ATTS 1
#define XML_TOK_START_TAG_NO_ATTS 2
#define XML_TOK_EMPTY_ELEMENT_WITH_ATTS 3 /* empty element tag <e/> */
#define XML_TOK_EMPTY_ELEMENT_NO_ATTS 4
#define XML_TOK_END_TAG 5
#define XML_TOK_DATA_CHARS 6
#define XML_TOK_DATA_NEWLINE 7
#define XML_TOK_CDATA_SECT_OPEN 8
#define XML_TOK_ENTITY_REF 9
#define XML_TOK_CHAR_REF 10 /* numeric character reference */
/* The following tokens may be returned by both XmlPrologTok and XmlContentTok */
#define XML_TOK_PI 11 /* processing instruction */
#define XML_TOK_XML_DECL 12 /* XML decl or text decl */
#define XML_TOK_COMMENT 13
#define XML_TOK_BOM 14 /* Byte order mark */
/* The following tokens are returned only by XmlPrologTok */
#define XML_TOK_PROLOG_S 15
#define XML_TOK_DECL_OPEN 16 /* <!foo */
#define XML_TOK_DECL_CLOSE 17 /* > */
#define XML_TOK_NAME 18
#define XML_TOK_NMTOKEN 19
#define XML_TOK_POUND_NAME 20 /* #name */
#define XML_TOK_OR 21 /* | */
#define XML_TOK_PERCENT 22
#define XML_TOK_OPEN_PAREN 23
#define XML_TOK_CLOSE_PAREN 24
#define XML_TOK_OPEN_BRACKET 25
#define XML_TOK_CLOSE_BRACKET 26
#define XML_TOK_LITERAL 27
#define XML_TOK_PARAM_ENTITY_REF 28
#define XML_TOK_INSTANCE_START 29
/* The following occur only in element type declarations */
#define XML_TOK_NAME_QUESTION 30 /* name? */
#define XML_TOK_NAME_ASTERISK 31 /* name* */
#define XML_TOK_NAME_PLUS 32 /* name+ */
#define XML_TOK_COND_SECT_OPEN 33 /* <![ */
#define XML_TOK_COND_SECT_CLOSE 34 /* ]]> */
#define XML_TOK_CLOSE_PAREN_QUESTION 35 /* )? */
#define XML_TOK_CLOSE_PAREN_ASTERISK 36 /* )* */
#define XML_TOK_CLOSE_PAREN_PLUS 37 /* )+ */
#define XML_TOK_COMMA 38
/* The following token is returned only by XmlAttributeValueTok */
#define XML_TOK_ATTRIBUTE_VALUE_S 39
/* The following token is returned only by XmlCdataSectionTok */
#define XML_TOK_CDATA_SECT_CLOSE 40
/* With namespace processing this is returned by XmlPrologTok
for a name with a colon. */
#define XML_TOK_PREFIXED_NAME 41
#ifdef XML_DTD
#define XML_TOK_IGNORE_SECT 42
#endif /* XML_DTD */
#ifdef XML_DTD
#define XML_N_STATES 4
#else /* not XML_DTD */
#define XML_N_STATES 3
#endif /* not XML_DTD */
#define XML_PROLOG_STATE 0
#define XML_CONTENT_STATE 1
#define XML_CDATA_SECTION_STATE 2
#ifdef XML_DTD
#define XML_IGNORE_SECTION_STATE 3
#endif /* XML_DTD */
#define XML_N_LITERAL_TYPES 2
#define XML_ATTRIBUTE_VALUE_LITERAL 0
#define XML_ENTITY_VALUE_LITERAL 1
/* The size of the buffer passed to XmlUtf8Encode must be at least this. */
#define XML_UTF8_ENCODE_MAX 4
/* The size of the buffer passed to XmlUtf16Encode must be at least this. */
#define XML_UTF16_ENCODE_MAX 2
typedef struct position {
/* first line and first column are 0 not 1 */
unsigned long lineNumber;
unsigned long columnNumber;
} POSITION;
typedef struct {
const char *name;
const char *valuePtr;
const char *valueEnd;
char normalized;
} ATTRIBUTE;
struct encoding;
typedef struct encoding ENCODING;
struct encoding {
int (*scanners[XML_N_STATES])(const ENCODING *,
const char *,
const char *,
const char **);
int (*literalScanners[XML_N_LITERAL_TYPES])(const ENCODING *,
const char *,
const char *,
const char **);
int (*sameName)(const ENCODING *,
const char *, const char *);
int (*nameMatchesAscii)(const ENCODING *,
const char *, const char *, const char *);
int (*nameLength)(const ENCODING *, const char *);
const char *(*skipS)(const ENCODING *, const char *);
int (*getAtts)(const ENCODING *enc, const char *ptr,
int attsMax, ATTRIBUTE *atts);
int (*charRefNumber)(const ENCODING *enc, const char *ptr);
int (*predefinedEntityName)(const ENCODING *, const char *, const char *);
void (*updatePosition)(const ENCODING *,
const char *ptr,
const char *end,
POSITION *);
int (*isPublicId)(const ENCODING *enc, const char *ptr, const char *end,
const char **badPtr);
void (*utf8Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
char **toP,
const char *toLim);
void (*utf16Convert)(const ENCODING *enc,
const char **fromP,
const char *fromLim,
unsigned short **toP,
const unsigned short *toLim);
int minBytesPerChar;
char isUtf8;
char isUtf16;
};
/*
Scan the string starting at ptr until the end of the next complete token,
but do not scan past eptr. Return an integer giving the type of token.
Return XML_TOK_NONE when ptr == eptr; nextTokPtr will not be set.
Return XML_TOK_PARTIAL when the string does not contain a complete token;
nextTokPtr will not be set.
Return XML_TOK_INVALID when the string does not start a valid token; nextTokPtr
will be set to point to the character which made the token invalid.
Otherwise the string starts with a valid token; nextTokPtr will be set to point
to the character following the end of that token.
Each data character counts as a single token, but adjacent data characters
may be returned together. Similarly for characters in the prolog outside
literals, comments and processing instructions.
*/
#define XmlTok(enc, state, ptr, end, nextTokPtr) \
(((enc)->scanners[state])(enc, ptr, end, nextTokPtr))
#define XmlPrologTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_PROLOG_STATE, ptr, end, nextTokPtr)
#define XmlContentTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CONTENT_STATE, ptr, end, nextTokPtr)
#define XmlCdataSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_CDATA_SECTION_STATE, ptr, end, nextTokPtr)
#ifdef XML_DTD
#define XmlIgnoreSectionTok(enc, ptr, end, nextTokPtr) \
XmlTok(enc, XML_IGNORE_SECTION_STATE, ptr, end, nextTokPtr)
#endif /* XML_DTD */
/* This is used for performing a 2nd-level tokenization on
the content of a literal that has already been returned by XmlTok. */
#define XmlLiteralTok(enc, literalType, ptr, end, nextTokPtr) \
(((enc)->literalScanners[literalType])(enc, ptr, end, nextTokPtr))
#define XmlAttributeValueTok(enc, ptr, end, nextTokPtr) \
XmlLiteralTok(enc, XML_ATTRIBUTE_VALUE_LITERAL, ptr, end, nextTokPtr)
#define XmlEntityValueTok(enc, ptr, end, nextTokPtr) \
XmlLiteralTok(enc, XML_ENTITY_VALUE_LITERAL, ptr, end, nextTokPtr)
#define XmlSameName(enc, ptr1, ptr2) (((enc)->sameName)(enc, ptr1, ptr2))
#define XmlNameMatchesAscii(enc, ptr1, end1, ptr2) \
(((enc)->nameMatchesAscii)(enc, ptr1, end1, ptr2))
#define XmlNameLength(enc, ptr) \
(((enc)->nameLength)(enc, ptr))
#define XmlSkipS(enc, ptr) \
(((enc)->skipS)(enc, ptr))
#define XmlGetAttributes(enc, ptr, attsMax, atts) \
(((enc)->getAtts)(enc, ptr, attsMax, atts))
#define XmlCharRefNumber(enc, ptr) \
(((enc)->charRefNumber)(enc, ptr))
#define XmlPredefinedEntityName(enc, ptr, end) \
(((enc)->predefinedEntityName)(enc, ptr, end))
#define XmlUpdatePosition(enc, ptr, end, pos) \
(((enc)->updatePosition)(enc, ptr, end, pos))
#define XmlIsPublicId(enc, ptr, end, badPtr) \
(((enc)->isPublicId)(enc, ptr, end, badPtr))
#define XmlUtf8Convert(enc, fromP, fromLim, toP, toLim) \
(((enc)->utf8Convert)(enc, fromP, fromLim, toP, toLim))
#define XmlUtf16Convert(enc, fromP, fromLim, toP, toLim) \
(((enc)->utf16Convert)(enc, fromP, fromLim, toP, toLim))
typedef struct {
ENCODING initEnc;
const ENCODING **encPtr;
} INIT_ENCODING;
int XMLTOKAPI XmlParseXmlDecl(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingNamePtr,
const ENCODING **namedEncodingPtr,
int *standalonePtr);
int XMLTOKAPI XmlInitEncoding(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncoding(void);
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncoding(void);
int XMLTOKAPI XmlUtf8Encode(int charNumber, char *buf);
int XMLTOKAPI XmlUtf16Encode(int charNumber, unsigned short *buf);
int XMLTOKAPI XmlSizeOfUnknownEncoding(void);
ENCODING XMLTOKAPI *
XmlInitUnknownEncoding(void *mem,
int *table,
int (*conv)(void *userData, const char *p),
void *userData);
int XMLTOKAPI XmlParseXmlDeclNS(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingNamePtr,
const ENCODING **namedEncodingPtr,
int *standalonePtr);
int XMLTOKAPI XmlInitEncodingNS(INIT_ENCODING *, const ENCODING **, const char *name);
const ENCODING XMLTOKAPI *XmlGetUtf8InternalEncodingNS(void);
const ENCODING XMLTOKAPI *XmlGetUtf16InternalEncodingNS(void);
ENCODING XMLTOKAPI *
XmlInitUnknownEncodingNS(void *mem,
int *table,
int (*conv)(void *userData, const char *p),
void *userData);
#ifdef __cplusplus
}
#endif
#endif /* not XmlTok_INCLUDED */

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,46 @@
/*
Copyright (c) 1998, 1999 Thai Open Source Software Center Ltd
See the file copying.txt for copying permission.
*/
enum {
BT_NONXML,
BT_MALFORM,
BT_LT,
BT_AMP,
BT_RSQB,
BT_LEAD2,
BT_LEAD3,
BT_LEAD4,
BT_TRAIL,
BT_CR,
BT_LF,
BT_GT,
BT_QUOT,
BT_APOS,
BT_EQUALS,
BT_QUEST,
BT_EXCL,
BT_SOL,
BT_SEMI,
BT_NUM,
BT_LSQB,
BT_S,
BT_NMSTRT,
BT_COLON,
BT_HEX,
BT_DIGIT,
BT_NAME,
BT_MINUS,
BT_OTHER, /* known not to be a name or name start character */
BT_NONASCII, /* might be a name or name start character */
BT_PERCNT,
BT_LPAR,
BT_RPAR,
BT_AST,
BT_PLUS,
BT_COMMA,
BT_VERBAR
};
#include <stddef.h>

View File

@ -0,0 +1,96 @@
const ENCODING *NS(XmlGetUtf8InternalEncoding)(void)
{
return &ns(internal_utf8_encoding).enc;
}
const ENCODING *NS(XmlGetUtf16InternalEncoding)(void)
{
#if XML_BYTE_ORDER == 12
return &ns(internal_little2_encoding).enc;
#elif XML_BYTE_ORDER == 21
return &ns(internal_big2_encoding).enc;
#else
const short n = 1;
return *(const char *)&n ? &ns(internal_little2_encoding).enc : &ns(internal_big2_encoding).enc;
#endif
}
static
const ENCODING *NS(encodings)[] = {
&ns(latin1_encoding).enc,
&ns(ascii_encoding).enc,
&ns(utf8_encoding).enc,
&ns(big2_encoding).enc,
&ns(big2_encoding).enc,
&ns(little2_encoding).enc,
&ns(utf8_encoding).enc /* NO_ENC */
};
static
int NS(initScanProlog)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_PROLOG_STATE, ptr, end, nextTokPtr);
}
static
int NS(initScanContent)(const ENCODING *enc, const char *ptr, const char *end,
const char **nextTokPtr)
{
return initScan(NS(encodings), (const INIT_ENCODING *)enc, XML_CONTENT_STATE, ptr, end, nextTokPtr);
}
int NS(XmlInitEncoding)(INIT_ENCODING *p, const ENCODING **encPtr, const char *name)
{
int i = getEncodingIndex(name);
if (i == UNKNOWN_ENC)
return 0;
SET_INIT_ENC_INDEX(p, i);
p->initEnc.scanners[XML_PROLOG_STATE] = NS(initScanProlog);
p->initEnc.scanners[XML_CONTENT_STATE] = NS(initScanContent);
p->initEnc.updatePosition = initUpdatePosition;
p->encPtr = encPtr;
*encPtr = &(p->initEnc);
return 1;
}
static
const ENCODING *NS(findEncoding)(const ENCODING *enc, const char *ptr, const char *end)
{
#define ENCODING_MAX 128
char buf[ENCODING_MAX];
char *p = buf;
int i;
XmlUtf8Convert(enc, &ptr, end, &p, p + ENCODING_MAX - 1);
if (ptr != end)
return 0;
*p = 0;
if (streqci(buf, KW_UTF_16) && enc->minBytesPerChar == 2)
return enc;
i = getEncodingIndex(buf);
if (i == UNKNOWN_ENC)
return 0;
return NS(encodings)[i];
}
int NS(XmlParseXmlDecl)(int isGeneralTextEntity,
const ENCODING *enc,
const char *ptr,
const char *end,
const char **badPtr,
const char **versionPtr,
const char **encodingName,
const ENCODING **encoding,
int *standalone)
{
return doParseXmlDecl(NS(findEncoding),
isGeneralTextEntity,
enc,
ptr,
end,
badPtr,
versionPtr,
encodingName,
encoding,
standalone);
}

40
src/xrc/makefile.b32 Normal file
View File

@ -0,0 +1,40 @@
#
# File: makefile.b32
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright:
#
# Makefile : Builds BC++ library for 32-bit BC++
WXDIR = $(WXWIN)
expat_dir = $(WXDIR)\contrib\src\xrc\expat
XMLPARSEDIR = $(expat_dir)\xmlparse
XMLTOKDIR = $(expat_dir)\xmltok
EXPAT_DEFS=-I$(expat_dir)\xmlparse -I$(expat_dir)\xmltok
EXPAT_OBJECTS=xmltok.obj xmlrole.obj xmlparse.obj
EXTRACPPFLAGS=$(wxLIBXMLDIR) $(EXPAT_DEFS)
LIBTARGET=$(WXDIR)\lib\wxxrc.lib
OBJECTS=$(EXPAT_OBJECTS) \
xml.obj xmlbin.obj xmlbinz.obj xmlexpat.obj xmlwrite.obj xmlres.obj xmlrsall.obj \
xh_bttn.obj xh_chckb.obj xh_chckl.obj xh_choic.obj xh_combo.obj xh_dlg.obj \
xh_gauge.obj xh_html.obj xh_menu.obj xh_notbk.obj xh_panel.obj xh_radbt.obj \
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj \
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj \
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj \
xh_tree.obj xh_unkwn.obj xh_frame.obj
!include $(WXDIR)\src\makelib.b32
{$(XMLPARSEDIR)}.c.obj:
bcc32 $(EXPAT_DEFS) -c -w-ccc -w-rch -w-par {$< }
{$(XMLTOKDIR)}.c.obj:
bcc32 $(EXPAT_DEFS) -c -w-ccc -w-rch -w-par {$< }

40
src/xrc/makefile.g95 Normal file
View File

@ -0,0 +1,40 @@
#
# File: makefile.g95
# Author: Julian Smart
# Created: 2000
# Updated:
# Copyright: (c) Julian Smart, 2000
#
# Makefile for wxWindows wxXML library (Cygwin/Mingw32).
WXDIR = ../../..
expat_dir = $(WXDIR)/contrib/src/xrc/expat
XMLPARSEDIR = $(expat_dir)/xmlparse
XMLTOKDIR=$(expat_dir)/xmltok
EXPAT_DEFS=-I$(expat_dir)/xmlparse -I$(expat_dir)/xmltok
EXTRACPPFLAGS=$(EXPAT_DEFS)
XMLPARSEDIR_OBJECTS=xmlparse.o
XMLTOKDIR_OBJECTS=xmltok.o xmlrole.o
LIBTARGET=$(WXDIR)/lib/libwxxrc.a
OBJECTS= $(XMLPARSEDIR_OBJECTS) $(XMLTOKDIR_OBJECTS) \
xml.o xmlbin.o xmlbinz.o xmlexpat.o xmlwrite.o xmlres.o xmlrsall.o \
xh_bttn.o xh_chckb.o xh_chckl.o xh_choic.o xh_combo.o xh_dlg.o \
xh_gauge.o xh_html.o xh_menu.o xh_notbk.o xh_panel.o xh_radbt.o \
xh_radbx.o xh_sizer.o xh_slidr.o xh_spin.o xh_stbmp.o xh_sttxt.o \
xh_text.o xh_listb.o xh_toolb.o xh_stlin.o xh_bmp.o xh_unkwn.o \
xh_bmpbt.o xh_cald.o xh_listc.o xh_scrol.o xh_stbox.o xh_tree.o \
xh_frame.o
include $(WXDIR)/src/makelib.g95
$(XMLPARSEDIR_OBJECTS):
$(CC) -g $(EXPAT_DEFS) -c -o $@ $(XMLPARSEDIR)/$(patsubst %.o,%.c, $@)
$(XMLTOKDIR_OBJECTS):
$(CC) -g $(EXPAT_DEFS) -c -o $@ $(XMLTOKDIR)/$(patsubst %.o,%.c, $@)

149
src/xrc/makefile.vc Normal file
View File

@ -0,0 +1,149 @@
# File: makefile.vc
# Author: Julian Smart
# Created: 1993
# Updated:
# Copyright: (c) 1993, AIAI, University of Edinburgh
#
# "%W% %G%"
#
# Makefile : Builds wxXML classes library (MS VC++).
# Use FINAL=1 argument to nmake to build final version with no debugging
# info
# Set WXDIR for your system
WXDIR = $(WXWIN)
wxXMLDIR = $(WXDIR)\contrib\src\xrc
wxXMLINC = $(WXDIR)\contrib\include\wx\xml
THISDIR = $(WXDIR)\contrib\src\xrc
DOCDIR=$(WXDIR)\contrib\docs
LOCALDOCDIR=$(WXDIR)\contrib\docs\latex\xml
NOPCH=1
EXPAT_DIR=$(THISDIR)\expat
E1=$(EXPAT_DIR)\xmlparse
E2=$(EXPAT_DIR)\xmltok
EXPAT_INCS=-I$(THISDIR)\expat\xmlparse -I$(THISDIR)\expat\xmltok
EXPAT_OBJS=$(D)\xmlparse.obj $(D)\xmlrole.obj $(D)\xmltok.obj
# Set this to where your libxml directory is
EXTRAFLAGS=$(EXPAT_INCS)
# Unfortunately we need this _before_ we include makelib.vc
!if "$(FINAL)" == "1"
D=Release
!else
D=Debug
LIBEXT=d
!endif
LIBTARGET=$(WXDIR)\lib\wxxrc$(LIBEXT).lib
EXTRATARGETS=$(D)
OBJECTS=$(EXPAT_OBJS) \
$(D)\xml.obj $(D)\xmlbin.obj $(D)\xmlbinz.obj $(D)\xmlres.obj \
$(D)\xmlrsall.obj $(D)\xh_bttn.obj $(D)\xh_chckb.obj $(D)\xh_chckl.obj \
$(D)\xh_choic.obj $(D)\xh_combo.obj $(D)\xh_dlg.obj \
$(D)\xh_frame.obj $(D)\xh_gauge.obj $(D)\xh_html.obj $(D)\xh_menu.obj \
$(D)\xh_notbk.obj $(D)\xh_panel.obj $(D)\xh_radbt.obj \
$(D)\xh_radbx.obj $(D)\xh_sizer.obj $(D)\xh_slidr.obj $(D)\xh_spin.obj \
$(D)\xh_stbmp.obj $(D)\xh_sttxt.obj \
$(D)\xh_text.obj $(D)\xh_listb.obj $(D)\xh_toolb.obj \
$(D)\xh_bmpbt.obj $(D)\xh_cald.obj $(D)\xh_listc.obj $(D)\xh_scrol.obj \
$(D)\xh_stbox.obj $(D)\xh_tree.obj $(D)\xh_stlin.obj $(D)\xh_bmp.obj \
$(D)\xh_unkwn.obj $(D)\xmlwrite.obj $(D)\xmlexpat.obj
!include $(WXDIR)\src\makelib.vc
{$(E1)}.c{$(D)}.obj:
$(cc) @<<
$(CPPFLAGS) /c /Fo$@ /Tc $<
<<
{$(E2)}.c{$(D)}.obj:
$(cc) @<<
$(CPPFLAGS) /c /Fo$@ /Tc $<
<<
DOCSOURCES=$(LOCALDOCDIR)\xml.tex \
$(LOCALDOCDIR)\bugs.tex $(LOCALDOCDIR)\changes.tex\
$(LOCALDOCDIR)\classes.tex $(LOCALDOCDIR)\intro.tex\
$(LOCALDOCDIR)\topics.tex $(LOCALDOCDIR)\sample.tex
html: $(DOCDIR)\html\xml\xml.htm
htmlhelp: $(DOCDIR)\htmlhelp\xml.chm
htb: $(DOCDIR)\htb\xml.htb
hlp: $(DOCDIR)\winhelp\xml.hlp
pdfrtf: $(DOCDIR)\pdf\xml.rtf
ps: $(DOCDIR)\ps\xml.ps
touchmanual:
touch $(LOCALDOCDIR)\xml.tex
$(DOCDIR)\winhelp\xml.hlp: $(LOCALDOCDIR)\xml.rtf $(LOCALDOCDIR)\xml.hpj
cd $(LOCALDOCDIR)
-erase xml.ph
hc xml
move xml.hlp $(DOCDIR)\winhelp\xml.hlp
move xml.cnt $(DOCDIR)\winhelp\xml.cnt
cd $(THISDIR)
$(LOCALDOCDIR)\xml.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(LOCALDOCDIR)\xml.rtf -twice -winhelp
cd $(THISDIR)
$(DOCDIR)\pdf\xml.rtf: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-copy *.bmp $(DOCDIR)\pdf
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(DOCDIR)\pdf\xml.rtf -twice -rtf
cd $(THISDIR)
$(DOCDIR)\html\xml\xml.htm: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-mkdir $(DOCDIR)\html\xml
copy *.gif $(DOCDIR)\html\xml
-start $(WAITFLAG) tex2rtf $(LOCALDOCDIR)\xml.tex $(DOCDIR)\html\xml\xml.htm -twice -html
-erase $(DOCDIR)\html\xml\*.con
-erase *.con
-erase $(DOCDIR)\html\xml\*.ref
cd $(THISDIR)
$(DOCDIR)\htmlhelp\xml.chm: $(DOCDIR)\html\xml\xml.htm $(DOCDIR)\html\xml\xml.hhp
cd $(DOCDIR)\html\xml
-hhc xml.hhp
move xml.chm $(DOCDIR)\htmlhelp\xml.chm
cd $(THISDIR)
# An htb file is a zip file containing the .htm, .gif, .hhp, .hhc and .hhk
# files, renamed to htb.
# This can then be used with e.g. helpview.
# Optionally, a cached version of the .hhp file can be generated with hhp2cached.
$(DOCDIR)\htb\xml.htb: $(DOCDIR)\html\xml\xml.htm
cd $(DOCDIR)\html\xml
-erase xml.zip xml.htb
zip xml.zip *.htm *.gif *.hhp *.hhc *.hhk
-mkdir $(DOCDIR)\htb
move xml.zip $(DOCDIR)\htb\xml.htb
cd $(THISDIR)
$(LOCALDOCDIR)\xml.dvi: $(DOCSOURCES)
cd $(LOCALDOCDIR)
-latex xml
-latex xml
-makeindx xml
-bibtex xml
-latex xml
-latex xml
cd $(THISDIR)
$(WXDIR)\docs\ps\xml.ps: $(LOCALDOCDIR)\xml.dvi
cd $(LOCALDOCDIR)
-dvips32 -o xml.ps xml
move xml.ps $(WXDIR)\docs\ps\xml.ps
cd $(THISDIR)

31
src/xrc/makefile.wat Normal file
View File

@ -0,0 +1,31 @@
# wxXML makefile
WXDIR = ..\..\..
EXTRACPPFLAGS=/Id:\libxml\libxml2-2.1.1
!include $(WXDIR)\src\makewat.env
WXXMLLIB = $(WXDIR)\lib\wxxrc.lib
THISDIR = $(WXDIR)\contrib\src\xrc
NAME = wxxrc
LNK = $(name).lnk
OBJECTS=xml.obj xmlbin.obj xmlbinz.obj xmlpars.obj xmlres.obj xmlrsall.obj &
xh_bttn.obj xh_chckb.obj xh_chckl.obj xh_choic.obj xh_combo.obj xh_dlg.obj &
xh_gauge.obj xh_html.obj xh_menu.obj xh_notbk.obj xh_panel.obj xh_radbt.obj &
xh_radbx.obj xh_sizer.obj xh_slidr.obj xh_spin.obj xh_stbmp.obj xh_sttxt.obj &
xh_text.obj xh_listb.obj xh_toolb.obj xh_stlin.obj xh_bmp.obj &
xh_bmpbt.obj xh_cald.obj xh_listc.obj xh_scrol.obj xh_stbox.obj &
xh_tree.obj xh_unkwn.obj xh_frame.obj
all: $(WXXMLLIB)
$(WXXMLLIB): $(OBJECTS)
*wlib /b /c /n /P=256 $(WXXMLLIB) $(OBJECTS)
clean: .SYMBOLIC
-erase *.obj *.bak *.err *.pch $(WXXMLLIB) *.lbc

254
src/xrc/wxXMLVC.dsp Normal file
View File

@ -0,0 +1,254 @@
# Microsoft Developer Studio Project File - Name="wxXMLVC" - Package Owner=<4>
# Microsoft Developer Studio Generated Build File, Format Version 6.00
# ** DO NOT EDIT **
# TARGTYPE "Win32 (x86) Static Library" 0x0104
CFG=wxXMLVC - Win32 Debug
!MESSAGE This is not a valid makefile. To build this project using NMAKE,
!MESSAGE use the Export Makefile command and run
!MESSAGE
!MESSAGE NMAKE /f "wxXMLVC.mak".
!MESSAGE
!MESSAGE You can specify a configuration when running NMAKE
!MESSAGE by defining the macro CFG on the command line. For example:
!MESSAGE
!MESSAGE NMAKE /f "wxXMLVC.mak" CFG="wxXMLVC - Win32 Debug"
!MESSAGE
!MESSAGE Possible choices for configuration are:
!MESSAGE
!MESSAGE "wxXMLVC - Win32 Release" (based on "Win32 (x86) Static Library")
!MESSAGE "wxXMLVC - Win32 Debug" (based on "Win32 (x86) Static Library")
!MESSAGE
# Begin Project
# PROP AllowPerConfigDependencies 0
# PROP Scc_ProjName ""
# PROP Scc_LocalPath ""
CPP=cl.exe
RSC=rc.exe
!IF "$(CFG)" == "wxXMLVC - Win32 Release"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 0
# PROP BASE Output_Dir "Release"
# PROP BASE Intermediate_Dir "Release"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 0
# PROP Output_Dir "Release"
# PROP Intermediate_Dir "Release"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MD /W3 /GX /O1 /Ob2 /I "../../../include" /I "../../include" /I "expat/xmlparse" /I "expat/xmltok" /D "WIN32" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\wxxrc.lib"
!ELSEIF "$(CFG)" == "wxXMLVC - Win32 Debug"
# PROP BASE Use_MFC 0
# PROP BASE Use_Debug_Libraries 1
# PROP BASE Output_Dir "Debug"
# PROP BASE Intermediate_Dir "Debug"
# PROP BASE Target_Dir ""
# PROP Use_MFC 0
# PROP Use_Debug_Libraries 1
# PROP Output_Dir "Debug"
# PROP Intermediate_Dir "Debug"
# PROP Target_Dir ""
# ADD BASE CPP /nologo /W3 /GX /Z7 /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /YX /FD /c
# ADD CPP /nologo /MDd /W3 /GX /Z7 /Od /I "../../../include" /I "../../include" /I "expat/xmlparse" /I "expat/xmltok" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "__WINDOWS__" /D "__WXMSW__" /D DEBUG=1 /D "__WXDEBUG__" /D "__WIN95__" /D "__WIN32__" /D WINVER=0x0400 /D "STRICT" /FD /c
# SUBTRACT CPP /YX
# ADD BASE RSC /l 0x809
# ADD RSC /l 0x809
BSC32=bscmake.exe
# ADD BASE BSC32 /nologo
# ADD BSC32 /nologo
LIB32=link.exe -lib
# ADD BASE LIB32 /nologo
# ADD LIB32 /nologo /out:"..\..\lib\wxxrcd.lib"
!ENDIF
# Begin Target
# Name "wxXMLVC - Win32 Release"
# Name "wxXMLVC - Win32 Debug"
# Begin Group "Expat"
# PROP Default_Filter ""
# Begin Source File
SOURCE=.\expat\xmlparse\xmlparse.c
# End Source File
# Begin Source File
SOURCE=.\expat\xmltok\xmlrole.c
# End Source File
# Begin Source File
SOURCE=.\expat\xmltok\xmltok.c
# End Source File
# End Group
# Begin Source File
SOURCE=.\xh_bmp.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_bmpbt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_bttn.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_cald.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_chckb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_chckl.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_choic.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_combo.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_dlg.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_frame.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_gauge.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_html.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_listb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_listc.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_menu.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_notbk.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_panel.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_radbt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_radbx.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_scrol.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_sizer.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_slidr.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_spin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbmp.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stbox.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_stlin.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_sttxt.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_text.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_toolb.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_tree.cpp
# End Source File
# Begin Source File
SOURCE=.\xh_unkwn.cpp
# End Source File
# Begin Source File
SOURCE=.\xml.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlbin.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlbinz.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlexpat.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlres.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlrsall.cpp
# End Source File
# Begin Source File
SOURCE=.\xmlwrite.cpp
# End Source File
# End Target
# End Project

29
src/xrc/wxXMLVC.dsw Normal file
View File

@ -0,0 +1,29 @@
Microsoft Developer Studio Workspace File, Format Version 6.00
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
###############################################################################
Project: "wxXMLVC"=.\wxXMLVC.dsp - Package Owner=<4>
Package=<5>
{{{
}}}
Package=<4>
{{{
}}}
###############################################################################
Global:
Package=<5>
{{{
}}}
Package=<3>
{{{
}}}
###############################################################################

60
src/xrc/xh_bmp.cpp Normal file
View File

@ -0,0 +1,60 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmp.cpp
// Purpose: XML resource for wxBitmap and wxIcon
// Author: Vaclav Slavik
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bmp.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_bmp.h"
#include "wx/bitmap.h"
wxBitmapXmlHandler::wxBitmapXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxBitmapXmlHandler::DoCreateResource()
{
return new wxBitmap(GetBitmap(wxT("")));
}
bool wxBitmapXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmap"));
}
wxIconXmlHandler::wxIconXmlHandler()
: wxXmlResourceHandler()
{
}
wxObject *wxIconXmlHandler::DoCreateResource()
{
return new wxIcon(GetIcon(wxT("")));
}
bool wxIconXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxIcon"));
}

66
src/xrc/xh_bmpbt.cpp Normal file
View File

@ -0,0 +1,66 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bmpbt.cpp
// Purpose: XML resource for bitmap buttons
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bmpbt.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_bmpbt.h"
#include <wx/bmpbuttn.h>
wxBitmapButtonXmlHandler::wxBitmapButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_AUTODRAW);
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxBitmapButtonXmlHandler::DoCreateResource()
{
wxBitmapButton *button = new wxBitmapButton(m_parentAsWindow,
GetID(),
GetBitmap(wxT("bitmap")),
GetPosition(), GetSize(),
GetStyle(wxT("style"), wxBU_AUTODRAW),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
if (!GetParamValue(wxT("selected")).IsEmpty())
button->SetBitmapSelected(GetBitmap(wxT("selected")));
if (!GetParamValue(wxT("focus")).IsEmpty())
button->SetBitmapFocus(GetBitmap(wxT("focus")));
if (!GetParamValue(wxT("disabled")).IsEmpty())
button->SetBitmapDisabled(GetBitmap(wxT("disabled")));
return button;
}
bool wxBitmapButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxBitmapButton"));
}

59
src/xrc/xh_bttn.cpp Normal file
View File

@ -0,0 +1,59 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_bttn.cpp
// Purpose: XML resource for buttons
// Author: Vaclav Slavik
// Created: 2000/03/05
// RCS-ID: $Id$
// Copyright: (c) 2000 Vaclav Slavik
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_bttn.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_bttn.h"
#include "wx/button.h"
wxButtonXmlHandler::wxButtonXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxBU_LEFT);
ADD_STYLE(wxBU_RIGHT);
ADD_STYLE(wxBU_TOP);
ADD_STYLE(wxBU_BOTTOM);
AddWindowStyles();
}
wxObject *wxButtonXmlHandler::DoCreateResource()
{
wxButton *button = new wxButton(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName());
if (GetBool(wxT("default"), 0) == 1) button->SetDefault();
SetupWindow(button);
return button;
}
bool wxButtonXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxButton"));
}

61
src/xrc/xh_cald.cpp Normal file
View File

@ -0,0 +1,61 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_cald.cpp
// Purpose: XML resource for wxCalendarCtrl
// Author: Brian Gavin
// Created: 2000/09/09
// RCS-ID: $Id$
// Copyright: (c) 2000 Brian Gavin
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_cald.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_cald.h"
#include "wx/event.h"
#include "wx/calctrl.h"
wxCalendarCtrlXmlHandler::wxCalendarCtrlXmlHandler()
: wxXmlResourceHandler()
{
ADD_STYLE(wxCAL_SUNDAY_FIRST);
ADD_STYLE(wxCAL_MONDAY_FIRST);
ADD_STYLE(wxCAL_SHOW_HOLIDAYS);
ADD_STYLE(wxCAL_NO_YEAR_CHANGE);
ADD_STYLE(wxCAL_NO_MONTH_CHANGE);
AddWindowStyles();
}
wxObject *wxCalendarCtrlXmlHandler::DoCreateResource()
{
wxCalendarCtrl *calendar = new wxCalendarCtrl(m_parentAsWindow,
GetID(),
wxDefaultDateTime,
/*TODO: take it from resource*/
GetPosition(), GetSize(),
GetStyle(),
GetName());
SetupWindow(calendar);
return calendar;
}
bool wxCalendarCtrlXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCalendarCtrl"));
}

57
src/xrc/xh_chckb.cpp Normal file
View File

@ -0,0 +1,57 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_chckb.cpp
// Purpose: XML resource for wxCheckBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_chckb.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_chckb.h"
#include "wx/checkbox.h"
#if wxUSE_CHECKBOX
wxCheckBoxXmlHandler::wxCheckBoxXmlHandler()
: wxXmlResourceHandler()
{
AddWindowStyles();
}
wxObject *wxCheckBoxXmlHandler::DoCreateResource()
{
wxCheckBox *control = new wxCheckBox(m_parentAsWindow,
GetID(),
GetText(wxT("label")),
GetPosition(), GetSize(),
GetStyle(),
wxDefaultValidator,
GetName()
);
control->SetValue( GetBool( wxT("checked")));
SetupWindow(control);
return control;
}
bool wxCheckBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return IsOfClass(node, wxT("wxCheckBox"));
}
#endif

109
src/xrc/xh_chckl.cpp Normal file
View File

@ -0,0 +1,109 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_chckl.cpp
// Purpose: XML resource for wxCheckList
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_chckl.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_chckl.h"
#include "wx/checklst.h"
wxCheckListXmlHandler::wxCheckListXmlHandler()
: wxXmlResourceHandler(), m_insideBox(FALSE)
{
// no styles
AddWindowStyles();
}
wxObject *wxCheckListXmlHandler::DoCreateResource()
{
if (m_class == wxT("wxCheckList"))
{
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately(NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxCheckListBox *control = new wxCheckListBox(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
// step through children myself (again.)
wxXmlNode *n = GetParamNode(wxT("content"));
if (n) n = n->GetChildren();
int i = 0;
while (n)
{
if (n->GetType() != wxXML_ELEMENT_NODE ||
n->GetName() != wxT("item"))
{ n = n->GetNext(); continue; }
// checking boolean is a bit ugly here (see GetBool() )
wxString v = n->GetPropVal(wxT("checked"), wxEmptyString);
v.MakeLower();
if (v && v == wxT("1"))
control->Check( i, TRUE );
i++;
n = n->GetNext();
}
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item checked="boolean">Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxCheckListXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxCheckList")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}

95
src/xrc/xh_choic.cpp Normal file
View File

@ -0,0 +1,95 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_choic.cpp
// Purpose: XML resource for wxChoice
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_choic.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_choic.h"
#include "wx/choice.h"
wxChoiceXmlHandler::wxChoiceXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SORT);
AddWindowStyles();
}
wxObject *wxChoiceXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxChoice"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxChoice *control = new wxChoice(m_parentAsWindow,
GetID(),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxChoiceXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxChoice")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}

101
src/xrc/xh_combo.cpp Normal file
View File

@ -0,0 +1,101 @@
/////////////////////////////////////////////////////////////////////////////
// Name: xh_combo.cpp
// Purpose: XML resource for wxRadioBox
// Author: Bob Mitchell
// Created: 2000/03/21
// RCS-ID: $Id$
// Copyright: (c) 2000 Bob Mitchell and Verant Interactive
// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#ifdef __GNUG__
#pragma implementation "xh_combo.h"
#endif
// For compilers that support precompilation, includes "wx.h".
#include "wx/wxprec.h"
#ifdef __BORLANDC__
#pragma hdrstop
#endif
#include "wx/xrc/xh_combo.h"
#include "wx/combobox.h"
#if wxUSE_COMBOBOX
wxComboBoxXmlHandler::wxComboBoxXmlHandler()
: wxXmlResourceHandler() , m_insideBox(FALSE)
{
ADD_STYLE(wxCB_SIMPLE);
ADD_STYLE(wxCB_SORT);
ADD_STYLE(wxCB_READONLY);
ADD_STYLE(wxCB_DROPDOWN);
AddWindowStyles();
}
wxObject *wxComboBoxXmlHandler::DoCreateResource()
{
if( m_class == wxT("wxComboBox"))
{
// find the selection
long selection = GetLong( wxT("selection"), -1 );
// need to build the list of strings from children
m_insideBox = TRUE;
CreateChildrenPrivately( NULL, GetParamNode(wxT("content")));
wxString *strings = (wxString *) NULL;
if( strList.GetCount() > 0 )
{
strings = new wxString[strList.GetCount()];
int count = strList.GetCount();
for( int i = 0; i < count; i++ )
strings[i]=strList[i];
}
wxComboBox *control = new wxComboBox(m_parentAsWindow,
GetID(),
GetText(wxT("value")),
GetPosition(), GetSize(),
strList.GetCount(),
strings,
GetStyle(),
wxDefaultValidator,
GetName()
);
if( selection != -1 )
control->SetSelection( selection );
SetupWindow(control);
if( strings != NULL )
delete [] strings;
strList.Clear(); // dump the strings
return control;
}
else
{
// on the inside now.
// handle <item>Label</item>
// add to the list
strList.Add( GetNodeContent(m_node) );
return NULL;
}
}
bool wxComboBoxXmlHandler::CanHandle(wxXmlNode *node)
{
return (IsOfClass(node, wxT("wxComboBox")) ||
(m_insideBox && node->GetName() == wxT("item"))
);
}
#endif

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