misc/liblua/lua.h
author Michael Hartman <omh1280@gmail.com>
Sun, 30 Dec 2012 09:48:52 -0500
branchwebgl
changeset 8338 cfad3738132c
parent 3697 d5b30d6373fc
child 10017 de822cd3df3a
permissions -rw-r--r--
Small GL message
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     1
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     2
** $Id: lua.h,v 1.218.1.5 2008/08/06 13:30:12 roberto Exp $
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     3
** Lua - An Extensible Extension Language
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     4
** Lua.org, PUC-Rio, Brazil (http://www.lua.org)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     5
** See Copyright Notice at the end of this file
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     6
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     7
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     8
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
     9
#ifndef lua_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    10
#define lua_h
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    11
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    12
#include <stdarg.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    13
#include <stddef.h>
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    14
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    15
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    16
#include "luaconf.h"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    17
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    18
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    19
#define LUA_VERSION	"Lua 5.1"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    20
#define LUA_RELEASE	"Lua 5.1.4"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    21
#define LUA_VERSION_NUM	501
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    22
#define LUA_COPYRIGHT	"Copyright (C) 1994-2008 Lua.org, PUC-Rio"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    23
#define LUA_AUTHORS 	"R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    24
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    25
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    26
/* mark for precompiled code (`<esc>Lua') */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    27
#define	LUA_SIGNATURE	"\033Lua"
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    28
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    29
/* option for multiple returns in `lua_pcall' and `lua_call' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    30
#define LUA_MULTRET	(-1)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    31
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    32
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    33
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    34
** pseudo-indices
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    35
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    36
#define LUA_REGISTRYINDEX	(-10000)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    37
#define LUA_ENVIRONINDEX	(-10001)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    38
#define LUA_GLOBALSINDEX	(-10002)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    39
#define lua_upvalueindex(i)	(LUA_GLOBALSINDEX-(i))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    40
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    41
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    42
/* thread status; 0 is OK */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    43
#define LUA_YIELD	1
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    44
#define LUA_ERRRUN	2
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    45
#define LUA_ERRSYNTAX	3
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    46
#define LUA_ERRMEM	4
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    47
#define LUA_ERRERR	5
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    48
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    49
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    50
typedef struct lua_State lua_State;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    51
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    52
typedef int (*lua_CFunction) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    53
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    54
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    55
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    56
** functions that read/write blocks when loading/dumping Lua chunks
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    57
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    58
typedef const char * (*lua_Reader) (lua_State *L, void *ud, size_t *sz);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    59
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    60
typedef int (*lua_Writer) (lua_State *L, const void* p, size_t sz, void* ud);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    61
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    62
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    63
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    64
** prototype for memory-allocation functions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    65
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    66
typedef void * (*lua_Alloc) (void *ud, void *ptr, size_t osize, size_t nsize);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    67
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    68
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    69
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    70
** basic types
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    71
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    72
#define LUA_TNONE		(-1)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    73
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    74
#define LUA_TNIL		0
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    75
#define LUA_TBOOLEAN		1
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    76
#define LUA_TLIGHTUSERDATA	2
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    77
#define LUA_TNUMBER		3
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    78
#define LUA_TSTRING		4
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    79
#define LUA_TTABLE		5
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    80
#define LUA_TFUNCTION		6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    81
#define LUA_TUSERDATA		7
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    82
#define LUA_TTHREAD		8
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    83
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    84
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    85
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    86
/* minimum Lua stack available to a C function */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    87
#define LUA_MINSTACK	20
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    88
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    89
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    90
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    91
** generic extra include file
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    92
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    93
#if defined(LUA_USER_H)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    94
#include LUA_USER_H
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    95
#endif
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    96
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    97
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    98
/* type of numbers in Lua */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    99
typedef LUA_NUMBER lua_Number;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   100
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   101
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   102
/* type for integer functions */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   103
typedef LUA_INTEGER lua_Integer;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   104
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   105
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   106
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   107
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   108
** state manipulation
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   109
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   110
LUA_API lua_State *(lua_newstate) (lua_Alloc f, void *ud);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   111
LUA_API void       (lua_close) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   112
LUA_API lua_State *(lua_newthread) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   113
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   114
LUA_API lua_CFunction (lua_atpanic) (lua_State *L, lua_CFunction panicf);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   115
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   116
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   117
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   118
** basic stack manipulation
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   119
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   120
LUA_API int   (lua_gettop) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   121
LUA_API void  (lua_settop) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   122
LUA_API void  (lua_pushvalue) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   123
LUA_API void  (lua_remove) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   124
LUA_API void  (lua_insert) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   125
LUA_API void  (lua_replace) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   126
LUA_API int   (lua_checkstack) (lua_State *L, int sz);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   127
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   128
LUA_API void  (lua_xmove) (lua_State *from, lua_State *to, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   129
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   130
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   131
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   132
** access functions (stack -> C)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   133
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   134
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   135
LUA_API int             (lua_isnumber) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   136
LUA_API int             (lua_isstring) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   137
LUA_API int             (lua_iscfunction) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   138
LUA_API int             (lua_isuserdata) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   139
LUA_API int             (lua_type) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   140
LUA_API const char     *(lua_typename) (lua_State *L, int tp);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   141
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   142
LUA_API int            (lua_equal) (lua_State *L, int idx1, int idx2);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   143
LUA_API int            (lua_rawequal) (lua_State *L, int idx1, int idx2);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   144
LUA_API int            (lua_lessthan) (lua_State *L, int idx1, int idx2);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   145
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   146
LUA_API lua_Number      (lua_tonumber) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   147
LUA_API lua_Integer     (lua_tointeger) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   148
LUA_API int             (lua_toboolean) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   149
LUA_API const char     *(lua_tolstring) (lua_State *L, int idx, size_t *len);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   150
LUA_API size_t          (lua_objlen) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   151
LUA_API lua_CFunction   (lua_tocfunction) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   152
LUA_API void	       *(lua_touserdata) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   153
LUA_API lua_State      *(lua_tothread) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   154
LUA_API const void     *(lua_topointer) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   155
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   156
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   157
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   158
** push functions (C -> stack)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   159
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   160
LUA_API void  (lua_pushnil) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   161
LUA_API void  (lua_pushnumber) (lua_State *L, lua_Number n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   162
LUA_API void  (lua_pushinteger) (lua_State *L, lua_Integer n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   163
LUA_API void  (lua_pushlstring) (lua_State *L, const char *s, size_t l);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   164
LUA_API void  (lua_pushstring) (lua_State *L, const char *s);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   165
LUA_API const char *(lua_pushvfstring) (lua_State *L, const char *fmt,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   166
                                                      va_list argp);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   167
LUA_API const char *(lua_pushfstring) (lua_State *L, const char *fmt, ...);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   168
LUA_API void  (lua_pushcclosure) (lua_State *L, lua_CFunction fn, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   169
LUA_API void  (lua_pushboolean) (lua_State *L, int b);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   170
LUA_API void  (lua_pushlightuserdata) (lua_State *L, void *p);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   171
LUA_API int   (lua_pushthread) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   172
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   173
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   174
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   175
** get functions (Lua -> stack)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   176
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   177
LUA_API void  (lua_gettable) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   178
LUA_API void  (lua_getfield) (lua_State *L, int idx, const char *k);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   179
LUA_API void  (lua_rawget) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   180
LUA_API void  (lua_rawgeti) (lua_State *L, int idx, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   181
LUA_API void  (lua_createtable) (lua_State *L, int narr, int nrec);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   182
LUA_API void *(lua_newuserdata) (lua_State *L, size_t sz);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   183
LUA_API int   (lua_getmetatable) (lua_State *L, int objindex);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   184
LUA_API void  (lua_getfenv) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   185
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   186
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   187
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   188
** set functions (stack -> Lua)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   189
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   190
LUA_API void  (lua_settable) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   191
LUA_API void  (lua_setfield) (lua_State *L, int idx, const char *k);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   192
LUA_API void  (lua_rawset) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   193
LUA_API void  (lua_rawseti) (lua_State *L, int idx, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   194
LUA_API int   (lua_setmetatable) (lua_State *L, int objindex);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   195
LUA_API int   (lua_setfenv) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   196
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   197
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   198
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   199
** `load' and `call' functions (load and run Lua code)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   200
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   201
LUA_API void  (lua_call) (lua_State *L, int nargs, int nresults);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   202
LUA_API int   (lua_pcall) (lua_State *L, int nargs, int nresults, int errfunc);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   203
LUA_API int   (lua_cpcall) (lua_State *L, lua_CFunction func, void *ud);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   204
LUA_API int   (lua_load) (lua_State *L, lua_Reader reader, void *dt,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   205
                                        const char *chunkname);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   206
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   207
LUA_API int (lua_dump) (lua_State *L, lua_Writer writer, void *data);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   208
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   209
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   210
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   211
** coroutine functions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   212
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   213
LUA_API int  (lua_yield) (lua_State *L, int nresults);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   214
LUA_API int  (lua_resume) (lua_State *L, int narg);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   215
LUA_API int  (lua_status) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   216
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   217
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   218
** garbage-collection function and options
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   219
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   220
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   221
#define LUA_GCSTOP		0
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   222
#define LUA_GCRESTART		1
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   223
#define LUA_GCCOLLECT		2
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   224
#define LUA_GCCOUNT		3
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   225
#define LUA_GCCOUNTB		4
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   226
#define LUA_GCSTEP		5
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   227
#define LUA_GCSETPAUSE		6
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   228
#define LUA_GCSETSTEPMUL	7
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   229
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   230
LUA_API int (lua_gc) (lua_State *L, int what, int data);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   231
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   232
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   233
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   234
** miscellaneous functions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   235
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   236
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   237
LUA_API int   (lua_error) (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   238
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   239
LUA_API int   (lua_next) (lua_State *L, int idx);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   240
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   241
LUA_API void  (lua_concat) (lua_State *L, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   242
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   243
LUA_API lua_Alloc (lua_getallocf) (lua_State *L, void **ud);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   244
LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   245
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   246
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   247
3697
d5b30d6373fc remove trailing spaces from end of line
koda
parents: 2812
diff changeset
   248
/*
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   249
** ===============================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   250
** some useful macros
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   251
** ===============================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   252
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   253
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   254
#define lua_pop(L,n)		lua_settop(L, -(n)-1)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   255
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   256
#define lua_newtable(L)		lua_createtable(L, 0, 0)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   257
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   258
#define lua_register(L,n,f) (lua_pushcfunction(L, (f)), lua_setglobal(L, (n)))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   259
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   260
#define lua_pushcfunction(L,f)	lua_pushcclosure(L, (f), 0)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   261
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   262
#define lua_strlen(L,i)		lua_objlen(L, (i))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   263
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   264
#define lua_isfunction(L,n)	(lua_type(L, (n)) == LUA_TFUNCTION)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   265
#define lua_istable(L,n)	(lua_type(L, (n)) == LUA_TTABLE)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   266
#define lua_islightuserdata(L,n)	(lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   267
#define lua_isnil(L,n)		(lua_type(L, (n)) == LUA_TNIL)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   268
#define lua_isboolean(L,n)	(lua_type(L, (n)) == LUA_TBOOLEAN)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   269
#define lua_isthread(L,n)	(lua_type(L, (n)) == LUA_TTHREAD)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   270
#define lua_isnone(L,n)		(lua_type(L, (n)) == LUA_TNONE)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   271
#define lua_isnoneornil(L, n)	(lua_type(L, (n)) <= 0)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   272
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   273
#define lua_pushliteral(L, s)	\
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   274
	lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   275
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   276
#define lua_setglobal(L,s)	lua_setfield(L, LUA_GLOBALSINDEX, (s))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   277
#define lua_getglobal(L,s)	lua_getfield(L, LUA_GLOBALSINDEX, (s))
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   278
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   279
#define lua_tostring(L,i)	lua_tolstring(L, (i), NULL)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   280
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   281
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   282
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   283
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   284
** compatibility macros and functions
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   285
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   286
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   287
#define lua_open()	luaL_newstate()
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   288
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   289
#define lua_getregistry(L)	lua_pushvalue(L, LUA_REGISTRYINDEX)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   290
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   291
#define lua_getgccount(L)	lua_gc(L, LUA_GCCOUNT, 0)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   292
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   293
#define lua_Chunkreader		lua_Reader
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   294
#define lua_Chunkwriter		lua_Writer
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   295
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   296
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   297
/* hack */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   298
LUA_API void lua_setlevel	(lua_State *from, lua_State *to);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   299
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   300
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   301
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   302
** {======================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   303
** Debug API
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   304
** =======================================================================
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   305
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   306
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   307
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   308
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   309
** Event codes
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   310
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   311
#define LUA_HOOKCALL	0
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   312
#define LUA_HOOKRET	1
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   313
#define LUA_HOOKLINE	2
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   314
#define LUA_HOOKCOUNT	3
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   315
#define LUA_HOOKTAILRET 4
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   316
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   317
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   318
/*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   319
** Event masks
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   320
*/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   321
#define LUA_MASKCALL	(1 << LUA_HOOKCALL)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   322
#define LUA_MASKRET	(1 << LUA_HOOKRET)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   323
#define LUA_MASKLINE	(1 << LUA_HOOKLINE)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   324
#define LUA_MASKCOUNT	(1 << LUA_HOOKCOUNT)
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   325
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   326
typedef struct lua_Debug lua_Debug;  /* activation record */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   327
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   328
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   329
/* Functions to be called by the debuger in specific events */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   330
typedef void (*lua_Hook) (lua_State *L, lua_Debug *ar);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   331
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   332
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   333
LUA_API int lua_getstack (lua_State *L, int level, lua_Debug *ar);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   334
LUA_API int lua_getinfo (lua_State *L, const char *what, lua_Debug *ar);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   335
LUA_API const char *lua_getlocal (lua_State *L, const lua_Debug *ar, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   336
LUA_API const char *lua_setlocal (lua_State *L, const lua_Debug *ar, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   337
LUA_API const char *lua_getupvalue (lua_State *L, int funcindex, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   338
LUA_API const char *lua_setupvalue (lua_State *L, int funcindex, int n);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   339
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   340
LUA_API int lua_sethook (lua_State *L, lua_Hook func, int mask, int count);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   341
LUA_API lua_Hook lua_gethook (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   342
LUA_API int lua_gethookmask (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   343
LUA_API int lua_gethookcount (lua_State *L);
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   344
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   345
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   346
struct lua_Debug {
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   347
  int event;
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   348
  const char *name;	/* (n) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   349
  const char *namewhat;	/* (n) `global', `local', `field', `method' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   350
  const char *what;	/* (S) `Lua', `C', `main', `tail' */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   351
  const char *source;	/* (S) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   352
  int currentline;	/* (l) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   353
  int nups;		/* (u) number of upvalues */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   354
  int linedefined;	/* (S) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   355
  int lastlinedefined;	/* (S) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   356
  char short_src[LUA_IDSIZE]; /* (S) */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   357
  /* private part */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   358
  int i_ci;  /* active function */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   359
};
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   360
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   361
/* }====================================================================== */
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   362
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   363
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   364
/******************************************************************************
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   365
* Copyright (C) 1994-2008 Lua.org, PUC-Rio.  All rights reserved.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   366
*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   367
* Permission is hereby granted, free of charge, to any person obtaining
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   368
* a copy of this software and associated documentation files (the
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   369
* "Software"), to deal in the Software without restriction, including
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   370
* without limitation the rights to use, copy, modify, merge, publish,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   371
* distribute, sublicense, and/or sell copies of the Software, and to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   372
* permit persons to whom the Software is furnished to do so, subject to
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   373
* the following conditions:
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   374
*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   375
* The above copyright notice and this permission notice shall be
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   376
* included in all copies or substantial portions of the Software.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   377
*
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   378
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   379
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   380
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   381
* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   382
* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   383
* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   384
* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   385
******************************************************************************/
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   386
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   387
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   388
#endif