lua头文件的pas翻译_lua.h

2016-02-19 18:51 16 1 收藏

下面请跟着图老师小编一起来了解下lua头文件的pas翻译_lua.h,精心挑选的内容希望大家喜欢,不要忘记点个赞哦!

【 tulaoshi.com - 编程语言 】

 {
    ** $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;

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)

    //  #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;

(本文来源于图老师网站,更多请访问http://www.tulaoshi.com/bianchengyuyan/)

  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.
  *****************************************************************************}
  

来源:http://www.tulaoshi.com/n/20160219/1619236.html

延伸阅读
传统 C++ #include assert.h //设定插入点 #include ctype.h//字符处理 #include errno.h//定义错误码 !-- frame contents -- !-- /frame contents -- #include float.h//浮点数处理 #include fstream.h//文件输入/输出 #include iomanip.h//参数化输入/输出 #include ...
标签: 电脑入门
如何用WPS制作红头文件 撰写行政公文是办公室工作人员必备的工作技能之一,公文的撰写过程大体分为文头、正文、落款等三大部分。其中文头制作最繁琐,下面就通过WPS文字,告诉大家怎样轻松掌握公文的文头制作技巧。 一、设置边框 首先,通过插入→分隔符→连续分隔符命令,将正文与文头区域分割成两节。然后鼠标左键单击文件...
  C++ Builder是最快的C++编译器之一,从编译速度来说也可以说是最快的win32C++编译器了。除了速度之外,C++builder的性能也在其它C++编译器的之上,但许多Delphi程序员仍受不了C++builder工程的编译速度。的确,delphi的速度要比任和c++的编译器都要快好多。Delphi在编译一个小工程的时候可能不到一秒,大的工程一般也在5秒钟...
  [原文] That is correct. A BPL is a DLL. (But not all DLLs are BPLs.) But I still found some different, such as that I can create a object from the Host exe and that pass to a BPL and modify it safely, but if I do same to a dll, I can not modify any referenced property of the...
因刚接触VC++的开发,需要对C++一些原理性的东西进行掌握。特别是对源文件和头文件的概念,需要深入对它了解: 关于头文件和源文件的分别 首先,我们可以将所有东西都放在一个.cpp文件内. 然后编译器就将这个.cpp编译成.obj,obj是什么东西? 就是编译单元了.一个程序,可以由一个编译单元组成,也可以有多个编译单元组成. 如果你不想让你的源...

经验教程

414

收藏

70
微博分享 QQ分享 QQ空间 手机页面 收藏网站 回到头部