From a5aade2fa9ff89f9f3c4a91261071299de0d0fa4 Mon Sep 17 00:00:00 2001 From: Mike Pall Date: Fri, 11 Feb 2011 01:21:46 +0100 Subject: FFI: Finish FFI docs. --- doc/ext_ffi_semantics.html | 40 +++++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 15 deletions(-) (limited to 'doc/ext_ffi_semantics.html') diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index b2b3af30..69dfc2ca 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html @@ -39,8 +39,6 @@ td.convop { font-style: italic; width: 16em; }
  • ffi.* API
  • -64 bit Integers -
  • FFI Semantics
  • @@ -653,7 +651,10 @@ parameters given by the function declaration. Arguments passed to the variable argument part of vararg C function use special conversion rules. This C function is called and the return value (if any) is -converted to a Lua object.
  • +converted to a Lua object.
    +On Windows/x86 systems, stdcall functions are automatically +detected and a function declared as cdecl (the default) is +silently fixed up after the first call. @@ -672,15 +673,24 @@ can be subtracted. The result is the difference between their addresses, divided by the element size in bytes. An error is raised if the element size is undefined or zero. -
  • 64 bit integer arithmetic: -the standard arithmetic operators -(+ - * / % ^ and unary -) -can be applied to two cdata numbers, or a cdata number and a Lua -number. If one of them is an uint64_t, the other side is +
  • 64 bit integer arithmetic: the standard arithmetic +operators (+ - * / % ^ and unary +minus) can be applied to two cdata numbers, or a cdata number and a +Lua number. If one of them is an uint64_t, the other side is converted to an uint64_t and an unsigned arithmetic operation is performed. Otherwise both sides are converted to an int64_t and a signed arithmetic operation is performed. The -result is a boxed 64 bit cdata object.
  • +result is a boxed 64 bit cdata object.
    + +These rules ensure that 64 bit integers are "sticky". Any +expression involving at least one 64 bit integer operand results +in another one. The undefined cases for the division, modulo and power +operators return 2LL ^ 63 or +2ULL ^ 63.
    + +You'll have to explicitly convert a 64 bit integer to a Lua +number (e.g. for regular floating-point calculations) with +tonumber(). But note this may incur a precision loss. @@ -692,12 +702,12 @@ can be compared. The result is the same as an unsigned comparison of their addresses. nil is treated like a NULL pointer, which is compatible with any other pointer type. -
  • 64 bit integer comparison: -two cdata numbers, or a cdata number and a Lua number can be compared -with each other. If one of them is an uint64_t, the other -side is converted to an uint64_t and an unsigned comparison -is performed. Otherwise both sides are converted to an -int64_t and a signed comparison is performed.
  • +
  • 64 bit integer comparison: two cdata numbers, or a +cdata number and a Lua number can be compared with each other. If one +of them is an uint64_t, the other side is converted to an +uint64_t and an unsigned comparison is performed. Otherwise +both sides are converted to an int64_t and a signed +comparison is performed.
  • -- cgit v1.2.3-55-g6feb