infix
A JIT-Powered FFI Library for C
Loading...
Searching...
No Matches
203_complex.c File Reference

Tests FFI calls with C _Complex types. More...

#include "common/double_tap.h"
#include "types.h"
#include <complex.h>
#include <infix/infix.h>
#include <math.h>
Include dependency graph for 203_complex.c:

Macros

#define DBLTAP_IMPLEMENTATION
 

Typedefs

typedef double _Complex complex_double_t
 

Functions

complex_double_t c_add (complex_double_t a, complex_double_t b)
 
complex_double_t c_mul (complex_double_t a, complex_double_t b)
 
complex_double_t callback_c_add (complex_double_t a, complex_double_t b)
 
void execute_complex_callback (complex_double_t(*func_ptr)(complex_double_t, complex_double_t), complex_double_t val_a, complex_double_t val_b, complex_double_t expected_val)
 
 if (!ok(status==INFIX_SUCCESS, "Successfully created infix_type for double _Complex"))
 
 subtest ("Forward call with _Complex arguments and return")
 
 subtest ("Reverse call (callback) with _Complex types")
 
 subtest ("Round trip signature parsing")
 
 infix_arena_destroy (arena)
 

Variables

 TEST
 
infix_arena_tarena = infix_arena_create(4096)
 
infix_typecomplex_double_type = NULL
 
infix_status status
 

Detailed Description

Tests FFI calls with C _Complex types.

Copyright (c) 2025 Sanko Robinson

This source code is dual-licensed under the Artistic License 2.0 or the MIT License. You may choose to use this code under the terms of either license.

SPDX-License-Identifier: (Artistic-2.0 OR MIT)

The documentation blocks within this file are licensed under the Creative Commons Attribution 4.0 International License (CC BY 4.0).

SPDX-License-Identifier: CC-BY-4.0

Macro Definition Documentation

◆ DBLTAP_IMPLEMENTATION

#define DBLTAP_IMPLEMENTATION

Typedef Documentation

◆ complex_double_t

typedef double _Complex complex_double_t

Function Documentation

◆ c_add()

◆ c_mul()

◆ callback_c_add()

complex_double_t callback_c_add ( complex_double_t  a,
complex_double_t  b 
)

◆ execute_complex_callback()

void execute_complex_callback ( complex_double_t(*)(complex_double_t, complex_double_t func_ptr,
complex_double_t  val_a,
complex_double_t  val_b,
complex_double_t  expected_val 
)

◆ if()

if ( okstatus==INFIX_SUCCESS, "Successfully created infix_type for double _Complex")

◆ infix_arena_destroy()

infix_arena_destroy ( arena  )

◆ subtest() [1/3]

subtest ( "Forward call with _Complex arguments and return"  )

◆ subtest() [2/3]

subtest ( "Reverse call (callback) with _Complex types"  )

◆ subtest() [3/3]

subtest ( "Round trip signature parsing"  )

Variable Documentation

◆ arena

◆ complex_double_type

infix_type* complex_double_type = NULL

◆ status

infix_status status
Initial value:
=
infix_type * complex_double_type
Definition 203_complex.c:61
infix_arena_t * arena
Definition 203_complex.c:58
c23_nodiscard infix_status infix_type_create_complex(infix_arena_t *, infix_type **, infix_type *)
Creates a new infix_type for a _Complex number from an arena.
Definition types.c:324
c23_nodiscard infix_type * infix_type_create_primitive(infix_primitive_type_id)
Creates an infix_type descriptor for a primitive C type.
Definition types.c:97
@ INFIX_PRIMITIVE_DOUBLE
double
Definition infix.h:146

◆ TEST

TEST
Initial value:
{
plan(4)
#define plan(count)
Definition double_tap.h:132