diff options
| author | Mike Pall <mike> | 2012-07-17 22:20:03 +0200 |
|---|---|---|
| committer | Mike Pall <mike> | 2012-07-17 22:22:07 +0200 |
| commit | 4d9c29a78cde2596ea3286744d93d29dd2a6d9ca (patch) | |
| tree | 62af9fd2c6765a06005f8fa8ed00a1b491c0a356 /doc | |
| parent | 2139c6791f4b802560ce62dc688293786803a9ca (diff) | |
| download | luajit-4d9c29a78cde2596ea3286744d93d29dd2a6d9ca.tar.gz luajit-4d9c29a78cde2596ea3286744d93d29dd2a6d9ca.tar.bz2 luajit-4d9c29a78cde2596ea3286744d93d29dd2a6d9ca.zip | |
FFI: Box all accessed or returned enums.
Diffstat (limited to 'doc')
| -rw-r--r-- | doc/ext_ffi_semantics.html | 23 |
1 files changed, 16 insertions, 7 deletions
diff --git a/doc/ext_ffi_semantics.html b/doc/ext_ffi_semantics.html index ed32d23f..afe7e613 100644 --- a/doc/ext_ffi_semantics.html +++ b/doc/ext_ffi_semantics.html | |||
| @@ -250,19 +250,20 @@ constant values; retrieving return values from C calls: | |||
| 250 | <tr class="even separate"> | 250 | <tr class="even separate"> |
| 251 | <td class="convin"><tt>bool</tt></td><td class="convop">0 → <tt>false</tt>, otherwise <tt>true</tt></td><td class="convout">boolean</td></tr> | 251 | <td class="convin"><tt>bool</tt></td><td class="convop">0 → <tt>false</tt>, otherwise <tt>true</tt></td><td class="convout">boolean</td></tr> |
| 252 | <tr class="odd separate"> | 252 | <tr class="odd separate"> |
| 253 | <td class="convin">Complex number</td><td class="convop">boxed value</td><td class="convout">complex cdata</td></tr> | 253 | <td class="convin"><tt>enum</tt></td><td class="convop">boxed value</td><td class="convout">enum cdata</td></tr> |
| 254 | <tr class="even"> | 254 | <tr class="even"> |
| 255 | <td class="convin">Vector</td><td class="convop">boxed value</td><td class="convout">vector cdata</td></tr> | 255 | <td class="convin">Complex number</td><td class="convop">boxed value</td><td class="convout">complex cdata</td></tr> |
| 256 | <tr class="odd"> | 256 | <tr class="odd"> |
| 257 | <td class="convin">Vector</td><td class="convop">boxed value</td><td class="convout">vector cdata</td></tr> | ||
| 258 | <tr class="even"> | ||
| 257 | <td class="convin">Pointer</td><td class="convop">boxed value</td><td class="convout">pointer cdata</td></tr> | 259 | <td class="convin">Pointer</td><td class="convop">boxed value</td><td class="convout">pointer cdata</td></tr> |
| 258 | <tr class="even separate"> | 260 | <tr class="odd separate"> |
| 259 | <td class="convin">Array</td><td class="convop">boxed reference</td><td class="convout">reference cdata</td></tr> | 261 | <td class="convin">Array</td><td class="convop">boxed reference</td><td class="convout">reference cdata</td></tr> |
| 260 | <tr class="odd"> | 262 | <tr class="even"> |
| 261 | <td class="convin"><tt>struct</tt>/<tt>union</tt></td><td class="convop">boxed reference</td><td class="convout">reference cdata</td></tr> | 263 | <td class="convin"><tt>struct</tt>/<tt>union</tt></td><td class="convop">boxed reference</td><td class="convout">reference cdata</td></tr> |
| 262 | </table> | 264 | </table> |
| 263 | <p> | 265 | <p> |
| 264 | Bitfields or <tt>enum</tt> types are treated like their underlying | 266 | Bitfields are treated like their underlying type. |
| 265 | type. | ||
| 266 | </p> | 267 | </p> |
| 267 | <p> | 268 | <p> |
| 268 | Reference types are dereferenced <em>before</em> a conversion can take | 269 | Reference types are dereferenced <em>before</em> a conversion can take |
| @@ -715,6 +716,10 @@ is performed. Otherwise both sides are converted to an | |||
| 715 | <tt>int64_t</tt> and a signed arithmetic operation is performed. The | 716 | <tt>int64_t</tt> and a signed arithmetic operation is performed. The |
| 716 | result is a boxed 64 bit cdata object.<br> | 717 | result is a boxed 64 bit cdata object.<br> |
| 717 | 718 | ||
| 719 | If one of the operands is an <tt>enum</tt> and the other operand is a | ||
| 720 | string, the string is converted to the value of a matching <tt>enum</tt> | ||
| 721 | constant before the above conversion.<br> | ||
| 722 | |||
| 718 | These rules ensure that 64 bit integers are "sticky". Any | 723 | These rules ensure that 64 bit integers are "sticky". Any |
| 719 | expression involving at least one 64 bit integer operand results | 724 | expression involving at least one 64 bit integer operand results |
| 720 | in another one. The undefined cases for the division, modulo and power | 725 | in another one. The undefined cases for the division, modulo and power |
| @@ -740,7 +745,11 @@ cdata number and a Lua number can be compared with each other. If one | |||
| 740 | of them is an <tt>uint64_t</tt>, the other side is converted to an | 745 | of them is an <tt>uint64_t</tt>, the other side is converted to an |
| 741 | <tt>uint64_t</tt> and an unsigned comparison is performed. Otherwise | 746 | <tt>uint64_t</tt> and an unsigned comparison is performed. Otherwise |
| 742 | both sides are converted to an <tt>int64_t</tt> and a signed | 747 | both sides are converted to an <tt>int64_t</tt> and a signed |
| 743 | comparison is performed.</li> | 748 | comparison is performed.<br> |
| 749 | |||
| 750 | If one of the operands is an <tt>enum</tt> and the other operand is a | ||
| 751 | string, the string is converted to the value of a matching <tt>enum</tt> | ||
| 752 | constant before the above conversion.<br> | ||
| 744 | 753 | ||
| 745 | <li><b>Comparisons for equality/inequality</b> never raise an error. | 754 | <li><b>Comparisons for equality/inequality</b> never raise an error. |
| 746 | Even incompatible pointers can be compared for equality by address. Any | 755 | Even incompatible pointers can be compared for equality by address. Any |
