Skip to content

Commit

Permalink
Fix issue #15 ; reformat types
Browse files Browse the repository at this point in the history
  • Loading branch information
ichordev committed Dec 27, 2023
1 parent aa6b225 commit 0429509
Show file tree
Hide file tree
Showing 4 changed files with 174 additions and 170 deletions.
67 changes: 34 additions & 33 deletions source/bindbc/lua/v51/types.d
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

// Copyright 2019 - 2021 Michael D. Parker
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

/+
+ Copyright 2023 Aya Partridge
+ Copyright 2019 - 2021 Michael D. Parker
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+/
module bindbc.lua.v51.types;

version(LUA_51):

import core.stdc.stdio : BUFSIZ;
import core.stdc.stdio: BUFSIZ;

// luaconf.h
enum LUA_IDSIZE = 60;
Expand All @@ -27,19 +28,19 @@ enum LUAI_MAXSTACK = 1000000;
// lauxlib.h
enum LUA_ERRFILE = LUA_ERRERR+1;

struct luaL_Reg {
const(char)* name;
lua_CFunction func;
struct luaL_Reg{
const(char)* name;
lua_CFunction func;
}

enum LUA_NOREF = -2;
enum LUA_REFNIL = -1;

struct luaL_Buffer {
char* p;
int lvl;
lua_State* L;
char[LUAL_BUFFERSIZE] buffer;
struct luaL_Buffer{
char* p;
int lvl;
lua_State* L;
char[LUAL_BUFFERSIZE] buffer;
}

// lua.h
Expand Down Expand Up @@ -68,11 +69,11 @@ enum LUA_ERRERR = 5;

struct lua_State;

extern(C) nothrow {
alias lua_CFunction = int function(lua_State*);
alias lua_Reader = const(char)* function(lua_State*,void*,size_t*);
alias lua_Writer = int function(lua_State*,const(void)*,size_t,void*);
alias lua_Alloc = void* function(void*,void*,size_t,size_t);
extern(C) nothrow{
alias lua_CFunction = int function(lua_State*);
alias lua_Reader = const(char)* function(lua_State*, void*, size_t*);
alias lua_Writer = int function(lua_State*, const(void)*, size_t, void*);
alias lua_Alloc = void* function(void*, void*, size_t, size_t);
}

enum LUA_TNONE = -1;
Expand Down Expand Up @@ -111,21 +112,21 @@ enum LUA_MASKRET = 1 << LUA_HOOKRET;
enum LUA_MASKLINE = 1 << LUA_HOOKLINE;
enum LUA_MASKCOUNT = 1 << LUA_HOOKCOUNT;

struct lua_Debug {
int event;
const(char)* name;
const(char)* namewhat;
const(char)* what;
const(char)* source;
int currentline;
int nups;
int linedefined;
int lastlinedefined;
char[LUA_IDSIZE] short_src;
private int i_ci;
struct lua_Debug{
int event;
const(char)* name;
const(char)* namewhat;
const(char)* what;
const(char)* source;
int currentline;
int nups;
int linedefined;
int lastlinedefined;
char[LUA_IDSIZE] short_src;
private int i_ci;
}

alias lua_Hook = void function(lua_State*,lua_Debug*) nothrow;
alias lua_Hook = extern(C) void function(lua_State*, lua_Debug*) nothrow;

// lualib.h
enum LUA_FILEHANDLE = "FILE*";
Expand Down
81 changes: 41 additions & 40 deletions source/bindbc/lua/v52/types.d
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@

// Copyright 2019 - 2021 Michael D. Parker
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

/+
+ Copyright 2023 Aya Partridge
+ Copyright 2019 - 2021 Michael D. Parker
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+/
module bindbc.lua.v52.types;

version(LUA_52):

import core.stdc.stdio : BUFSIZ, FILE;
import core.stdc.stdio: BUFSIZ, FILE;

// luaconf.h
enum LUA_IDSIZE = 60;
Expand All @@ -28,27 +29,27 @@ enum LUAI_FIRSTPSEUDOIDX = (-LUAI_MAXSTACK - 1000);
// lauxlib.h
enum LUA_ERRFILE = LUA_ERRERR+1;

struct luaL_Reg {
const(char)* name;
lua_CFunction func;
struct luaL_Reg{
const(char)* name;
lua_CFunction func;
}

enum LUA_NOREF = -2;
enum LUA_REFNIL = -1;

struct luaL_Buffer {
char* b;
size_t size;
size_t n;
lua_State* L;
char[LUAL_BUFFERSIZE] buffer;
struct luaL_Buffer{
char* b;
size_t size;
size_t n;
lua_State* L;
char[LUAL_BUFFERSIZE] buffer;
}

alias LUA_FILEHANDLE = FILE*;

struct luaL_Stream {
FILE* f;
lua_CFunction closef;
struct luaL_Stream{
FILE* f;
lua_CFunction closef;
}

// lua.h
Expand All @@ -75,11 +76,11 @@ enum LUA_ERRERR = 6;

struct lua_State;

extern(C) nothrow {
alias lua_CFunction = int function(lua_State*);
alias lua_Reader = const(char)* function(lua_State*,void*,size_t*);
alias lua_Writer = int function(lua_State*,const(void)*,size_t,void*);
alias lua_Alloc = void* function(void*,void*,size_t,size_t);
extern(C) nothrow{
alias lua_CFunction = int function(lua_State*);
alias lua_Reader = const(char)* function(lua_State*, void*, size_t*);
alias lua_Writer = int function(lua_State*, const(void)*, size_t, void*);
alias lua_Alloc = void* function(void*, void*, size_t, size_t);
}

enum LUA_TNONE = -1;
Expand Down Expand Up @@ -140,24 +141,24 @@ enum LUA_MASKRET = 1 << LUA_HOOKRET;
enum LUA_MASKLINE = 1 << LUA_HOOKLINE;
enum LUA_MASKCOUNT = 1 << LUA_HOOKCOUNT;

struct lua_Debug {
int event;
const(char)* name;
const(char)* namewhat;
const(char)* what;
const(char)* source;
int currentline;
int linedefined;
int lastlinedefined;
ubyte nups;
ubyte nparams;
char isvararg;
char istailcall;
char[LUA_IDSIZE] short_src;
private void* i_ci;
struct lua_Debug{
int event;
const(char)* name;
const(char)* namewhat;
const(char)* what;
const(char)* source;
int currentline;
int linedefined;
int lastlinedefined;
ubyte nups;
ubyte nparams;
char isvararg;
char istailcall;
char[LUA_IDSIZE] short_src;
private void* i_ci;
}

alias lua_Hook = void function(lua_State*,lua_Debug*) nothrow;
alias lua_Hook = extern(C) void function(lua_State*, lua_Debug*) nothrow;

// lualib.h
enum LUA_COLIBNAME = "coroutine";
Expand Down
83 changes: 42 additions & 41 deletions source/bindbc/lua/v53/types.d
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@

// Copyright 2019 - 2021 Michael D. Parker
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

/+
+ Copyright 2023 Aya Partridge
+ Copyright 2010 - 2021 Michael D. Parker
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENSE_1_0.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
+/
module bindbc.lua.v53.types;

version(LUA_53):

import core.stdc.stdio : BUFSIZ, FILE;
import core.stdc.stdint : intptr_t;
import core.stdc.stdio: BUFSIZ, FILE;
import core.stdc.stdint: intptr_t;

// luaconf.h
alias LUA_INT32 = int;
Expand All @@ -30,29 +31,29 @@ enum LUA_ERRFILE = LUA_ERRERR+1;
enum LUA_LOADED_TABLE = "_LOADED";
enum LUA_PRELOAD_TABLE = "_PRELOAD";

struct luaL_Reg {
const(char)* name;
lua_CFunction func;
struct luaL_Reg{
const(char)* name;
lua_CFunction func;
}

enum LUAL_NUMSIZES = lua_Integer.sizeof * 16 + lua_Number.sizeof;

enum LUA_NOREF = -2;
enum LUA_REFNIL = -1;

struct luaL_Buffer {
char* b;
size_t size;
size_t n;
lua_State* L;
char[LUAL_BUFFERSIZE] initb;
struct luaL_Buffer{
char* b;
size_t size;
size_t n;
lua_State* L;
char[LUAL_BUFFERSIZE] initb;
}

alias LUA_FILEHANDLE = FILE*;

struct luaL_Stream {
FILE* f;
lua_CFunction closef;
FILE* f;
lua_CFunction closef;
}

// lua.h
Expand All @@ -79,12 +80,12 @@ enum LUA_ERRERR = 6;

struct lua_State;

extern(C) nothrow {
alias lua_CFunction = int function(lua_State*);
alias lua_KFunction = int function(lua_State*,int,lua_KContext);
alias lua_Reader = const(char)* function(lua_State*,void*,size_t*);
alias lua_Writer = int function(lua_State*,const(void)*,size_t,void*);
alias lua_Alloc = void* function(void*,void*,size_t,size_t);
extern(C) nothrow{
alias lua_CFunction = int function(lua_State*);
alias lua_KFunction = int function(lua_State*, int, lua_KContext);
alias lua_Reader = const(char)* function(lua_State*, void*, size_t*);
alias lua_Writer = int function(lua_State*, const(void)*, size_t, void*);
alias lua_Alloc = void* function(void*, void*, size_t, size_t);
}

enum LUA_TNONE = -1;
Expand Down Expand Up @@ -150,24 +151,24 @@ enum LUA_MASKRET = 1 << LUA_HOOKRET;
enum LUA_MASKLINE = 1 << LUA_HOOKLINE;
enum LUA_MASKCOUNT = 1 << LUA_HOOKCOUNT;

struct lua_Debug {
int event;
const(char)* name;
const(char)* namewhat;
const(char)* what;
const(char)* source;
int currentline;
int linedefined;
int lastlinedefined;
ubyte nups;
ubyte nparams;
char isvararg;
char istailcall;
char[LUA_IDSIZE] short_src;
private void* i_ci;
struct lua_Debug{
int event;
const(char)* name;
const(char)* namewhat;
const(char)* what;
const(char)* source;
int currentline;
int linedefined;
int lastlinedefined;
ubyte nups;
ubyte nparams;
char isvararg;
char istailcall;
char[LUA_IDSIZE] short_src;
private void* i_ci;
}

alias lua_Hook = void function(lua_State*,lua_Debug*) nothrow;
alias lua_Hook = extern(C) void function(lua_State*, lua_Debug*) nothrow;

// lualib.h
enum LUA_VERSUFFIX = "_" ~ LUA_VERSION_MAJOR ~ "_" ~ LUA_VERSION_MINOR;
Expand Down
Loading

0 comments on commit 0429509

Please sign in to comment.