pax_global_header00006660000000000000000000000064123177555360014530gustar00rootroot0000000000000052 comment=03bfddf60057dc3620af5793ced5081389816d2e lua-expat-1.3.0/000077500000000000000000000000001231775553600134315ustar00rootroot00000000000000lua-expat-1.3.0/.hg_archival.txt000066400000000000000000000002241231775553600165150ustar00rootroot00000000000000repo: 24d141cb2d1e66a1bb42b445f049fcc037972f2b node: dacbae98c3e21e9ee14bfe6fd6a920f938d16cc8 branch: default latesttag: 1.3.0 latesttagdistance: 1 lua-expat-1.3.0/.hgtags000066400000000000000000000001361231775553600147070ustar00rootroot0000000000000030c2491fe44a485caf2dd24643052670c91b91e3 1.2.0 1adb0c435b5465ec433e897c67e753fc2775ce14 1.3.0 lua-expat-1.3.0/Makefile000066400000000000000000000015001231775553600150650ustar00rootroot00000000000000CC ?= cc RM ?= rm -rf INSTALL ?= install INSTALL_PROGRAM ?= $(INSTALL) INSTALL_DATA ?= $(INSTALL) -m 644 LUA_V ?= 5.1 LUA_LDIR ?= /usr/share/lua/$(LUA_V) LUA_CDIR ?= /usr/lib/lua/$(LUA_V) T = lxp LIBNAME = $(T).so COMMON_CFLAGS = -g -pedantic -Wall -O2 -fPIC -DPIC -ansi LUA_INC ?= -I/usr/include/lua$(LUA_V) EXPAT_INC ?= -I/usr/include CF = $(LUA_INC) $(EXPAT_INC) $(COMMON_CFLAGS) $(CFLAGS) EXPAT_LIB = -lexpat COMMON_LDFLAGS = -shared LF = $(COMMON_LDFLAGS) $(EXPAT_LIB) $(LDFLAGS) OBJS = src/lxplib.o lib: src/$(LIBNAME) src/$(LIBNAME): export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) $(CF) -o $@ src/$(T)lib.c $(LF) install: $(INSTALL_PROGRAM) -D src/$(LIBNAME) $(DESTDIR)$(LUA_CDIR)/$(LIBNAME) $(INSTALL_PROGRAM) -D src/$T/lom.lua $(DESTDIR)$(LUA_LDIR)/$T/lom.lua clean: $(RM) src/$(LIBNAME) $(OBJS) lua-expat-1.3.0/README000066400000000000000000000036451231775553600143210ustar00rootroot00000000000000LuaExpat (http://www.keplerproject.org/luaexpat/) ------------------------------------------------- Overview LuaExpat is a SAX XML parser based on the Expat library. LuaExpat is free software and uses the same license as Lua 5.1. Status Current version is 1.3.0. It was developed for both Lua 5.1 and Lua 5.2, and has been tested on Linux, Windows (XP) and MacOS X with Expat 2.1.0. Download LuaExpat source can be downloaded from its LuaForge page. If you are using LuaBinaries a Windows binary version of LuaExpat can be found at the LuaForge page. History Version 1.3.0 [04/Apr/2014] * support for the XmlDecl handler * add parser:getcurrentbytecount() (XML_GetCurrentByteCount) * ability to disable CharacterData merging Version 1.2.0 [02/Jun/2011] * support for the StartDoctypeDecl handler * add parser:stop() to abort parsing inside a callback Version 1.1.0 [05/Jun/2006] * adapted to work on both Lua 5.0 and Lua 5.1 * updated to Expat 2.0.0 Version 1.0.2 [23/Mar/2006] * minor bugfix, lom correct module name is lxp.lom Version 1.0.1 [06/Jun/2005] * minor changes for compatibility with Expat version 1.95.8 Version 1.0 [2/Dec/2004] Version 1.0 Beta [4/Apr/2004] Version 1.0 Alpha [10/Dec/2003] References LuaExpat uses the Expat library. For details on the C API please refer to the article "Using Expat". LuaExpat implements the SAX API. Credits Version 1.0 was designed by Roberto Ierusalimschy, André Carregal and Tomás Guisasola as part of the Kepler Project which holds its copyright. The implementation was coded by Roberto Ierusalimschy, based on a previous design by Jay Carlson. LuaExpat development was sponsored by Fábrica Digital and FINEP. Contact For more information please contact us (info at keplerproject dot org). Comments are welcome! You can also reach other Kepler developers and users on the Kepler Project mailing list. lua-expat-1.3.0/doc/000077500000000000000000000000001231775553600141765ustar00rootroot00000000000000lua-expat-1.3.0/doc/us/000077500000000000000000000000001231775553600146255ustar00rootroot00000000000000lua-expat-1.3.0/doc/us/examples.html000066400000000000000000000123201231775553600173270ustar00rootroot00000000000000 LuaExpat: XML Expat parsing for the Lua programming language
LuaExpat
XML Expat parsing for the Lua programming language

Examples

The code excerpt below creates a parser with 2 callbacks and feeds a test string to it. The parsing of the test string triggers the callbacks, printing the results.

require"lxp"

local count = 0
callbacks = {
    StartElement = function (parser, name)
        io.write("+ ", string.rep(" ", count), name, "\n")
        count = count + 1
    end,
    EndElement = function (parser, name)
        count = count - 1
        io.write("- ", string.rep(" ", count), name, "\n")
    end
}

p = lxp.new(callbacks)

for l in io.lines() do  -- iterate lines
    p:parse(l)          -- parses the line
    p:parse("\n")       -- parses the end of line
end
p:parse()               -- finishes the document
p:close()               -- closes the parser

For a test string like

<elem1>
    text
    <elem2/>
    more text
</elem1>

The example would print

+ elem1
    + elem2
    - elem2
- elem1

Note that the text parts are not handled since the corresponding callback (CharacterData) has not been defined. Also note that defining this callback after the call to lxp.new would make no difference. But had the callback table been defined as

callbacks = {
    StartElement = function (parser, name)
        io.write("+ ", string.rep(" ", count), name, "\n")
        count = count + 1
    end,
    EndElement = function (parser, name)
        count = count - 1
        io.write("- ", string.rep(" ", count), name, "\n")
    end,
    CharacterData = function (parser, string)
        io.write("* ", string.rep(" ", count), string, "\n")
    end
}

The results would have been

+ elem1
* text
    + elem2
    - elem2
* more text
- elem1

Another example would be the use of false as a placeholder for the callback. Suppose that we would like to print only the text associated with elem2 elements and that the XML sample is

 <elem1>
    text
    <elem2>
        inside text
    </elem2>
    more text
</elem1>

We could define the new callback table as

callbacks = {
    StartElement = function (parser, name)
      if name == "elem2" then
        -- redefines CharacterData behaviour
        callbacks.CharacterData = function (parser, string)
          io.write(string, "\n")
        end
      end
    end,

    EndElement = function (parser, name)
      if name == "elem2" then
        callbacks.CharacterData = false -- restores placeholder
      end
    end,

    CharacterData = false               -- placeholder
}

The results would have been

inside text

Note that this example assumes no other elements are present inside elem2 tags.

Valid XHTML 1.0!

$Id: examples.html,v 1.5 2006/03/23 00:19:37 carregal Exp $

lua-expat-1.3.0/doc/us/index.html000066400000000000000000000131351231775553600166250ustar00rootroot00000000000000 LuaExpat: XML Expat parsing for the Lua programming language
LuaExpat
XML Expat parsing for the Lua programming language

Overview

LuaExpat is a SAX XML parser based on the Expat library.

LuaExpat is free software and uses the same license as Lua 5.1.

Status

Current version is 1.3.0. It was developed for both Lua 5.1 and Lua 5.2, and has been tested on Linux, Windows (XP) and MacOS X with Expat 2.1.0.

Download

LuaExpat source can be downloaded from its LuaForge page. If you are using LuaBinaries a Windows binary version of LuaExpat can be found at the LuaForge page.

History

Version 1.3.0 [02/Apr/2014]
  • support for the XmlDecl handler
  • add parser:getcurrentbytecount() (XML_GetCurrentByteCount)
  • ability to disable CharacterData merging
Version 1.2.0 [02/Jun/2011]
  • support for the StartDoctypeDecl handler
  • add parser:stop() to abort parsing inside a callback
Version 1.1.0 [05/Jun/2007]
  • adapted to work on both Lua 5.0 and Lua 5.1
  • updated to use Expat 2.0.0
Version 1.0.2 [23/Mar/2006]
  • minor bugfix, lom correct module name is lxp.lom
Version 1.0.1 [06/Jun/2005]
  • minor changes for compatibility with Expat version 1.95.8
Version 1.0 [2/Dec/2004]
Version 1.0 Beta [4/Apr/2004]
Version 1.0 Alpha [10/Dec/2003]

References

LuaExpat uses the Expat library. For details on the C API please refer to the article "Using Expat".

LuaExpat implements the SAX API.

Credits

Version 1.0 was designed by Roberto Ierusalimschy, André Carregal and Tomás Guisasola as part of the Kepler Project which holds its copyright. The implementation was coded by Roberto Ierusalimschy, based on a previous design by Jay Carlson.

LuaExpat development was sponsored by Fábrica Digital and FINEP.

Contact

For more information please contact us. Comments are welcome!

You can also reach other Kepler developers and users on the Kepler Project mailing list.

Valid XHTML 1.0!

lua-expat-1.3.0/doc/us/license.html000066400000000000000000000106031231775553600171350ustar00rootroot00000000000000 LuaExpat: XML Expat parsing for the Lua programming language
LuaExpat
XML Expat parsing for the Lua programming language

License

LuaExpat is free software: it can be used for both academic and commercial purposes at absolutely no cost. There are no royalties or GNU-like "copyleft" restrictions. LuaExpat qualifies as Open Source software. Its licenses are compatible with GPL. LuaExpat is not in the public domain and the Kepler Project keep its copyright. The legal details are below.

The spirit of the license is that you are free to use LuaExpat for any purpose at no cost without having to ask us. The only requirement is that if you do use LuaExpat, then you should give us credit by including the appropriate copyright notice somewhere in your product or its documentation.

The LuaExpat library is designed and implemented by Roberto Ierusalimschy. The implementation is not derived from licensed software.


Copyright © 2003-2007 The Kepler Project.

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.

Valid XHTML 1.0!

$Id: license.html,v 1.9 2007/06/05 20:03:12 carregal Exp $

lua-expat-1.3.0/doc/us/lom.html000066400000000000000000000120501231775553600163000ustar00rootroot00000000000000 LuaExpat: XML Expat parsing for the Lua programming language
LuaExpat
XML Expat parsing for the Lua programming language

Introduction

Lua Object Model (LOM) is a representation of XML elements through Lua data types. Currently it is not supposed to be 100% complete, but simple.

LuaExpat's distribution provides an implementation of LOM that gets an XML documenta (a string) and transforms it to a Lua table. The only function exported is lxp.lom.parse.

Characteristics

The model represents each XML element as a Lua table. A LOM table has three special characteristics:

  • a special field called tag that holds the element's name;
  • an optional field called attr that stores the element's attributes (see attribute's section); and
  • the element's children are stored at the array-part of the table. A child could be an ordinary string or another XML element that will be represented by a Lua table following these same rules.

Attributes

The special field attr is a Lua table that stores the XML element's attributes as pairs <key>=<value>. To assure an order (if necessary), the sequence of keys could be placed at the array-part of this same table.

Examples

For a simple string like

    s = [[<abc a1="A1" a2="A2">inside tag `abc'</abc>]]

A call like

    tab = lxp.lom.parse (s))

Would result in a table equivalent to

tab = {
        ["attr"] = {
                [1] = "a1",
                [2] = "a2",
                ["a2"] = "A2",
                ["a1"] = "A1",
        },
        [1] = "inside tag `abc'",
        ["tag"] = "abc",
}

Now an example with an element nested inside another element

tab = lxp.lom.parse(
[[<qwerty q1="q1" q2="q2">
    <asdf>some text</asdf>
</qwerty>]]
)

The result would have been a table equivalent to

tab = {
        [1] = "\
        ",
        [2] = {
                ["attr"] = {
                },
                [1] = "some text",
                ["tag"] = "asdf",
        },
        ["attr"] = {
                [1] = "q1",
                [2] = "q2",
                ["q2"] = "q2",
                ["q1"] = "q1",
        },
        [3] = "\
",
        ["tag"] = "qwerty",
}

Note that even the new-line and tab characters are stored on the table.

Valid XHTML 1.0!

$Id: lom.html,v 1.6 2006/03/20 22:26:00 carregal Exp $

lua-expat-1.3.0/doc/us/luaexpat.png000066400000000000000000000173571231775553600171730ustar00rootroot00000000000000PNG  IHDRL\nIDATxyXSWMHš-v ,"`Ej(X[|mgu(Vi (eDD&aߗ@ȞPHro}=s=!~C`u~SMz7U`ppPߩZZZΟ?_Ѕ{]@ $ ϗJNVs'kmm%H>>>8533c08:4jΜVAeee'fffnnn6mDW\ٻwN;abb 777SSSݻd겳% @7o䵖>0AX,q fӦMw B$d2Ͷ%xOD+++bg(Rlx?2"` cQп*+++**|իB͛7駽{oذahh`|<blmmq8 #2'))IiYY/33!YD7}bc Pup RԔ> +VxEnnߢE/^hkkAбcbcc,X0~` W0ccc4 ǫlTv\_iqتxOrfK722R bggi%QQQAAA111#@$|>_٧AEC&;::_b=<<֮],a'lɺ 1$Y{:gdSrMMM'OljjdXWd2,)__=z+++. A+zLV^^ՕADzɭ[JբE{o?8..m H_Nzzu\q03RRÇKJJ.] ߄F&966FPGϯp\CCCCBBrrr:;;B!Bٽ{ӧOq8AD"Q?oa0*:ޘ]{qHvlݚYmZn*Azzzҥ jjju떥 F( ;A999&&&၁X,ٳgw511x Y`V;i Ywu~V&\P$iGaOOϵk\\\~my>D"H +***//_bw^^^\\lA777Ayi;z6`tTx?H%ǧfwx<իW&˔ŋ۷ӳR"hKKKH?`V\ rrVXR LPuّ;wLn FFF(::z֭d2׷I$iѣ>_}<\&34r/\pggd**0::*\ŔwА=_WQUV*JMLLݻw׭[7g2n >D222:x\\zzzD5#݌`Jʺ7҇ oe'x|D `h54YZ[Y;;i4 uPD ҁneIIڵkL|||ZZO?k.p6oᡮP^w2]O QHQ. s w" 5ȝE06V0'qG\aLLrS[;Bѣ8rvv(.T"[W+,$SǏ>|rJy%AEBFFqqKK{+VXTByy[--O@TS3qWcAkk""|h42 &K ֯_oooqttT &&W2X0*~wHF13Kvl銺hLLLܹsd8p@@ TT1sE7}"Si 23?`BBWY?RK4l!X,vƍ CJ;d_Z;Gbx :ӫOLq#IEgf2###hj!A@7omTTȑǩezؘn_ ex<b ;&rH&hh"y󦭭U(UD"HTMK\KKKo+ԥD mV-\&lmmϟ_PP !*U@yyyjjjiiUڶ6ݞoq`< ^Ao[dɯ!ر#GMzĐJ@?^\\< (SA))wg@ sܶ_q8SqS lΝR~~~#Fb=y򤮮-^xɒ%O"Yӌe$]}{ju+X,600@lQ Fuu5  v획MBBccBo{{Q֙ٙҲeE99oqmMkk&sfJy||~'N * =Jիݴ>VSWRYXWIU{011QVVswO|B{ΝKxD)7 }$j&&&&QQQʤc J''F%Hyk׮ul~BqjuvP6qB rȨ[Y+ N`;lٰf2tDUT]]J: qQA&BVP(hvr Y %uu,eO{{_#<==GGGw xq4W$d CYs ,ݡCY) +J"R$ MMnpZuw|60Q@xK5=g*欱ՠ:̫WǏŧDA4 P^ckuK)A塱2 ...hJ@_$'nk#G?xjS NuV33z@wp8ի/% (-9u/U;#əAnMMmlWgᐐs "Kǂ;;Q": VVVݻZT$I$} :*gO @TX'OV###FͨZKKcG̎Hde?X Y[`0 Abqʕ49 ̢P\\fkk:XG0ė.\TH05bm7B*J1 2=jƫWW#>9::*4QKRT!ON?yU)@&IR4t7hST)@,CFB\j1kh}U 7nDc_7Giffx [4r׮]Xjq8/pՕ|S,uz/lޙ3mXjfF`@ ֲm>VZG}>;nxlssH  X kh`+T@JJc~eLdѲeN˖9ɷ^L}'Y}3A88e2xb5btƥK alD Nw#GV患RyLo4~}侩 ѷj+B$''ϟvp9v8ڜ=|3GUUfY OU[o}M i۶-D?lGs|K>OPp]]]ϟ?54DQN+H$ѣ+_/"(җd@ˑիWx|bb"$Bt\՞=w7`N@*^2 J%K78 pdÜ{;ogg-|OV>{NElp!lQd$-6mZO.Œʕ+^^^VIif6Jpi4.D1_}}}~~虩Fx:A,r!/=EFFd a27oޤR۶mCm HBAW^ۿj6!zіf455={7ވy /]ӳlٲf}wj,UA2D"1!!a>1 B*0K?#Yxg~~}f?|pxxx:llFQ )..Rγ0=WUUU[Ք'Zb\:;;ۭ-ZDӕJ<DcB!jg2sbb*++>#]4===MOgN(F*NC뫫stttpprNi2o߮p>>>M9)477?|bIR=yH$b fze-JGGGGGG\0L2i GD". y;wp8,o>pN> LbC:{֘%@5cccB>{ҥ H8H444{ U5j7o 3/BUx LuaExpat: XML Expat parsing for the Lua programming language
LuaExpat
XML Expat parsing for the Lua programming language

Introduction

LuaExpat is a SAX XML parser based on the Expat library. SAX is the Simple API for XML and allows programs to:

  • process a XML document incrementally, thus being able to handle huge documents without memory penalties;
  • register handler functions which are called by the parser during the processing of the document, handling the document elements or text.

With an event-based API like SAX the XML document can be fed to the parser in chunks, and the parsing begins as soon as the parser receives the first document chunk. LuaExpat reports parsing events (such as the start and end of elements) directly to the application through callbacks. The parsing of huge documents can benefit from this piecemeal operation.

LuaExpat is distributed as a library and a file lom.lua that implements the Lua Object Model.

Building

LuaExpat could be built to Lua 5.1 or to Lua 5.2. In both cases, the language library and headers files for the desired version must be installed properly. LuaExpat also depends on Expat 2.0.0+ which should also be installed.

LuaExpat offers a Makefile and a separate configuration file, config, which should be edited to suit the particularities of the target platform before running make. The file has some definitions like paths to the external libraries, compiler options and the like. One important definition is the version of Lua language, which is not obtained from the installed software.

Installation

The compiled binary file should be copied to a directory in your C path. Lua 5.0 users should also install Compat-5.1.

Windows users can use the binary version of LuaExpat (lxp.dll, compatible with LuaBinaries) available at LuaForge.

The file lom.lua should be copied to a directory in your Lua path.

Parser objects

Usually SAX implementations base all operations on the concept of a parser that allows the registration of callback functions. LuaExpat offers the same functionality but uses a different registration method, based on a table of callbacks. This table contains references to the callback functions which are responsible for the handling of the document parts. The parser will assume no behaviour for any undeclared callbacks.

Constructor

lxp.new(callbacks [, separator[, merge_character_data]])
The parser is created by a call to the function lxp.new, which returns the created parser or raises a Lua error. It receives the callbacks table and optionally the parser separator character used in the namespace expanded element names. If merge_character_data is false then LuaExpat will not combine multiple CharacterData calls into one. For more info on this behaviour see CharacterData below.

Methods

parser:close()
Closes the parser, freeing all memory used by it. A call to parser:close() without a previous call to parser:parse() could result in an error.
parser:getbase()
Returns the base for resolving relative URIs.
parser:getcallbacks()
Returns the callbacks table.
parser:parse(s)
Parse some more of the document. The string s contains part (or perhaps all) of the document. When called without arguments the document is closed (but the parser still has to be closed).
The function returns a non nil value when the parser has been succesfull, and when the parser finds an error it returns five results: nil, msg, line, col, and pos, which are the error message, the line number, column number and absolute position of the error in the XML document.
parser:pos()
Returns three results: the current parsing line, column, and absolute position.
parser:getcurrentbytecount()
Return the number of bytes of input corresponding to the current event. This function can only be called inside a handler, in other contexts it will return 0. Do not use inside a CharacterData handler unless CharacterData merging has been disabled (see lxp.new).
parser:setbase(base)
Sets the base to be used for resolving relative URIs in system identifiers.
parser:setencoding(encoding)
Set the encoding to be used by the parser. There are four built-in encodings, passed as strings: "US-ASCII", "UTF-8", "UTF-16", and "ISO-8859-1".
parser:stop()
Abort the parser and prevent it from parsing any further through the data it was last passed. Use to halt parsing the document when an error is discovered inside a callback, for example. The parser object cannot accept more data after this call.

Callbacks

The Lua callbacks define the handlers of the parser events. The use of a table in the parser constructor has some advantages over the registration of callbacks, since there is no need for for the API to provide a way to manipulate callbacks.

Another difference lies in the behaviour of the callbacks during the parsing itself. The callback table contains references to the functions that can be redefined at will. The only restriction is that only the callbacks present in the table at creation time will be called.

The callbacks table indices are named after the equivalent Expat callbacks:
CharacterData, Comment, Default, DefaultExpand, EndCDataSection, EndElement, EndNamespaceDecl, ExternalEntityRef, NotStandalone, NotationDecl, ProcessingInstruction, StartCDataSection, StartElement, StartNamespaceDecl, UnparsedEntityDecl, XmlDecl and StartDoctypeDecl.

These indices can be references to functions with specific signatures, as seen below. The parser constructor also checks the presence of a field called _nonstrict in the callbacks table. If _nonstrict is absent, only valid callback names are accepted as indices in the table (Defaultexpanded would be considered an error for example). If _nonstrict is defined, any other fieldnames can be used (even if not called at all).

The callbacks can optionally be defined as false, acting thus as placeholders for future assignment of functions.

Every callback function receives as the first parameter the calling parser itself, thus allowing the same functions to be used for more than one parser for example.

callbacks.CharacterData = function(parser, string)
Called when the parser recognizes an XML CDATA string. Note that LuaExpat automatically combines multiple CharacterData events from Expat into a single call to this handler, unless merge_character_data is set to false when calling lxp.new().
callbacks.Comment = function(parser, string)
Called when the parser recognizes an XML comment string.
callbacks.Default = function(parser, string)
Called when the parser has a string corresponding to any characters in the document which wouldn't otherwise be handled. Using this handler has the side effect of turning off expansion of references to internally defined general entities. Instead these references are passed to the default handler.
callbacks.DefaultExpand = function(parser, string)
Called when the parser has a string corresponding to any characters in the document which wouldn't otherwise be handled. Using this handler doesn't affect expansion of internal entity references.
callbacks.EndCdataSection = function(parser)
Called when the parser detects the end of a CDATA section.
callbacks.EndElement = function(parser, elementName)
Called when the parser detects the ending of an XML element with elementName.
callbacks.EndNamespaceDecl = function(parser, namespaceName)
Called when the parser detects the ending of an XML namespace with namespaceName. The handling of the end namespace is done after the handling of the end tag for the element the namespace is associated with.
callbacks.ExternalEntityRef = function(parser, subparser, base, systemId, publicId)
Called when the parser detects an external entity reference.

The subparser is a LuaExpat parser created with the same callbacks and Expat context as the parser and should be used to parse the external entity.
The base parameter is the base to use for relative system identifiers. It is set by parser:setbase and may be nil.
The systemId parameter is the system identifier specified in the entity declaration and is never nil.
The publicId parameter is the public id given in the entity declaration and may be nil.
callbacks.NotStandalone = function(parser)
Called when the parser detects that the document is not "standalone". This happens when there is an external subset or a reference to a parameter entity, but the document does not have standalone set to "yes" in an XML declaration.
callbacks.NotationDecl = function(parser, notationName, base, systemId, publicId)
Called when the parser detects XML notation declarations with notationName
The base parameter is the base to use for relative system identifiers. It is set by parser:setbase and may be nil.
The systemId parameter is the system identifier specified in the entity declaration and is never nil.
The publicId parameter is the public id given in the entity declaration and may be nil.
callbacks.ProcessingInstruction = function(parser, target, data)
Called when the parser detects XML processing instructions. The target is the first word in the processing instruction. The data is the rest of the characters in it after skipping all whitespace after the initial word.
callbacks.StartCdataSection = function(parser)
Called when the parser detects the begining of an XML CDATA section.
callbacks.XmlDecl = function(parser, version, encoding)
Called when the parser encounters an XML document declaration (these are optional, and valid only at the start of the document). The callback receives the declared XML version and document encoding.
callbacks.StartElement = function(parser, elementName, attributes)
Called when the parser detects the begining of an XML element with elementName.
The attributes parameter is a Lua table with all the element attribute names and values. The table contains an entry for every attribute in the element start tag and entries for the default attributes for that element.
The attributes are listed by name (including the inherited ones) and by position (inherited attributes are not considered in the position list).
As an example if the book element has attributes author, title and an optional format attribute (with "printed" as default value),
<book author="Ierusalimschy, Roberto" title="Programming in Lua">
would be represented as
{[1] = "Ierusalimschy, Roberto",
 [2] = "Programming in Lua",
 author = "Ierusalimschy, Roberto",
 format = "printed",
 title = "Programming in Lua"}
callbacks.StartNamespaceDecl = function(parser, namespaceName)
Called when the parser detects an XML namespace declaration with namespaceName. Namespace declarations occur inside start tags, but the StartNamespaceDecl handler is called before the StartElement handler for each namespace declared in that start tag.
callbacks.UnparsedEntityDecl = function(parser, entityName, base, systemId, publicId, notationName)
Called when the parser receives declarations of unparsed entities. These are entity declarations that have a notation (NDATA) field.
As an example, in the chunk
<!ENTITY logo SYSTEM "images/logo.gif" NDATA gif>
entityName would be "logo", systemId would be "images/logo.gif" and notationName would be "gif". For this example the publicId parameter would be nil. The base parameter would be whatever has been set with parser:setbase. If not set, it would be nil.
callbacks.StartDoctypeDecl = function(parser, name, sysid, pubid, has_internal_subset)
Called when the parser detects the beginning of an XML DTD (DOCTYPE) section. These precede the XML root element and take the form:
<!DOCTYPE root_elem PUBLIC "example">

The separator character

The optional separator character in the parser constructor defines the character used in the namespace expanded element names. The separator character is optional (if not defined the parser will not handle namespaces) but if defined it must be different from the character '\0'.

lua-expat-1.3.0/makefile.win000066400000000000000000000013121231775553600157220ustar00rootroot00000000000000LUA_INC=c:\lua5.1\include LUA_DIR=c:\lua5.1\lua LUA_LIBDIR=c:\lua5.1 LUA_LIB=c:\lua5.1\lua5.1.lib OBJS= src\lxplib.obj EXPAT_INCLUDE=C:\Expat-2.0.0\Source\lib EXPAT_LIB=C:\Expat-2.0.0\Libs\libexpat.lib .c.obj: cl /c /Fo$@ /O2 /I$(LUA_INC) /I$(EXPAT_INCLUDE) /D_CRT_SECURE_NO_DEPRECATE $< src\lxp.dll: $(OBJS) link /dll /def:src\lxp.def /out:$@ $(OBJS) $(EXPAT_LIB) $(LUA_LIB) install: src\lxp.dll IF NOT EXIST $(LUA_LIBDIR) mkdir $(LUA_LIBDIR) copy src\lxp.dll $(LUA_LIBDIR) IF NOT EXIST $(LUA_DIR)\lxp mkdir $(LUA_DIR)\lxp copy src\lxp\lom.lua $(LUA_DIR)\lxp clean: del src\lxp.dll del src\*.obj del src\lxp.exp del src\lxp.lib # $Id: makefile.win,v 1.3 2007/06/05 20:03:12 carregal Exp $ lua-expat-1.3.0/src/000077500000000000000000000000001231775553600142205ustar00rootroot00000000000000lua-expat-1.3.0/src/lxp.def000066400000000000000000000000241231775553600154770ustar00rootroot00000000000000EXPORTS luaopen_lxplua-expat-1.3.0/src/lxp/000077500000000000000000000000001231775553600150235ustar00rootroot00000000000000lua-expat-1.3.0/src/lxp/lom.lua000066400000000000000000000026161231775553600163220ustar00rootroot00000000000000-- See Copyright Notice in license.html -- $Id: lom.lua,v 1.6 2005/06/09 19:18:40 tuler Exp $ local lxp = require "lxp" local tinsert, tremove = table.insert, table.remove local assert, type, print = assert, type, print local function starttag (p, tag, attr) local stack = p:getcallbacks().stack local newelement = {tag = tag, attr = attr} tinsert(stack, newelement) end local function endtag (p, tag) local stack = p:getcallbacks().stack local element = tremove(stack) assert(element.tag == tag) local level = #stack tinsert(stack[level], element) end local function text (p, txt) local stack = p:getcallbacks().stack local element = stack[#stack] local n = #element if type(element[n]) == "string" then element[n] = element[n] .. txt else tinsert(element, txt) end end local function parse (o) local c = { StartElement = starttag, EndElement = endtag, CharacterData = text, _nonstrict = true, stack = {{}} } local p = lxp.new(c) local status, err if type(o) == "string" then status, err = p:parse(o) if not status then return nil, err end else for l in pairs(o) do status, err = p:parse(l) if not status then return nil, err end end end status, err = p:parse() if not status then return nil, err end p:close() return c.stack[1][1] end return { parse = parse } lua-expat-1.3.0/src/lxplib.c000066400000000000000000000436311231775553600156650ustar00rootroot00000000000000/* ** $Id: lxplib.c,v 1.16 2007/06/05 20:03:12 carregal Exp $ ** LuaExpat: Lua bind for Expat library ** See Copyright Notice in license.html */ #include #include #include #include "expat.h" #include "lua.h" #include "lauxlib.h" #include "lxplib.h" #if !defined(lua_pushliteral) #define lua_pushliteral(L, s) \ lua_pushstring(L, "" s, (sizeof(s)/sizeof(char))-1) #endif enum XPState { XPSpre, /* parser just initialized */ XPSok, /* state while parsing */ XPSfinished, /* state after finished parsing */ XPSerror, XPSstring /* state while reading a string */ }; struct lxp_userdata { lua_State *L; XML_Parser parser; /* associated expat parser */ int tableref; /* table with callbacks for this parser */ enum XPState state; luaL_Buffer *b; /* to concatenate sequences of cdata pieces */ int bufferCharData; /* whether to buffer cdata pieces */ }; typedef struct lxp_userdata lxp_userdata; static int reporterror (lxp_userdata *xpu) { lua_State *L = xpu->L; XML_Parser p = xpu->parser; lua_pushnil(L); lua_pushstring(L, XML_ErrorString(XML_GetErrorCode(p))); lua_pushnumber(L, XML_GetCurrentLineNumber(p)); lua_pushnumber(L, XML_GetCurrentColumnNumber(p) + 1); lua_pushnumber(L, XML_GetCurrentByteIndex(p) + 1); return 5; } static lxp_userdata *createlxp (lua_State *L) { lxp_userdata *xpu = (lxp_userdata *)lua_newuserdata(L, sizeof(lxp_userdata)); xpu->tableref = LUA_REFNIL; /* in case of errors... */ xpu->parser = NULL; xpu->L = NULL; xpu->state = XPSpre; luaL_getmetatable(L, ParserType); lua_setmetatable(L, -2); return xpu; } static void lxpclose (lua_State *L, lxp_userdata *xpu) { luaL_unref(L, LUA_REGISTRYINDEX, xpu->tableref); xpu->tableref = LUA_REFNIL; if (xpu->parser) XML_ParserFree(xpu->parser); xpu->parser = NULL; } /* ** Auxiliary function to call a Lua handle */ static void docall (lxp_userdata *xpu, int nargs, int nres) { lua_State *L = xpu->L; assert(xpu->state == XPSok); if (lua_pcall(L, nargs + 1, nres, 0) != 0) { xpu->state = XPSerror; luaL_unref(L, LUA_REGISTRYINDEX, xpu->tableref); xpu->tableref = luaL_ref(L, LUA_REGISTRYINDEX); /* error message */ } } /* ** Check whether there is pending Cdata, and call its handle if necessary */ static void dischargestring (lxp_userdata *xpu) { assert(xpu->state == XPSstring); xpu->state = XPSok; luaL_pushresult(xpu->b); docall(xpu, 1, 0); } /* ** Check whether there is a Lua handle for a given event: If so, ** put it on the stack (to be called later), and also push `self' */ static int getHandle (lxp_userdata *xpu, const char *handle) { lua_State *L = xpu->L; if (xpu->state == XPSstring) dischargestring(xpu); if (xpu->state == XPSerror) return 0; /* some error happened before; skip all handles */ lua_pushstring(L, handle); lua_gettable(L, 3); if (lua_toboolean(L, -1) == 0) { lua_pop(L, 1); return 0; } if (!lua_isfunction(L, -1)) { luaL_error(L, "lxp `%s' callback is not a function", handle); } lua_pushvalue(L, 1); /* first argument in every call (self) */ return 1; } /* ** {====================================================== ** Handles ** ======================================================= */ static void f_StartCdata (void *ud) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, StartCdataKey) == 0) return; /* no handle */ docall(xpu, 0, 0); } static void f_EndCdataKey (void *ud) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, EndCdataKey) == 0) return; /* no handle */ docall(xpu, 0, 0); } static void f_CharData (void *ud, const char *s, int len) { lxp_userdata *xpu = (lxp_userdata *)ud; if (xpu->state == XPSok) { if (getHandle(xpu, CharDataKey) == 0) return; /* no handle */ if(xpu->bufferCharData != 0) { xpu->state = XPSstring; luaL_buffinit(xpu->L, xpu->b); } else { lua_pushlstring(xpu->L, s, len); docall(xpu, 1, 0); } } if (xpu->state == XPSstring) luaL_addlstring(xpu->b, s, len); } static void f_Comment (void *ud, const char *data) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, CommentKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, data); docall(xpu, 1, 0); } static void f_Default (void *ud, const char *data, int len) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, DefaultKey) == 0) return; /* no handle */ lua_pushlstring(xpu->L, data, len); docall(xpu, 1, 0); } static void f_DefaultExpand (void *ud, const char *data, int len) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, DefaultExpandKey) == 0) return; /* no handle */ lua_pushlstring(xpu->L, data, len); docall(xpu, 1, 0); } static void f_StartElement (void *ud, const char *name, const char **attrs) { lxp_userdata *xpu = (lxp_userdata *)ud; lua_State *L = xpu->L; int lastspec = XML_GetSpecifiedAttributeCount(xpu->parser) / 2; int i = 1; if (getHandle(xpu, StartElementKey) == 0) return; /* no handle */ lua_pushstring(L, name); lua_newtable(L); while (*attrs) { if (i <= lastspec) { lua_pushnumber(L, i++); lua_pushstring(L, *attrs); lua_settable(L, -3); } lua_pushstring(L, *attrs++); lua_pushstring(L, *attrs++); lua_settable(L, -3); } docall(xpu, 2, 0); /* call function with self, name, and attributes */ } static void f_EndElement (void *ud, const char *name) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, EndElementKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, name); docall(xpu, 1, 0); } static int f_ExternaEntity (XML_Parser p, const char *context, const char *base, const char *systemId, const char *publicId) { lxp_userdata *xpu = (lxp_userdata *)XML_GetUserData(p); lua_State *L = xpu->L; lxp_userdata *child; int status; if (getHandle(xpu, ExternalEntityKey) == 0) return 1; /* no handle */ child = createlxp(L); child->parser = XML_ExternalEntityParserCreate(p, context, NULL); if (!child->parser) luaL_error(L, "XML_ParserCreate failed"); lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref); */ /* child uses the same table of its father */ child->tableref = luaL_ref(L, LUA_REGISTRYINDEX); lua_pushstring(L, base); lua_pushstring(L, systemId); lua_pushstring(L, publicId); docall(xpu, 4, 1); status = lua_toboolean(L, -1); lua_pop(L, 1); lxpclose(L, child); return status; } static void f_StartNamespaceDecl (void *ud, const char *prefix, const char *uri) { lxp_userdata *xpu = (lxp_userdata *)ud; lua_State *L = xpu->L; if (getHandle(xpu, StartNamespaceDeclKey) == 0) return; /* no handle */ lua_pushstring(L, prefix); lua_pushstring(L, uri); docall(xpu, 2, 0); } static void f_EndNamespaceDecl (void *ud, const char *prefix) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, EndNamespaceDeclKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, prefix); docall(xpu, 1, 0); } static void f_NotationDecl (void *ud, const char *notationName, const char *base, const char *systemId, const char *publicId) { lxp_userdata *xpu = (lxp_userdata *)ud; lua_State *L = xpu->L; if (getHandle(xpu, NotationDeclKey) == 0) return; /* no handle */ lua_pushstring(L, notationName); lua_pushstring(L, base); lua_pushstring(L, systemId); lua_pushstring(L, publicId); docall(xpu, 4, 0); } static int f_NotStandalone (void *ud) { int status; lxp_userdata *xpu = (lxp_userdata *)ud; lua_State *L = xpu->L; if (getHandle(xpu, NotStandaloneKey) == 0) return 1; /* no handle */ docall(xpu, 0, 1); status = lua_toboolean(L, -1); lua_pop(L, 1); return status; } static void f_ProcessingInstruction (void *ud, const char *target, const char *data) { lxp_userdata *xpu = (lxp_userdata *)ud; lua_State *L = xpu->L; if (getHandle(xpu, ProcessingInstructionKey) == 0) return; /* no handle */ lua_pushstring(L, target); lua_pushstring(L, data); docall(xpu, 2, 0); } static void f_UnparsedEntityDecl (void *ud, const char *entityName, const char *base, const char *systemId, const char *publicId, const char *notationName) { lxp_userdata *xpu = (lxp_userdata *)ud; lua_State *L = xpu->L; if (getHandle(xpu, UnparsedEntityDeclKey) == 0) return; /* no handle */ lua_pushstring(L, entityName); lua_pushstring(L, base); lua_pushstring(L, systemId); lua_pushstring(L, publicId); lua_pushstring(L, notationName); docall(xpu, 5, 0); } static void f_StartDoctypeDecl (void *ud, const XML_Char *doctypeName, const XML_Char *sysid, const XML_Char *pubid, int has_internal_subset) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, StartDoctypeDeclKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, doctypeName); lua_pushstring(xpu->L, sysid); lua_pushstring(xpu->L, pubid); lua_pushboolean(xpu->L, has_internal_subset); docall(xpu, 4, 0); } static void f_XmlDecl (void *ud, const XML_Char *version, const XML_Char *encoding, int standalone) { lxp_userdata *xpu = (lxp_userdata *)ud; if (getHandle(xpu, XmlDeclKey) == 0) return; /* no handle */ lua_pushstring(xpu->L, version); lua_pushstring(xpu->L, encoding); lua_pushboolean(xpu->L, standalone); docall(xpu, 3, 0); } /* }====================================================== */ static int hasfield (lua_State *L, const char *fname) { int res; lua_pushstring(L, fname); lua_gettable(L, 1); res = !lua_isnil(L, -1); lua_pop(L, 1); return res; } static void checkcallbacks (lua_State *L) { static const char *const validkeys[] = { "StartCdataSection", "EndCdataSection", "CharacterData", "Comment", "Default", "DefaultExpand", "StartElement", "EndElement", "ExternalEntityRef", "StartNamespaceDecl", "EndNamespaceDecl", "NotationDecl", "NotStandalone", "ProcessingInstruction", "UnparsedEntityDecl", "StartDoctypeDecl", "XmlDecl", NULL}; if (hasfield(L, "_nonstrict")) return; lua_pushnil(L); while (lua_next(L, 1)) { lua_pop(L, 1); /* remove value */ #if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501 if (lua_type(L, -1) != LUA_TSTRING || luaL_findstring(lua_tostring(L, -1), validkeys) < 0) luaL_error(L, "invalid key `%s' in callback table", lua_tostring(L, -1)); #else luaL_checkoption(L, -1, NULL, validkeys); #endif } } static int lxp_make_parser (lua_State *L) { XML_Parser p; int bufferCharData = (lua_type(L, 3) != LUA_TBOOLEAN) || (lua_toboolean(L, 3) != 0); char sep = *luaL_optstring(L, 2, ""); lxp_userdata *xpu = createlxp(L); xpu->bufferCharData = bufferCharData; p = xpu->parser = (sep == '\0') ? XML_ParserCreate(NULL) : XML_ParserCreateNS(NULL, sep); if (!p) luaL_error(L, "XML_ParserCreate failed"); luaL_checktype(L, 1, LUA_TTABLE); checkcallbacks(L); lua_pushvalue(L, 1); xpu->tableref = luaL_ref(L, LUA_REGISTRYINDEX); XML_SetUserData(p, xpu); if (hasfield(L, StartCdataKey) || hasfield(L, EndCdataKey)) XML_SetCdataSectionHandler(p, f_StartCdata, f_EndCdataKey); if (hasfield(L, CharDataKey)) XML_SetCharacterDataHandler(p, f_CharData); if (hasfield(L, CommentKey)) XML_SetCommentHandler(p, f_Comment); if (hasfield(L, DefaultKey)) XML_SetDefaultHandler(p, f_Default); if (hasfield(L, DefaultExpandKey)) XML_SetDefaultHandlerExpand(p, f_DefaultExpand); if (hasfield(L, StartElementKey) || hasfield(L, EndElementKey)) XML_SetElementHandler(p, f_StartElement, f_EndElement); if (hasfield(L, ExternalEntityKey)) XML_SetExternalEntityRefHandler(p, f_ExternaEntity); if (hasfield(L, StartNamespaceDeclKey) || hasfield(L, EndNamespaceDeclKey)) XML_SetNamespaceDeclHandler(p, f_StartNamespaceDecl, f_EndNamespaceDecl); if (hasfield(L, NotationDeclKey)) XML_SetNotationDeclHandler(p, f_NotationDecl); if (hasfield(L, NotStandaloneKey)) XML_SetNotStandaloneHandler(p, f_NotStandalone); if (hasfield(L, ProcessingInstructionKey)) XML_SetProcessingInstructionHandler(p, f_ProcessingInstruction); if (hasfield(L, UnparsedEntityDeclKey)) XML_SetUnparsedEntityDeclHandler(p, f_UnparsedEntityDecl); if (hasfield(L, StartDoctypeDeclKey)) XML_SetStartDoctypeDeclHandler(p, f_StartDoctypeDecl); if (hasfield(L, XmlDeclKey)) XML_SetXmlDeclHandler(p, f_XmlDecl); return 1; } static lxp_userdata *checkparser (lua_State *L, int idx) { lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, idx, ParserType); luaL_argcheck(L, xpu, idx, "expat parser expected"); luaL_argcheck(L, xpu->parser, idx, "parser is closed"); return xpu; } static int parser_gc (lua_State *L) { lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, 1, ParserType); luaL_argcheck(L, xpu, 1, "expat parser expected"); lxpclose(L, xpu); return 0; } static int setbase (lua_State *L) { lxp_userdata *xpu = checkparser(L, 1); if (XML_SetBase(xpu->parser, luaL_checkstring(L, 2)) == 0) luaL_error(L, "no memory to store base"); return 0; } static int getbase (lua_State *L) { lxp_userdata *xpu = checkparser(L, 1); lua_pushstring(L, XML_GetBase(xpu->parser)); return 1; } static int getcallbacks (lua_State *L) { lxp_userdata *xpu = checkparser(L, 1); lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); return 1; } static int parse_aux (lua_State *L, lxp_userdata *xpu, const char *s, size_t len) { luaL_Buffer b; int status; xpu->L = L; xpu->state = XPSok; xpu->b = &b; lua_settop(L, 2); lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /*lua_getref(L, xpu->tableref);*/ /* to be used by handlers */ status = XML_Parse(xpu->parser, s, (int)len, s == NULL); if (xpu->state == XPSstring) dischargestring(xpu); if (xpu->state == XPSerror) { /* callback error? */ lua_rawgeti(L, LUA_REGISTRYINDEX, xpu->tableref); /* get original msg. */ lua_error(L); } if (s == NULL) xpu->state = XPSfinished; if (status) { lua_pushboolean(L, 1); return 1; } else { /* error */ return reporterror(xpu); } } static int lxp_parse (lua_State *L) { lxp_userdata *xpu = checkparser(L, 1); size_t len; const char *s = luaL_optlstring(L, 2, NULL, &len); if (xpu->state == XPSfinished && s != NULL) { lua_pushnil(L); lua_pushliteral(L, "cannot parse - document is finished"); return 2; } return parse_aux(L, xpu, s, len); } static int lxp_close (lua_State *L) { int status = 1; lxp_userdata *xpu = (lxp_userdata *)luaL_checkudata(L, 1, ParserType); luaL_argcheck(L, xpu, 1, "expat parser expected"); if (xpu->state != XPSfinished) status = parse_aux(L, xpu, NULL, 0); lxpclose(L, xpu); if (status > 1) luaL_error(L, "error closing parser: %s", lua_tostring(L, -status+1)); return 0; } static int lxp_pos (lua_State *L) { lxp_userdata *xpu = checkparser(L, 1); XML_Parser p = xpu->parser; lua_pushnumber(L, XML_GetCurrentLineNumber(p)); lua_pushnumber(L, XML_GetCurrentColumnNumber(p) + 1); lua_pushnumber(L, XML_GetCurrentByteIndex(p) + 1); return 3; } static int lxp_setencoding (lua_State *L) { lxp_userdata *xpu = checkparser(L, 1); const char *encoding = luaL_checkstring(L, 2); luaL_argcheck(L, xpu->state == XPSpre, 1, "invalid parser state"); XML_SetEncoding(xpu->parser, encoding); return 0; } static int lxp_stop (lua_State *L) { lxp_userdata *xpu = checkparser(L, 1); lua_pushboolean(L, XML_StopParser(xpu->parser, XML_FALSE) == XML_STATUS_OK); return 1; } #if !defined LUA_VERSION_NUM /* Lua 5.0 */ #define luaL_Reg luaL_reg #endif static int lxp_getcurrentbytecount (lua_State* L) { lxp_userdata *xpu = checkparser(L, 1); lua_pushinteger(L, XML_GetCurrentByteCount(xpu->parser)); return 1; } static const struct luaL_Reg lxp_meths[] = { {"parse", lxp_parse}, {"close", lxp_close}, {"__gc", parser_gc}, {"pos", lxp_pos}, {"getcurrentbytecount", lxp_getcurrentbytecount}, {"setencoding", lxp_setencoding}, {"getcallbacks", getcallbacks}, {"getbase", getbase}, {"setbase", setbase}, {"stop", lxp_stop}, {NULL, NULL} }; static const struct luaL_Reg lxp_funcs[] = { {"new", lxp_make_parser}, {NULL, NULL} }; /* ** Assumes the table is on top of the stack. */ static void set_info (lua_State *L) { lua_pushliteral (L, "_COPYRIGHT"); lua_pushliteral (L, "Copyright (C) 2003-2012 Kepler Project"); lua_settable (L, -3); lua_pushliteral (L, "_DESCRIPTION"); lua_pushliteral (L, "LuaExpat is a SAX XML parser based on the Expat library"); lua_settable (L, -3); lua_pushliteral (L, "_VERSION"); lua_pushliteral (L, "LuaExpat 1.3.0"); lua_settable (L, -3); } #if !defined LUA_VERSION_NUM || LUA_VERSION_NUM==501 /* ** Adapted from Lua 5.2.0 */ static void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup) { luaL_checkstack(L, nup, "too many upvalues"); for (; l->name != NULL; l++) { /* fill the table with given functions */ int i; for (i = 0; i < nup; i++) /* copy upvalues to the top */ lua_pushvalue(L, -nup); lua_pushstring(L, l->name); lua_pushcclosure(L, l->func, nup); /* closure with those upvalues */ lua_settable(L, -(nup + 3)); } lua_pop(L, nup); /* remove upvalues */ } #endif int luaopen_lxp (lua_State *L) { luaL_newmetatable(L, ParserType); lua_pushliteral(L, "__index"); lua_pushvalue(L, -2); lua_rawset(L, -3); luaL_setfuncs (L, lxp_meths, 0); lua_pop (L, 1); /* remove metatable */ lua_newtable (L); luaL_setfuncs (L, lxp_funcs, 0); set_info (L); return 1; } lua-expat-1.3.0/src/lxplib.h000066400000000000000000000014761231775553600156730ustar00rootroot00000000000000/* ** See Copyright Notice in license.html */ #define ParserType "Expat" #define StartCdataKey "StartCdataSection" #define EndCdataKey "EndCdataSection" #define CharDataKey "CharacterData" #define CommentKey "Comment" #define DefaultKey "Default" #define DefaultExpandKey "DefaultExpand" #define StartElementKey "StartElement" #define EndElementKey "EndElement" #define ExternalEntityKey "ExternalEntityRef" #define StartNamespaceDeclKey "StartNamespaceDecl" #define EndNamespaceDeclKey "EndNamespaceDecl" #define NotationDeclKey "NotationDecl" #define NotStandaloneKey "NotStandalone" #define ProcessingInstructionKey "ProcessingInstruction" #define UnparsedEntityDeclKey "UnparsedEntityDecl" #define StartDoctypeDeclKey "StartDoctypeDecl" #define XmlDeclKey "XmlDecl" int luaopen_lxp (lua_State *L); lua-expat-1.3.0/tests/000077500000000000000000000000001231775553600145735ustar00rootroot00000000000000lua-expat-1.3.0/tests/test-lom.lua000066400000000000000000000025551231775553600170510ustar00rootroot00000000000000#!/usr/local/bin/lua local lom = require "lxp.lom" local tests = { [[inside tag `abc']], [[ some text ]], } function table._tostring (tab, indent, spacing) local s = {} spacing = spacing or "" indent = indent or "\t" table.insert (s, "{\n") for nome, val in pairs (tab) do table.insert (s, spacing..indent) local t = type(nome) if t == "string" then table.insert (s, string.format ("[%q] = ", tostring (nome))) elseif t == "number" or t == "boolean" then table.insert (s, string.format ("[%s] = ", tostring (nome))) else table.insert (s, t) end t = type(val) if t == "string" or t == "number" then table.insert (s, string.format ("%q", val)) elseif t == "table" then table.insert (s, table._tostring (val, indent, spacing..indent)) else table.insert (s, t) end table.insert (s, ",\n") end table.insert (s, spacing.."}") return table.concat (s) end function table.print (tab, indent, spacing) io.write (table._tostring (tab, indent, spacing)) end for i, s in ipairs(tests) do --s = string.gsub (s, "[\n\r\t]", "") local ds = assert (lom.parse ([[]]..s)) print(table._tostring(ds)) end lua-expat-1.3.0/tests/test.lua000066400000000000000000000207701231775553600162630ustar00rootroot00000000000000#!/usr/local/bin/lua5.1 -- See Copyright Notice in license.html -- $Id: test.lua,v 1.6 2006/06/08 20:34:52 tomas Exp $ if string.find(_VERSION, " 5.0") then lxp = assert(loadlib("./lxp.so", "luaopen_lxp"))() else lxp = require"lxp" gcinfo = function () return collectgarbage"count" end end print (lxp._VERSION) assert(lxp.new, "Cannot find function lxp.new ("..tostring(lxp.new)..")") -- basic test with no preamble local p = lxp.new{} p:setencoding("ISO-8859-1") assert(p:parse[[hi]]) p:close() preamble = [[ ]> ]] X = {} if string.find(_VERSION, " 5.0") then function getargs (...) X = arg end function xgetargs (c) return function (...) table.insert(arg, 1, c) table.insert(X, arg) end end else (loadstring or load)[[ function getargs (...) X = { ... } X.n = select('#', ...) end function xgetargs (c) return function (...) local arg = { ... } arg.n = select('#', ...) + 1 table.insert(arg, 1, c) table.insert(X, arg) end end table.getn = function (t) if t.n then return t.n else local n = 0 for i in pairs(t) do if type(i) == "number" then n = math.max(n, i) end end return n end end]]() end ------------------------------- print("testing start/end tags") callbacks = { StartElement = getargs, EndElement = getargs, } p = lxp.new(callbacks) assert(p:getcallbacks() == callbacks) assert(p:parse(preamble)) assert(p:parse([[ ]])) assert(X.n == 3 and X[1] == p and X[2] == "to") x = X[3] assert(x.priority=="10" and x.xu=="hi" and x.method=="POST") assert(x[1] == "priority" and x[2] == "xu" and table.getn(x) == 2, "x[1] == "..tostring(x[1])..", x[2] == "..tostring(x[2])..", #x == "..tostring(table.getn(x))) assert(p:parse("")) assert(p:parse()) p:close() ------------------------------- print("testing CharacterData/Cdata") callbacks = { CharacterData = getargs, } p = lxp.new(callbacks) assert(p:parse(preamble)) assert(p:parse"a basic text<>]]>") assert(X[1] == p and X[2] == "a basic text<<>") callbacks.chardata = error -- no more calls to `chardata' assert(p:parse("")) assert(p:parse()) -- assert(p:parse()) -- no problem to finish twice. alas, it has problems assert(p:getcallbacks() == callbacks) p:close() ------------------------------- callbacks = { CharacterData = xgetargs"c", StartCdataSection = xgetargs"s", EndCdataSection = xgetargs"e", } X = {} p = lxp.new(callbacks) assert(p:parse(preamble)) assert(p:parse"") assert(p:parse"") assert(table.getn(X) == 3) assert(X[1][1] == "s" and X[1][2] == p, "X[1][1] == "..tostring(X[1][1])..", X[1][2] == "..tostring(X[1][2])..", p == "..tostring(p)) assert(X[2][1] == "c" and X[2][2] == p and X[2][3] == "hi") assert(X[3][1] == "e" and X[3][2] == p) assert(p:parse"") p:close() ------------------------------- print("testing ProcessingInstruction") callbacks = {ProcessingInstruction = getargs} p = lxp.new(callbacks) assert(p:parse[[ ? ?> ]]) assert(X[1] == p and X[2] == "lua" and X[3] == "how is this passed to ? ") p:close() ------------------------------ print("testing Comment") callbacks = {Comment = xgetargs"c"; CharacterData = xgetargs"t"} X = {} p = lxp.new(callbacks) assert(p:parse[[ some text some more text ]]) p:close() assert(X[1][1] == "t" and X[2][1] == "c" and X[3][1] == "t") assert(X[1][2] == X[2][2] and X[2][2] == X[3][2] and X[3][2] == p) assert(X[1][3] == "some text\n") assert(X[2][3] == " with some & symbols ") assert(X[3][3] == "\nsome more text") ---------------------------- print("testing ExternalEntity") entities = { ["entity1.xml"] = "" } callbacks = {StartElement = xgetargs"s", EndElement = xgetargs"e", ExternalEntityRef = function (p, context, base, systemID, publicId) assert(base == "/base") return context:parse(entities[systemID]) end} X = {} p = lxp.new(callbacks) p:setbase("/base") assert(p:parse(preamble)) assert(p:parse[[ &test-entity; ]]) assert(p:getbase() == "/base") p:close() assert(X[1][1] == "s" and X[1][3] == "to") assert(X[2][1] == "s" and X[2][3] == "hi") assert(X[3][1] == "e" and X[3][3] == "hi") assert(X[4][1] == "e" and X[4][3] == "to") ---------------------------- print("testing default handles") text = [[ hi &xuxu; ]] local t = "" callbacks = { Default = function (p, s) t = t .. s end } p = lxp.new(callbacks) assert(p:parse(preamble)) assert(p:parse(text)) p:close() assert(t == preamble..text) t = "" callbacks = { DefaultExpand = function (p, s) t = t .. s end } p = lxp.new(callbacks) assert(p:parse(preamble)) assert(p:parse(text)) p:close() assert(t == preamble..string.gsub(text, "&xuxu;", "is this a xuxu?")) ---------------------------- print("testing notation declarations and unparsed entities") callbacks = { UnparsedEntityDecl = getargs, NotationDecl = function (p, name, base, systemId, publicId) assert(name == "TXT" and systemId == "txt" and base == "/base") end, } p = lxp.new(callbacks) p:setbase("/base") assert(p:parse(preamble)) assert(p:parse[[]]) p:close() assert(X[2] == "test-unparsed" and X[3] == "/base" and X[4] == "unparsed.txt" and X[6] == "txt" and X.n == 6) ---------------------------- print("testing namespace declarations") callbacks = { StartNamespaceDecl = xgetargs"sn", EndNamespaceDecl = xgetargs"en", StartElement = xgetargs"s", EndElement = xgetargs"e", } X = {} p = lxp.new(callbacks, "?") assert(p:parse[[ ]]) p:close() x = X[1] assert(x[1] == "sn" and x[3] == "space" and x[4] == "a/namespace" and table.getn(x) == 4, "x[1] == "..tostring(x[1])..", x[3] == "..tostring(x[3])..", x[4] == "..tostring(x[4])..", #x == "..tostring(table.getn(x))) x = X[3] assert(x[1] == "s" and x[3] == "a/namespace?a") x = X[4] assert(x[1] == "e" and x[3] == "a/namespace?a") x = X[6] assert(x[1] == "en" and x[3] == "space" and table.getn(x) == 3) ---------------------------- print("testing doctype declarations") callbacks = { StartDoctypeDecl = getargs } p = lxp.new(callbacks) assert(p:parse([[]])) assert(p:parse[[]]) p:close() assert(X[2] == "root" and X[3] == "hello-world" and X[4] == "foo" and X[5] == false) -- Error reporting p = lxp.new{} data = [[ ]] local status, msg, line, col, byte = p:parse(data) assert(status == nil and type(msg) == "string" and line == 2 and col == 9) assert(string.sub(data, byte, byte) == "<") p = lxp.new{} p:parse("") local status, msg, line, col, byte = p:parse() assert(status == nil and line == 1 and col == 5 and byte == 5) -- position reporting callbacks = { ProcessingInstruction = function (p) X = {p:pos()} end } p = lxp.new(callbacks) assert(p:parse[[ ]]) p:close() assert(X[1] == 1 and X[2] == 6 and X[3] == 6) -- line, column, abs. position print("testing errors") -- invalid keys assert(not pcall(lxp.new, {StatCdata=print})) assert(pcall(lxp.new, {StatCdata=print, _nonstrict = true})) -- invalid sequences p = lxp.new{} assert(p:parse[[]]) assert(p:parse()) assert(p:parse(" ") == nil) -- closing unfinished document p = lxp.new{} assert(p:parse[[]]) local status, err = pcall(p.close, p) assert(not status and string.find(err, "error closing parser")) -- closing unfinished document print("testing parser:stop()"); local stopped; p = lxp.new{ StartElement = function (parser, name, attr) if name == "stop" then parser:stop() stopped = true else stopped = false end end } local ok, err = p:parse[[Hellohere]]; assert(not ok) assert(err == "parsing aborted") assert(stopped == true, "parser not stopped") -- test for GC print("\ntesting garbage collection") collectgarbage(); collectgarbage() local x = gcinfo() for i=1,100000 do -- due to a small bug in Lua... if (math.mod or math.fmod)(i, 100) == 0 then collectgarbage() end lxp.new({}) end collectgarbage(); collectgarbage() assert(math.abs(gcinfo() - x) <= 2) print"OK" lua-expat-1.3.0/vc6/000077500000000000000000000000001231775553600141275ustar00rootroot00000000000000lua-expat-1.3.0/vc6/README000066400000000000000000000006471231775553600150160ustar00rootroot00000000000000These are the Visual Studio 6 projects provided by the Kepler Project Files: luaexpat.dsw luaexpat_dll.dsp luaexpat_static.dsp README Generated files: luaexpat.ncb luaexpat.opt ../lib/liblxp.lib ../lib/liblxpd.lib ../lib/lxp.exp ../lib/lxp.lib ../lib/lxpd.exp ../lib/lxpd.lib ../lib/lxpd.pdb ../bin/lxp.dll ../bin/lxpd.dll ../bin/lxpd.ilk Download source from: http://www.keplerproject.org/luaexpat/lua-expat-1.3.0/vc6/luaexpat.dsw000066400000000000000000000013271231775553600164740ustar00rootroot00000000000000Microsoft Developer Studio Workspace File, Format Version 6.00 # WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE! ############################################################################### Project: "expat"="..\..\external-src\expat-1.95.8\lib\expat.dsp" - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Project: "luaexpat_dll"=.\luaexpat_dll.dsp - Package Owner=<4> Package=<5> {{{ }}} Package=<4> {{{ }}} ############################################################################### Global: Package=<5> {{{ }}} Package=<3> {{{ }}} ############################################################################### lua-expat-1.3.0/vc6/luaexpat_dll.dsp000066400000000000000000000116461231775553600173250ustar00rootroot00000000000000# Microsoft Developer Studio Project File - Name="luaexpat_dll" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Dynamic-Link Library" 0x0102 CFG=luaexpat_dll - 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 "luaexpat_dll.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 "luaexpat_dll.mak" CFG="luaexpat_dll - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "luaexpat_dll - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "luaexpat_dll - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 # PROP Scc_ProjName "" # PROP Scc_LocalPath "" CPP=cl.exe MTL=midl.exe RSC=rc.exe !IF "$(CFG)" == "luaexpat_dll - 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 "../lib/vc6" # PROP Intermediate_Dir "luaexpat_dll/Release" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MT /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAEXPAT_DLL_EXPORTS" /YX /FD /c # ADD CPP /nologo /MD /W3 /GX /O2 /I "../../external-src/expat-1.95.8/lib" /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "NDEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAEXPAT_DLL_EXPORTS" /YX /FD /c # ADD BASE MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "NDEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 # ADD LINK32 lua50.lib libexpat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /machine:I386 /out:"../bin/vc6/lxp.dll" /libpath:"../../external-src/lua50/lib/dll" /libpath:"../../external-src/expat-1.95.8/lib/Release" # Begin Special Build Tool SOURCE="$(InputPath)" PostBuild_Cmds=cd ../bin/vc6 zip.exe luaexpat-1.0.1-win32.zip lxp.dll # End Special Build Tool !ELSEIF "$(CFG)" == "luaexpat_dll - 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 "../lib/vc6" # PROP Intermediate_Dir "luaexpat_dll/Debug" # PROP Ignore_Export_Lib 0 # PROP Target_Dir "" # ADD BASE CPP /nologo /MTd /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAEXPAT_DLL_EXPORTS" /YX /FD /GZ /c # ADD CPP /nologo /MDd /W3 /Gm /GX /ZI /Od /I "../../external-src/expat-1.95.8/lib" /I "../../external-src/lua50/include" /I "../../compat/src" /D "WIN32" /D "_DEBUG" /D "_WINDOWS" /D "_MBCS" /D "_USRDLL" /D "LUAEXPAT_DLL_EXPORTS" /YX /FD /GZ /c # ADD BASE MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD MTL /nologo /D "_DEBUG" /mktyplib203 /win32 # ADD BASE RSC /l 0x416 /d "_DEBUG" # ADD RSC /l 0x416 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 lua50.lib libexpat.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /out:"../bin/vc6/lxpd.dll" /pdbtype:sept /libpath:"../../external-src/lua50/lib/dll" /libpath:"../../external-src/expat-1.95.8/lib/Debug" !ENDIF # Begin Target # Name "luaexpat_dll - Win32 Release" # Name "luaexpat_dll - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE="..\..\compat\src\compat-5.1.c" # End Source File # Begin Source File SOURCE=.\lxp.def # End Source File # Begin Source File SOURCE=..\src\lxplib.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE="..\..\compat\src\compat-5.1.h" # End Source File # Begin Source File SOURCE=..\src\lxplib.h # End Source File # End Group # Begin Group "Resource Files" # PROP Default_Filter "ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe" # End Group # End Target # End Project lua-expat-1.3.0/vc6/luaexpat_static.dsp000066400000000000000000000062771231775553600200450ustar00rootroot00000000000000# Microsoft Developer Studio Project File - Name="luaexpat_static" - Package Owner=<4> # Microsoft Developer Studio Generated Build File, Format Version 6.00 # ** DO NOT EDIT ** # TARGTYPE "Win32 (x86) Static Library" 0x0104 CFG=luaexpat_static - 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 "luaexpat_static.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 "luaexpat_static.mak" CFG="luaexpat_static - Win32 Debug" !MESSAGE !MESSAGE Possible choices for configuration are: !MESSAGE !MESSAGE "luaexpat_static - Win32 Release" (based on "Win32 (x86) Static Library") !MESSAGE "luaexpat_static - 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)" == "luaexpat_static - 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 "../lib/vc6" # PROP Intermediate_Dir "luaexpat_static/Release" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /GX /O2 /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD CPP /nologo /W3 /GX /O2 /I "../expat/xmlparse" /I "../../lua/include" /I "../../compat" /D "WIN32" /D "NDEBUG" /D "_MBCS" /D "_LIB" /YX /FD /c # ADD BASE RSC /l 0x416 /d "NDEBUG" # ADD RSC /l 0x416 /d "NDEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"../lib/vc6/liblxp.lib" !ELSEIF "$(CFG)" == "luaexpat_static - 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 "../lib/vc6" # PROP Intermediate_Dir "luaexpat_static/Debug" # PROP Target_Dir "" # ADD BASE CPP /nologo /W3 /Gm /GX /ZI /Od /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD CPP /nologo /W3 /Gm /GX /ZI /Od /I "../expat/xmlparse" /I "../../lua/include" /I "../../compat" /D "WIN32" /D "_DEBUG" /D "_MBCS" /D "_LIB" /YX /FD /GZ /c # ADD BASE RSC /l 0x416 /d "_DEBUG" # ADD RSC /l 0x416 /d "_DEBUG" BSC32=bscmake.exe # ADD BASE BSC32 /nologo # ADD BSC32 /nologo LIB32=link.exe -lib # ADD BASE LIB32 /nologo # ADD LIB32 /nologo /out:"../lib/vc6/liblxpd.lib" !ENDIF # Begin Target # Name "luaexpat_static - Win32 Release" # Name "luaexpat_static - Win32 Debug" # Begin Group "Source Files" # PROP Default_Filter "cpp;c;cxx;rc;def;r;odl;idl;hpj;bat" # Begin Source File SOURCE="..\..\compat\compat-5.1.c" # End Source File # Begin Source File SOURCE=..\lxplib.c # End Source File # End Group # Begin Group "Header Files" # PROP Default_Filter "h;hpp;hxx;hm;inl" # Begin Source File SOURCE="..\..\compat\compat-5.1.h" # End Source File # Begin Source File SOURCE=..\lxplib.h # End Source File # End Group # End Target # End Project lua-expat-1.3.0/vc6/lxp.def000066400000000000000000000001161231775553600154100ustar00rootroot00000000000000LIBRARY lxp.dll DESCRIPTION "LuaExpat" VERSION 1.0.2 EXPORTS luaopen_lxp