1+ /******************************************************************************
2+ This file contains routines that can be bound to a Postgres backend and
3+ called by the backend in the process of processing queries. The calling
4+ format for these routines is dictated by Postgres architecture.
5+ ******************************************************************************/
6+
17#include <stdio.h>
28/* do not include libpq-fe.h for backend-loaded functions*/
39/* #include "libpq-fe.h" */
@@ -11,6 +17,20 @@ typedef struct Complex {
1117double y ;
1218}Complex ;
1319
20+ /* These prototypes declare the requirements that Postgres places on these
21+ user written functions.
22+ */
23+ Complex * complex_in (char * str );
24+ char * complex_out (Complex * complex );
25+ Complex * complex_add (Complex * a ,Complex * b );
26+ bool complex_abs_lt (Complex * a ,Complex * b );
27+ bool complex_abs_le (Complex * a ,Complex * b );
28+ bool complex_abs_eq (Complex * a ,Complex * b );
29+ bool complex_abs_ge (Complex * a ,Complex * b );
30+ bool complex_abs_gt (Complex * a ,Complex * b );
31+ int4 complex_abs_cmp (Complex * a ,Complex * b );
32+
33+
1434/*****************************************************************************
1535 * Input/Output functions
1636 *****************************************************************************/
@@ -48,7 +68,7 @@ complex_out(Complex *complex)
4868return (NULL );
4969
5070result = (char * )palloc (60 );
51- sprintf (result ,"(%lg,%lg )" ,complex -> x ,complex -> y );
71+ sprintf (result ,"(%g,%g )" ,complex -> x ,complex -> y );
5272return (result );
5373}
5474
@@ -131,6 +151,7 @@ complex_abs_cmp(Complex *a, Complex *b)
131151 * POSTGRES crashing, it is impossible to tell whether the bug is in your
132152 * code or POSTGRES's.
133153 */
154+ void test_main (void );
134155void
135156test_main ()
136157{