Skip to content
This repository has been archived by the owner on Nov 20, 2020. It is now read-only.

Commit

Permalink
Adding support for compilation on both Lua 5.0 and Lua 5.1. Correctin…
Browse files Browse the repository at this point in the history
…g version number.
  • Loading branch information
Tomas Guisasola committed Jun 8, 2006
1 parent fc48509 commit 8561525
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 27 deletions.
5 changes: 5 additions & 0 deletions config
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ LIB_OPTION= -shared #for Linux
#LIB_OPTION= -bundle -undefined dynamic_lookup #for MacOS X

LIBNAME= $T.so.$V
# Lua version number
# (according to Lua 5.1 definition:
# first version digit * 100 + second version digit
# e.g. Lua 5.0.2 => 500, Lua 5.1 => 501, Lua 5.1.1 => 501)
LUA_VERSION_NUM= 500
COMPAT_DIR= ../compat/src

# Compilation parameters
Expand Down
33 changes: 22 additions & 11 deletions doc/us/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -61,17 +61,12 @@ <h2><a name="overview"></a>Overview</h2>
<a href="http://www.libexpat.org/">Expat</a> library.</p>

<p>LuaExpat is free software and uses the same <a href="license.html">license</a>
as Lua 5.0.</p>
as Lua 5.1.</p>

<h2><a name="status"></a>Status</h2>

<p>Current version is 1.0.2. It was developed for Lua 5.0 and has been tested on
Linux, Windows (2000/XP) and MacOS X with Expat 1.95.8.</p>

<p>LuaExpat 1.0.2 follows the
<a href="http://www.keplerproject.org/compat/">package model</a>
for Lua 5.1 (see section <a href="manual.html#installation">Installation</a>
for more details).</p>
<p>Current version is 1.1.0. It was developed for both Lua 5.0 and Lua 5.1, and has been tested on
Linux, Windows (2000/XP) and MacOS X with Expat 2.0.0.</p>

<h2><a name="download"></a>Download</h2>

Expand All @@ -84,11 +79,27 @@ <h2><a name="download"></a>Download</h2>
<h2><a name="history"></a>History</h2>

<dl class="history">
<dt><strong>Version 1.1.0</strong> [?/Jun/2006]</dt>
<dd>
<ul>
<li>adapted to work on both Lua 5.0 and Lua 5.1
<li>updated to Expat 2.0.0
</ul>
</dd>

<dt><strong>Version 1.0.2</strong> [23/Mar/2006]</dt>
<dd>minor bugfix, <code>lom</code> correct module name is <code>lxp.lom</code>.</dd>
<dd>
<ul>
<li>minor bugfix, <code>lom</code> correct module name is <code>lxp.lom</code>
</ul>
</dd>

<dt><strong>Version 1.0.1</strong> [06/Jun/2005]</dt>
<dd>minor changes for compatibility with Expat version 1.95.8.</dd>
<dd>
<ul>
<li>minor changes for compatibility with Expat version 1.95.8
</ul>
</dd>

<dt><strong>Version 1.0</strong> [2/Dec/2004]</dt>
<dd />
Expand Down Expand Up @@ -137,7 +148,7 @@ <h2><a name="contact"></a>Contact</h2>
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
<p><small>$Id: index.html,v 1.40 2006-03-26 16:41:48 carregal Exp $</small></p>
<p><small>$Id: index.html,v 1.41 2006-06-08 20:41:48 tomas Exp $</small></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->
Expand Down
12 changes: 3 additions & 9 deletions doc/us/manual.html
Original file line number Diff line number Diff line change
Expand Up @@ -83,14 +83,8 @@ <h2><a name="introduction"></a>Introduction</h2>

<h2><a name="installation"></a>Installation</h2>

<p>LuaExpat follows the
<a href="http://www.keplerproject.org/compat">package model</a>
for Lua 5.1, therefore it should be "installed". Refer to
<a href="http://www.keplerproject.org/compat/manual.html#configuration">
Compat-5.1 configuration</a> section about how to install the compiled
binary file properly.
The compiled binary file should be copied to a directory in your
<code>LUA_CPATH</code>.</p>
<p>The compiled binary file should be copied to a directory in your
<code><a href="http://www.lua.org/manual/5.1/manual.html#pdf-package.cpath">LUA_CPATH</a></code>. Lua 5.0 users should install <a href="http://www.keplerproject.org/compat">Compat-5.1</a> also.</p>

<p>Windows users can use the binary version of LuaExpat (<code>lxp.dll</code>, compatible with
<a href="http://luabinaries.luaforge.net">LuaBinaries</a> Release 2) available at
Expand Down Expand Up @@ -332,7 +326,7 @@ <h4><a name="separator"></a>The separator character</h4>
<div id="about">
<p><a href="http://validator.w3.org/check?uri=referer">
<img src="http://www.w3.org/Icons/valid-xhtml10" alt="Valid XHTML 1.0!" height="31" width="88" /></a></p>
<p><small>$Id: manual.html,v 1.23 2006-03-20 22:26:00 carregal Exp $</small></p>
<p><small>$Id: manual.html,v 1.24 2006-06-08 20:41:48 tomas Exp $</small></p>
</div> <!-- id="about" -->

</div> <!-- id="container" -->
Expand Down
14 changes: 9 additions & 5 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
T= lxp
V= 1.0.2
V= 1.1.0
CONFIG= ./config

include $(CONFIG)

ifeq "$(LUA_VERSION_NUM)" "500"
COMPAT_O= $(COMPAT_DIR)/compat-5.1.o
endif

OBJS= src/lxplib.o $(COMPAT_O)
lib: src/$(LIBNAME)

src/$(LIBNAME) : src/lxplib.o $(COMPAT_DIR)/compat-5.1.o
export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) -o src/$(LIBNAME) $(LIB_OPTION) src/lxplib.o $(COMPAT_DIR)/compat-5.1.o -lexpat
src/$(LIBNAME) : $(OBJS)
export MACOSX_DEPLOYMENT_TARGET="10.3"; $(CC) -o src/$(LIBNAME) $(LIB_OPTION) $(OBJS) -lexpat

$(COMPAT_DIR)/compat-5.1.o: $(COMPAT_DIR)/compat-5.1.c
$(CC) -c $(CFLAGS) -o $@ $(COMPAT_DIR)/compat-5.1.c
Expand All @@ -21,6 +25,6 @@ install:
cp src/$T/lom.lua $(LUA_DIR)/$T

clean:
rm -f src/$(LIBNAME) src/lxplib.o $(COMPAT_DIR)/compat-5.1.o
rm -f src/$(LIBNAME) $(OBJS)

# $Id: makefile,v 1.32 2005-06-27 17:04:27 tomas Exp $
# $Id: makefile,v 1.33 2006-06-08 20:41:48 tomas Exp $
11 changes: 9 additions & 2 deletions src/lxplib.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
** $Id: lxplib.c,v 1.13 2006-03-20 19:55:53 carregal Exp $
** $Id: lxplib.c,v 1.14 2006-06-08 20:41:48 tomas Exp $
** LuaExpat: Lua bind for Expat library
** See Copyright Notice in license.html
*/
Expand All @@ -13,7 +13,9 @@

#include "lua.h"
#include "lauxlib.h"
#if ! defined (LUA_VERSION_NUM) || LUA_VERSION_NUM < 501
#include "compat-5.1.h"
#endif


#include "lxplib.h"
Expand Down Expand Up @@ -334,9 +336,14 @@ static void checkcallbacks (lua_State *L) {
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
if (lua_type(L, -1) == LUA_TSTRING)
luaL_checkoption(L, -1, NULL, validkeys);
#endif
}
}

Expand Down Expand Up @@ -520,7 +527,7 @@ static void set_info (lua_State *L) {
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.0.2");
lua_pushliteral (L, "LuaExpat 1.1.0");
lua_settable (L, -3);
}

Expand Down

0 comments on commit 8561525

Please sign in to comment.