Github User Fetcher 1.0.0
C Application with Server and GUI
|
#include <ctype.h>
#include <limits.h>
#include <stddef.h>
#include <string.h>
#include "lua.h"
#include "lauxlib.h"
Go to the source code of this file.
Data Structures | |
struct | cD |
struct | Header |
Macros | |
#define | STRUCT_INT long |
#define | MAXINTSIZE 32 |
#define | isp2(x) ((x) > 0 && ((x) & ((x) - 1)) == 0) |
#define | PADDING (sizeof(struct cD) - sizeof(double)) |
#define | MAXALIGN (PADDING > sizeof(int) ? PADDING : sizeof(int)) |
#define | BIG 0 |
#define | LITTLE 1 |
#define | defaultoptions(h) ((h)->endian = native.endian, (h)->align = 1) |
Typedefs | |
typedef STRUCT_INT | Inttype |
typedef unsigned STRUCT_INT | Uinttype |
typedef struct Header | Header |
Functions | |
static int | getnum (const char **fmt, int df) |
static size_t | optsize (lua_State *L, char opt, const char **fmt) |
static int | gettoalign (size_t len, Header *h, int opt, size_t size) |
static void | controloptions (lua_State *L, int opt, const char **fmt, Header *h) |
static void | putinteger (lua_State *L, luaL_Buffer *b, int arg, int endian, int size) |
static void | correctbytes (char *b, int size, int endian) |
static int | b_pack (lua_State *L) |
static lua_Number | getinteger (const char *buff, int endian, int issigned, int size) |
static int | b_unpack (lua_State *L) |
static int | b_size (lua_State *L) |
LUALIB_API int | luaopen_struct (lua_State *L) |
Variables | ||
union { | ||
int dummy | ||
char endian | ||
} | native = {1} | |
static const struct luaL_Reg | thislib [] | |
#define BIG 0 |
Definition at line 75 of file lua_struct.c.
Referenced by controloptions(), and getinteger().
#define defaultoptions | ( | h | ) | ((h)->endian = native.endian, (h)->align = 1) |
Definition at line 104 of file lua_struct.c.
Referenced by b_pack(), b_size(), and b_unpack().
#define isp2 | ( | x | ) | ((x) > 0 && ((x) & ((x) - 1)) == 0) |
Definition at line 61 of file lua_struct.c.
Referenced by controloptions().
#define LITTLE 1 |
Definition at line 76 of file lua_struct.c.
Referenced by controloptions(), and putinteger().
Definition at line 71 of file lua_struct.c.
Referenced by controloptions().
#define MAXINTSIZE 32 |
Definition at line 58 of file lua_struct.c.
Referenced by optsize(), and putinteger().
#define PADDING (sizeof(struct cD) - sizeof(double)) |
Definition at line 70 of file lua_struct.c.
#define STRUCT_INT long |
Definition at line 48 of file lua_struct.c.
typedef struct Header Header |
typedef STRUCT_INT Inttype |
Definition at line 51 of file lua_struct.c.
typedef unsigned STRUCT_INT Uinttype |
Definition at line 54 of file lua_struct.c.
|
static |
Definition at line 205 of file lua_struct.c.
References arg, controloptions(), correctbytes(), defaultoptions, Header::endian, gettoalign(), lua_pushnil(), luaL_addchar, luaL_addlstring(), luaL_argcheck, luaL_buffinit(), luaL_checklstring(), luaL_checknumber(), luaL_checkstring, luaL_pushresult(), optsize(), putinteger(), and s.
|
static |
Definition at line 359 of file lua_struct.c.
References controloptions(), defaultoptions, gettoalign(), lua_pushinteger(), luaL_argerror(), luaL_checkstring, and optsize().
|
static |
Definition at line 290 of file lua_struct.c.
References controloptions(), correctbytes(), defaultoptions, Header::endian, getinteger(), gettoalign(), lua_isnumber(), lua_pop, lua_pushinteger(), lua_pushlstring(), lua_pushnumber(), lua_tonumber, luaL_argcheck, luaL_checklstring(), luaL_checkstack(), luaL_checkstring, luaL_error(), luaL_optinteger(), NULL, and optsize().
Definition at line 145 of file lua_struct.c.
References Header::align, BIG, Header::endian, getnum(), isp2, LITTLE, lua_pushfstring(), luaL_argerror(), luaL_error(), and MAXALIGN.
Referenced by b_pack(), b_size(), and b_unpack().
|
static |
Definition at line 193 of file lua_struct.c.
References endian, and native.
Referenced by b_pack(), and b_unpack().
|
static |
Definition at line 263 of file lua_struct.c.
References BIG, endian, and mask.
Referenced by b_unpack().
|
static |
Definition at line 91 of file lua_struct.c.
Referenced by controloptions(), and optsize().
|
static |
Definition at line 134 of file lua_struct.c.
References Header::align.
Referenced by b_pack(), b_size(), and b_unpack().
LUALIB_API int luaopen_struct | ( | lua_State * | L | ) |
Definition at line 394 of file lua_struct.c.
References lua_pushvalue(), lua_setglobal, luaL_newlib, and thislib.
|
static |
Definition at line 108 of file lua_struct.c.
References getnum(), luaL_error(), and MAXINTSIZE.
Referenced by b_pack(), b_size(), and b_unpack().
|
static |
Definition at line 166 of file lua_struct.c.
References arg, endian, LITTLE, luaL_addlstring(), luaL_checknumber(), MAXINTSIZE, and value.
Referenced by b_pack().
int dummy |
Definition at line 80 of file lua_struct.c.
char endian |
Definition at line 81 of file lua_struct.c.
Referenced by correctbytes(), getinteger(), and putinteger().
union { ... } native |
Referenced by correctbytes().
|
static |
Definition at line 384 of file lua_struct.c.
Referenced by luaopen_struct().