LuaConf.pas 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. (*
  2. ** $Id: LuaConf.pas,v 1.1 2006-11-21 00:36:22 jfgoulet Exp $
  3. ** Configuration file for Lua
  4. ** See Copyright Notice in lua.h
  5. **
  6. ** Translation form C and Delphi adaptation of Code :
  7. ** Massimo Magnano, Jean-Francois Goulet 2006
  8. *)
  9. unit luaconf;
  10. interface
  11. type
  12. ptrdiff_t = Integer;
  13. (*
  14. @@ LUA_INTEGER is the integral type used by lua_pushinteger/lua_tointeger.
  15. ** CHANGE that if ptrdiff_t is not adequate on your machine. (On most
  16. ** machines, ptrdiff_t gives a good choice between int or long.)
  17. *)
  18. LUA_INTEGER = ptrdiff_t;
  19. const
  20. (*
  21. @@ LUA_IDSIZE gives the maximum size for the description of the source
  22. @* of a function in debug information.
  23. ** CHANGE it if you want a different size.
  24. *)
  25. LUA_IDSIZE = 60;
  26. (*
  27. @@ LUA_COMPAT_OPENLIB controls compatibility with old 'luaL_openlib'
  28. @* behavior.
  29. ** CHANGE it to undefined as soon as you replace to 'luaL_registry'
  30. ** your uses of 'luaL_openlib'
  31. *)
  32. {$define LUA_COMPAT_OPENLIB}
  33. (*
  34. @@ LUAL_BUFFERSIZE is the buffer size used by the lauxlib buffer system.
  35. *)
  36. BUFSIZ = 1024;
  37. LUAL_BUFFERSIZE = BUFSIZ;
  38. (* }================================================================== *)
  39. (*
  40. @@ LUA_PROMPT is the default prompt used by stand-alone Lua.
  41. @@ LUA_PROMPT2 is the default continuation prompt used by stand-alone Lua.
  42. ** CHANGE them if you want different prompts. (You can also change the
  43. ** prompts dynamically, assigning to globals _PROMPT/_PROMPT2.)
  44. *)
  45. const
  46. LUA_PROMPT = '> ';
  47. LUA_PROMPT2 = '>> ';
  48. type
  49. (*
  50. ** {==================================================================
  51. @@ LUA_NUMBER is the type of numbers in Lua.
  52. ** CHANGE the following definitions only if you want to build Lua
  53. ** with a number type different from double. You may also need to
  54. ** change lua_number2int & lua_number2integer.
  55. ** ===================================================================
  56. *)
  57. {$define LUA_NUMBER_DOUBLE}
  58. LUA_NUMBER = Double;
  59. const
  60. (*
  61. @@ LUA_NUMBER_SCAN is the format for reading numbers.
  62. @@ LUA_NUMBER_FMT is the format for writing numbers.
  63. @@ lua_number2str converts a number to a string.
  64. @@ LUAI_MAXNUMBER2STR is maximum size of previous conversion.
  65. @@ lua_str2number converts a string to a number.
  66. *)
  67. LUA_NUMBER_SCAN = '%lf';
  68. LUA_NUMBER_FMT = '%.14g';
  69. (*
  70. @@ lua_readline defines how to show a prompt and then read a line from
  71. @* the standard input.
  72. @@ lua_saveline defines how to "save" a read line in a "history".
  73. @@ lua_freeline defines how to free a line read by lua_readline.
  74. ** CHANGE them if you want to improve this functionality (e.g., by using
  75. ** GNU readline and history facilities).
  76. function lua_readline(L : Plua_State; var b : PChar; p : PChar): Boolean;
  77. procedure lua_saveline(L : Plua_State; idx : Integer);
  78. procedure lua_freeline(L : Plua_State; b : PChar);
  79. *)
  80. const
  81. lua_stdin_is_tty = TRUE;
  82. implementation
  83. (*
  84. function lua_readline(L : Plua_State; var b : PChar; p : PChar): Boolean;
  85. var
  86. s : String;
  87. begin
  88. Write(p); // show prompt
  89. ReadLn(s); // get line
  90. b := PChar(s); // and return it
  91. result := (b[0] <> #4); // test for ctrl-D
  92. end;
  93. procedure lua_saveline(L : Plua_State; idx : Integer);
  94. begin
  95. end;
  96. procedure lua_freeline(L : Plua_State; b : PChar);
  97. begin
  98. end;
  99. *)
  100. end.