C language simple table function conversion

The code from the C language scalar function can be reused as a simple table function by making minor modifications to the registration.

Code

The code is the same as found in the C language scalar function section.

Compilation

Compilation is the same as the one performed in local or remote modes.
$NZ_EXPORT_DIR/ae/utilities/bin/compile_ae --language system --version 3 \
--template compile func.c --exe apply

Registration

Register the executables by using the modified command, which changes --template and --return to be appropriate for a table function:
$NZ_EXPORT_DIR/ae/utilities/bin/register_ae --language system --version 3 \
--template udtf --exe apply --sig "tapplyop_c(VARARGS)" \
--return "TABLE (D double)"

Running

The AE can now be run in SQL:
SELECT * FROM TABLE WITH FINAL(tapplyop_c('+',1,2));
D
---
3
(1 row)