This enshrines the current testsuite practice of using ffi_arg for
authorAlan Modra <amodra@gmail.com>
Wed, 13 Nov 2013 21:55:36 +0000 (16:55 -0500)
committerAnthony Green <green@moxielogic.com>
Wed, 13 Nov 2013 21:55:36 +0000 (16:55 -0500)
returned values.  It would be reasonable and logical to use the actual
return argument type as passed to ffi_prep_cif, but this would mean
changing a large number of tests that use ffi_arg and all backends
that write results to an ffi_arg.

ChangeLog
doc/libffi.info
doc/libffi.texi
doc/stamp-vti
doc/version.texi

index 3cb6188d4b446dac1f3126d714f4f1abc324d1f4..806af1809555111b0fb188f3fffebc67caf7feaf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-11-13  Alan Modra  <amodra@gmail.com>
+
+       * doc/libffi.texi (Simple Example): Correct example code.
+       * doc/libffi.info, doc/stamp-vti, doc/version.texi: Rebuilt.
+
 2013-11-13  Anthony Green  <green@moxielogic.com>
 
        * include/ffi_common.h: Respect HAVE_ALLOCA_H for GNU compiler
index fb02d37bddf2daf1d324eb1056c12f190c99041a..4d42f5be1dac7305efa0c08b0c9a18952ef771e6 100644 (file)
@@ -186,7 +186,7 @@ Here is a trivial example that calls 'puts' a few times.
        ffi_type *args[1];
        void *values[1];
        char *s;
-       int rc;
+       ffi_arg rc;
 
        /* Initialize the argument info vectors */
        args[0] = &ffi_type_pointer;
@@ -194,7 +194,7 @@ Here is a trivial example that calls 'puts' a few times.
 
        /* Initialize the cif */
        if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
-                      &ffi_type_uint, args) == FFI_OK)
+                      &ffi_type_sint, args) == FFI_OK)
          {
            s = "Hello World!";
            ffi_call(&cif, puts, &rc, values);
@@ -363,6 +363,7 @@ The following example initializes a 'ffi_type' object representing the
            int i;
 
            tm_type.size = tm_type.alignment = 0;
+           tm_type.type = FFI_TYPE_STRUCT;
            tm_type.elements = &tm_type_elements;
 
            for (i = 0; i < 9; i++)
@@ -477,7 +478,7 @@ A trivial example that creates a new 'puts' by binding 'fputs' with
      #include <ffi.h>
 
      /* Acts like puts with the file given at time of enclosure. */
-     void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[],
+     void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[],
                        FILE *stream)
      {
        *ret = fputs(*(char **)args[0], stream);
@@ -502,7 +503,7 @@ A trivial example that creates a new 'puts' by binding 'fputs' with
 
            /* Initialize the cif */
            if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
-                            &ffi_type_uint, args) == FFI_OK)
+                            &ffi_type_sint, args) == FFI_OK)
              {
                /* Initialize the closure, setting stream to stdout */
                if (ffi_prep_closure_loc(closure, &cif, puts_binding,
@@ -602,14 +603,14 @@ Node: Introduction\7f1429
 Node: Using libffi\7f3061
 Node: The Basics\7f3547
 Node: Simple Example\7f7198
-Node: Types\7f8225
-Node: Primitive Types\7f8508
-Node: Structures\7f10329
-Node: Type Example\7f11203
-Node: Multiple ABIs\7f12426
-Node: The Closure API\7f12797
-Node: Closure Example\7f15741
-Node: Missing Features\7f17300
-Node: Index\7f17753
+Node: Types\7f8229
+Node: Primitive Types\7f8512
+Node: Structures\7f10333
+Node: Type Example\7f11207
+Node: Multiple ABIs\7f12473
+Node: The Closure API\7f12844
+Node: Closure Example\7f15788
+Node: Missing Features\7f17342
+Node: Index\7f17795
 \1f
 End Tag Table
index eca11dc35a7aa57c71d87f937b2e70cce78f15e1..d13c5c028e76336163a18aaab701908dd2e9a09c 100644 (file)
@@ -214,7 +214,7 @@ int main()
   ffi_type *args[1];
   void *values[1];
   char *s;
-  int rc;
+  ffi_arg rc;
   
   /* Initialize the argument info vectors */    
   args[0] = &ffi_type_pointer;
@@ -222,7 +222,7 @@ int main()
   
   /* Initialize the cif */
   if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1, 
-                      &ffi_type_uint, args) == FFI_OK)
+                      &ffi_type_sint, args) == FFI_OK)
     @{
       s = "Hello World!";
       ffi_call(&cif, puts, &rc, values);
@@ -414,6 +414,7 @@ Here is the corresponding code to describe this struct to
       int i;
 
       tm_type.size = tm_type.alignment = 0;
+      tm_type.type = FFI_TYPE_STRUCT;
       tm_type.elements = &tm_type_elements;
     
       for (i = 0; i < 9; i++)
@@ -540,7 +541,7 @@ A trivial example that creates a new @code{puts} by binding
 #include <ffi.h>
 
 /* Acts like puts with the file given at time of enclosure. */
-void puts_binding(ffi_cif *cif, unsigned int *ret, void* args[], 
+void puts_binding(ffi_cif *cif, ffi_arg *ret, void* args[], 
                   FILE *stream)
 @{
   *ret = fputs(*(char **)args[0], stream);
@@ -565,7 +566,7 @@ int main()
 
       /* Initialize the cif */
       if (ffi_prep_cif(&cif, FFI_DEFAULT_ABI, 1,
-                       &ffi_type_uint, args) == FFI_OK)
+                       &ffi_type_sint, args) == FFI_OK)
         @{
           /* Initialize the closure, setting stream to stdout */
           if (ffi_prep_closure_loc(closure, &cif, puts_binding, 
index fbdde9bc66b22a6ed08bfca1b911a0c8d4a19b40..3c7f7b217f233d0b78e762a8ff3c5341c8963c89 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 2 July 2013
-@set UPDATED-MONTH July 2013
+@set UPDATED 13 November 2013
+@set UPDATED-MONTH November 2013
 @set EDITION 3.0.14-rc0
 @set VERSION 3.0.14-rc0
index fbdde9bc66b22a6ed08bfca1b911a0c8d4a19b40..3c7f7b217f233d0b78e762a8ff3c5341c8963c89 100644 (file)
@@ -1,4 +1,4 @@
-@set UPDATED 2 July 2013
-@set UPDATED-MONTH July 2013
+@set UPDATED 13 November 2013
+@set UPDATED-MONTH November 2013
 @set EDITION 3.0.14-rc0
 @set VERSION 3.0.14-rc0