From a079c41de6a7504e579b425820beef21579e530e Mon Sep 17 00:00:00 2001 From: Javier Sancho Date: Tue, 28 Apr 2020 09:27:02 +0200 Subject: [PATCH] Use SCM_UNDEFINED for undefined arguments --- src/device.cpp | 4 ++-- src/file-system.cpp | 4 ++-- src/gui-environment.cpp | 44 ++++++++++++++++++++--------------------- src/gui-toolbar.cpp | 16 +++++++-------- src/scene-manager.cpp | 30 ++++++++++++++-------------- src/video-driver.cpp | 4 ++-- 6 files changed, 51 insertions(+), 51 deletions(-) diff --git a/src/device.cpp b/src/device.cpp index 939685e..3b4dc10 100644 --- a/src/device.cpp +++ b/src/device.cpp @@ -61,7 +61,7 @@ extern "C" { SCM fullscreen = SCM_BOOL_F; SCM stencilbuffer = SCM_BOOL_F; SCM vsync = SCM_BOOL_F; - SCM receiver = SCM_BOOL_F; + SCM receiver = SCM_UNDEFINED; scm_c_bind_keyword_arguments ("create-device", rest, (scm_t_keyword_arguments_flags)0, scm_from_utf8_keyword ("device-type"), &device_type, @@ -80,7 +80,7 @@ extern "C" { scm_to_bool (fullscreen), scm_to_bool (stencilbuffer), scm_to_bool (vsync), - scm_is_false (receiver) ? 0 : unwrap_event_receiver (receiver)); + receiver == SCM_UNDEFINED ? 0 : unwrap_event_receiver (receiver)); return wrap_device (device); } diff --git a/src/file-system.cpp b/src/file-system.cpp index 4c643ae..44171b3 100644 --- a/src/file-system.cpp +++ b/src/file-system.cpp @@ -52,7 +52,7 @@ extern "C" { SCM ignore_paths = SCM_BOOL_T; SCM archive_type = scm_from_utf8_symbol ("unknown"); SCM password = scm_from_utf8_string (""); - SCM ret_archive = SCM_BOOL_F; + SCM ret_archive = SCM_UNDEFINED; scm_c_bind_keyword_arguments ("add-file-archive!", rest, (scm_t_keyword_arguments_flags)0, scm_from_utf8_keyword ("ignore-case"), &ignore_case, @@ -63,7 +63,7 @@ extern "C" { SCM_UNDEFINED); irr::io::IFileArchive** retArchiveReference = 0; - if (!scm_is_false (ret_archive)) + if (ret_archive != SCM_UNDEFINED) { irr::io::IFileArchive* retArchive = unwrap_file_archive (ret_archive); retArchiveReference = &retArchive; diff --git a/src/gui-environment.cpp b/src/gui-environment.cpp index aa1ccde..87fe38d 100644 --- a/src/gui-environment.cpp +++ b/src/gui-environment.cpp @@ -85,9 +85,9 @@ extern "C" { SCM rest) { SCM use_alpha_channel = SCM_BOOL_T; - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); - SCM text = SCM_BOOL_F; + SCM text = SCM_UNDEFINED; scm_c_bind_keyword_arguments ("add-image!", rest, (scm_t_keyword_arguments_flags)0, scm_from_utf8_keyword ("use_alpha_channel"), &use_alpha_channel, @@ -101,9 +101,9 @@ extern "C" { guienv->addImage (unwrap_texture (image), scm_to_position2d_s32 (position), scm_to_bool (use_alpha_channel), - scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent), scm_to_int32 (id), - scm_is_false (text) ? 0 : scm_to_wide_char_string (text)); + text == SCM_UNDEFINED ? 0 : scm_to_wide_char_string (text)); return wrap_gui_image (guiImage); } @@ -114,7 +114,7 @@ extern "C" { SCM rest) { SCM border = SCM_BOOL_T; - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); scm_c_bind_keyword_arguments ("add-editbox!", rest, (scm_t_keyword_arguments_flags)0, @@ -128,7 +128,7 @@ extern "C" { guienv->addEditBox (scm_to_wide_char_string (text), scm_to_rect_s32 (rectangle), scm_to_bool (border), - scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent), scm_to_int32 (id)); return wrap_gui_editbox (editbox); } @@ -138,7 +138,7 @@ extern "C" { SCM rectangle, SCM rest) { - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); SCM draw_background = SCM_BOOL_F; @@ -151,7 +151,7 @@ extern "C" { irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrapped_gui_environment); irr::gui::IGUIListBox* listbox = guienv->addListBox (scm_to_rect_s32 (rectangle), - scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent), scm_to_int32 (id), scm_to_bool (draw_background)); return wrap_gui_listbox (listbox); @@ -163,7 +163,7 @@ extern "C" { SCM rectangle, SCM rest) { - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); scm_c_bind_keyword_arguments ("add-scrollbar!", rest, (scm_t_keyword_arguments_flags)0, @@ -175,7 +175,7 @@ extern "C" { irr::gui::IGUIScrollBar* scrollbar = guienv->addScrollBar (scm_to_bool (horizontal), scm_to_rect_s32 (rectangle), - scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent), scm_to_int32 (id)); return wrap_gui_scrollbar (scrollbar); } @@ -188,7 +188,7 @@ extern "C" { { SCM border = SCM_BOOL_F; SCM word_wrap = SCM_BOOL_T; - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); SCM fill_background = SCM_BOOL_F; @@ -206,7 +206,7 @@ extern "C" { scm_to_rect_s32 (rectangle), scm_to_bool (border), scm_to_bool (word_wrap), - scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent), scm_to_int32 (id), scm_to_bool (fill_background)); return wrap_gui_static_text (staticText); @@ -218,8 +218,8 @@ extern "C" { SCM rest) { SCM modal = SCM_BOOL_F; - SCM text = SCM_BOOL_F; - SCM parent = SCM_BOOL_F; + SCM text = SCM_UNDEFINED; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); scm_c_bind_keyword_arguments ("add-window!", rest, (scm_t_keyword_arguments_flags)0, @@ -233,8 +233,8 @@ extern "C" { irr::gui::IGUIWindow* window = guienv->addWindow (scm_to_rect_s32 (rectangle), scm_to_bool (modal), - scm_is_false (text) ? 0 : scm_to_wide_char_string (text), - scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + text == SCM_UNDEFINED ? 0 : scm_to_wide_char_string (text), + parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent), scm_to_int32 (id)); return wrap_gui_window (window); } @@ -260,10 +260,10 @@ extern "C" { SCM rectangle, SCM rest) { - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); - SCM text = SCM_BOOL_F; - SCM tooltiptext = SCM_BOOL_F; + SCM text = SCM_UNDEFINED; + SCM tooltiptext = SCM_UNDEFINED; scm_c_bind_keyword_arguments ("add-button!", rest, (scm_t_keyword_arguments_flags)0, scm_from_utf8_keyword ("parent"), &parent, @@ -275,10 +275,10 @@ extern "C" { irr::gui::IGUIEnvironment* guienv = unwrap_gui_environment (wrapped_gui_environment); irr::gui::IGUIButton* button = guienv->addButton (scm_to_rect_s32 (rectangle), - scm_is_false (parent) ? 0 : unwrap_gui_element (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_gui_element (parent), scm_to_int32 (id), - scm_is_false (text) ? 0 : scm_to_wide_char_string (text), - scm_is_false (tooltiptext) ? 0 : scm_to_wide_char_string (tooltiptext)); + text == SCM_UNDEFINED ? 0 : scm_to_wide_char_string (text), + tooltiptext == SCM_UNDEFINED ? 0 : scm_to_wide_char_string (tooltiptext)); return wrap_gui_button (button); } diff --git a/src/gui-toolbar.cpp b/src/gui-toolbar.cpp index cc571e8..eec05c7 100644 --- a/src/gui-toolbar.cpp +++ b/src/gui-toolbar.cpp @@ -45,10 +45,10 @@ extern "C" { SCM rest) { SCM id = scm_from_int32 (-1); - SCM text = SCM_BOOL_F; - SCM tooltiptext = SCM_BOOL_F; - SCM img = SCM_BOOL_F; - SCM pressedimg = SCM_BOOL_F; + SCM text = SCM_UNDEFINED; + SCM tooltiptext = SCM_UNDEFINED; + SCM img = SCM_UNDEFINED; + SCM pressedimg = SCM_UNDEFINED; SCM is_push_button = SCM_BOOL_F; SCM use_alpha_channel = SCM_BOOL_F; @@ -65,10 +65,10 @@ extern "C" { irr::gui::IGUIToolBar* toolbar = unwrap_gui_toolbar (wrapped_gui_toolbar); irr::gui::IGUIButton* button = toolbar->addButton (scm_to_int32 (id), - scm_is_false (text) ? 0 : scm_to_wide_char_string (text), - scm_is_false (tooltiptext) ? 0 : scm_to_wide_char_string (tooltiptext), - scm_is_false (img) ? 0 : unwrap_texture (img), - scm_is_false (pressedimg) ? 0 : unwrap_texture (pressedimg), + text == SCM_UNDEFINED ? 0 : scm_to_wide_char_string (text), + tooltiptext == SCM_UNDEFINED ? 0 : scm_to_wide_char_string (tooltiptext), + img == SCM_UNDEFINED ? 0 : unwrap_texture (img), + pressedimg == SCM_UNDEFINED ? 0 : unwrap_texture (pressedimg), scm_to_bool (is_push_button), scm_to_bool (use_alpha_channel)); return wrap_gui_button (button); diff --git a/src/scene-manager.cpp b/src/scene-manager.cpp index 03ae21d..d17d65c 100644 --- a/src/scene-manager.cpp +++ b/src/scene-manager.cpp @@ -68,7 +68,7 @@ extern "C" { SCM mesh, SCM rest) { - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); SCM position = scm_list_3 (scm_from_double (0), scm_from_double (0), @@ -93,7 +93,7 @@ extern "C" { irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager); irr::scene::IAnimatedMeshSceneNode* node = smgr->addAnimatedMeshSceneNode (unwrap_animated_mesh (mesh), - scm_is_false (parent) ? 0 : unwrap_scene_node (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_scene_node (parent), scm_to_int32 (id), scm_to_vector3df (position), scm_to_vector3df (rotation), @@ -106,7 +106,7 @@ extern "C" { irr_scene_addCameraSceneNode (SCM wrapped_scene_manager, SCM rest) { - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM position = scm_list_3 (scm_from_double (0), scm_from_double (0), scm_from_double (0)); @@ -126,7 +126,7 @@ extern "C" { irr::scene::ISceneManager* scene_manager = unwrap_scene_manager (wrapped_scene_manager); irr::scene::ICameraSceneNode* camera = - scene_manager->addCameraSceneNode (scm_is_false (parent) ? 0 : unwrap_scene_node (parent), + scene_manager->addCameraSceneNode (parent == SCM_UNDEFINED ? 0 : unwrap_scene_node (parent), scm_to_vector3df (position), scm_to_vector3df (lookat), scm_to_int32 (id), @@ -138,11 +138,11 @@ extern "C" { irr_scene_addCameraSceneNodeFPS (SCM wrapped_scene_manager, SCM rest) { - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM rotate_speed = scm_from_double (100); SCM move_speed = scm_from_double (0.5); SCM id = scm_from_int32 (-1); - SCM key_map_array = SCM_BOOL_F; + SCM key_map_array = SCM_UNDEFINED; SCM key_map_size = scm_from_int32 (0); SCM no_vertical_movement = SCM_BOOL_F; SCM jump_speed = scm_from_double (0); @@ -164,11 +164,11 @@ extern "C" { irr::scene::ISceneManager* scene_manager = unwrap_scene_manager (wrapped_scene_manager); irr::scene::ICameraSceneNode* camera = - scene_manager->addCameraSceneNodeFPS (scm_is_false (parent) ? 0 : unwrap_scene_node (parent), + scene_manager->addCameraSceneNodeFPS (parent == SCM_UNDEFINED ? 0 : unwrap_scene_node (parent), scm_to_double (rotate_speed), scm_to_double (move_speed), scm_to_int32 (id), - scm_is_false (key_map_array) ? 0 : unwrap_keymap (key_map_array), + key_map_array == SCM_UNDEFINED ? 0 : unwrap_keymap (key_map_array), scm_to_int32 (key_map_size), scm_to_bool (no_vertical_movement), scm_to_double (jump_speed), @@ -182,7 +182,7 @@ extern "C" { SCM rest) { SCM size = scm_from_double (10); - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); SCM position = scm_list_3 (scm_from_double (0), scm_from_double (0), @@ -206,7 +206,7 @@ extern "C" { irr::scene::ISceneManager* smgr = unwrap_scene_manager (wrapped_scene_manager); irr::scene::IMeshSceneNode* node = smgr->addCubeSceneNode (scm_to_double (size), - scm_is_false (parent) ? 0 : unwrap_scene_node (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_scene_node (parent), scm_to_int32 (id), scm_to_vector3df (position), scm_to_vector3df (rotation), @@ -321,7 +321,7 @@ extern "C" { SCM wrapped_mesh, SCM rest) { - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); SCM minimal_polys_per_node = scm_from_int32 (256); SCM also_add_if_mesh_pointer_zero = SCM_BOOL_F; @@ -338,7 +338,7 @@ extern "C" { if (animated_mesh_p (wrapped_mesh)) { node = smgr->addOctreeSceneNode (unwrap_animated_mesh (wrapped_mesh), - scm_is_false (parent) ? 0 : unwrap_scene_node (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_scene_node (parent), scm_to_int32 (id), scm_to_int32 (minimal_polys_per_node), scm_to_bool (also_add_if_mesh_pointer_zero)); @@ -346,7 +346,7 @@ extern "C" { else { node = smgr->addOctreeSceneNode (unwrap_mesh (wrapped_mesh), - scm_is_false (parent) ? 0 : unwrap_scene_node (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_scene_node (parent), scm_to_int32 (id), scm_to_int32 (minimal_polys_per_node), scm_to_bool (also_add_if_mesh_pointer_zero)); @@ -360,7 +360,7 @@ extern "C" { { SCM radius = scm_from_double (5.0); SCM poly_count = scm_from_int32 (16); - SCM parent = SCM_BOOL_F; + SCM parent = SCM_UNDEFINED; SCM id = scm_from_int32 (-1); SCM position = scm_list_3 (scm_from_double (0), scm_from_double (0), @@ -386,7 +386,7 @@ extern "C" { irr::scene::IMeshSceneNode* node = smgr->addSphereSceneNode (scm_to_double (radius), scm_to_int32 (poly_count), - scm_is_false (parent) ? 0 : unwrap_scene_node (parent), + parent == SCM_UNDEFINED ? 0 : unwrap_scene_node (parent), scm_to_int32 (id), scm_to_vector3df (position), scm_to_vector3df (rotation), diff --git a/src/video-driver.cpp b/src/video-driver.cpp index 85a720e..bd01f6e 100644 --- a/src/video-driver.cpp +++ b/src/video-driver.cpp @@ -66,7 +66,7 @@ extern "C" { scm_from_uint32 (0), scm_from_uint32 (0)); SCM video_data = SCM_BOOL_F; - SCM source_rect = SCM_BOOL_F; + SCM source_rect = SCM_UNDEFINED; scm_c_bind_keyword_arguments ("begin-scene", rest, (scm_t_keyword_arguments_flags)0, scm_from_utf8_keyword ("back-buffer"), &back_buffer, @@ -78,7 +78,7 @@ extern "C" { irr::video::IVideoDriver* driver = unwrap_video_driver (wrapped_video_driver); irr::core::rect* sourceRectAddress = 0; - if (!scm_is_false (source_rect)) + if (source_rect != SCM_UNDEFINED) { irr::core::rect sourceRect = scm_to_rect_s32 (source_rect); sourceRectAddress = &sourceRect; -- 2.39.5