#ifndef _POLY_H_ #define _POLY_H_ #include #include "list.h" typedef List Polynomial; /* Call this function to initialize the polynomial. Yet another constructor-wannabe. */ void poly_initialize(Polynomial *); /* Reads a polynomial from the provided file. The polynomial should be a list of "c e" pairs, where c is the coefficient and e is the exponent, and the e's are in sorted order. A coefficient of 0 terminates the polynomial. */ void poly_read(Polynomial *, FILE *); /* Writes a polynomial in user-readable format to the specified file. */ void poly_write(Polynomial *, FILE *); /* This function makes a copy of a polynomial. The first argument is the source and the second the destination. */ void poly_copy(Polynomial *src, Polynomial *dest); /* This function adds the first two polynomial argument and returns their sum through the third argument. */ void poly_add(Polynomial *op1, Polynomial *op2, Polynomial *result); /* This function multiplies the first two polynomial argument and returns their product through the third argument. */ void poly_multiply(Polynomial *op1, Polynomial *op2, Polynomial *result); /* This function frees the memory held by a polynomial. */ void poly_destroy(Polynomial *); #endif