mirror of https://github.com/g012/l65.git
Fixed warnings on clang.
Removed dl lib for osx. Fixed lpeg build on windows with numsiblings static.
This commit is contained in:
parent
7d766aea03
commit
a02573fc32
|
@ -110,7 +110,10 @@ if (MSVC)
|
||||||
|
|
||||||
elseif (UNIX)
|
elseif (UNIX)
|
||||||
|
|
||||||
list(APPEND LINKLIBS m dl)
|
list(APPEND LINKLIBS m)
|
||||||
|
if (NOT APPLE)
|
||||||
|
list(APPEND LINKLIBS dl)
|
||||||
|
endif()
|
||||||
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
# l65
|
# l65
|
||||||
|
[![Build Status](https://travis-ci.org/g012/l65.svg?branch=master)](https://travis-ci.org/g012/l65)
|
||||||
|
|
||||||
l65 is a 6502 assembler, operating from within Lua and written in Lua. This means assembler mnemonics become regular Lua statements anywhere in the middle of Lua code.
|
l65 is a 6502 assembler, operating from within Lua and written in Lua. This means assembler mnemonics become regular Lua statements anywhere in the middle of Lua code.
|
||||||
|
|
||||||
|
@ -13,6 +14,7 @@ Use CMake to build a standalone executable. Following are basic instructions if
|
||||||
mkdir build\win32
|
mkdir build\win32
|
||||||
cd build\win32
|
cd build\win32
|
||||||
cmake -G "Visual Studio 15 2017" ..\..
|
cmake -G "Visual Studio 15 2017" ..\..
|
||||||
|
cd ..
|
||||||
cmake --build win32 --config Release
|
cmake --build win32 --config Release
|
||||||
```
|
```
|
||||||
|
|
||||||
|
@ -21,13 +23,14 @@ cmake --build win32 --config Release
|
||||||
mkdir build\win64
|
mkdir build\win64
|
||||||
cd build\win64
|
cd build\win64
|
||||||
cmake -G "Visual Studio 15 2017 Win64" ..\..
|
cmake -G "Visual Studio 15 2017 Win64" ..\..
|
||||||
|
cd ..
|
||||||
cmake --build win64 --config Release
|
cmake --build win64 --config Release
|
||||||
```
|
```
|
||||||
|
|
||||||
### Linux
|
### Linux
|
||||||
|
|
||||||
```
|
```
|
||||||
mkdir build/linux
|
mkdir -p build/linux
|
||||||
cd build/linux
|
cd build/linux
|
||||||
cmake ../.. -DCMAKE_BUILD_TYPE=Release
|
cmake ../.. -DCMAKE_BUILD_TYPE=Release
|
||||||
make
|
make
|
||||||
|
@ -35,7 +38,7 @@ make
|
||||||
|
|
||||||
Force 32b build on 64b system:
|
Force 32b build on 64b system:
|
||||||
```
|
```
|
||||||
mkdir build/linux32
|
mkdir -p build/linux32
|
||||||
cd build/linux32
|
cd build/linux32
|
||||||
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-m32
|
cmake ../.. -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_FLAGS=-m32
|
||||||
make
|
make
|
||||||
|
|
4
lpeg.c
4
lpeg.c
|
@ -283,7 +283,7 @@ typedef struct Pattern {
|
||||||
|
|
||||||
|
|
||||||
/* number of children for each tree */
|
/* number of children for each tree */
|
||||||
static const byte numsiblings[];
|
static const byte numsiblings[17];
|
||||||
|
|
||||||
/* access to children */
|
/* access to children */
|
||||||
#define sib1(t) ((t) + 1)
|
#define sib1(t) ((t) + 1)
|
||||||
|
@ -2203,7 +2203,7 @@ static void printktable (lua_State *L, int idx) {
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* number of siblings for each tree */
|
/* number of siblings for each tree */
|
||||||
static const byte numsiblings[] = {
|
static const byte numsiblings[17] = {
|
||||||
0, 0, 0, /* char, set, any */
|
0, 0, 0, /* char, set, any */
|
||||||
0, 0, /* true, false */
|
0, 0, /* true, false */
|
||||||
1, /* rep */
|
1, /* rep */
|
||||||
|
|
8
main.c
8
main.c
|
@ -5,7 +5,7 @@
|
||||||
extern int luaopen_lpeg(lua_State *L);
|
extern int luaopen_lpeg(lua_State *L);
|
||||||
extern int luaopen_lfs(lua_State *L);
|
extern int luaopen_lfs(lua_State *L);
|
||||||
|
|
||||||
static struct script { const char *name; int t; const char *data; size_t sz; } embedded[] = {
|
static struct script { const char *name; int t; const unsigned char *data; size_t sz; } embedded[] = {
|
||||||
{ "l65cfg", 0, script_l65cfg_lua, sizeof(script_l65cfg_lua) },
|
{ "l65cfg", 0, script_l65cfg_lua, sizeof(script_l65cfg_lua) },
|
||||||
{ "vcs", 1, script_vcs_l65, sizeof(script_vcs_l65) },
|
{ "vcs", 1, script_vcs_l65, sizeof(script_vcs_l65) },
|
||||||
};
|
};
|
||||||
|
@ -17,7 +17,7 @@ static int getembedded(lua_State *L)
|
||||||
{
|
{
|
||||||
if (!strcmp(s->name, name))
|
if (!strcmp(s->name, name))
|
||||||
{
|
{
|
||||||
lua_pushlstring(L, s->data, s->sz);
|
lua_pushlstring(L, (const char*)s->data, s->sz);
|
||||||
lua_pushboolean(L, s->t);
|
lua_pushboolean(L, s->t);
|
||||||
return 2;
|
return 2;
|
||||||
}
|
}
|
||||||
|
@ -47,14 +47,14 @@ int main(int argc, char *argv[])
|
||||||
|
|
||||||
// preload embedded lua scripts
|
// preload embedded lua scripts
|
||||||
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
|
luaL_getsubtable(L, LUA_REGISTRYINDEX, LUA_PRELOAD_TABLE);
|
||||||
luaL_loadbufferx(L, script_6502_lua, sizeof(script_6502_lua), "6502.lua", "b");
|
luaL_loadbufferx(L, (const char*)script_6502_lua, sizeof(script_6502_lua), "6502.lua", "b");
|
||||||
lua_setfield(L, -2, "6502");
|
lua_setfield(L, -2, "6502");
|
||||||
lua_pop(L, 1);
|
lua_pop(L, 1);
|
||||||
|
|
||||||
// error handler
|
// error handler
|
||||||
lua_pushcfunction(L, msghandler);
|
lua_pushcfunction(L, msghandler);
|
||||||
// l65.lua script
|
// l65.lua script
|
||||||
luaL_loadbufferx(L, script_l65_lua, sizeof(script_l65_lua), "l65.lua", "b");
|
luaL_loadbufferx(L, (const char*)script_l65_lua, sizeof(script_l65_lua), "l65.lua", "b");
|
||||||
// arg[] table
|
// arg[] table
|
||||||
lua_createtable(L, argc-1, 2);
|
lua_createtable(L, argc-1, 2);
|
||||||
lua_pushcfunction(L, getembedded); // pass embedded script lookup function as arg[-1]
|
lua_pushcfunction(L, getembedded); // pass embedded script lookup function as arg[-1]
|
||||||
|
|
Loading…
Reference in New Issue