/* Vars extension test */ #include #include /* Type declaration */ #include "ext1.c" /* Functions */ extern vtype *complex_declare(void); extern vcomplex *complex_copy(vcomplex *c); extern int complex_next(viter *iter); extern vcomplex *complex_create(double real, double imag); extern void complex_print(vcomplex *c, FILE *fp); extern vcomplex *complex_read(FILE *fp); extern int complex_write(vcomplex *c, FILE *fp); extern int complex_freeze(vcomplex *c, FILE *fp); extern vcomplex *complex_thaw(FILE *fp); extern void complex_destroy(vcomplex *c); extern int complex_traverse(vcomplex *c, int (*func)()); /* Create function */ #include "ext2.c" /* Print function */ #include "ext3.c" /* Read/write functions */ #include "ext4.c" #include "ext5.c" /* Traverse function */ #include "ext6.c" /* Destroy function */ #include "ext7.c" /* Copy function */ #include "ext8.c" /* Iteration function */ #include "ext9.c" #define WRITE int main(void) { vcomplex *c; viter i; #ifdef WRITE c = complex_create(1.2, 2.5); v_freeze(c, stdout); v_iterate(c, i) printf("%g\n", i.dval[0]); #else complex_declare(); if ((c = v_thaw(stdin)) != NULL) v_print(c, stdout); else v_die("Error: %s", v_thaw_error()); #endif return 0; }