分享
 
 
 

lua头文件的pas翻译_lua.h

王朝delphi·作者佚名  2006-01-09
窄屏简体版  字體: |||超大  

{

** $Id: lua.h,v 1.175b 2003/03/18 12:31:39 roberto Exp $

** Lua - An Extensible Extension Language

** Tecgraf: Computer Graphics Technology Group, PUC-Rio, Brazil

** http://www.lua.org mailto:info@lua.org

** See Copyright Notice at the end of this file

}

{

this .h header file is translated by melice

}

unit Lua;

interface

const

LuaDLL = 'LuaLibDll.dll';

type

lua_state = pointer;

int = integer;

size_t = int;

va_list = int;

const

sLUA_VERSION = 'Lua 5.0.2';

sLUA_COPYRIGHT = 'Copyright (C) 1994-2004 Tecgraf, PUC-Rio';

sLUA_AUTHORS = 'R. Ierusalimschy, L. H. de Figueiredo & W. Celes';

{ option for multiple returns in `lua_pcall' and `lua_call' }

LUA_MULTRET = -1;

{

** pseudo-indices

}

LUA_REGISTRYINDEX = -10000;

LUA_GLOBALSINDEX = -10001;

// #define lua_upvalueindex(i) (LUA_GLOBALSINDEX-(i))

{ error codes for `lua_load' and `lua_pcall' }

LUA_ERRRUN = 1;

LUA_ERRFILE = 2;

LUA_ERRSYNTAX = 3;

LUA_ERRMEM = 4;

LUA_ERRERR = 5;

// typedef struct lua_State lua_State;

type

lua_CFunction = function(L: lua_state): int;

{

** functions that read/write blocks when loading/dumping Lua chunks

}

lua_Chunkreader = function(L: lua_State; ud: pointer; sz: size_t): pchar;

lua_Chunkwriter = function(L: lua_State; p: pointer; sz: size_t; ud: pointer):

int;

{

** basic types

}

const

LUA_TNONE = -1;

LUA_TNIL = 0;

LUA_TBOOLEAN = 1;

LUA_TLIGHTUSERDATA = 2;

LUA_TNUMBER = 3;

LUA_TSTRING = 4;

LUA_TTABLE = 5;

LUA_TFUNCTION = 6;

LUA_TUSERDATA = 7;

LUA_TTHREAD = 8;

{ minimum Lua stack available to a C function }

LUA_MINSTACK = 20;

{

** generic extra include file

}

{ type of numbers in Lua }

type

lua_Number = double;

{

** state manipulation

}

function lua_open: lua_State; stdcall; external Luadll;

procedure lua_close(L: lua_State); stdcall; external Luadll;

function lua_newthread(L: lua_State): lua_State; stdcall; external Luadll;

function lua_atpanic(L: lua_State; panicf: lua_CFunction): lua_CFunction;

stdcall; external Luadll;

{

** basic stack manipulation

}

function lua_gettop(L: lua_State): int; stdcall; external Luadll;

procedure lua_settop(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_pushvalue(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_remove(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_insert(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_replace(L: lua_State; idx: int); stdcall; external Luadll;

function lua_checkstack(L: lua_State; sz: int): int; stdcall; external Luadll;

procedure lua_xmove(fromls: lua_State; tols: lua_State; n: int); stdcall;

external

Luadll;

{

** access functions (stack -> C)

}

function lua_isnumber(L: lua_State; idx: int): int; stdcall; external Luadll;

function lua_isstring(L: lua_State; idx: int): int; stdcall; external Luadll;

function lua_iscfunction(L: lua_State; idx: int): int; stdcall; external Luadll;

function lua_isuserdata(L: lua_State; idx: int): int; stdcall; external Luadll;

function lua_type(L: lua_State; idx: int): int; stdcall; external Luadll;

function lua_typename(L: lua_State; tp: int): pchar; stdcall; external Luadll;

function lua_equal(L: lua_State; idx1: int; idx2: int): int; stdcall; external

Luadll;

function lua_rawequal(L: lua_State; idx1: int; idx2: int): int; stdcall; external

Luadll;

function lua_lessthan(L: lua_State; idx1: int; idx2: int): int; stdcall; external

Luadll;

function lua_tonumber(L: lua_State; idx: int): lua_Number; stdcall; external

Luadll;

function lua_toboolean(L: lua_State; idx: int): int; stdcall; external Luadll;

function lua_tostring(L: lua_State; idx: int): pchar; stdcall; external Luadll;

function lua_strlen(L: lua_State; idx: int): size_t; stdcall; external Luadll;

function lua_tocfunction(L: lua_State; idx: int): lua_CFunction; stdcall;

external Luadll;

procedure lua_touserdata(L: lua_State; idx: int); stdcall; external Luadll;

function lua_tothread(L: lua_State; idx: int): lua_State; stdcall; external

Luadll;

procedure lua_topointer(L: lua_State; idx: int); stdcall; external Luadll;

{

** push functions (C -> stack)

}

procedure lua_pushnil(L: lua_State); stdcall; external Luadll;

procedure lua_pushnumber(L: lua_State; n: lua_Number); stdcall; external Luadll;

procedure lua_pushlstring(L: lua_State; s: pchar; st: size_t); stdcall; external

Luadll;

procedure lua_pushstring(L: lua_State; s: pchar); stdcall; external Luadll;

function lua_pushvfstring(L: lua_State; fmt: pchar; argp: va_list): pchar;

stdcall; external Luadll;

function lua_pushfstring(L: lua_State; fmt: pchar): pchar; stdcall; external

Luadll;

procedure lua_pushcclosure(L: lua_State; fn: lua_CFunction; n: int); stdcall;

external Luadll;

procedure lua_pushboolean(L: lua_State; b: int); stdcall; external Luadll;

procedure lua_pushlightuserdata(L: lua_State; p: pointer); stdcall; external

Luadll;

{

** get functions (Lua -> stack)

}

procedure lua_gettable(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_rawget(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_rawgeti(L: lua_State; idx: int; n: int); stdcall; external Luadll;

procedure lua_newtable(L: lua_State); stdcall; external Luadll;

procedure lua_newuserdata(L: lua_State; sz: size_t); stdcall; external Luadll;

function lua_getmetatable(L: lua_State; objindex: int): int; stdcall; external

Luadll;

procedure lua_getfenv(L: lua_State; idx: int); stdcall; external Luadll;

{

** set functions (stack -> Lua)

}

procedure lua_settable(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_rawset(L: lua_State; idx: int); stdcall; external Luadll;

procedure lua_rawseti(L: lua_State; idx: int; n: int); stdcall; external Luadll;

function lua_setmetatable(L: lua_State;

objindex: int): int; stdcall; external Luadll;

function lua_setfenv(L: lua_State; idx: int): int; stdcall; external Luadll;

{

** `load' and `call' functions (load and run Lua code)

}

procedure lua_call(L: lua_State; nargs: int;

nresults: int); stdcall; external Luadll;

function lua_pcall(L: lua_State; nargs: int; nresults: int;

errfunc: int): int; stdcall; external Luadll;

function lua_cpcall(L: lua_State; func: lua_CFunction;

ud: pointer): int; stdcall; external Luadll;

function lua_load(L: lua_State; reader: lua_Chunkreader; dt: pointer;

chunkname: pchar): int; stdcall; external Luadll;

function lua_dump(L: lua_State; writer: lua_Chunkwriter;

data: pointer): int; stdcall; external Luadll;

{

** coroutine functions

}

function lua_yield(L: lua_State; nresults: int): int; stdcall; external Luadll;

function lua_resume(L: lua_State; narg: int): int; stdcall; external Luadll;

{

** garbage-collection functions

}

function lua_getgcthreshold(L: lua_State): int; stdcall; external Luadll;

function lua_getgccount(L: lua_State): int; stdcall; external Luadll;

procedure lua_setgcthreshold(L: lua_State; newthreshold: int); stdcall; external

Luadll;

{

** miscellaneous functions

}

function lua_version: pchar; stdcall; external Luadll;

function lua_error(L: lua_State): int; stdcall; external Luadll;

function lua_next(L: lua_State; idx: int): int; stdcall; external Luadll;

procedure lua_concat(L: lua_State; n: int); stdcall; external Luadll;

{

** ===============================================================

** some useful macros

** ===============================================================

}

{

#DEFfine lua_boxpointer(L, u) (*(void **)(lua_newuserdata(L, sizeof(void * ))) = (u))

#DEFfine lua_unboxpointer(L, i) (*(void **)(lua_touserdata(L, i)))

#DEFfine lua_pop(L, n)lua_settop(L, -(n) - 1)

#DEFfine lua_register(L, n, f)(lua_pushstring(L, n), lua_pushcfunction(L, f), lua_settable(L, LUA_GLOBALSINDEX))

#DEFine lua_pushcfunction(L, f)lua_pushcclosure(L, f, 0)

#DEFine lua_isfunction(L, n)(lua_type(L, n) = = LUA_TFUNCTION)

#DEFine lua_istable(L, n)(lua_type(L, n) = = LUA_TTABLE)

#DEFine lua_islightuserdata(L, n)(lua_type(L, n) = = LUA_TLIGHTUSERDATA)

#DEFine lua_isnil(L, n)(lua_type(L, n) = = LUA_TNIL)

#DEFine lua_isboolean(L, n)(lua_type(L, n) = = LUA_TBOOLEAN)

#DEFine lua_isnone(L, n)(lua_type(L, n) = = LUA_TNONE)

#DEFine lua_isnoneornil(L, n)(lua_type(L, n) <= 0)

#DEFine lua_pushliteral(L, s)lua_pushlstring(L, "" s, (sizeof(s) / sizeof(char)) - 1)

}

{

** compatibility macros and functions

}

function lua_pushupvalues(L: lua_State): int; stdcall; external Luadll;

{

** MACRO Functions

}

procedure lua_getregistry(L: lua_state);

procedure lua_setglobal(L: lua_state; s: pchar);

procedure lua_getglobal(L: lua_state; s: pchar);

{ compatibility with ref system }

{ pre-defined references }

const

LUA_NOREF = -2;

LUA_REFNIL = -1;

{

#DEF ine lua_ref(L, lock)((lock)? luaL_ref(L, LUA_REGISTRYINDEX): (lua_pushstring(L, "unlocked references are obsolete"), lua_error(L), 0))

#DEF ine lua_unref(L, ref)luaL_unref(L, LUA_REGISTRYINDEX, (ref))

#DEF ine lua_getref(L, ref)lua_rawgeti(L, LUA_REGISTRYINDEX, ref)

}

{

** {======================================================================

** useful definitions for Lua kernel and libraries

** =======================================================================

}

{ formats for Lua numbers }

const

LUA_NUMBER_SCAN = '%lf';

LUA_NUMBER_FMT = '%.14 g';

{ = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =

= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = }

{

** {======================================================================

** Debug API

** =======================================================================

}

{

** Event codes

}

LUA_HOOKCALL = 0;

LUA_HOOKRET = 1;

LUA_HOOKLINE = 2;

LUA_HOOKCOUNT = 3;

LUA_HOOKTAILRET = 4;

{

** Event masks

}

LUA_MASKCALL = (1 shl LUA_HOOKCALL);

LUA_MASKRET = (1 shl LUA_HOOKRET);

LUA_MASKLINE = (1 shl LUA_HOOKLINE);

LUA_MASKCOUNT = (1 shl LUA_HOOKCOUNT);

LUA_IDSIZE = 60;

type

lua_Debug = record

event: int;

name: pchar; // (n)

namewhat: pchar; // (n) `global', `local', `field', `method'

what: pchar; /// (S) `Lua', `C', `main', `tail'

source: pchar; // (S)

currentline: int; // (l)

nups: int; // (u) number of upvalues

linedefined: int; // (S)

short_src: array[0..LUA_IDSIZE] of char; // (S)

// private part

i_ci: int; // active function

end;

lua_Hook = procedure(L: lua_state; ar: lua_debug);

function lua_getstack(L: lua_State; level: int;

ar: lua_Debug): int; stdcall; external Luadll;

function lua_getinfo(L: lua_State; what: pchar;

ar: lua_Debug): int; stdcall; external Luadll;

function lua_getlocal(L: lua_State; ar: lua_Debug;

n: int): pchar; stdcall; external Luadll;

function lua_setlocal(L: lua_State; ar: lua_Debug;

n: int): pchar; stdcall; external Luadll;

function lua_getupvalue(L: lua_State; funcindex: int;

n: int): pchar; stdcall; external Luadll;

function lua_setupvalue(L: lua_State; funcindex: int;

n: int): pchar; stdcall; external Luadll;

function lua_sethook(L: lua_State; func: lua_Hook; mask: int;

count: int): int; stdcall; external Luadll;

function lua_gethook(L: lua_State): lua_Hook; stdcall; external Luadll;

function lua_gethookmask(L: lua_State): int; stdcall; external Luadll;

function lua_gethookcount(L: lua_State): int; stdcall; external Luadll;

var

luaState: lua_state;

luaDebug: lua_Debug; { activation record }

implementation

procedure lua_getregistry(L: lua_state);

begin

lua_pushvalue(L, LUA_REGISTRYINDEX);

end;

procedure lua_setglobal(L: lua_state; s: pchar);

begin

lua_pushstring(L, s);

lua_insert(L, -2);

lua_settable(L, LUA_GLOBALSINDEX);

end;

procedure lua_getglobal(L: lua_state; s: pchar);

begin

lua_pushstring(L, s);

lua_gettable(L, LUA_GLOBALSINDEX);

end;

end.

{ ====================================================================== }

{*****************************************************************************

* Copyright (C) 1994-2004 Tecgraf, PUC-Rio. All rights reserved.

*

* Permission is hereby granted, free of charge, to any person obtaining

* a copy of this software and associated documentation files (the

* "Software"), to deal in the Software without restriction, including

* without limitation the rights to use, copy, modify, merge, publish,

* distribute, sublicense, and/or sell copies of the Software, and to

* permit persons to whom the Software is furnished to do so, subject to

* the following conditions:

*

* The above copyright notice and this permission notice shall be

* included in all copies or substantial portions of the Software.

*

* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,

* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF

* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.

* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY

* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,

* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE

* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

*****************************************************************************}

 
 
 
免责声明:本文为网络用户发布,其观点仅代表作者个人观点,与本站无关,本站仅提供信息存储服务。文中陈述内容未经本站证实,其真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。
2023年上半年GDP全球前十五强
 百态   2023-10-24
美众议院议长启动对拜登的弹劾调查
 百态   2023-09-13
上海、济南、武汉等多地出现不明坠落物
 探索   2023-09-06
印度或要将国名改为“巴拉特”
 百态   2023-09-06
男子为女友送行,买票不登机被捕
 百态   2023-08-20
手机地震预警功能怎么开?
 干货   2023-08-06
女子4年卖2套房花700多万做美容:不但没变美脸,面部还出现变形
 百态   2023-08-04
住户一楼被水淹 还冲来8头猪
 百态   2023-07-31
女子体内爬出大量瓜子状活虫
 百态   2023-07-25
地球连续35年收到神秘规律性信号,网友:不要回答!
 探索   2023-07-21
全球镓价格本周大涨27%
 探索   2023-07-09
钱都流向了那些不缺钱的人,苦都留给了能吃苦的人
 探索   2023-07-02
倩女手游刀客魅者强控制(强混乱强眩晕强睡眠)和对应控制抗性的关系
 百态   2020-08-20
美国5月9日最新疫情:美国确诊人数突破131万
 百态   2020-05-09
荷兰政府宣布将集体辞职
 干货   2020-04-30
倩女幽魂手游师徒任务情义春秋猜成语答案逍遥观:鹏程万里
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案神机营:射石饮羽
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案昆仑山:拔刀相助
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案天工阁:鬼斧神工
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案丝路古道:单枪匹马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:与虎谋皮
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:李代桃僵
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案镇郊荒野:指鹿为马
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:小鸟依人
 干货   2019-11-12
倩女幽魂手游师徒任务情义春秋猜成语答案金陵:千金买邻
 干货   2019-11-12
 
推荐阅读
 
 
 
>>返回首頁<<
 
靜靜地坐在廢墟上,四周的荒凉一望無際,忽然覺得,淒涼也很美
© 2005- 王朝網路 版權所有