misc/liblua/lua.h
author antonc27 <antonc27@mail.ru>
Fri, 29 Dec 2017 19:38:01 +0100
branchios-develop
changeset 12869 941674281760
parent 10017 de822cd3df3a
permissions -rw-r--r--
- Xcode somehow inherit info about unused target for tvOS from SDL 2.0.7, so commit this noise too...
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
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    19
#define LUA_VERSION "Lua 5.1"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    20
#define LUA_RELEASE "Lua 5.1.4"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    21
#define LUA_VERSION_NUM 501
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    22
#define LUA_COPYRIGHT   "Copyright (C) 1994-2008 Lua.org, PUC-Rio"
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    23
#define LUA_AUTHORS     "R. Ierusalimschy, L. H. de Figueiredo & W. Celes"
2812
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') */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    27
#define LUA_SIGNATURE   "\033Lua"
2812
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' */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    30
#define LUA_MULTRET (-1)
2812
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
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    36
#define LUA_REGISTRYINDEX   (-10000)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    37
#define LUA_ENVIRONINDEX    (-10001)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    38
#define LUA_GLOBALSINDEX    (-10002)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    39
#define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))
2812
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 */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    43
#define LUA_YIELD   1
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    44
#define LUA_ERRRUN  2
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    45
#define LUA_ERRSYNTAX   3
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    46
#define LUA_ERRMEM  4
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    47
#define LUA_ERRERR  5
2812
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
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    72
#define LUA_TNONE       (-1)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
    73
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    74
#define LUA_TNIL        0
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    75
#define LUA_TBOOLEAN        1
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    76
#define LUA_TLIGHTUSERDATA  2
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    77
#define LUA_TNUMBER     3
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    78
#define LUA_TSTRING     4
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    79
#define LUA_TTABLE      5
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    80
#define LUA_TFUNCTION       6
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    81
#define LUA_TUSERDATA       7
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    82
#define LUA_TTHREAD     8
2812
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 */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
    87
#define LUA_MINSTACK    20
2812
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);
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   152
LUA_API void           *(lua_touserdata) (lua_State *L, int idx);
2812
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
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   221
#define LUA_GCSTOP      0
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   222
#define LUA_GCRESTART       1
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   223
#define LUA_GCCOLLECT       2
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   224
#define LUA_GCCOUNT     3
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   225
#define LUA_GCCOUNTB        4
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   226
#define LUA_GCSTEP      5
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   227
#define LUA_GCSETPAUSE      6
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   228
#define LUA_GCSETSTEPMUL    7
2812
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
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   254
#define lua_pop(L,n)        lua_settop(L, -(n)-1)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   255
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   256
#define lua_newtable(L)     lua_createtable(L, 0, 0)
2812
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
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   260
#define lua_pushcfunction(L,f)  lua_pushcclosure(L, (f), 0)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   261
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   262
#define lua_strlen(L,i)     lua_objlen(L, (i))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   263
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   264
#define lua_isfunction(L,n) (lua_type(L, (n)) == LUA_TFUNCTION)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   265
#define lua_istable(L,n)    (lua_type(L, (n)) == LUA_TTABLE)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   266
#define lua_islightuserdata(L,n)    (lua_type(L, (n)) == LUA_TLIGHTUSERDATA)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   267
#define lua_isnil(L,n)      (lua_type(L, (n)) == LUA_TNIL)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   268
#define lua_isboolean(L,n)  (lua_type(L, (n)) == LUA_TBOOLEAN)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   269
#define lua_isthread(L,n)   (lua_type(L, (n)) == LUA_TTHREAD)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   270
#define lua_isnone(L,n)     (lua_type(L, (n)) == LUA_TNONE)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   271
#define lua_isnoneornil(L, n)   (lua_type(L, (n)) <= 0)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   272
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   273
#define lua_pushliteral(L, s)   \
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   274
    lua_pushlstring(L, "" s, (sizeof(s)/sizeof(char))-1)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   275
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   276
#define lua_setglobal(L,s)  lua_setfield(L, LUA_GLOBALSINDEX, (s))
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   277
#define lua_getglobal(L,s)  lua_getfield(L, LUA_GLOBALSINDEX, (s))
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   278
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   279
#define lua_tostring(L,i)   lua_tolstring(L, (i), NULL)
2812
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
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   287
#define lua_open()  luaL_newstate()
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   288
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   289
#define lua_getregistry(L)  lua_pushvalue(L, LUA_REGISTRYINDEX)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   290
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   291
#define lua_getgccount(L)   lua_gc(L, LUA_GCCOUNT, 0)
2812
0a24853de796 add liblua to sources for macosx
koda
parents:
diff changeset
   292
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   293
#define lua_Chunkreader     lua_Reader
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   294
#define lua_Chunkwriter     lua_Writer
2812
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 */
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   298
LUA_API void lua_setlevel   (lua_State *from, lua_State *to);
2812
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
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   311
#define LUA_HOOKCALL    0
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   312
#define LUA_HOOKRET 1
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   313
#define LUA_HOOKLINE    2
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   314
#define LUA_HOOKCOUNT   3
2812
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
*/
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   321
#define LUA_MASKCALL    (1 << LUA_HOOKCALL)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   322
#define LUA_MASKRET (1 << LUA_HOOKRET)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   323
#define LUA_MASKLINE    (1 << LUA_HOOKLINE)
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   324
#define LUA_MASKCOUNT   (1 << LUA_HOOKCOUNT)
2812
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;
10017
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   348
  const char *name; /* (n) */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   349
  const char *namewhat; /* (n) `global', `local', `field', `method' */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   350
  const char *what; /* (S) `Lua', `C', `main', `tail' */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   351
  const char *source;   /* (S) */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   352
  int currentline;  /* (l) */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   353
  int nups;     /* (u) number of upvalues */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   354
  int linedefined;  /* (S) */
de822cd3df3a fixwhitespace and dos2unix
koda
parents: 3697
diff changeset
   355
  int lastlinedefined;  /* (S) */
2812
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