#include <stdio.h>
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>

#include "crs.h"

/*
**  Used in the WKT parser to build up lists of parts structs.
*/
typedef struct
{
	int         type; /* PARTLIST */
	int         num_parts;
	PART*   parts[CRS_MAX_PARAMS];
} PARTLIST;

/*
** Prototypes for CRS building
*/
char *crs_string_make(char *str);
PARTLIST *crs_partlist_make(void);
void crs_partlist_add_part(PARTLIST *partlist, PART *part);
AUTHORITY *crs_authority_make(char *auth_name, char *auth_id, char *auth_description);
UNIT *crs_unit_make(char *unit_name, double unit_conversion, AUTHORITY *unit_auth);
PRIMEM *crs_primem_make(char *primem_name, double primem_origin, AUTHORITY *primem_auth);
SPHEROID *crs_spheroid_make(char *spheroid_name, double spheroid_semimajor, double spheroid_invflattening, AUTHORITY *spheroid_auth);
TOWGS84 *crs_towgs84_make(int wgs84_num_params, double *wgs84_params);
DATUM *crs_datum_make(char *datum_name, SPHEROID *datum_spheroid, TOWGS84 *datum_towgs84, AUTHORITY *datum_auth);
DATUM *crs_datum_make_from_partlist(char *datum_name, PARTLIST *datum_partlist);
AXIS *crs_axis_make(char *axis_name, char *axis_type);
GEOGCS *crs_geogcs_make(char *geogcs_name, DATUM *geogcs_datum, PRIMEM *geogcs_primem, AXIS *geogcs_axis0, AXIS *geogcs_axis1, UNIT *geogcs_unit, AUTHORITY *geogcs_auth);
GEOGCS *crs_geogcs_make_from_partlist(char *geogcs_name, PARTLIST *geogcs_partlist);
PROJECTION *crs_projection_make(char *projection_name, AUTHORITY *projection_auth);
PARAMETER *crs_parameter_make(char *parameter_name, double parameter_value);
PROJCS *crs_projcs_make(PROJECTION *projcs_projection, int projcs_num_parameters, PARAMETER *projcs_parameters, AXIS *projcs_axis0, AXIS *projcs_axis1, UNIT *projcs_unit, AUTHORITY *projcs_auth);
PROJCS *crs_projcs_make_from_partlist(char *projcs_name, PARTLIST *projcs_partlist);
