Extract ffi to lua52-sys

master
Pierre Krieger 2015-01-03 20:19:04 +01:00
parent 414922ca5a
commit 582b188101
6 changed files with 30 additions and 4 deletions

2
lua52-sys/.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
Cargo.lock
target

13
lua52-sys/Cargo.toml Normal file
View File

@ -0,0 +1,13 @@
[package]
name = "lua52-sys"
version = "0.0.1"
authors = ["Pierre Krieger <pierre.krieger1708@gmail.com>"]
description = "Bindings for Lua 5.2"
build = "build.rs"
links = "lua52"
license = "MIT"
repository = "https://github.com/tomaka/rust-hl-lua"
[build-dependencies]
pkg-config = "*"

5
lua52-sys/build.rs Normal file
View File

@ -0,0 +1,5 @@
extern crate "pkg-config" as pkg_config;
fn main() {
pkg_config::find_library("lua5.2").unwrap();
}

View File

@ -2,9 +2,10 @@
#![allow(non_snake_case)]
#![allow(dead_code)]
use libc;
extern crate libc;
use libc::c_int;
use std::{ default, ptr };
use std::{default, ptr};
pub const MULTRET: c_int = -1;
@ -20,8 +21,8 @@ pub const LUA_ERRMEM: c_int = 4;
pub const LUA_ERRGCMM: c_int = 5;
pub const LUA_ERRERR: c_int = 6;
#[repr(C)]
#[allow(missing_copy_implementations)]
pub struct lua_State;
pub type lua_CFunction = extern "C" fn(L: *mut lua_State) -> c_int;
@ -92,6 +93,7 @@ pub const LUA_MASKLINE: c_int = 1 << LUA_HOOKLINE as uint;
pub const LUA_MASKCOUNT: c_int = 1 << LUA_HOOKCOUNT as uint;
#[repr(C)]
#[allow(missing_copy_implementations)]
pub struct lua_Debug {
pub event: c_int,
pub name: *const libc::c_char,

View File

@ -4,3 +4,7 @@ name = "rust-hl-lua"
version = "0.1.0"
authors = [ "pierre.krieger1708@gmail.com" ]
license = "MIT"
[dependencies.lua52-sys]
version = "*"
path = "../lua52-sys"

View File

@ -4,6 +4,7 @@
extern crate libc;
extern crate collections;
extern crate "lua52-sys" as ffi;
use std::error::Error;
use std::io::IoError;
@ -17,7 +18,6 @@ pub mod functions_read;
pub mod lua_tables;
pub mod userdata;
mod ffi;
mod functions_write;
mod rust_tables;
mod tuples;