#ifndef VRMLREADERINTERNALS_H
#define VRMLREADERINTERNALS_H

#include <stdio.h>


enum
{
	VRML_READER_OK,
	VRML_READER_KO
};


#define NODE_CHECK_ASSERT(NODE_TYPE) \
	GraphNode *node = builder->getCurrentNode(); \
	if (node == NULL) \
	{ \
		std::cerr << __FILE__ << "[" << __LINE__ << "]: NODE_CHECK_ASSERT()" << std::endl; \
		return VRML_READER_KO; \
	} \
	if (node->getType() != NODE_TYPE) \
	{ \
		std::cerr << __FILE__ << "[" << __LINE__ << "]: NODE_CHECK_ASSERT()" << std::endl; \
		return VRML_READER_KO; \
	}


#ifdef __cplusplus
extern "C"
{
#endif
	extern FILE *VRMLReader_in;
	extern int VRMLReader_parse(void);
	extern int VRMLReader_restart(FILE *fd);

	int VRMLReader_lex(void);
	void VRMLReader_error(const char *error);

	int VRMLReader_GraphNode_setNodeName(char *name);
	int VRMLReader_GraphNode_addDefReference(char *name);
	int VRMLReader_GraphNode_resolveUseReference(char *name);

	int VRMLReader_Group_new(void);
	int VRMLReader_Group_finish(void);

	int VRMLReader_Transform_new(void);
	int VRMLReader_Transform_finish(void);
	int VRMLReader_Transform_setCenter(double x, double y, double z);
	int VRMLReader_Transform_setRotation(double rx, double ry, double rz, double angle);
	int VRMLReader_Transform_setTranslation(double x, double y, double z);

	int VRMLReader_Material_new(void);
	int VRMLReader_Material_finish(void);
	int VRMLReader_Material_setDiffuseColor(double r, double g, double b);
	int VRMLReader_Material_setEmissiveColor(double r, double g, double b);
	int VRMLReader_Material_setSpecularColor(double r, double g, double b);
	int VRMLReader_Material_setAmbientIntensity(double intensity);
	int VRMLReader_Material_setTransparency(double transparency);
	int VRMLReader_Material_setShininess(double shininess);

	int VRMLReader_VertexArray_new(void);
	int VRMLReader_VertexArray_finish(void);
	int VRMLReader_VertexArray_addVertexArrayEntry(double x, double y, double z);
	int VRMLReader_VertexArray_addVertexIndexEntry(int a, int b, int c);
	int VRMLReader_VertexArray_addNormalArrayEntry(double x, double y, double z);
	int VRMLReader_VertexArray_addNormalIndexEntry(int a, int b, int c);
	int VRMLReader_VertexArray_setNormalPerVertex(int status);
#ifdef __cplusplus
}
#endif


#endif

