scene::E_PRIMITIVE_TYPE
scm_to_primitive_type (SCM primitive_type)
{
- char* type = scm_to_utf8_stringn (scm_symbol_to_string (primitive_type), NULL);
- if (!strcmp (type, "points"))
+ char* type_name = scm_to_utf8_string (scm_symbol_to_string (primitive_type));
+ scene::E_PRIMITIVE_TYPE type;
+
+ if (!strcmp (type_name, "points"))
{
- return scene::EPT_POINTS;
+ type = scene::EPT_POINTS;
}
- else if (!strcmp (type, "line-strip"))
+ else if (!strcmp (type_name, "line-strip"))
{
- return scene::EPT_LINE_STRIP;
+ type = scene::EPT_LINE_STRIP;
}
- else if (!strcmp (type, "line-loop"))
+ else if (!strcmp (type_name, "line-loop"))
{
- return scene::EPT_LINE_LOOP;
+ type = scene::EPT_LINE_LOOP;
}
- else if (!strcmp (type, "lines"))
+ else if (!strcmp (type_name, "lines"))
{
- return scene::EPT_LINES;
+ type = scene::EPT_LINES;
}
- else if (!strcmp (type, "triangle-strip"))
+ else if (!strcmp (type_name, "triangle-strip"))
{
- return scene::EPT_TRIANGLE_STRIP;
+ type = scene::EPT_TRIANGLE_STRIP;
}
- else if (!strcmp (type, "triangle-fan"))
+ else if (!strcmp (type_name, "triangle-fan"))
{
- return scene::EPT_TRIANGLE_FAN;
+ type = scene::EPT_TRIANGLE_FAN;
}
- else if (!strcmp (type, "triangles"))
+ else if (!strcmp (type_name, "triangles"))
{
- return scene::EPT_TRIANGLES;
+ type = scene::EPT_TRIANGLES;
}
- else if (!strcmp (type, "quad-strip"))
+ else if (!strcmp (type_name, "quad-strip"))
{
- return scene::EPT_QUAD_STRIP;
+ type = scene::EPT_QUAD_STRIP;
}
- else if (!strcmp (type, "quads"))
+ else if (!strcmp (type_name, "quads"))
{
- return scene::EPT_QUADS;
+ type = scene::EPT_QUADS;
}
- else if (!strcmp (type, "polygon"))
+ else if (!strcmp (type_name, "polygon"))
{
- return scene::EPT_POLYGON;
+ type = scene::EPT_POLYGON;
}
- else if (!strcmp (type, "point-sprites"))
+ else if (!strcmp (type_name, "point-sprites"))
{
- return scene::EPT_POINT_SPRITES;
+ type = scene::EPT_POINT_SPRITES;
}
else
{
scm_error (scm_arg_type_key, NULL, "Wrong primitive type: ~S",
scm_list_1 (primitive_type), scm_list_1 (primitive_type));
}
+
+ free (type_name);
+ return type;
}