示例#1
0
//---------------------------------------------------------------------------------
// Purpose: Look for tokens in a string begining with { and ending with }
//---------------------------------------------------------------------------------
void	ParseSubstituteStrings
(
 player_t	*player,
 const char	*in_string,
 char	*out_string
)
{
	int in_index = 0;
	int	out_index = 0;
	int	token_length;
	char	*out_token;
	char	*substitute_token;

	Q_strcpy(out_string, "");
	if (!in_string) return;

	while (in_string[in_index] != '\0')
	{
		bool	substituted = false;
		if (in_string[in_index] == '{')
		{
			out_token = GetSubToken(&(in_string[in_index]), &token_length);
			if (out_token && !FStrEq(out_token,""))
			{
				substitute_token = TranslateToken(player, out_token);
				if (substitute_token && !FStrEq(substitute_token,""))
				{
					int	substitute_length = Q_strlen(substitute_token);

					in_index += token_length;

					for (int j = 0; j < substitute_length; j++)
					{
						out_string[out_index] = substitute_token[j];
						out_index ++;
					}

					substituted = true;
				}
			}
		}

		if (!substituted)
		{
			out_string[out_index] = in_string[in_index];
			in_index ++;
			out_index ++;
		}
	}

	out_string[out_index] = '\0';

	return;
}
示例#2
0
文件: main.c 项目: ARSekkat/gpac
void WriteNodeCode(GF_List *BNodes, FILE *vrml_code)
{
	char token[20], tok[20];
	char *store;
	u32 i, j, k, go;
	X3DField *bf;
	X3DNode *n;

	fprintf(vrml_code, "\n#include <gpac/nodes_x3d.h>\n");
	fprintf(vrml_code, "\n#include <gpac/internal/scenegraph_dev.h>\n");
	fprintf(vrml_code, "\n/*for NDT tag definitions*/\n#include <gpac/nodes_mpeg4.h>\n");
	fprintf(vrml_code, "#ifndef GPAC_DISABLE_X3D\n\n");

	for (k=0; k<gf_list_count(BNodes); k++) {
		Bool is_parent = 0;
		n = gf_list_get(BNodes, k);
		if (n->skip_impl) continue;
		fprintf(vrml_code, "\n/*\n\t%s Node deletion\n*/\n\n", n->name);
		fprintf(vrml_code, "static void %s_Del(GF_Node *node)\n{\n\tX_%s *p = (X_%s *) node;\n", n->name, n->name, n->name);

		for (i=0; i<gf_list_count(n->Fields); i++) {
			bf = gf_list_get(n->Fields, i);
			//nothing on child events
			if (!strcmp(bf->name, "addChildren")) continue;
			if (!strcmp(bf->name, "removeChildren")) continue;

			//delete all children node
			if (strcmp(bf->type, "eventOut") && !strcmp(bf->name, "children")) {
				is_parent = 1;
				continue;
			}

			//delete ALL fields that must be deleted: this includes eventIn and out since
			//all fields are defined in the node
			if (!strcmp(bf->familly, "MFInt")
			        || !strcmp(bf->familly, "MFFloat")
			        || !strcmp(bf->familly, "MFDouble")
			        || !strcmp(bf->familly, "MFBool")
			        || !strcmp(bf->familly, "MFInt32")
			        || !strcmp(bf->familly, "MFColor")
			        || !strcmp(bf->familly, "MFRotation")
			        || !strcmp(bf->familly, "MFString")
			        || !strcmp(bf->familly, "MFTime")
			        || !strcmp(bf->familly, "MFVec2f")
			        || !strcmp(bf->familly, "MFVec3f")
			        || !strcmp(bf->familly, "MFVec4f")
			        || !strcmp(bf->familly, "MFVec2d")
			        || !strcmp(bf->familly, "MFVec3d")
			        || !strcmp(bf->familly, "MFURL")
			        || !strcmp(bf->familly, "MFScript")
			        || !strcmp(bf->familly, "SFString")
			        || !strcmp(bf->familly, "SFURL")
			        || !strcmp(bf->familly, "SFImage")
					|| !strcmp(bf->familly, "MFColorRGBA")

			   ) {
				char szName[500];
				strcpy(szName, bf->familly);
				strlwr(szName);
				fprintf(vrml_code, "\tgf_sg_%s_del(p->%s);\n", szName, bf->name);
			} else if (strstr(bf->familly, "Node")) {
				//this is a POINTER to a node
				if (strstr(bf->familly, "SF")) {
					fprintf(vrml_code, "\tgf_node_unregister((GF_Node *) p->%s, node);\t\n", bf->name);
				} else {
					//this is a POINTER to a chain
					fprintf(vrml_code, "\tgf_node_unregister_children(node, p->%s);\t\n", bf->name);
				}
			}
		}
		if (is_parent)
			fprintf(vrml_code, "\tgf_sg_vrml_parent_destroy(node);\t\n");
		/*avoids gcc warnings in case no field to delete*/
		fprintf(vrml_code, "\tgf_node_free((GF_Node *)p);\n}\n\n");

		//node fields
		WriteNodeFields(vrml_code, n);

		//
		//		Constructor
		//

		fprintf(vrml_code, "\n\nstatic GF_Node *%s_Create()\n{\n\tX_%s *p;\n\tGF_SAFEALLOC(p, X_%s);\n", n->name, n->name, n->name);
		fprintf(vrml_code, "\tif(!p) return NULL;\n");
		fprintf(vrml_code, "\tgf_node_setup((GF_Node *)p, TAG_X3D_%s);\n", n->name);

		for (i=0; i<gf_list_count(n->Fields); i++) {
			bf = gf_list_get(n->Fields, i);
			//setup all children node
			if (strcmp(bf->type, "eventOut") && !strcmp(bf->name, "children")) {
				fprintf(vrml_code, "\tgf_sg_vrml_parent_setup((GF_Node *) p);\n");
				break;
			}
			else if ( strstr(bf->familly, "Node") && strncmp(bf->type, "event", 5) ) {
				//this is a POINTER to a node
				if (strstr(bf->familly, "MF")) {
					//this is a POINTER to a chain
					//fprintf(vrml_code, "\tp->%s = gf_list_new();\t\n", bf->name);
				}
			}
			/*special case for SFCommandBuffer: we also create a command list*/
			if (!stricmp(bf->familly, "SFCommandBuffer")) {
				fprintf(vrml_code, "\tp->%s.commandList = gf_list_new();\t\n", bf->name);
			}
		}

		fprintf(vrml_code, "\n\t/*default field values*/\n");

		for (i=0; i<gf_list_count(n->Fields); i++) {
			bf = gf_list_get(n->Fields, i);

			//nothing on eventIn or Out
			if (!strcmp(bf->type, "eventIn")) continue;
			if (!strcmp(bf->type, "eventOut")) continue;

			if (!strcmp(bf->def, "")) continue;

			//no default on nodes
			if (strstr(bf->familly, "Node")) continue;
			//extract default falue

			//
			//		SF Fields
			//

			//SFBool
			if (!strcmp(bf->familly, "SFBool")) {
				if (!strcmp(bf->def, "1") || !strcmp(bf->def, "TRUE"))
					fprintf(vrml_code, "\tp->%s = 1;\n", bf->name);
			}
			//SFFloat
			else if (!strcmp(bf->familly, "SFFloat")) {
				fprintf(vrml_code, "\tp->%s = FLT2FIX(%s);\n", bf->name, bf->def);
			}
			//SFDouble
			else if (!strcmp(bf->familly, "SFDouble")) {
				fprintf(vrml_code, "\tp->%s = (SFDouble) %s;\n", bf->name, bf->def);
			}
			//SFTime
			else if (!strcmp(bf->familly, "SFTime")) {
				fprintf(vrml_code, "\tp->%s = %s;\n", bf->name, bf->def);
			}
			//SFInt32
			else if (!strcmp(bf->familly, "SFInt32")) {
				fprintf(vrml_code, "\tp->%s = %s;\n", bf->name, bf->def);
			}
			//SFColor
			else if (!strcmp(bf->familly, "SFColor")) {
				CurrentLine = bf->def;
				GetNextToken(token, " ");
				TranslateToken(token);

				fprintf(vrml_code, "\tp->%s.red = FLT2FIX(%s);\n", bf->name, token);
				GetNextToken(token, " ");
				fprintf(vrml_code, "\tp->%s.green = FLT2FIX(%s);\n", bf->name, token);
				GetNextToken(token, " ");
				fprintf(vrml_code, "\tp->%s.blue = FLT2FIX(%s);\n", bf->name, token);
			}
			//SFVec2f
			else if (!strcmp(bf->familly, "SFVec2f")) {
				CurrentLine = bf->def;
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.x = FLT2FIX(%s);\n", bf->name, token);
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.y = FLT2FIX(%s);\n", bf->name, token);
			}
			//SFVec2d
			else if (!strcmp(bf->familly, "SFVec2d")) {
				CurrentLine = bf->def;
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.x = (SFDouble) %s;\n", bf->name, token);
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.y = (SFDouble) %s;\n", bf->name, token);
			}
			//SFVec3f
			else if (!strcmp(bf->familly, "SFVec3f")) {
				CurrentLine = bf->def;
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.x = FLT2FIX(%s);\n", bf->name, token);
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.y = FLT2FIX(%s);\n", bf->name, token);
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.z = FLT2FIX(%s);\n", bf->name, token);
			}
			//SFVec3d
			else if (!strcmp(bf->familly, "SFVec3d")) {
				CurrentLine = bf->def;
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.x = (SFDouble) %s;\n", bf->name, token);
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.y = (SFDouble) %s;\n", bf->name, token);
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.z = (SFDouble) %s;\n", bf->name, token);
			}
			//SFVec4f & SFRotation
			else if (!strcmp(bf->familly, "SFVec4f") || !strcmp(bf->familly, "SFRotation")) {
				CurrentLine = bf->def;
				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.x = FLT2FIX(%s);\n", bf->name, token);

				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.y = FLT2FIX(%s);\n", bf->name, token);

				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.z = FLT2FIX(%s);\n", bf->name, token);

				GetNextToken(token, " ");
				TranslateToken(token);
				fprintf(vrml_code, "\tp->%s.q = FLT2FIX(%s);\n", bf->name, token);
			}
			//SFString
			else if (!strcmp(bf->familly, "SFString")) {
				fprintf(vrml_code, "\tp->%s.buffer = (char*) gf_malloc(sizeof(char) * %d);\n", bf->name, strlen(bf->def)+1);
				fprintf(vrml_code, "\tstrcpy(p->%s.buffer, \"%s\");\n", bf->name, bf->def);
			}

			//
			//		MF Fields
			//
			//MFFloat
			else if (!strcmp(bf->familly, "MFFloat")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, " ,")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFFloat *)gf_malloc(sizeof(SFFloat)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, " ,")) go = 0;
					TranslateToken(token);
					fprintf(vrml_code, "\tp->%s.vals[%d] = FLT2FIX(%s);\n", bf->name, j, token);
					j+=1;
				}
			}
			//MFDouble
			else if (!strcmp(bf->familly, "MFDouble")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, " ,")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFFloat*)gf_malloc(sizeof(SFFloat)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, " ,")) go = 0;
					TranslateToken(token);
					fprintf(vrml_code, "\tp->%s.vals[%d] = (SFDouble) %s;\n", bf->name, j, token);
					j+=1;
				}
			}
			//MFVec2f
			else if (!strcmp(bf->familly, "MFVec2f")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFVec2f*) gf_malloc(sizeof(SFVec2f)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].x = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].y = FLT2FIX(%s);\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFVec2d
			else if (!strcmp(bf->familly, "MFVec2d")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFVec2f*)gf_malloc(sizeof(SFVec2f)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].x = (SFDouble) %s;\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].y = (SFDouble) %s;\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFVec3f
			else if (!strcmp(bf->familly, "MFVec3f")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFVec3f*)gf_malloc(sizeof(SFVec3f)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].x = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].y = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].z = FLT2FIX(%s);\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFVec3d
			else if (!strcmp(bf->familly, "MFVec3d")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFVec2f*)gf_malloc(sizeof(SFVec3f)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].x = (SFDouble) %s;\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].y = (SFDouble) %s;\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].z = (SFDouble) %s;\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFVec4f & MFRotation
			else if (!strcmp(bf->familly, "MFVec4f") || !strcmp(bf->familly, "MFRotation")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (GF_Vec4*)gf_malloc(sizeof(GF_Vec4)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].x = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].y = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].z = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d].q = FLT2FIX(%s);\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFInt32
			else if (!strcmp(bf->familly, "MFInt32")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFInt32*)gf_malloc(sizeof(SFInt32)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " ");
					fprintf(vrml_code, "\tp->%s.vals[%d] = %s;\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFColor
			else if (!strcmp(bf->familly, "MFColor")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFColor*)gf_malloc(sizeof(SFColor)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " ");
					fprintf(vrml_code, "\tp->%s.vals[%d].red = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					fprintf(vrml_code, "\tp->%s.vals[%d].green = FLT2FIX(%s);\n", bf->name, j, tok);
					GetNextToken(tok, " ");
					fprintf(vrml_code, "\tp->%s.vals[%d].blue = FLT2FIX(%s);\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFString
			else if (!strcmp(bf->familly, "MFString")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (char**)gf_malloc(sizeof(SFString)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " \"");
					fprintf(vrml_code, "\tp->%s.vals[%d] = (char*)gf_malloc(sizeof(char) * %d);\n", bf->name, j, strlen(tok)+1);
					fprintf(vrml_code, "\tstrcpy(p->%s.vals[%d], \"%s\");\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}
			//MFTime
			else if (!strcmp(bf->familly, "MFTime")) {
				j = 0;
				CurrentLine = bf->def;
				while (GetNextToken(token, ",")) j++;
				j+=1;
				fprintf(vrml_code, "\tp->%s.vals = (SFTime*)gf_malloc(sizeof(SFTime)*%d);\n", bf->name, j);
				fprintf(vrml_code, "\tp->%s.count = %d;\n", bf->name, j);
				j = 0;
				go = 1;
				CurrentLine = bf->def;
				while (go) {
					if (!GetNextToken(token, ",")) go = 0;
					store = CurrentLine;
					CurrentLine = token;
					GetNextToken(tok, " \"");
					TranslateToken(tok);
					fprintf(vrml_code, "\tp->%s.vals[%d] = %s;\n", bf->name, j, tok);
					j+=1;
					CurrentLine = store;
				}
			}

			//other nodes
			else if (!strcmp(bf->familly, "SFImage")) {
				//we currently only have SFImage, with NO texture so do nothing
			}
			//unknown init (for debug)
			else {
				fprintf(vrml_code, "UNKNOWN FIELD (%s);\n", bf->familly);

			}
		}
		fprintf(vrml_code, "\treturn (GF_Node *)p;\n}\n\n");

	}

	fprintf(vrml_code, "\n\n\n");

	//creator function
	fprintf(vrml_code, "GF_Node *gf_sg_x3d_node_new(u32 NodeTag)\n{\n\tswitch (NodeTag) {\n");
	for (i=0; i<gf_list_count(BNodes); i++) {
		n = gf_list_get(BNodes, i);
		if (!n->skip_impl) fprintf(vrml_code, "\tcase TAG_X3D_%s:\n\t\treturn %s_Create();\n", n->name, n->name);
	}
	fprintf(vrml_code, "\tdefault:\n\t\treturn NULL;\n\t}\n}\n\n");

	fprintf(vrml_code, "const char *gf_sg_x3d_node_get_class_name(u32 NodeTag)\n{\n\tswitch (NodeTag) {\n");
	for (i=0; i<gf_list_count(BNodes); i++) {
		n = gf_list_get(BNodes, i);
		if (!n->skip_impl) fprintf(vrml_code, "\tcase TAG_X3D_%s:\n\t\treturn \"%s\";\n", n->name, n->name);
	}
	fprintf(vrml_code, "\tdefault:\n\t\treturn \"Unknown Node\";\n\t}\n}\n\n");

	fprintf(vrml_code, "void gf_sg_x3d_node_del(GF_Node *node)\n{\n\tswitch (node->sgprivate->tag) {\n");
	for (i=0; i<gf_list_count(BNodes); i++) {
		n = gf_list_get(BNodes, i);
		if (!n->skip_impl) fprintf(vrml_code, "\tcase TAG_X3D_%s:\n\t\t%s_Del(node); return;\n", n->name, n->name);
	}
	fprintf(vrml_code, "\tdefault:\n\t\treturn;\n\t}\n}\n\n");

	fprintf(vrml_code, "u32 gf_sg_x3d_node_get_field_count(GF_Node *node)\n{\n\tswitch (node->sgprivate->tag) {\n");
	for (i=0; i<gf_list_count(BNodes); i++) {
		n = gf_list_get(BNodes, i);
		if (!n->skip_impl) fprintf(vrml_code, "\tcase TAG_X3D_%s:return %s_get_field_count(node, 0);\n", n->name, n->name);
	}
	fprintf(vrml_code, "\tdefault:\n\t\treturn 0;\n\t}\n}\n\n");

	fprintf(vrml_code, "GF_Err gf_sg_x3d_node_get_field(GF_Node *node, GF_FieldInfo *field)\n{\n\tswitch (node->sgprivate->tag) {\n");
	for (i=0; i<gf_list_count(BNodes); i++) {
		n = gf_list_get(BNodes, i);
		if (!n->skip_impl) fprintf(vrml_code, "\tcase TAG_X3D_%s: return %s_get_field(node, field);\n", n->name, n->name);
	}
	fprintf(vrml_code, "\tdefault:\n\t\treturn GF_BAD_PARAM;\n\t}\n}\n\n");

	fprintf(vrml_code, "\nu32 gf_node_x3d_type_by_class_name(const char *node_name)\n{\n\tif(!node_name) return 0;\n");
	for (i=0; i<gf_list_count(BNodes); i++) {
		n = gf_list_get(BNodes, i);
		if (!n->skip_impl) fprintf(vrml_code, "\tif (!strcmp(node_name, \"%s\")) return TAG_X3D_%s;\n", n->name, n->name);
	}
	fprintf(vrml_code, "\treturn 0;\n}\n\n");

	fprintf(vrml_code, "s32 gf_sg_x3d_node_get_field_index_by_name(GF_Node *node, char *name)\n{\n\tswitch (node->sgprivate->tag) {\n");
	for (i=0; i<gf_list_count(BNodes); i++) {
		n = gf_list_get(BNodes, i);
		if (!n->skip_impl) {
			fprintf(vrml_code, "\tcase TAG_X3D_%s: return %s_get_field_index_by_name(name);\n", n->name, n->name);
		}
	}
	fprintf(vrml_code, "\tdefault:\n\t\treturn -1;\n\t}\n}\n\n");

}