X-Git-Url: https://git.jsancho.org/?a=blobdiff_plain;f=src%2Fdriver-types.cpp;h=fef8547b35c11e33e52cf59df7b72b4a14b36881;hb=79e12d94cc21232477796a4e76fc2ddb5d88f9dc;hp=886d40d4f55eee55d2a71315ff991a34b6dfc465;hpb=2806f03eafc48ec9ef02a3dc2d74133eaf11ccc1;p=guile-irrlicht.git diff --git a/src/driver-types.cpp b/src/driver-types.cpp index 886d40d..fef8547 100644 --- a/src/driver-types.cpp +++ b/src/driver-types.cpp @@ -23,41 +23,44 @@ #include #include "driver-types.h" -extern "C" { - - irr::video::E_DRIVER_TYPE - scm_to_driver_type (SCM driver_type) - { - char* driverType = scm_to_utf8_stringn (scm_symbol_to_string (driver_type), NULL); - if (!strcmp (driverType, "null")) - { - return irr::video::EDT_NULL; - } - else if (!strcmp (driverType, "software")) - { - return irr::video::EDT_SOFTWARE; - } - else if (!strcmp (driverType, "burnings")) - { - return irr::video::EDT_BURNINGSVIDEO; - } - else if (!strcmp (driverType, "direct3d8")) - { - return irr::video::EDT_DIRECT3D8; - } - else if (!strcmp (driverType, "direct3d9")) - { - return irr::video::EDT_DIRECT3D9; - } - else if (!strcmp (driverType, "opengl")) - { - return irr::video::EDT_OPENGL; - } - else - { - scm_error (scm_arg_type_key, NULL, "Wrong driver type: ~S", - scm_list_1 (driver_type), scm_list_1 (driver_type)); - } - } +using namespace irr; +video::E_DRIVER_TYPE +scm_to_driver_type (SCM driver_type) +{ + char* type_name = scm_to_utf8_string (scm_symbol_to_string (driver_type)); + video::E_DRIVER_TYPE type; + + if (!strcmp (type_name, "null")) + { + type = video::EDT_NULL; + } + else if (!strcmp (type_name, "software")) + { + type = video::EDT_SOFTWARE; + } + else if (!strcmp (type_name, "burnings")) + { + type = video::EDT_BURNINGSVIDEO; + } + else if (!strcmp (type_name, "direct3d8")) + { + type = video::EDT_DIRECT3D8; + } + else if (!strcmp (type_name, "direct3d9")) + { + type = video::EDT_DIRECT3D9; + } + else if (!strcmp (type_name, "opengl")) + { + type = video::EDT_OPENGL; + } + else + { + scm_error (scm_arg_type_key, NULL, "Wrong driver type: ~S", + scm_list_1 (driver_type), scm_list_1 (driver_type)); + } + + free (type_name); + return type; }