1  #include <stdlib.h>
       2  #include <string.h>
       3  
       4  #include <ISO_Fortran_binding.h>
       5  #include "dump-descriptors.h"
       6  
       7  extern void ctest (CFI_cdesc_t *a, int n);
       8  extern void ftest (CFI_cdesc_t *a, int n);
       9  
      10  void
      11  ctest (CFI_cdesc_t *a, int n)
      12  {
      13    /* Dump the descriptor contents to test that we can access the fields
      14       correctly, etc.  */
      15    dump_CFI_cdesc_t (a);
      16  
      17    /* The actual argument object on the Fortran side has length n and
      18       was passed as character(len=*).
      19       Make sure that matches what's in the descriptor.  */
      20    if (!a->base_addr)
      21      abort ();
      22    if (a->elem_len != n)
      23      abort ();
      24    if (a->rank != 0)
      25      abort ();
      26    if (a->type != CFI_type_char)
      27      abort ();
      28    if (a->attribute != CFI_attribute_other)
      29      abort ();
      30    ftest (a, n);
      31  }