From 215a22a3c840a27e6c616426751dc529e10144c7 Mon Sep 17 00:00:00 2001 From: "Gun.io Whitespace Robot" Date: Sat, 17 Dec 2011 05:46:17 -0500 Subject: [PATCH] Remove whitespace [Gun.io WhitespaceBot] --- .gitignore | 50 + Include/Pxf/Base/Config.h | 2 +- Include/Pxf/Base/Debug.h | 2 +- Include/Pxf/Base/Platform.h | 2 +- Include/Pxf/Base/Stream.h | 4 +- Include/Pxf/Base/Utils.h | 16 +- Include/Pxf/Engine.h | 2 +- Include/Pxf/Extra/LuaGUI/Callbacks.h | 12 +- Include/Pxf/Extra/LuaGUI/GUIHandler.h | 6 +- Include/Pxf/Extra/LuaGUI/GUIScript.h | 10 +- Include/Pxf/Extra/LuaGUI/GUIWidget.h | 2 +- Include/Pxf/Extra/LuaGame/LuaGame.h | 48 +- Include/Pxf/Extra/LuaGame/Subsystem.h | 6 +- .../Pxf/Extra/LuaGame/Subsystems/Graphics.h | 4 +- .../Pxf/Extra/LuaGame/Subsystems/MouseInput.h | 4 +- .../Pxf/Extra/LuaGame/Subsystems/Physics.h | 6 +- .../Pxf/Extra/LuaGame/Subsystems/Resources.h | 4 +- Include/Pxf/Extra/LuaGame/Subsystems/Vec2.h | 6 +- .../Extra/LuaGame/Subsystems/iPhoneInput.h | 6 +- Include/Pxf/Extra/SimpleFont/SimpleFont.h | 14 +- Include/Pxf/Extra/SimpleFont/stb_truetype.h | 34 +- Include/Pxf/Extra/SimpleNet/SimpleClient.h | 4 +- Include/Pxf/Extra/SimpleNet/SimpleNet.h | 6 +- Include/Pxf/Extra/SimpleNet/SimpleServer.h | 4 +- Include/Pxf/Game/Box2D/Box2DParameterDefs.h | 2 +- Include/Pxf/Game/Box2D/Box2DPhysicsObject.h | 8 +- Include/Pxf/Game/Box2D/Box2DPhysicsWorld.h | 16 +- Include/Pxf/Game/GameObject.h | 6 +- Include/Pxf/Game/GameState.h | 6 +- Include/Pxf/Game/PhysicsBodyDefs.h | 4 +- Include/Pxf/Game/PhysicsObject.h | 12 +- Include/Pxf/Game/PhysicsWorld.h | 4 +- Include/Pxf/Game/Sprite.h | 22 +- Include/Pxf/Game/SpriteBatch.h | 10 +- Include/Pxf/Graphics/D3D9/DeviceD3D9.h | 2 +- Include/Pxf/Graphics/D3D9/WindowD3D.h | 2 +- Include/Pxf/Graphics/Device.h | 12 +- Include/Pxf/Graphics/DeviceResource.h | 4 +- Include/Pxf/Graphics/DeviceType.h | 2 +- Include/Pxf/Graphics/OpenGL/DeviceGLES11.h | 32 +- Include/Pxf/Graphics/OpenGL/EAGLView11.h | 2 +- Include/Pxf/Graphics/OpenGL/OpenGL.h | 6 +- Include/Pxf/Graphics/OpenGL/OpenGLUtils.h | 4 +- Include/Pxf/Graphics/OpenGL/QuadBatchGL2.h | 6 +- Include/Pxf/Graphics/OpenGL/QuadBatchGLES11.h | 6 +- Include/Pxf/Graphics/OpenGL/RenderTargetGL2.h | 12 +- Include/Pxf/Graphics/OpenGL/TextureGL2.h | 6 +- Include/Pxf/Graphics/OpenGL/TextureGLES.h | 6 +- Include/Pxf/Graphics/OpenGL/VertexBufferGL2.h | 2 +- .../Pxf/Graphics/OpenGL/VertexBufferGLES11.h | 4 +- Include/Pxf/Graphics/OpenGL/VideoBufferGL.h | 2 +- Include/Pxf/Graphics/OpenGL3/WindowGL3.h | 2 +- Include/Pxf/Graphics/RenderTarget.h | 4 +- Include/Pxf/Graphics/Shader.h | 4 +- Include/Pxf/Graphics/Shader/GLSLShader.h | 14 +- Include/Pxf/Graphics/Texture.h | 8 +- Include/Pxf/Graphics/TextureDefs.h | 4 +- Include/Pxf/Graphics/VertexBuffer.h | 2 +- Include/Pxf/Graphics/VertexBufferDefs.h | 6 +- Include/Pxf/Input/Input.h | 2 +- Include/Pxf/Input/InputDefs.h | 4 +- Include/Pxf/Input/OpenGL/InputGL2.h | 2 +- Include/Pxf/Math/Math.h | 8 +- Include/Pxf/Math/Matrix.h | 52 +- Include/Pxf/Math/Quaternion.h | 50 +- Include/Pxf/Math/Vector.h | 88 +- Include/Pxf/Resource/Chunk.h | 8 +- Include/Pxf/Resource/Image.h | 8 +- Include/Pxf/Resource/ResourceManager.h | 2 +- Include/Pxf/Resource/ShaderSource.h | 6 +- Include/Pxf/Scene/Entity.h | 4 +- Include/Pxf/Scene/EntityDefs.h | 6 +- Include/Pxf/Scene/Scene.h | 4 +- Include/Pxf/Scene/SceneManager.h | 6 +- Include/Pxf/Util/MemoryManager/mmgr.cpp | 70 +- Include/Pxf/Util/MemoryManager/mmgr.h | 28 +- Include/Pxf/Util/MemoryManager/nommgr.h | 28 +- Include/Pxf/Util/MemoryManager/readme.txt | 2 +- .../sdk/add_on/autowrapper/aswrappedcall.h | 4 +- .../autowrapper/generator/generateheader.cpp | 10 +- .../autowrapper/generator/generator.dsp | 14 +- .../sdk/add_on/clib/angelscript_c.h | 24 +- .../AngelScript/sdk/add_on/clib/as_c.cpp | 32 +- .../sdk/add_on/clib/projects/msvc6/msvc6.dsp | 14 +- .../sdk/add_on/contextmgr/contextmgr.cpp | 24 +- .../sdk/add_on/contextmgr/contextmgr.h | 4 +- .../sdk/add_on/scriptany/scriptany.cpp | 6 +- .../sdk/add_on/scriptany/scriptany.h | 2 +- .../sdk/add_on/scriptarray/scriptarray.cpp | 22 +- .../scriptdictionary/scriptdictionary.cpp | 22 +- .../scriptdictionary/scriptdictionary.h | 4 +- .../sdk/add_on/scriptfile/scriptfile.cpp | 8 +- .../sdk/add_on/scripthelper/scripthelper.cpp | 16 +- .../sdk/add_on/scriptmath/scriptmath.cpp | 2 +- .../scriptstdstring/scriptstdstring.cpp | 6 +- .../add_on/scriptstdstring/scriptstdstring.h | 2 +- .../sdk/add_on/scriptstring/scriptstring.cpp | 4 +- .../scriptstring/scriptstring_utils.cpp | 2 +- .../sdk/angelscript/include/angelscript.h | 44 +- .../sdk/angelscript/include/scriptbuilder.h | 6 +- .../sdk/angelscript/source/as_arrayobject.cpp | 26 +- .../sdk/angelscript/source/as_arrayobject.h | 16 +- .../sdk/angelscript/source/as_atomic.cpp | 12 +- .../sdk/angelscript/source/as_atomic.h | 18 +- .../sdk/angelscript/source/as_builder.cpp | 30 +- .../sdk/angelscript/source/as_builder.h | 18 +- .../sdk/angelscript/source/as_bytecode.cpp | 156 +- .../sdk/angelscript/source/as_bytecode.h | 16 +- .../sdk/angelscript/source/as_callfunc.cpp | 8 +- .../angelscript/source/as_callfunc_arm.cpp | 2 +- .../angelscript/source/as_callfunc_arm_gcc.S | 4 +- .../source/as_callfunc_arm_msvc.asm | 4 +- .../source/as_callfunc_arm_xcode.s | 4 +- .../angelscript/source/as_callfunc_mips.cpp | 4 +- .../angelscript/source/as_callfunc_ppc.cpp | 52 +- .../angelscript/source/as_callfunc_ppc_64.cpp | 12 +- .../angelscript/source/as_callfunc_sh4.cpp | 24 +- .../sdk/angelscript/source/as_compiler.cpp | 46 +- .../sdk/angelscript/source/as_compiler.h | 16 +- .../sdk/angelscript/source/as_config.h | 14 +- .../sdk/angelscript/source/as_configgroup.cpp | 20 +- .../sdk/angelscript/source/as_configgroup.h | 16 +- .../sdk/angelscript/source/as_context.cpp | 34 +- .../angelscript/source/as_criticalsection.h | 22 +- .../sdk/angelscript/source/as_datatype.cpp | 38 +- .../sdk/angelscript/source/as_datatype.h | 18 +- .../sdk/angelscript/source/as_debug.h | 18 +- .../sdk/angelscript/source/as_gc.h | 18 +- .../sdk/angelscript/source/as_generic.cpp | 26 +- .../sdk/angelscript/source/as_generic.h | 16 +- .../angelscript/source/as_globalproperty.cpp | 64 +- .../sdk/angelscript/source/as_map.h | 60 +- .../sdk/angelscript/source/as_memory.cpp | 10 +- .../sdk/angelscript/source/as_module.cpp | 76 +- .../sdk/angelscript/source/as_module.h | 20 +- .../sdk/angelscript/source/as_objecttype.cpp | 52 +- .../sdk/angelscript/source/as_objecttype.h | 54 +- .../angelscript/source/as_outputbuffer.cpp | 18 +- .../sdk/angelscript/source/as_outputbuffer.h | 16 +- .../sdk/angelscript/source/as_parser.cpp | 96 +- .../sdk/angelscript/source/as_parser.h | 16 +- .../sdk/angelscript/source/as_property.h | 16 +- .../sdk/angelscript/source/as_restore.cpp | 88 +- .../sdk/angelscript/source/as_restore.h | 22 +- .../sdk/angelscript/source/as_scriptcode.cpp | 22 +- .../sdk/angelscript/source/as_scriptcode.h | 16 +- .../angelscript/source/as_scriptengine.cpp | 12 +- .../sdk/angelscript/source/as_scriptengine.h | 20 +- .../angelscript/source/as_scriptfunction.cpp | 46 +- .../angelscript/source/as_scriptfunction.h | 18 +- .../sdk/angelscript/source/as_scriptnode.cpp | 16 +- .../sdk/angelscript/source/as_scriptnode.h | 16 +- .../angelscript/source/as_scriptobject.cpp | 20 +- .../sdk/angelscript/source/as_scriptobject.h | 16 +- .../sdk/angelscript/source/as_string.cpp | 22 +- .../sdk/angelscript/source/as_string.h | 16 +- .../sdk/angelscript/source/as_string_util.cpp | 26 +- .../sdk/angelscript/source/as_string_util.h | 16 +- .../sdk/angelscript/source/as_texts.h | 16 +- .../sdk/angelscript/source/as_thread.cpp | 28 +- .../sdk/angelscript/source/as_thread.h | 16 +- .../sdk/angelscript/source/as_tokendef.h | 20 +- .../sdk/angelscript/source/as_tokenizer.cpp | 32 +- .../sdk/angelscript/source/as_tokenizer.h | 16 +- .../sdk/angelscript/source/as_typeinfo.cpp | 16 +- .../sdk/angelscript/source/as_typeinfo.h | 20 +- .../angelscript/source/as_variablescope.cpp | 18 +- .../sdk/angelscript/source/as_variablescope.h | 16 +- .../sdk/angelscript/source/scriptbuilder.cpp | 26 +- Libraries/Box2D/box2d.lua | 2 +- .../Documentation/API/_box2_d_8h_source.html | 16 +- .../API/b2_block_allocator_8h_source.html | 22 +- .../sdk/Documentation/API/b2_body_8h.html | 4 +- .../Documentation/API/b2_body_8h_source.html | 306 +- .../API/b2_broad_phase_8h_source.html | 92 +- .../API/b2_circle_contact_8h_source.html | 12 +- .../API/b2_circle_shape_8h_source.html | 34 +- .../Documentation/API/b2_collision_8h.html | 6 +- .../API/b2_collision_8h_source.html | 110 +- .../API/b2_contact_8h_source.html | 100 +- .../API/b2_contact_manager_8h_source.html | 18 +- .../API/b2_contact_solver_8h_source.html | 20 +- .../API/b2_distance_8h_source.html | 60 +- .../API/b2_distance_joint_8h_source.html | 50 +- .../API/b2_dynamic_tree_8h_source.html | 106 +- .../API/b2_fixture_8h_source.html | 142 +- .../API/b2_friction_joint_8h_source.html | 44 +- .../API/b2_gear_joint_8h_source.html | 44 +- .../API/b2_island_8h_source.html | 36 +- .../sdk/Documentation/API/b2_joint_8h.html | 24 +- .../Documentation/API/b2_joint_8h_source.html | 96 +- .../API/b2_line_joint_8h_source.html | 76 +- .../Documentation/API/b2_math_8h_source.html | 206 +- .../API/b2_mouse_joint_8h_source.html | 42 +- ..._polygon_and_circle_contact_8h_source.html | 12 +- .../API/b2_polygon_contact_8h_source.html | 12 +- .../API/b2_polygon_shape_8h_source.html | 46 +- .../API/b2_prismatic_joint_8h_source.html | 76 +- .../API/b2_pulley_joint_8h_source.html | 62 +- .../API/b2_revolute_joint_8h_source.html | 76 +- .../API/b2_settings_8h_source.html | 36 +- .../Documentation/API/b2_shape_8h_source.html | 32 +- .../API/b2_stack_allocator_8h_source.html | 22 +- .../API/b2_t_o_i_solver_8h_source.html | 16 +- .../API/b2_time_of_impact_8h_source.html | 12 +- .../API/b2_time_step_8h_source.html | 6 +- .../API/b2_weld_joint_8h_source.html | 34 +- .../Documentation/API/b2_world_8h_source.html | 118 +- .../API/b2_world_callbacks_8h_source.html | 76 +- .../sdk/Documentation/API/classb2_body.html | 2 +- .../API/classb2_circle_shape.html | 2 +- .../Documentation/API/classb2_contact.html | 6 +- .../Documentation/API/classb2_debug_draw.html | 8 +- .../sdk/Documentation/API/classb2_island.html | 2 +- .../sdk/Documentation/API/classb2_shape.html | 6 +- .../Box2D/sdk/Documentation/API/doxygen.css | 30 +- .../Documentation/API/structb2_a_a_b_b.html | 2 +- .../API/structb2_clip_vertex.html | 2 +- .../sdk/Documentation/API/structb2_color.html | 2 +- .../structb2_contact_i_d_1_1_features.html | 2 +- .../API/structb2_distance_output.html | 2 +- .../API/structb2_dynamic_tree_node.html | 2 +- .../Documentation/API/structb2_filter.html | 2 +- .../API/structb2_friction_joint_def.html | 2 +- .../Documentation/API/structb2_joint_def.html | 2 +- .../Documentation/API/structb2_manifold.html | 4 +- .../Documentation/API/structb2_mass_data.html | 2 +- .../sdk/Documentation/API/structb2_mat22.html | 2 +- .../sdk/Documentation/API/structb2_mat33.html | 2 +- .../Documentation/API/structb2_position.html | 2 +- .../API/structb2_ray_cast_input.html | 2 +- .../API/structb2_separation_function.html | 4 +- .../API/structb2_t_o_i_input.html | 2 +- .../API/structb2_t_o_i_output.html | 8 +- .../Documentation/API/structb2_time_step.html | 2 +- .../sdk/Documentation/API/structb2_vec2.html | 2 +- .../sdk/Documentation/API/structb2_vec3.html | 2 +- .../Documentation/API/structb2_velocity.html | 2 +- .../API/structb2_world_manifold.html | 2 +- .../API/unionb2_contact_i_d.html | 2 +- .../include/Box2D/Collision/Shapes/b2Shape.h | 2 +- .../sdk/include/Box2D/Collision/b2Distance.h | 4 +- .../Box2D/sdk/include/Box2D/Common/b2Math.h | 4 +- .../Box2D/Dynamics/Joints/b2PrismaticJoint.h | 2 +- .../Box2D/Dynamics/Joints/b2PulleyJoint.h | 4 +- .../Box2D/Dynamics/Joints/b2RevoluteJoint.h | 4 +- .../Box2D/sdk/include/Box2D/Dynamics/b2Body.h | 2 +- .../include/Box2D/Dynamics/b2ContactManager.h | 2 +- .../sdk/include/Box2D/Dynamics/b2World.h | 6 +- .../include/Box2D/Dynamics/b2WorldCallbacks.h | 6 +- Libraries/Box2D/sdk/src/b2BlockAllocator.cpp | 4 +- Libraries/Box2D/sdk/src/b2CollidePolygon.cpp | 4 +- Libraries/Box2D/sdk/src/b2Collision.cpp | 2 +- Libraries/Box2D/sdk/src/b2Contact.cpp | 4 +- Libraries/Box2D/sdk/src/b2ContactSolver.cpp | 14 +- Libraries/Box2D/sdk/src/b2Distance.cpp | 4 +- Libraries/Box2D/sdk/src/b2DistanceJoint.cpp | 2 +- Libraries/Box2D/sdk/src/b2DynamicTree.cpp | 4 +- Libraries/Box2D/sdk/src/b2Fixture.cpp | 4 +- Libraries/Box2D/sdk/src/b2GearJoint.cpp | 2 +- Libraries/Box2D/sdk/src/b2Island.cpp | 2 +- Libraries/Box2D/sdk/src/b2Joint.cpp | 4 +- Libraries/Box2D/sdk/src/b2LineJoint.cpp | 2 +- Libraries/Box2D/sdk/src/b2PolygonShape.cpp | 6 +- Libraries/Box2D/sdk/src/b2PrismaticJoint.cpp | 2 +- Libraries/Box2D/sdk/src/b2RevoluteJoint.cpp | 2 +- Libraries/Box2D/sdk/src/b2TimeOfImpact.cpp | 6 +- Libraries/RtAudio/sdk/RtAudio.cpp | 42 +- Libraries/RtAudio/sdk/RtAudio.h | 26 +- Libraries/RtAudio/sdk/RtError.h | 2 +- Libraries/RtAudio/sdk/include/asio.cpp | 14 +- Libraries/RtAudio/sdk/include/asio.h | 22 +- Libraries/RtAudio/sdk/include/asiodrivers.cpp | 2 +- Libraries/RtAudio/sdk/include/asiodrivers.h | 2 +- Libraries/RtAudio/sdk/include/asiodrvr.h | 2 +- Libraries/RtAudio/sdk/include/asiolist.cpp | 16 +- Libraries/RtAudio/sdk/include/asiolist.h | 4 +- Libraries/RtAudio/sdk/include/asiosys.h | 12 +- Libraries/RtAudio/sdk/include/ginclude.h | 14 +- Libraries/RtAudio/sdk/include/iasiodrv.h | 6 +- .../sdk/include/iasiothiscallresolver.cpp | 10 +- .../sdk/include/iasiothiscallresolver.h | 2 +- Libraries/RtAudio/sdk/include/soundcard.h | 58 +- Libraries/enet/enet.lua | 2 +- Libraries/enet/sdk/include/enet/callbacks.h | 2 +- Libraries/enet/sdk/include/enet/enet.h | 70 +- Libraries/enet/sdk/include/enet/list.h | 4 +- Libraries/enet/sdk/include/enet/protocol.h | 2 +- Libraries/enet/sdk/include/enet/time.h | 2 +- Libraries/enet/sdk/include/enet/types.h | 2 +- Libraries/enet/sdk/include/enet/unix.h | 4 +- Libraries/enet/sdk/include/enet/utility.h | 2 +- Libraries/enet/sdk/include/enet/win32.h | 2 +- Libraries/enet/sdk/src/callbacks.c | 6 +- Libraries/enet/sdk/src/host.c | 36 +- Libraries/enet/sdk/src/list.c | 6 +- Libraries/enet/sdk/src/packet.c | 26 +- Libraries/enet/sdk/src/peer.c | 44 +- Libraries/enet/sdk/src/protocol.c | 154 +- Libraries/enet/sdk/src/unix.c | 24 +- Libraries/enet/sdk/src/win32.c | 24 +- Libraries/glew/glew.lua | 2 +- Libraries/glew/sdk/include/GL/glew.h | 30 +- Libraries/glew/sdk/include/GL/glxew.h | 98 +- Libraries/glew/sdk/include/GL/wglew.h | 40 +- Libraries/glew/sdk/source/glew.c | 40 +- Libraries/glfw/glfw.lua | 2 +- Libraries/glfw/sdk/src/enable.c | 2 +- .../glfw/sdk/src/macosx/macosx_fullscreen.c | 12 +- Libraries/glfw/sdk/src/macosx/macosx_init.c | 12 +- Libraries/glfw/sdk/src/macosx/macosx_window.c | 4 +- Libraries/glfw/sdk/src/macosx/platform.h | 4 +- Libraries/glfw/sdk/src/stream.c | 4 +- .../sdk/src/win32/Makefile.win32.cross-mgw | 10 +- Libraries/glfw/sdk/src/win32/platform.h | 12 +- Libraries/glfw/sdk/src/win32/win32_window.c | 26 +- Libraries/glfw/sdk/src/x11/x11_fullscreen.c | 2 +- Libraries/glfw/sdk/src/x11/x11_joystick.c | 10 +- .../glfw/sdk/src/x11/x11_keysym2unicode.c | 24 +- Libraries/glfw/sdk/src/x11/x11_window.c | 24 +- Libraries/lua/lua.lua | 2 +- Libraries/lua/sdk/include/llimits.h | 4 +- Libraries/lua/sdk/include/lobject.h | 2 +- Libraries/lua/sdk/include/lopcodes.h | 10 +- Libraries/lua/sdk/include/lua.h | 2 +- Libraries/lua/sdk/include/lualib.h | 2 +- Libraries/lua/sdk/src/lapi.c | 4 +- Libraries/lua/sdk/src/ldblib.c | 2 +- Libraries/lua/sdk/src/ldebug.c | 2 +- Libraries/lua/sdk/src/ldo.c | 2 +- Libraries/lua/sdk/src/lgc.c | 4 +- Libraries/lua/sdk/src/loadlib.c | 4 +- Libraries/lua/sdk/src/lstate.c | 2 +- Libraries/lua/sdk/src/lstrlib.c | 2 +- Libraries/lua/sdk/src/ltable.c | 14 +- Libraries/lua/sdk/src/lvm.c | 4 +- Libraries/luasocket/luasocket.lua | 2 +- Libraries/luasocket/sdk/include/auxiliar.h | 10 +- Libraries/luasocket/sdk/include/buffer.h | 6 +- Libraries/luasocket/sdk/include/except.h | 4 +- Libraries/luasocket/sdk/include/inet.h | 10 +- Libraries/luasocket/sdk/include/mime.h | 6 +- Libraries/luasocket/sdk/include/options.h | 4 +- Libraries/luasocket/sdk/include/select.h | 4 +- Libraries/luasocket/sdk/include/socket.h | 22 +- Libraries/luasocket/sdk/include/udp.h | 2 +- Libraries/luasocket/sdk/include/unix.h | 2 +- Libraries/luasocket/sdk/lua_src/http.lua | 14 +- Libraries/luasocket/sdk/lua_src/mime.lua | 2 +- Libraries/luasocket/sdk/lua_src/url.lua | 2 +- Libraries/luasocket/sdk/src/auxiliar.c | 10 +- Libraries/luasocket/sdk/src/buffer.c | 22 +- Libraries/luasocket/sdk/src/except.c | 4 +- Libraries/luasocket/sdk/src/inet.c | 10 +- Libraries/luasocket/sdk/src/io.c | 2 +- Libraries/luasocket/sdk/src/mime.c | 100 +- Libraries/luasocket/sdk/src/options.c | 26 +- Libraries/luasocket/sdk/src/select.c | 24 +- Libraries/luasocket/sdk/src/tcp.c | 26 +- Libraries/luasocket/sdk/src/timeout.c | 8 +- Libraries/luasocket/sdk/src/udp.c | 26 +- Libraries/luasocket/sdk/src/unix/unix.c | 38 +- Libraries/luasocket/sdk/src/unix/usocket.c | 50 +- Libraries/luasocket/sdk/src/windows/wsocket.c | 66 +- Libraries/s7/sdk/s7.c | 3892 ++++++++--------- Libraries/s7/sdk/s7.h | 118 +- Libraries/s7/sdk/s7.html | 248 +- Libraries/s7/sdk/s7test.scm | 3804 ++++++++-------- Libraries/soil/sdk/include/stb_image_aug.h | 10 +- Libraries/soil/sdk/src/SOIL.mm | 2 +- Libraries/soil/soil.lua | 2 +- Source/Base/PlatformPosix.cpp | 4 +- Source/Base/PlatformWin32.cpp | 4 +- Source/Base/StreamPosix.cpp | 4 +- Source/Engine.cpp | 4 +- Source/Extra/LuaGUI/GUIHandler.cpp | 2 +- Source/Extra/LuaGUI/GUIScript.cpp | 10 +- Source/Extra/LuaGame/LuaGame.cpp | 156 +- Source/Extra/LuaGame/Subsystems/Graphics.cpp | 96 +- .../Extra/LuaGame/Subsystems/MouseInput.cpp | 22 +- Source/Extra/LuaGame/Subsystems/Physics.cpp | 34 +- Source/Extra/LuaGame/Subsystems/Resources.cpp | 52 +- Source/Extra/LuaGame/Subsystems/Vec2.cpp | 24 +- .../Extra/LuaGame/Subsystems/iPhoneInput.mm | 20 +- Source/Extra/LuaGame/docs/luagame.html | 16 +- Source/Extra/SimpleFont/SimpleFont.cpp | 22 +- Source/Extra/SimpleNet/SimpleClient.cpp | 28 +- Source/Extra/SimpleNet/SimpleServer.cpp | 22 +- Source/Extra/iPhoneInput/iPhoneInput.mm | 8 +- Source/Game/Box2D/Box2DPhysicsWorld.cpp | 12 +- Source/Game/GameObject.cpp | 6 +- Source/Game/Sprite.cpp | 72 +- Source/Graphics/D3D9/DeviceD3D9.cpp | 2 +- Source/Graphics/D3D9/WindowD3D.cpp | 8 +- Source/Graphics/OpenGL/DeviceGL2.cpp | 6 +- Source/Graphics/OpenGL/DeviceGLES11.mm | 92 +- Source/Graphics/OpenGL/EAGLView11.mm | 86 +- Source/Graphics/OpenGL/QuadBatchGL2.cpp | 60 +- Source/Graphics/OpenGL/QuadBatchGLES11.cpp | 60 +- Source/Graphics/OpenGL/RenderTargetGL2.cpp | 8 +- Source/Graphics/OpenGL/TextureGL2.cpp | 32 +- Source/Graphics/OpenGL/TextureGLES.cpp | 32 +- Source/Graphics/OpenGL/VertexBufferGL2.cpp | 2 +- Source/Graphics/OpenGL/VertexBufferGLES11.cpp | 6 +- Source/Graphics/OpenGL/WindowGL2.cpp | 8 +- Source/Graphics/OpenGL3/WindowGL3.cpp | 6 +- Source/Graphics/Shader/GLSLShader.cpp | 8 +- Source/Pxf.cpp | 2 +- Source/Resource/ImageSOIL.cpp | 2 +- Source/Resource/ResourceManager.cpp | 4 +- Tests/BasicAngelScriptTest/Source/Main.cpp | 10 +- Tests/D3DTest/Source/Main.cpp | 4 +- Tests/FakePhone/Source/FakePhone.cpp | 26 +- Tests/FakePhone/data/LuaGame.lua | 54 +- Tests/FakePhone/data/faker.lua | 12 +- Tests/FakePhone/data/game.lua | 22 +- Tests/FakePhone/data/http.lua | 14 +- Tests/FakePhone/data/knugen.lua | 46 +- Tests/FakePhone/data/knugen/card.lua | 110 +- Tests/FakePhone/data/knugen/menu.lua | 50 +- Tests/FakePhone/data/knugen_game.lua | 22 +- Tests/FakePhone/data/mime.lua | 2 +- Tests/FakePhone/data/url.lua | 2 +- Tests/FrameWorkEntryPoint/Source/Main.cpp | 2 +- Tests/GLFWTest/Source/Main.cpp | 4 +- Tests/IPhoneTest/Include/Application.h | 20 +- Tests/IPhoneTest/Include/ApplicationDefines.h | 2 +- Tests/IPhoneTest/Include/TestGameState.h | 6 +- Tests/IPhoneTest/LuaGame.lua | 54 +- Tests/IPhoneTest/Source/Application.mm | 74 +- Tests/IPhoneTest/Source/Delegate.mm | 24 +- Tests/IPhoneTest/Source/TestGameState.cpp | 4 +- Tests/IPhoneTest/Source/main.m | 2 +- Tests/IPhoneTest/test.lua | 50 +- Tests/LuaGUITest/Source/LuaGUITest.cpp | 10 +- Tests/LuaGUITest/data/basetheme.lua | 100 +- Tests/LuaGUITest/data/guibase.lua | 38 +- Tests/Renderer/Source/Main.cpp | 2 +- Tests/SchemeTest/Source/Main.cpp | 10 +- Tests/SchemeTest/ext.scm | 4 +- Tests/ShaderChainTest/Source/Main.cpp | 2 +- Tests/SimpleNetTest/Source/SimpleNetTest.cpp | 18 +- Tests/SimpleNetTest/data/basetheme.lua | 100 +- Tests/SimpleNetTest/data/guibase.lua | 38 +- Tests/SimpleNetTest/data/server_gui.lua | 4 +- Tests/VertexBuffer/Source/Main.cpp | 12 +- framework.lua | 28 +- todo.txt | 4 +- 448 files changed, 8607 insertions(+), 8557 deletions(-) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c091839 --- /dev/null +++ b/.gitignore @@ -0,0 +1,50 @@ +# Compiled source # +################### +*.com +*.class +*.dll +*.exe +*.o +*.so +*.pyc + +# Numerous always-ignore extensions +################### +*.diff +*.err +*.orig +*.log +*.rej +*.swo +*.swp +*.vi +*~ + +*.sass-cache +# Folders to ignore +################### +.hg +.svn +.CVS +# OS or Editor folders +################### +.DS_Store +Icon? +Thumbs.db +ehthumbs.db +nbproject +.cache +.project +.settings +.tmproj +*.esproj +*.sublime-project +*.sublime-workspace +# Dreamweaver added files +################### +_notes +dwsync.xml +# Komodo +################### +*.komodoproject +.komodotools diff --git a/Include/Pxf/Base/Config.h b/Include/Pxf/Base/Config.h index 1177af7..c86c00f 100644 --- a/Include/Pxf/Base/Config.h +++ b/Include/Pxf/Base/Config.h @@ -8,7 +8,7 @@ // Windows # if defined (WIN64) || defined (_WIN64) # define CONF_FAMILY_WINDOWS -# define CONF_FAMILY_STRING "windows" +# define CONF_FAMILY_STRING "windows" # define CONF_PLATFORM_WIN64 # define CONF_PLATFORM_STRING "win64" # elif defined (WIN32) || defined (_WIN32) || defined(__CYGWIN32__) || defined (__MINGW32__) diff --git a/Include/Pxf/Base/Debug.h b/Include/Pxf/Base/Debug.h index c6b8a1c..b6e2485 100644 --- a/Include/Pxf/Base/Debug.h +++ b/Include/Pxf/Base/Debug.h @@ -23,7 +23,7 @@ namespace Pxf #define PXFASSERT(_Expression, _Message, ...) do{}while(0) #endif bool Assert(bool _Expression, int _Line, char* _File, const char* _Message, ...); - + /* Simple message reporting */ void Message(const char* _SubSystem, const char* _Message, ...); diff --git a/Include/Pxf/Base/Platform.h b/Include/Pxf/Base/Platform.h index 10a61bb..2e1da09 100644 --- a/Include/Pxf/Base/Platform.h +++ b/Include/Pxf/Base/Platform.h @@ -22,7 +22,7 @@ namespace Pxf s_TimeInitialized = true; } } - + static int64 GetTime(); }; } diff --git a/Include/Pxf/Base/Stream.h b/Include/Pxf/Base/Stream.h index 814acbb..840a9d8 100644 --- a/Include/Pxf/Base/Stream.h +++ b/Include/Pxf/Base/Stream.h @@ -34,7 +34,7 @@ class Stream template void WriteNE(T v) { Write(&v, sizeof(T)); } template void WriteBE(T v) { T t = ByteswapNtoB(v); Write(&t, sizeof(T)); } template void WriteLE(T v) { T t = ByteswapNtoL(v); Write(&t, sizeof(T)); } - + }; class FileStream : public Stream @@ -85,7 +85,7 @@ class FileStream : public Stream } bool Close(); - + uint Read(void* _Buffer, uint _Count); uint Write(const void* _Buffer, uint _Count); diff --git a/Include/Pxf/Base/Utils.h b/Include/Pxf/Base/Utils.h index 98899ba..c846846 100644 --- a/Include/Pxf/Base/Utils.h +++ b/Include/Pxf/Base/Utils.h @@ -8,18 +8,18 @@ namespace Pxf { // safe deletion of ptr - template + template inline void SafeDelete(T& _Ptr) { - if(_Ptr != 0) - { + if(_Ptr != 0) + { delete _Ptr; _Ptr = 0; } } // safe deletion of array - template + template inline void SafeDeleteArray(T& _Ptr) { if(_Ptr != 0) @@ -39,7 +39,7 @@ namespace Pxf int Format(char* _Dest, const char* _Format, ...); // Swaps the content of a and b - template + template inline void Swap(T& a, T& b) { T t; t = a; a = b; b = t; @@ -87,8 +87,8 @@ namespace Pxf return ((v>>24) | ((v&0xFF0000)>>8) | ((v&0xFF00)<<8) | ((v&0xFF)<<24)); } - // Swaps endianess for arbitrary data type - template + // Swaps endianess for arbitrary data type + template static T ByteswapArb(const T& t) { if (sizeof(T) > 1) @@ -124,7 +124,7 @@ namespace Pxf template inline T ByteswapLtoN(const T& t) { return t; } template inline T ByteswapNtoL(const T& t) { return t; } #endif - + } // namespace Pxf #endif //__PXF_BASE_UTILS_H__ diff --git a/Include/Pxf/Engine.h b/Include/Pxf/Engine.h index dab1712..b8f1db6 100644 --- a/Include/Pxf/Engine.h +++ b/Include/Pxf/Engine.h @@ -21,7 +21,7 @@ namespace Pxf } void SuperTest(); - + class Engine { public: diff --git a/Include/Pxf/Extra/LuaGUI/Callbacks.h b/Include/Pxf/Extra/LuaGUI/Callbacks.h index 626d832..a1ef2f6 100644 --- a/Include/Pxf/Extra/LuaGUI/Callbacks.h +++ b/Include/Pxf/Extra/LuaGUI/Callbacks.h @@ -136,14 +136,14 @@ namespace LuaGUI GUIWidget* widget = (GUIWidget*)lua_touserdata(L, 1); (*g_CurrentScript.top()).AddQuad(widget, &quad, &texcoord); - + return 0; } else { Message(PXF_LUAGUI_MESSAGE_ID, "Wrong number (%i instead of 6) of parameters to AddWidget(...).", n); } return 0; } - + static int _guicb_AddText(lua_State *L) { int n = lua_gettop(L); // arguments @@ -153,14 +153,14 @@ namespace LuaGUI GUIWidget* widget = (GUIWidget*)lua_touserdata(L, 1); (*g_CurrentScript.top()).AddText(widget, lua_tostring(L, 2), _pos); - + return 0; } else { Message(PXF_LUAGUI_MESSAGE_ID, "Wrong number (%i instead of 4) of parameters to AddText(...).", n); } return 0; } - + static int _guicb_AddTextCentered(lua_State *L) { int n = lua_gettop(L); // arguments @@ -170,7 +170,7 @@ namespace LuaGUI GUIWidget* widget = (GUIWidget*)lua_touserdata(L, 1); (*g_CurrentScript.top()).AddTextCentered(widget, lua_tostring(L, 2), _pos); - + return 0; } else { Message(PXF_LUAGUI_MESSAGE_ID, "Wrong number (%i instead of 4) of parameters to AddTextCentered(...).", n); @@ -249,7 +249,7 @@ namespace LuaGUI } return 0; } - + static int _guicb_Message(lua_State *L) { int n = lua_gettop(L); // arguments diff --git a/Include/Pxf/Extra/LuaGUI/GUIHandler.h b/Include/Pxf/Extra/LuaGUI/GUIHandler.h index 574b5df..8988f67 100644 --- a/Include/Pxf/Extra/LuaGUI/GUIHandler.h +++ b/Include/Pxf/Extra/LuaGUI/GUIHandler.h @@ -27,14 +27,14 @@ namespace Pxf namespace LuaGUI { enum ScriptMessageID { SCRIPT_MESSAGE_TEST = 1 }; - + struct ScriptMessage { int id; GUIScript* script; void* data; }; - + class GUIHandler { public: @@ -50,7 +50,7 @@ namespace Pxf Pxf::Graphics::Device* m_Device; std::list m_Scripts; }; - + } // LuaGUI } // Extra diff --git a/Include/Pxf/Extra/LuaGUI/GUIScript.h b/Include/Pxf/Extra/LuaGUI/GUIScript.h index 4c654da..7ad1d9e 100644 --- a/Include/Pxf/Extra/LuaGUI/GUIScript.h +++ b/Include/Pxf/Extra/LuaGUI/GUIScript.h @@ -31,7 +31,7 @@ namespace Pxf namespace LuaGUI { - + class GUIScript { public: @@ -50,14 +50,14 @@ namespace Pxf void AddText(GUIWidget* _widget, Util::String _text, Math::Vec3f _pos); void AddTextCentered(GUIWidget* _widget, Util::String _text, Math::Vec3f _pos); void SendMessageInternal(GUIWidget* _widget, int _messageid, void* _data); - + // Messages from script to engine bool MessagePump(ScriptMessage* _pmessage); // Send messages from engine to script void SendMessage(int _messageid, char* _data); //void SendMessage(int _messageid, Math::Vec2f); - + private: Graphics::Device* m_Device; Graphics::QuadBatch* m_QuadBatch; @@ -72,7 +72,7 @@ namespace Pxf bool m_Running; bool m_ShouldReload; - + // Messages from script to engine std::list m_Messages; @@ -80,7 +80,7 @@ namespace Pxf void CallLuaFunc(const char* _funcname); bool HandleLuaErrors(int _error); }; - + } // LuaGUI } // Extra diff --git a/Include/Pxf/Extra/LuaGUI/GUIWidget.h b/Include/Pxf/Extra/LuaGUI/GUIWidget.h index ba1dc30..7388422 100644 --- a/Include/Pxf/Extra/LuaGUI/GUIWidget.h +++ b/Include/Pxf/Extra/LuaGUI/GUIWidget.h @@ -55,7 +55,7 @@ namespace Pxf bool m_MousePushedLast; Math::Vec2f m_MouseHit; }; - + } // LuaGUI } // Extra diff --git a/Include/Pxf/Extra/LuaGame/LuaGame.h b/Include/Pxf/Extra/LuaGame/LuaGame.h index d8a0b92..0e1800a 100644 --- a/Include/Pxf/Extra/LuaGame/LuaGame.h +++ b/Include/Pxf/Extra/LuaGame/LuaGame.h @@ -23,7 +23,7 @@ extern "C" { namespace Pxf { - + namespace Extra { namespace LuaGame @@ -39,63 +39,63 @@ namespace Pxf m_Texture = _texture; } }; - + class Game { public: Game(Util::String _gameFilename, Graphics::Device* _device, bool _gracefulFail = false); ~Game(); void CleanUp(); - + bool Reload(); bool Load(); bool Update(float dt); bool Render(); - + // Lua state lua_State *L; - + // Pxf device Graphics::Device* m_Device; - + // Graphic data QBTConnection* m_QBT[8]; int m_CurrentQBT, m_QBTCount; Graphics::QuadBatch* GetCurrentQB(); Graphics::Texture* GetCurrentTexture(); - + // Graphics manipulation (luagame.graphics ...) void BindTexture(Graphics::Texture* _texture); - + void AddQuad(float x, float y, float w, float h); void AddQuad(float x, float y, float w, float h, float s0, float t0, float s1, float t1); void AddQuad(float x, float y, float w, float h, float rotation); void AddQuad(float x, float y, float w, float h, float rotation, float s0, float t0, float s1, float t1); - + void SetColor(float r, float g, float b); void SetAlpha(float a); - + // Depth/Z control float m_CurrentDepth; float m_DepthStep; float m_DepthFar, m_DepthNear; - + // World orientation void Translate(float x, float y); void Rotate(float angle); void LoadIdentity(); - + // Public preload stuff Graphics::Texture* AddPreload(Util::String _filepath); - + // Safely call a lua function from outside the "game" void PrefixStack(const char* _method); void RunScriptMethod(int _param_num = 0); - + #if !defined(TARGET_OS_IPHONEDEV) // Mouse input handling for non-iPhone games void SetInputDevice(Input::Input* _InputDevice); - Input::Input* m_InputDevice; + Input::Input* m_InputDevice; #endif #if defined(TARGET_OS_IPHONEFAKEDEV) @@ -107,21 +107,21 @@ namespace Pxf bool m_Running; // Script state bool m_HasInitialized; bool m_GracefulFail; - + Util::String m_GameFilename; Util::String m_GameIdent; Util::String m_GameVersion; // Simple mechanism for version handling - - + + // Error/panic handling int m_CrashRetries; - + // Private LuaGame quadbatch and texture // (internal usage, such as preload-bar etc) Graphics::Texture* m_CoreTexture; Graphics::QuadBatch* m_CoreQB; - - + + // Private methods void _register_lua_libs_callbacks(); void _register_own_callbacks(); @@ -129,14 +129,14 @@ namespace Pxf bool CallGameMethod(int _param_num = 0); bool CallGameMethod(const char* _method); static void* GetInstance(lua_State *_L); - + // Preload stuff Graphics::Texture* m_PreLoadQueue_Textures[8]; // TODO: Change to some dynamic type of list? int m_PreLoadQueue_Textures_Counter; int m_PreLoadQueue_Total; int PreLoad(); // Called within Render() in the starting phase of the game - - + + // Callback methods static int Print(lua_State *_L); static int RunString(lua_State *_L); diff --git a/Include/Pxf/Extra/LuaGame/Subsystem.h b/Include/Pxf/Extra/LuaGame/Subsystem.h index 64da1ba..090c095 100644 --- a/Include/Pxf/Extra/LuaGame/Subsystem.h +++ b/Include/Pxf/Extra/LuaGame/Subsystem.h @@ -21,13 +21,13 @@ namespace Pxf public: //Subsystem (); //virtual ~Subsystem(); - + //virtual void RegisterClass(lua_State* _L); - + //virtual int ToString(lua_State* _L); private: - + }; } /* LuaGame */ } /* Extra */ diff --git a/Include/Pxf/Extra/LuaGame/Subsystems/Graphics.h b/Include/Pxf/Extra/LuaGame/Subsystems/Graphics.h index 31b7319..4071e29 100644 --- a/Include/Pxf/Extra/LuaGame/Subsystems/Graphics.h +++ b/Include/Pxf/Extra/LuaGame/Subsystems/Graphics.h @@ -26,7 +26,7 @@ namespace Pxf int NewSprite(lua_State* _L); class LuaSprite : public Pxf::Game::Sprite - { + { public: LuaSprite(Graphics::Device* _pDevice, Graphics::Texture* _Texture, int _CellWidth, int _CellHeight,int _Frequency) : Pxf::Game::Sprite(_pDevice,NULL,_Texture,_CellWidth,_CellHeight,_Frequency) { } @@ -34,7 +34,7 @@ namespace Pxf static int _Update(lua_State* _L); static int _AddSequence(lua_State* _L); }; */ - + } /* GraphicsSubsystem */ } /* LuaGame */ } /* Extra */ diff --git a/Include/Pxf/Extra/LuaGame/Subsystems/MouseInput.h b/Include/Pxf/Extra/LuaGame/Subsystems/MouseInput.h index 361d10d..d3f9f18 100644 --- a/Include/Pxf/Extra/LuaGame/Subsystems/MouseInput.h +++ b/Include/Pxf/Extra/LuaGame/Subsystems/MouseInput.h @@ -14,9 +14,9 @@ namespace Pxf { void RegisterClass(lua_State* _L); void Update(Game* g, lua_State* _L); - + int GetMousePos(lua_State* _L); - + } /* MouseInputSubsystem */ } /* LuaGame */ } /* Extra */ diff --git a/Include/Pxf/Extra/LuaGame/Subsystems/Physics.h b/Include/Pxf/Extra/LuaGame/Subsystems/Physics.h index bca953e..a0d07d8 100644 --- a/Include/Pxf/Extra/LuaGame/Subsystems/Physics.h +++ b/Include/Pxf/Extra/LuaGame/Subsystems/Physics.h @@ -28,7 +28,7 @@ namespace Pxf class LuaPhysicsBody : public Subsystem { public: - virtual int GetPosition(lua_State* _L) = 0; + virtual int GetPosition(lua_State* _L) = 0; private: }; @@ -45,7 +45,7 @@ namespace Pxf class LuaPhysicsWorld : Subsystem { public: - LuaPhysicsWorld(Math::Vec3f _Gravity) { + LuaPhysicsWorld(Math::Vec3f _Gravity) { m_Gravity = _Gravity; } @@ -67,7 +67,7 @@ namespace Pxf class LuaBox2DPhysicsWorld : public LuaPhysicsWorld { public: - LuaBox2DPhysicsWorld(Math::Vec3f _Gravity) + LuaBox2DPhysicsWorld(Math::Vec3f _Gravity) : LuaPhysicsWorld(_Gravity) , m_World(0) { } ~LuaBox2DPhysicsWorld(); diff --git a/Include/Pxf/Extra/LuaGame/Subsystems/Resources.h b/Include/Pxf/Extra/LuaGame/Subsystems/Resources.h index cc967a7..56aa6ae 100644 --- a/Include/Pxf/Extra/LuaGame/Subsystems/Resources.h +++ b/Include/Pxf/Extra/LuaGame/Subsystems/Resources.h @@ -15,8 +15,8 @@ namespace Pxf int LoadTexture(lua_State* _L); int BindTexture(lua_State* _L); int GetTextureSize(lua_State* _L); - - + + } /* ResourcesSubsystem */ } /* LuaGame */ } /* Extra */ diff --git a/Include/Pxf/Extra/LuaGame/Subsystems/Vec2.h b/Include/Pxf/Extra/LuaGame/Subsystems/Vec2.h index ec800dc..ff59366 100644 --- a/Include/Pxf/Extra/LuaGame/Subsystems/Vec2.h +++ b/Include/Pxf/Extra/LuaGame/Subsystems/Vec2.h @@ -15,13 +15,13 @@ namespace Pxf public: Vec2 (); ~Vec2 (); - + static void RegisterClass(lua_State* _L); - + // Callbacks static int New(lua_State* _L); static int ToString(lua_State* _L); - + // Data float x,y; }; diff --git a/Include/Pxf/Extra/LuaGame/Subsystems/iPhoneInput.h b/Include/Pxf/Extra/LuaGame/Subsystems/iPhoneInput.h index f02cdd0..74a618f 100644 --- a/Include/Pxf/Extra/LuaGame/Subsystems/iPhoneInput.h +++ b/Include/Pxf/Extra/LuaGame/Subsystems/iPhoneInput.h @@ -13,10 +13,10 @@ namespace Pxf { void RegisterClass(lua_State* _L); void Update(Game* g, lua_State* _L); - + int GetText(lua_State* _L); - - + + } /* IPhoneInputSubsystem */ } /* LuaGame */ } /* Extra */ diff --git a/Include/Pxf/Extra/SimpleFont/SimpleFont.h b/Include/Pxf/Extra/SimpleFont/SimpleFont.h index 9ed06e6..e35aadf 100644 --- a/Include/Pxf/Extra/SimpleFont/SimpleFont.h +++ b/Include/Pxf/Extra/SimpleFont/SimpleFont.h @@ -12,7 +12,7 @@ namespace Pxf { namespace Graphics { class QuadBatch; class Texture; } - + namespace Extra { class SimpleFont @@ -20,25 +20,25 @@ namespace Pxf public: SimpleFont (Graphics::Device *_device); ~SimpleFont (); - + void Load(Util::String _font_filepath, float _font_size, int _texture_size = 512); void ResetText(); void AddText(Util::String _text, Math::Vec3f _pos); void AddTextCentered(Util::String _text, Math::Vec3f _pos); void Draw(); private: - + // Portable method to get file size int _get_filesize(); - + Graphics::Device *m_Device; Util::String m_FontFilepath; Graphics::Texture *m_CharmapTexture; - + stbtt_bakedchar m_CharData[96]; - + Graphics::QuadBatch *m_QuadBatch; - + int m_TextureSize; float m_FontSize; }; diff --git a/Include/Pxf/Extra/SimpleFont/stb_truetype.h b/Include/Pxf/Extra/SimpleFont/stb_truetype.h index a3d3035..38772fe 100644 --- a/Include/Pxf/Extra/SimpleFont/stb_truetype.h +++ b/Include/Pxf/Extra/SimpleFont/stb_truetype.h @@ -73,7 +73,7 @@ // Curve tesselation 120 LOC \__ 500 LOC Bitmap creation // Bitmap management 70 LOC / // Baked bitmap interface 70 LOC / -// Font name matching & access 150 LOC ---- 150 +// Font name matching & access 150 LOC ---- 150 // C runtime library abstraction 60 LOC ---- 60 @@ -157,7 +157,7 @@ int main(int argc, char **argv) } return 0; } -#endif +#endif // // Output: // @@ -171,9 +171,9 @@ int main(int argc, char **argv) // :@@. M@M // @@@o@@@@ // :M@@V:@@. -// +// ////////////////////////////////////////////////////////////////////////////// -// +// // Complete program: print "Hello World!" banner, with bugs // #if 0 @@ -293,7 +293,7 @@ extern "C" { typedef struct { unsigned short x0,y0,x1,y1; // coordinates of bbox in bitmap - float xoff,yoff,xadvance; + float xoff,yoff,xadvance; } stbtt_bakedchar; extern int stbtt_BakeFontBitmap(const unsigned char *data, int offset, // font location (use offset=0 for plain .ttf) @@ -962,7 +962,7 @@ int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_verte stbtt_setvertex(&vertices[num_vertices++], STBTT_vline,sx,sy,0,0); } - // now start the new one + // now start the new one stbtt_setvertex(&vertices[num_vertices++], STBTT_vmove,x,y,0,0); next_move = 1 + ttUSHORT(endPtsOfContours+j*2); ++j; @@ -1002,7 +1002,7 @@ int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_verte int comp_num_verts = 0, i; stbtt_vertex *comp_verts = 0, *tmp = 0; float mtx[6] = {1,0,0,1,0,0}, m, n; - + flags = ttSHORT(comp); comp+=2; gidx = ttSHORT(comp); comp+=2; @@ -1032,7 +1032,7 @@ int stbtt_GetGlyphShape(const stbtt_fontinfo *info, int glyph_index, stbtt_verte mtx[2] = ttSHORT(comp)/16384.0f; comp+=2; mtx[3] = ttSHORT(comp)/16384.0f; comp+=2; } - + // Find transformation scales. m = (float) sqrt(mtx[0]*mtx[0] + mtx[1]*mtx[1]); n = (float) sqrt(mtx[2]*mtx[2] + mtx[3]*mtx[3]); @@ -1222,7 +1222,7 @@ static void stbtt__fill_active_edges(unsigned char *scanline, int len, stbtt__ac } } } - + e = e->next; } } @@ -1512,7 +1512,7 @@ unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, f { int ix0,iy0,ix1,iy1; stbtt__bitmap gbm; - stbtt_vertex *vertices; + stbtt_vertex *vertices; int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); if (scale_x == 0) scale_x = scale_y; @@ -1532,7 +1532,7 @@ unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, f if (height) *height = gbm.h; if (xoff ) *xoff = ix0; if (yoff ) *yoff = iy0; - + if (gbm.w && gbm.h) { gbm.pixels = (unsigned char *) STBTT_malloc(gbm.w * gbm.h, info->userdata); if (gbm.pixels) { @@ -1543,14 +1543,14 @@ unsigned char *stbtt_GetGlyphBitmap(const stbtt_fontinfo *info, float scale_x, f } STBTT_free(vertices, info->userdata); return gbm.pixels; -} +} void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int glyph) { int ix0,iy0; - stbtt_vertex *vertices; + stbtt_vertex *vertices; int num_verts = stbtt_GetGlyphShape(info, glyph, &vertices); - stbtt__bitmap gbm; + stbtt__bitmap gbm; stbtt_GetGlyphBitmapBox(info, glyph, scale_x, scale_y, &ix0,&iy0,0,0); gbm.pixels = output; @@ -1567,7 +1567,7 @@ void stbtt_MakeGlyphBitmap(const stbtt_fontinfo *info, unsigned char *output, in unsigned char *stbtt_GetCodepointBitmap(const stbtt_fontinfo *info, float scale_x, float scale_y, int codepoint, int *width, int *height, int *xoff, int *yoff) { return stbtt_GetGlyphBitmap(info, scale_x, scale_y, stbtt_FindGlyphIndex(info,codepoint), width,height,xoff,yoff); -} +} void stbtt_MakeCodepointBitmap(const stbtt_fontinfo *info, unsigned char *output, int out_w, int out_h, int out_stride, float scale_x, float scale_y, int codepoint) { @@ -1651,7 +1651,7 @@ void stbtt_GetBakedQuad(stbtt_bakedchar *chardata, int pw, int ph, int char_inde // // check if a utf8 string contains a prefix which is the utf16 string; if so return length of matching utf8 string -static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2) +static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, stbtt_int32 len1, stbtt_uint8 *s2, stbtt_int32 len2) { stbtt_int32 i=0; @@ -1690,7 +1690,7 @@ static stbtt_int32 stbtt__CompareUTF8toUTF16_bigendian_prefix(stbtt_uint8 *s1, s return i; } -int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2) +int stbtt_CompareUTF8toUTF16_bigendian(const char *s1, int len1, const char *s2, int len2) { return len1 == stbtt__CompareUTF8toUTF16_bigendian_prefix((stbtt_uint8*) s1, len1, (stbtt_uint8*) s2, len2); } diff --git a/Include/Pxf/Extra/SimpleNet/SimpleClient.h b/Include/Pxf/Extra/SimpleNet/SimpleClient.h index 142a43a..33d2077 100644 --- a/Include/Pxf/Extra/SimpleNet/SimpleClient.h +++ b/Include/Pxf/Extra/SimpleNet/SimpleClient.h @@ -12,10 +12,10 @@ namespace Pxf public: SimpleClient(); ~SimpleClient(); - + void Connect(char* _host, unsigned int _port, unsigned int _channels = 1); void Disconnect(); - + int MessagePump(NetMessage* _message); private: diff --git a/Include/Pxf/Extra/SimpleNet/SimpleNet.h b/Include/Pxf/Extra/SimpleNet/SimpleNet.h index 89b96e1..cc18a39 100644 --- a/Include/Pxf/Extra/SimpleNet/SimpleNet.h +++ b/Include/Pxf/Extra/SimpleNet/SimpleNet.h @@ -4,10 +4,10 @@ #include namespace Pxf -{ +{ namespace Extra { - + typedef ENetEvent NetMessage; typedef enum { @@ -27,7 +27,7 @@ namespace Pxf ~SimpleNet(); private: - + }; } // Extra } // Pxf diff --git a/Include/Pxf/Extra/SimpleNet/SimpleServer.h b/Include/Pxf/Extra/SimpleNet/SimpleServer.h index 2f80b98..c22ac88 100644 --- a/Include/Pxf/Extra/SimpleNet/SimpleServer.h +++ b/Include/Pxf/Extra/SimpleNet/SimpleServer.h @@ -12,7 +12,7 @@ namespace Pxf public: SimpleServer(char* _host, unsigned int _port, unsigned int _max_clients = 32); ~SimpleServer(); - + void Open(); void Close(); int MessagePump(NetMessage* _message); @@ -23,7 +23,7 @@ namespace Pxf // ENet specifics ENetAddress m_address; ENetHost *m_server; - + }; } /* Extra */ } /* Pxf */ diff --git a/Include/Pxf/Game/Box2D/Box2DParameterDefs.h b/Include/Pxf/Game/Box2D/Box2DParameterDefs.h index 9017995..b436ba3 100644 --- a/Include/Pxf/Game/Box2D/Box2DParameterDefs.h +++ b/Include/Pxf/Game/Box2D/Box2DParameterDefs.h @@ -7,7 +7,7 @@ namespace Pxf { namespace Game { // these are just a few parameters to get started.. could scrap this as well, its just to create bodies rapidly.. - struct body_parameters + struct body_parameters { Math::Vec2f position; Math::Vec2f half_size; diff --git a/Include/Pxf/Game/Box2D/Box2DPhysicsObject.h b/Include/Pxf/Game/Box2D/Box2DPhysicsObject.h index 8c46bdb..a55bc3a 100644 --- a/Include/Pxf/Game/Box2D/Box2DPhysicsObject.h +++ b/Include/Pxf/Game/Box2D/Box2DPhysicsObject.h @@ -5,22 +5,22 @@ class b2Body; -namespace Pxf +namespace Pxf { namespace Game { class Box2DPhysicsObject : public PhysicsObject { public: - Box2DPhysicsObject(b2Body* _Body = 0) + Box2DPhysicsObject(b2Body* _Body = 0) : m_Body(0) { m_Body = _Body; } ~Box2DPhysicsObject(); - + void SetPosition(Math::Vec3f _Position); Math::Vec3f GetPosition(); - + b2Body* GetBody() { return m_Body; } void SetBody(b2Body* _Body) { m_Body = _Body; } private: diff --git a/Include/Pxf/Game/Box2D/Box2DPhysicsWorld.h b/Include/Pxf/Game/Box2D/Box2DPhysicsWorld.h index 7aacb0c..2a52353 100644 --- a/Include/Pxf/Game/Box2D/Box2DPhysicsWorld.h +++ b/Include/Pxf/Game/Box2D/Box2DPhysicsWorld.h @@ -10,8 +10,8 @@ class b2World; class b2Body; -namespace Pxf -{ +namespace Pxf +{ /* This attempt at forward declaration yields specialization of 'Pxf::Math::Vector3D' after instantiation error.. any ideas? namespace Math @@ -19,9 +19,9 @@ namespace Pxf class Vector3D; typedef Vector3D Vec3f; } */ - + namespace Game - { + { struct body_parameters; class PhysicsObject; class Box2DPhysicsWorld : public PhysicsWorld @@ -29,15 +29,15 @@ namespace Pxf public: Box2DPhysicsWorld(Math::Vec2f _Gravity, bool _SleepObjects, float32 _TimeStep, int32 _VelocityIterations, int32 _PositionIterations); ~Box2DPhysicsWorld(); - + // TODO: what to do void Simulate(); void ClearForces(); - + PhysicsObject* CreateBodyFromParams(body_parameters _Params); - + b2World* GetWorld() { return m_World; } - + private: b2World* m_World; bool m_SleepObjects; diff --git a/Include/Pxf/Game/GameObject.h b/Include/Pxf/Game/GameObject.h index a2acb0d..6f18aa2 100644 --- a/Include/Pxf/Game/GameObject.h +++ b/Include/Pxf/Game/GameObject.h @@ -4,7 +4,7 @@ #include #include -namespace Pxf +namespace Pxf { namespace Game { @@ -16,11 +16,11 @@ namespace Pxf GameObject(); GameObject(Math::Vec3f _Position, const char* _ID = 0); GameObject(float _X, float _Y, float _Z, const char* _ID = 0); - + protected: static unsigned m_ObjectCounter; const char* m_ID; - + private: void _GenerateNewName(); }; diff --git a/Include/Pxf/Game/GameState.h b/Include/Pxf/Game/GameState.h index fb84627..1ecaab4 100644 --- a/Include/Pxf/Game/GameState.h +++ b/Include/Pxf/Game/GameState.h @@ -2,8 +2,8 @@ #define _PXF_GAME_GAMESTATE_H_ namespace Pxf -{ - namespace Game +{ + namespace Game { // abstract state class class GameState @@ -11,7 +11,7 @@ namespace Pxf public: // Initialize state resources etc. virtual bool Init() = 0; - // update state + // update state virtual void Update() = 0; // render this game state virtual void Render() = 0; diff --git a/Include/Pxf/Game/PhysicsBodyDefs.h b/Include/Pxf/Game/PhysicsBodyDefs.h index 2066507..f99a060 100644 --- a/Include/Pxf/Game/PhysicsBodyDefs.h +++ b/Include/Pxf/Game/PhysicsBodyDefs.h @@ -1,8 +1,8 @@ #ifndef _PXF_GAME_PHYSICSBODYDEFS_H_ #define _PXF_GAME_PHYSICSBODYDEFS_H_ -namespace Pxf -{ +namespace Pxf +{ namespace Game { enum PhysicsBodyType diff --git a/Include/Pxf/Game/PhysicsObject.h b/Include/Pxf/Game/PhysicsObject.h index a134cec..ad0ea96 100644 --- a/Include/Pxf/Game/PhysicsObject.h +++ b/Include/Pxf/Game/PhysicsObject.h @@ -3,18 +3,18 @@ #include -namespace Pxf -{ +namespace Pxf +{ namespace Game { - class PhysicsObject + class PhysicsObject { - public: + public: virtual Math::Vec3f GetPosition() = 0; virtual void SetPosition(Math::Vec3f) = 0; - + private: - + }; } // Game } // Pxf diff --git a/Include/Pxf/Game/PhysicsWorld.h b/Include/Pxf/Game/PhysicsWorld.h index 77b88be..0ddab32 100644 --- a/Include/Pxf/Game/PhysicsWorld.h +++ b/Include/Pxf/Game/PhysicsWorld.h @@ -3,8 +3,8 @@ #include -namespace Pxf -{ +namespace Pxf +{ namespace Game { class PhysicsObject; diff --git a/Include/Pxf/Game/Sprite.h b/Include/Pxf/Game/Sprite.h index 82b2caa..89ab733 100644 --- a/Include/Pxf/Game/Sprite.h +++ b/Include/Pxf/Game/Sprite.h @@ -9,15 +9,15 @@ #include namespace Pxf -{ +{ namespace Graphics { class Texture; class Device; class VertexBuffer; } - namespace Game - { + namespace Game + { struct sprite_sequence { ~sprite_sequence(); int* sequence; @@ -51,7 +51,7 @@ namespace Pxf tex_coords = uv; } }; - + Sprite() { } Sprite(Graphics::Device* _pDevice, const char* _ID, Graphics::Texture* _Texture, int _CellWidth, int _CellHeight,int _Frequency); ~Sprite(); @@ -65,10 +65,10 @@ namespace Pxf void Stop(); void Start(); void NextFrame(); - + void AddSequence(int _SequenceLength, ...); void SetScale(float _Value) { m_DrawScale = _Value; } - + bool IsReady() { return m_Ready; } int GetZIndex() { return m_ZIndex; } int GetCurrentFrame() { return m_CurrentFrame; } @@ -76,13 +76,13 @@ namespace Pxf void _CalculateUV(); void _SetCurrentUV(); const char* m_ID; - + Graphics::Device* m_Device; Graphics::Texture* m_Texture; Graphics::VertexBuffer* m_DrawBuffer; SpriteDrawData* m_MappedData; // VertexBuffer access pointer - - int m_CellSize[2]; // force power-of-two cell size? + + int m_CellSize[2]; // force power-of-two cell size? float m_UVStep[2]; // step sizes float m_UVCoords[4]; float (*m_UVValues)[4]; @@ -93,14 +93,14 @@ namespace Pxf int m_CurrentFrame; // frame counter int m_ZIndex; // depth sort int m_MaxFrames; // calculate - + float m_TimeStep; // 60 / frequency float m_SwitchTime; // += dt, call nextframe when >= timestep float m_DrawScale; // draw scale bool m_Ready; bool m_UseCustomSequence; - + std::vector m_SequenceList; }; } diff --git a/Include/Pxf/Game/SpriteBatch.h b/Include/Pxf/Game/SpriteBatch.h index e3072c7..0f31fce 100644 --- a/Include/Pxf/Game/SpriteBatch.h +++ b/Include/Pxf/Game/SpriteBatch.h @@ -2,16 +2,16 @@ #define _PXF_GAME_SPRITEBATCH_H_ namespace Pxf -{ - namespace Game +{ + namespace Game { - /* + /* Abstract spritebatch class --- The purpose of this class is to manage and draw a set of sprites at the same time, - so that the user wont need to explicitly call draw methods on each sprite. + so that the user wont need to explicitly call draw methods on each sprite. - Todo: Sort sprites? + Todo: Sort sprites? */ class SpriteBatch diff --git a/Include/Pxf/Graphics/D3D9/DeviceD3D9.h b/Include/Pxf/Graphics/D3D9/DeviceD3D9.h index 226c354..ee3b062 100644 --- a/Include/Pxf/Graphics/D3D9/DeviceD3D9.h +++ b/Include/Pxf/Graphics/D3D9/DeviceD3D9.h @@ -17,7 +17,7 @@ namespace Pxf{ public: DeviceD3D9(); ~DeviceD3D9(); - + Window* OpenWindow(WindowSpecifications* _pWindowSpecs); void CloseWindow(); diff --git a/Include/Pxf/Graphics/D3D9/WindowD3D.h b/Include/Pxf/Graphics/D3D9/WindowD3D.h index d5fedf7..5c37aeb 100644 --- a/Include/Pxf/Graphics/D3D9/WindowD3D.h +++ b/Include/Pxf/Graphics/D3D9/WindowD3D.h @@ -30,7 +30,7 @@ namespace Pxf{ char* GetContextTypeName(); bool IsOpen(); - /* + /* bool IsActive(); bool IsMinimized(); */ diff --git a/Include/Pxf/Graphics/Device.h b/Include/Pxf/Graphics/Device.h index 7ecf150..9215d63 100644 --- a/Include/Pxf/Graphics/Device.h +++ b/Include/Pxf/Graphics/Device.h @@ -21,9 +21,9 @@ namespace Pxf class NonInterleavedVertexBuffer; class QuadBatch; - + class Texture; - + //! Abstract video device class Device { @@ -53,7 +53,7 @@ namespace Pxf // PrimitiveBatch virtual QuadBatch* CreateQuadBatch(int _maxSize) = 0; - + virtual VertexBuffer* CreateVertexBuffer(VertexBufferLocation _VertexBufferLocation, VertexBufferUsageFlag _VertexBufferUsageFlag) = 0; virtual void DestroyVertexBuffer(VertexBuffer* _pVertexBuffer) = 0; virtual void DrawBuffer(VertexBuffer* _pVertexBuffer) = 0; @@ -63,16 +63,16 @@ namespace Pxf virtual RenderTarget* CreateRenderTarget(int _Width,int _Height,RTFormat _ColorFormat,RTFormat _DepthFormat) = 0; //virtual VideoBuffer* CreateVideoBuffer(int _Format, int _Width, int _Height) = 0; - + bool Ready() { return m_Ready; } private: bool m_Ready; - + // Need the name VertexBuffer for draw calls...? // Or should *VertexArray inherit from Drawable? // QuadBatch : public PrimitiveBatch public : Drawable - // + // }; } // Graphics diff --git a/Include/Pxf/Graphics/DeviceResource.h b/Include/Pxf/Graphics/DeviceResource.h index c2dd262..1075040 100644 --- a/Include/Pxf/Graphics/DeviceResource.h +++ b/Include/Pxf/Graphics/DeviceResource.h @@ -8,13 +8,13 @@ namespace Pxf { namespace Graphics { class Device; - + class DeviceResource { protected: static unsigned GLOBAL_RESOURCE_COUNTER; uint m_ID; - Pxf::Graphics::Device *m_pDevice; + Pxf::Graphics::Device *m_pDevice; Resource::AbstractResource* m_Resource; public: diff --git a/Include/Pxf/Graphics/DeviceType.h b/Include/Pxf/Graphics/DeviceType.h index 6411d28..8319fc0 100644 --- a/Include/Pxf/Graphics/DeviceType.h +++ b/Include/Pxf/Graphics/DeviceType.h @@ -7,7 +7,7 @@ namespace Pxf { namespace Graphics { - + const char* DeviceTypeName(DeviceType _deviceType); } // Graphics } // Pxf diff --git a/Include/Pxf/Graphics/OpenGL/DeviceGLES11.h b/Include/Pxf/Graphics/OpenGL/DeviceGLES11.h index 2800590..c7ae8b3 100644 --- a/Include/Pxf/Graphics/OpenGL/DeviceGLES11.h +++ b/Include/Pxf/Graphics/OpenGL/DeviceGLES11.h @@ -25,11 +25,11 @@ namespace Pxf{ public: DeviceGLES11(); ~DeviceGLES11(); - + Window* OpenWindow(WindowSpecifications* _pWindowSpecs); void CloseWindow(); DeviceType GetDeviceType() { return EOpenGLES11; } - + // Graphics void GetSize(int *_w, int *_h); void SetViewport(int _x, int _y, int _w, int _h); @@ -47,7 +47,7 @@ namespace Pxf{ // PrimitiveBatch QuadBatch* CreateQuadBatch(int _maxSize); - + VertexBuffer* CreateVertexBuffer(VertexBufferLocation _VertexBufferLocation, VertexBufferUsageFlag _VertexBufferUsageFlag); void DestroyVertexBuffer(VertexBuffer* _pVertexBuffer); void DrawBuffer(VertexBuffer* _pVertexBuffer); @@ -60,17 +60,17 @@ namespace Pxf{ void DeleteVideoBuffer(VideoBuffer* _VideoBuffer); bool BindVideoBuffer(VideoBuffer* _VideoBuffer); bool UnBindVideoBufferType(int _FormatType); - + void SetEAGLContext(EAGLContext* _Context) { m_Context = _Context; } void SetUseDepthBuffer(bool _Toggle) { m_UseDepthBuffer = _Toggle; } void SetBackingWidth(GLint _Width) { m_BackingWidth = _Width; } void SetBackingHeight(GLint _Height) { m_BackingHeight = _Height; } GLint GetBackingWidth() { return m_BackingWidth; } GLint GetBackingHeight() { return m_BackingHeight; } - + //bool InitBuffers(); bool InitBuffers(EAGLContext* _context, CAEAGLLayer* _EAGLLayer); // Temporary.. - + // Input handling // This is fuuugly, but hey, it sucks to mix c++ and obj-c. void SetUIView(UIView* _view); @@ -80,34 +80,34 @@ namespace Pxf{ bool InputHasRespondedText(); void InputGetResponseText(char *outText); int InputGetResponseButton(); - - + + bool InputTap(InputTapData* _data); bool InputRelease(InputTapData* _data); bool InputDoubleTap(InputTapData* _data); bool InputDrag(InputDragData* _data); - + void InputSetTap(float x, float y); void InputSetRelease(float x, float y); void InputSetDoubleTap(float x, float y); void InputSetDrag(float x1, float y1, float x2, float y2); - + /* - (void) clearResponse; - (bool) hasRespondedToInput; - (void) getInputResponseText:(const char *)outText; - (int) getInputResponseButton; */ - + EAGLContext* GetEAGLContext() { return m_Context; } bool GetUseDepthBuffer() { return m_UseDepthBuffer; } VideoBufferGL* GetRenderBuffer() { return m_RenderBuffer; } VideoBufferGL* GetFrameBuffer() { return m_FrameBuffer; } VideoBufferGL* GetDepthBuffer() { return m_DepthBuffer; } - + private: void _ConfigureTextureUnits(); - + // TODO: replace videobuffer with simple gluints.. /*GLuint m_RenderBuffer; GLuint m_FrameBuffer; @@ -117,11 +117,11 @@ namespace Pxf{ VideoBufferGL* m_RenderBuffer; VideoBufferGL* m_FrameBuffer; VideoBufferGL* m_DepthBuffer; - + bool m_UseDepthBuffer; GLint m_BackingWidth; GLint m_BackingHeight; - + // Input device for iPhone InputHandler* m_InputHandler; bool m_InputTapOccurred; @@ -132,7 +132,7 @@ namespace Pxf{ float m_InputReleaseData[2]; float m_InputDoubleTapData[2]; float m_InputDragData[4]; - + }; } // Graphics } // Pxf diff --git a/Include/Pxf/Graphics/OpenGL/EAGLView11.h b/Include/Pxf/Graphics/OpenGL/EAGLView11.h index a8cb134..a1a503f 100644 --- a/Include/Pxf/Graphics/OpenGL/EAGLView11.h +++ b/Include/Pxf/Graphics/OpenGL/EAGLView11.h @@ -6,7 +6,7 @@ @interface EAGLView11 : EAGLView { @private - + } - (bool) InitDevice; diff --git a/Include/Pxf/Graphics/OpenGL/OpenGL.h b/Include/Pxf/Graphics/OpenGL/OpenGL.h index 7140e92..c311a33 100644 --- a/Include/Pxf/Graphics/OpenGL/OpenGL.h +++ b/Include/Pxf/Graphics/OpenGL/OpenGL.h @@ -1,7 +1,7 @@ #ifndef _PXF_GRAPHICS_OPENGL_H_ #define _PXF_GRAPHICS_OPENGL_H_ -#include +#include #if defined(CONF_FAMILY_WINDOWS) #define WIN32_LEAN_AND_MEAN @@ -10,7 +10,7 @@ #endif #if defined(CONF_PLATFORM_MACOSX) - + #if defined(__i386__) && !defined(TARGET_OS_IPHONEDEV) #include #include @@ -21,7 +21,7 @@ // Running un iPhone device or simulator #include #include - + #endif #else #include diff --git a/Include/Pxf/Graphics/OpenGL/OpenGLUtils.h b/Include/Pxf/Graphics/OpenGL/OpenGLUtils.h index d662a6e..dbaa051 100644 --- a/Include/Pxf/Graphics/OpenGL/OpenGLUtils.h +++ b/Include/Pxf/Graphics/OpenGL/OpenGLUtils.h @@ -3,9 +3,9 @@ #include -namespace Pxf +namespace Pxf { - namespace Graphics + namespace Graphics { // Should this be elsewhere? bool IsExtensionSupported( char* szTargetExtension ) diff --git a/Include/Pxf/Graphics/OpenGL/QuadBatchGL2.h b/Include/Pxf/Graphics/OpenGL/QuadBatchGL2.h index 3ce0cec..055b886 100644 --- a/Include/Pxf/Graphics/OpenGL/QuadBatchGL2.h +++ b/Include/Pxf/Graphics/OpenGL/QuadBatchGL2.h @@ -8,7 +8,7 @@ namespace Pxf { namespace Graphics { - + class QuadBatchGL2 : public QuadBatch { public: @@ -38,7 +38,7 @@ namespace Pxf void AddTopLeft(float x, float y, float w, float h); void AddCentered(float x, float y, float w, float h); void AddCentered(float x, float y, float w, float h, float rotation); - + void Draw(); private: void Flush(); @@ -51,7 +51,7 @@ namespace Pxf float m_CurrentAlpha; //float m_Rotation; - + //Math::Vec2f m_Translation; Math::Mat4 m_TransformMatrix; diff --git a/Include/Pxf/Graphics/OpenGL/QuadBatchGLES11.h b/Include/Pxf/Graphics/OpenGL/QuadBatchGLES11.h index 4460554..7035b4b 100644 --- a/Include/Pxf/Graphics/OpenGL/QuadBatchGLES11.h +++ b/Include/Pxf/Graphics/OpenGL/QuadBatchGLES11.h @@ -8,7 +8,7 @@ namespace Pxf { namespace Graphics { - + class QuadBatchGLES11 : public QuadBatch { public: @@ -38,7 +38,7 @@ namespace Pxf void AddTopLeft(float x, float y, float w, float h); void AddCentered(float x, float y, float w, float h); void AddCentered(float x, float y, float w, float h, float rotation); - + void Draw(); private: void Flush(); @@ -51,7 +51,7 @@ namespace Pxf float m_CurrentAlpha; //float m_Rotation; - + //Math::Vec2f m_Translation; Math::Mat4 m_TransformMatrix; diff --git a/Include/Pxf/Graphics/OpenGL/RenderTargetGL2.h b/Include/Pxf/Graphics/OpenGL/RenderTargetGL2.h index f9a54d7..c73198f 100644 --- a/Include/Pxf/Graphics/OpenGL/RenderTargetGL2.h +++ b/Include/Pxf/Graphics/OpenGL/RenderTargetGL2.h @@ -7,8 +7,8 @@ namespace Pxf { namespace Graphics - { - const GLenum FBO_Buffers[] = { GL_COLOR_ATTACHMENT0_EXT, + { + const GLenum FBO_Buffers[] = { GL_COLOR_ATTACHMENT0_EXT, GL_COLOR_ATTACHMENT1_EXT, GL_COLOR_ATTACHMENT2_EXT, GL_COLOR_ATTACHMENT3_EXT }; @@ -19,11 +19,11 @@ namespace Pxf { private: bool m_MRTEnabled; - + int m_Width; int m_Height; - // balls, just realized color formats already have been set by the device when the textures are created.. + // balls, just realized color formats already have been set by the device when the textures are created.. // to maintain "FBO completeness", the same color formats must be used in all color attachments GLenum m_ColorFormat; GLenum m_DepthFormat; @@ -54,10 +54,10 @@ namespace Pxf public: PBO(Device* _pDevice) : RenderTarget(_pDevice, RT_TYPE_PBO) { - + } ~PBO(); - + void AddColorAttachment(Texture* _Color); void AddDepthAttachment(Texture* _Depth); }; diff --git a/Include/Pxf/Graphics/OpenGL/TextureGL2.h b/Include/Pxf/Graphics/OpenGL/TextureGL2.h index c5d5e69..5f54f7a 100644 --- a/Include/Pxf/Graphics/OpenGL/TextureGL2.h +++ b/Include/Pxf/Graphics/OpenGL/TextureGL2.h @@ -11,7 +11,7 @@ namespace Pxf namespace Graphics { - + //! Abstract texture class class TextureGL2 : public Texture { @@ -19,7 +19,7 @@ namespace Pxf TextureGL2(Device* _pDevice); TextureGL2(const char* _filepath, Device* _pDevice); ~TextureGL2(); - + void Load(); void Load(const char* _filepath); void LoadData(const unsigned char* _datachunk, int _width, int _height, int _channels); @@ -36,7 +36,7 @@ namespace Pxf void SetClampMethod(TextureClampMethod _Method); Math::Vec4f CreateTextureSubset(float _x1, float _y1, float _x2, float _y2); - + // OGL specific inline GLuint GetTextureID() { return m_TextureID; } diff --git a/Include/Pxf/Graphics/OpenGL/TextureGLES.h b/Include/Pxf/Graphics/OpenGL/TextureGLES.h index 1085b65..c1ef27b 100644 --- a/Include/Pxf/Graphics/OpenGL/TextureGLES.h +++ b/Include/Pxf/Graphics/OpenGL/TextureGLES.h @@ -11,7 +11,7 @@ namespace Pxf { namespace Graphics { - + //! Abstract texture class class TextureGLES : public Texture { @@ -19,7 +19,7 @@ namespace Pxf TextureGLES(Device* _pDevice); TextureGLES(const char* _filepath, Device* _pDevice); ~TextureGLES(); - + void Load(); void Load(const char* _filepath); void LoadData(const unsigned char* _datachunk, int _width, int _height, int _channels); @@ -36,7 +36,7 @@ namespace Pxf void SetClampMethod(TextureClampMethod _Method); Math::Vec4f CreateTextureSubset(float _x1, float _y1, float _x2, float _y2); - + // OGL specific inline GLuint GetTextureID() { return m_TextureID; } diff --git a/Include/Pxf/Graphics/OpenGL/VertexBufferGL2.h b/Include/Pxf/Graphics/OpenGL/VertexBufferGL2.h index 74f5679..0b7bcc3 100644 --- a/Include/Pxf/Graphics/OpenGL/VertexBufferGL2.h +++ b/Include/Pxf/Graphics/OpenGL/VertexBufferGL2.h @@ -22,7 +22,7 @@ namespace Pxf virtual ~VertexBufferGL2(); void CreateNewBuffer(uint32 _NumVertices, uint32 _VertexSize); - void CreateFromBuffer(void* _Buffer,uint32 _NumVertices, uint32 _VertexSize); + void CreateFromBuffer(void* _Buffer,uint32 _NumVertices, uint32 _VertexSize); void UpdateData(void* _Buffer, uint32 _Count, uint32 _Offset); diff --git a/Include/Pxf/Graphics/OpenGL/VertexBufferGLES11.h b/Include/Pxf/Graphics/OpenGL/VertexBufferGLES11.h index 723d2e5..c64b917 100644 --- a/Include/Pxf/Graphics/OpenGL/VertexBufferGLES11.h +++ b/Include/Pxf/Graphics/OpenGL/VertexBufferGLES11.h @@ -19,7 +19,7 @@ namespace Pxf virtual ~VertexBufferGLES11(); void CreateNewBuffer(uint32 _NumVertices, uint32 _VertexSize); - void CreateFromBuffer(void* _Buffer,uint32 _NumVertices, uint32 _VertexSize); + void CreateFromBuffer(void* _Buffer,uint32 _NumVertices, uint32 _VertexSize); void UpdateData(void* _Buffer, uint32 _Count, uint32 _Offset); @@ -27,7 +27,7 @@ namespace Pxf void UnmapData(); void _PreDraw(); - void _PostDraw(); + void _PostDraw(); }; } // Graphics } // Pxf diff --git a/Include/Pxf/Graphics/OpenGL/VideoBufferGL.h b/Include/Pxf/Graphics/OpenGL/VideoBufferGL.h index 94749d0..f0d494d 100644 --- a/Include/Pxf/Graphics/OpenGL/VideoBufferGL.h +++ b/Include/Pxf/Graphics/OpenGL/VideoBufferGL.h @@ -6,7 +6,7 @@ namespace Pxf { namespace Graphics - { + { struct VideoBufferGL : VideoBuffer { unsigned int m_Handle; diff --git a/Include/Pxf/Graphics/OpenGL3/WindowGL3.h b/Include/Pxf/Graphics/OpenGL3/WindowGL3.h index affadb1..e0f477f 100644 --- a/Include/Pxf/Graphics/OpenGL3/WindowGL3.h +++ b/Include/Pxf/Graphics/OpenGL3/WindowGL3.h @@ -41,7 +41,7 @@ namespace Pxf{ HDC m_HDC; // Private GDI Device Context HGLRC m_HRC; // Permanent Rendering Context HWND m_Window; // Window Handle - HINSTANCE m_HInstance;// Instance Of The Application + HINSTANCE m_HInstance;// Instance Of The Application #endif // CONF_FAMILY_WINDOWS int m_width, m_height; diff --git a/Include/Pxf/Graphics/RenderTarget.h b/Include/Pxf/Graphics/RenderTarget.h index c42ecaa..ec18d82 100644 --- a/Include/Pxf/Graphics/RenderTarget.h +++ b/Include/Pxf/Graphics/RenderTarget.h @@ -7,7 +7,7 @@ namespace Pxf { namespace Graphics - { + { // REDO THIS // Move the enums.. @@ -26,7 +26,7 @@ namespace Pxf class Device; class Texture; - //! Abstract render target + //! Abstract render target class RenderTarget : public DeviceResource { RTType m_RTType; diff --git a/Include/Pxf/Graphics/Shader.h b/Include/Pxf/Graphics/Shader.h index b033567..e3c74fb 100644 --- a/Include/Pxf/Graphics/Shader.h +++ b/Include/Pxf/Graphics/Shader.h @@ -9,7 +9,7 @@ namespace Pxf { } namespace Graphics { - + class Shader : Resource::DeviceResource { private: @@ -25,7 +25,7 @@ namespace Pxf { virtual void Bind() = 0; virtual void Unbind() = 0; - + inline bool IsValid() { return m_IsValid; diff --git a/Include/Pxf/Graphics/Shader/GLSLShader.h b/Include/Pxf/Graphics/Shader/GLSLShader.h index d5f7f63..fc85ea2 100644 --- a/Include/Pxf/Graphics/Shader/GLSLShader.h +++ b/Include/Pxf/Graphics/Shader/GLSLShader.h @@ -20,15 +20,15 @@ namespace Pxf { bool m_SourceChanged; void _Init(); public: - GLSLComponent(Resource::Chunk* _Chunk, const char* _Source,Resource::SHType _Type) + GLSLComponent(Resource::Chunk* _Chunk, const char* _Source,Resource::SHType _Type) : Resource::ShaderSource(_Chunk,_Source,_Type) ,m_ShaderHandle(0) { - _Init(); + _Init(); } ~GLSLComponent(); - + unsigned GetHandle() const { return m_ShaderHandle; } bool IsValid() { return m_IsValid; } void Attach(unsigned _Handle); @@ -43,11 +43,11 @@ namespace Pxf { unsigned m_ProgramHandle; GLSLComponent* m_VertexProgram; GLSLComponent* m_FragmentProgram; - - static unsigned int _ID; + + static unsigned int _ID; bool m_IsValid; bool m_IsBound; - void _Init(); + void _Init(); public: GLSLShader(GLSLComponent* _Vertex,GLSLComponent* _Fragment) { @@ -55,7 +55,7 @@ namespace Pxf { if(_Vertex->GetType() == Resource::SH_TYPE_VERTEX) m_VertexProgram = _Vertex; else - Message(LOCAL_MSG,"Vertex program has wrong type"); + Message(LOCAL_MSG,"Vertex program has wrong type"); if(_Fragment->GetType() == Resource::SH_TYPE_FRAGMENT) m_FragmentProgram = _Fragment; else diff --git a/Include/Pxf/Graphics/Texture.h b/Include/Pxf/Graphics/Texture.h index da47148..7b0271f 100644 --- a/Include/Pxf/Graphics/Texture.h +++ b/Include/Pxf/Graphics/Texture.h @@ -9,23 +9,23 @@ namespace Pxf { namespace Graphics { - + //! Abstract texture class class Texture : public DeviceResource { public: Util::String m_Filepath; - + Texture(Device* _pDevice) : DeviceResource(_pDevice) {} - + Texture(const char* _filepath, Device* _pDevice) : DeviceResource(_pDevice) { m_Filepath = _filepath; } - + virtual void Load() = 0; virtual void Load(const char* _filepath) = 0; virtual void LoadData(const unsigned char* _datachunk, int _width, int _height, int _channels) = 0; diff --git a/Include/Pxf/Graphics/TextureDefs.h b/Include/Pxf/Graphics/TextureDefs.h index d84c6fb..927cce0 100644 --- a/Include/Pxf/Graphics/TextureDefs.h +++ b/Include/Pxf/Graphics/TextureDefs.h @@ -4,7 +4,7 @@ namespace Pxf { namespace Graphics - { + { enum TextureFilter { // valid for min & mag @@ -24,7 +24,7 @@ namespace Pxf TEX_CLAMP_TO_EDGE, TEX_REPEAT }; - + enum TextureFormatStorage { TEX_FORMAT_RGB, diff --git a/Include/Pxf/Graphics/VertexBuffer.h b/Include/Pxf/Graphics/VertexBuffer.h index 3445462..5964b4b 100644 --- a/Include/Pxf/Graphics/VertexBuffer.h +++ b/Include/Pxf/Graphics/VertexBuffer.h @@ -74,7 +74,7 @@ namespace Pxf virtual void CreateNewBuffer(uint32 _NumVertices, uint32 _VertexSize) = 0; - virtual void CreateFromBuffer(void* _Buffer,uint32 _NumVertices, uint32 _VertexSize) = 0; + virtual void CreateFromBuffer(void* _Buffer,uint32 _NumVertices, uint32 _VertexSize) = 0; virtual void UpdateData(void* _Buffer, uint32 _Count, uint32 _Offset) = 0; diff --git a/Include/Pxf/Graphics/VertexBufferDefs.h b/Include/Pxf/Graphics/VertexBufferDefs.h index 1077b52..33b2d1a 100644 --- a/Include/Pxf/Graphics/VertexBufferDefs.h +++ b/Include/Pxf/Graphics/VertexBufferDefs.h @@ -4,7 +4,7 @@ namespace Pxf { namespace Graphics - { + { /** * VertexBuffer location types * VB_LOCATION_SYS is stored in system memory @@ -68,9 +68,9 @@ namespace Pxf VB_ACCESS_READ_WRITE = 4 }; - enum VertexBufferPrimitiveType { + enum VertexBufferPrimitiveType { VB_PRIMITIVE_NONE = 0, - VB_PRIMITIVE_POINTS = 1, + VB_PRIMITIVE_POINTS = 1, VB_PRIMITIVE_LINES, VB_PRIMITIVE_LINE_LOOP, VB_PRIMITIVE_LINE_STRIP, diff --git a/Include/Pxf/Input/Input.h b/Include/Pxf/Input/Input.h index f9d0680..ba676a7 100644 --- a/Include/Pxf/Input/Input.h +++ b/Include/Pxf/Input/Input.h @@ -38,7 +38,7 @@ namespace Pxf virtual void ShowCursor(bool _show) = 0; private: Graphics::Window* m_Window; - + }; } // Input diff --git a/Include/Pxf/Input/InputDefs.h b/Include/Pxf/Input/InputDefs.h index 2d97e1c..58fd241 100644 --- a/Include/Pxf/Input/InputDefs.h +++ b/Include/Pxf/Input/InputDefs.h @@ -5,7 +5,7 @@ namespace Pxf { namespace Input { - + //! Special keyboard keys enum { @@ -99,7 +99,7 @@ namespace Pxf MOUSE_LEFT = MOUSE_1, MOUSE_RIGHT = MOUSE_2, MOUSE_MIDDLE = MOUSE_3 - }; + }; } } diff --git a/Include/Pxf/Input/OpenGL/InputGL2.h b/Include/Pxf/Input/OpenGL/InputGL2.h index 64e95ad..45f7006 100644 --- a/Include/Pxf/Input/OpenGL/InputGL2.h +++ b/Include/Pxf/Input/OpenGL/InputGL2.h @@ -44,7 +44,7 @@ namespace Pxf MOUSE_MODE mouse_mode; int mouse_x, mouse_y, mouse_scroll; - unsigned int mouse_buttons; /* store status for mouse button, bit #0 = button 1. 1 = pressed */ + unsigned int mouse_buttons; /* store status for mouse button, bit #0 = button 1. 1 = pressed */ }; } // Input } // Pxf diff --git a/Include/Pxf/Math/Math.h b/Include/Pxf/Math/Math.h index 90b58bf..6a610fe 100644 --- a/Include/Pxf/Math/Math.h +++ b/Include/Pxf/Math/Math.h @@ -36,28 +36,28 @@ inline T TransformRange(T value, T in_min, T in_max, T out_min, T out_max) } // Returns the absolute value of a -template +template inline T Abs(const T& a) { return (a < 0 ? -a : a); } // Returns the biggest of a and b -template +template inline T Max(const T& a, const T& b) { return (b < a ? a : b); } // Returns the smallest of a and b -template +template inline T Min(const T& a,const T& b) { return (a < b ? a : b); } // Clamps value between min and max -template +template inline T Clamp(const T& value, const T& min, const T& max) { return (value < min ? min : (value > max ? max : value)); diff --git a/Include/Pxf/Math/Matrix.h b/Include/Pxf/Math/Matrix.h index e4565fb..775d613 100644 --- a/Include/Pxf/Math/Matrix.h +++ b/Include/Pxf/Math/Matrix.h @@ -71,14 +71,14 @@ class Mat4 m[y + 12] * o.m[x*4 + 3]; } }*/ - + /* [ 0 1 2 3 ] [ 4 5 6 7 ] [ 8 9 10 11 ] [12 13 14 15 ] */ - + for (int y = 0; y < 4; ++y) { for (int x = 0; x < 4; ++x) @@ -87,7 +87,7 @@ class Mat4 m[y*4 + 1] * o.m[x + 4] + m[y*4 + 2] * o.m[x + 8] + m[y*4 + 3] * o.m[x + 12]; - + /*m[y ] * o.m[x*4 ] + m[y + 4] * o.m[x*4 + 1] + m[y + 8] * o.m[x*4 + 2] + @@ -97,23 +97,23 @@ class Mat4 return res; } - + /* [ 0 1 2 3 ] [a] [ 4 5 6 7 ] [b] [ 8 9 10 11 ] * [c] = [a*0, b*5, c*10, d*15] [12 13 14 15 ] [d] */ - + Vec4f operator * (const Vec4f v) const { Vec4f res; - + res.x = v.x * m[0] + v.y * m[1] + v.z * m[2] + v.w * m[3]; res.y = v.x * m[4] + v.y * m[5] + v.z * m[6] + v.w * m[7]; res.z = v.x * m[8] + v.y * m[9] + v.z * m[10] + v.w * m[11]; res.w = v.x * m[12] + v.y * m[13] + v.z * m[14] + v.w * m[15]; - + return res; } @@ -135,7 +135,7 @@ class Mat4 float Det() const { - + return m[ 0]*m[ 5]*m[10]*m[15] + m[ 0]*m[ 9]*m[14]*m[ 7] + m[ 0]*m[13]*m[ 6]*m[11] + m[ 4]*m[ 1]*m[14]*m[11] + m[ 4]*m[ 9]*m[ 2]*m[15] + m[ 4]*m[13]*m[10]*m[ 3] + m[ 8]*m[ 1]*m[ 6]*m[15] + m[ 8]*m[ 5]*m[14]*m[ 3] + m[ 8]*m[13]*m[ 2]*m[ 7] + @@ -149,7 +149,7 @@ class Mat4 const Mat4& Inv() { - + Mat4 mat = Zero; float determ = Det(); mat.m[0] = mat.m[5] = mat.m[10] = mat.m[15] = 0; @@ -191,14 +191,14 @@ class Mat4 { return Translate(pos.x, pos.y, pos.z); } - + /* [ 0 1 2 3 ] [a] [ 4 5 6 7 ] [b] [ 8 9 10 11 ] * [c] = [a*0, b*5, c*10, d*15] [12 13 14 15 ] [d] */ - + const Mat4& Translate(float x, float y, float z) { //*this = Identity; @@ -208,7 +208,7 @@ class Mat4 return *this; } - + /* const Mat4& Translate(float x, float y, float z) { @@ -219,7 +219,7 @@ class Mat4 return *this; } - + const Mat4& Translate(float x, float y, float z) { *this = Identity; @@ -234,7 +234,7 @@ class Mat4 { float f = 1.0f/tanf(fovy*(PI/360.0f)); Mat4 res = Identity; - + res.m[0] = f/aspect; res.m[5] = f; res.m[10] = (zfar+znear)/(znear-zfar); @@ -281,7 +281,7 @@ class Mat4 // TODO: Hmm... I don't think this works... // http://en.wikipedia.org/wiki/Rotation_matrix#Axis_and_angle - + const Mat4& Rotate(float angle, float x, float y, float z) { float c, C, s; @@ -316,37 +316,37 @@ class Mat4 res.m[13] = 0.f; res.m[14] = 0.f; res.m[15] = 1.f; - + *this = *this * (res * Mat4::Identity); - + return *this; } - - + + /* [ 0 1 2 3 ] [ 4 5 6 7 ] [ 8 9 10 11 ] [12 13 14 15 ] - + | e0 e4 e8 e12 | | e1 e5 e9 e13 | | e2 e6 e10 e14 | | e3 e7 e11 e15 | - + */ /* const Vec2f Transform2D(Vec2f v) { Vec2f res; - + // Store in temp variables in case src = dst res.x = (m[0]*v.x) + (m[1]*v.y) + (0) + (m[3]); res.y = (m[4]*v.x) + (m[5]*v.y) + (0) + (m[7]); - + return res; }*/ - + /*static Mat4 Rotate(float angle, float x, float y, float z) { float c, C, s; @@ -381,10 +381,10 @@ class Mat4 res.m[13] = 0.f; res.m[14] = 0.f; res.m[15] = 1.f; - + return res; }*/ - + }; } // Math diff --git a/Include/Pxf/Math/Quaternion.h b/Include/Pxf/Math/Quaternion.h index 451428c..d3a5583 100644 --- a/Include/Pxf/Math/Quaternion.h +++ b/Include/Pxf/Math/Quaternion.h @@ -127,24 +127,24 @@ class Quaternion void CreateMatrix(Mat4* out_mtx) const { - out_mtx->m[ 0] = 1.0f - 2.0f * ( y * y + z * z ); - out_mtx->m[ 1] = 2.0f * ( x * y - w * z ); - out_mtx->m[ 2] = 2.0f * ( x * z + w * y ); - out_mtx->m[ 3] = 0.0f; - - out_mtx->m[ 4] = 2.0f * ( x * y + w * z ); - out_mtx->m[ 5] = 1.0f - 2.0f * ( x * x + z * z ); - out_mtx->m[ 6] = 2.0f * ( y * z - w * x ); - out_mtx->m[ 7] = 0.0f; - - out_mtx->m[ 8] = 2.0f * ( x * z - w * y ); - out_mtx->m[ 9] = 2.0f * ( y * z + w * x ); - out_mtx->m[10] = 1.0f - 2.0f * ( x * x + y * y ); - out_mtx->m[11] = 0.0f; - - out_mtx->m[12] = 0; - out_mtx->m[13] = 0; - out_mtx->m[14] = 0; + out_mtx->m[ 0] = 1.0f - 2.0f * ( y * y + z * z ); + out_mtx->m[ 1] = 2.0f * ( x * y - w * z ); + out_mtx->m[ 2] = 2.0f * ( x * z + w * y ); + out_mtx->m[ 3] = 0.0f; + + out_mtx->m[ 4] = 2.0f * ( x * y + w * z ); + out_mtx->m[ 5] = 1.0f - 2.0f * ( x * x + z * z ); + out_mtx->m[ 6] = 2.0f * ( y * z - w * x ); + out_mtx->m[ 7] = 0.0f; + + out_mtx->m[ 8] = 2.0f * ( x * z - w * y ); + out_mtx->m[ 9] = 2.0f * ( y * z + w * x ); + out_mtx->m[10] = 1.0f - 2.0f * ( x * x + y * y ); + out_mtx->m[11] = 0.0f; + + out_mtx->m[12] = 0; + out_mtx->m[13] = 0; + out_mtx->m[14] = 0; out_mtx->m[15] = 1.0f; } @@ -164,7 +164,7 @@ class Quaternion /* Negation */ Quaternion operator - () const - { + { Quaternion q; q.x = -x; q.y = -y; @@ -197,7 +197,7 @@ class Quaternion /* Multiplication */ Quaternion operator * (const float c) const - { + { Quaternion q; q.x = x*c; q.y = y*c; @@ -205,12 +205,12 @@ class Quaternion q.w = w*c; return q; } - + const Quaternion& operator *= (const float c) { x*=c; y*=c; z*=c; w*=c; } - + Quaternion operator * (const Quaternion& o) const { Quaternion tmp; @@ -231,7 +231,7 @@ class Quaternion *this = tmp; return *this; } - + /* Division */ Quaternion operator / (const float c) const { @@ -292,7 +292,7 @@ inline Quaternion Conjugated(const Quaternion& q) } inline float Dot(const Quaternion& a, const Quaternion& b) -{ +{ return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w; } @@ -318,7 +318,7 @@ inline Quaternion Slerp(const Quaternion& from, const Quaternion& to, float t) } if (c > 1.0f - 0.0000001f) - { + { Quaternion q = Lerp(from, q3, t); return Normalized(q); } diff --git a/Include/Pxf/Math/Vector.h b/Include/Pxf/Math/Vector.h index eba9447..8697c43 100644 --- a/Include/Pxf/Math/Vector.h +++ b/Include/Pxf/Math/Vector.h @@ -28,11 +28,11 @@ namespace Math { Vector2D(T nv) { x = y = nv; } Vector2D(T nx, T ny) { x = nx; y = ny; } Vector2D(const Vector2D& o) { *this = o; } - + inline void Set(T nx, T ny) { x = nx; y = ny; } Vector2D operator - () const { return Vector2D(-x, -y); } - + Vector2D operator - (const Vector2D &v) const { return Vector2D(x - v.x, y - v.y); } Vector2D operator + (const Vector2D &v) const { return Vector2D(x + v.x, y + v.y); } Vector2D operator * (const Vector2D &v) const { return Vector2D(x * v.x, y * v.y); } @@ -61,44 +61,44 @@ namespace Math { template inline T Dot(const Vector2D &a, const Vector2D &b) - { + { return a.x*b.x + a.y*b.y; } template inline T LengthSqr(const Vector2D &a) { - return a.x*a.x + a.y*a.y; + return a.x*a.x + a.y*a.y; } template inline T Length(const Vector2D &a) - { + { return sqrtf(LengthSqr(a)); } - + template inline T Distance(const Vector2D &a, const Vector2D &b) - { - return Length(a-b); + { + return Length(a-b); } - + template inline Vector2D Perpendicular(const Vector2D &a) - { + { return Vector2D(a.y, -a.x); } template inline void Clamp(const Vector2D &a, T min, T max) - { + { a.x = Clamp(a.x, min, max); a.y = Clamp(a.y, min, max); } template inline Vector2D Clamped(const Vector2D &a, T min, T max) - { + { Vector2D ret = a; Clamp(ret); return ret; @@ -143,7 +143,7 @@ namespace Math { union { T x, r; }; union { T y, g; }; union { T z, b; }; - + Vector3D() { x = y = z = 0; } Vector3D(T nv) { x = y = z = nv; } Vector3D(T nx, T ny, T nz) { x = nx; y = ny; z = nz; } @@ -152,7 +152,7 @@ namespace Math { inline void Set(T nx, T ny, T nz) { x = nx; y = ny; z = nz; } Vector3D operator - () const { return Vector3D(-x, -y, -z); } - + Vector3D operator - (const Vector3D &v) const { return Vector3D(x - v.x, y - v.y, z - v.z); } Vector3D operator + (const Vector3D &v) const { return Vector3D(x + v.x, y + v.y, z + v.z); } Vector3D operator * (const Vector3D &v) const { return Vector3D(x * v.x, y * v.y, z * v.z); } @@ -181,39 +181,39 @@ namespace Math { template inline T Dot(const Vector3D &a, const Vector3D &b) - { - return a.x*b.x + a.y*b.y + a.z*b.z; + { + return a.x*b.x + a.y*b.y + a.z*b.z; } template - inline T LengthSqr(const Vector3D &a) - { - return a.x*a.x + a.y*a.y + a.z*a.z; + inline T LengthSqr(const Vector3D &a) + { + return a.x*a.x + a.y*a.y + a.z*a.z; } template - inline T Length(const Vector3D &a) - { - return sqrtf(LengthSqr(a)); + inline T Length(const Vector3D &a) + { + return sqrtf(LengthSqr(a)); } - + template - inline T Distance(const Vector3D &a, const Vector3D &b) - { + inline T Distance(const Vector3D &a, const Vector3D &b) + { return Length(a-b); } - + template inline void Clamp(const Vector3D &a, T min, T max) - { - a.x = Clamp(a.x, min, max); - a.y = Clamp(a.y, min, max); + { + a.x = Clamp(a.x, min, max); + a.y = Clamp(a.y, min, max); a.z = Clamp(a.z, min, max); } - + template inline Vector3D Clamped(const Vector3D &a, T min, T max) - { + { Vector3D ret = a; Clamp(ret); return ret; @@ -244,7 +244,7 @@ namespace Math { template inline Vector3D Cross(const Vector3D &a, const Vector3D &b) { - return Vector3D( a.y * b.z - a.z * b.y, + return Vector3D( a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); } @@ -261,7 +261,7 @@ namespace Math { union { T y; T g; }; union { T z; T b; }; union { T w; T a; }; - + Vector4D() { x = y = z = w = 0; } Vector4D(T nv) { x = y = z = w = nv; } Vector4D(T nx, T ny, T nz, T nw) { x = nx; y = ny; z = nz; w = nw; } @@ -270,7 +270,7 @@ namespace Math { inline void Set(T nx, T ny, T nz, T nw) { x = nx; y = ny; z = nz; w = nw; } Vector4D operator - () const { return Vector4D(-x, -y, -z, -w); } - + Vector4D operator - (const Vector4D &v) const { return Vector4D(x - v.x, y - v.y, z - v.z, w - v.w); } Vector4D operator + (const Vector4D &v) const { return Vector4D(x + v.x, y + v.y, z + v.z, w + v.w); } Vector4D operator * (const Vector4D &v) const { return Vector4D(x * v.x, y * v.y, z * v.z, w * v.w); } @@ -299,22 +299,22 @@ namespace Math { template inline T Dot(const Vector4D &a, const Vector4D &b) - { + { return a.x*b.x + a.y*b.y + a.z*b.z + a.w*b.w; } - + template inline void Clamp(const Vector4D &a, T min, T max) - { + { a.x = Clamp(a.x, min, max); - a.y = Clamp(a.y, min, max); - a.z = Clamp(a.z, min, max); + a.y = Clamp(a.y, min, max); + a.z = Clamp(a.z, min, max); a.w = Clamp(a.w, min, max); } template inline Vector4D Clamped(const Vector4D &a, T min, T max) - { + { Vector4D ret = a; Clamp(ret); return ret; @@ -322,16 +322,16 @@ namespace Math { template inline T LengthSqr(const Vector4D &a) - { + { return a.x*a.x + a.y*a.y + a.z*a.z + a.w*a.w; } template inline T Length(const Vector4D &a) - { - return sqrtf(LengthSqr(a)); + { + return sqrtf(LengthSqr(a)); } - + template inline void Normalize(Vector4D &a) { diff --git a/Include/Pxf/Resource/Chunk.h b/Include/Pxf/Resource/Chunk.h index f2808f4..3553900 100644 --- a/Include/Pxf/Resource/Chunk.h +++ b/Include/Pxf/Resource/Chunk.h @@ -13,16 +13,16 @@ namespace Resource { public: char* Data; unsigned Size; - + // If data isn't allocated on the heap, it should not attempt to delete it. bool Static; - + Chunk() : Data(NULL) , Size(0) - , Static(false) + , Static(false) {} - + ~Chunk() { if (!Static) diff --git a/Include/Pxf/Resource/Image.h b/Include/Pxf/Resource/Image.h index 4376da3..2faec93 100644 --- a/Include/Pxf/Resource/Image.h +++ b/Include/Pxf/Resource/Image.h @@ -24,18 +24,18 @@ namespace Resource { const int Width() const { return m_Width; - } + } const int Height() const { return m_Height; - } + } const int Channels() const { return m_Channels; - } - + } + unsigned char* Ptr() const { return m_ImageData; diff --git a/Include/Pxf/Resource/ResourceManager.h b/Include/Pxf/Resource/ResourceManager.h index 2742a04..793af03 100644 --- a/Include/Pxf/Resource/ResourceManager.h +++ b/Include/Pxf/Resource/ResourceManager.h @@ -59,7 +59,7 @@ class ResourceManager Message("ResourceManager", "Failed to acquire resource."); return NULL; } - + res->m_References++; Message("ResourceManager", "Acquired '%s' [refs = %d]", _Filename, res->m_References); return (T*)res; diff --git a/Include/Pxf/Resource/ShaderSource.h b/Include/Pxf/Resource/ShaderSource.h index e271518..96a5e94 100644 --- a/Include/Pxf/Resource/ShaderSource.h +++ b/Include/Pxf/Resource/ShaderSource.h @@ -41,9 +41,9 @@ namespace Pxf { return m_FileName; } - SHType GetType() - { - return m_SType; + SHType GetType() + { + return m_SType; } }; } diff --git a/Include/Pxf/Scene/Entity.h b/Include/Pxf/Scene/Entity.h index 75d3c75..dc5bd49 100644 --- a/Include/Pxf/Scene/Entity.h +++ b/Include/Pxf/Scene/Entity.h @@ -4,7 +4,7 @@ #include namespace Pxf -{ +{ namespace Scene { //! Abstract class for items in the engine @@ -17,7 +17,7 @@ namespace Pxf //! Type EntityType m_Type; public: - Entity(const char* _Name,EntityType _Type) + Entity(const char* _Name,EntityType _Type) : m_Name(_Name) , m_Type(_Type) { diff --git a/Include/Pxf/Scene/EntityDefs.h b/Include/Pxf/Scene/EntityDefs.h index 3f93b4a..8d0da63 100644 --- a/Include/Pxf/Scene/EntityDefs.h +++ b/Include/Pxf/Scene/EntityDefs.h @@ -2,11 +2,11 @@ #define _PXF_SCENE_ENTITYDEFS_H namespace Pxf -{ +{ namespace Scene { - enum EntityType - { + enum EntityType + { ELight, EObject, ECamera diff --git a/Include/Pxf/Scene/Scene.h b/Include/Pxf/Scene/Scene.h index c51c0d9..a593064 100644 --- a/Include/Pxf/Scene/Scene.h +++ b/Include/Pxf/Scene/Scene.h @@ -5,7 +5,7 @@ namespace Pxf { namespace Scene -{ +{ class Camera; class MaterialManager; @@ -21,7 +21,7 @@ namespace Scene //! Scene statistics: unsigned long int m_NumVerts; unsigned long int m_NumFaces; - + //! BGColor float m_BGColor[3]; diff --git a/Include/Pxf/Scene/SceneManager.h b/Include/Pxf/Scene/SceneManager.h index dcd3fac..5f21dff 100644 --- a/Include/Pxf/Scene/SceneManager.h +++ b/Include/Pxf/Scene/SceneManager.h @@ -6,7 +6,7 @@ namespace Pxf { namespace Scene -{ +{ //! Simple scene manager that stores/loads scenes //! No fancy scene graph stuff here.. TODO: ? class SceneManager @@ -29,13 +29,13 @@ namespace Scene //! Create new scene //! return = 0 if failed - Pxf::Scene::Scene* NewScene(const char* _Name); + Pxf::Scene::Scene* NewScene(const char* _Name); //! Statistics getters unsigned long GetNumVerts() { return m_NumVerts; } unsigned long GetNumFaces() { return m_NumFaces; } - //! Do a scene lookup + //! Do a scene lookup //! return = 0 if failed //! else return the scene Pxf::Scene::Scene* GetScene(const char* _Name); diff --git a/Include/Pxf/Util/MemoryManager/mmgr.cpp b/Include/Pxf/Util/MemoryManager/mmgr.cpp index 9e296c1..7542b37 100644 --- a/Include/Pxf/Util/MemoryManager/mmgr.cpp +++ b/Include/Pxf/Util/MemoryManager/mmgr.cpp @@ -1,77 +1,77 @@ /* --------------------------------------------------------------------------------------------------------------------------------- - - - _ __ ___ _ __ ___ __ _ _ __ ___ _ __ _ __ - | '_ ` _ \| '_ ` _ \ / _` | '__| / __| '_ \| '_ \ + + + _ __ ___ _ __ ___ __ _ _ __ ___ _ __ _ __ + | '_ ` _ \| '_ ` _ \ / _` | '__| / __| '_ \| '_ \ | | | | | | | | | | | (_| | | _ | (__| |_) | |_) | - |_| |_| |_|_| |_| |_|\__, |_| (_) \___| .__/| .__/ - __/ | | | | | - |___/ |_| |_| - + |_| |_| |_|_| |_| |_|\__, |_| (_) \___| .__/| .__/ + __/ | | | | | + |___/ |_| |_| + Memory manager & tracking software - + Best viewed with 8-character tabs and (at least) 132 columns - + --------------------------------------------------------------------------------------------------------------------------------- - + Restrictions & freedoms pertaining to usage and redistribution of this software: - + * This software is 100% free * If you use this software (in part or in whole) you must credit the author. * This software may not be re-distributed (in part or in whole) in a modified form without clear documentation on how to obtain a copy of the original work. * You may not use this software to directly or indirectly cause harm to others. * This software is provided as-is and without warrantee. Use at your own risk. - + For more information, visit HTTP: www.FluidStudios.com - + --------------------------------------------------------------------------------------------------------------------------------- Originally created on 12/22/2000 by Paul Nettle - + Copyright 2000, Fluid Studios, Inc., all rights reserved. --------------------------------------------------------------------------------------------------------------------------------- - + !!IMPORTANT!! - + This software is self-documented with periodic comments. Before you start using this software, perform a search for the string "-DOC-" to locate pertinent information about how to use this software. - + You are also encouraged to read the comment blocks throughout this source file. They will help you understand how this memory tracking software works, so you can better utilize it within your applications. - + NOTES: - + 1. If you get compiler errors having to do with set_new_handler, then go through this source and search/replace "std::set_new_handler" with "set_new_handler". - + 2. This code purposely uses no external routines that allocate RAM (other than the raw allocation routines, such as malloc). We do this because we want this to be as self-contained as possible. As an example, we don't use assert, because when running under WIN32, the assert brings up a dialog box, which allocates RAM. Doing this in the middle of an allocation would be bad. - + 3. When trying to override new/delete under MFC (which has its own version of global new/delete) the linker will complain. In order to fix this error, use the compiler option: /FORCE, which will force it to build an executable even with linker errors. Be sure to check those errors each time you compile, otherwise, you may miss a valid linker error. - + 4. If you see something that looks odd to you or seems like a strange way of going about doing something, then consider that this code was carefully thought out. If something looks odd, then just assume I've got a good reason for doing it that way (an example is the use of the class MemStaticTimeTracker.) - + 5. With MFC applications, you will need to comment out any occurance of "#define new DEBUG_NEW" from all source files. - + 6. Include file dependencies are _very_important_ for getting the MMGR to integrate nicely into your application. Be careful if - you're including standard includes from within your own project inclues; that will break this very specific dependency order. + you're including standard includes from within your own project inclues; that will break this very specific dependency order. It should look like this: - + #include // Standard includes MUST come first - #include - #include - + #include + #include + #include "mmgr.h" // mmgr.h MUST come next - + #include "myfile1.h" // Project includes MUST come last #include "myfile2.h" // #include "myfile3.h" // - + --------------------------------------------------------------------------------------------------------------------------------- */ @@ -107,7 +107,7 @@ // // Whether this software causes your application to crash, or if it reports errors, you need to be able to TRUST this software. To // this end, you are given some very simple debugging tools. -// +// // The quickest way to locate problems is to enable the STRESS_TEST macro (below.) This should catch 95% of the crashes before they // occur by validating every allocation each time this memory manager performs an allocation function. If that doesn't work, keep // reading... @@ -1188,7 +1188,7 @@ void *m_allocator(const char *sourceFile, const unsigned int sourceLine, const c wipeWithPattern(au, unusedPattern); // calloc() expects the reported memory address range to be filled with 0's - + // memset for all allocations #ifndef MEMSETALLMEMORYALLOCATIONS if (allocationType == m_alloc_calloc) @@ -1701,7 +1701,7 @@ void m_dumpMemoryReport(const char *filename, const bool overwrite) // Open the report file // FILE *fp = NULL; - + // if (overwrite) fp = fopen(filename, "w+b"); // else fp = fopen(filename, "ab"); diff --git a/Include/Pxf/Util/MemoryManager/mmgr.h b/Include/Pxf/Util/MemoryManager/mmgr.h index e9b19fd..94837bc 100644 --- a/Include/Pxf/Util/MemoryManager/mmgr.h +++ b/Include/Pxf/Util/MemoryManager/mmgr.h @@ -1,33 +1,33 @@ /* --------------------------------------------------------------------------------------------------------------------------------- - _ - | | - _ __ ___ _ __ ___ __ _ _ __ | |__ - | '_ ` _ \| '_ ` _ \ / _` | '__| | '_ \ + _ + | | + _ __ ___ _ __ ___ __ _ _ __ | |__ + | '_ ` _ \| '_ ` _ \ / _` | '__| | '_ \ | | | | | | | | | | | (_| | | _ | | | | |_| |_| |_|_| |_| |_|\__, |_| (_)|_| |_| - __/ | - |___/ - + __/ | + |___/ + Memory manager & tracking software - + Best viewed with 8-character tabs and (at least) 132 columns - + --------------------------------------------------------------------------------------------------------------------------------- - + Restrictions & freedoms pertaining to usage and redistribution of this software: - + * This software is 100% free * If you use this software (in part or in whole) you must credit the author. * This software may not be re-distributed (in part or in whole) in a modified form without clear documentation on how to obtain a copy of the original work. * You may not use this software to directly or indirectly cause harm to others. * This software is provided as-is and without warrantee. Use at your own risk. - + For more information, visit HTTP://www.FluidStudios.com - + --------------------------------------------------------------------------------------------------------------------------------- Originally created on 12/22/2000 by Paul Nettle - + Copyright 2000, Fluid Studios, Inc., all rights reserved. --------------------------------------------------------------------------------------------------------------------------------- */ diff --git a/Include/Pxf/Util/MemoryManager/nommgr.h b/Include/Pxf/Util/MemoryManager/nommgr.h index 2dda25f..5345c1b 100644 --- a/Include/Pxf/Util/MemoryManager/nommgr.h +++ b/Include/Pxf/Util/MemoryManager/nommgr.h @@ -1,33 +1,33 @@ /* --------------------------------------------------------------------------------------------------------------------------------- - _ - | | - _ __ ___ _ __ ___ _ __ ___ __ _ _ __ | |__ - | '_ \ / _ \| '_ ` _ \| '_ ` _ \ / _` | '__| | '_ \ + _ + | | + _ __ ___ _ __ ___ _ __ ___ __ _ _ __ | |__ + | '_ \ / _ \| '_ ` _ \| '_ ` _ \ / _` | '__| | '_ \ | | | | (_) | | | | | | | | | | | (_| | | _ | | | | |_| |_|\___/|_| |_| |_|_| |_| |_|\__, |_| (_)|_| |_| - __/ | - |___/ - + __/ | + |___/ + Memory manager & tracking software - + Best viewed with 8-character tabs and (at least) 132 columns - + --------------------------------------------------------------------------------------------------------------------------------- - + Restrictions & freedoms pertaining to usage and redistribution of this software: - + * This software is 100% free * If you use this software (in part or in whole) you must credit the author. * This software may not be re-distributed (in part or in whole) in a modified form without clear documentation on how to obtain a copy of the original work. * You may not use this software to directly or indirectly cause harm to others. * This software is provided as-is and without warrantee. Use at your own risk. - + For more information, visit HTTP://www.FluidStudios.com - + --------------------------------------------------------------------------------------------------------------------------------- Originally created on 12/22/2000 by Paul Nettle - + Copyright 2000, Fluid Studios, Inc., all rights reserved. --------------------------------------------------------------------------------------------------------------------------------- */ diff --git a/Include/Pxf/Util/MemoryManager/readme.txt b/Include/Pxf/Util/MemoryManager/readme.txt index e4b49bd..7739eae 100644 --- a/Include/Pxf/Util/MemoryManager/readme.txt +++ b/Include/Pxf/Util/MemoryManager/readme.txt @@ -66,7 +66,7 @@ a tough bug, then please visit this issue of Ask Midnight and leave a testimonial in the comments. I will periodically check them and may eventually release an updated version of this software based on your comments. -So go ahead. Take the challenge. I dare you. :) +So go ahead. Take the challenge. I dare you. :) - Paul Nettle midnight@FluidStudios.com diff --git a/Libraries/AngelScript/sdk/add_on/autowrapper/aswrappedcall.h b/Libraries/AngelScript/sdk/add_on/autowrapper/aswrappedcall.h index 23b1ef1..031f063 100644 --- a/Libraries/AngelScript/sdk/add_on/autowrapper/aswrappedcall.h +++ b/Libraries/AngelScript/sdk/add_on/autowrapper/aswrappedcall.h @@ -1,8 +1,8 @@ #ifndef ASWRAPPEDCALL_H #define ASWRAPPEDCALL_H -// Generate the wrappers by calling the macros in global scope. -// Then register the wrapper function with the script engine using the asCALL_GENERIC +// Generate the wrappers by calling the macros in global scope. +// Then register the wrapper function with the script engine using the asCALL_GENERIC // calling convention. The wrapper can handle both global functions and class methods. // // Example: diff --git a/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generateheader.cpp b/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generateheader.cpp index 0b0c629..6670870 100644 --- a/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generateheader.cpp +++ b/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generateheader.cpp @@ -16,7 +16,7 @@ int main() printf("#ifndef ASWRAPPEDCALL_H\n" "#define ASWRAPPEDCALL_H\n\n"); - // Add some instructions on how to use this + // Add some instructions on how to use this printf("// Generate the wrappers by calling the macros in global scope. \n"); printf("// Then register the wrapper function with the script engine using the asCALL_GENERIC \n"); printf("// calling convention. The wrapper can handle both global functions and class methods.\n"); @@ -65,7 +65,7 @@ int main() " as_wrapNative_helper(X d_) : d(d_) {}\n" "};\n\n"); - // Iterate over the number of parameters + // Iterate over the number of parameters for(int t = 0; t <= MAXPARAM; t++) { printf("// %d parameter(s)\n\n", t); @@ -113,7 +113,7 @@ int main() }; //---------- - // Generate the function that extracts the parameters from + // Generate the function that extracts the parameters from // the asIScriptGeneric interface and calls the native function // Build the template declaration @@ -125,7 +125,7 @@ int main() printf("%stypename T%d",(k||(d>0))?",":"",k+1); printf(">\n"); - } + } printf("static void asWrapNative_p%d%s(",t,signature[d]); printf("%s (%s*func)(" ,(d&1)?"R":"void", (d>1)?"C::":""); @@ -181,7 +181,7 @@ int main() "}\n\n"); } - } + } printf("#endif // ASWRAPPEDCALL_H\n\n"); diff --git a/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generator.dsp b/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generator.dsp index 2ba5fa8..32dd8fc 100644 --- a/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generator.dsp +++ b/Libraries/AngelScript/sdk/add_on/autowrapper/generator/generator.dsp @@ -7,19 +7,19 @@ CFG=generator - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "generator.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "generator.mak" CFG="generator - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "generator - Win32 Release" (based on "Win32 (x86) Console Application") !MESSAGE "generator - Win32 Debug" (based on "Win32 (x86) Console Application") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -74,7 +74,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /subsystem:console /debug /machine:I386 /pdbtype:sept -!ENDIF +!ENDIF # Begin Target diff --git a/Libraries/AngelScript/sdk/add_on/clib/angelscript_c.h b/Libraries/AngelScript/sdk/add_on/clib/angelscript_c.h index 71c1e16..e5264a3 100644 --- a/Libraries/AngelScript/sdk/add_on/clib/angelscript_c.h +++ b/Libraries/AngelScript/sdk/add_on/clib/angelscript_c.h @@ -34,7 +34,7 @@ // // The script engine interface for the C language. // -// The idea is that the library should be compiled with a C++ compiler with the AS_C_INTERFACE +// The idea is that the library should be compiled with a C++ compiler with the AS_C_INTERFACE // preprocessor word defined. The C application will then be able to link with the library and // use this header file to interact with it. // @@ -80,7 +80,7 @@ typedef size_t asPWORD; // Enumerations and constants // Engine properties -typedef enum +typedef enum { asEP_ALLOW_UNSAFE_REFERENCES = 1, asEP_OPTIMIZE_BYTECODE = 2, @@ -98,7 +98,7 @@ typedef enum } asEEngineProp; // Calling conventions -typedef enum +typedef enum { asCALL_CDECL = 0, asCALL_STDCALL = 1, @@ -109,7 +109,7 @@ typedef enum } asECallConvTypes; // Object type flags -typedef enum +typedef enum { asOBJ_REF = 0x01, asOBJ_VALUE = 0x02, @@ -135,7 +135,7 @@ typedef enum } asEObjTypeFlags; // Behaviours -typedef enum +typedef enum { // Value object memory management asBEHAVE_CONSTRUCT, @@ -165,7 +165,7 @@ typedef enum } asEBehaviours; // Return codes -typedef enum +typedef enum { asSUCCESS = 0, asERROR = -1, @@ -198,7 +198,7 @@ typedef enum } asERetCodes; // Context states -typedef enum +typedef enum { asEXECUTION_FINISHED = 0, asEXECUTION_SUSPENDED = 1, @@ -211,14 +211,14 @@ typedef enum } asEContextState; // ExecuteString flags -typedef enum +typedef enum { asEXECSTRING_ONLY_PREPARE = 1, asEXECSTRING_USE_MY_CONTEXT = 2 } asEExecStrFlags; // Message types -typedef enum +typedef enum { asMSGTYPE_ERROR = 0, asMSGTYPE_WARNING = 1, @@ -241,7 +241,7 @@ const int asPREPARE_PREVIOUS = -1; const char * const asALL_MODULES = (const char * const)-1; // Type id flags -typedef enum +typedef enum { asTYPEID_VOID = 0, asTYPEID_BOOL = 1, @@ -272,7 +272,7 @@ typedef enum asGM_ALWAYS_CREATE = 2 } asEGMFlags; -typedef struct +typedef struct { const char *section; int row; @@ -397,7 +397,7 @@ extern "C" AS_API asIScriptEngine *asModule_GetEngine(asIScriptModule *m); AS_API void asModule_SetName(asIScriptModule *m, const char *name); - AS_API const char *asModule_GetName(asIScriptModule *m); + AS_API const char *asModule_GetName(asIScriptModule *m); AS_API int asModule_AddScriptSection(asIScriptModule *m, const char *name, const char *code, size_t codeLength, int lineOffset); AS_API int asModule_Build(asIScriptModule *m); AS_API int asModule_GetFunctionCount(asIScriptModule *m); diff --git a/Libraries/AngelScript/sdk/add_on/clib/as_c.cpp b/Libraries/AngelScript/sdk/add_on/clib/as_c.cpp index 94ba08b..40033cb 100644 --- a/Libraries/AngelScript/sdk/add_on/clib/as_c.cpp +++ b/Libraries/AngelScript/sdk/add_on/clib/as_c.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -32,7 +32,7 @@ // // as_c.cpp // -// A C interface to the library +// A C interface to the library // // Include the C++ interface header so we can call the proper methods @@ -158,15 +158,15 @@ AS_API int asModule_BindAllImportedFunctions(asIScriptModule *m) AS_API int asModule_UnbindAllImportedFunctions(asIScriptModule *m) { return m->UnbindAllImportedFunctions(); } AS_API int asModule_SaveByteCode(asIScriptModule *m, asIBinaryStream *out) { return m->SaveByteCode(out); } AS_API int asModule_LoadByteCode(asIScriptModule *m, asIBinaryStream *in) { return m->LoadByteCode(in); } - + AS_API int asContext_AddRef(asIScriptContext *c) { return c->AddRef(); } AS_API int asContext_Release(asIScriptContext *c) { return c->Release(); } AS_API asIScriptEngine *asContext_GetEngine(asIScriptContext *c) { return c->GetEngine(); } AS_API int asContext_GetState(asIScriptContext *c) { return c->GetState(); } AS_API int asContext_Prepare(asIScriptContext *c, int funcID) { return c->Prepare(funcID); } -AS_API int asContext_SetArgByte(asIScriptContext *c, asUINT arg, asBYTE value) { return c->SetArgByte(arg, value); } -AS_API int asContext_SetArgWord(asIScriptContext *c, asUINT arg, asWORD value) { return c->SetArgWord(arg, value); } -AS_API int asContext_SetArgDWord(asIScriptContext *c, asUINT arg, asDWORD value) { return c->SetArgDWord(arg, value); } +AS_API int asContext_SetArgByte(asIScriptContext *c, asUINT arg, asBYTE value) { return c->SetArgByte(arg, value); } +AS_API int asContext_SetArgWord(asIScriptContext *c, asUINT arg, asWORD value) { return c->SetArgWord(arg, value); } +AS_API int asContext_SetArgDWord(asIScriptContext *c, asUINT arg, asDWORD value) { return c->SetArgDWord(arg, value); } AS_API int asContext_SetArgQWord(asIScriptContext *c, asUINT arg, asQWORD value) { return c->SetArgQWord(arg, value); } AS_API int asContext_SetArgFloat(asIScriptContext *c, asUINT arg, float value) { return c->SetArgFloat(arg, value); } AS_API int asContext_SetArgDouble(asIScriptContext *c, asUINT arg, double value) { return c->SetArgDouble(arg, value); } @@ -246,7 +246,7 @@ AS_API const char * asObject_GetPropertyName(asIScriptObject *s, asUINT prop AS_API void * asObject_GetAddressOfProperty(asIScriptObject *s, asUINT prop) { return s->GetAddressOfProperty(prop); } AS_API int asObject_CopyFrom(asIScriptObject *s, asIScriptObject *other) { return s->CopyFrom(other); } -AS_API asIScriptEngine *asArray_GetEngine(asIScriptArray *a) { return a->GetEngine(); } +AS_API asIScriptEngine *asArray_GetEngine(asIScriptArray *a) { return a->GetEngine(); } AS_API int asArray_AddRef(asIScriptArray *a) { return a->AddRef(); } AS_API int asArray_Release(asIScriptArray *a) { return a->Release(); } AS_API int asArray_GetArrayTypeId(asIScriptArray *a) { return a->GetArrayTypeId(); } @@ -281,7 +281,7 @@ AS_API int asObjectType_GetPropertyCount(const asIObjectTyp AS_API int asObjectType_GetPropertyTypeId(const asIObjectType *o, asUINT prop) { return o->GetPropertyTypeId(prop); } AS_API const char *asObjectType_GetPropertyName(const asIObjectType *o, asUINT prop) { return o->GetPropertyName(prop); } AS_API int asObjectType_GetPropertyOffset(const asIObjectType *o, asUINT prop) { return o->GetPropertyOffset(prop); } - + AS_API asIScriptEngine *asScriptFunction_GetEngine(const asIScriptFunction *f) { return f->GetEngine(); } AS_API const char *asScriptFunction_GetModuleName(const asIScriptFunction *f) { return f->GetModuleName(); } AS_API asIObjectType *asScriptFunction_GetObjectType(const asIScriptFunction *f) { return f->GetObjectType(); } @@ -293,7 +293,7 @@ AS_API bool asScriptFunction_IsInterfaceMethod(const asIScriptFu AS_API int asScriptFunction_GetParamCount(const asIScriptFunction *f) { return f->GetParamCount(); } AS_API int asScriptFunction_GetParamTypeId(const asIScriptFunction *f, int index) { return f->GetParamTypeId(index); } AS_API int asScriptFunction_GetReturnTypeId(const asIScriptFunction *f) { return f->GetReturnTypeId(); } - + } END_AS_NAMESPACE diff --git a/Libraries/AngelScript/sdk/add_on/clib/projects/msvc6/msvc6.dsp b/Libraries/AngelScript/sdk/add_on/clib/projects/msvc6/msvc6.dsp index 5119848..35ea1ab 100644 --- a/Libraries/AngelScript/sdk/add_on/clib/projects/msvc6/msvc6.dsp +++ b/Libraries/AngelScript/sdk/add_on/clib/projects/msvc6/msvc6.dsp @@ -7,19 +7,19 @@ CFG=msvc6 - Win32 Debug !MESSAGE This is not a valid makefile. To build this project using NMAKE, !MESSAGE use the Export Makefile command and run -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "msvc6.mak". -!MESSAGE +!MESSAGE !MESSAGE You can specify a configuration when running NMAKE !MESSAGE by defining the macro CFG on the command line. For example: -!MESSAGE +!MESSAGE !MESSAGE NMAKE /f "msvc6.mak" CFG="msvc6 - Win32 Debug" -!MESSAGE +!MESSAGE !MESSAGE Possible choices for configuration are: -!MESSAGE +!MESSAGE !MESSAGE "msvc6 - Win32 Release" (based on "Win32 (x86) Dynamic-Link Library") !MESSAGE "msvc6 - Win32 Debug" (based on "Win32 (x86) Dynamic-Link Library") -!MESSAGE +!MESSAGE # Begin Project # PROP AllowPerConfigDependencies 0 @@ -81,7 +81,7 @@ LINK32=link.exe # ADD BASE LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib /nologo /dll /debug /machine:I386 /pdbtype:sept # ADD LINK32 kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib ../../../../angelscript/lib/angelscriptd.lib /nologo /dll /debug /machine:I386 /include:"_asCreateScriptEngine" /include:"_asEngine_AddRef" /out:"Debug/angelscript_c.dll" /pdbtype:sept -!ENDIF +!ENDIF # Begin Target diff --git a/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.cpp b/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.cpp index ce33635..dfcb7a0 100644 --- a/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.cpp +++ b/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.cpp @@ -6,12 +6,12 @@ using namespace std; // TODO: Should have a pool of free asIScriptContext so that new contexts -// won't be allocated every time. The application must not keep +// won't be allocated every time. The application must not keep // its own references, instead it must tell the context manager // that it is using the context. Otherwise the context manager may // think it can reuse the context too early. -// TODO: Need to have a callback for when scripts finishes, so that the +// TODO: Need to have a callback for when scripts finishes, so that the // application can receive return values. BEGIN_AS_NAMESPACE @@ -30,7 +30,7 @@ static void ScriptSleep(asUINT milliSeconds) asIScriptContext *ctx = asGetActiveContext(); if( ctx && g_ctxMgr ) { - // Suspend its execution. The VM will continue until the current + // Suspend its execution. The VM will continue until the current // statement is finished and then return from the Execute() method ctx->Suspend(); @@ -48,7 +48,7 @@ static void ScriptYield() // Let the context manager know that it should run the next co-routine g_ctxMgr->NextCoRoutine(); - // The current context must be suspended so that VM will return from + // The current context must be suspended so that VM will return from // the Execute() method where the context manager will continue. ctx->Suspend(); } @@ -63,7 +63,7 @@ void ScriptCreateCoRoutine(string &func, CScriptAny *arg) string mod = engine->GetFunctionDescriptorById(ctx->GetCurrentFunction())->GetModuleName(); // We need to find the function that will be created as the co-routine - string decl = "void " + func + "(any @)"; + string decl = "void " + func + "(any @)"; int funcId = engine->GetModule(mod.c_str())->GetFunctionIdByDecl(decl.c_str()); if( funcId < 0 ) { @@ -118,9 +118,9 @@ CContextMgr::~CContextMgr() void CContextMgr::ExecuteScripts() { - g_ctxMgr = this; + g_ctxMgr = this; - // TODO: Should have a time out. And if not all scripts executed before the + // TODO: Should have a time out. And if not all scripts executed before the // time out, the next time the function is called the loop should continue // where it left off. @@ -170,7 +170,7 @@ void CContextMgr::NextCoRoutine() void CContextMgr::AbortAll() { - // Abort all contexts and release them. The script engine will make + // Abort all contexts and release them. The script engine will make // sure that all resources held by the scripts are properly released. for( asUINT n = 0; n < threads.size(); n++ ) @@ -258,14 +258,14 @@ asIScriptContext *CContextMgr::AddContextForCoRoutine(asIScriptContext *currCtx, } } - return coctx; + return coctx; } void CContextMgr::SetSleeping(asIScriptContext *ctx, asUINT milliSeconds) { assert( getTimeFunc != 0 ); - - // Find the context and update the timeStamp + + // Find the context and update the timeStamp // for when the context is to be continued // TODO: Start with the current thread @@ -285,7 +285,7 @@ void CContextMgr::RegisterThreadSupport(asIScriptEngine *engine) // Must set the get time callback function for this to work assert( getTimeFunc != 0 ); - + // Register the sleep function r = engine->RegisterGlobalFunction("void sleep(uint)", asFUNCTION(ScriptSleep), asCALL_CDECL); assert( r >= 0 ); diff --git a/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.h b/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.h index 13fabdf..2c05ccf 100644 --- a/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.h +++ b/Libraries/AngelScript/sdk/add_on/contextmgr/contextmgr.h @@ -43,7 +43,7 @@ class CContextMgr // void yield() void RegisterCoRoutineSupport(asIScriptEngine *engine); - // Create a new context, prepare it with the function id, then return + // Create a new context, prepare it with the function id, then return // it so that the application can pass the argument values. The context // will be released by the manager after the execution has completed. asIScriptContext *AddContext(asIScriptEngine *engine, int funcId); @@ -53,7 +53,7 @@ class CContextMgr // will be added as a co-routine in the same thread as the currCtx. asIScriptContext *AddContextForCoRoutine(asIScriptContext *currCtx, int funcId); - // Execute each script that is not currently sleeping. The function returns after + // Execute each script that is not currently sleeping. The function returns after // each script has been executed once. The application should call this function // for each iteration of the message pump, or game loop, or whatever. void ExecuteScripts(); diff --git a/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.cpp b/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.cpp index f6250b1..79a8861 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.cpp @@ -245,7 +245,7 @@ CScriptAny::CScriptAny(asIScriptEngine *engine) value.valueInt = 0; // Notify the garbage collector of this object - engine->NotifyGarbageCollectorOfNewObject(this, engine->GetTypeIdByDecl("any")); + engine->NotifyGarbageCollectorOfNewObject(this, engine->GetTypeIdByDecl("any")); } CScriptAny::CScriptAny(void *ref, int refTypeId, asIScriptEngine *engine) @@ -257,7 +257,7 @@ CScriptAny::CScriptAny(void *ref, int refTypeId, asIScriptEngine *engine) value.valueInt = 0; // Notify the garbage collector of this object - engine->NotifyGarbageCollectorOfNewObject(this, engine->GetTypeIdByDecl("any")); + engine->NotifyGarbageCollectorOfNewObject(this, engine->GetTypeIdByDecl("any")); Store(ref, refTypeId); } @@ -322,7 +322,7 @@ bool CScriptAny::Retrieve(void *ref, int refTypeId) const // A handle can be retrieved if the stored type is a handle of same or compatible type // or if the stored type is an object that implements the interface that the handle refer to. - if( (value.typeId & asTYPEID_MASK_OBJECT) && + if( (value.typeId & asTYPEID_MASK_OBJECT) && engine->IsHandleCompatibleWithObject(value.valueObj, value.typeId, refTypeId) ) { engine->AddRefScriptObject(value.valueObj, value.typeId); diff --git a/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.h b/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.h index 810ef0c..7c41763 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.h +++ b/Libraries/AngelScript/sdk/add_on/scriptany/scriptany.h @@ -5,7 +5,7 @@ BEGIN_AS_NAMESPACE -class CScriptAny +class CScriptAny { public: // Constructors diff --git a/Libraries/AngelScript/sdk/add_on/scriptarray/scriptarray.cpp b/Libraries/AngelScript/sdk/add_on/scriptarray/scriptarray.cpp index 2769644..4d4f1fd 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptarray/scriptarray.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptarray/scriptarray.cpp @@ -17,7 +17,7 @@ static CScriptArray* ScriptArrayFactory2(asIObjectType *ot, asUINT length) { CScriptArray *a = new CScriptArray(length, ot); - // It's possible the constructor raised a script exception, in which case we + // It's possible the constructor raised a script exception, in which case we // need to free the memory and return null instead, else we get a memory leak. asIScriptContext *ctx = asGetActiveContext(); if( ctx && ctx->GetState() == asEXECUTION_EXCEPTION ) @@ -35,11 +35,11 @@ static CScriptArray* ScriptArrayFactory(asIObjectType *ot) } // This optional callback is called when the template type is first used by the compiler. -// It allows the application to validate if the template can be instanciated for the requested +// It allows the application to validate if the template can be instanciated for the requested // subtype at compile time, instead of at runtime. static bool ScriptArrayTemplateCallback(asIObjectType *ot) { - // Make sure the subtype can be instanciated with a default factory/constructor, + // Make sure the subtype can be instanciated with a default factory/constructor, // otherwise we won't be able to instanciate the elements int typeId = ot->GetSubTypeId(); if( (typeId & asTYPEID_MASK_OBJECT) && !(typeId & asTYPEID_OBJHANDLE) ) @@ -78,7 +78,7 @@ static bool ScriptArrayTemplateCallback(asIObjectType *ot) // Found the default factory return true; } - } + } // No default factory return false; @@ -101,7 +101,7 @@ void RegisterScriptArray(asIScriptEngine *engine) void RegisterScriptArray_Native(asIScriptEngine *engine) { int r; - + // Register the array type as a template r = engine->RegisterObjectType("array", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE); assert( r >= 0 ); @@ -119,7 +119,7 @@ void RegisterScriptArray_Native(asIScriptEngine *engine) // The index operator returns the template subtype r = engine->RegisterObjectBehaviour("array", asBEHAVE_INDEX, "T &f(uint)", asMETHOD(CScriptArray, At), asCALL_THISCALL); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("array", asBEHAVE_INDEX, "const T &f(uint) const", asMETHOD(CScriptArray, At), asCALL_THISCALL); assert( r >= 0 ); - + // The assignment operator r = engine->RegisterObjectMethod("array", "array &opAssign(const array&in)", asMETHOD(CScriptArray, operator=), asCALL_THISCALL); assert( r >= 0 ); @@ -138,7 +138,7 @@ void RegisterScriptArray_Native(asIScriptEngine *engine) CScriptArray &CScriptArray::operator=(const CScriptArray &other) { // Only perform the copy if the array types are the same - if( &other != this && + if( &other != this && other.GetArrayObjectType() == GetArrayObjectType() ) { if( buffer ) @@ -233,7 +233,7 @@ void CScriptArray::Resize(asUINT numElements) asDWORD **s = (asDWORD**)buffer->data; for( int n = 0; n < c; n++ ) d[n] = s[n]; - + if( numElements > buffer->numElements ) { Construct(newBuffer, buffer->numElements, numElements); @@ -262,7 +262,7 @@ void CScriptArray::Resize(asUINT numElements) // internal bool CScriptArray::CheckMaxSize(asUINT numElements) { - // This code makes sure the size of the buffer that is allocated + // This code makes sure the size of the buffer that is allocated // for the array doesn't overflow and becomes smaller than requested asUINT maxSize = 0xFFFFFFFFul - sizeof(SArrayBuffer) + 1; @@ -410,7 +410,7 @@ void CScriptArray::CopyBuffer(SArrayBuffer *dst, SArrayBuffer *src) asDWORD **max = (asDWORD**)(dst->data + count * sizeof(void*)); asDWORD **d = (asDWORD**)dst->data; asDWORD **s = (asDWORD**)src->data; - + for( ; d < max; d++, s++ ) { *d = *s; @@ -619,7 +619,7 @@ static void ScriptArrayReleaseAllHandles_Generic(asIScriptGeneric *gen) void RegisterScriptArray_Generic(asIScriptEngine *engine) { int r; - + r = engine->RegisterObjectType("array", 0, asOBJ_REF | asOBJ_GC | asOBJ_TEMPLATE); assert( r >= 0 ); r = engine->RegisterObjectBehaviour("array", asBEHAVE_FACTORY, "array@ f(int&in)", asFUNCTION(ScriptArrayFactory_Generic), asCALL_GENERIC); assert( r >= 0 ); diff --git a/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.cpp b/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.cpp index 6e86837..c4fc43a 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.cpp @@ -15,8 +15,8 @@ CScriptDictionary::CScriptDictionary(asIScriptEngine *engine) refCount = 1; // Keep a reference to the engine for as long as we live - // We don't increment the reference counter, because the - // engine will hold a pointer to the object. + // We don't increment the reference counter, because the + // engine will hold a pointer to the object. this->engine = engine; // Notify the garbage collector of this object @@ -72,7 +72,7 @@ void CScriptDictionary::EnumReferences(asIScriptEngine *engine) void CScriptDictionary::ReleaseAllReferences(asIScriptEngine * /*engine*/) { - // We're being told to release all references in + // We're being told to release all references in // order to break circular references for dead objects DeleteAll(); } @@ -126,16 +126,16 @@ void CScriptDictionary::Set(const string &key, void *value, int typeId) // This overloaded method is implemented so that all integer and // unsigned integers types will be stored in the dictionary as int64 // through implicit conversions. This simplifies the management of the -// numeric types when the script retrieves the stored value using a +// numeric types when the script retrieves the stored value using a // different type. void CScriptDictionary::Set(const string &key, asINT64 &value) { Set(key, &value, asTYPEID_INT64); } -// This overloaded method is implemented so that all floating point types -// will be stored in the dictionary as double through implicit conversions. -// This simplifies the management of the numeric types when the script +// This overloaded method is implemented so that all floating point types +// will be stored in the dictionary as double through implicit conversions. +// This simplifies the management of the numeric types when the script // retrieves the stored value using a different type. void CScriptDictionary::Set(const string &key, double &value) { @@ -154,7 +154,7 @@ bool CScriptDictionary::Get(const string &key, void *value, int typeId) const { // A handle can be retrieved if the stored type is a handle of same or compatible type // or if the stored type is an object that implements the interface that the handle refer to. - if( (it->second.typeId & asTYPEID_MASK_OBJECT) && + if( (it->second.typeId & asTYPEID_MASK_OBJECT) && engine->IsHandleCompatibleWithObject(it->second.valueObj, it->second.typeId, typeId) ) { engine->AddRefScriptObject(it->second.valueObj, it->second.typeId); @@ -202,7 +202,7 @@ bool CScriptDictionary::Get(const string &key, void *value, int typeId) const } // AngelScript has already initialized the value with a default value, - // so we don't have to do anything if we don't find the element, or if + // so we don't have to do anything if we don't find the element, or if // the element is incompatible with the requested type. return false; @@ -419,7 +419,7 @@ void RegisterScriptDictionary_Native(asIScriptEngine *engine) r = engine->RegisterObjectMethod("dictionary", "void set(const string &in, double&in)", asMETHODPR(CScriptDictionary,Set,(const string&,double&),void), asCALL_THISCALL); assert( r >= 0 ); r = engine->RegisterObjectMethod("dictionary", "bool get(const string &in, double&out) const", asMETHODPR(CScriptDictionary,Get,(const string&,double&) const,bool), asCALL_THISCALL); assert( r >= 0 ); - + r = engine->RegisterObjectMethod("dictionary", "bool exists(const string &in) const", asMETHOD(CScriptDictionary,Exists), asCALL_THISCALL); assert( r >= 0 ); r = engine->RegisterObjectMethod("dictionary", "void delete(const string &in)", asMETHOD(CScriptDictionary,Delete), asCALL_THISCALL); assert( r >= 0 ); r = engine->RegisterObjectMethod("dictionary", "void deleteAll()", asMETHOD(CScriptDictionary,DeleteAll), asCALL_THISCALL); assert( r >= 0 ); @@ -443,7 +443,7 @@ void RegisterScriptDictionary_Generic(asIScriptEngine *engine) r = engine->RegisterObjectMethod("dictionary", "void set(const string &in, ?&in)", asFUNCTION(ScriptDictionarySet_Generic), asCALL_GENERIC); assert( r >= 0 ); r = engine->RegisterObjectMethod("dictionary", "bool get(const string &in, ?&out) const", asFUNCTION(ScriptDictionaryGet_Generic), asCALL_GENERIC); assert( r >= 0 ); - + r = engine->RegisterObjectMethod("dictionary", "void set(const string &in, int64&in)", asFUNCTION(ScriptDictionarySetInt_Generic), asCALL_GENERIC); assert( r >= 0 ); r = engine->RegisterObjectMethod("dictionary", "bool get(const string &in, int64&out) const", asFUNCTION(ScriptDictionaryGetInt_Generic), asCALL_GENERIC); assert( r >= 0 ); diff --git a/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.h b/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.h index 5ddd851..e854879 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.h +++ b/Libraries/AngelScript/sdk/add_on/scriptdictionary/scriptdictionary.h @@ -65,7 +65,7 @@ class CScriptDictionary }; int typeId; }; - + // We don't want anyone to call the destructor directly, it should be called through the Release method virtual ~CScriptDictionary(); @@ -74,7 +74,7 @@ class CScriptDictionary // Helper methods void FreeValue(valueStruct &value); - + // Our properties asIScriptEngine *engine; int refCount; diff --git a/Libraries/AngelScript/sdk/add_on/scriptfile/scriptfile.cpp b/Libraries/AngelScript/sdk/add_on/scriptfile/scriptfile.cpp index 777631a..5528180 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptfile/scriptfile.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptfile/scriptfile.cpp @@ -214,7 +214,7 @@ int CScriptFile::Open(const std::string &filename, const std::string &mode) if (!apppath[0]) { GetModuleFileName(NULL, apppath, MAX_PATH); - + int appLen = _tcslen(apppath); while (appLen > 1) { @@ -277,7 +277,7 @@ int CScriptFile::GetPos() const return ftell(file); } - + int CScriptFile::SetPos(int pos) { if( file == 0 ) @@ -307,7 +307,7 @@ int CScriptFile::ReadString(unsigned int length, std::string &str) // Read the string str.resize(length); - int size = (int)fread(&str[0], 1, length, file); + int size = (int)fread(&str[0], 1, length, file); str.resize(size); return size; @@ -332,7 +332,7 @@ int CScriptFile::ReadLine(std::string &str) // Read the line (or first 255 characters, which ever comes first) fgets(buf, 256, file); - + // Get the position after the read int end = ftell(file); diff --git a/Libraries/AngelScript/sdk/add_on/scripthelper/scripthelper.cpp b/Libraries/AngelScript/sdk/add_on/scripthelper/scripthelper.cpp index 8477153..87ad2c6 100644 --- a/Libraries/AngelScript/sdk/add_on/scripthelper/scripthelper.cpp +++ b/Libraries/AngelScript/sdk/add_on/scripthelper/scripthelper.cpp @@ -8,9 +8,9 @@ BEGIN_AS_NAMESPACE int CompareRelation(asIScriptEngine *engine, void *lobj, void *robj, int typeId, int &result) { - // TODO: If a lot of script objects are going to be compared, e.g. when sorting an array, + // TODO: If a lot of script objects are going to be compared, e.g. when sorting an array, // then the method id and context should be cached between calls. - + int retval = -1; int funcId = 0; @@ -27,7 +27,7 @@ int CompareRelation(asIScriptEngine *engine, void *lobj, void *robj, int typeId, { asDWORD flags; int paramTypeId = func->GetParamTypeId(0, &flags); - + // The parameter must be an input reference of the same type if( flags != asTM_INREF || typeId != paramTypeId ) break; @@ -64,7 +64,7 @@ int CompareEquality(asIScriptEngine *engine, void *lobj, void *robj, int typeId, { // TODO: If a lot of script objects are going to be compared, e.g. when searching for an // entry in a set, then the method id and context should be cached between calls. - + int retval = -1; int funcId = 0; @@ -81,7 +81,7 @@ int CompareEquality(asIScriptEngine *engine, void *lobj, void *robj, int typeId, { asDWORD flags; int paramTypeId = func->GetParamTypeId(0, &flags); - + // The parameter must be an input reference of the same type if( flags != asTM_INREF || typeId != paramTypeId ) break; @@ -128,10 +128,10 @@ int ExecuteString(asIScriptEngine *engine, const char *code, asIScriptModule *mo string funcCode = "void ExecuteString() {\n"; funcCode += code; funcCode += "\n;}"; - + // If no module was provided, get a dummy from the engine asIScriptModule *execMod = mod ? mod : engine->GetModule("ExecuteString", asGM_ALWAYS_CREATE); - + // Compile the function that can be executed asIScriptFunction *func = 0; int r = execMod->CompileFunction("ExecuteString", funcCode.c_str(), -1, 0, &func); @@ -150,7 +150,7 @@ int ExecuteString(asIScriptEngine *engine, const char *code, asIScriptModule *mo // Execute the function r = execCtx->Execute(); - + // Clean up func->Release(); if( !ctx ) execCtx->Release(); diff --git a/Libraries/AngelScript/sdk/add_on/scriptmath/scriptmath.cpp b/Libraries/AngelScript/sdk/add_on/scriptmath/scriptmath.cpp index 24af42c..532b41f 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptmath/scriptmath.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptmath/scriptmath.cpp @@ -12,7 +12,7 @@ BEGIN_AS_NAMESPACE #endif #endif -// The modf function doesn't seem very intuitive, so I'm writing this +// The modf function doesn't seem very intuitive, so I'm writing this // function that simply returns the fractional part of the float value #if AS_USE_FLOAT float fractionf(float v) diff --git a/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.cpp b/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.cpp index 9c77db0..5d2c17c 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.cpp @@ -122,7 +122,7 @@ static void StringCharAtGeneric(asIScriptGeneric * gen) { } } -void AssignInt2StringGeneric(asIScriptGeneric *gen) +void AssignInt2StringGeneric(asIScriptGeneric *gen) { int *a = static_cast(gen->GetAddressOfArg(0)); string *self = static_cast(gen->GetObject()); @@ -132,7 +132,7 @@ void AssignInt2StringGeneric(asIScriptGeneric *gen) gen->SetReturnAddress(self); } -void AssignUInt2StringGeneric(asIScriptGeneric *gen) +void AssignUInt2StringGeneric(asIScriptGeneric *gen) { unsigned int *a = static_cast(gen->GetAddressOfArg(0)); string *self = static_cast(gen->GetObject()); @@ -142,7 +142,7 @@ void AssignUInt2StringGeneric(asIScriptGeneric *gen) gen->SetReturnAddress(self); } -void AssignDouble2StringGeneric(asIScriptGeneric *gen) +void AssignDouble2StringGeneric(asIScriptGeneric *gen) { double *a = static_cast(gen->GetAddressOfArg(0)); string *self = static_cast(gen->GetObject()); diff --git a/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.h b/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.h index 4a3711f..24ebffb 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.h +++ b/Libraries/AngelScript/sdk/add_on/scriptstdstring/scriptstdstring.h @@ -3,7 +3,7 @@ // // This function registers the std::string type with AngelScript to be used as the default string type. // -// The string type is registered as a value type, thus may have performance issues if a lot of +// The string type is registered as a value type, thus may have performance issues if a lot of // string operations are performed in the script. However, for relatively few operations, this should // not cause any problem for most applications. // diff --git a/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring.cpp b/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring.cpp index 55a4a9e..b8da35d 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring.cpp @@ -117,7 +117,7 @@ static int StringCmp(const string &a, const string &b) return cmp; } -static void StringCmp_Generic(asIScriptGeneric * gen) +static void StringCmp_Generic(asIScriptGeneric * gen) { string * a = static_cast(gen->GetObject()); string * b = static_cast(gen->GetArgAddress(0)); @@ -495,7 +495,7 @@ static void StringEqual_Generic(asIScriptGeneric *gen) *(bool*)gen->GetAddressOfReturnLocation() = r; } -static void StringEquals_Generic(asIScriptGeneric * gen) +static void StringEquals_Generic(asIScriptGeneric * gen) { string * a = static_cast(gen->GetObject()); string * b = static_cast(gen->GetArgAddress(0)); diff --git a/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring_utils.cpp b/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring_utils.cpp index 4daac08..1d5a376 100644 --- a/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring_utils.cpp +++ b/Libraries/AngelScript/sdk/add_on/scriptstring/scriptstring_utils.cpp @@ -329,7 +329,7 @@ void StringJoin_Generic(asIScriptGeneric *gen) // int64 parseInt(const string &in str, int &out bytesParsed); // double parseDouble(const string &in str, int &out bytesParsed); // string @ formatString(int64, const string &in format); // should use sprintf to format the string -// string @ formatDouble(double, const string &in format); +// string @ formatDouble(double, const string &in format); // // int16 byteStringToInt16(const string &in str, int start); // int32 byteStringToInt32(const string &in str, int start); diff --git a/Libraries/AngelScript/sdk/angelscript/include/angelscript.h b/Libraries/AngelScript/sdk/angelscript/include/angelscript.h index ee4241f..aa4d436 100644 --- a/Libraries/AngelScript/sdk/angelscript/include/angelscript.h +++ b/Libraries/AngelScript/sdk/angelscript/include/angelscript.h @@ -329,7 +329,7 @@ typedef void (*asFREEFUNC_t)(void *); #define asFUNCTION(f) asFunctionPtr(f) #if defined(_MSC_VER) && _MSC_VER <= 1200 // MSVC 6 has a bug that prevents it from properly compiling using the correct asFUNCTIONPR with operator > -// so we need to use ordinary C style cast instead of static_cast. The drawback is that the compiler can't +// so we need to use ordinary C style cast instead of static_cast. The drawback is that the compiler can't // check that the cast is really valid. #define asFUNCTIONPR(f,p,r) asFunctionPtr((void (*)())((r (*)p)(f))) #else @@ -348,7 +348,7 @@ struct asSFuncPtr // The largest known method point is 20 bytes (MSVC 64bit), // but with 8byte alignment this becomes 24 bytes. So we need // to be able to store at least that much. - char dummy[25]; + char dummy[25]; struct {asMETHOD_t mthd; char dummy[25-sizeof(asMETHOD_t)];} m; struct {asFUNCTION_t func; char dummy[25-sizeof(asFUNCTION_t)];} f; } ptr; @@ -971,9 +971,9 @@ struct asSMethodPtr // on 64bit platforms with 8byte data alignments. // Method pointers for virtual inheritance is not supported, - // as it requires the location of the vbase table, which is + // as it requires the location of the vbase table, which is // only available to the C++ compiler, but not in the method - // pointer. + // pointer. // You can get around this by forward declaring the class and // storing the sizeof its method pointer in a constant. Example: @@ -985,7 +985,7 @@ struct asSMethodPtr // for the class, which falls under the next case // TODO: We need to try to identify if this is really a method pointer - // with virtual inheritance, or just a method pointer for multiple + // with virtual inheritance, or just a method pointer for multiple // inheritance with pad bytes to produce a 16byte structure. asSFuncPtr p; @@ -1284,25 +1284,25 @@ enum asEBCType // Instruction type sizes const int asBCTypeSize[19] = { - 0, // asBCTYPE_INFO - 1, // asBCTYPE_NO_ARG - 1, // asBCTYPE_W_ARG - 1, // asBCTYPE_wW_ARG - 2, // asBCTYPE_DW_ARG - 2, // asBCTYPE_rW_DW_ARG - 3, // asBCTYPE_QW_ARG - 3, // asBCTYPE_DW_DW_ARG + 0, // asBCTYPE_INFO + 1, // asBCTYPE_NO_ARG + 1, // asBCTYPE_W_ARG + 1, // asBCTYPE_wW_ARG + 2, // asBCTYPE_DW_ARG + 2, // asBCTYPE_rW_DW_ARG + 3, // asBCTYPE_QW_ARG + 3, // asBCTYPE_DW_DW_ARG 2, // asBCTYPE_wW_rW_rW_ARG - 3, // asBCTYPE_wW_QW_ARG - 2, // asBCTYPE_wW_rW_ARG - 1, // asBCTYPE_rW_ARG - 2, // asBCTYPE_wW_DW_ARG + 3, // asBCTYPE_wW_QW_ARG + 2, // asBCTYPE_wW_rW_ARG + 1, // asBCTYPE_rW_ARG + 2, // asBCTYPE_wW_DW_ARG 3, // asBCTYPE_wW_rW_DW_ARG - 2, // asBCTYPE_rW_rW_ARG - 2, // asBCTYPE_W_rW_ARG - 2, // asBCTYPE_wW_W_ARG - 2, // asBCTYPE_W_DW_ARG - 4 // asBCTYPE_QW_DW_ARG + 2, // asBCTYPE_rW_rW_ARG + 2, // asBCTYPE_W_rW_ARG + 2, // asBCTYPE_wW_W_ARG + 2, // asBCTYPE_W_DW_ARG + 4 // asBCTYPE_QW_DW_ARG }; // Instruction info diff --git a/Libraries/AngelScript/sdk/angelscript/include/scriptbuilder.h b/Libraries/AngelScript/sdk/angelscript/include/scriptbuilder.h index 0a2388d..0bdc953 100644 --- a/Libraries/AngelScript/sdk/angelscript/include/scriptbuilder.h +++ b/Libraries/AngelScript/sdk/angelscript/include/scriptbuilder.h @@ -22,7 +22,7 @@ #include -#if defined(_MSC_VER) && _MSC_VER <= 1200 +#if defined(_MSC_VER) && _MSC_VER <= 1200 // disable the annoying warnings on MSVC 6 #pragma warning (disable:4786) #endif @@ -49,7 +49,7 @@ class CScriptBuilder; // then the function should return a negative value to abort the compilation. typedef int (*INCLUDECALLBACK_t)(const char *include, const char *from, CScriptBuilder *builder, void *userParam); -// Helper class for loading and pre-processing script files to +// Helper class for loading and pre-processing script files to // support include directives and metadata declarations class CScriptBuilder { @@ -63,7 +63,7 @@ class CScriptBuilder int AddSectionFromFile(const char *filename); // Load a script section from memory - int AddSectionFromMemory(const char *scriptCode, + int AddSectionFromMemory(const char *scriptCode, const char *sectionName = ""); // Build the added script sections diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.cpp index b729cdb..1008b97 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -48,7 +48,7 @@ static asCArrayObject* ArrayObjectFactory2(asIObjectType *ot, asUINT length) { asCArrayObject *a = asNEW(asCArrayObject)(length, ot); - // It's possible the constructor raised a script exception, in which case we + // It's possible the constructor raised a script exception, in which case we // need to free the memory and return null instead, else we get a memory leak. asIScriptContext *ctx = asGetActiveContext(); if( ctx && ctx->GetState() == asEXECUTION_EXCEPTION ) @@ -221,7 +221,7 @@ void RegisterArrayObject(asIScriptEngine *engine) r = engine->RegisterObjectBehaviour("_builtin_array_", asBEHAVE_GETGCFLAG, "bool f()", asFUNCTION(ArrayObject_GetFlag_Generic), asCALL_GENERIC); asASSERT( r >= 0 ); r = engine->RegisterObjectBehaviour("_builtin_array_", asBEHAVE_ENUMREFS, "void f(int&in)", asFUNCTION(ArrayObject_EnumReferences_Generic), asCALL_GENERIC); asASSERT( r >= 0 ); r = engine->RegisterObjectBehaviour("_builtin_array_", asBEHAVE_RELEASEREFS, "void f(int&in)", asFUNCTION(ArrayObject_ReleaseAllHandles_Generic), asCALL_GENERIC); asASSERT( r >= 0 ); -#endif +#endif } asCArrayObject &asCArrayObject::operator=(asCArrayObject &other) @@ -337,7 +337,7 @@ void asCArrayObject::Resize(asUINT numElements) asDWORD **s = (asDWORD**)buffer->data; for( int n = 0; n < c; n++ ) d[n] = s[n]; - + if( numElements > buffer->numElements ) { Construct(newBuffer, buffer->numElements, numElements); @@ -366,7 +366,7 @@ void asCArrayObject::Resize(asUINT numElements) // internal bool asCArrayObject::CheckMaxSize(asUINT numElements) { - // This code makes sure the size of the buffer that is allocated + // This code makes sure the size of the buffer that is allocated // for the array doesn't overflow and becomes smaller than requested asUINT maxSize = 0xFFFFFFFFul - sizeof(sArrayBuffer) + 1; @@ -514,7 +514,7 @@ void asCArrayObject::CopyBuffer(sArrayBuffer *dst, sArrayBuffer *src) asDWORD **max = (asDWORD**)(dst->data + count * sizeof(void*)); asDWORD **d = (asDWORD**)dst->data; asDWORD **s = (asDWORD**)src->data; - + for( ; d < max; d++, s++ ) { *d = *s; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.h b/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.h index 8d71269..02ec713 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_arrayobject.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_atomic.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_atomic.cpp index efa59b3..dac2992 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_atomic.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_atomic.cpp @@ -27,7 +27,7 @@ Andreas Jonsson andreas@angelcode.com */ - + // // as_gc.cpp // @@ -109,15 +109,15 @@ asDWORD asCAtomic::atomicDec() #elif defined(AS_LINUX) || defined(AS_BSD) // -// atomic_inc_and_test() and atomic_dec_and_test() from asm/atomic.h is not meant -// to be used outside the Linux kernel. Instead we should use the GNUC provided +// atomic_inc_and_test() and atomic_dec_and_test() from asm/atomic.h is not meant +// to be used outside the Linux kernel. Instead we should use the GNUC provided // __sync_add_and_fetch() and __sync_sub_and_fetch() functions. // // Reference: http://golubenco.org/blog/atomic-operations/ // -// These are only available in GCC 4.1 and above, so for older versions we +// These are only available in GCC 4.1 and above, so for older versions we // use the critical sections, though it is a lot slower. -// +// asDWORD asCAtomic::atomicInc() { @@ -148,7 +148,7 @@ asDWORD asCAtomic::atomicDec() #else // If we get here, then the configuration in as_config.h -// is wrong for the compiler/platform combination. +// is wrong for the compiler/platform combination. int ERROR_PleaseFixTheConfig[-1]; #endif diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_atomic.h b/Libraries/AngelScript/sdk/angelscript/source/as_atomic.h index 123097f..193b15b 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_atomic.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_atomic.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -33,7 +33,7 @@ // as_atomic.h // // The asCAtomic class provides methods for performing threadsafe -// operations on a single dword, e.g. reference counting and +// operations on a single dword, e.g. reference counting and // bitfields. // diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_builder.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_builder.cpp index 35ebcf1..1567fc4 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_builder.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_builder.cpp @@ -247,7 +247,7 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l // Add the string to the script code asCScriptCode *script = asNEW(asCScriptCode); script->SetCode(sectionName, code, true); - script->lineOffset = lineOffset; + script->lineOffset = lineOffset; scripts.PushLast(script); // Parse the string @@ -258,9 +258,9 @@ int asCBuilder::CompileFunction(const char *sectionName, const char *code, int l asCScriptNode *node = parser.GetScriptNode(); // Make sure there is nothing else than the function in the script code - if( node == 0 || - node->firstChild == 0 || - node->firstChild != node->lastChild || + if( node == 0 || + node->firstChild == 0 || + node->firstChild != node->lastChild || node->firstChild->nodeType != snFunction ) { WriteError(script->name.AddressOf(), TXT_ONLY_ONE_FUNCTION_ALLOWED, 0, 0); @@ -1119,10 +1119,10 @@ void asCBuilder::CompileGlobalVariables() asCArray initOrder; // We first try to compile all the primitive global variables, and only after that - // compile the non-primitive global variables. This permits the constructors - // for the complex types to use the already initialized variables of primitive - // type. Note, we currently don't know which global variables are used in the - // constructors, so we cannot guarantee that variables of complex types are + // compile the non-primitive global variables. This permits the constructors + // for the complex types to use the already initialized variables of primitive + // type. Note, we currently don't know which global variables are used in the + // constructors, so we cannot guarantee that variables of complex types are // initialized in the correct order, so we won't reorder those. bool compilingPrimitives = true; @@ -1265,7 +1265,7 @@ void asCBuilder::CompileGlobalVariables() initFunc->globalVarPointers = func.globalVarPointers; initFunc->AddReferences(); - // The function's refCount was already initialized to 1 + // The function's refCount was already initialized to 1 gvar->property->initFunc = initFunc; } } @@ -1284,7 +1284,7 @@ void asCBuilder::CompileGlobalVariables() { if( compilingPrimitives ) { - // No more primitives could be compiled, so + // No more primitives could be compiled, so // switch to compiling the complex variables compilingPrimitives = false; compileSucceeded = true; @@ -1312,8 +1312,8 @@ void asCBuilder::CompileGlobalVariables() // Set the correct order of initialization if( numErrors == 0 ) { - // If the length of the arrays are not the same, then this is the compilation - // of a single variable, in which case the initialization order of the previous + // If the length of the arrays are not the same, then this is the compilation + // of a single variable, in which case the initialization order of the previous // variables must be preserved. if( module->scriptGlobals.GetLength() == initOrder.GetLength() ) module->scriptGlobals = initOrder; @@ -1985,7 +1985,7 @@ int asCBuilder::RegisterEnum(asCScriptNode *node, asCScriptCode *file) gvar->isEnumValue = true; gvar->constantValue = 0xdeadbeef; - // Allocate dummy property so we can compile the value. + // Allocate dummy property so we can compile the value. // This will be removed later on so we don't add it to the engine. gvar->property = asNEW(asCGlobalProperty); gvar->property->name = name; @@ -2533,7 +2533,7 @@ asCDataType asCBuilder::CreateDataTypeFromNode(asCScriptNode *node, asCScriptCod asCObjectType *ot = 0; - // If this is for a template type, then we must first determine if the + // If this is for a template type, then we must first determine if the // identifier matches any of the template subtypes // TODO: template: it should be possible to have more than one subtypes if( templateType && (templateType->flags & asOBJ_TEMPLATE) && str == templateType->templateSubType.GetObjectType()->name ) @@ -2575,7 +2575,7 @@ asCDataType asCBuilder::CreateDataTypeFromNode(asCScriptNode *node, asCScriptCod if( ot->flags & asOBJ_TEMPLATE ) { n = n->next; - + // Check if the subtype is a type or the template's subtype // if it is the template's subtype then this is the actual template type, // orderwise it is a template instance. diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_builder.h b/Libraries/AngelScript/sdk/angelscript/source/as_builder.h index 7272bd6..0a11065 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_builder.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_builder.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -143,7 +143,7 @@ class asCBuilder void AddDefaultConstructor(asCObjectType *objType, asCScriptCode *file); asCObjectProperty *AddPropertyToClass(sClassDeclaration *c, const asCString &name, const asCDataType &type, asCScriptCode *file = 0, asCScriptNode *node = 0); - + int CreateVirtualFunction(asCScriptFunction *func, int idx); asCObjectType *GetObjectType(const char *type); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.cpp index fabb34a..adcc198 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -80,7 +80,7 @@ void asCByteCode::ClearAll() { cByteInstruction *del = first; - while( del ) + while( del ) { first = del->next; engine->memoryMgr.FreeByteInstruction(del); @@ -242,28 +242,28 @@ bool asCByteCode::IsCombination(cByteInstruction *curr, asEBCInstr bc1, asEBCIns { if( curr->op == bc1 && curr->next && curr->next->op == bc2 ) return true; - + return false; } bool asCByteCode::IsCombination(cByteInstruction *curr, asEBCInstr bc1, asEBCInstr bc2, asEBCInstr bc3) { - if( curr->op == bc1 && + if( curr->op == bc1 && curr->next && curr->next->op == bc2 && curr->next->next && curr->next->next->op == bc3 ) return true; - + return false; } cByteInstruction *asCByteCode::ChangeFirstDeleteNext(cByteInstruction *curr, asEBCInstr bc) { curr->op = bc; - + if( curr->next ) DeleteInstruction(curr->next); - + // Continue optimization with the instruction before the altered one - if( curr->prev ) + if( curr->prev ) return curr->prev; else return curr; @@ -272,14 +272,14 @@ cByteInstruction *asCByteCode::ChangeFirstDeleteNext(cByteInstruction *curr, asE cByteInstruction *asCByteCode::DeleteFirstChangeNext(cByteInstruction *curr, asEBCInstr bc) { asASSERT( curr->next ); - + cByteInstruction *instr = curr->next; instr->op = bc; - + DeleteInstruction(curr); - + // Continue optimization with the instruction before the altered one - if( instr->prev ) + if( instr->prev ) return instr->prev; else return instr; @@ -343,7 +343,7 @@ bool asCByteCode::PostponeInitOfTemp(cByteInstruction *curr, cByteInstruction ** { if( curr->op != asBC_SetV4 || !IsTemporary(curr->wArg[0]) ) return false; - // Move the initialization to just before it's use. + // Move the initialization to just before it's use. // Don't move it beyond any labels or jumps. cByteInstruction *use = curr->next; while( use ) @@ -368,14 +368,14 @@ bool asCByteCode::PostponeInitOfTemp(cByteInstruction *curr, cByteInstruction ** RemoveInstruction(curr); InsertBefore(use, curr); - // Try a RemoveUnusedValue to see if it can be combined with the other + // Try a RemoveUnusedValue to see if it can be combined with the other cByteInstruction *temp; if( RemoveUnusedValue(curr, &temp) ) { *next = GoBack(*next); return true; } - + // Return the instructions to its original position as it wasn't useful RemoveInstruction(curr); InsertBefore(*next, curr); @@ -412,7 +412,7 @@ bool asCByteCode::RemoveUnusedValue(cByteInstruction *curr, cByteInstruction **n // TODO: There should be one for doubles as well // The value is immediately used and then never again if( curr->op == asBC_SetV4 && - curr->next && + curr->next && (curr->next->op == asBC_CMPi || curr->next->op == asBC_CMPf || curr->next->op == asBC_CMPu) && @@ -428,10 +428,10 @@ bool asCByteCode::RemoveUnusedValue(cByteInstruction *curr, cByteInstruction **n *next = GoBack(DeleteInstruction(curr)); return true; } - + // The value is immediately used and then never again if( curr->op == asBC_SetV4 && - curr->next && + curr->next && (curr->next->op == asBC_ADDi || curr->next->op == asBC_SUBi || curr->next->op == asBC_MULi || @@ -456,7 +456,7 @@ bool asCByteCode::RemoveUnusedValue(cByteInstruction *curr, cByteInstruction **n } if( curr->op == asBC_SetV4 && - curr->next && + curr->next && (curr->next->op == asBC_ADDi || curr->next->op == asBC_MULi || curr->next->op == asBC_ADDf || @@ -481,10 +481,10 @@ bool asCByteCode::RemoveUnusedValue(cByteInstruction *curr, cByteInstruction **n } // The values is immediately moved to another variable and then not used again - if( (asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG || - asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG) && + if( (asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG || + asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG) && curr->next && curr->next->op == asBC_CpyVtoV4 && - curr->wArg[0] == curr->next->wArg[1] && + curr->wArg[0] == curr->next->wArg[1] && IsTemporary(curr->wArg[0]) && !IsTempVarRead(curr->next, curr->wArg[0]) ) { @@ -580,9 +580,9 @@ int asCByteCode::Optimize() // TODO: optimize: Optimize the release of script objects. Most of the time the instructions PSV and FREE are used for this. // Need a bytecode BC_FreeV that can free the object stored in a variable directly - + // TODO: optimize: Need a bytecode BC_AddRef so that BC_CALLSYS doesn't have to be used for this trivial call - + // TODO: global: The global var address should be stored in the instruction directly cByteInstruction *instr = first; @@ -591,7 +591,7 @@ int asCByteCode::Optimize() cByteInstruction *curr = instr; instr = instr->next; - // Remove or combine instructions + // Remove or combine instructions if( RemoveUnusedValue(curr, &instr) ) continue; // Postpone initializations so that they may be combined in the second pass @@ -619,7 +619,7 @@ int asCByteCode::Optimize() else if( IsCombination(curr, asBC_PSF, asBC_RDS4) ) instr = GoBack(ChangeFirstDeleteNext(curr, asBC_PshV4)); // RDS4, POP x -> POP x - else if( IsCombination(curr, asBC_RDS4, asBC_POP) && instr->wArg[0] > 0 ) + else if( IsCombination(curr, asBC_RDS4, asBC_POP) && instr->wArg[0] > 0 ) instr = GoBack(DeleteInstruction(curr)); // LDG x, WRTV4 y -> CpyVtoG4 y, x else if( IsCombination(curr, asBC_LDG, asBC_WRTV4) && !IsTempRegUsed(instr) ) @@ -636,7 +636,7 @@ int asCByteCode::Optimize() { if( !IsTempRegUsed(instr) ) curr->op = asBC_CpyGtoV4; - else + else curr->op = asBC_LdGRdR4; curr->size = asBCTypeSize[asBCInfo[asBC_CpyGtoV4].type]; curr->wArg[1] = curr->wArg[0]; @@ -649,7 +649,7 @@ int asCByteCode::Optimize() else if( IsCombination(curr, asBC_LDV, asBC_INCi) && !IsTempRegUsed(instr) ) { curr->op = asBC_IncVi; - + DeleteInstruction(instr); instr = GoBack(curr); } @@ -657,7 +657,7 @@ int asCByteCode::Optimize() else if( IsCombination(curr, asBC_LDV, asBC_DECi) && !IsTempRegUsed(instr) ) { curr->op = asBC_DecVi; - + DeleteInstruction(instr); instr = GoBack(curr); } @@ -677,7 +677,7 @@ int asCByteCode::Optimize() } // SUSPEND, JitEntry, SUSPEND -> SUSPEND // LINE, JitEntry, LINE -> LINE - else if( (IsCombination(curr, asBC_SUSPEND, asBC_JitEntry) && IsCombination(instr, asBC_JitEntry, asBC_SUSPEND)) || + else if( (IsCombination(curr, asBC_SUSPEND, asBC_JitEntry) && IsCombination(instr, asBC_JitEntry, asBC_SUSPEND)) || (IsCombination(curr, asBC_LINE, asBC_JitEntry) && IsCombination(instr, asBC_JitEntry, asBC_LINE)) ) { // Delete the two first instructions @@ -686,8 +686,8 @@ int asCByteCode::Optimize() } // SUSPEND, SUSPEND -> SUSPEND // LINE, LINE -> LINE - else if( IsCombination(curr, asBC_SUSPEND, asBC_SUSPEND) || - IsCombination(curr, asBC_LINE, asBC_LINE) ) + else if( IsCombination(curr, asBC_SUSPEND, asBC_SUSPEND) || + IsCombination(curr, asBC_LINE, asBC_LINE) ) { // Delete the first instruction instr = GoBack(DeleteInstruction(curr)); @@ -723,7 +723,7 @@ int asCByteCode::Optimize() // PshRPtr, POP x -> POP x - 1 else if( (IsCombination(curr, asBC_PshRPtr, asBC_POP) || IsCombination(curr, asBC_PSF , asBC_POP) || - IsCombination(curr, asBC_VAR , asBC_POP)) + IsCombination(curr, asBC_VAR , asBC_POP)) && instr->wArg[0] > (AS_PTR_SIZE-1) ) { DeleteInstruction(curr); @@ -746,11 +746,11 @@ int asCByteCode::Optimize() } // POP 0 -> remove // PUSH 0 -> remove - else if( (curr->op == asBC_POP || curr->op == asBC_PUSH ) && curr->wArg[0] == 0 ) + else if( (curr->op == asBC_POP || curr->op == asBC_PUSH ) && curr->wArg[0] == 0 ) instr = GoBack(DeleteInstruction(curr)); // Begin PATTERN // T**; J** +x -> J** +x - else if( IsCombination(curr, asBC_TZ , asBC_JZ ) || + else if( IsCombination(curr, asBC_TZ , asBC_JZ ) || IsCombination(curr, asBC_TNZ, asBC_JNZ) ) instr = GoBack(DeleteFirstChangeNext(curr, asBC_JNZ)); else if( IsCombination(curr, asBC_TNZ, asBC_JZ ) || @@ -819,7 +819,7 @@ int asCByteCode::Optimize() bool asCByteCode::IsTempVarReadByInstr(cByteInstruction *curr, int offset) { // Which instructions read from variables? - if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG && + if( asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG && (curr->wArg[1] == offset || curr->wArg[2] == offset) ) return true; else if( (asBCInfo[curr->op].type == asBCTYPE_rW_ARG || @@ -860,7 +860,7 @@ bool asCByteCode::IsTempVarOverwrittenByInstr(cByteInstruction *curr, int offset if( curr->op == asBC_RET || curr->op == asBC_SUSPEND ) return true; - else if( (asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG || + else if( (asBCInfo[curr->op].type == asBCTYPE_wW_rW_rW_ARG || asBCInfo[curr->op].type == asBCTYPE_wW_rW_ARG || asBCInfo[curr->op].type == asBCTYPE_wW_rW_DW_ARG || asBCInfo[curr->op].type == asBCTYPE_wW_ARG || @@ -1020,7 +1020,7 @@ void asCByteCode::ExtractLineNumbers() { cByteInstruction *curr = instr; instr = instr->next; - + if( curr->op == asBC_LINE ) { if( lastLinePos == pos ) @@ -1171,7 +1171,7 @@ void asCByteCode::JmpP(int var, asDWORD max) { if( AddInstruction() < 0 ) return; - + asASSERT(asBCInfo[asBC_JMPP].type == asBCTYPE_rW_ARG); last->op = asBC_JMPP; @@ -1273,13 +1273,13 @@ int asCByteCode::ResolveJumpAddresses() // The program pointer is updated as the instruction is read pos += instr->GetSize(); - if( instr->op == asBC_JMP || + if( instr->op == asBC_JMP || instr->op == asBC_JZ || instr->op == asBC_JNZ || - instr->op == asBC_JS || instr->op == asBC_JNS || + instr->op == asBC_JS || instr->op == asBC_JNS || instr->op == asBC_JP || instr->op == asBC_JNP ) { int label = *((int*) ARG_DW(instr->arg)); - int labelPosOffset; + int labelPosOffset; int r = FindLabel(label, instr, 0, &labelPosOffset); if( r == 0 ) *((int*) ARG_DW(instr->arg)) = labelPosOffset; @@ -1299,7 +1299,7 @@ cByteInstruction *asCByteCode::DeleteInstruction(cByteInstruction *instr) if( instr == 0 ) return 0; cByteInstruction *ret = instr->prev ? instr->prev : instr->next; - + RemoveInstruction(instr); engine->memoryMgr.FreeByteInstruction(instr); @@ -1312,7 +1312,7 @@ void asCByteCode::Output(asDWORD *array) // TODO: Receive a script function pointer // TODO: When arguments in a byte instruction are too large put them in the constant memory instead - // 4 byte arguments may remain in the instruction code for now. But move + // 4 byte arguments may remain in the instruction code for now. But move // the 8 byte arguments to the constant memory // Pointers will also be moved to the pointer array @@ -1325,7 +1325,7 @@ void asCByteCode::Output(asDWORD *array) { *(asBYTE*)ap = asBYTE(instr->op); *(((asBYTE*)ap)+1) = 0; // Second byte is always zero - switch( asBCInfo[instr->op].type ) + switch( asBCInfo[instr->op].type ) { case asBCTYPE_NO_ARG: *(((asWORD*)ap)+1) = 0; // Clear upper bytes @@ -1351,7 +1351,7 @@ void asCByteCode::Output(asDWORD *array) *(asQWORD*)(ap+1) = asQWORD(instr->arg); break; case asBCTYPE_W_ARG: - case asBCTYPE_rW_ARG: + case asBCTYPE_rW_ARG: case asBCTYPE_wW_ARG: *(((asWORD*)ap)+1) = instr->wArg[0]; break; @@ -1387,7 +1387,7 @@ void asCByteCode::PostProcess() // This function will do the following // - Verify if there is any code that never gets executed and remove it - // - Calculate the stack size at the position of each byte code + // - Calculate the stack size at the position of each byte code // - Calculate the largest stack needed largestStackUsed = 0; @@ -1409,13 +1409,13 @@ void asCByteCode::PostProcess() { instr = paths[p]; int stackSize = instr->stackSize; - + while( instr ) { instr->marked = true; instr->stackSize = stackSize; stackSize += instr->stackInc; - if( stackSize > largestStackUsed ) + if( stackSize > largestStackUsed ) largestStackUsed = stackSize; // PSP -> PSF @@ -1431,7 +1431,7 @@ void asCByteCode::PostProcess() int label = *((int*) ARG_DW(instr->arg)); cByteInstruction *dest = 0; int r = FindLabel(label, instr, &dest, 0); asASSERT( r == 0 ); UNUSED_VAR(r); - + AddPath(paths, dest, stackSize); break; } @@ -1443,28 +1443,28 @@ void asCByteCode::PostProcess() int label = *((int*) ARG_DW(instr->arg)); cByteInstruction *dest = 0; int r = FindLabel(label, instr, &dest, 0); asASSERT( r == 0 ); UNUSED_VAR(r); - + AddPath(paths, dest, stackSize); - + // Add both paths to the code paths AddPath(paths, instr->next, stackSize); - + break; } else if( instr->op == asBC_JMPP ) { // I need to know the largest value possible asDWORD max = *ARG_DW(instr->arg); - + // Add all destinations to the code paths cByteInstruction *dest = instr->next; for( asDWORD n = 0; n <= max && dest != 0; ++n ) { AddPath(paths, dest, stackSize); dest = dest->next; - } - - break; + } + + break; } else { @@ -1474,7 +1474,7 @@ void asCByteCode::PostProcess() } } } - + // Are there any instructions that didn't get visited? instr = first; while( instr ) @@ -1490,7 +1490,7 @@ void asCByteCode::PostProcess() } else instr = instr->next; - } + } } #ifdef AS_DEBUG @@ -1501,7 +1501,7 @@ void asCByteCode::DebugOutput(const char *name, asCScriptEngine *engine) asCString str = "AS_DEBUG/"; str += name; -#if _MSC_VER >= 1500 +#if _MSC_VER >= 1500 FILE *file; fopen_s(&file, str.AddressOf(), "w"); #else @@ -1605,7 +1605,7 @@ void asCByteCode::DebugOutput(const char *name, asCScriptEngine *engine) fprintf(file, " %-8s %d (%s)\n", asBCInfo[instr->op].name, *((int*) ARG_DW(instr->arg)), decl.AddressOf()); } - break; + break; case asBC_FREE: case asBC_REFCPY: @@ -1872,7 +1872,7 @@ int asCByteCode::InstrW_DW(asEBCInstr bc, asWORD a, asDWORD b) int asCByteCode::InstrSHORT_B(asEBCInstr bc, short a, asBYTE b) { - asASSERT(asBCInfo[bc].type == asBCTYPE_wW_DW_ARG || + asASSERT(asBCInfo[bc].type == asBCTYPE_wW_DW_ARG || asBCInfo[bc].type == asBCTYPE_rW_DW_ARG); asASSERT(asBCInfo[bc].stackInc == 0); @@ -1883,7 +1883,7 @@ int asCByteCode::InstrSHORT_B(asEBCInstr bc, short a, asBYTE b) last->wArg[0] = a; // We'll have to be careful to store the byte correctly, independent of endianess. - // Some optimizing compilers may change the order of operations, so we make sure + // Some optimizing compilers may change the order of operations, so we make sure // the value is not overwritten even if that happens. asBYTE *argPtr = (asBYTE*)ARG_DW(last->arg); argPtr[0] = b; // The value is always stored in the lower byte @@ -1899,7 +1899,7 @@ int asCByteCode::InstrSHORT_B(asEBCInstr bc, short a, asBYTE b) int asCByteCode::InstrSHORT_W(asEBCInstr bc, short a, asWORD b) { - asASSERT(asBCInfo[bc].type == asBCTYPE_wW_DW_ARG || + asASSERT(asBCInfo[bc].type == asBCTYPE_wW_DW_ARG || asBCInfo[bc].type == asBCTYPE_rW_DW_ARG); asASSERT(asBCInfo[bc].stackInc == 0); @@ -1908,9 +1908,9 @@ int asCByteCode::InstrSHORT_W(asEBCInstr bc, short a, asWORD b) last->op = bc; last->wArg[0] = a; - + // We'll have to be careful to store the word correctly, independent of endianess. - // Some optimizing compilers may change the order of operations, so we make sure + // Some optimizing compilers may change the order of operations, so we make sure // the value is not overwritten even if that happens. asWORD *argPtr = (asWORD*)ARG_DW(last->arg); argPtr[0] = b; // The value is always stored in the lower word @@ -1924,7 +1924,7 @@ int asCByteCode::InstrSHORT_W(asEBCInstr bc, short a, asWORD b) int asCByteCode::InstrSHORT_DW(asEBCInstr bc, short a, asDWORD b) { - asASSERT(asBCInfo[bc].type == asBCTYPE_wW_DW_ARG || + asASSERT(asBCInfo[bc].type == asBCTYPE_wW_DW_ARG || asBCInfo[bc].type == asBCTYPE_rW_DW_ARG); asASSERT(asBCInfo[bc].stackInc == 0); @@ -1993,8 +1993,8 @@ int asCByteCode::InstrW_FLOAT(asEBCInstr bc, asWORD a, float b) int asCByteCode::InstrSHORT(asEBCInstr bc, short param) { - asASSERT(asBCInfo[bc].type == asBCTYPE_rW_ARG || - asBCInfo[bc].type == asBCTYPE_wW_ARG || + asASSERT(asBCInfo[bc].type == asBCTYPE_rW_ARG || + asBCInfo[bc].type == asBCTYPE_wW_ARG || asBCInfo[bc].type == asBCTYPE_W_ARG); asASSERT(asBCInfo[bc].stackInc != 0xFFFF); @@ -2075,8 +2075,8 @@ int asCByteCode::InstrQWORD(asEBCInstr bc, asQWORD param) int asCByteCode::InstrWORD(asEBCInstr bc, asWORD param) { - asASSERT(asBCInfo[bc].type == asBCTYPE_W_ARG || - asBCInfo[bc].type == asBCTYPE_rW_ARG || + asASSERT(asBCInfo[bc].type == asBCTYPE_W_ARG || + asBCInfo[bc].type == asBCTYPE_rW_ARG || asBCInfo[bc].type == asBCTYPE_wW_ARG); asASSERT(asBCInfo[bc].stackInc != 0xFFFF); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.h b/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.h index 5b92d0f..796689a 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_bytecode.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc.cpp index f1c1901..5067ba0 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc.cpp @@ -128,7 +128,7 @@ int PrepareSystemFunctionGeneric(asCScriptFunction *func, asSSystemFunctionInter int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *internal, asCScriptEngine *engine) { #ifdef AS_MAX_PORTABILITY - // This should never happen, as when AS_MAX_PORTABILITY is on, all functions + // This should never happen, as when AS_MAX_PORTABILITY is on, all functions // are asCALL_GENERIC, which are prepared by PrepareSystemFunctionGeneric asASSERT(false); #endif @@ -144,7 +144,7 @@ int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *i else if( func->returnType.IsObject() ) { asDWORD objType = func->returnType.GetObjectType()->flags; - + // Only value types can be returned by value asASSERT( objType & asOBJ_VALUE ); @@ -280,7 +280,7 @@ int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *i if( !(func->parameterTypes[n].GetObjectType()->flags & (asOBJ_APP_CLASS | asOBJ_APP_PRIMITIVE | asOBJ_APP_FLOAT)) ) { engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, func->GetDeclarationStr().AddressOf()); - + asCString str; str.Format(TXT_CANNOT_PASS_TYPE_s_BY_VAL, func->parameterTypes[n].GetObjectType()->name.AddressOf()); engine->WriteMessage("", 0, 0, asMSGTYPE_ERROR, str.AddressOf()); @@ -292,7 +292,7 @@ int PrepareSystemFunction(asCScriptFunction *func, asSSystemFunctionInterface *i // It's not safe to pass objects by value because different registers // will be used depending on the memory layout of the object #ifdef COMPLEX_OBJS_PASSED_BY_REF - if( !(func->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK) ) + if( !(func->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK) ) #endif { engine->WriteMessage("", 0, 0, asMSGTYPE_INFORMATION, func->GetDeclarationStr().AddressOf()); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm.cpp index decae22..ed86967 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm.cpp @@ -244,7 +244,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) { void *obj = (void*)args[spos++]; - // Running the destructor here results in the destructor being + // Running the destructor here results in the destructor being // run twice as it has already been called in the native function. // TODO: Should this be an ifdef or removed completely? // asSTypeBehaviour *beh = &descr->parameterTypes[n].GetObjectType()->beh; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_gcc.S b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_gcc.S index 949d6c1..9c654a7 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_gcc.S +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_gcc.S @@ -41,7 +41,7 @@ .global armFuncR0R1 .global armFuncObjLast .global armFuncR0ObjLast - + armFunc: stmdb sp!, {r4-r8, lr} mov r6, r0 // arg table @@ -94,7 +94,7 @@ armFuncObjLast: ldrge r0, [r6],#4 cmp r7, #2*4 ldrge r1, [r6],#4 - ldrlt r1, [sp] + ldrlt r1, [sp] cmp r7, #3*4 ldrge r2, [r6],#4 ldrlt r2, [sp] diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_msvc.asm b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_msvc.asm index 8db42da..af374f1 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_msvc.asm +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_msvc.asm @@ -42,7 +42,7 @@ EXPORT armFuncR0R1 EXPORT armFuncObjLast EXPORT armFuncR0ObjLast - + AREA |.text|, CODE, ARM @@ -99,7 +99,7 @@ armFuncObjLast PROC ldrge r0, [r6],#4 cmp r7, #2*4 ldrge r1, [r6],#4 - ldrlt r1, [sp] + ldrlt r1, [sp] cmp r7, #3*4 ldrge r2, [r6],#4 ldrlt r2, [sp] diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_xcode.s b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_xcode.s index 60c4e18..91c17e5 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_xcode.s +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_arm_xcode.s @@ -43,7 +43,7 @@ .globl _armFuncR0R1 .globl _armFuncObjLast .globl _armFuncR0ObjLast - + _armFunc: stmdb sp!, {r4-r8, lr} mov r6, r0 // arg table @@ -96,7 +96,7 @@ _armFuncObjLast: ldrge r0, [r6],#4 cmp r7, #2*4 ldrge r1, [r6],#4 - ldrlt r1, [sp] + ldrlt r1, [sp] cmp r7, #3*4 ldrge r2, [r6],#4 ldrlt r2, [sp] diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_mips.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_mips.cpp index c9c9ff8..6798860 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_mips.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_mips.cpp @@ -286,9 +286,9 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) int intArgs = 0; for( size_t a = 0; a < descr->parameterTypes.GetLength(); a++ ) { - if (descr->parameterTypes[a].IsFloatType()) + if (descr->parameterTypes[a].IsFloatType()) hostFlags |= argBit; - else + else intArgs++; argBit <<= 1; } diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc.cpp index b846790..1cacac2 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc.cpp @@ -77,7 +77,7 @@ extern "C" static asBYTE ppcArgsType[2*AS_PPC_MAX_ARGS + 1 + 1 + 1]; } -// NOTE: these values are for PowerPC 32 bit. +// NOTE: these values are for PowerPC 32 bit. #define PPC_LINKAGE_SIZE (24) // how big the PPC linkage area is in a stack frame #define PPC_NUM_REGSTORE (9) // how many registers of the PPC we need to store/restore for ppcFunc() #define PPC_REGSTORE_SIZE (4*PPC_NUM_REGSTORE) // how many bytes are required for register store/restore @@ -95,13 +95,13 @@ asm(" .text\n" "_ppcFunc:\n" // We're receiving the following parameters - + // r3 : argsPtr // r4 : StackArgSize // r5 : func // The following registers are used through out the function - + // r31 : the address of the label address, as reference for all other labels // r30 : temporary variable // r29 : arg list pointer @@ -116,20 +116,20 @@ asm(" .text\n" // f0 : temporary variable // We need to store some of the registers for restoral before returning to caller - + // lr - always stored in 8(r1) - this is the return address - // cr - not required to be stored, but if it is, its place is in 4(r1) - this is the condition register + // cr - not required to be stored, but if it is, its place is in 4(r1) - this is the condition register // r1 - always stored in 0(r1) - this is the stack pointer - // r11 - // r13 to r31 + // r11 + // r13 to r31 // f14 to f31 // Store register values and setup our stack frame " mflr r0 \n" // move the return address into r0 " stw r0, 8(r1) \n" // Store the return address on the stack " stmw r23, -36(r1) \n" // Store registers r23 to r31 on the stack - " stwux r1, r1, r4 \n" // Increase the stack with the needed space and store the original value in the destination - + " stwux r1, r1, r4 \n" // Increase the stack with the needed space and store the original value in the destination + // Obtain an address that we'll use as our position of reference when obtaining addresses of other labels " bl address \n" "address: \n" @@ -142,7 +142,7 @@ asm(" .text\n" " sub r0, r0, r0 \n" // zero out r0 " mr r23, r0 \n" // zero out r23, which holds the number of used GPR registers " mr r28, r0 \n" // zero our r22, which holds the number of used float registers - + // load the global ppcArgsType which holds the types of arguments for each argument " addis r25, r31, ha16(_ppcArgsType - address) \n" // load the upper 16 bits of the address to r25 " la r25, lo16(_ppcArgsType - address)(r25) \n" // load the lower 16 bits of the address to r25 @@ -156,26 +156,26 @@ asm(" .text\n" " mulli r24, r24, 4 \n" // our jump table has 4 bytes per case (1 instruction) " addis r30, r31, ha16(ppcTypeSwitch - address) \n" // load the address of the jump table for the switch " la r30, lo16(ppcTypeSwitch - address)(r30) \n" - + " add r0, r30, r24 \n" // offset by our argument type " mtctr r0 \n" // load the jump address into CTR " bctr \n" // jump into the jump table/switch " nop \n" - + // the jump table/switch based on the current argument type "ppcTypeSwitch: \n" " b ppcArgsEnd \n" " b ppcArgIsInteger \n" " b ppcArgIsFloat \n" " b ppcArgIsDouble \n" - + // when we get here we have finished processing all the arguments // everything is ready to go to call the function "ppcArgsEnd: \n" " mtctr r27 \n" // the function pointer is stored in r27, load that into CTR " bctrl \n" // call the function. We have to do it this way so that the LR gets the proper " nop \n" // return value (the next instruction below). So we have to branch from CTR instead of LR. - + // Restore registers and caller's stack frame, then return to caller " lwz r1, 0(r1) \n" // restore the caller's stack pointer " lwz r0, 8(r1) \n" // load in the caller's LR @@ -183,7 +183,7 @@ asm(" .text\n" " lmw r23, -36(r1) \n" // restore registers r23 to r31 from the stack " blr \n" // return back to the caller " nop \n" - + // Integer argument (GPR register) "ppcArgIsInteger: \n" " addis r30, r31, ha16(ppcLoadIntReg - address) \n" // load the address to the jump table for integer registers @@ -272,7 +272,7 @@ asm(" .text\n" " addi r26, r26, 4 \n" // move to the next stack slot " b ppcNextArg \n" // on to the next argument " nop \n" - + // double Float argument "ppcArgIsDouble: \n" " addis r30, r31, ha16(ppcLoadDoubleReg - address) \n" // load the base address of the jump table for double registers @@ -447,7 +447,7 @@ static asQWORD CallThisCallFunction(const void *obj, const asDWORD* pArgs, const } // This function is identical to CallCDeclFunction, with the only difference that -// the value in the last parameter is the object +// the value in the last parameter is the object // NOTE: on PPC the order for the args is reversed static asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory) { @@ -502,7 +502,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) void *func = (void*)sysFunc->func; int paramSize = sysFunc->paramSize; int popSize = paramSize; - asDWORD *args = context->regs.stackPointer; + asDWORD *args = context->regs.stackPointer; void *obj = NULL; asDWORD *vftable = NULL; void *retObjPointer = NULL; // for system functions that return AngelScript objects @@ -511,7 +511,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) // convert the parameters that are < 4 bytes from little endian to big endian int argDwordOffset = 0; - + // if this is a THISCALL function and no object pointer was given, then the // first argument on the stack is the object pointer -- we MUST skip it for doing // the endian flipping. @@ -519,7 +519,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) { ++argDwordOffset; } - + for( a = 0; a < (int)descr->parameterTypes.GetLength(); a++ ) { int numBytes = descr->parameterTypes[a].GetSizeInMemoryBytes(); @@ -564,7 +564,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) { // Allocate the memory for the object retObjPointer = engine->CallAlloc( descr->returnType.GetObjectType() ); - + if( sysFunc->hostReturnInMemory ) { // The return is made in memory on the host system @@ -678,7 +678,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) // Keep a free location at the beginning args = ¶mBuffer[1]; } - + // one last verification to make sure things are how we expect asASSERT( (retInMemPointer!=NULL && sysFunc->hostReturnInMemory) || (retInMemPointer==NULL && !sysFunc->hostReturnInMemory) ); context->isCallingSystemFunction = true; @@ -753,7 +753,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) // Since we're treating the system function as if it is returning a QWORD we are // actually receiving the value in the high DWORD of retQW. retQW >>= 32; - + // returning an object handle context->regs.objectRegister = (void*)(asDWORD)retQW; @@ -781,8 +781,8 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) // Since we're treating the system function as if it is returning a QWORD we are // actually receiving the value in the high DWORD of retQW. retQW >>= 32; - - *(asDWORD*)retObjPointer = (asDWORD)retQW; + + *(asDWORD*)retObjPointer = (asDWORD)retQW; } else { @@ -822,7 +822,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) else if( sysFunc->hostReturnSize == 1 ) { // <= 32 bit primitives - + // Since we're treating the system function as if it is returning a QWORD we are // actually receiving the value in the high DWORD of retQW. retQW >>= 32; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc_64.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc_64.cpp index c8b6fb0..6958752 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc_64.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_ppc_64.cpp @@ -52,8 +52,8 @@ BEGIN_AS_NAMESPACE -// This part was written and tested by Jeff Slutter -// from Reactor Zero, Abril, 2007, for PlayStation 3, which +// This part was written and tested by Jeff Slutter +// from Reactor Zero, Abril, 2007, for PlayStation 3, which // is a PowerPC 64bit based architecture. Even though it is // 64bit it seems the pointer size is still 32bit. @@ -125,7 +125,7 @@ asm("" "sub %r0,%r0,%r0\n" // zero out r0 "mr %r23,%r0\n" // zero out r23, which holds the number of used GPR registers "mr %r22,%r0\n" // zero our r22, which holds the number of used float registers - + // load the global ppcArgsType which holds the types of arguments for each argument "lis %r25, ppcArgsType@ha\n" // load the upper 16 bits of the address to r25 "addi %r25, %r25, ppcArgsType@l\n" // load the lower 16 bits of the address to r25 @@ -493,7 +493,7 @@ static asQWORD CallThisCallFunction(const void *obj, const asDWORD* pArgs, const } // This function is identical to CallCDeclFunction, with the only difference that -// the value in the last parameter is the object +// the value in the last parameter is the object // NOTE: on PPC the order for the args is reversed static asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD* pArgs, const asBYTE *pArgsType, int argSize, asDWORD func, void *retInMemory) { @@ -637,7 +637,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) { // Allocate the memory for the object retObjPointer = engine->CallAlloc( descr->returnType.GetObjectType() ); - + if( sysFunc->hostReturnInMemory ) { // The return is made in memory on the host system @@ -764,7 +764,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) // Keep a free location at the beginning args = ¶mBuffer[1]; } - + // one last verification to make sure things are how we expect assert( (retInMemPointer!=NULL && sysFunc->hostReturnInMemory) || (retInMemPointer==NULL && !sysFunc->hostReturnInMemory) ); context->isCallingSystemFunction = true; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_sh4.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_sh4.cpp index f838278..c9ce4ba 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_sh4.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_callfunc_sh4.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -215,7 +215,7 @@ asQWORD CallThisCallFunction(const void *obj, const asDWORD *args, int argSize, int restArgs = 0; sh4Args[0] = (asDWORD) obj; - + // put the arguments in the correct places in the sh4Args array if (argNum >= 1) splitArgs(args, argNum, intArgs, floatArgs, restArgs, flags); @@ -244,7 +244,7 @@ asQWORD CallThisCallFunction_objLast(const void *obj, const asDWORD *args, int a sh4Args[4 + 8 + restArgs] = (asDWORD) obj; restArgs++; } - + return sh4Func(intArgs << 2, floatArgs << 2, restArgs << 2, func); } @@ -317,7 +317,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) // Check for null pointer obj = (void*)*(args + paramSize); if( obj == 0 ) - { + { context->SetInternalException(TXT_NULL_POINTER_ACCESS); if( retPointer ) engine->CallFree(retPointer); @@ -425,7 +425,7 @@ int CallSystemFunction(int id, asCContext *context, void *objectPointer) int spos = 0; for( int n = 0; n < descr->parameterTypes.GetLength(); n++ ) { - if( descr->parameterTypes[n].IsObject() && + if( descr->parameterTypes[n].IsObject() && !descr->parameterTypes[n].IsReference() && (descr->parameterTypes[n].GetObjectType()->flags & COMPLEX_MASK) ) { diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_compiler.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_compiler.cpp index 673252d..dd696c5 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_compiler.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_compiler.cpp @@ -429,7 +429,7 @@ int asCCompiler::CompileFunction(asCBuilder *builder, asCScriptCode *script, asC } // If there are compile errors, there is no reason to build the final code - if( hasCompileErrors || builder->numErrors != buildErrors ) + if( hasCompileErrors || builder->numErrors != buildErrors ) { // Clear the accessed global properties, so they are not prematurely released outFunc->globalVarPointers.SetLength(0); @@ -1228,7 +1228,7 @@ void asCCompiler::MoveArgsToStack(int funcID, asCByteCode *bc, asCArrayparameterTypes[n].GetTokenType() == ttQuestion && args[n]->type.dataType.IsObject() && !args[n]->type.dataType.IsObjectHandle() ) { - // Send the object as a reference to the object, + // Send the object as a reference to the object, // and not to the variable holding the object bc->InstrWORD(asBC_GETOBJREF, (asWORD)offset); } @@ -1398,7 +1398,7 @@ void asCCompiler::MatchFunctions(asCArray &funcs, asCArray { str.Format(TXT_MULTIPLE_MATCHING_SIGNATURES_TO_s, str.AddressOf()); Error(str.AddressOf(), node); - + PrintMatchingFuncs(funcs, node); } } @@ -2674,8 +2674,8 @@ void asCCompiler::CompileReturnStatement(asCScriptNode *rnode, asCByteCode *bc) // LOADOBJ cleared the address in the variable so the object will not be freed // here, but the temporary variable must still be freed - // TODO: optimize: Since there is nothing in the variable anymore, - // there is no need to call asBC_FREE on it. + // TODO: optimize: Since there is nothing in the variable anymore, + // there is no need to call asBC_FREE on it. } // Release temporary variables used by expression @@ -4705,8 +4705,8 @@ int asCCompiler::DoAssignment(asSExprContext *ctx, asSExprContext *lctx, asSExpr { if( op != ttAssignment ) { - // TODO: getset: We may actually be able to support this, if we can - // guarantee that the object reference will stay valid + // TODO: getset: We may actually be able to support this, if we can + // guarantee that the object reference will stay valid // between the calls to the get and set accessors. // Compound assignments are not allowed for properties @@ -5769,7 +5769,7 @@ asUINT asCCompiler::ProcessStringConstant(asCString &cstr, asCScriptNode *node, return charLiteral; } - // TODO: Consider deprecating use of hexadecimal escape sequences, + // TODO: Consider deprecating use of hexadecimal escape sequences, // as they do not guarantee proper unicode sequences if( cstr[n] == 'x' || cstr[n] == 'X' ) { @@ -6908,13 +6908,13 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx if( getId || setId ) { - // Property accessors were found, but we don't know which is to be used yet, so + // Property accessors were found, but we don't know which is to be used yet, so // we just prepare the bytecode for the method call, and then store the function ids // so that the right one can be used when we get there. ctx->property_get = getId; ctx->property_set = setId; - // If the object is read-only then we need to remember + // If the object is read-only then we need to remember if( (!ctx->type.dataType.IsObjectHandle() && ctx->type.dataType.IsReadOnly()) || (ctx->type.dataType.IsObjectHandle() && ctx->type.dataType.IsHandleToConst()) ) ctx->property_const = true; @@ -6930,7 +6930,7 @@ int asCCompiler::FindPropertyAccessor(const asCString &name, asSExprContext *ctx else dt = engine->scriptFunctions[setId]->parameterTypes[0]; - // Just change the type, the context must still maintain information + // Just change the type, the context must still maintain information // about previous variable offset and the indicator of temporary variable. int offset = ctx->type.stackOffset; bool isTemp = ctx->type.isTemporary; @@ -7150,7 +7150,7 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct int r = FindPropertyAccessor(name, ctx, node); if( r != 0 ) return r; - + if( !ctx->type.dataType.IsPrimitive() ) Dereference(ctx, true); @@ -7229,7 +7229,7 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct Error(str.AddressOf(), node); return -1; } - + // Process the get property accessor ProcessPropertyGetAccessor(ctx, node); @@ -7246,7 +7246,7 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct // Compile function call CompileFunctionCall(node->firstChild, ctx, trueObj, isConst); - // If the method returned a reference, then we can't release the original + // If the method returned a reference, then we can't release the original // object yet, because the reference may be to a member of it if( objType.isTemporary && (ctx->type.dataType.IsReference() || (ctx->type.dataType.IsObject() && !ctx->type.dataType.IsObjectHandle())) && @@ -7385,7 +7385,7 @@ int asCCompiler::CompileExpressionPostOp(asCScriptNode *node, asSExprContext *ct } } - // If the method returned a reference, then we can't release the original + // If the method returned a reference, then we can't release the original // object yet, because the reference may be to a member of it if( objType.isTemporary && (ctx->type.dataType.IsReference() || (ctx->type.dataType.IsObject() && !ctx->type.dataType.IsObjectHandle())) && @@ -7614,8 +7614,8 @@ bool asCCompiler::CompileOverloadedDualOperator(asCScriptNode *node, asSExprCont int token = node->tokenType; if( token == ttUnrecognizedToken ) { - // This happens when the compiler is inferring an assignment - // operation from another action, for example in preparing a value + // This happens when the compiler is inferring an assignment + // operation from another action, for example in preparing a value // as a function argument token = ttAssignment; } @@ -7631,7 +7631,7 @@ bool asCCompiler::CompileOverloadedDualOperator(asCScriptNode *node, asSExprCont token == ttNotEqual ) { // TODO: Should evaluate which of the two have the best match. If both have equal match, the first version should be used - // Find the matching opEquals method + // Find the matching opEquals method int r = CompileOverloadedDualOperator2(node, "opEquals", lctx, rctx, ctx, true, asCDataType::CreatePrimitive(ttBool, false)); if( r == 0 ) { @@ -7803,7 +7803,7 @@ bool asCCompiler::CompileOverloadedDualOperator(asCScriptNode *node, asSExprCont // one on matching operator int asCCompiler::CompileOverloadedDualOperator2(asCScriptNode *node, const char *methodName, asSExprContext *lctx, asSExprContext *rctx, asSExprContext *ctx, bool specificReturn, const asCDataType &returnType) { - // Find the matching method + // Find the matching method if( lctx->type.dataType.IsObject() && !lctx->type.isExplicitHandle ) { // Is the left value a const? @@ -7848,7 +7848,7 @@ int asCCompiler::CompileOverloadedDualOperator2(asCScriptNode *node, const char ctx->type = lctx->type; MakeFunctionCall(ctx, ops[0], objType.dataType.GetObjectType(), args, node); - // TODO: Can we do this here? + // TODO: Can we do this here? ReleaseTemporaryVariable(objType, &ctx->bc); // Found matching operator @@ -7876,12 +7876,12 @@ void asCCompiler::MakeFunctionCall(asSExprContext *ctx, int funcId, asCObjectTyp { Dereference(ctx, true); - // Warn if the method is non-const and the object is temporary + // Warn if the method is non-const and the object is temporary // since the changes will be lost when the object is destroyed. // If the object is accessed through a handle, then it is assumed // the object is not temporary, even though the handle is. - if( ctx->type.isTemporary && - !ctx->type.dataType.IsObjectHandle() && + if( ctx->type.isTemporary && + !ctx->type.dataType.IsObjectHandle() && !engine->scriptFunctions[funcId]->isReadOnly ) { Warning(TXT_CALLING_NONCONST_METHOD_ON_TEMP, node); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_compiler.h b/Libraries/AngelScript/sdk/angelscript/source/as_compiler.h index e6057f8..50dc7c4 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_compiler.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_compiler.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_config.h b/Libraries/AngelScript/sdk/angelscript/source/as_config.h index 1e69d46..bf32344 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_config.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_config.h @@ -78,9 +78,9 @@ // AS_DOUBLEBYTE_CHARSET // When this flag is defined, the parser will treat all characters in strings // that are greater than 127 as lead characters and automatically include the -// next character in the script without checking its value. This should be -// compatible with common encoding schemes, e.g. Big5. Shift-JIS is not compatible -// though as it encodes some single byte characters above 127. +// next character in the script without checking its value. This should be +// compatible with common encoding schemes, e.g. Big5. Shift-JIS is not compatible +// though as it encodes some single byte characters above 127. // // If support for international text is desired, it is recommended that UTF-8 // is used as this is supported natively by the compiler without the use for this @@ -112,7 +112,7 @@ //----------------------------------------- // asVSNPRINTF(a,b,c,d) -// Some compilers use different names for this function. You must +// Some compilers use different names for this function. You must // define this macro to map to the proper function. // ASM_AT_N_T or ASM_INTEL @@ -191,7 +191,7 @@ // Use assembler code for the ARM CPU family // AS_64BIT_PTR -// Define this to make the engine store all pointers in 64bit words. +// Define this to make the engine store all pointers in 64bit words. // AS_BIG_ENDIAN // Define this for CPUs that use big endian memory layout, e.g. PPC @@ -284,7 +284,7 @@ // SPLIT_OBJS_BY_MEMBER_TYPES // On some platforms objects with primitive members are split over different -// register types when passed by value to functions. +// register types when passed by value to functions. @@ -489,7 +489,7 @@ #define AS_MAX_PORTABILITY #endif #define AS_POSIX_THREADS - + // Windows #elif defined(WIN32) // On Windows the simple classes are returned in the EAX:EDX registers diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.cpp index 0d745d2..a366a12 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -185,7 +185,7 @@ void asCConfigGroup::ValidateNoUsage(asCScriptEngine *engine, asCObjectType *typ } } - // TODO: Check also usage of the type in global variables + // TODO: Check also usage of the type in global variables // TODO: Check also usage of the type in local variables in script functions @@ -225,7 +225,7 @@ bool asCConfigGroup::HasModuleAccess(const char *module) asSMapNode *cursor = 0; if( moduleAccess.MoveTo(&cursor, mod) ) return moduleAccess.GetValue(cursor); - + return defaultAccess; } diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.h b/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.h index 4f9abe2..304e233 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_configgroup.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_context.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_context.cpp index 6d9691c..33482da 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_context.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_context.cpp @@ -80,7 +80,7 @@ class asCDebugStats ~asCDebugStats() { /* - // This code writes out some statistics for the VM. + // This code writes out some statistics for the VM. // It's useful for determining what needs to be optimized. _mkdir("AS_DEBUG"); @@ -390,7 +390,7 @@ int asCContext::Unprepare() stringFunction = 0; } #endif - + return 0; } @@ -511,7 +511,7 @@ void *asCContext::GetAddressOfReturnValue() // An object is stored in the objectRegister if( !dt->IsReference() && dt->IsObject() ) { - // Need to dereference objects + // Need to dereference objects if( !dt->IsObjectHandle() ) return *(void**)®s.objectRegister; return ®s.objectRegister; @@ -827,7 +827,7 @@ int asCContext::SetArgObject(asUINT arg, void *obj) if( obj && beh->addref ) engine->CallObjectMethod(obj, beh->addref); } - else + else { obj = engine->CreateScriptObjectCopy(obj, engine->GetTypeIdFromDataType(*dt)); } @@ -867,8 +867,8 @@ void *asCContext::GetAddressOfArg(asUINT arg) // We should return the address of the location where the argument value will be placed - // All registered types are always sent by reference, even if - // the function is declared to receive the argument by value. + // All registered types are always sent by reference, even if + // the function is declared to receive the argument by value. return ®s.stackFramePointer[offset]; } @@ -893,7 +893,7 @@ int asCContext::Abort() // interface int asCContext::Suspend() { - // This function just sets some internal flags and is safe + // This function just sets some internal flags and is safe // to call from a secondary thread, even if the library has // been built without multi-thread support. @@ -988,7 +988,7 @@ int asCContext::Execute() // Call the function directly CallSystemFunction(currentFunction->id, this, 0); - + // Was the call successful? if( status == asEXECUTION_ACTIVE ) { @@ -1192,7 +1192,7 @@ void asCContext::CallScriptFunction(asCScriptFunction *func) } regs.stackPointer = stackBlocks[stackIndex] + (stackBlockSize<GetSpaceNeededForArguments(); - } + } // Copy the function arguments to the new stack space memcpy(regs.stackPointer, oldStackPointer, sizeof(asDWORD)*func->GetSpaceNeededForArguments()); @@ -1221,12 +1221,12 @@ void asCContext::CallInterfaceMethod(asCScriptFunction *func) asCObjectType *objType = obj->objType; - // TODO: optimize: The object type should have a list of only those methods that + // TODO: optimize: The object type should have a list of only those methods that // implement interface methods. This list should be ordered by // the signatureId so that a binary search can be made, instead // of a linear search. // - // When this is done, we must also make sure the signatureId of a + // When this is done, we must also make sure the signatureId of a // function never changes, e.g. when if the signature functions are // released. @@ -1367,7 +1367,7 @@ void asCContext::ExecuteNext() l_bc++; break; - // Load the address of a global variable in the register, then + // Load the address of a global variable in the register, then // copy the value of the global variable into a local variable case asBC_LdGRdR4: // TODO: global: The global var address should be stored in the instruction directly @@ -2222,7 +2222,7 @@ void asCContext::ExecuteNext() // Pop address of destination pointer from the stack void **d = (void**)*(size_t*)l_sp; l_sp += AS_PTR_SIZE; - + // Read wanted pointer from the stack void *s = (void*)*(size_t*)l_sp; @@ -2883,7 +2883,7 @@ void asCContext::ExecuteNext() } else { - // The object register should already be null, so there + // The object register should already be null, so there // is no need to clear it if the cast is unsuccessful asASSERT( regs.objectRegister == 0 ); } @@ -2934,7 +2934,7 @@ void asCContext::ExecuteNext() break; case asBC_u64TOf: -#if _MSC_VER <= 1200 // MSVC6 +#if _MSC_VER <= 1200 // MSVC6 { // MSVC6 doesn't permit UINT64 to double asINT64 v = *(asINT64*)(l_fp - asBC_SWORDARG1(l_bc)); @@ -2955,7 +2955,7 @@ void asCContext::ExecuteNext() break; case asBC_u64TOd: -#if _MSC_VER <= 1200 // MSVC6 +#if _MSC_VER <= 1200 // MSVC6 { // MSVC6 doesn't permit UINT64 to double asINT64 v = *(asINT64*)(l_fp - asBC_SWORDARG0(l_bc)); @@ -3146,7 +3146,7 @@ void asCContext::ExecuteNext() // TODO: JIT: We should return from this function if the jitFunction tells us to (currentFunction->jitFunction)(®s, jitOffset-1); - + l_bc = regs.programPointer; l_sp = regs.stackPointer; l_fp = regs.stackFramePointer; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_criticalsection.h b/Libraries/AngelScript/sdk/angelscript/source/as_criticalsection.h index 8ceb03e..d538dfd 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_criticalsection.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_criticalsection.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2008 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -45,9 +45,9 @@ BEGIN_AS_NAMESPACE #ifdef AS_NO_THREADS -#define DECLARECRITICALSECTION(x) -#define ENTERCRITICALSECTION(x) -#define LEAVECRITICALSECTION(x) +#define DECLARECRITICALSECTION(x) +#define ENTERCRITICALSECTION(x) +#define LEAVECRITICALSECTION(x) #else diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_datatype.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_datatype.cpp index 2aa95e2..4860960 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_datatype.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_datatype.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -204,11 +204,11 @@ int asCDataType::MakeHandle(bool b, bool acceptHandleForScope) } else if( b && !isObjectHandle ) { - // Only reference types are allowed to be handles, + // Only reference types are allowed to be handles, // but not nohandle reference types, and not scoped references (except when returned from registered function) - if( !objectType || - !((objectType->flags & asOBJ_REF) || (objectType->flags & asOBJ_TEMPLATE_SUBTYPE)) || - (objectType->flags & asOBJ_NOHANDLE) || + if( !objectType || + !((objectType->flags & asOBJ_REF) || (objectType->flags & asOBJ_TEMPLATE_SUBTYPE)) || + (objectType->flags & asOBJ_NOHANDLE) || ((objectType->flags & asOBJ_SCOPED) && !acceptHandleForScope) ) return -1; @@ -228,7 +228,7 @@ int asCDataType::MakeArray(asCScriptEngine *engine) isObjectHandle = false; isConstHandle = false; - + objectType = at; tokenType = ttIdentifier; @@ -265,7 +265,7 @@ int asCDataType::MakeHandleToConst(bool b) bool asCDataType::SupportHandles() const { if( objectType && - (objectType->flags & asOBJ_REF) && + (objectType->flags & asOBJ_REF) && !(objectType->flags & asOBJ_NOHANDLE) && !isObjectHandle ) return true; @@ -276,7 +276,7 @@ bool asCDataType::SupportHandles() const bool asCDataType::CanBeInstanciated() const { if( GetSizeOnStackDWords() == 0 || - (IsObject() && + (IsObject() && (objectType->flags & asOBJ_REF) && // It's a ref type and ((objectType->flags & asOBJ_NOHANDLE) || // the ref type doesn't support handles or (!IsObjectHandle() && // it's not a handle and @@ -430,7 +430,7 @@ bool asCDataType::IsPrimitive() const bool asCDataType::IsSamePrimitiveBaseType(const asCDataType &dt) const { if( !IsPrimitive() || !dt.IsPrimitive() ) return false; - + if( IsIntegerType() && dt.IsIntegerType() ) return true; if( IsUnsignedType() && dt.IsUnsignedType() ) return true; if( IsFloatType() && dt.IsFloatType() ) return true; @@ -535,7 +535,7 @@ int asCDataType::GetSizeInMemoryDWords() const int s = GetSizeInMemoryBytes(); if( s == 0 ) return 0; if( s <= 4 ) return 1; - + return s/4; } @@ -550,8 +550,8 @@ int asCDataType::GetSizeOnStackDWords() const } asSTypeBehaviour *asCDataType::GetBehaviour() const -{ - return objectType ? &objectType->beh : 0; +{ + return objectType ? &objectType->beh : 0; } bool asCDataType::IsEnumType() const diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_datatype.h b/Libraries/AngelScript/sdk/angelscript/source/as_datatype.h index ef4ee1f..67dcba7 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_datatype.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_datatype.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -75,7 +75,7 @@ class asCDataType bool IsPrimitive() const; bool IsObject() const; bool IsReference() const {return isReference;} - bool IsReadOnly() const; + bool IsReadOnly() const; bool IsIntegerType() const; bool IsUnsignedType() const; bool IsFloatType() const; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_debug.h b/Libraries/AngelScript/sdk/angelscript/source/as_debug.h index 744749f..bc68cd3 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_debug.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_debug.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -43,7 +43,7 @@ // Neither does WinCE -#if defined(__GNUC__) +#if defined(__GNUC__) // Define mkdir for GNUC #include #include diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_gc.h b/Libraries/AngelScript/sdk/angelscript/source/as_gc.h index ca9bb3c..4479201 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_gc.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_gc.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -100,7 +100,7 @@ class asCGarbageCollector // This array temporarily holds references to objects known to be live objects asCArray liveObjects; - // This map holds objects currently being searched for cyclic references, it also holds a + // This map holds objects currently being searched for cyclic references, it also holds a // counter that gives the number of references to the object that the GC can't reach asCMap gcMap; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_generic.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_generic.cpp index 20a6b19..a1612b6 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_generic.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_generic.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -42,7 +42,7 @@ BEGIN_AS_NAMESPACE -// TODO: optimize: The access to the arguments should be optimized so that code +// TODO: optimize: The access to the arguments should be optimized so that code // doesn't have to count the position of the argument with every call // internal @@ -52,7 +52,7 @@ asCGeneric::asCGeneric(asCScriptEngine *engine, asCScriptFunction *sysFunction, this->sysFunction = sysFunction; this->currentObject = currentObject; this->stackPointer = stackPointer; - + objectRegister = 0; returnVal = 0; } @@ -283,8 +283,8 @@ void *asCGeneric::GetAddressOfArg(asUINT arg) offset += sysFunction->parameterTypes[n].GetSizeOnStackDWords(); // For object variables it's necessary to dereference the pointer to get the address of the value - if( !sysFunction->parameterTypes[arg].IsReference() && - sysFunction->parameterTypes[arg].IsObject() && + if( !sysFunction->parameterTypes[arg].IsReference() && + sysFunction->parameterTypes[arg].IsObject() && !sysFunction->parameterTypes[arg].IsObjectHandle() ) return *(void**)&stackPointer[offset]; @@ -481,7 +481,7 @@ void *asCGeneric::GetAddressOfReturnLocation() { if( dt.GetObjectType()->flags & asOBJ_VALUE ) { - // Allocate the necessary memory for this object, + // Allocate the necessary memory for this object, // but do not initialize it, as the caller will do that. objectRegister = engine->CallAlloc(dt.GetObjectType()); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_generic.h b/Libraries/AngelScript/sdk/angelscript/source/as_generic.h index b158a8a..3649f77 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_generic.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_generic.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_globalproperty.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_globalproperty.cpp index 303438e..e8d7ba8 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_globalproperty.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_globalproperty.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -36,19 +36,19 @@ BEGIN_AS_NAMESPACE -asCGlobalProperty::asCGlobalProperty() -{ - memory = 0; - memoryAllocated = false; - realAddress = 0; - initFunc = 0; +asCGlobalProperty::asCGlobalProperty() +{ + memory = 0; + memoryAllocated = false; + realAddress = 0; + initFunc = 0; refCount.set(1); } asCGlobalProperty::~asCGlobalProperty() -{ - if( memoryAllocated ) { asDELETEARRAY(memory); } +{ + if( memoryAllocated ) { asDELETEARRAY(memory); } if( initFunc ) initFunc->Release(); } @@ -60,7 +60,7 @@ void asCGlobalProperty::AddRef() void asCGlobalProperty::Release() { - // The property doesn't delete itself. The + // The property doesn't delete itself. The // engine will do that at a later time if( refCount.atomicDec() == 1 && initFunc ) { @@ -74,33 +74,33 @@ void asCGlobalProperty::Release() } void *asCGlobalProperty::GetAddressOfValue() -{ - return (memoryAllocated || realAddress) ? memory : &storage; +{ + return (memoryAllocated || realAddress) ? memory : &storage; } // The global property structure is responsible for allocating the storage // method for script declared variables. Each allocation is independent of // other global properties, so that variables can be added and removed at // any time. -void asCGlobalProperty::AllocateMemory() -{ - if( type.GetSizeOnStackDWords() > 2 ) - { - memory = asNEWARRAY(asDWORD, type.GetSizeOnStackDWords()); - memoryAllocated = true; - } +void asCGlobalProperty::AllocateMemory() +{ + if( type.GetSizeOnStackDWords() > 2 ) + { + memory = asNEWARRAY(asDWORD, type.GetSizeOnStackDWords()); + memoryAllocated = true; + } } -void asCGlobalProperty::SetRegisteredAddress(void *p) -{ - realAddress = p; +void asCGlobalProperty::SetRegisteredAddress(void *p) +{ + realAddress = p; if( type.IsObject() && !type.IsReference() && !type.IsObjectHandle() ) { - // The global property is a pointer to a pointer + // The global property is a pointer to a pointer memory = &realAddress; - } + } else - memory = p; + memory = p; } diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_map.h b/Libraries/AngelScript/sdk/angelscript/source/as_map.h index 4231d4c..729bdb3 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_map.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_map.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -49,7 +49,7 @@ template class asCMap int Insert(const KEY &key, const VAL &value); int GetCount(); - + const KEY &GetKey(const asSMapNode *cursor) const; const VAL &GetValue(const asSMapNode *cursor) const; VAL &GetValue(asSMapNode *cursor); @@ -205,7 +205,7 @@ void asCMap::BalanceInsert(asSMapNode *node) // The node, that is red, can't have a red parent while( node != root && node->parent->isRed ) { - // Check color of uncle + // Check color of uncle if( node->parent == node->parent->parent->left ) { asSMapNode *uncle = node->parent->parent->right; @@ -229,7 +229,7 @@ void asCMap::BalanceInsert(asSMapNode *node) // R B // N - if( node == node->parent->right ) + if( node == node->parent->right ) { // Make the node a left child node = node->parent; @@ -265,13 +265,13 @@ void asCMap::BalanceInsert(asSMapNode *node) // B R // N - if( node == node->parent->left ) + if( node == node->parent->left ) { // Make the node a right child node = node->parent; RotateRight(node); } - + // Change color on parent and grand parent // Then rotate grand parent to the right node->parent->isRed = false; @@ -288,9 +288,9 @@ void asCMap::BalanceInsert(asSMapNode *node) template int asCMap::CheckIntegrity(asSMapNode *node) { - if( node == 0 ) + if( node == 0 ) { - if( root == 0 ) + if( root == 0 ) return 0; else if( ISRED(root) ) return -1; @@ -304,9 +304,9 @@ int asCMap::CheckIntegrity(asSMapNode *node) if( node->right ) right = CheckIntegrity(node->right); - if( left != right || left == -1 ) + if( left != right || left == -1 ) return -1; - + if( ISBLACK(node) ) return left+1; @@ -327,7 +327,7 @@ bool asCMap::MoveTo(asSMapNode **out, const KEY &key) *out = p; return true; } - else + else p = p->right; } @@ -396,7 +396,7 @@ void asCMap::Erase(asSMapNode *cursor) remove->left = node->left; if( remove->left ) remove->left->parent = remove; remove->right = node->right; - if( remove->right ) remove->right->parent = remove; + if( remove->right ) remove->right->parent = remove; } typedef asSMapNode node_t; @@ -411,7 +411,7 @@ template void asCMap::BalanceErase(asSMapNode *child, asSMapNode *parent) { // If child is red - // Color child black + // Color child black // Terminate // These tests assume brother is to the right. @@ -490,7 +490,7 @@ void asCMap::BalanceErase(asSMapNode *child, asSMapNode *brother = parent->left; - + // Case 1 if( ISRED(brother) ) { @@ -624,9 +624,9 @@ int asCMap::RotateLeft(asSMapNode *node) } template -const VAL &asCMap::GetValue(const asSMapNode *cursor) const +const VAL &asCMap::GetValue(const asSMapNode *cursor) const { - if( cursor == 0 ) + if( cursor == 0 ) return dummy.value; return cursor->value; @@ -635,7 +635,7 @@ const VAL &asCMap::GetValue(const asSMapNode *cursor) const template VAL &asCMap::GetValue(asSMapNode *cursor) { - if( cursor == 0 ) + if( cursor == 0 ) return dummy.value; return cursor->value; @@ -656,7 +656,7 @@ bool asCMap::MoveFirst(asSMapNode **out) *out = root; if( root == 0 ) return false; - while( (*out)->left ) + while( (*out)->left ) *out = (*out)->left; return true; @@ -668,7 +668,7 @@ bool asCMap::MoveLast(asSMapNode **out) *out = root; if( root == 0 ) return false; - while( (*out)->right ) + while( (*out)->right ) *out = (*out)->right; return true; @@ -683,7 +683,7 @@ bool asCMap::MoveNext(asSMapNode **out, asSMapNode * return false; } - if( cursor->right == 0 ) + if( cursor->right == 0 ) { // Move upwards until we find a parent node to the right while( cursor->parent && cursor->parent->right == cursor ) @@ -691,14 +691,14 @@ bool asCMap::MoveNext(asSMapNode **out, asSMapNode * cursor = cursor->parent; *out = cursor; - if( cursor == 0 ) + if( cursor == 0 ) return false; return true; } cursor = cursor->right; - while( cursor->left ) + while( cursor->left ) cursor = cursor->left; *out = cursor; @@ -708,7 +708,7 @@ bool asCMap::MoveNext(asSMapNode **out, asSMapNode * template bool asCMap::MovePrev(asSMapNode **out, asSMapNode *cursor) { - if( cursor == 0 ) + if( cursor == 0 ) { *out = 0; return false; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_memory.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_memory.cpp index 6471a98..a454f69 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_memory.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_memory.cpp @@ -83,7 +83,7 @@ asCMemoryMgr::~asCMemoryMgr() void asCMemoryMgr::FreeUnusedMemory() { - // It's necessary to protect the scriptNodePool from multiple + // It's necessary to protect the scriptNodePool from multiple // simultaneous accesses, as the parser is used by several methods // that can be executed simultaneously. ENTERCRITICALSECTION(cs); @@ -95,8 +95,8 @@ void asCMemoryMgr::FreeUnusedMemory() LEAVECRITICALSECTION(cs); - // The engine already protects against multiple threads - // compiling scripts simultaneously so this pool doesn't have + // The engine already protects against multiple threads + // compiling scripts simultaneously so this pool doesn't have // to be protected again. for( n = 0; n < (signed)byteInstructionPool.GetLength(); n++ ) userFree(byteInstructionPool[n]); @@ -116,7 +116,7 @@ void *asCMemoryMgr::AllocScriptNode() LEAVECRITICALSECTION(cs); -#if defined(AS_DEBUG) +#if defined(AS_DEBUG) return ((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(asCScriptNode), __FILE__, __LINE__); #else return userAlloc(sizeof(asCScriptNode)); @@ -141,7 +141,7 @@ void *asCMemoryMgr::AllocByteInstruction() if( byteInstructionPool.GetLength() ) return byteInstructionPool.PopLast(); -#if defined(AS_DEBUG) +#if defined(AS_DEBUG) return ((asALLOCFUNCDEBUG_t)(userAlloc))(sizeof(cByteInstruction), __FILE__, __LINE__); #else return userAlloc(sizeof(cByteInstruction)); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_module.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_module.cpp index a34c20b..5903169 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_module.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_module.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -59,7 +59,7 @@ asCModule::~asCModule() { InternalReset(); - if( builder ) + if( builder ) { asDELETE(builder,asCBuilder); builder = 0; @@ -141,7 +141,7 @@ int asCModule::Build() r = builder->Build(); asDELETE(builder,asCBuilder); builder = 0; - + if( r < 0 ) { // Reset module again @@ -166,7 +166,7 @@ int asCModule::Build() // interface int asCModule::ResetGlobalVars() { - if( isGlobalVarInitialized ) + if( isGlobalVarInitialized ) CallExit(); // TODO: The application really should do this manually through a context @@ -187,7 +187,7 @@ int asCModule::GetFunctionIdByIndex(int index) // internal int asCModule::CallInit() { - if( isGlobalVarInitialized ) + if( isGlobalVarInitialized ) return asERROR; // Each global variable needs to be cleared individually @@ -226,9 +226,9 @@ int asCModule::CallInit() ctx = 0; } - // Even if the initialization failed we need to set the + // Even if the initialization failed we need to set the // flag that the variables have been initialized, otherwise - // the module won't free those variables that really were + // the module won't free those variables that really were // initialized. isGlobalVarInitialized = true; @@ -365,7 +365,7 @@ int asCModule::GetImportedFunctionIndexByDecl(const char *decl) int id = -1; for( asUINT n = 0; n < bindInformations.GetLength(); ++n ) { - if( func.name == bindInformations[n]->importedFunctionSignature->name && + if( func.name == bindInformations[n]->importedFunctionSignature->name && func.returnType == bindInformations[n]->importedFunctionSignature->returnType && func.parameterTypes.GetLength() == bindInformations[n]->importedFunctionSignature->parameterTypes.GetLength() ) { @@ -415,8 +415,8 @@ int asCModule::GetFunctionIdByDecl(const char *decl) int id = -1; for( size_t n = 0; n < globalFunctions.GetLength(); ++n ) { - if( globalFunctions[n]->objectType == 0 && - func.name == globalFunctions[n]->name && + if( globalFunctions[n]->objectType == 0 && + func.name == globalFunctions[n]->name && func.returnType == globalFunctions[n]->returnType && func.parameterTypes.GetLength() == globalFunctions[n]->parameterTypes.GetLength() ) { @@ -510,7 +510,7 @@ int asCModule::GetGlobalVarIndexByDecl(const char *decl) int id = -1; for( size_t n = 0; n < scriptGlobals.GetLength(); ++n ) { - if( gvar.name == scriptGlobals[n]->name && + if( gvar.name == scriptGlobals[n]->name && gvar.type == scriptGlobals[n]->type ) { id = (int)n; @@ -581,10 +581,10 @@ int asCModule::GetObjectTypeCount() return (int)classTypes.GetLength(); } -// interface +// interface asIObjectType *asCModule::GetObjectTypeByIndex(asUINT index) { - if( index >= classTypes.GetLength() ) + if( index >= classTypes.GetLength() ) return 0; return classTypes[index]; @@ -625,7 +625,7 @@ int asCModule::GetEnumValueCount(int enumTypeId) { const asCDataType *dt = engine->GetDataTypeFromTypeId(enumTypeId); asCObjectType *t = dt->GetObjectType(); - if( t == 0 || !(t->GetFlags() & asOBJ_ENUM) ) + if( t == 0 || !(t->GetFlags() & asOBJ_ENUM) ) return asINVALID_TYPE; return (int)t->enumValues.GetLength(); @@ -636,7 +636,7 @@ const char *asCModule::GetEnumValueByIndex(int enumTypeId, asUINT index, int *ou { const asCDataType *dt = engine->GetDataTypeFromTypeId(enumTypeId); asCObjectType *t = dt->GetObjectType(); - if( t == 0 || !(t->GetFlags() & asOBJ_ENUM) ) + if( t == 0 || !(t->GetFlags() & asOBJ_ENUM) ) return 0; if( index >= t->enumValues.GetLength() ) @@ -710,7 +710,7 @@ int asCModule::AddScriptFunction(int sectionIdx, int id, const char *name, const return 0; } -// internal +// internal int asCModule::AddScriptFunction(asCScriptFunction *func) { scriptFunctions.PushLast(func); @@ -770,7 +770,7 @@ int asCModule::BindImportedFunction(int index, int sourceId) if( dst == 0 ) return asNO_FUNCTION; asCScriptFunction *src = engine->GetScriptFunction(sourceId); - if( src == 0 ) + if( src == 0 ) return asNO_FUNCTION; // Verify return type @@ -920,8 +920,8 @@ asCGlobalProperty *asCModule::AllocateGlobalProperty(const char *name, const asC void asCModule::ResolveInterfaceIds() { // For each of the interfaces declared in the script find identical interface in the engine. - // If an identical interface was found then substitute the current id for the identical interface's id, - // then remove this interface declaration. If an interface was modified by the declaration, then + // If an identical interface was found then substitute the current id for the identical interface's id, + // then remove this interface declaration. If an interface was modified by the declaration, then // retry the detection of identical interface for it since it may now match another. // For an interface to be equal to another the name and methods must match. If the interface @@ -940,7 +940,7 @@ void asCModule::ResolveInterfaceIds() unsigned int i; - // The interface can only be equal to interfaces declared in other modules. + // The interface can only be equal to interfaces declared in other modules. // Interfaces registered by the application will conflict with this one if it has the same name. // This means that we only need to look for the interfaces in the engine->classTypes, but not in engine->objectTypes. asCArray equals; @@ -960,7 +960,7 @@ void asCModule::ResolveInterfaceIds() break; } } - + if( found ) break; @@ -969,7 +969,7 @@ void asCModule::ResolveInterfaceIds() // Don't compare against self if( engine->classTypes[n] == intf1 ) continue; - + asCObjectType *intf2 = engine->classTypes[n]; // Assume the interface are equal, then validate this @@ -978,13 +978,13 @@ void asCModule::ResolveInterfaceIds() if( AreInterfacesEqual(intf1, intf2, equals) ) break; - + // Since they are not equal, remove them from the list again equals.PopLast(); } } - // For each of the interfaces that have been found to be equal we need to + // For each of the interfaces that have been found to be equal we need to // remove the new declaration and instead have the module use the existing one. for( i = 0; i < equals.GetLength(); i++ ) { @@ -1072,7 +1072,7 @@ bool asCModule::AreInterfacesEqual(asCObjectType *a, asCObjectType *b, asCArray< // TODO: Study the possiblity of allowing interfaces where methods are declared in different orders to // be considered equal. The compiler and VM can handle this, but it complicates the comparison of interfaces // where multiple methods take different interfaces as parameters (or return values). Example: - // + // // interface A // { // void f(B, C); @@ -1110,7 +1110,7 @@ bool asCModule::AreInterfacesEqual(asCObjectType *a, asCObjectType *b, asCArray< asCScriptFunction *funcA = (asCScriptFunction*)engine->GetFunctionDescriptorById(a->methods[n]); asCScriptFunction *funcB = (asCScriptFunction*)engine->GetFunctionDescriptorById(b->methods[n]); - // funcB can be null if the module that created the interface has been + // funcB can be null if the module that created the interface has been // discarded but the type has not yet been released by the engine. if( funcB == 0 ) break; @@ -1119,7 +1119,7 @@ bool asCModule::AreInterfacesEqual(asCObjectType *a, asCObjectType *b, asCArray< if( funcA->name != funcB->name || funcA->parameterTypes.GetLength() != funcB->parameterTypes.GetLength() ) break; - + // The return types must be equal. If the return type is an interface the interfaces must match. if( !AreTypesEqual(funcA->returnType, funcB->returnType, equals) ) break; @@ -1154,8 +1154,8 @@ bool asCModule::AreInterfacesEqual(asCObjectType *a, asCObjectType *b, asCArray< if( !match ) { - // The interfaces doesn't match. - // Restore the list of previous equals before we go on, so + // The interfaces doesn't match. + // Restore the list of previous equals before we go on, so // the caller can continue comparing with another interface equals.SetLength(prevEquals); } @@ -1263,7 +1263,7 @@ int asCModule::CompileGlobalVar(const char *sectionName, const char *code, int l // Initialize the variable if( r >= 0 && engine->ep.initGlobalVarsAfterBuild ) { - // Clear the memory + // Clear the memory asCGlobalProperty *prop = scriptGlobals[scriptGlobals.GetLength()-1]; memset(prop->GetAddressOfValue(), 0, sizeof(asDWORD)*prop->type.GetSizeOnStackDWords()); @@ -1292,7 +1292,7 @@ int asCModule::CompileFunction(const char *sectionName, const char *code, int li asASSERT(outFunc == 0 || *outFunc == 0); // Validate arguments - if( code == 0 || + if( code == 0 || (compileFlags != 0 && compileFlags != asCOMP_ADD_TO_MODULE) ) return asINVALID_ARG; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_module.h b/Libraries/AngelScript/sdk/angelscript/source/as_module.h index 67850e4..3f2c0b6 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_module.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_module.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -71,13 +71,13 @@ struct sObjectTypePair asCObjectType *b; }; -// TODO: import: Remove function imports. When I have implemented function +// TODO: import: Remove function imports. When I have implemented function // pointers the function imports should be deprecated. // TODO: Need a separate interface for compiling scripts. The asIScriptCompiler // will have a target module, and will allow the compilation of an entire // script or just individual functions within the scope of the module -// +// // With this separation it will be possible to compile the library without // the compiler, thus giving a much smaller binary executable. diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.cpp index d85bbcf..64026f8 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -122,18 +122,18 @@ void RegisterObjectTypeGCBehaviours(asCScriptEngine *engine) asCObjectType::asCObjectType() { - engine = 0; - refCount.set(0); + engine = 0; + refCount.set(0); derivedFrom = 0; acceptValueSubType = true; acceptRefSubType = true; } -asCObjectType::asCObjectType(asCScriptEngine *engine) +asCObjectType::asCObjectType(asCScriptEngine *engine) { - this->engine = engine; - refCount.set(0); + this->engine = engine; + refCount.set(0); derivedFrom = 0; acceptValueSubType = true; @@ -178,7 +178,7 @@ asCObjectType::~asCObjectType() asUINT n; for( n = 0; n < properties.GetLength(); n++ ) - if( properties[n] ) + if( properties[n] ) { if( flags & asOBJ_SCRIPT_OBJECT ) { @@ -374,7 +374,7 @@ int asCObjectType::GetMethodIdByDecl(const char *decl) const asIScriptFunction *asCObjectType::GetMethodDescriptorByIndex(int index) const { - if( index < 0 || (unsigned)index >= methods.GetLength() ) + if( index < 0 || (unsigned)index >= methods.GetLength() ) return 0; return engine->scriptFunctions[methods[index]]; @@ -403,7 +403,7 @@ const char *asCObjectType::GetPropertyName(asUINT prop) const asIObjectType *asCObjectType::GetBaseType() const { - return derivedFrom; + return derivedFrom; } int asCObjectType::GetPropertyOffset(asUINT prop) const @@ -418,7 +418,7 @@ int asCObjectType::GetBehaviourCount() const { // Count the number of behaviours (except factory functions) int count = 0; - + if( beh.destruct ) count++; if( beh.addref ) count++; if( beh.release ) count++; @@ -426,7 +426,7 @@ int asCObjectType::GetBehaviourCount() const if( beh.gcSetFlag ) count++; if( beh.gcGetFlag ) count++; if( beh.gcEnumReferences ) count++; - if( beh.gcReleaseAllReferences ) count++; + if( beh.gcReleaseAllReferences ) count++; if( beh.templateCallback ) count++; count += (int)beh.constructors.GetLength(); @@ -441,7 +441,7 @@ int asCObjectType::GetBehaviourByIndex(asUINT index, asEBehaviours *outBehaviour int count = 0; if( beh.destruct && count++ == (int)index ) // only increase count if the behaviour is registered - { + { if( outBehaviour ) *outBehaviour = asBEHAVE_DESTRUCT; return beh.destruct; } @@ -499,7 +499,7 @@ int asCObjectType::GetBehaviourByIndex(asUINT index, asEBehaviours *outBehaviour if( outBehaviour ) *outBehaviour = asBEHAVE_CONSTRUCT; return beh.constructors[index - count]; } - else + else count += (int)beh.constructors.GetLength(); if( index - count < beh.operators.GetLength() / 2 ) @@ -535,7 +535,7 @@ void asCObjectType::ReleaseAllFunctions() beh.factory = 0; for( asUINT a = 0; a < beh.factories.GetLength(); a++ ) { - if( engine->scriptFunctions[beh.factories[a]] ) + if( engine->scriptFunctions[beh.factories[a]] ) engine->scriptFunctions[beh.factories[a]]->Release(); } beh.factories.SetLength(0); @@ -543,7 +543,7 @@ void asCObjectType::ReleaseAllFunctions() beh.construct = 0; for( asUINT b = 0; b < beh.constructors.GetLength(); b++ ) { - if( engine->scriptFunctions[beh.constructors[b]] ) + if( engine->scriptFunctions[beh.constructors[b]] ) engine->scriptFunctions[beh.constructors[b]]->Release(); } beh.constructors.SetLength(0); @@ -597,7 +597,7 @@ void asCObjectType::ReleaseAllFunctions() for( asUINT c = 0; c < methods.GetLength(); c++ ) { - if( engine->scriptFunctions[methods[c]] ) + if( engine->scriptFunctions[methods[c]] ) engine->scriptFunctions[methods[c]]->Release(); } methods.SetLength(0); @@ -614,11 +614,11 @@ void asCObjectType::ReleaseAllFunctions() void asCObjectType::EnumReferences(asIScriptEngine *) { for( asUINT a = 0; a < beh.factories.GetLength(); a++ ) - if( engine->scriptFunctions[beh.factories[a]] ) + if( engine->scriptFunctions[beh.factories[a]] ) engine->GCEnumCallback(engine->scriptFunctions[beh.factories[a]]); for( asUINT b = 0; b < beh.constructors.GetLength(); b++ ) - if( engine->scriptFunctions[beh.constructors[b]] ) + if( engine->scriptFunctions[beh.constructors[b]] ) engine->GCEnumCallback(engine->scriptFunctions[beh.constructors[b]]); if( beh.templateCallback ) @@ -656,7 +656,7 @@ void asCObjectType::EnumReferences(asIScriptEngine *) engine->GCEnumCallback(engine->scriptFunctions[beh.operators[e]]); for( asUINT c = 0; c < methods.GetLength(); c++ ) - if( engine->scriptFunctions[methods[c]] ) + if( engine->scriptFunctions[methods[c]] ) engine->GCEnumCallback(engine->scriptFunctions[methods[c]]); for( asUINT d = 0; d < virtualFunctionTable.GetLength(); d++ ) diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.h b/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.h index 9124278..54aac82 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_objecttype.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -62,33 +62,33 @@ const asDWORD asOBJ_TEMPLATE_SUBTYPE = 0x20000000; -// asOBJ_GC is used to indicate that the type can potentially +// asOBJ_GC is used to indicate that the type can potentially // form circular references, thus is garbage collected. -// The fact that an object is garbage collected doesn't imply that an object that -// can references it also must be garbage collected, only if the garbage collected +// The fact that an object is garbage collected doesn't imply that an object that +// can references it also must be garbage collected, only if the garbage collected // object can reference it as well. -// For registered types however, we set the flag asOBJ_GC if the GC -// behaviours are registered. For script types that contain any such type we +// For registered types however, we set the flag asOBJ_GC if the GC +// behaviours are registered. For script types that contain any such type we // automatically make garbage collected as well, because we cannot know what type // of references that object can contain, and must assume the worst. struct asSTypeBehaviour { - asSTypeBehaviour() + asSTypeBehaviour() { - factory = 0; - construct = 0; - destruct = 0; - copy = 0; - addref = 0; - release = 0; - gcGetRefCount = 0; - gcSetFlag = 0; - gcGetFlag = 0; - gcEnumReferences = 0; + factory = 0; + construct = 0; + destruct = 0; + copy = 0; + addref = 0; + release = 0; + gcGetRefCount = 0; + gcSetFlag = 0; + gcGetFlag = 0; + gcEnumReferences = 0; gcReleaseAllReferences = 0; templateCallback = 0; } @@ -100,14 +100,14 @@ struct asSTypeBehaviour int addref; int release; int templateCallback; - + // GC behaviours int gcGetRefCount; int gcSetFlag; int gcGetFlag; int gcEnumReferences; int gcReleaseAllReferences; - + asCArray factories; asCArray constructors; asCArray operators; @@ -174,7 +174,7 @@ class asCObjectType : public asIObjectType // Internal //=========================================== public: - asCObjectType(); + asCObjectType(); asCObjectType(asCScriptEngine *engine); ~asCObjectType(); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.cpp index cf37014..a244923 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -51,7 +51,7 @@ void asCOutputBuffer::Clear() { for( asUINT n = 0; n < messages.GetLength(); n++ ) { - if( messages[n] ) + if( messages[n] ) { asDELETE(messages[n],message_t); } diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.h b/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.h index de3fcc9..b34400e 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_outputbuffer.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2008 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_parser.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_parser.cpp index 32147a7..421bb98 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_parser.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_parser.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -138,7 +138,7 @@ int asCParser::ParseDataType(asCScriptCode *script) this->script = script; scriptNode = new(engine->memoryMgr.AllocScriptNode()) asCScriptNode(snDataType); - + scriptNode->AddChildLast(ParseType(true)); if( isSyntaxError ) return -1; @@ -406,7 +406,7 @@ int asCParser::ParseStatementBlock(asCScriptCode *script, asCScriptNode *block) this->script = script; sourcePos = block->tokenPos; - scriptNode = ParseStatementBlock(); + scriptNode = ParseStatementBlock(); if( isSyntaxError || errorWhileParsing ) return -1; @@ -436,7 +436,7 @@ asCScriptNode *asCParser::ParseEnumeration() // Get the identifier GetToken(&token); - if(ttIdentifier != token.type) + if(ttIdentifier != token.type) { Error(TXT_EXPECTED_IDENTIFIER, &token); return node; @@ -452,24 +452,24 @@ asCScriptNode *asCParser::ParseEnumeration() // check for the start of the declaration block GetToken(&token); - if( token.type != ttStartStatementBlock ) + if( token.type != ttStartStatementBlock ) { RewindTo(&token); Error(ExpectedToken(asGetTokenDefinition(token.type)).AddressOf(), &token); return node; } - while(ttEnd != token.type) + while(ttEnd != token.type) { GetToken(&token); - if( ttEndStatementBlock == token.type ) + if( ttEndStatementBlock == token.type ) { RewindTo(&token); break; } - if(ttIdentifier != token.type) + if(ttIdentifier != token.type) { Error(TXT_EXPECTED_IDENTIFIER, &token); return node; @@ -496,7 +496,7 @@ asCScriptNode *asCParser::ParseEnumeration() GetToken(&token); } - if(ttListSeparator != token.type) + if(ttListSeparator != token.type) { RewindTo(&token); break; @@ -505,7 +505,7 @@ asCScriptNode *asCParser::ParseEnumeration() // check for the end of the declaration block GetToken(&token); - if( token.type != ttEndStatementBlock ) + if( token.type != ttEndStatementBlock ) { RewindTo(&token); Error(ExpectedToken(asGetTokenDefinition(token.type)).AddressOf(), &token); @@ -551,7 +551,7 @@ bool asCParser::CheckTemplateType(sToken &t) GetToken(&t); } - // Accept >> and >>> tokens too. But then force the tokenizer to move + // Accept >> and >>> tokens too. But then force the tokenizer to move // only 1 character ahead (thus splitting the token in two). if( script->code[t.pos] != '>' ) return false; @@ -573,7 +573,7 @@ bool asCParser::IsVarDecl() sToken t; GetToken(&t); RewindTo(&t); - + // A variable decl can start with a const sToken t1; GetToken(&t1); @@ -622,14 +622,14 @@ bool asCParser::IsVarDecl() RewindTo(&t); return true; } - if( t2.type == ttOpenParanthesis ) - { - // If the closing paranthesis is followed by a statement - // block or end-of-file, then treat it as a function. + if( t2.type == ttOpenParanthesis ) + { + // If the closing paranthesis is followed by a statement + // block or end-of-file, then treat it as a function. while( t2.type != ttCloseParanthesis && t2.type != ttEnd ) GetToken(&t2); - if( t2.type == ttEnd ) + if( t2.type == ttEnd ) return false; else { @@ -704,14 +704,14 @@ bool asCParser::IsFuncDecl(bool isMethod) } GetToken(&t2); - if( t2.type == ttOpenParanthesis ) - { - // If the closing paranthesis is not followed by a - // statement block then it is not a function. + if( t2.type == ttOpenParanthesis ) + { + // If the closing paranthesis is not followed by a + // statement block then it is not a function. while( t2.type != ttCloseParanthesis && t2.type != ttEnd ) GetToken(&t2); - if( t2.type == ttEnd ) + if( t2.type == ttEnd ) return false; else { @@ -778,7 +778,7 @@ asCScriptNode *asCParser::ParseFunction(bool isMethod) node->AddChildLast(ParseToken(ttConst)); } - // We should just find the end of the statement block here. The statements + // We should just find the end of the statement block here. The statements // will be parsed on request by the compiler once it starts the compilation. node->AddChildLast(SuperficiallyParseStatementBlock()); @@ -851,7 +851,7 @@ asCScriptNode *asCParser::ParseInterface() // Parse the method signature node->AddChildLast(ParseInterfaceMethod()); if( isSyntaxError ) return node; - + GetToken(&t); RewindTo(&t); } @@ -886,7 +886,7 @@ asCScriptNode *asCParser::ParseClass() { // Parse 'implicit handle class' construct GetToken(&t); - + if ( t.type == ttHandle ) node->SetToken(&t); else @@ -1033,7 +1033,7 @@ int asCParser::ParseGlobalVarInit(asCScriptCode *script, asCScriptNode *init) else scriptNode = ParseAssignment(); } - else if( t.type == ttOpenParanthesis ) + else if( t.type == ttOpenParanthesis ) { RewindTo(&t); scriptNode = ParseArgList(); @@ -1155,7 +1155,7 @@ asCScriptNode *asCParser::ParseTypeMod(bool isParam) } } - // Parse possible + token + // Parse possible + token GetToken(&t); RewindTo(&t); if( t.type == ttPlus ) @@ -1202,7 +1202,7 @@ asCScriptNode *asCParser::ParseType(bool allowConst, bool allowVariableType) node->AddChildLast(ParseType(true, false)); if( isSyntaxError ) return node; - // Accept >> and >>> tokens too. But then force the tokenizer to move + // Accept >> and >>> tokens too. But then force the tokenizer to move // only 1 character ahead (thus splitting the token in two). GetToken(&t); if( script->code[t.pos] != '>' ) @@ -1834,7 +1834,7 @@ asCScriptNode *asCParser::ParseInitList() GetToken(&t1); if( t1.type == ttListSeparator ) { - // No expression + // No expression node->AddChildLast(new(engine->memoryMgr.AllocScriptNode()) asCScriptNode(snUndefined)); GetToken(&t1); @@ -1849,7 +1849,7 @@ asCScriptNode *asCParser::ParseInitList() } else if( t1.type == ttEndStatementBlock ) { - // No expression + // No expression node->AddChildLast(new(engine->memoryMgr.AllocScriptNode()) asCScriptNode(snUndefined)); node->UpdateSourcePos(t1.pos, t1.length); @@ -2100,11 +2100,11 @@ asCScriptNode *asCParser::ParseSwitch() Error(ExpectedToken("{").AddressOf(), &t); return node; } - + while( !isSyntaxError ) { GetToken(&t); - + if( t.type == ttEndStatementBlock || t.type == ttDefault) break; @@ -2168,9 +2168,9 @@ asCScriptNode *asCParser::ParseCase() // Parse statements until we find either of }, case, default, and break GetToken(&t); RewindTo(&t); - while( t.type != ttCase && - t.type != ttDefault && - t.type != ttEndStatementBlock && + while( t.type != ttCase && + t.type != ttDefault && + t.type != ttEndStatementBlock && t.type != ttBreak ) { @@ -2284,14 +2284,14 @@ asCScriptNode *asCParser::ParseFor() } node->AddChildLast(ParseStatement()); - + return node; } - + asCScriptNode *asCParser::ParseWhile() { asCScriptNode *node = new(engine->memoryMgr.AllocScriptNode()) asCScriptNode(snWhile); @@ -2561,7 +2561,7 @@ asCScriptNode *asCParser::ParseExprTerm() node->AddChildLast(ParseExprValue()); if( isSyntaxError ) return node; - + for(;;) { sToken t; @@ -2693,7 +2693,7 @@ void asCParser::GetToken(sToken *token) sourcePos += token->length; } // Filter out whitespace and comments - while( token->type == ttWhiteSpace || + while( token->type == ttWhiteSpace || token->type == ttOnelineComment || token->type == ttMultilineComment ); } @@ -2893,7 +2893,7 @@ asCScriptNode *asCParser::ParseTypedef() Error(ExpectedToken(asGetTokenDefinition(token.type)).AddressOf(), &token); return node; } - + node->SetToken(&token); node->UpdateSourcePos(token.pos, token.length); @@ -2915,7 +2915,7 @@ asCScriptNode *asCParser::ParseTypedef() // Check for the end of the typedef GetToken(&token); - if( token.type != ttEndStatement ) + if( token.type != ttEndStatement ) { RewindTo(&token); Error(ExpectedToken(asGetTokenDefinition(token.type)).AddressOf(), &token); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_parser.h b/Libraries/AngelScript/sdk/angelscript/source/as_parser.h index 41e78d9..e944204 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_parser.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_parser.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_property.h b/Libraries/AngelScript/sdk/angelscript/source/as_property.h index af28e6b..553e7ea 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_property.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_property.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_restore.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_restore.cpp index eb3d1a1..e8a5203 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_restore.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_restore.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -50,12 +50,12 @@ asCRestore::asCRestore(asCModule* _module, asIBinaryStream* _stream, asCScriptEn { } -int asCRestore::Save() +int asCRestore::Save() { unsigned long i, count; // Store everything in the same order that the builder parses scripts - + // Store enums count = (asUINT)module->enumTypes.GetLength(); WRITE_NUM(count); @@ -100,7 +100,7 @@ int asCRestore::Save() // scriptGlobals[] count = (asUINT)module->scriptGlobals.GetLength(); WRITE_NUM(count); - for( i = 0; i < count; ++i ) + for( i = 0; i < count; ++i ) WriteGlobalProperty(module->scriptGlobals[i]); // scriptFunctions[] @@ -155,9 +155,9 @@ int asCRestore::Save() return asSUCCESS; } -int asCRestore::Restore() +int asCRestore::Restore() { - // Before starting the load, make sure that + // Before starting the load, make sure that // any existing resources have been freed module->InternalReset(); @@ -227,14 +227,14 @@ int asCRestore::Restore() // scriptGlobals[] READ_NUM(count); module->scriptGlobals.Allocate(count, 0); - for( i = 0; i < count; ++i ) + for( i = 0; i < count; ++i ) { ReadGlobalProperty(); } // scriptFunctions[] READ_NUM(count); - for( i = 0; i < count; ++i ) + for( i = 0; i < count; ++i ) { func = ReadFunction(); } @@ -262,7 +262,7 @@ int asCRestore::Restore() info->boundFunctionId = -1; module->bindInformations[i] = info; } - + // usedTypes[] READ_NUM(count); usedTypes.Allocate(count, 0); @@ -330,7 +330,7 @@ void asCRestore::ReadUsedStringConstants() asUINT count; READ_NUM(count); usedStringConstants.SetLength(count); - for( asUINT i = 0; i < count; ++i ) + for( asUINT i = 0; i < count; ++i ) { ReadString(&str); usedStringConstants[i] = engine->AddConstantString(str.AddressOf(), str.GetLength()); @@ -417,7 +417,7 @@ void asCRestore::WriteFunctionSignature(asCScriptFunction *func) WriteDataType(&func->returnType); count = (asUINT)func->parameterTypes.GetLength(); WRITE_NUM(count); - for( i = 0; i < count; ++i ) + for( i = 0; i < count; ++i ) WriteDataType(&func->parameterTypes[i]); count = (asUINT)func->inOutFlags.GetLength(); @@ -442,7 +442,7 @@ void asCRestore::ReadFunctionSignature(asCScriptFunction *func) ReadDataType(&func->returnType); READ_NUM(count); func->parameterTypes.Allocate(count, 0); - for( i = 0; i < count; ++i ) + for( i = 0; i < count; ++i ) { ReadDataType(&dt); func->parameterTypes.PushLast(dt); @@ -463,7 +463,7 @@ void asCRestore::ReadFunctionSignature(asCScriptFunction *func) READ_NUM(func->isReadOnly); } -void asCRestore::WriteFunction(asCScriptFunction* func) +void asCRestore::WriteFunction(asCScriptFunction* func) { char c; @@ -525,7 +525,7 @@ void asCRestore::WriteFunction(asCScriptFunction* func) // TODO: Store script section index } -asCScriptFunction *asCRestore::ReadFunction(bool addToModule, bool addToEngine) +asCScriptFunction *asCRestore::ReadFunction(bool addToModule, bool addToEngine) { char c; READ_NUM(c); @@ -559,7 +559,7 @@ asCScriptFunction *asCRestore::ReadFunction(bool addToModule, bool addToEngine) engine->gc.AddScriptObjectToGC(func, &engine->functionBehaviours); func->id = engine->GetNextScriptFunctionId(); - + READ_NUM(count); func->byteCode.Allocate(count, 0); ReadByteCode(func->byteCode.AddressOf(), count); @@ -614,7 +614,7 @@ void asCRestore::WriteObjectTypeDeclaration(asCObjectType *ot, bool writePropert WRITE_NUM(flags); } else - { + { if( ot->flags & asOBJ_ENUM ) { // enumValues[] @@ -718,7 +718,7 @@ void asCRestore::ReadObjectTypeDeclaration(asCObjectType *ot, bool readPropertie engine->scriptFunctions[ot->beh.operators[i]]->AddRef(); } else - { + { if( ot->flags & asOBJ_ENUM ) { int count; @@ -802,7 +802,7 @@ void asCRestore::ReadObjectTypeDeclaration(asCObjectType *ot, bool readPropertie // methods[] READ_NUM(size); - for( n = 0; n < size; n++ ) + for( n = 0; n < size; n++ ) { asCScriptFunction *func = ReadFunction(); ot->methods.PushLast(func->id); @@ -821,14 +821,14 @@ void asCRestore::ReadObjectTypeDeclaration(asCObjectType *ot, bool readPropertie } } -void asCRestore::WriteString(asCString* str) +void asCRestore::WriteString(asCString* str) { asUINT len = (asUINT)str->GetLength(); WRITE_NUM(len); stream->Write(str->AddressOf(), (asUINT)len); } -void asCRestore::ReadString(asCString* str) +void asCRestore::ReadString(asCString* str) { asUINT len; READ_NUM(len); @@ -836,10 +836,10 @@ void asCRestore::ReadString(asCString* str) stream->Read(str->AddressOf(), len); } -void asCRestore::WriteGlobalProperty(asCGlobalProperty* prop) +void asCRestore::WriteGlobalProperty(asCGlobalProperty* prop) { - // TODO: We might be able to avoid storing the name and type of the global - // properties twice if we merge this with the WriteUsedGlobalProperties. + // TODO: We might be able to avoid storing the name and type of the global + // properties twice if we merge this with the WriteUsedGlobalProperties. WriteString(&prop->name); WriteDataType(&prop->type); @@ -858,7 +858,7 @@ void asCRestore::WriteGlobalProperty(asCGlobalProperty* prop) } } -void asCRestore::ReadGlobalProperty() +void asCRestore::ReadGlobalProperty() { asCString name; asCDataType type; @@ -880,21 +880,21 @@ void asCRestore::ReadGlobalProperty() } } -void asCRestore::WriteObjectProperty(asCObjectProperty* prop) +void asCRestore::WriteObjectProperty(asCObjectProperty* prop) { WriteString(&prop->name); WriteDataType(&prop->type); WRITE_NUM(prop->byteOffset); } -void asCRestore::ReadObjectProperty(asCObjectProperty* prop) +void asCRestore::ReadObjectProperty(asCObjectProperty* prop) { ReadString(&prop->name); ReadDataType(&prop->type); READ_NUM(prop->byteOffset); } -void asCRestore::WriteDataType(const asCDataType *dt) +void asCRestore::WriteDataType(const asCDataType *dt) { bool b; int t = dt->GetTokenType(); @@ -910,7 +910,7 @@ void asCRestore::WriteDataType(const asCDataType *dt) WRITE_NUM(b); } -void asCRestore::ReadDataType(asCDataType *dt) +void asCRestore::ReadDataType(asCDataType *dt) { eTokenType tokenType; READ_NUM(tokenType); @@ -937,7 +937,7 @@ void asCRestore::ReadDataType(asCDataType *dt) dt->MakeReference(isReference); } -void asCRestore::WriteObjectType(asCObjectType* ot) +void asCRestore::WriteObjectType(asCObjectType* ot) { char ch; @@ -994,7 +994,7 @@ void asCRestore::WriteObjectType(asCObjectType* ot) } } -asCObjectType* asCRestore::ReadObjectType() +asCObjectType* asCRestore::ReadObjectType() { asCObjectType *ot; char ch; @@ -1013,7 +1013,7 @@ asCObjectType* asCRestore::ReadObjectType() dt.MakeArray(engine); ot = dt.GetObjectType(); - + asASSERT(ot); } else @@ -1023,7 +1023,7 @@ asCObjectType* asCRestore::ReadObjectType() asCDataType dt = asCDataType::CreatePrimitive(tokenType, false); dt.MakeArray(engine); ot = dt.GetObjectType(); - + asASSERT(ot); } } @@ -1058,7 +1058,7 @@ asCObjectType* asCRestore::ReadObjectType() ot = module->GetObjectType(typeName.AddressOf()); if( !ot ) ot = engine->GetObjectType(typeName.AddressOf()); - + asASSERT(ot); } else if( typeName == "_builtin_object_" ) @@ -1086,7 +1086,7 @@ void asCRestore::WriteByteCode(asDWORD *bc, int length) for( n = 0; n < asBCTypeSize[asBCInfo[c].type]-1; n++ ) tmp[n] = *bc++; - // Translate the object type + // Translate the object type asCObjectType *ot = *(asCObjectType**)tmp; *(int*)tmp = FindObjectTypeIdx(ot); @@ -1098,7 +1098,7 @@ void asCRestore::WriteByteCode(asDWORD *bc, int length) WRITE_NUM(tmp[n]); } else if( c == asBC_FREE || - c == asBC_REFCPY || + c == asBC_REFCPY || c == asBC_OBJTYPE ) { WRITE_NUM(*bc++); @@ -1129,7 +1129,7 @@ void asCRestore::WriteByteCode(asDWORD *bc, int length) WRITE_NUM(tmp[n]); } else if( c == asBC_CALL || - c == asBC_CALLINTF || + c == asBC_CALLINTF || c == asBC_CALLSYS ) { WRITE_NUM(*bc++); @@ -1237,7 +1237,7 @@ void asCRestore::WriteUsedGlobalProps() for( int n = 0; n < c; n++ ) { size_t *p = (size_t*)usedGlobalProperties[n]; - + // First search for the global in the module char moduleProp = 0; asCGlobalProperty *prop = 0; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_restore.h b/Libraries/AngelScript/sdk/angelscript/source/as_restore.h index adb4af4..640b0ae 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_restore.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_restore.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -36,7 +36,7 @@ // asCRestore was originally written by Dennis Bollyn, dennis@gyrbo.be -// TODO: This should be split in two, so that an application that doesn't compile any +// TODO: This should be split in two, so that an application that doesn't compile any // code but only loads precompiled code can link with only the bytecode loader #ifndef AS_RESTORE_H @@ -48,7 +48,7 @@ BEGIN_AS_NAMESPACE -class asCRestore +class asCRestore { public: asCRestore(asCModule *module, asIBinaryStream *stream, asCScriptEngine *engine); @@ -107,7 +107,7 @@ class asCRestore // After loading, each function needs to be translated to update pointers, function ids, etc void TranslateFunction(asCScriptFunction *func); - // Temporary storage for persisting variable data + // Temporary storage for persisting variable data asCArray usedTypeIds; asCArray usedTypes; asCArray usedFunctions; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.cpp index 9c3ba65..04121e9 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2008 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -52,7 +52,7 @@ asCScriptCode::asCScriptCode() asCScriptCode::~asCScriptCode() { - if( !sharedCode && code ) + if( !sharedCode && code ) { asDELETEARRAY(code); } @@ -66,7 +66,7 @@ int asCScriptCode::SetCode(const char *name, const char *code, bool makeCopy) int asCScriptCode::SetCode(const char *name, const char *code, size_t length, bool makeCopy) { this->name = name; - if( !sharedCode && this->code ) + if( !sharedCode && this->code ) { asDELETEARRAY(this->code); } @@ -97,7 +97,7 @@ int asCScriptCode::SetCode(const char *name, const char *code, size_t length, bo void asCScriptCode::ConvertPosToRowCol(size_t pos, int *row, int *col) { - if( linePositions.GetLength() == 0 ) + if( linePositions.GetLength() == 0 ) { if( row ) *row = lineOffset; if( col ) *col = 1; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.h b/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.h index c960aa9..2ee86ae 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptcode.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.cpp index cb11ad2..8e64e8e 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.cpp @@ -939,7 +939,7 @@ int asCScriptEngine::CreateContext(asIScriptContext **context, bool isInternal) { *context = asNEW(asCContext)(this, !isInternal); - // We need to make sure the engine has been + // We need to make sure the engine has been // prepared before any context is executed PrepareEngine(); @@ -1612,7 +1612,7 @@ int asCScriptEngine::RegisterBehaviourToObjectType(asCObjectType *objectType, as } else if( behaviour == asBEHAVE_TEMPLATE_CALLBACK ) { - // Must be a template type + // Must be a template type if( !(func.objectType->flags & asOBJ_TEMPLATE) ) { WriteMessage("", 0, 0, asMSGTYPE_ERROR, TXT_ILLEGAL_BEHAVIOUR_FOR_TYPE); @@ -1837,7 +1837,7 @@ int asCScriptEngine::RegisterGlobalProperty(const char *declaration, void *point prop->type = type; prop->SetRegisteredAddress(pointer); - + registeredGlobalProps.PushLast(prop); currentGroup->globalProps.PushLast(prop); @@ -2435,7 +2435,7 @@ int asCScriptEngine::ExecuteString(const char *module, const char *script, asISc str = "void ExecuteString(){\n" + str + "\n;}"; r = builder.BuildString(str.AddressOf(), (asCContext*)exec); - + BuildCompleted(); if( r < 0 ) @@ -3489,11 +3489,11 @@ int asCScriptEngine::EndConfigGroup() int asCScriptEngine::RemoveConfigGroup(const char *groupName) { - // It is not allowed to remove a group that is still in use. + // It is not allowed to remove a group that is still in use. // It would be possible to change the code in such a way that // the group could be removed even though it was still in use, - // but that would cause severe negative impact on runtime + // but that would cause severe negative impact on runtime // performance, since the VM would then have to be able handle // situations where the types, functions, and global variables // can be removed at any time. diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.h b/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.h index 70af12c..1b69dfb 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptengine.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -104,7 +104,7 @@ class asCScriptEngine : public asIScriptEngine virtual int RegisterGlobalProperty(const char *declaration, void *pointer); virtual int GetGlobalPropertyCount(); virtual int GetGlobalPropertyByIndex(asUINT index, const char **name, int *typeId = 0, bool *isConst = 0, const char **configGroup = 0, void **pointer = 0); - + // Type registration virtual int RegisterObjectType(const char *obj, int byteSize, asDWORD flags); virtual int RegisterObjectProperty(const char *obj, const char *declaration, int byteOffset); @@ -114,7 +114,7 @@ class asCScriptEngine : public asIScriptEngine virtual int RegisterInterfaceMethod(const char *intf, const char *declaration); virtual int GetObjectTypeCount(); virtual asIObjectType *GetObjectTypeByIndex(asUINT index); - + // String factory virtual int RegisterStringFactory(const char *datatype, const asSFuncPtr &factoryFunc, asDWORD callConv); virtual int GetStringFactoryReturnTypeId(); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.cpp index 2607f2b..dcd692e 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -128,9 +128,9 @@ asCScriptFunction::asCScriptFunction(asCScriptEngine *engine, asCModule *mod, in refCount.set(1); this->engine = engine; funcType = _funcType; - module = mod; - objectType = 0; - name = ""; + module = mod; + objectType = 0; + name = ""; isReadOnly = false; stackNeeded = 0; sysFuncIntf = 0; @@ -149,9 +149,9 @@ asCScriptFunction::asCScriptFunction(asCScriptEngine *engine, asCModule *mod, in // internal asCScriptFunction::~asCScriptFunction() { - // Imported functions are not reference counted, nor are dummy + // Imported functions are not reference counted, nor are dummy // functions that are allocated on the stack - asASSERT( funcType == -1 || + asASSERT( funcType == -1 || funcType == asFUNC_IMPORTED || refCount.get() == 0 ); @@ -216,7 +216,7 @@ asIObjectType *asCScriptFunction::GetObjectType() const } // interface -const char *asCScriptFunction::GetObjectName() const +const char *asCScriptFunction::GetObjectName() const { if( objectType ) return objectType->GetName(); @@ -336,7 +336,7 @@ int asCScriptFunction::GetLineNumber(int programPosition) if( lineNumbers[i*2+2] > programPosition ) return lineNumbers[i*2+1]; min = i + 1; - i = (max + min)/2; + i = (max + min)/2; } else if( lineNumbers[i*2] > programPosition ) { @@ -367,15 +367,15 @@ void asCScriptFunction::AddVariable(asCString &name, asCDataType &type, int stac // internal void asCScriptFunction::ComputeSignatureId() { - // This function will compute the signatureId based on the - // function name, return type, and parameter types. The object - // type for methods is not used, so that class methods and + // This function will compute the signatureId based on the + // function name, return type, and parameter types. The object + // type for methods is not used, so that class methods and // interface methods match each other. for( asUINT n = 0; n < engine->signatureIds.GetLength(); n++ ) { if( !IsSignatureEqual(engine->signatureIds[n]) ) continue; - // We don't need to increment the reference counter here, because + // We don't need to increment the reference counter here, because // asCScriptEngine::FreeScriptFunctionId will maintain the signature // id as the function is freed. signatureId = engine->signatureIds[n]->signatureId; @@ -405,7 +405,7 @@ void asCScriptFunction::AddReferences() asUINT n; // Only count references if there is any bytecode - if( byteCode.GetLength() ) + if( byteCode.GetLength() ) { if( returnType.IsObject() ) returnType.GetObjectType()->AddRef(); @@ -525,7 +525,7 @@ void asCScriptFunction::ReleaseReferences() case asBC_REFCPY: { asCObjectType *objType = (asCObjectType*)(size_t)asBC_PTRARG(&byteCode[n]); - if( objType ) + if( objType ) objType->Release(); } break; @@ -648,7 +648,7 @@ const char *asCScriptFunction::GetScriptSectionName() const { if( scriptSectionIdx >= 0 ) return engine->scriptSectionNames[scriptSectionIdx]->AddressOf(); - + return 0; } @@ -819,7 +819,7 @@ void asCScriptFunction::EnumReferences(asIScriptEngine *) void asCScriptFunction::ReleaseAllHandles(asIScriptEngine *) { // Release paramaters - if( byteCode.GetLength() ) + if( byteCode.GetLength() ) { if( returnType.IsObject() ) { diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.h b/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.h index 9447a0c..14f976b 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptfunction.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -75,7 +75,7 @@ struct asSSystemFunctionInterface; // as the function can be removed from the module, but still remain alive. For example // for dynamically generated functions held by a function pointer. -// TODO: Might be interesting to allow enumeration of accessed global variables, and +// TODO: Might be interesting to allow enumeration of accessed global variables, and // also functions/methods that are being called. void RegisterScriptFunction(asCScriptEngine *engine); diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.cpp index f49e91e..c9e06ef 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.h b/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.h index ea23e1b..585e8cc 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptnode.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.cpp index d7f5a28..74f7259 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -268,7 +268,7 @@ int asCScriptObject::Release() void asCScriptObject::CallDestructor() { - // Make sure the destructor is called once only, even if the + // Make sure the destructor is called once only, even if the // reference count is increased and then decreased again isDestructCalled = true; @@ -295,7 +295,7 @@ void asCScriptObject::CallDestructor() ctx->SetObject(this); ctx->Execute(); - // There's not much to do if the execution doesn't + // There's not much to do if the execution doesn't // finish, so we just ignore the result } } diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.h b/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.h index 40b0587..bd5e82d 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_scriptobject.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_string.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_string.cpp index 42da295..daca027 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_string.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_string.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -248,7 +248,7 @@ size_t asCString::Format(const char *format, ...) return length; } -char &asCString::operator [](size_t index) +char &asCString::operator [](size_t index) { asASSERT(index < length); @@ -287,7 +287,7 @@ int asCString::Compare(const asCString &str) const int asCString::Compare(const char *str, size_t len) const { - if( length == 0 ) + if( length == 0 ) { if( str == 0 || len == 0 ) return 0; // Equal @@ -296,7 +296,7 @@ int asCString::Compare(const char *str, size_t len) const if( str == 0 ) { - if( length == 0 ) + if( length == 0 ) return 0; // Equal return -1; // The other string is smaller than this diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_string.h b/Libraries/AngelScript/sdk/angelscript/source/as_string.h index 39f0771..b7efe65 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_string.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_string.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_string_util.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_string_util.cpp index 17cbc8e..8396ccb 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_string_util.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_string_util.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -111,7 +111,7 @@ asQWORD asStringScanUInt64(const char *string, int base, size_t *numScanned) // // The function will encode the unicode code point into the outEncodedBuffer, and then -// return the length of the encoded value. If the input value is not a valid unicode code +// return the length of the encoded value. If the input value is not a valid unicode code // point, then the function will return -1. // // This function is taken from the AngelCode ToolBox. @@ -164,7 +164,7 @@ int asStringEncodeUTF8(unsigned int value, char *outEncodedBuffer) int asStringDecodeUTF8(const char *encodedBuffer, unsigned int *outLength) { const unsigned char *buf = (const unsigned char*)encodedBuffer; - + int value = 0; int length = -1; unsigned char byte = buf[0]; @@ -180,7 +180,7 @@ int asStringDecodeUTF8(const char *encodedBuffer, unsigned int *outLength) value = int(byte & 0x1F); length = 2; - // The value at this moment must not be less than 2, because + // The value at this moment must not be less than 2, because // that should have been encoded with one byte only. if( value < 2 ) length = -1; @@ -204,7 +204,7 @@ int asStringDecodeUTF8(const char *encodedBuffer, unsigned int *outLength) byte = buf[n]; if( (byte & 0xC0) == 0x80 ) value = (value << 6) + int(byte & 0x3F); - else + else break; } @@ -220,7 +220,7 @@ int asStringDecodeUTF8(const char *encodedBuffer, unsigned int *outLength) // // The function will encode the unicode code point into the outEncodedBuffer, and then -// return the length of the encoded value. If the input value is not a valid unicode code +// return the length of the encoded value. If the input value is not a valid unicode code // point, then the function will return -1. // // This function is taken from the AngelCode ToolBox. diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_string_util.h b/Libraries/AngelScript/sdk/angelscript/source/as_string_util.h index 3effa57..c3ba96a 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_string_util.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_string_util.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_texts.h b/Libraries/AngelScript/sdk/angelscript/source/as_texts.h index 7307d47..570640a 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_texts.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_texts.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_thread.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_thread.cpp index 80b9859..ea3b3e0 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_thread.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_thread.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2008 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -52,7 +52,7 @@ extern "C" AS_API int asThreadCleanup() { - // As this function can be called globally, + // As this function can be called globally, // we can't assume the threadManager exists if( threadManager ) return threadManager->CleanupLocalData(); @@ -81,7 +81,7 @@ void asCThreadManager::Release() { if( refCount.atomicDec() == 0 ) { - // The last engine has been destroyed, so we + // The last engine has been destroyed, so we // need to delete the thread manager as well asDELETE(this,asCThreadManager); threadManager = 0; @@ -99,7 +99,7 @@ asCThreadManager::~asCThreadManager() { do { - if( tldMap.GetValue(cursor) ) + if( tldMap.GetValue(cursor) ) { asDELETE(tldMap.GetValue(cursor),asCThreadLocalData); } @@ -108,7 +108,7 @@ asCThreadManager::~asCThreadManager() LEAVECRITICALSECTION(criticalSection); #else - if( tld ) + if( tld ) { asDELETE(tld,asCThreadLocalData); } @@ -132,7 +132,7 @@ int asCThreadManager::CleanupLocalData() if( tldMap.MoveTo(&cursor, id) ) { asCThreadLocalData *tld = tldMap.GetValue(cursor); - + // Can we really remove it at this time? if( tld->activeContexts.GetLength() == 0 ) { @@ -196,7 +196,7 @@ asCThreadLocalData *asCThreadManager::GetLocalData() #elif defined AS_WINDOWS_THREADS asDWORD id = GetCurrentThreadId(); #endif - + asCThreadLocalData *tld = GetLocalData(id); if( tld == 0 ) { diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_thread.h b/Libraries/AngelScript/sdk/angelscript/source/as_thread.h index d3ef920..99b0722 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_thread.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_thread.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2008 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_tokendef.h b/Libraries/AngelScript/sdk/angelscript/source/as_tokendef.h index 6d69e6e..1c36950 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_tokendef.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_tokendef.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -249,7 +249,7 @@ sTokenWord const tokenWords[] = {"int" , ttInt}, {"int8" , ttInt8}, {"int16" , ttInt16}, - {"int32" , ttInt}, + {"int32" , ttInt}, {"int64" , ttInt64}, {"interface" , ttInterface}, {"is" , ttIs}, @@ -269,7 +269,7 @@ sTokenWord const tokenWords[] = {"uint64" , ttUInt64}, {"switch" , ttSwitch}, {"class" , ttClass}, - {"case" , ttCase}, + {"case" , ttCase}, {"default" , ttDefault}, {"xor" , ttXor}, {"typedef" , ttTypedef}, diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.cpp index 52af122..f782ff8 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2009 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -115,7 +115,7 @@ asETokenClass asCTokenizer::ParseToken() bool asCTokenizer::IsWhiteSpace() { // Treat UTF8 byte-order-mark (EF BB BF) as whitespace - if( sourceLength >= 3 && + if( sourceLength >= 3 && asBYTE(source[0]) == 0xEFu && asBYTE(source[1]) == 0xBBu && asBYTE(source[2]) == 0xBFu ) @@ -304,14 +304,14 @@ bool asCTokenizer::IsConstant() // Double-byte characters are only allowed for ASCII if( (source[n] & 0x80) && engine->ep.scanner == 0 ) { - // This is a leading character in a double byte character, + // This is a leading character in a double byte character, // include both in the string and continue processing. n++; continue; } #endif - if( source[n] == '\n' ) + if( source[n] == '\n' ) tokenType = ttMultilineStringConstant; if( source[n] == quote && evenSlashes ) { @@ -392,9 +392,9 @@ bool asCTokenizer::IsKeyWord() { if( tokenWords[words[i]].word[n] == '\0' ) { - // tokens that end with a character that can be part of an - // identifier require an extra verification to guarantee that - // we don't split an identifier token, e.g. the "!is" token + // tokens that end with a character that can be part of an + // identifier require an extra verification to guarantee that + // we don't split an identifier token, e.g. the "!is" token // and the "!isTrue" expression. if( ((tokenWords[words[i]].word[n-1] >= 'a' && tokenWords[words[i]].word[n-1] <= 'z') || (tokenWords[words[i]].word[n-1] >= 'A' && tokenWords[words[i]].word[n-1] <= 'Z')) && @@ -403,13 +403,13 @@ bool asCTokenizer::IsKeyWord() (source[n] >= '0' && source[n] <= '9') || (source[n] == '_')) ) { - // The token doesn't really match, even though + // The token doesn't really match, even though // the start of the source matches the token words[i--] = words[--numWords]; } else if( numWords > 1 ) { - // It's possible that a longer token matches, so let's + // It's possible that a longer token matches, so let's // remember this match and continue searching lastPossible = words[i]; words[i--] = words[--numWords]; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.h b/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.h index 9e047d7..898e21e 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_tokenizer.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2008 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.cpp index 544571b..fdd8a87 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.h b/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.h index 3a4d3b8..93229c2 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_typeinfo.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -68,8 +68,8 @@ struct asCTypeInfo bool isExplicitHandle : 1; short dummy : 12; short stackOffset; - union - { + union + { asQWORD qwordValue; double doubleValue; asDWORD dwordValue; diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.cpp b/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.cpp index 36155c0..a1b9f46 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.cpp @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: @@ -58,7 +58,7 @@ void asCVariableScope::Reset() isContinueScope = false; for( asUINT n = 0; n < variables.GetLength(); n++ ) - if( variables[n] ) + if( variables[n] ) { asDELETE(variables[n],sVariable); } diff --git a/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.h b/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.h index 28f04f1..593b8ef 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.h +++ b/Libraries/AngelScript/sdk/angelscript/source/as_variablescope.h @@ -2,23 +2,23 @@ AngelCode Scripting Library Copyright (c) 2003-2007 Andreas Jonsson - This software is provided 'as-is', without any express or implied - warranty. In no event will the authors be held liable for any + This software is provided 'as-is', without any express or implied + warranty. In no event will the authors be held liable for any damages arising from the use of this software. - Permission is granted to anyone to use this software for any - purpose, including commercial applications, and to alter it and + Permission is granted to anyone to use this software for any + purpose, including commercial applications, and to alter it and redistribute it freely, subject to the following restrictions: - 1. The origin of this software must not be misrepresented; you + 1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use - this software in a product, an acknowledgment in the product + this software in a product, an acknowledgment in the product documentation would be appreciated but is not required. - 2. Altered source versions must be plainly marked as such, and + 2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software. - 3. This notice may not be removed or altered from any source + 3. This notice may not be removed or altered from any source distribution. The original version of this library can be located at: diff --git a/Libraries/AngelScript/sdk/angelscript/source/scriptbuilder.cpp b/Libraries/AngelScript/sdk/angelscript/source/scriptbuilder.cpp index c5c8374..6b1d56f 100644 --- a/Libraries/AngelScript/sdk/angelscript/source/scriptbuilder.cpp +++ b/Libraries/AngelScript/sdk/angelscript/source/scriptbuilder.cpp @@ -85,7 +85,7 @@ void CScriptBuilder::ClearAll() { includedScripts.clear(); -#if AS_PROCESS_METADATA == 1 +#if AS_PROCESS_METADATA == 1 foundDeclarations.clear(); typeMetadataMap.clear(); funcMetadataMap.clear(); @@ -129,7 +129,7 @@ int CScriptBuilder::LoadScriptSection(const char *filename) engine->WriteMessage(filename, 0, 0, asMSGTYPE_ERROR, msg.c_str()); return -1; } - + // Determine size of the file fseek(f, 0, SEEK_END); int len = ftell(f); @@ -145,7 +145,7 @@ int CScriptBuilder::LoadScriptSection(const char *filename) fclose(f); - if( c == 0 ) + if( c == 0 ) { // Write a message to the engine's message callback char buf[256]; @@ -221,7 +221,7 @@ int CScriptBuilder::ProcessScriptSection(const char *script, const char *section OverwriteCode(start, pos-start); nested--; } - } + } } else pos += len; @@ -256,7 +256,7 @@ int CScriptBuilder::ProcessScriptSection(const char *script, const char *section // Determine what this metadata is for int type; pos = ExtractDeclaration(pos, declaration, type); - + // Store away the declaration in a map for lookup after the build has completed if( type > 0 ) { @@ -264,7 +264,7 @@ int CScriptBuilder::ProcessScriptSection(const char *script, const char *section foundDeclarations.push_back(decl); } } - else + else #endif // Is this a preprocessor directive? if( modifiedScript[pos] == '#' ) @@ -303,7 +303,7 @@ int CScriptBuilder::ProcessScriptSection(const char *script, const char *section } } // Don't search for metadata/includes within statement blocks or between tokens in statements - else + else pos = SkipStatement(pos); } @@ -363,7 +363,7 @@ int CScriptBuilder::Build() return r; #if AS_PROCESS_METADATA == 1 - // After the script has been built, the metadata strings should be + // After the script has been built, the metadata strings should be // stored for later lookup by function id, type id, and variable index for( int n = 0; n < (int)foundDeclarations.size(); n++ ) { @@ -475,7 +475,7 @@ int CScriptBuilder::ExcludeCode(int pos) return pos; } -// Overwrite all characters except line breaks with blanks +// Overwrite all characters except line breaks with blanks void CScriptBuilder::OverwriteCode(int start, int len) { char *code = &modifiedScript[start]; @@ -596,8 +596,8 @@ int CScriptBuilder::ExtractDeclaration(int pos, string &declaration, int &type) } else if( token == "(" && varLength == 0 ) { - // This is the first parenthesis we encounter. If the parenthesis isn't followed - // by a statement block, then this is a variable declaration, in which case we + // This is the first parenthesis we encounter. If the parenthesis isn't followed + // by a statement block, then this is a variable declaration, in which case we // should only store the type and name of the variable, not the initialization parameters. varLength = (int)declaration.size(); } @@ -649,13 +649,13 @@ static const char *GetCurrentDir(char *buf, size_t size) { GetModuleFileName(NULL, apppath, MAX_PATH); - + int appLen = _tcslen(apppath); // Look for the last backslash in the path, which would be the end // of the path itself and the start of the filename. We only want // the path part of the exe's full-path filename - // Safety is that we make sure not to walk off the front of the + // Safety is that we make sure not to walk off the front of the // array (in case the path is nothing more than a filename) while (appLen > 1) { diff --git a/Libraries/Box2D/box2d.lua b/Libraries/Box2D/box2d.lua index 90090d9..d99e128 100644 --- a/Libraries/Box2D/box2d.lua +++ b/Libraries/Box2D/box2d.lua @@ -1,6 +1,6 @@ local module_filename = ModuleFilename() Libraries["box2d"] = { - Build = function(settings) + Build = function(settings) settings.cc.defines:Add("CONF_WITH_BOX2D") settings.cc.includes:Add(Path(PathDir(module_filename) .. "/sdk/include")) src = Collect(Path(PathDir(module_filename) .. "/sdk/src/*.c")) diff --git a/Libraries/Box2D/sdk/Documentation/API/_box2_d_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/_box2_d_8h_source.html index eb62cae..bac6175 100755 --- a/Libraries/Box2D/sdk/Documentation/API/_box2_d_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/_box2_d_8h_source.html @@ -39,30 +39,30 @@

Box2D/Box2D/Box2D.h

Go to the documentation of 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef BOX2D_H 00020 #define BOX2D_H 00021 00032 // These include files constitute the main Box2D API -00033 +00033 00034 #include <Box2D/Common/b2Settings.h> -00035 +00035 00036 #include <Box2D/Collision/Shapes/b2CircleShape.h> 00037 #include <Box2D/Collision/Shapes/b2PolygonShape.h> -00038 +00038 00039 #include <Box2D/Collision/b2BroadPhase.h> 00040 #include <Box2D/Collision/b2Distance.h> 00041 #include <Box2D/Collision/b2DynamicTree.h> 00042 #include <Box2D/Collision/b2TimeOfImpact.h> -00043 +00043 00044 #include <Box2D/Dynamics/b2Body.h> 00045 #include <Box2D/Dynamics/b2Fixture.h> 00046 #include <Box2D/Dynamics/b2WorldCallbacks.h> 00047 #include <Box2D/Dynamics/b2TimeStep.h> 00048 #include <Box2D/Dynamics/b2World.h> -00049 +00049 00050 #include <Box2D/Dynamics/Contacts/b2Contact.h> -00051 +00051 00052 #include <Box2D/Dynamics/Joints/b2DistanceJoint.h> 00053 #include <Box2D/Dynamics/Joints/b2FrictionJoint.h> 00054 #include <Box2D/Dynamics/Joints/b2GearJoint.h> @@ -72,7 +72,7 @@

Box2D/Box2D/Box2D.h

Go to the documentation of 00058 #include <Box2D/Dynamics/Joints/b2PulleyJoint.h> 00059 #include <Box2D/Dynamics/Joints/b2RevoluteJoint.h> 00060 #include <Box2D/Dynamics/Joints/b2WeldJoint.h> -00061 +00061 00062 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_block_allocator_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_block_allocator_8h_source.html index fd77950..19eb173 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_block_allocator_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_block_allocator_8h_source.html @@ -39,20 +39,20 @@

Box2D/Box2D/Common/b2BlockAllocator.h

00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_BLOCK_ALLOCATOR_H 00020 #define B2_BLOCK_ALLOCATOR_H 00021 00022 #include <Box2D/Common/b2Settings.h> -00023 +00023 00024 const int32 b2_chunkSize = 4096; 00025 const int32 b2_maxBlockSize = 640; 00026 const int32 b2_blockSizes = 14; 00027 const int32 b2_chunkArrayIncrement = 128; -00028 +00028 00029 struct b2Block; 00030 struct b2Chunk; -00031 +00031 00032 // This is a small object allocator used for allocating small 00033 // objects that persist for more than one time step. 00034 // See: http://www.codeproject.com/useritems/Small_Block_Allocator.asp @@ -61,25 +61,25 @@

Box2D/Box2D/Common/b2BlockAllocator.h

00037 public: 00038 b2BlockAllocator(); 00039 ~b2BlockAllocator(); -00040 +00040 00041 void* Allocate(int32 size); 00042 void Free(void* p, int32 size); -00043 +00043 00044 void Clear(); -00045 +00045 00046 private: -00047 +00047 00048 b2Chunk* m_chunks; 00049 int32 m_chunkCount; 00050 int32 m_chunkSpace; -00051 +00051 00052 b2Block* m_freeLists[b2_blockSizes]; -00053 +00053 00054 static int32 s_blockSizes[b2_blockSizes]; 00055 static uint8 s_blockSizeLookup[b2_maxBlockSize + 1]; 00056 static bool s_blockSizeLookupInitialized; 00057 }; -00058 +00058 00059 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_body_8h.html b/Libraries/Box2D/sdk/Documentation/API/b2_body_8h.html index 6cda50c..d3d6ddb 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_body_8h.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_body_8h.html @@ -35,8 +35,8 @@

Box2D/Box2D/Dynamics/b2Body.h File Reference

#include <class  b2Body  A rigid body. These are created via b2World::CreateBody. More...

Enumerations

-enum  b2BodyType { b2_staticBody = 0, -b2_kinematicBody, +enum  b2BodyType { b2_staticBody = 0, +b2_kinematicBody, b2_dynamicBody } diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_body_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_body_8h_source.html index 9a542b3..d97f28c 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_body_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_body_8h_source.html @@ -39,14 +39,14 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_BODY_H 00020 #define B2_BODY_H 00021 00022 #include <Box2D/Common/b2Math.h> 00023 #include <Box2D/Collision/Shapes/b2Shape.h> 00024 #include <memory> -00025 +00025 00026 class b2Fixture; 00027 class b2Joint; 00028 class b2Contact; @@ -55,14 +55,14 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00031 struct b2FixtureDef; 00032 struct b2JointEdge; 00033 struct b2ContactEdge; -00034 +00034 00039 enum b2BodyType 00040 { 00041 b2_staticBody = 0, 00042 b2_kinematicBody, 00043 b2_dynamicBody, 00044 }; -00045 +00045 00048 struct b2BodyDef 00049 { 00051 b2BodyDef() @@ -82,154 +82,154 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00065 active = true; 00066 inertiaScale = 1.0f; 00067 } -00068 +00068 00071 b2BodyType type; -00072 +00072 00075 b2Vec2 position; -00076 +00076 00078 float32 angle; -00079 +00079 00081 b2Vec2 linearVelocity; -00082 +00082 00084 float32 angularVelocity; -00085 +00085 00089 float32 linearDamping; -00090 +00090 00094 float32 angularDamping; -00095 +00095 00098 bool allowSleep; -00099 +00099 00101 bool awake; -00102 +00102 00104 bool fixedRotation; -00105 +00105 00110 bool bullet; -00111 +00111 00113 bool active; -00114 +00114 00116 void* userData; -00117 +00117 00119 float32 inertiaScale; 00120 }; -00121 +00121 00123 class b2Body 00124 { 00125 public: 00133 b2Fixture* CreateFixture(const b2FixtureDef* def); -00134 +00134 00142 b2Fixture* CreateFixture(const b2Shape* shape, float32 density); -00143 +00143 00151 void DestroyFixture(b2Fixture* fixture); -00152 +00152 00158 void SetTransform(const b2Vec2& position, float32 angle); -00159 +00159 00162 const b2Transform& GetTransform() const; -00163 +00163 00166 const b2Vec2& GetPosition() const; -00167 +00167 00170 float32 GetAngle() const; -00171 +00171 00173 const b2Vec2& GetWorldCenter() const; -00174 +00174 00176 const b2Vec2& GetLocalCenter() const; -00177 +00177 00180 void SetLinearVelocity(const b2Vec2& v); -00181 +00181 00184 b2Vec2 GetLinearVelocity() const; -00185 +00185 00188 void SetAngularVelocity(float32 omega); -00189 +00189 00192 float32 GetAngularVelocity() const; -00193 +00193 00199 void ApplyForce(const b2Vec2& force, const b2Vec2& point); -00200 +00200 00205 void ApplyTorque(float32 torque); -00206 +00206 00212 void ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point); -00213 +00213 00216 void ApplyAngularImpulse(float32 impulse); -00217 +00217 00220 float32 GetMass() const; -00221 +00221 00224 float32 GetInertia() const; -00225 +00225 00228 void GetMassData(b2MassData* data) const; -00229 +00229 00235 void SetMassData(const b2MassData* data); -00236 +00236 00240 void ResetMassData(); -00241 +00241 00245 b2Vec2 GetWorldPoint(const b2Vec2& localPoint) const; -00246 +00246 00250 b2Vec2 GetWorldVector(const b2Vec2& localVector) const; -00251 +00251 00255 b2Vec2 GetLocalPoint(const b2Vec2& worldPoint) const; -00256 +00256 00260 b2Vec2 GetLocalVector(const b2Vec2& worldVector) const; -00261 +00261 00265 b2Vec2 GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const; -00266 +00266 00270 b2Vec2 GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const; -00271 +00271 00273 float32 GetLinearDamping() const; -00274 +00274 00276 void SetLinearDamping(float32 linearDamping); -00277 +00277 00279 float32 GetAngularDamping() const; -00280 +00280 00282 void SetAngularDamping(float32 angularDamping); -00283 +00283 00285 void SetType(b2BodyType type); -00286 +00286 00288 b2BodyType GetType() const; -00289 +00289 00291 void SetBullet(bool flag); -00292 +00292 00294 bool IsBullet() const; -00295 +00295 00298 void SetSleepingAllowed(bool flag); -00299 +00299 00301 bool IsSleepingAllowed() const; -00302 +00302 00306 void SetAwake(bool flag); -00307 +00307 00310 bool IsAwake() const; -00311 +00311 00325 void SetActive(bool flag); -00326 +00326 00328 bool IsActive() const; -00329 +00329 00332 void SetFixedRotation(bool flag); -00333 +00333 00335 bool IsFixedRotation() const; -00336 +00336 00338 b2Fixture* GetFixtureList(); 00339 const b2Fixture* GetFixtureList() const; -00340 +00340 00342 b2JointEdge* GetJointList(); 00343 const b2JointEdge* GetJointList() const; -00344 +00344 00348 b2ContactEdge* GetContactList(); 00349 const b2ContactEdge* GetContactList() const; -00350 +00350 00352 b2Body* GetNext(); 00353 const b2Body* GetNext() const; -00354 +00354 00356 void* GetUserData() const; -00357 +00357 00359 void SetUserData(void* data); -00360 +00360 00362 b2World* GetWorld(); 00363 const b2World* GetWorld() const; -00364 +00364 00365 private: -00366 +00366 00367 friend class b2World; 00368 friend class b2Island; 00369 friend class b2ContactManager; 00370 friend class b2ContactSolver; 00371 friend class b2TOISolver; -00372 +00372 00373 friend class b2DistanceJoint; 00374 friend class b2GearJoint; 00375 friend class b2LineJoint; @@ -239,7 +239,7 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00379 friend class b2RevoluteJoint; 00380 friend class b2WeldJoint; 00381 friend class b2FrictionJoint; -00382 +00382 00383 // m_flags 00384 enum 00385 { @@ -251,194 +251,194 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00391 e_activeFlag = 0x0020, 00392 e_toiFlag = 0x0040, 00393 }; -00394 +00394 00395 b2Body(const b2BodyDef* bd, b2World* world); 00396 ~b2Body(); -00397 +00397 00398 void SynchronizeFixtures(); 00399 void SynchronizeTransform(); -00400 +00400 00401 // This is used to prevent connected bodies from colliding. 00402 // It may lie, depending on the collideConnected flag. 00403 bool ShouldCollide(const b2Body* other) const; -00404 +00404 00405 void Advance(float32 t); -00406 +00406 00407 b2BodyType m_type; -00408 +00408 00409 uint16 m_flags; -00410 +00410 00411 int32 m_islandIndex; -00412 +00412 00413 b2Transform m_xf; // the body origin transform 00414 b2Sweep m_sweep; // the swept motion for CCD -00415 +00415 00416 b2Vec2 m_linearVelocity; 00417 float32 m_angularVelocity; -00418 +00418 00419 b2Vec2 m_force; 00420 float32 m_torque; -00421 +00421 00422 b2World* m_world; 00423 b2Body* m_prev; 00424 b2Body* m_next; -00425 +00425 00426 b2Fixture* m_fixtureList; 00427 int32 m_fixtureCount; -00428 +00428 00429 b2JointEdge* m_jointList; 00430 b2ContactEdge* m_contactList; -00431 +00431 00432 float32 m_mass, m_invMass; -00433 +00433 00434 // Rotational inertia about the center of mass. 00435 float32 m_I, m_invI; -00436 +00436 00437 float32 m_linearDamping; 00438 float32 m_angularDamping; -00439 +00439 00440 float32 m_sleepTime; -00441 +00441 00442 void* m_userData; 00443 }; -00444 +00444 00445 inline b2BodyType b2Body::GetType() const 00446 { 00447 return m_type; 00448 } -00449 +00449 00450 inline const b2Transform& b2Body::GetTransform() const 00451 { 00452 return m_xf; 00453 } -00454 +00454 00455 inline const b2Vec2& b2Body::GetPosition() const 00456 { 00457 return m_xf.position; 00458 } -00459 +00459 00460 inline float32 b2Body::GetAngle() const 00461 { 00462 return m_sweep.a; 00463 } -00464 +00464 00465 inline const b2Vec2& b2Body::GetWorldCenter() const 00466 { 00467 return m_sweep.c; 00468 } -00469 +00469 00470 inline const b2Vec2& b2Body::GetLocalCenter() const 00471 { 00472 return m_sweep.localCenter; 00473 } -00474 +00474 00475 inline void b2Body::SetLinearVelocity(const b2Vec2& v) 00476 { 00477 if (m_type == b2_staticBody) 00478 { 00479 return; 00480 } -00481 +00481 00482 if (b2Dot(v,v) > 0.0f) 00483 { 00484 SetAwake(true); 00485 } -00486 +00486 00487 m_linearVelocity = v; 00488 } -00489 +00489 00490 inline b2Vec2 b2Body::GetLinearVelocity() const 00491 { 00492 return m_linearVelocity; 00493 } -00494 +00494 00495 inline void b2Body::SetAngularVelocity(float32 w) 00496 { 00497 if (m_type == b2_staticBody) 00498 { 00499 return; 00500 } -00501 +00501 00502 if (w * w > 0.0f) 00503 { 00504 SetAwake(true); 00505 } -00506 +00506 00507 m_angularVelocity = w; 00508 } -00509 +00509 00510 inline float32 b2Body::GetAngularVelocity() const 00511 { 00512 return m_angularVelocity; 00513 } -00514 +00514 00515 inline float32 b2Body::GetMass() const 00516 { 00517 return m_mass; 00518 } -00519 +00519 00520 inline float32 b2Body::GetInertia() const 00521 { 00522 return m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter); 00523 } -00524 +00524 00525 inline void b2Body::GetMassData(b2MassData* data) const 00526 { 00527 data->mass = m_mass; 00528 data->I = m_I + m_mass * b2Dot(m_sweep.localCenter, m_sweep.localCenter); 00529 data->center = m_sweep.localCenter; 00530 } -00531 +00531 00532 inline b2Vec2 b2Body::GetWorldPoint(const b2Vec2& localPoint) const 00533 { 00534 return b2Mul(m_xf, localPoint); 00535 } -00536 +00536 00537 inline b2Vec2 b2Body::GetWorldVector(const b2Vec2& localVector) const 00538 { 00539 return b2Mul(m_xf.R, localVector); 00540 } -00541 +00541 00542 inline b2Vec2 b2Body::GetLocalPoint(const b2Vec2& worldPoint) const 00543 { 00544 return b2MulT(m_xf, worldPoint); 00545 } -00546 +00546 00547 inline b2Vec2 b2Body::GetLocalVector(const b2Vec2& worldVector) const 00548 { 00549 return b2MulT(m_xf.R, worldVector); 00550 } -00551 +00551 00552 inline b2Vec2 b2Body::GetLinearVelocityFromWorldPoint(const b2Vec2& worldPoint) const 00553 { 00554 return m_linearVelocity + b2Cross(m_angularVelocity, worldPoint - m_sweep.c); 00555 } -00556 +00556 00557 inline b2Vec2 b2Body::GetLinearVelocityFromLocalPoint(const b2Vec2& localPoint) const 00558 { 00559 return GetLinearVelocityFromWorldPoint(GetWorldPoint(localPoint)); 00560 } -00561 +00561 00562 inline float32 b2Body::GetLinearDamping() const 00563 { 00564 return m_linearDamping; 00565 } -00566 +00566 00567 inline void b2Body::SetLinearDamping(float32 linearDamping) 00568 { 00569 m_linearDamping = linearDamping; 00570 } -00571 +00571 00572 inline float32 b2Body::GetAngularDamping() const 00573 { 00574 return m_angularDamping; 00575 } -00576 +00576 00577 inline void b2Body::SetAngularDamping(float32 angularDamping) 00578 { 00579 m_angularDamping = angularDamping; 00580 } -00581 +00581 00582 inline void b2Body::SetBullet(bool flag) 00583 { 00584 if (flag) @@ -450,12 +450,12 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00590 m_flags &= ~e_bulletFlag; 00591 } 00592 } -00593 +00593 00594 inline bool b2Body::IsBullet() const 00595 { 00596 return (m_flags & e_bulletFlag) == e_bulletFlag; 00597 } -00598 +00598 00599 inline void b2Body::SetAwake(bool flag) 00600 { 00601 if (flag) @@ -476,17 +476,17 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00616 m_torque = 0.0f; 00617 } 00618 } -00619 +00619 00620 inline bool b2Body::IsAwake() const 00621 { 00622 return (m_flags & e_awakeFlag) == e_awakeFlag; 00623 } -00624 +00624 00625 inline bool b2Body::IsActive() const 00626 { 00627 return (m_flags & e_activeFlag) == e_activeFlag; 00628 } -00629 +00629 00630 inline void b2Body::SetFixedRotation(bool flag) 00631 { 00632 if (flag) @@ -497,15 +497,15 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00637 { 00638 m_flags &= ~e_fixedRotationFlag; 00639 } -00640 +00640 00641 ResetMassData(); 00642 } -00643 +00643 00644 inline bool b2Body::IsFixedRotation() const 00645 { 00646 return (m_flags & e_fixedRotationFlag) == e_fixedRotationFlag; 00647 } -00648 +00648 00649 inline void b2Body::SetSleepingAllowed(bool flag) 00650 { 00651 if (flag) @@ -518,100 +518,100 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00658 SetAwake(true); 00659 } 00660 } -00661 +00661 00662 inline bool b2Body::IsSleepingAllowed() const 00663 { 00664 return (m_flags & e_autoSleepFlag) == e_autoSleepFlag; 00665 } -00666 +00666 00667 inline b2Fixture* b2Body::GetFixtureList() 00668 { 00669 return m_fixtureList; 00670 } -00671 +00671 00672 inline const b2Fixture* b2Body::GetFixtureList() const 00673 { 00674 return m_fixtureList; 00675 } -00676 +00676 00677 inline b2JointEdge* b2Body::GetJointList() 00678 { 00679 return m_jointList; 00680 } -00681 +00681 00682 inline const b2JointEdge* b2Body::GetJointList() const 00683 { 00684 return m_jointList; 00685 } -00686 +00686 00687 inline b2ContactEdge* b2Body::GetContactList() 00688 { 00689 return m_contactList; 00690 } -00691 +00691 00692 inline const b2ContactEdge* b2Body::GetContactList() const 00693 { 00694 return m_contactList; 00695 } -00696 +00696 00697 inline b2Body* b2Body::GetNext() 00698 { 00699 return m_next; 00700 } -00701 +00701 00702 inline const b2Body* b2Body::GetNext() const 00703 { 00704 return m_next; 00705 } -00706 +00706 00707 inline void b2Body::SetUserData(void* data) 00708 { 00709 m_userData = data; 00710 } -00711 +00711 00712 inline void* b2Body::GetUserData() const 00713 { 00714 return m_userData; 00715 } -00716 +00716 00717 inline void b2Body::ApplyForce(const b2Vec2& force, const b2Vec2& point) 00718 { 00719 if (m_type != b2_dynamicBody) 00720 { 00721 return; 00722 } -00723 +00723 00724 if (IsAwake() == false) 00725 { 00726 SetAwake(true); 00727 } -00728 +00728 00729 m_force += force; 00730 m_torque += b2Cross(point - m_sweep.c, force); 00731 } -00732 +00732 00733 inline void b2Body::ApplyTorque(float32 torque) 00734 { 00735 if (m_type != b2_dynamicBody) 00736 { 00737 return; 00738 } -00739 +00739 00740 if (IsAwake() == false) 00741 { 00742 SetAwake(true); 00743 } -00744 +00744 00745 m_torque += torque; 00746 } -00747 +00747 00748 inline void b2Body::ApplyLinearImpulse(const b2Vec2& impulse, const b2Vec2& point) 00749 { 00750 if (m_type != b2_dynamicBody) 00751 { 00752 return; 00753 } -00754 +00754 00755 if (IsAwake() == false) 00756 { 00757 SetAwake(true); @@ -619,27 +619,27 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00759 m_linearVelocity += m_invMass * impulse; 00760 m_angularVelocity += m_invI * b2Cross(point - m_sweep.c, impulse); 00761 } -00762 +00762 00763 inline void b2Body::ApplyAngularImpulse(float32 impulse) 00764 { 00765 if (m_type != b2_dynamicBody) 00766 { 00767 return; 00768 } -00769 +00769 00770 if (IsAwake() == false) 00771 { 00772 SetAwake(true); 00773 } 00774 m_angularVelocity += m_invI * impulse; 00775 } -00776 +00776 00777 inline void b2Body::SynchronizeTransform() 00778 { 00779 m_xf.R.Set(m_sweep.a); 00780 m_xf.position = m_sweep.c - b2Mul(m_xf.R, m_sweep.localCenter); 00781 } -00782 +00782 00783 inline void b2Body::Advance(float32 t) 00784 { 00785 // Advance to the new safe time. @@ -648,17 +648,17 @@

Box2D/Box2D/Dynamics/b2Body.h

Go to the docume 00788 m_sweep.a = m_sweep.a0; 00789 SynchronizeTransform(); 00790 } -00791 +00791 00792 inline b2World* b2Body::GetWorld() 00793 { 00794 return m_world; 00795 } -00796 +00796 00797 inline const b2World* b2Body::GetWorld() const 00798 { 00799 return m_world; 00800 } -00801 +00801 00802 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_broad_phase_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_broad_phase_8h_source.html index ac42ba3..2eeb46f 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_broad_phase_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_broad_phase_8h_source.html @@ -39,7 +39,7 @@

Box2D/Box2D/Collision/b2BroadPhase.h

Go 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_BROAD_PHASE_H 00020 #define B2_BROAD_PHASE_H 00021 @@ -47,123 +47,123 @@

Box2D/Box2D/Collision/b2BroadPhase.h

Go 00023 #include <Box2D/Collision/b2Collision.h> 00024 #include <Box2D/Collision/b2DynamicTree.h> 00025 #include <algorithm> -00026 +00026 00027 struct b2Pair 00028 { 00029 int32 proxyIdA; 00030 int32 proxyIdB; 00031 int32 next; 00032 }; -00033 +00033 00037 class b2BroadPhase 00038 { 00039 public: -00040 +00040 00041 enum 00042 { 00043 e_nullProxy = -1, 00044 }; -00045 +00045 00046 b2BroadPhase(); 00047 ~b2BroadPhase(); -00048 +00048 00051 int32 CreateProxy(const b2AABB& aabb, void* userData); -00052 +00052 00054 void DestroyProxy(int32 proxyId); -00055 +00055 00058 void MoveProxy(int32 proxyId, const b2AABB& aabb, const b2Vec2& displacement); -00059 +00059 00061 const b2AABB& GetFatAABB(int32 proxyId) const; -00062 +00062 00064 void* GetUserData(int32 proxyId) const; -00065 +00065 00067 bool TestOverlap(int32 proxyIdA, int32 proxyIdB) const; -00068 +00068 00070 int32 GetProxyCount() const; -00071 +00071 00073 template <typename T> 00074 void UpdatePairs(T* callback); -00075 +00075 00078 template <typename T> 00079 void Query(T* callback, const b2AABB& aabb) const; -00080 +00080 00088 template <typename T> 00089 void RayCast(T* callback, const b2RayCastInput& input) const; -00090 +00090 00092 int32 ComputeHeight() const; -00093 +00093 00094 private: -00095 +00095 00096 friend class b2DynamicTree; -00097 +00097 00098 void BufferMove(int32 proxyId); 00099 void UnBufferMove(int32 proxyId); -00100 +00100 00101 bool QueryCallback(int32 proxyId); -00102 +00102 00103 b2DynamicTree m_tree; -00104 +00104 00105 int32 m_proxyCount; -00106 +00106 00107 int32* m_moveBuffer; 00108 int32 m_moveCapacity; 00109 int32 m_moveCount; -00110 +00110 00111 b2Pair* m_pairBuffer; 00112 int32 m_pairCapacity; 00113 int32 m_pairCount; -00114 +00114 00115 int32 m_queryProxyId; 00116 }; -00117 +00117 00119 inline bool b2PairLessThan(const b2Pair& pair1, const b2Pair& pair2) 00120 { 00121 if (pair1.proxyIdA < pair2.proxyIdA) 00122 { 00123 return true; 00124 } -00125 +00125 00126 if (pair1.proxyIdA == pair2.proxyIdA) 00127 { 00128 return pair1.proxyIdB < pair2.proxyIdB; 00129 } -00130 +00130 00131 return false; 00132 } -00133 +00133 00134 inline void* b2BroadPhase::GetUserData(int32 proxyId) const 00135 { 00136 return m_tree.GetUserData(proxyId); 00137 } -00138 +00138 00139 inline bool b2BroadPhase::TestOverlap(int32 proxyIdA, int32 proxyIdB) const 00140 { 00141 const b2AABB& aabbA = m_tree.GetFatAABB(proxyIdA); 00142 const b2AABB& aabbB = m_tree.GetFatAABB(proxyIdB); 00143 return b2TestOverlap(aabbA, aabbB); 00144 } -00145 +00145 00146 inline const b2AABB& b2BroadPhase::GetFatAABB(int32 proxyId) const 00147 { 00148 return m_tree.GetFatAABB(proxyId); 00149 } -00150 +00150 00151 inline int32 b2BroadPhase::GetProxyCount() const 00152 { 00153 return m_proxyCount; 00154 } -00155 +00155 00156 inline int32 b2BroadPhase::ComputeHeight() const 00157 { 00158 return m_tree.ComputeHeight(); 00159 } -00160 +00160 00161 template <typename T> 00162 void b2BroadPhase::UpdatePairs(T* callback) 00163 { 00164 // Reset pair buffer 00165 m_pairCount = 0; -00166 +00166 00167 // Perform tree queries for all moving proxies. 00168 for (int32 i = 0; i < m_moveCount; ++i) 00169 { @@ -172,21 +172,21 @@

Box2D/Box2D/Collision/b2BroadPhase.h

Go 00172 { 00173 continue; 00174 } -00175 +00175 00176 // We have to query the tree with the fat AABB so that 00177 // we don't fail to create a pair that may touch later. 00178 const b2AABB& fatAABB = m_tree.GetFatAABB(m_queryProxyId); -00179 +00179 00180 // Query tree, create pairs and add them pair buffer. 00181 m_tree.Query(this, fatAABB); 00182 } -00183 +00183 00184 // Reset move buffer 00185 m_moveCount = 0; -00186 +00186 00187 // Sort the pair buffer to expose duplicates. 00188 std::sort(m_pairBuffer, m_pairBuffer + m_pairCount, b2PairLessThan); -00189 +00189 00190 // Send the pairs back to the client. 00191 int32 i = 0; 00192 while (i < m_pairCount) @@ -194,10 +194,10 @@

Box2D/Box2D/Collision/b2BroadPhase.h

Go 00194 b2Pair* primaryPair = m_pairBuffer + i; 00195 void* userDataA = m_tree.GetUserData(primaryPair->proxyIdA); 00196 void* userDataB = m_tree.GetUserData(primaryPair->proxyIdB); -00197 +00197 00198 callback->AddPair(userDataA, userDataB); 00199 ++i; -00200 +00200 00201 // Skip any duplicate pairs. 00202 while (i < m_pairCount) 00203 { @@ -209,23 +209,23 @@

Box2D/Box2D/Collision/b2BroadPhase.h

Go 00209 ++i; 00210 } 00211 } -00212 +00212 00213 // Try to keep the tree balanced. 00214 m_tree.Rebalance(4); 00215 } -00216 +00216 00217 template <typename T> 00218 inline void b2BroadPhase::Query(T* callback, const b2AABB& aabb) const 00219 { 00220 m_tree.Query(callback, aabb); 00221 } -00222 +00222 00223 template <typename T> 00224 inline void b2BroadPhase::RayCast(T* callback, const b2RayCastInput& input) const 00225 { 00226 m_tree.RayCast(callback, input); 00227 } -00228 +00228 00229 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_circle_contact_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_circle_contact_8h_source.html index e26678e..62485f1 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_circle_contact_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_circle_contact_8h_source.html @@ -39,26 +39,26 @@

Box2D/Box2D/Dynamics/Contacts/b2CircleContact.h

00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_CIRCLE_CONTACT_H 00020 #define B2_CIRCLE_CONTACT_H 00021 00022 #include <Box2D/Dynamics/Contacts/b2Contact.h> -00023 +00023 00024 class b2BlockAllocator; -00025 +00025 00026 class b2CircleContact : public b2Contact 00027 { 00028 public: 00029 static b2Contact* Create(b2Fixture* fixtureA, b2Fixture* fixtureB, b2BlockAllocator* allocator); 00030 static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); -00031 +00031 00032 b2CircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 00033 ~b2CircleContact() {} -00034 +00034 00035 void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 00036 }; -00037 +00037 00038 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_circle_shape_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_circle_shape_8h_source.html index 5a01bf4..a80278d 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_circle_shape_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_circle_shape_8h_source.html @@ -39,64 +39,64 @@

Box2D/Box2D/Collision/Shapes/b2CircleShape.h

00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_CIRCLE_SHAPE_H 00020 #define B2_CIRCLE_SHAPE_H 00021 00022 #include <Box2D/Collision/Shapes/b2Shape.h> -00023 +00023 00025 class b2CircleShape : public b2Shape 00026 { 00027 public: 00028 b2CircleShape(); -00029 +00029 00031 b2Shape* Clone(b2BlockAllocator* allocator) const; -00032 +00032 00034 bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; -00035 +00035 00037 bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, const b2Transform& transform) const; -00038 +00038 00040 void ComputeAABB(b2AABB* aabb, const b2Transform& transform) const; -00041 +00041 00043 void ComputeMass(b2MassData* massData, float32 density) const; -00044 +00044 00046 int32 GetSupport(const b2Vec2& d) const; -00047 +00047 00049 const b2Vec2& GetSupportVertex(const b2Vec2& d) const; -00050 +00050 00052 int32 GetVertexCount() const { return 1; } -00053 +00053 00055 const b2Vec2& GetVertex(int32 index) const; -00056 +00056 00058 b2Vec2 m_p; 00059 }; -00060 +00060 00061 inline b2CircleShape::b2CircleShape() 00062 { 00063 m_type = e_circle; 00064 m_radius = 0.0f; 00065 m_p.SetZero(); 00066 } -00067 +00067 00068 inline int32 b2CircleShape::GetSupport(const b2Vec2 &d) const 00069 { 00070 B2_NOT_USED(d); 00071 return 0; 00072 } -00073 +00073 00074 inline const b2Vec2& b2CircleShape::GetSupportVertex(const b2Vec2 &d) const 00075 { 00076 B2_NOT_USED(d); 00077 return m_p; 00078 } -00079 +00079 00080 inline const b2Vec2& b2CircleShape::GetVertex(int32 index) const 00081 { 00082 B2_NOT_USED(index); 00083 b2Assert(index == 0); 00084 return m_p; 00085 } -00086 +00086 00087 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h.html b/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h.html index 7669e45..8e17b00 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h.html @@ -46,9 +46,9 @@

Box2D/Box2D/Collision/b2Collision.h File Reference

#include <struct  b2AABB  An axis aligned bounding box. More...

Enumerations

-enum  b2PointState { b2_nullState, -b2_addState, -b2_persistState, +enum  b2PointState { b2_nullState, +b2_addState, +b2_persistState, b2_removeState }  

This is used for determining the state of contact points.

diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h_source.html index 3ba7960..8186e66 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_collision_8h_source.html @@ -39,40 +39,40 @@

Box2D/Box2D/Collision/b2Collision.h

Go to 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_COLLISION_H 00020 #define B2_COLLISION_H 00021 00022 #include <Box2D/Common/b2Math.h> 00023 #include <climits> -00024 -00028 +00024 +00028 00029 class b2Shape; 00030 class b2CircleShape; 00031 class b2PolygonShape; -00032 +00032 00033 const uint8 b2_nullFeature = UCHAR_MAX; -00034 +00034 00036 union b2ContactID 00037 { 00039 struct Features 00040 { -00041 uint8 referenceEdge; -00042 uint8 incidentEdge; -00043 uint8 incidentVertex; -00044 uint8 flip; +00041 uint8 referenceEdge; +00042 uint8 incidentEdge; +00043 uint8 incidentVertex; +00044 uint8 flip; 00045 } features; -00046 uint32 key; +00046 uint32 key; 00047 }; -00048 +00048 00059 struct b2ManifoldPoint 00060 { -00061 b2Vec2 localPoint; -00062 float32 normalImpulse; -00063 float32 tangentImpulse; -00064 b2ContactID id; +00061 b2Vec2 localPoint; +00062 float32 normalImpulse; +00063 float32 tangentImpulse; +00064 b2ContactID id; 00065 }; -00066 +00066 00083 struct b2Manifold 00084 { 00085 enum Type @@ -81,73 +81,73 @@

Box2D/Box2D/Collision/b2Collision.h

Go to 00088 e_faceA, 00089 e_faceB 00090 }; -00091 -00092 b2ManifoldPoint points[b2_maxManifoldPoints]; -00093 b2Vec2 localNormal; -00094 b2Vec2 localPoint; +00091 +00092 b2ManifoldPoint points[b2_maxManifoldPoints]; +00093 b2Vec2 localNormal; +00094 b2Vec2 localPoint; 00095 Type type; -00096 int32 pointCount; +00096 int32 pointCount; 00097 }; -00098 +00098 00100 struct b2WorldManifold 00101 { 00106 void Initialize(const b2Manifold* manifold, 00107 const b2Transform& xfA, float32 radiusA, 00108 const b2Transform& xfB, float32 radiusB); -00109 -00110 b2Vec2 normal; -00111 b2Vec2 points[b2_maxManifoldPoints]; +00109 +00110 b2Vec2 normal; +00111 b2Vec2 points[b2_maxManifoldPoints]; 00112 }; -00113 +00113 00115 enum b2PointState 00116 { -00117 b2_nullState, -00118 b2_addState, -00119 b2_persistState, -00120 b2_removeState +00117 b2_nullState, +00118 b2_addState, +00119 b2_persistState, +00120 b2_removeState 00121 }; -00122 +00122 00125 void b2GetPointStates(b2PointState state1[b2_maxManifoldPoints], b2PointState state2[b2_maxManifoldPoints], 00126 const b2Manifold* manifold1, const b2Manifold* manifold2); -00127 +00127 00129 struct b2ClipVertex 00130 { 00131 b2Vec2 v; 00132 b2ContactID id; 00133 }; -00134 +00134 00136 struct b2RayCastInput 00137 { 00138 b2Vec2 p1, p2; 00139 float32 maxFraction; 00140 }; -00141 +00141 00144 struct b2RayCastOutput 00145 { 00146 b2Vec2 normal; 00147 float32 fraction; 00148 }; -00149 +00149 00151 struct b2AABB 00152 { 00154 bool IsValid() const; -00155 +00155 00157 b2Vec2 GetCenter() const 00158 { 00159 return 0.5f * (lowerBound + upperBound); 00160 } -00161 +00161 00163 b2Vec2 GetExtents() const 00164 { 00165 return 0.5f * (upperBound - lowerBound); 00166 } -00167 +00167 00169 void Combine(const b2AABB& aabb1, const b2AABB& aabb2) 00170 { 00171 lowerBound = b2Min(aabb1.lowerBound, aabb2.lowerBound); 00172 upperBound = b2Max(aabb1.upperBound, aabb2.upperBound); 00173 } -00174 +00174 00176 bool Contains(const b2AABB& aabb) const 00177 { 00178 bool result = true; @@ -157,33 +157,33 @@

Box2D/Box2D/Collision/b2Collision.h

Go to 00182 result = result && aabb.upperBound.y <= upperBound.y; 00183 return result; 00184 } -00185 +00185 00186 bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input) const; -00187 -00188 b2Vec2 lowerBound; -00189 b2Vec2 upperBound; +00187 +00188 b2Vec2 lowerBound; +00189 b2Vec2 upperBound; 00190 }; -00191 +00191 00193 void b2CollideCircles(b2Manifold* manifold, 00194 const b2CircleShape* circle1, const b2Transform& xf1, 00195 const b2CircleShape* circle2, const b2Transform& xf2); -00196 +00196 00198 void b2CollidePolygonAndCircle(b2Manifold* manifold, 00199 const b2PolygonShape* polygon, const b2Transform& xf1, 00200 const b2CircleShape* circle, const b2Transform& xf2); -00201 +00201 00203 void b2CollidePolygons(b2Manifold* manifold, 00204 const b2PolygonShape* polygon1, const b2Transform& xf1, 00205 const b2PolygonShape* polygon2, const b2Transform& xf2); -00206 +00206 00208 int32 b2ClipSegmentToLine(b2ClipVertex vOut[2], const b2ClipVertex vIn[2], 00209 const b2Vec2& normal, float32 offset); -00210 +00210 00212 bool b2TestOverlap(const b2Shape* shapeA, const b2Shape* shapeB, 00213 const b2Transform& xfA, const b2Transform& xfB); -00214 +00214 00215 // ---------------- Inline Functions ------------------------------------------ -00216 +00216 00217 inline bool b2AABB::IsValid() const 00218 { 00219 b2Vec2 d = upperBound - lowerBound; @@ -191,22 +191,22 @@

Box2D/Box2D/Collision/b2Collision.h

Go to 00221 valid = valid && lowerBound.IsValid() && upperBound.IsValid(); 00222 return valid; 00223 } -00224 +00224 00225 inline bool b2TestOverlap(const b2AABB& a, const b2AABB& b) 00226 { 00227 b2Vec2 d1, d2; 00228 d1 = b.lowerBound - a.upperBound; 00229 d2 = a.lowerBound - b.upperBound; -00230 +00230 00231 if (d1.x > 0.0f || d1.y > 0.0f) 00232 return false; -00233 +00233 00234 if (d2.x > 0.0f || d2.y > 0.0f) 00235 return false; -00236 +00236 00237 return true; 00238 } -00239 +00239 00240 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_contact_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_contact_8h_source.html index 8a4d7ac..0fbdd54 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_contact_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_contact_8h_source.html @@ -39,7 +39,7 @@

Box2D/Box2D/Dynamics/Contacts/b2Contact.h

G 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_CONTACT_H 00020 #define B2_CONTACT_H 00021 @@ -48,7 +48,7 @@

Box2D/Box2D/Dynamics/Contacts/b2Contact.h

G 00024 #include <Box2D/Collision/Shapes/b2Shape.h> 00025 #include <Box2D/Dynamics/Contacts/b2Contact.h> 00026 #include <Box2D/Dynamics/b2Fixture.h> -00027 +00027 00028 class b2Body; 00029 class b2Contact; 00030 class b2Fixture; @@ -56,131 +56,131 @@

Box2D/Box2D/Dynamics/Contacts/b2Contact.h

G 00032 class b2BlockAllocator; 00033 class b2StackAllocator; 00034 class b2ContactListener; -00035 +00035 00036 typedef b2Contact* b2ContactCreateFcn(b2Fixture* fixtureA, b2Fixture* fixtureB, b2BlockAllocator* allocator); 00037 typedef void b2ContactDestroyFcn(b2Contact* contact, b2BlockAllocator* allocator); -00038 +00038 00039 struct b2ContactRegister 00040 { 00041 b2ContactCreateFcn* createFcn; 00042 b2ContactDestroyFcn* destroyFcn; 00043 bool primary; 00044 }; -00045 +00045 00051 struct b2ContactEdge 00052 { -00053 b2Body* other; -00054 b2Contact* contact; -00055 b2ContactEdge* prev; -00056 b2ContactEdge* next; +00053 b2Body* other; +00054 b2Contact* contact; +00055 b2ContactEdge* prev; +00056 b2ContactEdge* next; 00057 }; -00058 +00058 00062 class b2Contact 00063 { 00064 public: -00065 +00065 00068 b2Manifold* GetManifold(); 00069 const b2Manifold* GetManifold() const; -00070 +00070 00072 void GetWorldManifold(b2WorldManifold* worldManifold) const; -00073 +00073 00075 bool IsTouching() const; -00076 +00076 00080 void SetEnabled(bool flag); -00081 +00081 00083 bool IsEnabled() const; -00084 +00084 00086 b2Contact* GetNext(); 00087 const b2Contact* GetNext() const; -00088 +00088 00090 b2Fixture* GetFixtureA(); 00091 const b2Fixture* GetFixtureA() const; -00092 +00092 00094 b2Fixture* GetFixtureB(); 00095 const b2Fixture* GetFixtureB() const; -00096 +00096 00098 virtual void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB) = 0; -00099 +00099 00100 protected: 00101 friend class b2ContactManager; 00102 friend class b2World; 00103 friend class b2ContactSolver; 00104 friend class b2Body; 00105 friend class b2Fixture; -00106 +00106 00107 // Flags stored in m_flags 00108 enum 00109 { 00110 // Used when crawling contact graph when forming islands. 00111 e_islandFlag = 0x0001, -00112 +00112 00113 // Set when the shapes are touching. 00114 e_touchingFlag = 0x0002, -00115 +00115 00116 // This contact can be disabled (by user) 00117 e_enabledFlag = 0x0004, -00118 +00118 00119 // This contact needs filtering because a fixture filter was changed. 00120 e_filterFlag = 0x0008, 00121 }; -00122 +00122 00124 void FlagForFiltering(); -00125 +00125 00126 static void AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* destroyFcn, 00127 b2Shape::Type typeA, b2Shape::Type typeB); 00128 static void InitializeRegisters(); 00129 static b2Contact* Create(b2Fixture* fixtureA, b2Fixture* fixtureB, b2BlockAllocator* allocator); 00130 static void Destroy(b2Contact* contact, b2Shape::Type typeA, b2Shape::Type typeB, b2BlockAllocator* allocator); 00131 static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); -00132 +00132 00133 b2Contact() : m_fixtureA(NULL), m_fixtureB(NULL) {} 00134 b2Contact(b2Fixture* fixtureA, b2Fixture* fixtureB); 00135 virtual ~b2Contact() {} -00136 +00136 00137 void Update(b2ContactListener* listener); -00138 +00138 00139 static b2ContactRegister s_registers[b2Shape::e_typeCount][b2Shape::e_typeCount]; 00140 static bool s_initialized; -00141 +00141 00142 uint32 m_flags; -00143 +00143 00144 // World pool and list pointers. 00145 b2Contact* m_prev; 00146 b2Contact* m_next; -00147 +00147 00148 // Nodes for connecting bodies. 00149 b2ContactEdge m_nodeA; 00150 b2ContactEdge m_nodeB; -00151 +00151 00152 b2Fixture* m_fixtureA; 00153 b2Fixture* m_fixtureB; -00154 +00154 00155 b2Manifold m_manifold; -00156 +00156 00157 int32 m_toiCount; 00158 // float32 m_toi; 00159 }; -00160 +00160 00161 inline b2Manifold* b2Contact::GetManifold() 00162 { 00163 return &m_manifold; 00164 } -00165 +00165 00166 inline const b2Manifold* b2Contact::GetManifold() const 00167 { 00168 return &m_manifold; 00169 } -00170 +00170 00171 inline void b2Contact::GetWorldManifold(b2WorldManifold* worldManifold) const 00172 { 00173 const b2Body* bodyA = m_fixtureA->GetBody(); 00174 const b2Body* bodyB = m_fixtureB->GetBody(); 00175 const b2Shape* shapeA = m_fixtureA->GetShape(); 00176 const b2Shape* shapeB = m_fixtureB->GetShape(); -00177 +00177 00178 worldManifold->Initialize(&m_manifold, bodyA->GetTransform(), shapeA->m_radius, bodyB->GetTransform(), shapeB->m_radius); 00179 } -00180 +00180 00181 inline void b2Contact::SetEnabled(bool flag) 00182 { 00183 if (flag) @@ -192,52 +192,52 @@

Box2D/Box2D/Dynamics/Contacts/b2Contact.h

G 00189 m_flags &= ~e_enabledFlag; 00190 } 00191 } -00192 +00192 00193 inline bool b2Contact::IsEnabled() const 00194 { 00195 return (m_flags & e_enabledFlag) == e_enabledFlag; 00196 } -00197 +00197 00198 inline bool b2Contact::IsTouching() const 00199 { 00200 return (m_flags & e_touchingFlag) == e_touchingFlag; 00201 } -00202 +00202 00203 inline b2Contact* b2Contact::GetNext() 00204 { 00205 return m_next; 00206 } -00207 +00207 00208 inline const b2Contact* b2Contact::GetNext() const 00209 { 00210 return m_next; 00211 } -00212 +00212 00213 inline b2Fixture* b2Contact::GetFixtureA() 00214 { 00215 return m_fixtureA; 00216 } -00217 +00217 00218 inline const b2Fixture* b2Contact::GetFixtureA() const 00219 { 00220 return m_fixtureA; 00221 } -00222 +00222 00223 inline b2Fixture* b2Contact::GetFixtureB() 00224 { 00225 return m_fixtureB; 00226 } -00227 +00227 00228 inline const b2Fixture* b2Contact::GetFixtureB() const 00229 { 00230 return m_fixtureB; 00231 } -00232 +00232 00233 inline void b2Contact::FlagForFiltering() 00234 { 00235 m_flags |= e_filterFlag; 00236 } -00237 +00237 00238 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_contact_manager_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_contact_manager_8h_source.html index 6b70994..3b94890 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_contact_manager_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_contact_manager_8h_source.html @@ -39,32 +39,32 @@

Box2D/Box2D/Dynamics/b2ContactManager.h

00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_CONTACT_MANAGER_H 00020 #define B2_CONTACT_MANAGER_H 00021 00022 #include <Box2D/Collision/b2BroadPhase.h> -00023 +00023 00024 class b2Contact; 00025 class b2ContactFilter; 00026 class b2ContactListener; 00027 class b2BlockAllocator; -00028 +00028 00029 // Delegate of b2World. 00030 class b2ContactManager 00031 { 00032 public: 00033 b2ContactManager(); -00034 +00034 00035 // Broad-phase callback. 00036 void AddPair(void* proxyUserDataA, void* proxyUserDataB); -00037 +00037 00038 void FindNewContacts(); -00039 +00039 00040 void Destroy(b2Contact* c); -00041 +00041 00042 void Collide(); -00043 +00043 00044 b2BroadPhase m_broadPhase; 00045 b2Contact* m_contactList; 00046 int32 m_contactCount; @@ -72,7 +72,7 @@

Box2D/Box2D/Dynamics/b2ContactManager.h

00048 b2ContactListener* m_contactListener; 00049 b2BlockAllocator* m_allocator; 00050 }; -00051 +00051 00052 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_contact_solver_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_contact_solver_8h_source.html index 206cbc3..928fd5f 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_contact_solver_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_contact_solver_8h_source.html @@ -39,18 +39,18 @@

Box2D/Box2D/Dynamics/Contacts/b2ContactSolver.h

00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_CONTACT_SOLVER_H 00020 #define B2_CONTACT_SOLVER_H 00021 00022 #include <Box2D/Common/b2Math.h> 00023 #include <Box2D/Collision/b2Collision.h> 00024 #include <Box2D/Dynamics/b2Island.h> -00025 +00025 00026 class b2Contact; 00027 class b2Body; 00028 class b2StackAllocator; -00029 +00029 00030 struct b2ContactConstraintPoint 00031 { 00032 b2Vec2 localPoint; @@ -62,7 +62,7 @@

Box2D/Box2D/Dynamics/Contacts/b2ContactSolver.h

00038 float32 tangentMass; 00039 float32 velocityBias; 00040 }; -00041 +00041 00042 struct b2ContactConstraint 00043 { 00044 b2ContactConstraintPoint points[b2_maxManifoldPoints]; @@ -79,26 +79,26 @@

Box2D/Box2D/Dynamics/Contacts/b2ContactSolver.h

00055 int32 pointCount; 00056 b2Manifold* manifold; 00057 }; -00058 +00058 00059 class b2ContactSolver 00060 { 00061 public: 00062 b2ContactSolver(b2Contact** contacts, int32 contactCount, 00063 b2StackAllocator* allocator, float32 impulseRatio); -00064 +00064 00065 ~b2ContactSolver(); -00066 +00066 00067 void WarmStart(); 00068 void SolveVelocityConstraints(); 00069 void StoreImpulses(); -00070 +00070 00071 bool SolvePositionConstraints(float32 baumgarte); -00072 +00072 00073 b2StackAllocator* m_allocator; 00074 b2ContactConstraint* m_constraints; 00075 int m_constraintCount; 00076 }; -00077 +00077 00078 #endif
Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_distance_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_distance_8h_source.html index 2340114..8b268df 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_distance_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_distance_8h_source.html @@ -22,7 +22,7 @@
  • File Members
  • -

    Box2D/Box2D/Collision/b2Distance.h

    Go to the documentation of this file.
    00001 
    +

    Box2D/Box2D/Collision/b2Distance.h

    Go to the documentation of this file.
    00001
     00002 /*
     00003 * Copyright (c) 2006-2009 Erin Catto http://www.gphysics.com
     00004 *
    @@ -40,42 +40,42 @@ 

    Box2D/Box2D/Collision/b2Distance.h

    Go to t 00016 * misrepresented as being the original software. 00017 * 3. This notice may not be removed or altered from any source distribution. 00018 */ -00019 +00019 00020 #ifndef B2_DISTANCE_H 00021 #define B2_DISTANCE_H 00022 00023 #include <Box2D/Common/b2Math.h> 00024 #include <climits> -00025 +00025 00026 class b2Shape; -00027 +00027 00030 struct b2DistanceProxy 00031 { 00032 b2DistanceProxy() : m_vertices(NULL), m_count(0), m_radius(0.0f) {} -00033 +00033 00036 void Set(const b2Shape* shape); -00037 +00037 00039 int32 GetSupport(const b2Vec2& d) const; -00040 +00040 00042 const b2Vec2& GetSupportVertex(const b2Vec2& d) const; -00043 +00043 00045 int32 GetVertexCount() const; -00046 +00046 00048 const b2Vec2& GetVertex(int32 index) const; -00049 +00049 00050 const b2Vec2* m_vertices; 00051 int32 m_count; 00052 float32 m_radius; 00053 }; -00054 +00054 00057 struct b2SimplexCache 00058 { -00059 float32 metric; +00059 float32 metric; 00060 uint16 count; -00061 uint8 indexA[3]; -00062 uint8 indexB[3]; +00061 uint8 indexA[3]; +00062 uint8 indexB[3]; 00063 }; -00064 +00064 00068 struct b2DistanceInput 00069 { 00070 b2DistanceProxy proxyA; @@ -84,32 +84,32 @@

    Box2D/Box2D/Collision/b2Distance.h

    Go to t 00073 b2Transform transformB; 00074 bool useRadii; 00075 }; -00076 +00076 00078 struct b2DistanceOutput 00079 { -00080 b2Vec2 pointA; -00081 b2Vec2 pointB; +00080 b2Vec2 pointA; +00081 b2Vec2 pointB; 00082 float32 distance; -00083 int32 iterations; +00083 int32 iterations; 00084 }; -00085 +00085 00089 void b2Distance(b2DistanceOutput* output, -00090 b2SimplexCache* cache, +00090 b2SimplexCache* cache, 00091 const b2DistanceInput* input); -00092 -00093 -00095 +00092 +00093 +00095 00096 inline int32 b2DistanceProxy::GetVertexCount() const 00097 { 00098 return m_count; 00099 } -00100 +00100 00101 inline const b2Vec2& b2DistanceProxy::GetVertex(int32 index) const 00102 { 00103 b2Assert(0 <= index && index < m_count); 00104 return m_vertices[index]; 00105 } -00106 +00106 00107 inline int32 b2DistanceProxy::GetSupport(const b2Vec2& d) const 00108 { 00109 int32 bestIndex = 0; @@ -123,10 +123,10 @@

    Box2D/Box2D/Collision/b2Distance.h

    Go to t 00117 bestValue = value; 00118 } 00119 } -00120 +00120 00121 return bestIndex; 00122 } -00123 +00123 00124 inline const b2Vec2& b2DistanceProxy::GetSupportVertex(const b2Vec2& d) const 00125 { 00126 int32 bestIndex = 0; @@ -140,10 +140,10 @@

    Box2D/Box2D/Collision/b2Distance.h

    Go to t 00134 bestValue = value; 00135 } 00136 } -00137 +00137 00138 return m_vertices[bestIndex]; 00139 } -00140 +00140 00141 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_distance_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_distance_joint_8h_source.html index 412dfeb..c85f7ea 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_distance_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_distance_joint_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/Joints/b2DistanceJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_DISTANCE_JOINT_H 00020 #define B2_DISTANCE_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00030 struct b2DistanceJointDef : public b2JointDef 00031 { 00032 b2DistanceJointDef() @@ -56,51 +56,51 @@

    Box2D/Box2D/Dynamics/Joints/b2DistanceJoint.h

    00038 frequencyHz = 0.0f; 00039 dampingRatio = 0.0f; 00040 } -00041 +00041 00044 void Initialize(b2Body* bodyA, b2Body* bodyB, 00045 const b2Vec2& anchorA, const b2Vec2& anchorB); -00046 +00046 00048 b2Vec2 localAnchorA; -00049 +00049 00051 b2Vec2 localAnchorB; -00052 +00052 00054 float32 length; -00055 +00055 00057 float32 frequencyHz; -00058 +00058 00060 float32 dampingRatio; 00061 }; -00062 +00062 00066 class b2DistanceJoint : public b2Joint 00067 { 00068 public: -00069 +00069 00070 b2Vec2 GetAnchorA() const; 00071 b2Vec2 GetAnchorB() const; -00072 +00072 00073 b2Vec2 GetReactionForce(float32 inv_dt) const; 00074 float32 GetReactionTorque(float32 inv_dt) const; -00075 +00075 00078 void SetLength(float32 length); 00079 float32 GetLength() const; -00080 +00080 00081 // Set/get frequency in Hz. 00082 void SetFrequency(float32 hz); 00083 float32 GetFrequency() const; -00084 +00084 00085 // Set/get damping ratio. 00086 void SetDampingRatio(float32 ratio); 00087 float32 GetDampingRatio() const; -00088 +00088 00089 protected: -00090 +00090 00091 friend class b2Joint; 00092 b2DistanceJoint(const b2DistanceJointDef* data); -00093 +00093 00094 void InitVelocityConstraints(const b2TimeStep& step); 00095 void SolveVelocityConstraints(const b2TimeStep& step); 00096 bool SolvePositionConstraints(float32 baumgarte); -00097 +00097 00098 b2Vec2 m_localAnchor1; 00099 b2Vec2 m_localAnchor2; 00100 b2Vec2 m_u; @@ -112,37 +112,37 @@

    Box2D/Box2D/Dynamics/Joints/b2DistanceJoint.h

    00106 float32 m_mass; 00107 float32 m_length; 00108 }; -00109 +00109 00110 inline void b2DistanceJoint::SetLength(float32 length) 00111 { 00112 m_length = length; 00113 } -00114 +00114 00115 inline float32 b2DistanceJoint::GetLength() const 00116 { 00117 return m_length; 00118 } -00119 +00119 00120 inline void b2DistanceJoint::SetFrequency(float32 hz) 00121 { 00122 m_frequencyHz = hz; 00123 } -00124 +00124 00125 inline float32 b2DistanceJoint::GetFrequency() const 00126 { 00127 return m_frequencyHz; 00128 } -00129 +00129 00130 inline void b2DistanceJoint::SetDampingRatio(float32 ratio) 00131 { 00132 m_dampingRatio = ratio; 00133 } -00134 +00134 00135 inline float32 b2DistanceJoint::GetDampingRatio() const 00136 { 00137 return m_dampingRatio; 00138 } -00139 +00139 00140 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_dynamic_tree_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_dynamic_tree_8h_source.html index fd5c475..28f1c61 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_dynamic_tree_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_dynamic_tree_8h_source.html @@ -39,13 +39,13 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_DYNAMIC_TREE_H 00020 #define B2_DYNAMIC_TREE_H 00021 00022 #include <Box2D/Collision/b2Collision.h> -00023 -00025 +00023 +00025 00026 #define b2_nullNode (-1) 00027 00029 struct b2DynamicTreeNode @@ -54,94 +54,94 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00032 { 00033 return child1 == b2_nullNode; 00034 } -00035 +00035 00037 b2AABB aabb; -00038 +00038 00039 //int32 userData; 00040 void* userData; -00041 +00041 00042 union 00043 { 00044 int32 parent; 00045 int32 next; 00046 }; -00047 +00047 00048 int32 child1; 00049 int32 child2; 00050 }; -00051 +00051 00059 class b2DynamicTree 00060 { 00061 public: -00062 +00062 00064 b2DynamicTree(); -00065 +00065 00067 ~b2DynamicTree(); -00068 +00068 00070 int32 CreateProxy(const b2AABB& aabb, void* userData); -00071 +00071 00073 void DestroyProxy(int32 proxyId); -00074 +00074 00079 bool MoveProxy(int32 proxyId, const b2AABB& aabb1, const b2Vec2& displacement); -00080 +00080 00082 void Rebalance(int32 iterations); -00083 +00083 00086 void* GetUserData(int32 proxyId) const; -00087 +00087 00089 const b2AABB& GetFatAABB(int32 proxyId) const; -00090 +00090 00092 int32 ComputeHeight() const; -00093 +00093 00096 template <typename T> 00097 void Query(T* callback, const b2AABB& aabb) const; -00098 +00098 00106 template <typename T> 00107 void RayCast(T* callback, const b2RayCastInput& input) const; -00108 +00108 00109 private: -00110 +00110 00111 int32 AllocateNode(); 00112 void FreeNode(int32 node); -00113 +00113 00114 void InsertLeaf(int32 node); 00115 void RemoveLeaf(int32 node); -00116 +00116 00117 int32 ComputeHeight(int32 nodeId) const; -00118 +00118 00119 int32 m_root; -00120 +00120 00121 b2DynamicTreeNode* m_nodes; 00122 int32 m_nodeCount; 00123 int32 m_nodeCapacity; -00124 +00124 00125 int32 m_freeList; -00126 +00126 00128 uint32 m_path; -00129 +00129 00130 int32 m_insertionCount; 00131 }; -00132 +00132 00133 inline void* b2DynamicTree::GetUserData(int32 proxyId) const 00134 { 00135 b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); 00136 return m_nodes[proxyId].userData; 00137 } -00138 +00138 00139 inline const b2AABB& b2DynamicTree::GetFatAABB(int32 proxyId) const 00140 { 00141 b2Assert(0 <= proxyId && proxyId < m_nodeCapacity); 00142 return m_nodes[proxyId].aabb; 00143 } -00144 +00144 00145 template <typename T> 00146 inline void b2DynamicTree::Query(T* callback, const b2AABB& aabb) const 00147 { 00148 const int32 k_stackSize = 128; 00149 int32 stack[k_stackSize]; -00150 +00150 00151 int32 count = 0; 00152 stack[count++] = m_root; -00153 +00153 00154 while (count > 0) 00155 { 00156 int32 nodeId = stack[--count]; @@ -149,9 +149,9 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00158 { 00159 continue; 00160 } -00161 +00161 00162 const b2DynamicTreeNode* node = m_nodes + nodeId; -00163 +00163 00164 if (b2TestOverlap(node->aabb, aabb)) 00165 { 00166 if (node->IsLeaf()) @@ -168,7 +168,7 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00177 { 00178 stack[count++] = node->child1; 00179 } -00180 +00180 00181 if (count < k_stackSize) 00182 { 00183 stack[count++] = node->child2; @@ -177,7 +177,7 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00186 } 00187 } 00188 } -00189 +00189 00190 template <typename T> 00191 inline void b2DynamicTree::RayCast(T* callback, const b2RayCastInput& input) const 00192 { @@ -186,16 +186,16 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00195 b2Vec2 r = p2 - p1; 00196 b2Assert(r.LengthSquared() > 0.0f); 00197 r.Normalize(); -00198 +00198 00199 // v is perpendicular to the segment. 00200 b2Vec2 v = b2Cross(1.0f, r); 00201 b2Vec2 abs_v = b2Abs(v); -00202 +00202 00203 // Separating axis for segment (Gino, p80). 00204 // |dot(v, p1 - c)| > dot(|v|, h) -00205 +00205 00206 float32 maxFraction = input.maxFraction; -00207 +00207 00208 // Build a bounding box for the segment. 00209 b2AABB segmentAABB; 00210 { @@ -203,13 +203,13 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00212 segmentAABB.lowerBound = b2Min(p1, t); 00213 segmentAABB.upperBound = b2Max(p1, t); 00214 } -00215 +00215 00216 const int32 k_stackSize = 128; 00217 int32 stack[k_stackSize]; -00218 +00218 00219 int32 count = 0; 00220 stack[count++] = m_root; -00221 +00221 00222 while (count > 0) 00223 { 00224 int32 nodeId = stack[--count]; @@ -217,14 +217,14 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00226 { 00227 continue; 00228 } -00229 +00229 00230 const b2DynamicTreeNode* node = m_nodes + nodeId; -00231 +00231 00232 if (b2TestOverlap(node->aabb, segmentAABB) == false) 00233 { 00234 continue; 00235 } -00236 +00236 00237 // Separating axis for segment (Gino, p80). 00238 // |dot(v, p1 - c)| > dot(|v|, h) 00239 b2Vec2 c = node->aabb.GetCenter(); @@ -234,22 +234,22 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00243 { 00244 continue; 00245 } -00246 +00246 00247 if (node->IsLeaf()) 00248 { 00249 b2RayCastInput subInput; 00250 subInput.p1 = input.p1; 00251 subInput.p2 = input.p2; 00252 subInput.maxFraction = maxFraction; -00253 +00253 00254 float32 value = callback->RayCastCallback(subInput, nodeId); -00255 +00255 00256 if (value == 0.0f) 00257 { 00258 // The client has terminated the ray cast. 00259 return; 00260 } -00261 +00261 00262 if (value > 0.0f) 00263 { 00264 // Update segment bounding box. @@ -265,7 +265,7 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00274 { 00275 stack[count++] = node->child1; 00276 } -00277 +00277 00278 if (count < k_stackSize) 00279 { 00280 stack[count++] = node->child2; @@ -273,7 +273,7 @@

    Box2D/Box2D/Collision/b2DynamicTree.h

    00282 } 00283 } 00284 } -00285 +00285 00286 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_fixture_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_fixture_8h_source.html index 4c74403..3416473 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_fixture_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_fixture_8h_source.html @@ -39,27 +39,27 @@

    Box2D/Box2D/Dynamics/b2Fixture.h

    Go to the 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_FIXTURE_H 00020 #define B2_FIXTURE_H 00021 00022 #include <Box2D/Dynamics/b2Body.h> 00023 #include <Box2D/Collision/b2Collision.h> 00024 #include <Box2D/Collision/Shapes/b2Shape.h> -00025 +00025 00026 class b2BlockAllocator; 00027 class b2Body; 00028 class b2BroadPhase; -00029 +00029 00031 struct b2Filter 00032 { 00034 uint16 categoryBits; -00035 +00035 00038 uint16 maskBits; -00039 +00039 00043 int16 groupIndex; 00044 }; -00045 +00045 00048 struct b2FixtureDef 00049 { 00051 b2FixtureDef() @@ -74,218 +74,218 @@

    Box2D/Box2D/Dynamics/b2Fixture.h

    Go to the 00060 filter.groupIndex = 0; 00061 isSensor = false; 00062 } -00063 +00063 00064 virtual ~b2FixtureDef() {} -00065 +00065 00068 const b2Shape* shape; -00069 +00069 00071 void* userData; -00072 +00072 00074 float32 friction; -00075 +00075 00077 float32 restitution; -00078 +00078 00080 float32 density; -00081 +00081 00084 bool isSensor; -00085 +00085 00087 b2Filter filter; 00088 }; -00089 -00090 +00089 +00090 00096 class b2Fixture 00097 { 00098 public: 00101 b2Shape::Type GetType() const; -00102 +00102 00106 b2Shape* GetShape(); 00107 const b2Shape* GetShape() const; -00108 +00108 00110 void SetSensor(bool sensor); -00111 +00111 00114 bool IsSensor() const; -00115 +00115 00118 void SetFilterData(const b2Filter& filter); -00119 +00119 00121 const b2Filter& GetFilterData() const; -00122 +00122 00125 b2Body* GetBody(); 00126 const b2Body* GetBody() const; -00127 +00127 00130 b2Fixture* GetNext(); 00131 const b2Fixture* GetNext() const; -00132 +00132 00135 void* GetUserData() const; -00136 +00136 00138 void SetUserData(void* data); -00139 +00139 00143 bool TestPoint(const b2Vec2& p) const; -00144 +00144 00148 bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input) const; -00149 +00149 00153 void GetMassData(b2MassData* massData) const; -00154 +00154 00157 void SetDensity(float32 density); -00158 +00158 00160 float32 GetDensity() const; -00161 +00161 00163 float32 GetFriction() const; -00164 +00164 00166 void SetFriction(float32 friction); -00167 +00167 00169 float32 GetRestitution() const; -00170 +00170 00172 void SetRestitution(float32 restitution); -00173 +00173 00177 const b2AABB& GetAABB() const; -00178 +00178 00179 protected: -00180 +00180 00181 friend class b2Body; 00182 friend class b2World; 00183 friend class b2Contact; 00184 friend class b2ContactManager; -00185 +00185 00186 b2Fixture(); 00187 ~b2Fixture(); -00188 +00188 00189 // We need separation create/destroy functions from the constructor/destructor because 00190 // the destructor cannot access the allocator (no destructor arguments allowed by C++). 00191 void Create(b2BlockAllocator* allocator, b2Body* body, const b2FixtureDef* def); 00192 void Destroy(b2BlockAllocator* allocator); -00193 +00193 00194 // These support body activation/deactivation. 00195 void CreateProxy(b2BroadPhase* broadPhase, const b2Transform& xf); 00196 void DestroyProxy(b2BroadPhase* broadPhase); -00197 +00197 00198 void Synchronize(b2BroadPhase* broadPhase, const b2Transform& xf1, const b2Transform& xf2); -00199 +00199 00200 b2AABB m_aabb; -00201 +00201 00202 float32 m_density; -00203 +00203 00204 b2Fixture* m_next; 00205 b2Body* m_body; -00206 +00206 00207 b2Shape* m_shape; -00208 +00208 00209 float32 m_friction; 00210 float32 m_restitution; -00211 +00211 00212 int32 m_proxyId; 00213 b2Filter m_filter; -00214 +00214 00215 bool m_isSensor; -00216 +00216 00217 void* m_userData; 00218 }; -00219 +00219 00220 inline b2Shape::Type b2Fixture::GetType() const 00221 { 00222 return m_shape->GetType(); 00223 } -00224 +00224 00225 inline b2Shape* b2Fixture::GetShape() 00226 { 00227 return m_shape; 00228 } -00229 +00229 00230 inline const b2Shape* b2Fixture::GetShape() const 00231 { 00232 return m_shape; 00233 } -00234 +00234 00235 inline bool b2Fixture::IsSensor() const 00236 { 00237 return m_isSensor; 00238 } -00239 +00239 00240 inline const b2Filter& b2Fixture::GetFilterData() const 00241 { 00242 return m_filter; 00243 } -00244 +00244 00245 inline void* b2Fixture::GetUserData() const 00246 { 00247 return m_userData; 00248 } -00249 +00249 00250 inline void b2Fixture::SetUserData(void* data) 00251 { 00252 m_userData = data; 00253 } -00254 +00254 00255 inline b2Body* b2Fixture::GetBody() 00256 { 00257 return m_body; 00258 } -00259 +00259 00260 inline const b2Body* b2Fixture::GetBody() const 00261 { 00262 return m_body; 00263 } -00264 +00264 00265 inline b2Fixture* b2Fixture::GetNext() 00266 { 00267 return m_next; 00268 } -00269 +00269 00270 inline const b2Fixture* b2Fixture::GetNext() const 00271 { 00272 return m_next; 00273 } -00274 +00274 00275 inline void b2Fixture::SetDensity(float32 density) 00276 { 00277 b2Assert(b2IsValid(density) && density >= 0.0f); 00278 m_density = density; 00279 } -00280 +00280 00281 inline float32 b2Fixture::GetDensity() const 00282 { 00283 return m_density; 00284 } -00285 +00285 00286 inline float32 b2Fixture::GetFriction() const 00287 { 00288 return m_friction; 00289 } -00290 +00290 00291 inline void b2Fixture::SetFriction(float32 friction) 00292 { 00293 m_friction = friction; 00294 } -00295 +00295 00296 inline float32 b2Fixture::GetRestitution() const 00297 { 00298 return m_restitution; 00299 } -00300 +00300 00301 inline void b2Fixture::SetRestitution(float32 restitution) 00302 { 00303 m_restitution = restitution; 00304 } -00305 +00305 00306 inline bool b2Fixture::TestPoint(const b2Vec2& p) const 00307 { 00308 return m_shape->TestPoint(m_body->GetTransform(), p); 00309 } -00310 +00310 00311 inline bool b2Fixture::RayCast(b2RayCastOutput* output, const b2RayCastInput& input) const 00312 { 00313 return m_shape->RayCast(output, input, m_body->GetTransform()); 00314 } -00315 +00315 00316 inline void b2Fixture::GetMassData(b2MassData* massData) const 00317 { 00318 m_shape->ComputeMass(massData, m_density); 00319 } -00320 +00320 00321 inline const b2AABB& b2Fixture::GetAABB() const 00322 { 00323 return m_aabb; 00324 } -00325 +00325 00326 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_friction_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_friction_joint_8h_source.html index b021ab3..5d87c97 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_friction_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_friction_joint_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/Joints/b2FrictionJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_FRICTION_JOINT_H 00020 #define B2_FRICTION_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00025 struct b2FrictionJointDef : public b2JointDef 00026 { 00027 b2FrictionJointDef() @@ -55,58 +55,58 @@

    Box2D/Box2D/Dynamics/Joints/b2FrictionJoint.h

    00032 maxForce = 0.0f; 00033 maxTorque = 0.0f; 00034 } -00035 +00035 00038 void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor); -00039 +00039 00041 b2Vec2 localAnchorA; -00042 +00042 00044 b2Vec2 localAnchorB; -00045 +00045 00047 float32 maxForce; -00048 +00048 00050 float32 maxTorque; 00051 }; -00052 +00052 00055 class b2FrictionJoint : public b2Joint 00056 { 00057 public: 00058 b2Vec2 GetAnchorA() const; 00059 b2Vec2 GetAnchorB() const; -00060 +00060 00061 b2Vec2 GetReactionForce(float32 inv_dt) const; 00062 float32 GetReactionTorque(float32 inv_dt) const; -00063 +00063 00065 void SetMaxForce(float32 force); -00066 +00066 00068 float32 GetMaxForce() const; -00069 +00069 00071 void SetMaxTorque(float32 torque); -00072 +00072 00074 float32 GetMaxTorque() const; -00075 +00075 00076 protected: -00077 +00077 00078 friend class b2Joint; -00079 +00079 00080 b2FrictionJoint(const b2FrictionJointDef* def); -00081 +00081 00082 void InitVelocityConstraints(const b2TimeStep& step); 00083 void SolveVelocityConstraints(const b2TimeStep& step); 00084 bool SolvePositionConstraints(float32 baumgarte); -00085 +00085 00086 b2Vec2 m_localAnchorA; 00087 b2Vec2 m_localAnchorB; -00088 +00088 00089 b2Mat22 m_linearMass; 00090 float32 m_angularMass; -00091 +00091 00092 b2Vec2 m_linearImpulse; 00093 float32 m_angularImpulse; -00094 +00094 00095 float32 m_maxForce; 00096 float32 m_maxTorque; 00097 }; -00098 +00098 00099 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_gear_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_gear_joint_8h_source.html index 864124a..932ef0e 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_gear_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_gear_joint_8h_source.html @@ -39,15 +39,15 @@

    Box2D/Box2D/Dynamics/Joints/b2GearJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_GEAR_JOINT_H 00020 #define B2_GEAR_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00024 class b2RevoluteJoint; 00025 class b2PrismaticJoint; -00026 +00026 00030 struct b2GearJointDef : public b2JointDef 00031 { 00032 b2GearJointDef() @@ -57,64 +57,64 @@

    Box2D/Box2D/Dynamics/Joints/b2GearJoint.h

    00036 joint2 = NULL; 00037 ratio = 1.0f; 00038 } -00039 +00039 00041 b2Joint* joint1; -00042 +00042 00044 b2Joint* joint2; -00045 +00045 00048 float32 ratio; 00049 }; -00050 +00050 00060 class b2GearJoint : public b2Joint 00061 { 00062 public: 00063 b2Vec2 GetAnchorA() const; 00064 b2Vec2 GetAnchorB() const; -00065 +00065 00066 b2Vec2 GetReactionForce(float32 inv_dt) const; 00067 float32 GetReactionTorque(float32 inv_dt) const; -00068 +00068 00070 void SetRatio(float32 ratio); 00071 float32 GetRatio() const; -00072 +00072 00073 protected: -00074 +00074 00075 friend class b2Joint; 00076 b2GearJoint(const b2GearJointDef* data); -00077 +00077 00078 void InitVelocityConstraints(const b2TimeStep& step); 00079 void SolveVelocityConstraints(const b2TimeStep& step); 00080 bool SolvePositionConstraints(float32 baumgarte); -00081 +00081 00082 b2Body* m_ground1; 00083 b2Body* m_ground2; -00084 +00084 00085 // One of these is NULL. 00086 b2RevoluteJoint* m_revolute1; 00087 b2PrismaticJoint* m_prismatic1; -00088 +00088 00089 // One of these is NULL. 00090 b2RevoluteJoint* m_revolute2; 00091 b2PrismaticJoint* m_prismatic2; -00092 +00092 00093 b2Vec2 m_groundAnchor1; 00094 b2Vec2 m_groundAnchor2; -00095 +00095 00096 b2Vec2 m_localAnchor1; 00097 b2Vec2 m_localAnchor2; -00098 +00098 00099 b2Jacobian m_J; -00100 +00100 00101 float32 m_constant; 00102 float32 m_ratio; -00103 +00103 00104 // Effective mass 00105 float32 m_mass; -00106 +00106 00107 // Impulse for accumulation/warm starting. 00108 float32 m_impulse; 00109 }; -00110 +00110 00111 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_island_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_island_8h_source.html index 95d9ba7..7bf5a5c 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_island_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_island_8h_source.html @@ -39,90 +39,90 @@

    Box2D/Box2D/Dynamics/b2Island.h

    Go to the do 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_ISLAND_H 00020 #define B2_ISLAND_H 00021 00022 #include <Box2D/Common/b2Math.h> 00023 #include <Box2D/Dynamics/b2Body.h> 00024 #include <Box2D/Dynamics/b2TimeStep.h> -00025 +00025 00026 class b2Contact; 00027 class b2Joint; 00028 class b2StackAllocator; 00029 class b2ContactListener; 00030 struct b2ContactConstraint; -00031 +00031 00033 struct b2Position 00034 { 00035 b2Vec2 x; 00036 float32 a; 00037 }; -00038 +00038 00040 struct b2Velocity 00041 { 00042 b2Vec2 v; 00043 float32 w; 00044 }; -00045 +00045 00047 class b2Island 00048 { 00049 public: 00050 b2Island(int32 bodyCapacity, int32 contactCapacity, int32 jointCapacity, 00051 b2StackAllocator* allocator, b2ContactListener* listener); 00052 ~b2Island(); -00053 +00053 00054 void Clear() 00055 { 00056 m_bodyCount = 0; 00057 m_contactCount = 0; 00058 m_jointCount = 0; 00059 } -00060 +00060 00061 void Solve(const b2TimeStep& step, const b2Vec2& gravity, bool allowSleep); -00062 +00062 00063 void Add(b2Body* body) 00064 { 00065 b2Assert(m_bodyCount < m_bodyCapacity); 00066 body->m_islandIndex = m_bodyCount; 00067 m_bodies[m_bodyCount++] = body; 00068 } -00069 +00069 00070 void Add(b2Contact* contact) 00071 { 00072 b2Assert(m_contactCount < m_contactCapacity); 00073 m_contacts[m_contactCount++] = contact; 00074 } -00075 +00075 00076 void Add(b2Joint* joint) 00077 { 00078 b2Assert(m_jointCount < m_jointCapacity); 00079 m_joints[m_jointCount++] = joint; 00080 } -00081 +00081 00082 void Report(const b2ContactConstraint* constraints); -00083 +00083 00084 b2StackAllocator* m_allocator; 00085 b2ContactListener* m_listener; -00086 +00086 00087 b2Body** m_bodies; 00088 b2Contact** m_contacts; 00089 b2Joint** m_joints; -00090 +00090 00091 b2Position* m_positions; 00092 b2Velocity* m_velocities; -00093 +00093 00094 int32 m_bodyCount; 00095 int32 m_jointCount; 00096 int32 m_contactCount; -00097 +00097 00098 int32 m_bodyCapacity; 00099 int32 m_contactCapacity; 00100 int32 m_jointCapacity; -00101 +00101 00102 int32 m_positionIterationCount; 00103 }; -00104 +00104 00105 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h.html b/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h.html index 40dd6d8..8ca76d8 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h.html @@ -36,23 +36,23 @@

    Box2D/Box2D/Dynamics/Joints/b2Joint.h File Reference

    #include < class  b2Joint

    Enumerations

    enum  b2JointType {
    -  e_unknownJoint, -e_revoluteJoint, -e_prismaticJoint, -e_distanceJoint, +  e_unknownJoint, +e_revoluteJoint, +e_prismaticJoint, +e_distanceJoint,
    -  e_pulleyJoint, -e_mouseJoint, -e_gearJoint, -e_lineJoint, +  e_pulleyJoint, +e_mouseJoint, +e_gearJoint, +e_lineJoint,
    -  e_weldJoint, +  e_weldJoint, e_frictionJoint
    } -enum  b2LimitState { e_inactiveLimit, -e_atLowerLimit, -e_atUpperLimit, +enum  b2LimitState { e_inactiveLimit, +e_atLowerLimit, +e_atUpperLimit, e_equalLimits } diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h_source.html index 141ec44..b4f78be 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_joint_8h_source.html @@ -39,17 +39,17 @@

    Box2D/Box2D/Dynamics/Joints/b2Joint.h

    Go to t 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_JOINT_H 00020 #define B2_JOINT_H 00021 00022 #include <Box2D/Common/b2Math.h> -00023 +00023 00024 class b2Body; 00025 class b2Joint; 00026 struct b2TimeStep; 00027 class b2BlockAllocator; -00028 +00028 00029 enum b2JointType 00030 { 00031 e_unknownJoint, @@ -63,7 +63,7 @@

    Box2D/Box2D/Dynamics/Joints/b2Joint.h

    Go to t 00039 e_weldJoint, 00040 e_frictionJoint, 00041 }; -00042 +00042 00043 enum b2LimitState 00044 { 00045 e_inactiveLimit, @@ -71,27 +71,27 @@

    Box2D/Box2D/Dynamics/Joints/b2Joint.h

    Go to t 00047 e_atUpperLimit, 00048 e_equalLimits 00049 }; -00050 +00050 00051 struct b2Jacobian 00052 { 00053 b2Vec2 linearA; 00054 float32 angularA; 00055 b2Vec2 linearB; 00056 float32 angularB; -00057 +00057 00058 void SetZero(); 00059 void Set(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2); 00060 float32 Compute(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2); 00061 }; -00062 +00062 00068 struct b2JointEdge 00069 { -00070 b2Body* other; -00071 b2Joint* joint; -00072 b2JointEdge* prev; -00073 b2JointEdge* next; +00070 b2Body* other; +00071 b2Joint* joint; +00072 b2JointEdge* prev; +00073 b2JointEdge* next; 00074 }; -00075 +00075 00077 struct b2JointDef 00078 { 00079 b2JointDef() @@ -102,61 +102,61 @@

    Box2D/Box2D/Dynamics/Joints/b2Joint.h

    Go to t 00084 bodyB = NULL; 00085 collideConnected = false; 00086 } -00087 +00087 00089 b2JointType type; -00090 +00090 00092 void* userData; -00093 +00093 00095 b2Body* bodyA; -00096 +00096 00098 b2Body* bodyB; -00099 +00099 00101 bool collideConnected; 00102 }; -00103 +00103 00106 class b2Joint 00107 { 00108 public: -00109 +00109 00111 b2JointType GetType() const; -00112 +00112 00114 b2Body* GetBodyA(); -00115 +00115 00117 b2Body* GetBodyB(); -00118 +00118 00120 virtual b2Vec2 GetAnchorA() const = 0; -00121 +00121 00123 virtual b2Vec2 GetAnchorB() const = 0; -00124 +00124 00126 virtual b2Vec2 GetReactionForce(float32 inv_dt) const = 0; -00127 +00127 00129 virtual float32 GetReactionTorque(float32 inv_dt) const = 0; -00130 +00130 00132 b2Joint* GetNext(); -00133 +00133 00135 void* GetUserData() const; -00136 +00136 00138 void SetUserData(void* data); -00139 +00139 00141 bool IsActive() const; -00142 +00142 00143 protected: 00144 friend class b2World; 00145 friend class b2Body; 00146 friend class b2Island; -00147 +00147 00148 static b2Joint* Create(const b2JointDef* def, b2BlockAllocator* allocator); 00149 static void Destroy(b2Joint* joint, b2BlockAllocator* allocator); -00150 +00150 00151 b2Joint(const b2JointDef* def); 00152 virtual ~b2Joint() {} -00153 +00153 00154 virtual void InitVelocityConstraints(const b2TimeStep& step) = 0; 00155 virtual void SolveVelocityConstraints(const b2TimeStep& step) = 0; -00156 +00156 00157 // This returns true if the position errors are within tolerance. 00158 virtual bool SolvePositionConstraints(float32 baumgarte) = 0; -00159 +00159 00160 b2JointType m_type; 00161 b2Joint* m_prev; 00162 b2Joint* m_next; @@ -164,65 +164,65 @@

    Box2D/Box2D/Dynamics/Joints/b2Joint.h

    Go to t 00164 b2JointEdge m_edgeB; 00165 b2Body* m_bodyA; 00166 b2Body* m_bodyB; -00167 +00167 00168 bool m_islandFlag; 00169 bool m_collideConnected; -00170 +00170 00171 void* m_userData; -00172 +00172 00173 // Cache here per time step to reduce cache misses. 00174 b2Vec2 m_localCenterA, m_localCenterB; 00175 float32 m_invMassA, m_invIA; 00176 float32 m_invMassB, m_invIB; 00177 }; -00178 +00178 00179 inline void b2Jacobian::SetZero() 00180 { 00181 linearA.SetZero(); angularA = 0.0f; 00182 linearB.SetZero(); angularB = 0.0f; 00183 } -00184 +00184 00185 inline void b2Jacobian::Set(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2) 00186 { 00187 linearA = x1; angularA = a1; 00188 linearB = x2; angularB = a2; 00189 } -00190 +00190 00191 inline float32 b2Jacobian::Compute(const b2Vec2& x1, float32 a1, const b2Vec2& x2, float32 a2) 00192 { 00193 return b2Dot(linearA, x1) + angularA * a1 + b2Dot(linearB, x2) + angularB * a2; 00194 } -00195 +00195 00196 inline b2JointType b2Joint::GetType() const 00197 { 00198 return m_type; 00199 } -00200 +00200 00201 inline b2Body* b2Joint::GetBodyA() 00202 { 00203 return m_bodyA; 00204 } -00205 +00205 00206 inline b2Body* b2Joint::GetBodyB() 00207 { 00208 return m_bodyB; 00209 } -00210 +00210 00211 inline b2Joint* b2Joint::GetNext() 00212 { 00213 return m_next; 00214 } -00215 +00215 00216 inline void* b2Joint::GetUserData() const 00217 { 00218 return m_userData; 00219 } -00220 +00220 00221 inline void b2Joint::SetUserData(void* data) 00222 { 00223 m_userData = data; 00224 } -00225 +00225 00226 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_line_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_line_joint_8h_source.html index 4a647d8..aeddef7 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_line_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_line_joint_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/Joints/b2LineJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_LINE_JOINT_H 00020 #define B2_LINE_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00030 struct b2LineJointDef : public b2JointDef 00031 { 00032 b2LineJointDef() @@ -60,103 +60,103 @@

    Box2D/Box2D/Dynamics/Joints/b2LineJoint.h

    00042 maxMotorForce = 0.0f; 00043 motorSpeed = 0.0f; 00044 } -00045 +00045 00048 void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor, const b2Vec2& axis); -00049 +00049 00051 b2Vec2 localAnchorA; -00052 +00052 00054 b2Vec2 localAnchorB; -00055 +00055 00057 b2Vec2 localAxisA; -00058 +00058 00060 bool enableLimit; -00061 +00061 00063 float32 lowerTranslation; -00064 +00064 00066 float32 upperTranslation; -00067 +00067 00069 bool enableMotor; -00070 +00070 00072 float32 maxMotorForce; -00073 +00073 00075 float32 motorSpeed; 00076 }; -00077 +00077 00082 class b2LineJoint : public b2Joint 00083 { 00084 public: 00085 b2Vec2 GetAnchorA() const; 00086 b2Vec2 GetAnchorB() const; -00087 +00087 00088 b2Vec2 GetReactionForce(float32 inv_dt) const; 00089 float32 GetReactionTorque(float32 inv_dt) const; -00090 +00090 00092 float32 GetJointTranslation() const; -00093 +00093 00095 float32 GetJointSpeed() const; -00096 +00096 00098 bool IsLimitEnabled() const; -00099 +00099 00101 void EnableLimit(bool flag); -00102 +00102 00104 float32 GetLowerLimit() const; -00105 +00105 00107 float32 GetUpperLimit() const; -00108 +00108 00110 void SetLimits(float32 lower, float32 upper); -00111 +00111 00113 bool IsMotorEnabled() const; -00114 +00114 00116 void EnableMotor(bool flag); -00117 +00117 00119 void SetMotorSpeed(float32 speed); -00120 +00120 00122 float32 GetMotorSpeed() const; -00123 +00123 00125 void SetMaxMotorForce(float32 force); 00126 float32 GetMaxMotorForce() const; -00127 +00127 00129 float32 GetMotorForce() const; -00130 +00130 00131 protected: -00132 +00132 00133 friend class b2Joint; 00134 b2LineJoint(const b2LineJointDef* def); -00135 +00135 00136 void InitVelocityConstraints(const b2TimeStep& step); 00137 void SolveVelocityConstraints(const b2TimeStep& step); 00138 bool SolvePositionConstraints(float32 baumgarte); -00139 +00139 00140 b2Vec2 m_localAnchor1; 00141 b2Vec2 m_localAnchor2; 00142 b2Vec2 m_localXAxis1; 00143 b2Vec2 m_localYAxis1; -00144 +00144 00145 b2Vec2 m_axis, m_perp; 00146 float32 m_s1, m_s2; 00147 float32 m_a1, m_a2; -00148 +00148 00149 b2Mat22 m_K; 00150 b2Vec2 m_impulse; -00151 +00151 00152 float32 m_motorMass; // effective mass for motor/limit translational constraint. 00153 float32 m_motorImpulse; -00154 +00154 00155 float32 m_lowerTranslation; 00156 float32 m_upperTranslation; 00157 float32 m_maxMotorForce; 00158 float32 m_motorSpeed; -00159 +00159 00160 bool m_enableLimit; 00161 bool m_enableMotor; 00162 b2LimitState m_limitState; 00163 }; -00164 +00164 00165 inline float32 b2LineJoint::GetMotorSpeed() const 00166 { 00167 return m_motorSpeed; 00168 } -00169 +00169 00170 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_math_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_math_8h_source.html index 969b2bc..fb50f63 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_math_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_math_8h_source.html @@ -39,17 +39,17 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_MATH_H 00020 #define B2_MATH_H 00021 00022 #include <Box2D/Common/b2Settings.h> -00023 +00023 00024 #include <cmath> 00025 #include <cfloat> 00026 #include <cstddef> 00027 #include <limits> -00028 +00028 00031 inline bool b2IsValid(float32 x) 00032 { 00033 if (x != x) @@ -57,11 +57,11 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00035 // NaN. 00036 return false; 00037 } -00038 +00038 00039 float32 infinity = std::numeric_limits<float32>::infinity(); 00040 return -infinity < x && x < infinity; 00041 } -00042 +00042 00044 inline float32 b2InvSqrt(float32 x) 00045 { 00046 union @@ -69,7 +69,7 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00048 float32 x; 00049 int32 i; 00050 } convert; -00051 +00051 00052 convert.x = x; 00053 float32 xhalf = 0.5f * x; 00054 convert.i = 0x5f3759df - (convert.i >> 1); @@ -77,7 +77,7 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00056 x = x * (1.5f - xhalf * x * x); 00057 return x; 00058 } -00059 +00059 00060 #define b2Sqrt(x) sqrtf(x) 00061 #define b2Atan2(y, x) atan2f(y, x) 00062 @@ -85,54 +85,54 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00064 { 00065 return a > 0.0f ? a : -a; 00066 } -00067 +00067 00069 struct b2Vec2 00070 { 00072 b2Vec2() {} -00073 +00073 00075 b2Vec2(float32 x, float32 y) : x(x), y(y) {} -00076 +00076 00078 void SetZero() { x = 0.0f; y = 0.0f; } -00079 +00079 00081 void Set(float32 x_, float32 y_) { x = x_; y = y_; } -00082 +00082 00084 b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; } -00085 +00085 00087 float32 operator () (int32 i) const 00088 { 00089 return (&x)[i]; 00090 } -00091 +00091 00093 float32& operator () (int32 i) 00094 { 00095 return (&x)[i]; 00096 } -00097 +00097 00099 void operator += (const b2Vec2& v) 00100 { 00101 x += v.x; y += v.y; 00102 } -00103 +00103 00105 void operator -= (const b2Vec2& v) 00106 { 00107 x -= v.x; y -= v.y; 00108 } -00109 +00109 00111 void operator *= (float32 a) 00112 { 00113 x *= a; y *= a; 00114 } -00115 +00115 00117 float32 Length() const 00118 { 00119 return b2Sqrt(x * x + y * y); 00120 } -00121 +00121 00124 float32 LengthSquared() const 00125 { 00126 return x * x + y * y; 00127 } -00128 +00128 00130 float32 Normalize() 00131 { 00132 float32 length = Length(); @@ -143,64 +143,64 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00137 float32 invLength = 1.0f / length; 00138 x *= invLength; 00139 y *= invLength; -00140 +00140 00141 return length; 00142 } -00143 +00143 00145 bool IsValid() const 00146 { 00147 return b2IsValid(x) && b2IsValid(y); 00148 } -00149 +00149 00150 float32 x, y; 00151 }; -00152 +00152 00154 struct b2Vec3 00155 { 00157 b2Vec3() {} -00158 +00158 00160 b2Vec3(float32 x, float32 y, float32 z) : x(x), y(y), z(z) {} -00161 +00161 00163 void SetZero() { x = 0.0f; y = 0.0f; z = 0.0f; } -00164 +00164 00166 void Set(float32 x_, float32 y_, float32 z_) { x = x_; y = y_; z = z_; } -00167 +00167 00169 b2Vec3 operator -() const { b2Vec3 v; v.Set(-x, -y, -z); return v; } -00170 +00170 00172 void operator += (const b2Vec3& v) 00173 { 00174 x += v.x; y += v.y; z += v.z; 00175 } -00176 +00176 00178 void operator -= (const b2Vec3& v) 00179 { 00180 x -= v.x; y -= v.y; z -= v.z; 00181 } -00182 +00182 00184 void operator *= (float32 s) 00185 { 00186 x *= s; y *= s; z *= s; 00187 } -00188 +00188 00189 float32 x, y, z; 00190 }; -00191 +00191 00193 struct b2Mat22 00194 { 00196 b2Mat22() {} -00197 +00197 00199 b2Mat22(const b2Vec2& c1, const b2Vec2& c2) 00200 { 00201 col1 = c1; 00202 col2 = c2; 00203 } -00204 +00204 00206 b2Mat22(float32 a11, float32 a12, float32 a21, float32 a22) 00207 { 00208 col1.x = a11; col1.y = a21; 00209 col2.x = a12; col2.y = a22; 00210 } -00211 +00211 00214 explicit b2Mat22(float32 angle) 00215 { 00216 // TODO_ERIN compute sin+cos together. @@ -208,37 +208,37 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00218 col1.x = c; col2.x = -s; 00219 col1.y = s; col2.y = c; 00220 } -00221 +00221 00223 void Set(const b2Vec2& c1, const b2Vec2& c2) 00224 { 00225 col1 = c1; 00226 col2 = c2; 00227 } -00228 +00228 00231 void Set(float32 angle) 00232 { 00233 float32 c = cosf(angle), s = sinf(angle); 00234 col1.x = c; col2.x = -s; 00235 col1.y = s; col2.y = c; 00236 } -00237 +00237 00239 void SetIdentity() 00240 { 00241 col1.x = 1.0f; col2.x = 0.0f; 00242 col1.y = 0.0f; col2.y = 1.0f; 00243 } -00244 +00244 00246 void SetZero() 00247 { 00248 col1.x = 0.0f; col2.x = 0.0f; 00249 col1.y = 0.0f; col2.y = 0.0f; 00250 } -00251 +00251 00254 float32 GetAngle() const 00255 { 00256 return b2Atan2(col1.y, col1.x); 00257 } -00258 +00258 00259 b2Mat22 GetInverse() const 00260 { 00261 float32 a = col1.x, b = col2.x, c = col1.y, d = col2.y; @@ -252,7 +252,7 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00269 B.col1.y = -det * c; B.col2.y = det * a; 00270 return B; 00271 } -00272 +00272 00275 b2Vec2 Solve(const b2Vec2& b) const 00276 { 00277 float32 a11 = col1.x, a12 = col2.x, a21 = col1.y, a22 = col2.y; @@ -266,176 +266,176 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00285 x.y = det * (a11 * b.y - a21 * b.x); 00286 return x; 00287 } -00288 +00288 00289 b2Vec2 col1, col2; 00290 }; -00291 +00291 00293 struct b2Mat33 00294 { 00296 b2Mat33() {} -00297 +00297 00299 b2Mat33(const b2Vec3& c1, const b2Vec3& c2, const b2Vec3& c3) 00300 { 00301 col1 = c1; 00302 col2 = c2; 00303 col3 = c3; 00304 } -00305 +00305 00307 void SetZero() 00308 { 00309 col1.SetZero(); 00310 col2.SetZero(); 00311 col3.SetZero(); 00312 } -00313 +00313 00316 b2Vec3 Solve33(const b2Vec3& b) const; -00317 +00317 00321 b2Vec2 Solve22(const b2Vec2& b) const; -00322 +00322 00323 b2Vec3 col1, col2, col3; 00324 }; -00325 +00325 00328 struct b2Transform 00329 { 00331 b2Transform() {} -00332 +00332 00334 b2Transform(const b2Vec2& position, const b2Mat22& R) : position(position), R(R) {} -00335 +00335 00337 void SetIdentity() 00338 { 00339 position.SetZero(); 00340 R.SetIdentity(); 00341 } -00342 +00342 00344 void Set(const b2Vec2& p, float32 angle) 00345 { 00346 position = p; 00347 R.Set(angle); 00348 } -00349 +00349 00351 float32 GetAngle() const 00352 { 00353 return b2Atan2(R.col1.y, R.col1.x); 00354 } -00355 +00355 00356 b2Vec2 position; 00357 b2Mat22 R; 00358 }; -00359 +00359 00364 struct b2Sweep 00365 { 00368 void GetTransform(b2Transform* xf, float32 alpha) const; -00369 +00369 00372 void Advance(float32 t); -00373 -00374 b2Vec2 localCenter; -00375 b2Vec2 c0, c; -00376 float32 a0, a; +00373 +00374 b2Vec2 localCenter; +00375 b2Vec2 c0, c; +00376 float32 a0, a; 00377 }; -00378 -00379 +00378 +00379 00380 extern const b2Vec2 b2Vec2_zero; 00381 extern const b2Mat22 b2Mat22_identity; 00382 extern const b2Transform b2Transform_identity; -00383 +00383 00385 inline float32 b2Dot(const b2Vec2& a, const b2Vec2& b) 00386 { 00387 return a.x * b.x + a.y * b.y; 00388 } -00389 +00389 00391 inline float32 b2Cross(const b2Vec2& a, const b2Vec2& b) 00392 { 00393 return a.x * b.y - a.y * b.x; 00394 } -00395 +00395 00398 inline b2Vec2 b2Cross(const b2Vec2& a, float32 s) 00399 { 00400 return b2Vec2(s * a.y, -s * a.x); 00401 } -00402 +00402 00405 inline b2Vec2 b2Cross(float32 s, const b2Vec2& a) 00406 { 00407 return b2Vec2(-s * a.y, s * a.x); 00408 } -00409 +00409 00412 inline b2Vec2 b2Mul(const b2Mat22& A, const b2Vec2& v) 00413 { 00414 return b2Vec2(A.col1.x * v.x + A.col2.x * v.y, A.col1.y * v.x + A.col2.y * v.y); 00415 } -00416 +00416 00419 inline b2Vec2 b2MulT(const b2Mat22& A, const b2Vec2& v) 00420 { 00421 return b2Vec2(b2Dot(v, A.col1), b2Dot(v, A.col2)); 00422 } -00423 +00423 00425 inline b2Vec2 operator + (const b2Vec2& a, const b2Vec2& b) 00426 { 00427 return b2Vec2(a.x + b.x, a.y + b.y); 00428 } -00429 +00429 00431 inline b2Vec2 operator - (const b2Vec2& a, const b2Vec2& b) 00432 { 00433 return b2Vec2(a.x - b.x, a.y - b.y); 00434 } -00435 +00435 00436 inline b2Vec2 operator * (float32 s, const b2Vec2& a) 00437 { 00438 return b2Vec2(s * a.x, s * a.y); 00439 } -00440 +00440 00441 inline bool operator == (const b2Vec2& a, const b2Vec2& b) 00442 { 00443 return a.x == b.x && a.y == b.y; 00444 } -00445 +00445 00446 inline float32 b2Distance(const b2Vec2& a, const b2Vec2& b) 00447 { 00448 b2Vec2 c = a - b; 00449 return c.Length(); 00450 } -00451 +00451 00452 inline float32 b2DistanceSquared(const b2Vec2& a, const b2Vec2& b) 00453 { 00454 b2Vec2 c = a - b; 00455 return b2Dot(c, c); 00456 } -00457 +00457 00458 inline b2Vec3 operator * (float32 s, const b2Vec3& a) 00459 { 00460 return b2Vec3(s * a.x, s * a.y, s * a.z); 00461 } -00462 +00462 00464 inline b2Vec3 operator + (const b2Vec3& a, const b2Vec3& b) 00465 { 00466 return b2Vec3(a.x + b.x, a.y + b.y, a.z + b.z); 00467 } -00468 +00468 00470 inline b2Vec3 operator - (const b2Vec3& a, const b2Vec3& b) 00471 { 00472 return b2Vec3(a.x - b.x, a.y - b.y, a.z - b.z); 00473 } -00474 +00474 00476 inline float32 b2Dot(const b2Vec3& a, const b2Vec3& b) 00477 { 00478 return a.x * b.x + a.y * b.y + a.z * b.z; 00479 } -00480 +00480 00482 inline b2Vec3 b2Cross(const b2Vec3& a, const b2Vec3& b) 00483 { 00484 return b2Vec3(a.y * b.z - a.z * b.y, a.z * b.x - a.x * b.z, a.x * b.y - a.y * b.x); 00485 } -00486 +00486 00487 inline b2Mat22 operator + (const b2Mat22& A, const b2Mat22& B) 00488 { 00489 return b2Mat22(A.col1 + B.col1, A.col2 + B.col2); 00490 } -00491 +00491 00492 // A * B 00493 inline b2Mat22 b2Mul(const b2Mat22& A, const b2Mat22& B) 00494 { 00495 return b2Mat22(b2Mul(A, B.col1), b2Mul(A, B.col2)); 00496 } -00497 +00497 00498 // A^T * B 00499 inline b2Mat22 b2MulT(const b2Mat22& A, const b2Mat22& B) 00500 { @@ -443,75 +443,75 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00502 b2Vec2 c2(b2Dot(A.col1, B.col2), b2Dot(A.col2, B.col2)); 00503 return b2Mat22(c1, c2); 00504 } -00505 +00505 00507 inline b2Vec3 b2Mul(const b2Mat33& A, const b2Vec3& v) 00508 { 00509 return v.x * A.col1 + v.y * A.col2 + v.z * A.col3; 00510 } -00511 +00511 00512 inline b2Vec2 b2Mul(const b2Transform& T, const b2Vec2& v) 00513 { 00514 float32 x = T.position.x + T.R.col1.x * v.x + T.R.col2.x * v.y; 00515 float32 y = T.position.y + T.R.col1.y * v.x + T.R.col2.y * v.y; -00516 +00516 00517 return b2Vec2(x, y); 00518 } -00519 +00519 00520 inline b2Vec2 b2MulT(const b2Transform& T, const b2Vec2& v) 00521 { 00522 return b2MulT(T.R, v - T.position); 00523 } -00524 +00524 00525 inline b2Vec2 b2Abs(const b2Vec2& a) 00526 { 00527 return b2Vec2(b2Abs(a.x), b2Abs(a.y)); 00528 } -00529 +00529 00530 inline b2Mat22 b2Abs(const b2Mat22& A) 00531 { 00532 return b2Mat22(b2Abs(A.col1), b2Abs(A.col2)); 00533 } -00534 +00534 00535 template <typename T> 00536 inline T b2Min(T a, T b) 00537 { 00538 return a < b ? a : b; 00539 } -00540 +00540 00541 inline b2Vec2 b2Min(const b2Vec2& a, const b2Vec2& b) 00542 { 00543 return b2Vec2(b2Min(a.x, b.x), b2Min(a.y, b.y)); 00544 } -00545 +00545 00546 template <typename T> 00547 inline T b2Max(T a, T b) 00548 { 00549 return a > b ? a : b; 00550 } -00551 +00551 00552 inline b2Vec2 b2Max(const b2Vec2& a, const b2Vec2& b) 00553 { 00554 return b2Vec2(b2Max(a.x, b.x), b2Max(a.y, b.y)); 00555 } -00556 +00556 00557 template <typename T> 00558 inline T b2Clamp(T a, T low, T high) 00559 { 00560 return b2Max(low, b2Min(a, high)); 00561 } -00562 +00562 00563 inline b2Vec2 b2Clamp(const b2Vec2& a, const b2Vec2& low, const b2Vec2& high) 00564 { 00565 return b2Max(low, b2Min(a, high)); 00566 } -00567 +00567 00568 template<typename T> inline void b2Swap(T& a, T& b) 00569 { 00570 T tmp = a; 00571 a = b; 00572 b = tmp; 00573 } -00574 +00574 00580 inline uint32 b2NextPowerOfTwo(uint32 x) 00581 { 00582 x |= (x >> 1); @@ -521,29 +521,29 @@

    Box2D/Box2D/Common/b2Math.h

    Go to the document 00586 x |= (x >> 16); 00587 return x + 1; 00588 } -00589 +00589 00590 inline bool b2IsPowerOfTwo(uint32 x) 00591 { 00592 bool result = x > 0 && (x & (x - 1)) == 0; 00593 return result; 00594 } -00595 +00595 00596 inline void b2Sweep::GetTransform(b2Transform* xf, float32 alpha) const 00597 { 00598 xf->position = (1.0f - alpha) * c0 + alpha * c; 00599 float32 angle = (1.0f - alpha) * a0 + alpha * a; 00600 xf->R.Set(angle); -00601 +00601 00602 // Shift to origin 00603 xf->position -= b2Mul(xf->R, localCenter); 00604 } -00605 +00605 00606 inline void b2Sweep::Advance(float32 t) 00607 { 00608 c0 = (1.0f - t) * c0 + t * c; 00609 a0 = (1.0f - t) * a0 + t * a; 00610 } -00611 +00611 00612 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_mouse_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_mouse_joint_8h_source.html index 45b21e3..5e2a41a 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_mouse_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_mouse_joint_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/Joints/b2MouseJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_MOUSE_JOINT_H 00020 #define B2_MOUSE_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00026 struct b2MouseJointDef : public b2JointDef 00027 { 00028 b2MouseJointDef() @@ -55,53 +55,53 @@

    Box2D/Box2D/Dynamics/Joints/b2MouseJoint.h

    00033 frequencyHz = 5.0f; 00034 dampingRatio = 0.7f; 00035 } -00036 +00036 00039 b2Vec2 target; -00040 +00040 00044 float32 maxForce; -00045 +00045 00047 float32 frequencyHz; -00048 +00048 00050 float32 dampingRatio; 00051 }; -00052 +00052 00060 class b2MouseJoint : public b2Joint 00061 { 00062 public: -00063 +00063 00065 b2Vec2 GetAnchorA() const; -00066 +00066 00068 b2Vec2 GetAnchorB() const; -00069 +00069 00071 b2Vec2 GetReactionForce(float32 inv_dt) const; -00072 +00072 00074 float32 GetReactionTorque(float32 inv_dt) const; -00075 +00075 00077 void SetTarget(const b2Vec2& target); 00078 const b2Vec2& GetTarget() const; -00079 +00079 00081 void SetMaxForce(float32 force); 00082 float32 GetMaxForce() const; -00083 +00083 00085 void SetFrequency(float32 hz); 00086 float32 GetFrequency() const; -00087 +00087 00089 void SetDampingRatio(float32 ratio); 00090 float32 GetDampingRatio() const; -00091 +00091 00092 protected: 00093 friend class b2Joint; -00094 +00094 00095 b2MouseJoint(const b2MouseJointDef* def); -00096 +00096 00097 void InitVelocityConstraints(const b2TimeStep& step); 00098 void SolveVelocityConstraints(const b2TimeStep& step); 00099 bool SolvePositionConstraints(float32 baumgarte) { B2_NOT_USED(baumgarte); return true; } -00100 +00100 00101 b2Vec2 m_localAnchor; 00102 b2Vec2 m_target; 00103 b2Vec2 m_impulse; -00104 +00104 00105 b2Mat22 m_mass; // effective mass for point-to-point constraint. 00106 b2Vec2 m_C; // position error 00107 float32 m_maxForce; @@ -110,7 +110,7 @@

    Box2D/Box2D/Dynamics/Joints/b2MouseJoint.h

    00110 float32 m_beta; 00111 float32 m_gamma; 00112 }; -00113 +00113 00114 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_polygon_and_circle_contact_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_polygon_and_circle_contact_8h_source.html index 376523c..4c84412 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_polygon_and_circle_contact_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_polygon_and_circle_contact_8h_source.html @@ -39,26 +39,26 @@

    Box2D/Box2D/Dynamics/Contacts/b2PolygonAndCircleContact.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_POLYGON_AND_CIRCLE_CONTACT_H 00020 #define B2_POLYGON_AND_CIRCLE_CONTACT_H 00021 00022 #include <Box2D/Dynamics/Contacts/b2Contact.h> -00023 +00023 00024 class b2BlockAllocator; -00025 +00025 00026 class b2PolygonAndCircleContact : public b2Contact 00027 { 00028 public: 00029 static b2Contact* Create(b2Fixture* fixtureA, b2Fixture* fixtureB, b2BlockAllocator* allocator); 00030 static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); -00031 +00031 00032 b2PolygonAndCircleContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 00033 ~b2PolygonAndCircleContact() {} -00034 +00034 00035 void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 00036 }; -00037 +00037 00038 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_polygon_contact_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_polygon_contact_8h_source.html index 733c477..b95708d 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_polygon_contact_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_polygon_contact_8h_source.html @@ -39,26 +39,26 @@

    Box2D/Box2D/Dynamics/Contacts/b2PolygonContact.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_POLYGON_CONTACT_H 00020 #define B2_POLYGON_CONTACT_H 00021 00022 #include <Box2D/Dynamics/Contacts/b2Contact.h> -00023 +00023 00024 class b2BlockAllocator; -00025 +00025 00026 class b2PolygonContact : public b2Contact 00027 { 00028 public: 00029 static b2Contact* Create(b2Fixture* fixtureA, b2Fixture* fixtureB, b2BlockAllocator* allocator); 00030 static void Destroy(b2Contact* contact, b2BlockAllocator* allocator); -00031 +00031 00032 b2PolygonContact(b2Fixture* fixtureA, b2Fixture* fixtureB); 00033 ~b2PolygonContact() {} -00034 +00034 00035 void Evaluate(b2Manifold* manifold, const b2Transform& xfA, const b2Transform& xfB); 00036 }; -00037 +00037 00038 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_polygon_shape_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_polygon_shape_8h_source.html index e91de73..a3d87d7 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_polygon_shape_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_polygon_shape_8h_source.html @@ -39,49 +39,49 @@

    Box2D/Box2D/Collision/Shapes/b2PolygonShape.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_POLYGON_SHAPE_H 00020 #define B2_POLYGON_SHAPE_H 00021 00022 #include <Box2D/Collision/Shapes/b2Shape.h> -00023 +00023 00026 class b2PolygonShape : public b2Shape 00027 { 00028 public: 00029 b2PolygonShape(); -00030 +00030 00032 b2Shape* Clone(b2BlockAllocator* allocator) const; -00033 +00033 00036 void Set(const b2Vec2* vertices, int32 vertexCount); -00037 +00037 00041 void SetAsBox(float32 hx, float32 hy); -00042 +00042 00048 void SetAsBox(float32 hx, float32 hy, const b2Vec2& center, float32 angle); -00049 +00049 00051 void SetAsEdge(const b2Vec2& v1, const b2Vec2& v2); -00052 +00052 00054 bool TestPoint(const b2Transform& transform, const b2Vec2& p) const; -00055 +00055 00057 bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, const b2Transform& transform) const; -00058 +00058 00060 void ComputeAABB(b2AABB* aabb, const b2Transform& transform) const; -00061 +00061 00063 void ComputeMass(b2MassData* massData, float32 density) const; -00064 +00064 00066 int32 GetSupport(const b2Vec2& d) const; -00067 +00067 00069 const b2Vec2& GetSupportVertex(const b2Vec2& d) const; -00070 +00070 00072 int32 GetVertexCount() const { return m_vertexCount; } -00073 +00073 00075 const b2Vec2& GetVertex(int32 index) const; -00076 +00076 00077 b2Vec2 m_centroid; 00078 b2Vec2 m_vertices[b2_maxPolygonVertices]; 00079 b2Vec2 m_normals[b2_maxPolygonVertices]; 00080 int32 m_vertexCount; 00081 }; -00082 +00082 00083 inline b2PolygonShape::b2PolygonShape() 00084 { 00085 m_type = e_polygon; @@ -89,7 +89,7 @@

    Box2D/Box2D/Collision/Shapes/b2PolygonShape.h

    00087 m_vertexCount = 0; 00088 m_centroid.SetZero(); 00089 } -00090 +00090 00091 inline int32 b2PolygonShape::GetSupport(const b2Vec2& d) const 00092 { 00093 int32 bestIndex = 0; @@ -103,10 +103,10 @@

    Box2D/Box2D/Collision/Shapes/b2PolygonShape.h

    00101 bestValue = value; 00102 } 00103 } -00104 +00104 00105 return bestIndex; 00106 } -00107 +00107 00108 inline const b2Vec2& b2PolygonShape::GetSupportVertex(const b2Vec2& d) const 00109 { 00110 int32 bestIndex = 0; @@ -120,16 +120,16 @@

    Box2D/Box2D/Collision/Shapes/b2PolygonShape.h

    00118 bestValue = value; 00119 } 00120 } -00121 +00121 00122 return m_vertices[bestIndex]; 00123 } -00124 +00124 00125 inline const b2Vec2& b2PolygonShape::GetVertex(int32 index) const 00126 { 00127 b2Assert(0 <= index && index < m_vertexCount); 00128 return m_vertices[index]; 00129 } -00130 +00130 00131 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_prismatic_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_prismatic_joint_8h_source.html index aa0b88c..73f6572 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_prismatic_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_prismatic_joint_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_PRISMATIC_JOINT_H 00020 #define B2_PRISMATIC_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00031 struct b2PrismaticJointDef : public b2JointDef 00032 { 00033 b2PrismaticJointDef() @@ -61,105 +61,105 @@

    Box2D/Box2D/Dynamics/Joints/b2PrismaticJoint.h

    00044 maxMotorForce = 0.0f; 00045 motorSpeed = 0.0f; 00046 } -00047 +00047 00050 void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor, const b2Vec2& axis); -00051 +00051 00053 b2Vec2 localAnchorA; -00054 +00054 00056 b2Vec2 localAnchorB; -00057 +00057 00059 b2Vec2 localAxis1; -00060 +00060 00062 float32 referenceAngle; -00063 +00063 00065 bool enableLimit; -00066 +00066 00068 float32 lowerTranslation; -00069 +00069 00071 float32 upperTranslation; -00072 +00072 00074 bool enableMotor; -00075 +00075 00077 float32 maxMotorForce; -00078 +00078 00080 float32 motorSpeed; 00081 }; -00082 +00082 00087 class b2PrismaticJoint : public b2Joint 00088 { 00089 public: 00090 b2Vec2 GetAnchorA() const; 00091 b2Vec2 GetAnchorB() const; -00092 +00092 00093 b2Vec2 GetReactionForce(float32 inv_dt) const; 00094 float32 GetReactionTorque(float32 inv_dt) const; -00095 +00095 00097 float32 GetJointTranslation() const; -00098 +00098 00100 float32 GetJointSpeed() const; -00101 +00101 00103 bool IsLimitEnabled() const; -00104 +00104 00106 void EnableLimit(bool flag); -00107 +00107 00109 float32 GetLowerLimit() const; -00110 +00110 00112 float32 GetUpperLimit() const; -00113 +00113 00115 void SetLimits(float32 lower, float32 upper); -00116 +00116 00118 bool IsMotorEnabled() const; -00119 +00119 00121 void EnableMotor(bool flag); -00122 +00122 00124 void SetMotorSpeed(float32 speed); -00125 +00125 00127 float32 GetMotorSpeed() const; -00128 +00128 00130 void SetMaxMotorForce(float32 force); -00131 +00131 00133 float32 GetMotorForce() const; -00134 +00134 00135 protected: 00136 friend class b2Joint; 00137 friend class b2GearJoint; 00138 b2PrismaticJoint(const b2PrismaticJointDef* def); -00139 +00139 00140 void InitVelocityConstraints(const b2TimeStep& step); 00141 void SolveVelocityConstraints(const b2TimeStep& step); 00142 bool SolvePositionConstraints(float32 baumgarte); -00143 +00143 00144 b2Vec2 m_localAnchor1; 00145 b2Vec2 m_localAnchor2; 00146 b2Vec2 m_localXAxis1; 00147 b2Vec2 m_localYAxis1; 00148 float32 m_refAngle; -00149 +00149 00150 b2Vec2 m_axis, m_perp; 00151 float32 m_s1, m_s2; 00152 float32 m_a1, m_a2; -00153 +00153 00154 b2Mat33 m_K; 00155 b2Vec3 m_impulse; -00156 +00156 00157 float32 m_motorMass; // effective mass for motor/limit translational constraint. 00158 float32 m_motorImpulse; -00159 +00159 00160 float32 m_lowerTranslation; 00161 float32 m_upperTranslation; 00162 float32 m_maxMotorForce; 00163 float32 m_motorSpeed; -00164 +00164 00165 bool m_enableLimit; 00166 bool m_enableMotor; 00167 b2LimitState m_limitState; 00168 }; -00169 +00169 00170 inline float32 b2PrismaticJoint::GetMotorSpeed() const 00171 { 00172 return m_motorSpeed; 00173 } -00174 +00174 00175 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_pulley_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_pulley_joint_8h_source.html index 1bc52c2..5d36f14 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_pulley_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_pulley_joint_8h_source.html @@ -39,14 +39,14 @@

    Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_PULLEY_JOINT_H 00020 #define B2_PULLEY_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00024 const float32 b2_minPulleyLength = 2.0f; -00025 +00025 00029 struct b2PulleyJointDef : public b2JointDef 00030 { 00031 b2PulleyJointDef() @@ -63,88 +63,88 @@

    Box2D/Box2D/Dynamics/Joints/b2PulleyJoint.h

    00042 ratio = 1.0f; 00043 collideConnected = true; 00044 } -00045 +00045 00047 void Initialize(b2Body* bodyA, b2Body* bodyB, 00048 const b2Vec2& groundAnchorA, const b2Vec2& groundAnchorB, 00049 const b2Vec2& anchorA, const b2Vec2& anchorB, 00050 float32 ratio); -00051 +00051 00053 b2Vec2 groundAnchorA; -00054 +00054 00056 b2Vec2 groundAnchorB; -00057 +00057 00059 b2Vec2 localAnchorA; -00060 +00060 00062 b2Vec2 localAnchorB; -00063 +00063 00065 float32 lengthA; -00066 +00066 00068 float32 maxLengthA; -00069 +00069 00071 float32 lengthB; -00072 +00072 00074 float32 maxLengthB; -00075 +00075 00077 float32 ratio; 00078 }; -00079 +00079 00086 class b2PulleyJoint : public b2Joint 00087 { 00088 public: 00089 b2Vec2 GetAnchorA() const; 00090 b2Vec2 GetAnchorB() const; -00091 +00091 00092 b2Vec2 GetReactionForce(float32 inv_dt) const; 00093 float32 GetReactionTorque(float32 inv_dt) const; -00094 +00094 00096 b2Vec2 GetGroundAnchorA() const; -00097 +00097 00099 b2Vec2 GetGroundAnchorB() const; -00100 +00100 00102 float32 GetLength1() const; -00103 +00103 00105 float32 GetLength2() const; -00106 +00106 00108 float32 GetRatio() const; -00109 +00109 00110 protected: -00111 +00111 00112 friend class b2Joint; 00113 b2PulleyJoint(const b2PulleyJointDef* data); -00114 +00114 00115 void InitVelocityConstraints(const b2TimeStep& step); 00116 void SolveVelocityConstraints(const b2TimeStep& step); 00117 bool SolvePositionConstraints(float32 baumgarte); -00118 +00118 00119 b2Vec2 m_groundAnchor1; 00120 b2Vec2 m_groundAnchor2; 00121 b2Vec2 m_localAnchor1; 00122 b2Vec2 m_localAnchor2; -00123 +00123 00124 b2Vec2 m_u1; 00125 b2Vec2 m_u2; -00126 +00126 00127 float32 m_constant; 00128 float32 m_ratio; -00129 +00129 00130 float32 m_maxLength1; 00131 float32 m_maxLength2; -00132 +00132 00133 // Effective masses 00134 float32 m_pulleyMass; 00135 float32 m_limitMass1; 00136 float32 m_limitMass2; -00137 +00137 00138 // Impulses for accumulation/warm starting. 00139 float32 m_impulse; 00140 float32 m_limitImpulse1; 00141 float32 m_limitImpulse2; -00142 +00142 00143 b2LimitState m_state; 00144 b2LimitState m_limitState1; 00145 b2LimitState m_limitState2; 00146 }; -00147 +00147 00148 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_revolute_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_revolute_joint_8h_source.html index 03ca1eb..084bf94 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_revolute_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_revolute_joint_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_REVOLUTE_JOINT_H 00020 #define B2_REVOLUTE_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00035 struct b2RevoluteJointDef : public b2JointDef 00036 { 00037 b2RevoluteJointDef() @@ -60,99 +60,99 @@

    Box2D/Box2D/Dynamics/Joints/b2RevoluteJoint.h

    00047 enableLimit = false; 00048 enableMotor = false; 00049 } -00050 +00050 00053 void Initialize(b2Body* bodyA, b2Body* bodyB, const b2Vec2& anchor); -00054 +00054 00056 b2Vec2 localAnchorA; -00057 +00057 00059 b2Vec2 localAnchorB; -00060 +00060 00062 float32 referenceAngle; -00063 +00063 00065 bool enableLimit; -00066 +00066 00068 float32 lowerAngle; -00069 +00069 00071 float32 upperAngle; -00072 +00072 00074 bool enableMotor; -00075 +00075 00077 float32 motorSpeed; -00078 +00078 00081 float32 maxMotorTorque; 00082 }; -00083 +00083 00090 class b2RevoluteJoint : public b2Joint 00091 { 00092 public: 00093 b2Vec2 GetAnchorA() const; 00094 b2Vec2 GetAnchorB() const; -00095 +00095 00096 b2Vec2 GetReactionForce(float32 inv_dt) const; 00097 float32 GetReactionTorque(float32 inv_dt) const; -00098 +00098 00100 float32 GetJointAngle() const; -00101 +00101 00103 float32 GetJointSpeed() const; -00104 +00104 00106 bool IsLimitEnabled() const; -00107 +00107 00109 void EnableLimit(bool flag); -00110 +00110 00112 float32 GetLowerLimit() const; -00113 +00113 00115 float32 GetUpperLimit() const; -00116 +00116 00118 void SetLimits(float32 lower, float32 upper); -00119 +00119 00121 bool IsMotorEnabled() const; -00122 +00122 00124 void EnableMotor(bool flag); -00125 +00125 00127 void SetMotorSpeed(float32 speed); -00128 +00128 00130 float32 GetMotorSpeed() const; -00131 +00131 00133 void SetMaxMotorTorque(float32 torque); -00134 +00134 00136 float32 GetMotorTorque() const; -00137 +00137 00138 protected: -00139 +00139 00140 friend class b2Joint; 00141 friend class b2GearJoint; -00142 +00142 00143 b2RevoluteJoint(const b2RevoluteJointDef* def); -00144 +00144 00145 void InitVelocityConstraints(const b2TimeStep& step); 00146 void SolveVelocityConstraints(const b2TimeStep& step); -00147 +00147 00148 bool SolvePositionConstraints(float32 baumgarte); -00149 +00149 00150 b2Vec2 m_localAnchor1; // relative 00151 b2Vec2 m_localAnchor2; 00152 b2Vec3 m_impulse; 00153 float32 m_motorImpulse; -00154 +00154 00155 b2Mat33 m_mass; // effective mass for point-to-point constraint. 00156 float32 m_motorMass; // effective mass for motor/limit angular constraint. -00157 +00157 00158 bool m_enableMotor; 00159 float32 m_maxMotorTorque; 00160 float32 m_motorSpeed; -00161 +00161 00162 bool m_enableLimit; 00163 float32 m_referenceAngle; 00164 float32 m_lowerAngle; 00165 float32 m_upperAngle; 00166 b2LimitState m_limitState; 00167 }; -00168 +00168 00169 inline float32 b2RevoluteJoint::GetMotorSpeed() const 00170 { 00171 return m_motorSpeed; 00172 } -00173 +00173 00174 #endif
    Generated on Sat Apr 3 18:18:09 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_settings_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_settings_8h_source.html index 3d54f5b..de13ad4 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_settings_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_settings_8h_source.html @@ -39,13 +39,13 @@

    Box2D/Box2D/Common/b2Settings.h

    Go to the 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_SETTINGS_H 00020 #define B2_SETTINGS_H 00021 00022 #include <cassert> 00023 #include <cmath> -00024 +00024 00025 #define B2_NOT_USED(x) ((void)(x)) 00026 #define b2Assert(A) assert(A) 00027 @@ -56,14 +56,14 @@

    Box2D/Box2D/Common/b2Settings.h

    Go to the 00032 typedef unsigned short uint16; 00033 typedef unsigned int uint32; 00034 typedef float float32; -00035 +00035 00036 #define b2_maxFloat FLT_MAX 00037 #define b2_epsilon FLT_EPSILON 00038 #define b2_pi 3.14159265359f 00039 -00043 +00043 00044 // Collision -00045 +00045 00047 #define b2_maxManifoldPoints 2 00048 00050 #define b2_maxPolygonVertices 8 @@ -78,9 +78,9 @@

    Box2D/Box2D/Common/b2Settings.h

    Go to the 00069 00073 #define b2_polygonRadius (2.0f * b2_linearSlop) 00074 -00075 +00075 00076 // Dynamics -00077 +00077 00079 #define b2_maxTOIContacts 32 00080 00083 #define b2_velocityThreshold 1.0f @@ -98,7 +98,7 @@

    Box2D/Box2D/Common/b2Settings.h

    Go to the 00106 #define b2_contactBaumgarte 0.2f 00107 00108 // Sleep -00109 +00109 00111 #define b2_timeToSleep 0.5f 00112 00114 #define b2_linearSleepTolerance 0.01f @@ -106,30 +106,30 @@

    Box2D/Box2D/Common/b2Settings.h

    Go to the 00117 #define b2_angularSleepTolerance (2.0f / 180.0f * b2_pi) 00118 00119 // Memory Allocation -00120 +00120 00122 void* b2Alloc(int32 size); -00123 +00123 00125 void b2Free(void* mem); -00126 +00126 00129 struct b2Version 00130 { -00131 int32 major; -00132 int32 minor; -00133 int32 revision; +00131 int32 major; +00132 int32 minor; +00133 int32 revision; 00134 }; -00135 +00135 00137 extern b2Version b2_version; -00138 +00138 00140 inline float32 b2MixFriction(float32 friction1, float32 friction2) 00141 { 00142 return sqrtf(friction1 * friction2); 00143 } -00144 +00144 00146 inline float32 b2MixRestitution(float32 restitution1, float32 restitution2) 00147 { 00148 return restitution1 > restitution2 ? restitution1 : restitution2; 00149 } -00150 +00150 00151 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_shape_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_shape_8h_source.html index 6c4a7e5..6551159 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_shape_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_shape_8h_source.html @@ -39,27 +39,27 @@

    Box2D/Box2D/Collision/Shapes/b2Shape.h

    Go to 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_SHAPE_H 00020 #define B2_SHAPE_H 00021 00022 #include <Box2D/Common/b2BlockAllocator.h> 00023 #include <Box2D/Common/b2Math.h> 00024 #include <Box2D/Collision/b2Collision.h> -00025 +00025 00027 struct b2MassData 00028 { 00030 float32 mass; -00031 +00031 00033 b2Vec2 center; -00034 +00034 00036 float32 I; 00037 }; -00038 +00038 00042 class b2Shape 00043 { 00044 public: -00045 +00045 00046 enum Type 00047 { 00048 e_unknown= -1, @@ -67,31 +67,31 @@

    Box2D/Box2D/Collision/Shapes/b2Shape.h

    Go to 00050 e_polygon = 1, 00051 e_typeCount = 2, 00052 }; -00053 +00053 00054 b2Shape() { m_type = e_unknown; } 00055 virtual ~b2Shape() {} -00056 +00056 00058 virtual b2Shape* Clone(b2BlockAllocator* allocator) const = 0; -00059 +00059 00062 Type GetType() const; -00063 +00063 00067 virtual bool TestPoint(const b2Transform& xf, const b2Vec2& p) const = 0; -00068 +00068 00073 virtual bool RayCast(b2RayCastOutput* output, const b2RayCastInput& input, const b2Transform& transform) const = 0; -00074 +00074 00078 virtual void ComputeAABB(b2AABB* aabb, const b2Transform& xf) const = 0; -00079 +00079 00084 virtual void ComputeMass(b2MassData* massData, float32 density) const = 0; -00085 +00085 00086 Type m_type; 00087 float32 m_radius; 00088 }; -00089 +00089 00090 inline b2Shape::Type b2Shape::GetType() const 00091 { 00092 return m_type; 00093 } -00094 +00094 00095 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_stack_allocator_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_stack_allocator_8h_source.html index d364e13..a80a077 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_stack_allocator_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_stack_allocator_8h_source.html @@ -39,22 +39,22 @@

    Box2D/Box2D/Common/b2StackAllocator.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_STACK_ALLOCATOR_H 00020 #define B2_STACK_ALLOCATOR_H 00021 00022 #include <Box2D/Common/b2Settings.h> -00023 +00023 00024 const int32 b2_stackSize = 100 * 1024; // 100k 00025 const int32 b2_maxStackEntries = 32; -00026 +00026 00027 struct b2StackEntry 00028 { 00029 char* data; 00030 int32 size; 00031 bool usedMalloc; 00032 }; -00033 +00033 00034 // This is a stack allocator used for fast per step allocations. 00035 // You must nest allocate/free pairs. The code will assert 00036 // if you try to interleave multiple allocate/free pairs. @@ -63,24 +63,24 @@

    Box2D/Box2D/Common/b2StackAllocator.h

    00039 public: 00040 b2StackAllocator(); 00041 ~b2StackAllocator(); -00042 +00042 00043 void* Allocate(int32 size); 00044 void Free(void* p); -00045 +00045 00046 int32 GetMaxAllocation() const; -00047 +00047 00048 private: -00049 +00049 00050 char m_data[b2_stackSize]; 00051 int32 m_index; -00052 +00052 00053 int32 m_allocation; 00054 int32 m_maxAllocation; -00055 +00055 00056 b2StackEntry m_entries[b2_maxStackEntries]; 00057 int32 m_entryCount; 00058 }; -00059 +00059 00060 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_t_o_i_solver_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_t_o_i_solver_8h_source.html index 2c2bd13..4ca0c0e 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_t_o_i_solver_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_t_o_i_solver_8h_source.html @@ -39,37 +39,37 @@

    Box2D/Box2D/Dynamics/Contacts/b2TOISolver.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_TOI_SOLVER_H 00020 #define B2_TOI_SOLVER_H 00021 00022 #include <Box2D/Common/b2Math.h> -00023 +00023 00024 class b2Contact; 00025 class b2Body; 00026 struct b2TOIConstraint; 00027 class b2StackAllocator; -00028 +00028 00031 class b2TOISolver 00032 { 00033 public: 00034 b2TOISolver(b2StackAllocator* allocator); 00035 ~b2TOISolver(); -00036 +00036 00037 void Initialize(b2Contact** contacts, int32 contactCount, b2Body* toiBody); 00038 void Clear(); -00039 +00039 00040 // Perform one solver iteration. Returns true if converged. 00041 bool Solve(float32 baumgarte); -00042 +00042 00043 private: -00044 +00044 00045 b2TOIConstraint* m_constraints; 00046 int32 m_count; 00047 b2Body* m_toiBody; 00048 b2StackAllocator* m_allocator; 00049 }; -00050 +00050 00051 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_time_of_impact_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_time_of_impact_8h_source.html index 1c74465..e3aba7f 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_time_of_impact_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_time_of_impact_8h_source.html @@ -39,14 +39,14 @@

    Box2D/Box2D/Collision/b2TimeOfImpact.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_TIME_OF_IMPACT_H 00020 #define B2_TIME_OF_IMPACT_H 00021 00022 #include <Box2D/Common/b2Math.h> 00023 #include <Box2D/Collision/b2Distance.h> 00024 #include <climits> -00025 +00025 00027 struct b2TOIInput 00028 { 00029 b2DistanceProxy proxyA; @@ -55,7 +55,7 @@

    Box2D/Box2D/Collision/b2TimeOfImpact.h

    00032 b2Sweep sweepB; 00033 float32 tMax; // defines sweep interval [0, tMax] 00034 }; -00035 +00035 00036 // Output parameters for b2TimeOfImpact. 00037 struct b2TOIOutput 00038 { @@ -67,13 +67,13 @@

    Box2D/Box2D/Collision/b2TimeOfImpact.h

    00044 e_touching, 00045 e_separated 00046 }; -00047 +00047 00048 State state; 00049 float32 t; 00050 }; -00051 +00051 00057 void b2TimeOfImpact(b2TOIOutput* output, const b2TOIInput* input); -00058 +00058 00059 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_time_step_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_time_step_8h_source.html index db14705..ead4b81 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_time_step_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_time_step_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/b2TimeStep.h

    Go to t 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_TIME_STEP_H 00020 #define B2_TIME_STEP_H 00021 00022 #include <Box2D/Common/b2Settings.h> -00023 +00023 00025 struct b2TimeStep 00026 { 00027 float32 dt; // time step @@ -54,7 +54,7 @@

    Box2D/Box2D/Dynamics/b2TimeStep.h

    Go to t 00031 int32 positionIterations; 00032 bool warmStarting; 00033 }; -00034 +00034 00035 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_weld_joint_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_weld_joint_8h_source.html index 72bc392..143e38c 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_weld_joint_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_weld_joint_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/Joints/b2WeldJoint.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_WELD_JOINT_H 00020 #define B2_WELD_JOINT_H 00021 00022 #include <Box2D/Dynamics/Joints/b2Joint.h> -00023 +00023 00027 struct b2WeldJointDef : public b2JointDef 00028 { 00029 b2WeldJointDef() @@ -54,45 +54,45 @@

    Box2D/Box2D/Dynamics/Joints/b2WeldJoint.h

    00033 localAnchorB.Set(0.0f, 0.0f); 00034 referenceAngle = 0.0f; 00035 } -00036 +00036 00039 void Initialize(b2Body* body1, b2Body* body2, const b2Vec2& anchor); -00040 +00040 00042 b2Vec2 localAnchorA; -00043 +00043 00045 b2Vec2 localAnchorB; -00046 +00046 00048 float32 referenceAngle; 00049 }; -00050 +00050 00053 class b2WeldJoint : public b2Joint 00054 { 00055 public: 00056 b2Vec2 GetAnchorA() const; 00057 b2Vec2 GetAnchorB() const; -00058 +00058 00059 b2Vec2 GetReactionForce(float32 inv_dt) const; 00060 float32 GetReactionTorque(float32 inv_dt) const; -00061 +00061 00062 protected: -00063 +00063 00064 friend class b2Joint; -00065 +00065 00066 b2WeldJoint(const b2WeldJointDef* def); -00067 +00067 00068 void InitVelocityConstraints(const b2TimeStep& step); 00069 void SolveVelocityConstraints(const b2TimeStep& step); -00070 +00070 00071 bool SolvePositionConstraints(float32 baumgarte); -00072 +00072 00073 b2Vec2 m_localAnchorA; 00074 b2Vec2 m_localAnchorB; 00075 float32 m_referenceAngle; -00076 +00076 00077 b2Vec3 m_impulse; -00078 +00078 00079 b2Mat33 m_mass; 00080 }; -00081 +00081 00082 #endif
    Generated on Sat Apr 3 18:18:09 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_world_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_world_8h_source.html index 8e53ab8..d2f4746 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_world_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_world_8h_source.html @@ -39,7 +39,7 @@

    Box2D/Box2D/Dynamics/b2World.h

    Go to the docu 00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_WORLD_H 00020 #define B2_WORLD_H 00021 @@ -48,7 +48,7 @@

    Box2D/Box2D/Dynamics/b2World.h

    Go to the docu 00024 #include <Box2D/Common/b2StackAllocator.h> 00025 #include <Box2D/Dynamics/b2ContactManager.h> 00026 #include <Box2D/Dynamics/b2WorldCallbacks.h> -00027 +00027 00028 struct b2AABB; 00029 struct b2BodyDef; 00030 struct b2JointDef; @@ -56,72 +56,72 @@

    Box2D/Box2D/Dynamics/b2World.h

    Go to the docu 00032 class b2Body; 00033 class b2Fixture; 00034 class b2Joint; -00035 +00035 00039 class b2World 00040 { 00041 public: 00045 b2World(const b2Vec2& gravity, bool doSleep); -00046 +00046 00048 ~b2World(); -00049 +00049 00052 void SetDestructionListener(b2DestructionListener* listener); -00053 +00053 00057 void SetContactFilter(b2ContactFilter* filter); -00058 +00058 00061 void SetContactListener(b2ContactListener* listener); -00062 +00062 00066 void SetDebugDraw(b2DebugDraw* debugDraw); -00067 +00067 00071 b2Body* CreateBody(const b2BodyDef* def); -00072 +00072 00077 void DestroyBody(b2Body* body); -00078 +00078 00082 b2Joint* CreateJoint(const b2JointDef* def); -00083 +00083 00086 void DestroyJoint(b2Joint* joint); -00087 +00087 00093 void Step( float32 timeStep, 00094 int32 velocityIterations, 00095 int32 positionIterations); -00096 +00096 00101 void ClearForces(); -00102 +00102 00104 void DrawDebugData(); -00105 +00105 00110 void QueryAABB(b2QueryCallback* callback, const b2AABB& aabb) const; -00111 +00111 00118 void RayCast(b2RayCastCallback* callback, const b2Vec2& point1, const b2Vec2& point2) const; -00119 +00119 00123 b2Body* GetBodyList(); -00124 +00124 00128 b2Joint* GetJointList(); -00129 +00129 00134 b2Contact* GetContactList(); -00135 +00135 00137 void SetWarmStarting(bool flag) { m_warmStarting = flag; } -00138 +00138 00140 void SetContinuousPhysics(bool flag) { m_continuousPhysics = flag; } -00141 +00141 00143 int32 GetProxyCount() const; -00144 +00144 00146 int32 GetBodyCount() const; -00147 +00147 00149 int32 GetJointCount() const; -00150 +00150 00152 int32 GetContactCount() const; -00153 +00153 00155 void SetGravity(const b2Vec2& gravity); -00156 +00156 00158 b2Vec2 GetGravity() const; -00159 +00159 00161 bool IsLocked() const; -00162 +00162 00164 void SetAutoClearForces(bool flag); -00165 +00165 00167 bool GetAutoClearForces() const; -00168 +00168 00169 private: -00170 +00170 00171 // m_flags 00172 enum 00173 { @@ -129,95 +129,95 @@

    Box2D/Box2D/Dynamics/b2World.h

    Go to the docu 00175 e_locked = 0x0002, 00176 e_clearForces = 0x0004, 00177 }; -00178 +00178 00179 friend class b2Body; 00180 friend class b2ContactManager; 00181 friend class b2Controller; -00182 +00182 00183 void Solve(const b2TimeStep& step); 00184 void SolveTOI(); 00185 void SolveTOI(b2Body* body); -00186 +00186 00187 void DrawJoint(b2Joint* joint); 00188 void DrawShape(b2Fixture* shape, const b2Transform& xf, const b2Color& color); -00189 +00189 00190 b2BlockAllocator m_blockAllocator; 00191 b2StackAllocator m_stackAllocator; -00192 +00192 00193 int32 m_flags; -00194 +00194 00195 b2ContactManager m_contactManager; -00196 +00196 00197 b2Body* m_bodyList; 00198 b2Joint* m_jointList; -00199 +00199 00200 int32 m_bodyCount; 00201 int32 m_jointCount; -00202 +00202 00203 b2Vec2 m_gravity; 00204 bool m_allowSleep; -00205 +00205 00206 b2Body* m_groundBody; -00207 +00207 00208 b2DestructionListener* m_destructionListener; 00209 b2DebugDraw* m_debugDraw; -00210 +00210 00211 // This is used to compute the time step ratio to 00212 // support a variable time step. 00213 float32 m_inv_dt0; -00214 +00214 00215 // This is for debugging the solver. 00216 bool m_warmStarting; -00217 +00217 00218 // This is for debugging the solver. 00219 bool m_continuousPhysics; 00220 }; -00221 +00221 00222 inline b2Body* b2World::GetBodyList() 00223 { 00224 return m_bodyList; 00225 } -00226 +00226 00227 inline b2Joint* b2World::GetJointList() 00228 { 00229 return m_jointList; 00230 } -00231 +00231 00232 inline b2Contact* b2World::GetContactList() 00233 { 00234 return m_contactManager.m_contactList; 00235 } -00236 +00236 00237 inline int32 b2World::GetBodyCount() const 00238 { 00239 return m_bodyCount; 00240 } -00241 +00241 00242 inline int32 b2World::GetJointCount() const 00243 { 00244 return m_jointCount; 00245 } -00246 +00246 00247 inline int32 b2World::GetContactCount() const 00248 { 00249 return m_contactManager.m_contactCount; 00250 } -00251 +00251 00252 inline void b2World::SetGravity(const b2Vec2& gravity) 00253 { 00254 m_gravity = gravity; 00255 } -00256 +00256 00257 inline b2Vec2 b2World::GetGravity() const 00258 { 00259 return m_gravity; 00260 } -00261 +00261 00262 inline bool b2World::IsLocked() const 00263 { 00264 return (m_flags & e_locked) == e_locked; 00265 } -00266 +00266 00267 inline void b2World::SetAutoClearForces(bool flag) 00268 { 00269 if (flag) @@ -229,12 +229,12 @@

    Box2D/Box2D/Dynamics/b2World.h

    Go to the docu 00275 m_flags &= ~e_clearForces; 00276 } 00277 } -00278 +00278 00280 inline bool b2World::GetAutoClearForces() const 00281 { 00282 return (m_flags & e_clearForces) == e_clearForces; 00283 } -00284 +00284 00285 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/b2_world_callbacks_8h_source.html b/Libraries/Box2D/sdk/Documentation/API/b2_world_callbacks_8h_source.html index 96bff1a..067474a 100755 --- a/Libraries/Box2D/sdk/Documentation/API/b2_world_callbacks_8h_source.html +++ b/Libraries/Box2D/sdk/Documentation/API/b2_world_callbacks_8h_source.html @@ -39,12 +39,12 @@

    Box2D/Box2D/Dynamics/b2WorldCallbacks.h

    00015 * misrepresented as being the original software. 00016 * 3. This notice may not be removed or altered from any source distribution. 00017 */ -00018 +00018 00019 #ifndef B2_WORLD_CALLBACKS_H 00020 #define B2_WORLD_CALLBACKS_H 00021 00022 #include <Box2D/Common/b2Settings.h> -00023 +00023 00024 struct b2Vec2; 00025 struct b2Transform; 00026 class b2Fixture; @@ -54,70 +54,70 @@

    Box2D/Box2D/Dynamics/b2WorldCallbacks.h

    00030 struct b2ContactPoint; 00031 struct b2ContactResult; 00032 struct b2Manifold; -00033 +00033 00037 class b2DestructionListener 00038 { 00039 public: 00040 virtual ~b2DestructionListener() {} -00041 +00041 00044 virtual void SayGoodbye(b2Joint* joint) = 0; -00045 +00045 00048 virtual void SayGoodbye(b2Fixture* fixture) = 0; 00049 }; -00050 +00050 00053 class b2ContactFilter 00054 { 00055 public: 00056 virtual ~b2ContactFilter() {} -00057 +00057 00060 virtual bool ShouldCollide(b2Fixture* fixtureA, b2Fixture* fixtureB); 00061 }; -00062 +00062 00066 struct b2ContactImpulse 00067 { 00068 float32 normalImpulses[b2_maxManifoldPoints]; 00069 float32 tangentImpulses[b2_maxManifoldPoints]; 00070 }; -00071 +00071 00081 class b2ContactListener 00082 { 00083 public: 00084 virtual ~b2ContactListener() {} -00085 +00085 00087 virtual void BeginContact(b2Contact* contact) { B2_NOT_USED(contact); } -00088 +00088 00090 virtual void EndContact(b2Contact* contact) { B2_NOT_USED(contact); } -00091 +00091 00102 virtual void PreSolve(b2Contact* contact, const b2Manifold* oldManifold) 00103 { 00104 B2_NOT_USED(contact); 00105 B2_NOT_USED(oldManifold); 00106 } -00107 +00107 00114 virtual void PostSolve(b2Contact* contact, const b2ContactImpulse* impulse) 00115 { 00116 B2_NOT_USED(contact); 00117 B2_NOT_USED(impulse); 00118 } 00119 }; -00120 +00120 00123 class b2QueryCallback 00124 { 00125 public: 00126 virtual ~b2QueryCallback() {} -00127 +00127 00130 virtual bool ReportFixture(b2Fixture* fixture) = 0; 00131 }; -00132 +00132 00135 class b2RayCastCallback 00136 { 00137 public: 00138 virtual ~b2RayCastCallback() {} -00139 +00139 00151 virtual float32 ReportFixture( b2Fixture* fixture, const b2Vec2& point, 00152 const b2Vec2& normal, float32 fraction) = 0; 00153 }; -00154 +00154 00156 struct b2Color 00157 { 00158 b2Color() {} @@ -125,47 +125,47 @@

    Box2D/Box2D/Dynamics/b2WorldCallbacks.h

    00160 void Set(float32 ri, float32 gi, float32 bi) { r = ri; g = gi; b = bi; } 00161 float32 r, g, b; 00162 }; -00163 +00163 00166 class b2DebugDraw 00167 { 00168 public: 00169 b2DebugDraw(); -00170 +00170 00171 virtual ~b2DebugDraw() {} -00172 +00172 00173 enum 00174 { -00175 e_shapeBit = 0x0001, -00176 e_jointBit = 0x0002, -00177 e_aabbBit = 0x0004, -00178 e_pairBit = 0x0008, -00179 e_centerOfMassBit = 0x0010, +00175 e_shapeBit = 0x0001, +00176 e_jointBit = 0x0002, +00177 e_aabbBit = 0x0004, +00178 e_pairBit = 0x0008, +00179 e_centerOfMassBit = 0x0010, 00180 }; -00181 +00181 00183 void SetFlags(uint32 flags); -00184 +00184 00186 uint32 GetFlags() const; -00187 +00187 00189 void AppendFlags(uint32 flags); -00190 +00190 00192 void ClearFlags(uint32 flags); -00193 +00193 00195 virtual void DrawPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; -00196 +00196 00198 virtual void DrawSolidPolygon(const b2Vec2* vertices, int32 vertexCount, const b2Color& color) = 0; -00199 +00199 00201 virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0; -00202 +00202 00204 virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) = 0; -00205 +00205 00207 virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) = 0; -00208 +00208 00211 virtual void DrawTransform(const b2Transform& xf) = 0; -00212 +00212 00213 protected: 00214 uint32 m_drawFlags; 00215 }; -00216 +00216 00217 #endif
    Generated on Sat Apr 3 18:18:08 2010 for Box2D by  diff --git a/Libraries/Box2D/sdk/Documentation/API/classb2_body.html b/Libraries/Box2D/sdk/Documentation/API/classb2_body.html index 4cb9707..ab86d08 100755 --- a/Libraries/Box2D/sdk/Documentation/API/classb2_body.html +++ b/Libraries/Box2D/sdk/Documentation/API/classb2_body.html @@ -26,7 +26,7 @@

    b2Body Class Reference

    -

    A rigid body. These are created via b2World::CreateBody. +

    A rigid body. These are created via b2World::CreateBody. More...

    #include <b2Body.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/classb2_circle_shape.html b/Libraries/Box2D/sdk/Documentation/API/classb2_circle_shape.html index 76c6b8e..e63a91a 100755 --- a/Libraries/Box2D/sdk/Documentation/API/classb2_circle_shape.html +++ b/Libraries/Box2D/sdk/Documentation/API/classb2_circle_shape.html @@ -26,7 +26,7 @@

    b2CircleShape Class Reference

    -

    A circle shape. +

    A circle shape. More...

    #include <b2CircleShape.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/classb2_contact.html b/Libraries/Box2D/sdk/Documentation/API/classb2_contact.html index 680809e..d32ecd3 100755 --- a/Libraries/Box2D/sdk/Documentation/API/classb2_contact.html +++ b/Libraries/Box2D/sdk/Documentation/API/classb2_contact.html @@ -64,9 +64,9 @@

    b2Contact Class Reference

    virtual void Evaluate (b2Manifold *manifold, const b2Transform &xfA, const b2Transform &xfB)=0  Evaluate this contact with your own manifold and transforms.

    Protected Types

    -enum  { e_islandFlag = 0x0001, -e_touchingFlag = 0x0002, -e_enabledFlag = 0x0004, +enum  { e_islandFlag = 0x0001, +e_touchingFlag = 0x0002, +e_enabledFlag = 0x0004, e_filterFlag = 0x0008 }

    Protected Member Functions

    diff --git a/Libraries/Box2D/sdk/Documentation/API/classb2_debug_draw.html b/Libraries/Box2D/sdk/Documentation/API/classb2_debug_draw.html index 74045c8..671c867 100755 --- a/Libraries/Box2D/sdk/Documentation/API/classb2_debug_draw.html +++ b/Libraries/Box2D/sdk/Documentation/API/classb2_debug_draw.html @@ -32,10 +32,10 @@

    b2DebugDraw Class Reference

    Public Types

    enum  {
    -  e_shapeBit = 0x0001, -e_jointBit = 0x0002, -e_aabbBit = 0x0004, -e_pairBit = 0x0008, +  e_shapeBit = 0x0001, +e_jointBit = 0x0002, +e_aabbBit = 0x0004, +e_pairBit = 0x0008,
      e_centerOfMassBit = 0x0010
    diff --git a/Libraries/Box2D/sdk/Documentation/API/classb2_island.html b/Libraries/Box2D/sdk/Documentation/API/classb2_island.html index 4a73828..06eb424 100755 --- a/Libraries/Box2D/sdk/Documentation/API/classb2_island.html +++ b/Libraries/Box2D/sdk/Documentation/API/classb2_island.html @@ -26,7 +26,7 @@

    b2Island Class Reference

    -

    This is an internal class. +

    This is an internal class. More...

    #include <b2Island.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/classb2_shape.html b/Libraries/Box2D/sdk/Documentation/API/classb2_shape.html index 91cc32c..a5ea6b4 100755 --- a/Libraries/Box2D/sdk/Documentation/API/classb2_shape.html +++ b/Libraries/Box2D/sdk/Documentation/API/classb2_shape.html @@ -42,9 +42,9 @@

    b2Shape Class Reference

    List of all members.

    - diff --git a/Libraries/Box2D/sdk/Documentation/API/doxygen.css b/Libraries/Box2D/sdk/Documentation/API/doxygen.css index d6aaf28..622fb64 100755 --- a/Libraries/Box2D/sdk/Documentation/API/doxygen.css +++ b/Libraries/Box2D/sdk/Documentation/API/doxygen.css @@ -199,7 +199,7 @@ p.formulaDsp { } img.formulaDsp { - + } img.formulaInl { @@ -252,20 +252,20 @@ span.charliteral { color: #008080 } -span.vhdldigit { - color: #ff00ff +span.vhdldigit { + color: #ff00ff } -span.vhdlchar { - color: #000000 +span.vhdlchar { + color: #000000 } -span.vhdlkeyword { - color: #700070 +span.vhdlkeyword { + color: #700070 } -span.vhdllogic { - color: #ff0000 +span.vhdllogic { + color: #ff0000 } /* @end */ @@ -375,9 +375,9 @@ hr.footer { } .memproto { - border-top: 1px solid #84b0c7; - border-left: 1px solid #84b0c7; - border-right: 1px solid #84b0c7; + border-top: 1px solid #84b0c7; + border-left: 1px solid #84b0c7; + border-right: 1px solid #84b0c7; padding: 0; background-color: #d5e1e8; font-weight: bold; @@ -395,9 +395,9 @@ hr.footer { } .memdoc { - border-bottom: 1px solid #84b0c7; - border-left: 1px solid #84b0c7; - border-right: 1px solid #84b0c7; + border-bottom: 1px solid #84b0c7; + border-left: 1px solid #84b0c7; + border-right: 1px solid #84b0c7; padding: 2px 5px; background-color: #eef3f5; border-top-width: 0; diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_a_a_b_b.html b/Libraries/Box2D/sdk/Documentation/API/structb2_a_a_b_b.html index 9b25688..89f41d7 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_a_a_b_b.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_a_a_b_b.html @@ -26,7 +26,7 @@

    b2AABB Struct Reference

    -

    An axis aligned bounding box. +

    An axis aligned bounding box. More...

    #include <b2Collision.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_clip_vertex.html b/Libraries/Box2D/sdk/Documentation/API/structb2_clip_vertex.html index 5c80da1..37dec43 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_clip_vertex.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_clip_vertex.html @@ -26,7 +26,7 @@

    b2ClipVertex Struct Reference

    -

    Used for computing contact manifolds. +

    Used for computing contact manifolds. More...

    #include <b2Collision.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_color.html b/Libraries/Box2D/sdk/Documentation/API/structb2_color.html index ecddcc1..01a5e89 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_color.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_color.html @@ -26,7 +26,7 @@

    b2Color Struct Reference

    -

    Color for debug drawing. Each value has the range [0,1]. +

    Color for debug drawing. Each value has the range [0,1]. More...

    #include <b2WorldCallbacks.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_contact_i_d_1_1_features.html b/Libraries/Box2D/sdk/Documentation/API/structb2_contact_i_d_1_1_features.html index 551587e..4e57481 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_contact_i_d_1_1_features.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_contact_i_d_1_1_features.html @@ -28,7 +28,7 @@

    b2ContactID::Features Struct Reference

    -

    The features that intersect to form the contact point. +

    The features that intersect to form the contact point. More...

    #include <b2Collision.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_distance_output.html b/Libraries/Box2D/sdk/Documentation/API/structb2_distance_output.html index 305ca37..0bf5fbc 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_distance_output.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_distance_output.html @@ -26,7 +26,7 @@

    b2DistanceOutput Struct Reference

    -

    Output for b2Distance. +

    Output for b2Distance. More...

    #include <b2Distance.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_dynamic_tree_node.html b/Libraries/Box2D/sdk/Documentation/API/structb2_dynamic_tree_node.html index 3751aad..c1ed778 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_dynamic_tree_node.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_dynamic_tree_node.html @@ -26,7 +26,7 @@

    b2DynamicTreeNode Struct Reference

    -

    A node in the dynamic tree. The client does not interact with this directly. +

    A node in the dynamic tree. The client does not interact with this directly. More...

    #include <b2DynamicTree.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_filter.html b/Libraries/Box2D/sdk/Documentation/API/structb2_filter.html index cdbd579..c44a130 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_filter.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_filter.html @@ -26,7 +26,7 @@

    b2Filter Struct Reference

    -

    This holds contact filtering data. +

    This holds contact filtering data. More...

    #include <b2Fixture.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_friction_joint_def.html b/Libraries/Box2D/sdk/Documentation/API/structb2_friction_joint_def.html index 7ba6e82..b718021 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_friction_joint_def.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_friction_joint_def.html @@ -26,7 +26,7 @@

    b2FrictionJointDef Struct Reference

    -

    Friction joint definition. +

    Friction joint definition. More...

    #include <b2FrictionJoint.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_joint_def.html b/Libraries/Box2D/sdk/Documentation/API/structb2_joint_def.html index abd8f52..d7f4739 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_joint_def.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_joint_def.html @@ -26,7 +26,7 @@

    b2JointDef Struct Reference

    -

    Joint definitions are used to construct joints. +

    Joint definitions are used to construct joints. More...

    #include <b2Joint.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_manifold.html b/Libraries/Box2D/sdk/Documentation/API/structb2_manifold.html index 574752a..0b317a8 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_manifold.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_manifold.html @@ -31,8 +31,8 @@

    b2Manifold Struct Reference

    List of all members.

    Public Types

    enum  Type { e_unknown = -1, -e_circle = 0, -e_polygon = 1, +
    enum  Type { e_unknown = -1, +e_circle = 0, +e_polygon = 1, e_typeCount = 2 }

    Public Member Functions

    - diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_mass_data.html b/Libraries/Box2D/sdk/Documentation/API/structb2_mass_data.html index ce9863c..3cce98e 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_mass_data.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_mass_data.html @@ -26,7 +26,7 @@

    b2MassData Struct Reference

    -

    This holds the mass data computed for a shape. +

    This holds the mass data computed for a shape. More...

    #include <b2Shape.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_mat22.html b/Libraries/Box2D/sdk/Documentation/API/structb2_mat22.html index 28fb89e..ea62f9c 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_mat22.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_mat22.html @@ -26,7 +26,7 @@

    b2Mat22 Struct Reference

    -

    A 2-by-2 matrix. Stored in column-major order. +

    A 2-by-2 matrix. Stored in column-major order. More...

    #include <b2Math.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_mat33.html b/Libraries/Box2D/sdk/Documentation/API/structb2_mat33.html index 6b0bf3e..c2f432c 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_mat33.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_mat33.html @@ -26,7 +26,7 @@

    b2Mat33 Struct Reference

    -

    A 3-by-3 matrix. Stored in column-major order. +

    A 3-by-3 matrix. Stored in column-major order. More...

    #include <b2Math.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_position.html b/Libraries/Box2D/sdk/Documentation/API/structb2_position.html index c30a05c..2569f9b 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_position.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_position.html @@ -26,7 +26,7 @@

    b2Position Struct Reference

    -

    This is an internal structure. +

    This is an internal structure. More...

    #include <b2Island.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_ray_cast_input.html b/Libraries/Box2D/sdk/Documentation/API/structb2_ray_cast_input.html index 7aed7e4..817ca99 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_ray_cast_input.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_ray_cast_input.html @@ -26,7 +26,7 @@

    b2RayCastInput Struct Reference

    -

    Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). +

    Ray-cast input data. The ray extends from p1 to p1 + maxFraction * (p2 - p1). More...

    #include <b2Collision.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_separation_function.html b/Libraries/Box2D/sdk/Documentation/API/structb2_separation_function.html index b90e8f3..f93bfd4 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_separation_function.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_separation_function.html @@ -29,8 +29,8 @@

    b2SeparationFunction Struct Reference

    -

    Input parameters for b2TimeOfImpact. +

    Input parameters for b2TimeOfImpact. More...

    #include <b2TimeOfImpact.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_t_o_i_output.html b/Libraries/Box2D/sdk/Documentation/API/structb2_t_o_i_output.html index 17fbb75..433e792 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_t_o_i_output.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_t_o_i_output.html @@ -32,10 +32,10 @@

    b2TOIOutput Struct Reference

    Public Types

    enum  Type { e_circles, -e_faceA, +
    enum  Type { e_circles, +e_faceA, e_faceB }

    Public Attributes

    Public Types

    enum  State {
    -  e_unknown, -e_failed, -e_overlapped, -e_touching, +  e_unknown, +e_failed, +e_overlapped, +e_touching,
      e_separated
    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_time_step.html b/Libraries/Box2D/sdk/Documentation/API/structb2_time_step.html index 7612c1f..f5fb979 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_time_step.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_time_step.html @@ -26,7 +26,7 @@

    b2TimeStep Struct Reference

    -

    This is an internal structure. +

    This is an internal structure. More...

    #include <b2TimeStep.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_vec2.html b/Libraries/Box2D/sdk/Documentation/API/structb2_vec2.html index 23c4f29..7cef8c1 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_vec2.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_vec2.html @@ -26,7 +26,7 @@

    b2Vec2 Struct Reference

    -

    A 2D column vector. +

    A 2D column vector. More...

    #include <b2Math.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_vec3.html b/Libraries/Box2D/sdk/Documentation/API/structb2_vec3.html index e15e238..9b1911c 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_vec3.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_vec3.html @@ -26,7 +26,7 @@

    b2Vec3 Struct Reference

    -

    A 2D column vector with 3 elements. +

    A 2D column vector with 3 elements. More...

    #include <b2Math.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_velocity.html b/Libraries/Box2D/sdk/Documentation/API/structb2_velocity.html index f71b45c..513e1ef 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_velocity.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_velocity.html @@ -26,7 +26,7 @@

    b2Velocity Struct Reference

    -

    This is an internal structure. +

    This is an internal structure. More...

    #include <b2Island.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/structb2_world_manifold.html b/Libraries/Box2D/sdk/Documentation/API/structb2_world_manifold.html index 611fb65..ee60307 100755 --- a/Libraries/Box2D/sdk/Documentation/API/structb2_world_manifold.html +++ b/Libraries/Box2D/sdk/Documentation/API/structb2_world_manifold.html @@ -26,7 +26,7 @@

    b2WorldManifold Struct Reference

    -

    This is used to compute the current state of a contact manifold. +

    This is used to compute the current state of a contact manifold. More...

    #include <b2Collision.h>

    diff --git a/Libraries/Box2D/sdk/Documentation/API/unionb2_contact_i_d.html b/Libraries/Box2D/sdk/Documentation/API/unionb2_contact_i_d.html index dd8186b..af84e4d 100755 --- a/Libraries/Box2D/sdk/Documentation/API/unionb2_contact_i_d.html +++ b/Libraries/Box2D/sdk/Documentation/API/unionb2_contact_i_d.html @@ -26,7 +26,7 @@

    b2ContactID Union Reference

    -

    Contact ids to facilitate warm starting. +

    Contact ids to facilitate warm starting. More...

    #include <b2Collision.h>

    diff --git a/Libraries/Box2D/sdk/include/Box2D/Collision/Shapes/b2Shape.h b/Libraries/Box2D/sdk/include/Box2D/Collision/Shapes/b2Shape.h index 755679d..969abfd 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Collision/Shapes/b2Shape.h +++ b/Libraries/Box2D/sdk/include/Box2D/Collision/Shapes/b2Shape.h @@ -42,7 +42,7 @@ struct b2MassData class b2Shape { public: - + enum Type { e_unknown= -1, diff --git a/Libraries/Box2D/sdk/include/Box2D/Collision/b2Distance.h b/Libraries/Box2D/sdk/include/Box2D/Collision/b2Distance.h index 9fbae99..9babfa6 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Collision/b2Distance.h +++ b/Libraries/Box2D/sdk/include/Box2D/Collision/b2Distance.h @@ -64,7 +64,7 @@ struct b2SimplexCache /// Input for b2Distance. /// You have to option to use the shape radii -/// in the computation. Even +/// in the computation. Even struct b2DistanceInput { b2DistanceProxy proxyA; @@ -87,7 +87,7 @@ struct b2DistanceOutput /// b2CircleShape, b2PolygonShape, b2EdgeShape. The simplex cache is input/output. /// On the first call set b2SimplexCache.count to zero. void b2Distance(b2DistanceOutput* output, - b2SimplexCache* cache, + b2SimplexCache* cache, const b2DistanceInput* input); diff --git a/Libraries/Box2D/sdk/include/Box2D/Common/b2Math.h b/Libraries/Box2D/sdk/include/Box2D/Common/b2Math.h index a4d7028..e05d8e1 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Common/b2Math.h +++ b/Libraries/Box2D/sdk/include/Box2D/Common/b2Math.h @@ -82,7 +82,7 @@ struct b2Vec2 /// Negate this vector. b2Vec2 operator -() const { b2Vec2 v; v.Set(-x, -y); return v; } - + /// Read from and indexed element. float32 operator () (int32 i) const { @@ -100,7 +100,7 @@ struct b2Vec2 { x += v.x; y += v.y; } - + /// Subtract a vector from this vector. void operator -= (const b2Vec2& v) { diff --git a/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PrismaticJoint.h b/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PrismaticJoint.h index c5bfb53..545f955 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PrismaticJoint.h +++ b/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PrismaticJoint.h @@ -161,7 +161,7 @@ class b2PrismaticJoint : public b2Joint float32 m_upperTranslation; float32 m_maxMotorForce; float32 m_motorSpeed; - + bool m_enableLimit; bool m_enableMotor; b2LimitState m_limitState; diff --git a/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PulleyJoint.h b/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PulleyJoint.h index fc9ff7d..fd691f6 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PulleyJoint.h +++ b/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2PulleyJoint.h @@ -123,10 +123,10 @@ class b2PulleyJoint : public b2Joint b2Vec2 m_u1; b2Vec2 m_u2; - + float32 m_constant; float32 m_ratio; - + float32 m_maxLength1; float32 m_maxLength2; diff --git a/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2RevoluteJoint.h b/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2RevoluteJoint.h index 2b30a7e..c2ef524 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2RevoluteJoint.h +++ b/Libraries/Box2D/sdk/include/Box2D/Dynamics/Joints/b2RevoluteJoint.h @@ -136,7 +136,7 @@ class b2RevoluteJoint : public b2Joint float32 GetMotorTorque() const; protected: - + friend class b2Joint; friend class b2GearJoint; @@ -154,7 +154,7 @@ class b2RevoluteJoint : public b2Joint b2Mat33 m_mass; // effective mass for point-to-point constraint. float32 m_motorMass; // effective mass for motor/limit angular constraint. - + bool m_enableMotor; float32 m_maxMotorTorque; float32 m_motorSpeed; diff --git a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2Body.h b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2Body.h index a83a652..583937a 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2Body.h +++ b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2Body.h @@ -369,7 +369,7 @@ class b2Body friend class b2ContactManager; friend class b2ContactSolver; friend class b2TOISolver; - + friend class b2DistanceJoint; friend class b2GearJoint; friend class b2LineJoint; diff --git a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2ContactManager.h b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2ContactManager.h index 0b3c74d..2a6fc7c 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2ContactManager.h +++ b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2ContactManager.h @@ -40,7 +40,7 @@ class b2ContactManager void Destroy(b2Contact* c); void Collide(); - + b2BroadPhase m_broadPhase; b2Contact* m_contactList; int32 m_contactCount; diff --git a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2World.h b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2World.h index bff1427..0b469c1 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2World.h +++ b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2World.h @@ -53,7 +53,7 @@ class b2World /// Register a contact filter to provide specific control over collision. /// Otherwise the default filter is used (b2_defaultFilter). The listener is - /// owned by you and must remain in scope. + /// owned by you and must remain in scope. void SetContactFilter(b2ContactFilter* filter); /// Register a contact event listener. The listener is owned by you and must @@ -130,7 +130,7 @@ class b2World /// Get the world contact list. With the returned contact, use b2Contact::GetNext to get /// the next contact in the world list. A NULL contact indicates the end of the list. /// @return the head of the world contact list. - /// @warning contacts are + /// @warning contacts are b2Contact* GetContactList(); /// Enable/disable warm starting. For testing. @@ -153,7 +153,7 @@ class b2World /// Change the global gravity vector. void SetGravity(const b2Vec2& gravity); - + /// Get the global gravity vector. b2Vec2 GetGravity() const; diff --git a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2WorldCallbacks.h b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2WorldCallbacks.h index ec3e039..c10da6a 100755 --- a/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2WorldCallbacks.h +++ b/Libraries/Box2D/sdk/include/Box2D/Dynamics/b2WorldCallbacks.h @@ -184,7 +184,7 @@ class b2DebugDraw /// Get the drawing flags. uint32 GetFlags() const; - + /// Append flags to the current flags. void AppendFlags(uint32 flags); @@ -199,10 +199,10 @@ class b2DebugDraw /// Draw a circle. virtual void DrawCircle(const b2Vec2& center, float32 radius, const b2Color& color) = 0; - + /// Draw a solid circle. virtual void DrawSolidCircle(const b2Vec2& center, float32 radius, const b2Vec2& axis, const b2Color& color) = 0; - + /// Draw a line segment. virtual void DrawSegment(const b2Vec2& p1, const b2Vec2& p2, const b2Color& color) = 0; diff --git a/Libraries/Box2D/sdk/src/b2BlockAllocator.cpp b/Libraries/Box2D/sdk/src/b2BlockAllocator.cpp index 0407682..a60b907 100755 --- a/Libraries/Box2D/sdk/src/b2BlockAllocator.cpp +++ b/Libraries/Box2D/sdk/src/b2BlockAllocator.cpp @@ -22,7 +22,7 @@ #include #include -int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] = +int32 b2BlockAllocator::s_blockSizes[b2_blockSizes] = { 16, // 0 32, // 1 @@ -60,7 +60,7 @@ b2BlockAllocator::b2BlockAllocator() m_chunkSpace = b2_chunkArrayIncrement; m_chunkCount = 0; m_chunks = (b2Chunk*)b2Alloc(m_chunkSpace * sizeof(b2Chunk)); - + memset(m_chunks, 0, m_chunkSpace * sizeof(b2Chunk)); memset(m_freeLists, 0, sizeof(m_freeLists)); diff --git a/Libraries/Box2D/sdk/src/b2CollidePolygon.cpp b/Libraries/Box2D/sdk/src/b2CollidePolygon.cpp index cf590bf..ef858f4 100755 --- a/Libraries/Box2D/sdk/src/b2CollidePolygon.cpp +++ b/Libraries/Box2D/sdk/src/b2CollidePolygon.cpp @@ -247,13 +247,13 @@ void b2CollidePolygons(b2Manifold* manifold, b2Vec2 localTangent = v12 - v11; localTangent.Normalize(); - + b2Vec2 localNormal = b2Cross(localTangent, 1.0f); b2Vec2 planePoint = 0.5f * (v11 + v12); b2Vec2 tangent = b2Mul(xf1.R, localTangent); b2Vec2 normal = b2Cross(tangent, 1.0f); - + v11 = b2Mul(xf1, v11); v12 = b2Mul(xf1, v12); diff --git a/Libraries/Box2D/sdk/src/b2Collision.cpp b/Libraries/Box2D/sdk/src/b2Collision.cpp index f38d9ea..54e638b 100755 --- a/Libraries/Box2D/sdk/src/b2Collision.cpp +++ b/Libraries/Box2D/sdk/src/b2Collision.cpp @@ -51,7 +51,7 @@ void b2WorldManifold::Initialize(const b2Manifold* manifold, { normal = b2Mul(xfA.R, manifold->localNormal); b2Vec2 planePoint = b2Mul(xfA, manifold->localPoint); - + for (int32 i = 0; i < manifold->pointCount; ++i) { b2Vec2 clipPoint = b2Mul(xfB, manifold->points[i].localPoint); diff --git a/Libraries/Box2D/sdk/src/b2Contact.cpp b/Libraries/Box2D/sdk/src/b2Contact.cpp index d2ba360..c8bd986 100755 --- a/Libraries/Box2D/sdk/src/b2Contact.cpp +++ b/Libraries/Box2D/sdk/src/b2Contact.cpp @@ -45,7 +45,7 @@ void b2Contact::AddType(b2ContactCreateFcn* createFcn, b2ContactDestroyFcn* dest { b2Assert(b2Shape::e_unknown < type1 && type1 < b2Shape::e_typeCount); b2Assert(b2Shape::e_unknown < type2 && type2 < b2Shape::e_typeCount); - + s_registers[type1][type2].createFcn = createFcn; s_registers[type1][type2].destroyFcn = destoryFcn; s_registers[type1][type2].primary = true; @@ -71,7 +71,7 @@ b2Contact* b2Contact::Create(b2Fixture* fixtureA, b2Fixture* fixtureB, b2BlockAl b2Assert(b2Shape::e_unknown < type1 && type1 < b2Shape::e_typeCount); b2Assert(b2Shape::e_unknown < type2 && type2 < b2Shape::e_typeCount); - + b2ContactCreateFcn* createFcn = s_registers[type1][type2].createFcn; if (createFcn) { diff --git a/Libraries/Box2D/sdk/src/b2ContactSolver.cpp b/Libraries/Box2D/sdk/src/b2ContactSolver.cpp index 7928b62..c08010a 100755 --- a/Libraries/Box2D/sdk/src/b2ContactSolver.cpp +++ b/Libraries/Box2D/sdk/src/b2ContactSolver.cpp @@ -122,7 +122,7 @@ b2ContactSolver::b2ContactSolver(b2Contact** contacts, int32 contactCount, { b2ContactConstraintPoint* ccp1 = cc->points + 0; b2ContactConstraintPoint* ccp2 = cc->points + 1; - + float32 invMassA = bodyA->m_invMass; float32 invIA = bodyA->m_invI; float32 invMassB = bodyB->m_invMass; @@ -278,14 +278,14 @@ void b2ContactSolver::SolveVelocityConstraints() // implies that we must have in any solution either vn_i = 0 or x_i = 0. So for the 2D contact problem the cases // vn1 = 0 and vn2 = 0, x1 = 0 and x2 = 0, x1 = 0 and vn2 = 0, x2 = 0 and vn1 = 0 need to be tested. The first valid // solution that satisfies the problem is chosen. - // + // // In order to account of the accumulated impulse 'a' (because of the iterative nature of the solver which only requires // that the accumulated impulse is clamped and not the incremental impulse) we change the impulse variable (x_i). // // Substitute: - // + // // x = x' - a - // + // // Plug into above equation: // // vn = A * x + b @@ -365,7 +365,7 @@ void b2ContactSolver::SolveVelocityConstraints() // // Case 2: vn1 = 0 and x2 = 0 // - // 0 = a11 * x1' + a12 * 0 + b1' + // 0 = a11 * x1' + a12 * 0 + b1' // vn2 = a21 * x1' + a22 * 0 + b2' // x.x = - cp1->normalMass * b.x; @@ -407,7 +407,7 @@ void b2ContactSolver::SolveVelocityConstraints() // // Case 3: vn2 = 0 and x1 = 0 // - // vn1 = a11 * 0 + a12 * x2' + b1' + // vn1 = a11 * 0 + a12 * x2' + b1' // 0 = a21 * 0 + a22 * x2' + b2' // x.x = 0.0f; @@ -447,7 +447,7 @@ void b2ContactSolver::SolveVelocityConstraints() // // Case 4: x1 = 0 and x2 = 0 - // + // // vn1 = b1 // vn2 = b2; x.x = 0.0f; diff --git a/Libraries/Box2D/sdk/src/b2Distance.cpp b/Libraries/Box2D/sdk/src/b2Distance.cpp index c3375dd..510c906 100755 --- a/Libraries/Box2D/sdk/src/b2Distance.cpp +++ b/Libraries/Box2D/sdk/src/b2Distance.cpp @@ -68,7 +68,7 @@ struct b2Simplex const b2DistanceProxy* proxyB, const b2Transform& transformB) { b2Assert(cache->count <= 3); - + // Copy data from cache. m_count = cache->count; b2SimplexVertex* vertices = &m_v1; @@ -334,7 +334,7 @@ void b2Simplex::Solve3() float32 w3e23 = b2Dot(w3, e23); float32 d23_1 = w3e23; float32 d23_2 = -w2e23; - + // Triangle123 float32 n123 = b2Cross(e12, e13); diff --git a/Libraries/Box2D/sdk/src/b2DistanceJoint.cpp b/Libraries/Box2D/sdk/src/b2DistanceJoint.cpp index b5026d0..019bcb1 100755 --- a/Libraries/Box2D/sdk/src/b2DistanceJoint.cpp +++ b/Libraries/Box2D/sdk/src/b2DistanceJoint.cpp @@ -26,7 +26,7 @@ // x2 = x1 + h * v2 // 1-D mass-damper-spring system -// m (v2 - v1) + h * d * v2 + h * k * +// m (v2 - v1) + h * d * v2 + h * k * // C = norm(p2 - p1) - L // u = (p2 - p1) / norm(p2 - p1) diff --git a/Libraries/Box2D/sdk/src/b2DynamicTree.cpp b/Libraries/Box2D/sdk/src/b2DynamicTree.cpp index 6a1c9db..4c58ed9 100755 --- a/Libraries/Box2D/sdk/src/b2DynamicTree.cpp +++ b/Libraries/Box2D/sdk/src/b2DynamicTree.cpp @@ -193,7 +193,7 @@ void b2DynamicTree::InsertLeaf(int32 leaf) int32 sibling = m_root; if (m_nodes[sibling].IsLeaf() == false) { - do + do { int32 child1 = m_nodes[sibling].child1; int32 child2 = m_nodes[sibling].child2; @@ -240,7 +240,7 @@ void b2DynamicTree::InsertLeaf(int32 leaf) m_nodes[sibling].parent = node2; m_nodes[leaf].parent = node2; - do + do { if (m_nodes[node1].aabb.Contains(m_nodes[node2].aabb)) { diff --git a/Libraries/Box2D/sdk/src/b2Fixture.cpp b/Libraries/Box2D/sdk/src/b2Fixture.cpp index 381284c..69f6acc 100755 --- a/Libraries/Box2D/sdk/src/b2Fixture.cpp +++ b/Libraries/Box2D/sdk/src/b2Fixture.cpp @@ -115,7 +115,7 @@ void b2Fixture::DestroyProxy(b2BroadPhase* broadPhase) void b2Fixture::Synchronize(b2BroadPhase* broadPhase, const b2Transform& transform1, const b2Transform& transform2) { if (m_proxyId == b2BroadPhase::e_nullProxy) - { + { return; } @@ -123,7 +123,7 @@ void b2Fixture::Synchronize(b2BroadPhase* broadPhase, const b2Transform& transfo b2AABB aabb1, aabb2; m_shape->ComputeAABB(&aabb1, transform1); m_shape->ComputeAABB(&aabb2, transform2); - + m_aabb.Combine(aabb1, aabb2); b2Vec2 displacement = transform2.position - transform1.position; diff --git a/Libraries/Box2D/sdk/src/b2GearJoint.cpp b/Libraries/Box2D/sdk/src/b2GearJoint.cpp index 88b9f70..244b180 100755 --- a/Libraries/Box2D/sdk/src/b2GearJoint.cpp +++ b/Libraries/Box2D/sdk/src/b2GearJoint.cpp @@ -180,7 +180,7 @@ void b2GearJoint::SolveVelocityConstraints(const b2TimeStep& step) bool b2GearJoint::SolvePositionConstraints(float32 baumgarte) { B2_NOT_USED(baumgarte); - + float32 linearError = 0.0f; b2Body* b1 = m_bodyA; diff --git a/Libraries/Box2D/sdk/src/b2Island.cpp b/Libraries/Box2D/sdk/src/b2Island.cpp index ba352ea..61e38cb 100755 --- a/Libraries/Box2D/sdk/src/b2Island.cpp +++ b/Libraries/Box2D/sdk/src/b2Island.cpp @@ -361,7 +361,7 @@ void b2Island::Report(const b2ContactConstraint* constraints) b2Contact* c = m_contacts[i]; const b2ContactConstraint* cc = constraints + i; - + b2ContactImpulse impulse; for (int32 j = 0; j < cc->pointCount; ++j) { diff --git a/Libraries/Box2D/sdk/src/b2Joint.cpp b/Libraries/Box2D/sdk/src/b2Joint.cpp index cfb58d6..36eea9b 100755 --- a/Libraries/Box2D/sdk/src/b2Joint.cpp +++ b/Libraries/Box2D/sdk/src/b2Joint.cpp @@ -93,7 +93,7 @@ b2Joint* b2Joint::Create(const b2JointDef* def, b2BlockAllocator* allocator) joint = new (mem) b2WeldJoint((b2WeldJointDef*)def); } break; - + case e_frictionJoint: { void* mem = allocator->Allocate(sizeof(b2FrictionJoint)); @@ -141,7 +141,7 @@ void b2Joint::Destroy(b2Joint* joint, b2BlockAllocator* allocator) case e_lineJoint: allocator->Free(joint, sizeof(b2LineJoint)); break; - + case e_weldJoint: allocator->Free(joint, sizeof(b2WeldJoint)); break; diff --git a/Libraries/Box2D/sdk/src/b2LineJoint.cpp b/Libraries/Box2D/sdk/src/b2LineJoint.cpp index 2519383..2a5a9d4 100755 --- a/Libraries/Box2D/sdk/src/b2LineJoint.cpp +++ b/Libraries/Box2D/sdk/src/b2LineJoint.cpp @@ -293,7 +293,7 @@ void b2LineJoint::SolveVelocityConstraints(const b2TimeStep& step) } else { - f2r = f1.x; + f2r = f1.x; } m_impulse.x = f2r; diff --git a/Libraries/Box2D/sdk/src/b2PolygonShape.cpp b/Libraries/Box2D/sdk/src/b2PolygonShape.cpp index b2b85d0..0abb78a 100755 --- a/Libraries/Box2D/sdk/src/b2PolygonShape.cpp +++ b/Libraries/Box2D/sdk/src/b2PolygonShape.cpp @@ -167,7 +167,7 @@ void b2PolygonShape::Set(const b2Vec2* vertices, int32 count) { continue; } - + b2Vec2 r = m_vertices[j] - m_vertices[i1]; // Your polygon is non-convex (it has an indentation) or @@ -221,7 +221,7 @@ bool b2PolygonShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& inpu { return false; } - + float32 t = numerator / denominator; if (t < 0.0f || 1.0f < t) { @@ -271,7 +271,7 @@ bool b2PolygonShape::RayCast(b2RayCastOutput* output, const b2RayCastInput& inpu float32 denominator = b2Dot(m_normals[i], d); if (denominator == 0.0f) - { + { if (numerator < 0.0f) { return false; diff --git a/Libraries/Box2D/sdk/src/b2PrismaticJoint.cpp b/Libraries/Box2D/sdk/src/b2PrismaticJoint.cpp index eada39d..1ec7dae 100755 --- a/Libraries/Box2D/sdk/src/b2PrismaticJoint.cpp +++ b/Libraries/Box2D/sdk/src/b2PrismaticJoint.cpp @@ -464,7 +464,7 @@ bool b2PrismaticJoint::SolvePositionConstraints(float32 baumgarte) b2->m_sweep.a = a2; b1->SynchronizeTransform(); b2->SynchronizeTransform(); - + return linearError <= b2_linearSlop && angularError <= b2_angularSlop; } diff --git a/Libraries/Box2D/sdk/src/b2RevoluteJoint.cpp b/Libraries/Box2D/sdk/src/b2RevoluteJoint.cpp index 138340d..cea5f24 100755 --- a/Libraries/Box2D/sdk/src/b2RevoluteJoint.cpp +++ b/Libraries/Box2D/sdk/src/b2RevoluteJoint.cpp @@ -376,7 +376,7 @@ bool b2RevoluteJoint::SolvePositionConstraints(float32 baumgarte) b1->SynchronizeTransform(); b2->SynchronizeTransform(); } - + return positionError <= b2_linearSlop && angularError <= b2_angularSlop; } diff --git a/Libraries/Box2D/sdk/src/b2TimeOfImpact.cpp b/Libraries/Box2D/sdk/src/b2TimeOfImpact.cpp index 77e3caf..5384b8a 100755 --- a/Libraries/Box2D/sdk/src/b2TimeOfImpact.cpp +++ b/Libraries/Box2D/sdk/src/b2TimeOfImpact.cpp @@ -98,7 +98,7 @@ struct b2SeparationFunction m_type = e_faceA; b2Vec2 localPointA1 = m_proxyA->GetVertex(cache->indexA[0]); b2Vec2 localPointA2 = m_proxyA->GetVertex(cache->indexA[1]); - + m_axis = b2Cross(localPointA2 - localPointA1, 1.0f); m_axis.Normalize(); b2Vec2 normal = b2Mul(xfA.R, m_axis); @@ -137,7 +137,7 @@ struct b2SeparationFunction b2Vec2 localPointA = m_proxyA->GetVertex(*indexA); b2Vec2 localPointB = m_proxyB->GetVertex(*indexB); - + b2Vec2 pointA = b2Mul(xfA, localPointA); b2Vec2 pointB = b2Mul(xfB, localPointB); @@ -151,7 +151,7 @@ struct b2SeparationFunction b2Vec2 pointA = b2Mul(xfA, m_localPoint); b2Vec2 axisB = b2MulT(xfB.R, -normal); - + *indexA = -1; *indexB = m_proxyB->GetSupport(axisB); diff --git a/Libraries/RtAudio/sdk/RtAudio.cpp b/Libraries/RtAudio/sdk/RtAudio.cpp index 8d47585..ee19c2a 100644 --- a/Libraries/RtAudio/sdk/RtAudio.cpp +++ b/Libraries/RtAudio/sdk/RtAudio.cpp @@ -356,7 +356,7 @@ double RtApi :: getStreamTime( void ) then = stream_.lastTickTimestamp; return stream_.streamTime + ((now.tv_sec + 0.000001 * now.tv_usec) - - (then.tv_sec + 0.000001 * then.tv_usec)); + (then.tv_sec + 0.000001 * then.tv_usec)); #else return stream_.streamTime; #endif @@ -712,7 +712,7 @@ OSStatus callbackHandler( AudioDeviceID inDevice, const AudioBufferList* inInputData, const AudioTimeStamp* inInputTime, AudioBufferList* outOutputData, - const AudioTimeStamp* inOutputTime, + const AudioTimeStamp* inOutputTime, void* infoPointer ) { CallbackInfo *info = (CallbackInfo *) infoPointer; @@ -1626,7 +1626,7 @@ bool RtApiCore :: callbackEvent( AudioDeviceID deviceId, channelsLeft -= streamChannels; } } - + if ( stream_.doConvertBuffer[1] ) { // convert from our internal "device" buffer convertBuffer( stream_.userBuffer[1], stream_.deviceBuffer, @@ -2504,7 +2504,7 @@ RtApiAsio :: RtApiAsio() // CoInitialize beforehand, but it must be for appartment threading // (in which case, CoInitilialize will return S_FALSE here). coInitialized_ = false; - HRESULT hr = CoInitialize( NULL ); + HRESULT hr = CoInitialize( NULL ); if ( FAILED(hr) ) { errorText_ = "RtApiAsio::ASIO requires a single-threaded appartment. Call CoInitializeEx(0,COINIT_APARTMENTTHREADED)"; error( RtError::WARNING ); @@ -2855,7 +2855,7 @@ bool RtApiAsio :: probeDeviceOpen( unsigned int device, StreamMode mode, unsigne handle = new AsioHandle; } catch ( std::bad_alloc& ) { - //if ( handle == NULL ) { + //if ( handle == NULL ) { drivers.removeCurrentDriver(); errorText_ = "RtApiAsio::probeDeviceOpen: error allocating AsioHandle memory."; return FAILURE; @@ -3383,13 +3383,13 @@ long asioMessages( long selector, long value, void* message, double* opt ) static const char* getAsioErrorString( ASIOError result ) { - struct Messages + struct Messages { ASIOError value; const char*message; }; - static Messages m[] = + static Messages m[] = { { ASE_NotPresent, "Hardware input or output is not present or available." }, { ASE_HWMalfunction, "Hardware is malfunctioning." }, @@ -3412,7 +3412,7 @@ static const char* getAsioErrorString( ASIOError result ) #if defined(__WINDOWS_DS__) // Windows DirectSound API // Modified by Robin Davies, October 2005 -// - Improvements to DirectX pointer chasing. +// - Improvements to DirectX pointer chasing. // - Backdoor RtDsStatistics hook provides DirectX performance information. // - Bug fix for non-power-of-two Asio granularity used by Edirol PCR-A30. // - Auto-call CoInitialize for DSOUND and ASIO platforms. @@ -3459,7 +3459,7 @@ struct DsHandle { void *id[2]; void *buffer[2]; bool xrun[2]; - UINT bufferPointer[2]; + UINT bufferPointer[2]; DWORD dsBufferSize[2]; DWORD dsPointerLeadTime[2]; // the number of bytes ahead of the safe pointer to lead by. HANDLE condition; @@ -4326,10 +4326,10 @@ void RtApiDs :: startStream() // this is already in effect. MUTEX_LOCK( &stream_.mutex ); - + DsHandle *handle = (DsHandle *) stream_.apiHandle; - timeBeginPeriod( 1 ); + timeBeginPeriod( 1 ); /* memset( &statistics, 0, sizeof( statistics ) ); @@ -4637,7 +4637,7 @@ void RtApiDs :: callbackEvent() } if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) { - + LPDIRECTSOUNDBUFFER dsBuffer = (LPDIRECTSOUNDBUFFER) handle->buffer[0]; if ( handle->drainCounter > 1 ) { // write zeros to the output stream @@ -4712,7 +4712,7 @@ void RtApiDs :: callbackEvent() //} if ( dsPointerBetween( nextWritePos, safeWritePos, currentWritePos, dsBufferSize ) - || dsPointerBetween( endWrite, safeWritePos, currentWritePos, dsBufferSize ) ) { + || dsPointerBetween( endWrite, safeWritePos, currentWritePos, dsBufferSize ) ) { // We've strayed into the forbidden zone ... resync the read pointer. //++statistics.numberOfWriteUnderruns; handle->xrun[0] = true; @@ -4780,14 +4780,14 @@ void RtApiDs :: callbackEvent() if ( safeReadPos < (DWORD)nextReadPos ) safeReadPos += dsBufferSize; // unwrap offset DWORD endRead = nextReadPos + bufferBytes; - // Handling depends on whether we are INPUT or DUPLEX. + // Handling depends on whether we are INPUT or DUPLEX. // If we're in INPUT mode then waiting is a good thing. If we're in DUPLEX mode, // then a wait here will drag the write pointers into the forbidden zone. - // - // In DUPLEX mode, rather than wait, we will back off the read pointer until - // it's in a safe position. This causes dropouts, but it seems to be the only - // practical way to sync up the read and write pointers reliably, given the - // the very complex relationship between phase and increment of the read and write + // + // In DUPLEX mode, rather than wait, we will back off the read pointer until + // it's in a safe position. This causes dropouts, but it seems to be the only + // practical way to sync up the read and write pointers reliably, given the + // the very complex relationship between phase and increment of the read and write // pointers. // // In order to minimize audible dropouts in DUPLEX mode, we will @@ -4839,7 +4839,7 @@ void RtApiDs :: callbackEvent() errorText_ = errorStream_.str(); error( RtError::SYSTEM_ERROR ); } - + if ( safeReadPos < (DWORD)nextReadPos ) safeReadPos += dsBufferSize; // unwrap offset } } @@ -6007,7 +6007,7 @@ void RtApiAlsa :: stopStream() AlsaHandle *apiInfo = (AlsaHandle *) stream_.apiHandle; snd_pcm_t **handle = (snd_pcm_t **) apiInfo->handles; if ( stream_.mode == OUTPUT || stream_.mode == DUPLEX ) { - if ( apiInfo->synchronized ) + if ( apiInfo->synchronized ) result = snd_pcm_drop( handle[0] ); else result = snd_pcm_drain( handle[0] ); diff --git a/Libraries/RtAudio/sdk/RtAudio.h b/Libraries/RtAudio/sdk/RtAudio.h index b9bab05..2546537 100644 --- a/Libraries/RtAudio/sdk/RtAudio.h +++ b/Libraries/RtAudio/sdk/RtAudio.h @@ -109,7 +109,7 @@ static const RtAudioFormat RTAUDIO_FLOAT64 = 0x20; // Normalized between plus/mi open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs. - If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt + If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt to select realtime scheduling (round-robin) for the callback thread. */ typedef unsigned int RtAudioStreamFlags; @@ -273,10 +273,10 @@ class RtAudio open the input and/or output stream device(s) for exclusive use. Note that this is not possible with all supported audio APIs. - If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt + If the RTAUDIO_SCHEDULE_REALTIME flag is set, RtAudio will attempt to select realtime scheduling (round-robin) for the callback thread. The \c priority parameter will only be used if the RTAUDIO_SCHEDULE_REALTIME - flag is set. It defines the thread's realtime priority. + flag is set. It defines the thread's realtime priority. The \c numberOfBuffers parameter can be used to control stream latency in the Windows DirectSound, Linux OSS, and Linux Alsa APIs @@ -335,7 +335,7 @@ class RtAudio /*! This function performs a system query of available devices each time it is called, thus supporting devices connected \e after instantiation. If - a system error occurs during processing, a warning will be issued. + a system error occurs during processing, a warning will be issued. */ unsigned int getDeviceCount( void ) throw(); @@ -402,7 +402,7 @@ class RtAudio from within the callback function. \param options An optional pointer to a structure containing various global stream options, including a list of OR'ed RtAudioStreamFlags - and a suggested number of stream buffers that can be used to + and a suggested number of stream buffers that can be used to control stream latency. More buffers typically result in more robust performance, though at a cost of greater latency. If a value of zero is specified, a system-specific median value is @@ -657,7 +657,7 @@ class RtApi "warning" message is reported and FAILURE is returned. A successful probe is indicated by a return value of SUCCESS. */ - virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + virtual bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); @@ -748,7 +748,7 @@ class RtApiCore: public RtApi private: - bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); @@ -782,7 +782,7 @@ class RtApiJack: public RtApi private: - bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); @@ -818,7 +818,7 @@ class RtApiAsio: public RtApi std::vector devices_; void saveDeviceInfo( void ); bool coInitialized_; - bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); @@ -856,7 +856,7 @@ class RtApiDs: public RtApi bool coInitialized_; bool buffersRolling; long duplexPrerollBytes; - bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); @@ -890,7 +890,7 @@ class RtApiAlsa: public RtApi std::vector devices_; void saveDeviceInfo( void ); - bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); @@ -922,7 +922,7 @@ class RtApiOss: public RtApi private: - bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ); @@ -947,7 +947,7 @@ class RtApiDummy: public RtApi private: - bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, + bool probeDeviceOpen( unsigned int device, StreamMode mode, unsigned int channels, unsigned int firstChannel, unsigned int sampleRate, RtAudioFormat format, unsigned int *bufferSize, RtAudio::StreamOptions *options ) { return false; }; diff --git a/Libraries/RtAudio/sdk/RtError.h b/Libraries/RtAudio/sdk/RtError.h index ac5c414..d361d7a 100644 --- a/Libraries/RtAudio/sdk/RtError.h +++ b/Libraries/RtAudio/sdk/RtError.h @@ -36,7 +36,7 @@ class RtError : public std::exception //! The constructor. RtError( const std::string& message, Type type = RtError::UNSPECIFIED ) throw() : message_(message), type_(type) {} - + //! The destructor. virtual ~RtError( void ) throw() {} diff --git a/Libraries/RtAudio/sdk/include/asio.cpp b/Libraries/RtAudio/sdk/include/asio.cpp index 747b9e8..419a21a 100644 --- a/Libraries/RtAudio/sdk/include/asio.cpp +++ b/Libraries/RtAudio/sdk/include/asio.cpp @@ -3,11 +3,11 @@ (c) 1996, Steinberg Soft- und Hardware GmbH asio.cpp - + asio functions entries which translate the asio interface to the asiodrvr class methods -*/ - +*/ + #include #include "asiosys.h" // platform definition #include "asio.h" @@ -49,13 +49,13 @@ ASIOError ASIOInit(ASIODriverInfo *info) { delete theAsioDriver; theAsioDriver = 0; - } + } info->driverVersion = 0; strcpy(info->name, "No ASIO Driver"); theAsioDriver = getDriver(); if(!theAsioDriver) { - strcpy(info->errorMessage, "Not enough memory for the ASIO driver!"); + strcpy(info->errorMessage, "Not enough memory for the ASIO driver!"); return ASE_NotPresent; } if(!theAsioDriver->init(info->sysRef)) @@ -81,7 +81,7 @@ ASIOError ASIOInit(ASIODriverInfo *info) theAsioDriver->getErrorMessage(info->errorMessage); theAsioDriver = 0; return ASE_NotPresent; - } + } strcpy(info->errorMessage, "No ASIO Driver Error"); theAsioDriver->getDriverName(info->name); @@ -102,7 +102,7 @@ ASIOError ASIOExit(void) #else delete theAsioDriver; #endif - } + } theAsioDriver = 0; return ASE_OK; } diff --git a/Libraries/RtAudio/sdk/include/asio.h b/Libraries/RtAudio/sdk/include/asio.h index 5e175b6..bedebe9 100644 --- a/Libraries/RtAudio/sdk/include/asio.h +++ b/Libraries/RtAudio/sdk/include/asio.h @@ -11,7 +11,7 @@ basic concept is an i/o synchronous double-buffer scheme: - + on bufferSwitch(index == 0), host will read/write: after ASIOStart(), the @@ -75,7 +75,7 @@ ASIOError ASIOOutputReady(void); #define __ASIO_H // force 4 byte alignment -#if defined(_MSC_VER) && !defined(__MWERKS__) +#if defined(_MSC_VER) && !defined(__MWERKS__) #pragma pack(push,4) #elif PRAGMA_ALIGN_SUPPORTED #pragma options align = native @@ -138,7 +138,7 @@ enum { ASIOSTInt32MSB18 = 9, // 32 bit data with 18 bit alignment ASIOSTInt32MSB20 = 10, // 32 bit data with 20 bit alignment ASIOSTInt32MSB24 = 11, // 32 bit data with 24 bit alignment - + ASIOSTInt16LSB = 16, ASIOSTInt24LSB = 17, // used for 20 bits as well ASIOSTInt32LSB = 18, @@ -225,7 +225,7 @@ enum { //- - - - - - - - - - - - - - - - - - - - - - - - - typedef struct ASIOTimeCode -{ +{ double speed; // speed relation (fraction of nominal speed) // optional; set to 0. or 1. if not supported ASIOSamples timeCodeSamples; // time in samples @@ -240,7 +240,7 @@ typedef enum ASIOTimeCodeFlags kTcReverse = 1 << 2, kTcOnspeed = 1 << 3, kTcStill = 1 << 4, - + kTcSpeedValid = 1 << 8 } ASIOTimeCodeFlags; @@ -262,7 +262,7 @@ typedef enum AsioTimeInfoFlags kSamplePositionValid = 1 << 1, // must always be valid kSampleRateValid = 1 << 2, kSpeedValid = 1 << 3, - + kSampleRateChanged = 1 << 4, kClockSourceChanged = 1 << 5 } AsioTimeInfoFlags; @@ -453,7 +453,7 @@ enum kAsioSupportsTimeInfo, // if host returns true here, it will expect the // callback bufferSwitchTimeInfo to be called instead // of bufferSwitch - kAsioSupportsTimeCode, // + kAsioSupportsTimeCode, // kAsioMMCCommand, // unused - value: number of commands, message points to mmc commands kAsioSupportsInputMonitor, // kAsioSupportsXXX return 1 if host supports this kAsioSupportsInputGain, // unused and undefined @@ -536,7 +536,7 @@ ASIOError ASIOStart(void); the host to read from input buffer A (index 0), and start processing to output buffer A while output buffer B (which has been filled by the host prior to calling ASIOStart()) - is possibly sounding (see also ASIOGetLatencies()) + is possibly sounding (see also ASIOGetLatencies()) Parameter: None. Returns: @@ -895,7 +895,7 @@ ASIOError ASIOFuture(long selector, void *params); further calls with this selector. on success, ASE_SUCCESS must be returned (note: ASE_OK is *not* sufficient!) Notes: - see selectors defined below. + see selectors defined below. */ enum @@ -1032,7 +1032,7 @@ ASIOError ASIOOutputReady(void); should be returned in order to prevent further calls to this function. note that the host may want to determine if it is to use this when the system is not yet fully initialized, so - ASE_OK should always be returned if the mechanism makes sense. + ASE_OK should always be returned if the mechanism makes sense. Notes: please remeber to adjust ASIOGetLatencies() according to whether ASIOOutputReady() was ever called or not, if your @@ -1044,7 +1044,7 @@ ASIOError ASIOOutputReady(void); */ // restore old alignment -#if defined(_MSC_VER) && !defined(__MWERKS__) +#if defined(_MSC_VER) && !defined(__MWERKS__) #pragma pack(pop) #elif PRAGMA_ALIGN_SUPPORTED #pragma options align = reset diff --git a/Libraries/RtAudio/sdk/include/asiodrivers.cpp b/Libraries/RtAudio/sdk/include/asiodrivers.cpp index 4067bc0..5b5c658 100644 --- a/Libraries/RtAudio/sdk/include/asiodrivers.cpp +++ b/Libraries/RtAudio/sdk/include/asiodrivers.cpp @@ -152,7 +152,7 @@ void AsioDrivers::removeCurrentDriver() #include "asiolist.h" -AsioDrivers::AsioDrivers() +AsioDrivers::AsioDrivers() : AsioDriverList() { curIndex = -1; diff --git a/Libraries/RtAudio/sdk/include/asiodrivers.h b/Libraries/RtAudio/sdk/include/asiodrivers.h index 511f2ea..558eaeb 100644 --- a/Libraries/RtAudio/sdk/include/asiodrivers.h +++ b/Libraries/RtAudio/sdk/include/asiodrivers.h @@ -27,7 +27,7 @@ class AsioDrivers : public AsioDriverList public: AsioDrivers(); ~AsioDrivers(); - + bool getCurrentDriverName(char *name); long getDriverNames(char **names, long maxDrivers); bool loadDriver(char *name); diff --git a/Libraries/RtAudio/sdk/include/asiodrvr.h b/Libraries/RtAudio/sdk/include/asiodrvr.h index 1670dfa..fa66474 100644 --- a/Libraries/RtAudio/sdk/include/asiodrvr.h +++ b/Libraries/RtAudio/sdk/include/asiodrvr.h @@ -17,7 +17,7 @@ #include "asio.h" class AsioDriver; -extern AsioDriver *getDriver(); // for generic constructor +extern AsioDriver *getDriver(); // for generic constructor #if WINDOWS #include diff --git a/Libraries/RtAudio/sdk/include/asiolist.cpp b/Libraries/RtAudio/sdk/include/asiolist.cpp index 88b1632..7fe6e0a 100644 --- a/Libraries/RtAudio/sdk/include/asiolist.cpp +++ b/Libraries/RtAudio/sdk/include/asiolist.cpp @@ -8,7 +8,7 @@ #define COM_CLSID "clsid" // ****************************************************************** -// Local Functions +// Local Functions // ****************************************************************** static LONG findDrvPath (char *clsidstr,char *dllpath,int dllpathsize) { @@ -36,18 +36,18 @@ static LONG findDrvPath (char *clsidstr,char *dllpath,int dllpathsize) cr = RegQueryValueEx(hkpath,0,0,&datatype,(LPBYTE)dllpath,&datasize); if (cr == ERROR_SUCCESS) { memset(&ofs,0,sizeof(OFSTRUCT)); - ofs.cBytes = sizeof(OFSTRUCT); + ofs.cBytes = sizeof(OFSTRUCT); hfile = OpenFile(dllpath,&ofs,OF_EXIST); - if (hfile) rc = 0; + if (hfile) rc = 0; } RegCloseKey(hkpath); } RegCloseKey(hksub); } - found = TRUE; // break out + found = TRUE; // break out } } - } + } RegCloseKey(hkEnum); } return rc; @@ -92,7 +92,7 @@ static LPASIODRVSTRUCT newDrvStruct (HKEY hkey,char *keyname,int drvID,LPASIODRV } RegCloseKey(hksub); } - } + } else lpdrv->next = newDrvStruct(hkey,keyname,drvID+1,lpdrv->next); return lpdrv; @@ -192,7 +192,7 @@ LONG AsioDriverList::asioOpenDriver (int drvID,LPVOID *asiodrv) else rc = DRVERR_DEVICE_ALREADY_OPEN; } else rc = DRVERR_DEVICE_NOT_FOUND; - + return rc; } @@ -214,7 +214,7 @@ LONG AsioDriverList::asioCloseDriver (int drvID) } LONG AsioDriverList::asioGetDriverName (int drvID,char *drvname,int drvnamesize) -{ +{ LPASIODRVSTRUCT lpdrv = 0; if (!drvname) return DRVERR_INVALID_PARAM; diff --git a/Libraries/RtAudio/sdk/include/asiolist.h b/Libraries/RtAudio/sdk/include/asiolist.h index 1f504af..aefb396 100644 --- a/Libraries/RtAudio/sdk/include/asiolist.h +++ b/Libraries/RtAudio/sdk/include/asiolist.h @@ -26,13 +26,13 @@ class AsioDriverList { public: AsioDriverList(); ~AsioDriverList(); - + LONG asioOpenDriver (int,VOID **); LONG asioCloseDriver (int); // nice to have LONG asioGetNumDev (VOID); - LONG asioGetDriverName (int,char *,int); + LONG asioGetDriverName (int,char *,int); LONG asioGetDriverPath (int,char *,int); LONG asioGetDriverCLSID (int,CLSID *); diff --git a/Libraries/RtAudio/sdk/include/asiosys.h b/Libraries/RtAudio/sdk/include/asiosys.h index a61c233..93a3b58 100644 --- a/Libraries/RtAudio/sdk/include/asiosys.h +++ b/Libraries/RtAudio/sdk/include/asiosys.h @@ -2,7 +2,7 @@ #define __asiosys__ #ifdef WIN32 - #undef MAC + #undef MAC #define PPC 0 #define WINDOWS 1 #define SGI 0 @@ -12,7 +12,7 @@ #define NATIVE_INT64 0 #define IEEE754_64FLOAT 1 - + #elif BEOS #define MAC 0 #define PPC 0 @@ -21,10 +21,10 @@ #define SGI 0 #define SUN 0 #define LINUX 0 - + #define NATIVE_INT64 0 #define IEEE754_64FLOAT 1 - + #ifndef DEBUG #define DEBUG 0 #if DEBUG @@ -42,10 +42,10 @@ #define SUN 0 #define LINUX 0 #define BEOS 0 - + #define NATIVE_INT64 0 #define IEEE754_64FLOAT 1 - + #ifndef DEBUG #define DEBUG 0 #if DEBUG diff --git a/Libraries/RtAudio/sdk/include/ginclude.h b/Libraries/RtAudio/sdk/include/ginclude.h index 5603fac..cf0053e 100644 --- a/Libraries/RtAudio/sdk/include/ginclude.h +++ b/Libraries/RtAudio/sdk/include/ginclude.h @@ -1,22 +1,22 @@ #ifndef __gInclude__ #define __gInclude__ -#if SGI - #undef BEOS - #undef MAC +#if SGI + #undef BEOS + #undef MAC #undef WINDOWS // #define ASIO_BIG_ENDIAN 1 #define ASIO_CPU_MIPS 1 #elif defined WIN32 - #undef BEOS - #undef MAC + #undef BEOS + #undef MAC #undef SGI #define WINDOWS 1 #define ASIO_LITTLE_ENDIAN 1 #define ASIO_CPU_X86 1 #elif BEOS - #undef MAC + #undef MAC #undef SGI #undef WINDOWS #define ASIO_LITTLE_ENDIAN 1 @@ -24,7 +24,7 @@ // #else #define MAC 1 - #undef BEOS + #undef BEOS #undef WINDOWS #undef SGI #define ASIO_BIG_ENDIAN 1 diff --git a/Libraries/RtAudio/sdk/include/iasiodrv.h b/Libraries/RtAudio/sdk/include/iasiodrv.h index 1496f0f..9cfe3fb 100644 --- a/Libraries/RtAudio/sdk/include/iasiodrv.h +++ b/Libraries/RtAudio/sdk/include/iasiodrv.h @@ -1,7 +1,7 @@ #include "asiosys.h" #include "asio.h" -/* Forward Declarations */ +/* Forward Declarations */ #ifndef __ASIODRIVER_FWD_DEFINED__ #define __ASIODRIVER_FWD_DEFINED__ @@ -12,9 +12,9 @@ interface IASIO : public IUnknown { virtual ASIOBool init(void *sysHandle) = 0; - virtual void getDriverName(char *name) = 0; + virtual void getDriverName(char *name) = 0; virtual long getDriverVersion() = 0; - virtual void getErrorMessage(char *string) = 0; + virtual void getErrorMessage(char *string) = 0; virtual ASIOError start() = 0; virtual ASIOError stop() = 0; virtual ASIOError getChannels(long *numInputChannels, long *numOutputChannels) = 0; diff --git a/Libraries/RtAudio/sdk/include/iasiothiscallresolver.cpp b/Libraries/RtAudio/sdk/include/iasiothiscallresolver.cpp index 8dfefbd..89f0361 100644 --- a/Libraries/RtAudio/sdk/include/iasiothiscallresolver.cpp +++ b/Libraries/RtAudio/sdk/include/iasiothiscallresolver.cpp @@ -71,7 +71,7 @@ (IUnknown functions) 0 virtual HRESULT STDMETHODCALLTYPE (*QueryInterface)(REFIID riid, void **ppv) = 0; 4 virtual ULONG STDMETHODCALLTYPE (*AddRef)() = 0; - 8 virtual ULONG STDMETHODCALLTYPE (*Release)() = 0; + 8 virtual ULONG STDMETHODCALLTYPE (*Release)() = 0; (IASIO functions) 12 virtual ASIOBool (*init)(void *sysHandle) = 0; @@ -128,7 +128,7 @@ with MSVC, and requires that you ship the OpenASIO DLL with your application. - + ACKNOWLEDGEMENTS Ross Bencina: worked out the thiscall details above, wrote the original @@ -186,7 +186,7 @@ extern IASIO* theAsioDriver; // The following macros define the inline assembler for BORLAND first then gcc -#if defined(__BCPLUSPLUS__) || defined(__BORLANDC__) +#if defined(__BCPLUSPLUS__) || defined(__BORLANDC__) #define CALL_THISCALL_0( resultName, thisPtr, funcOffset )\ @@ -383,7 +383,7 @@ ULONG STDMETHODCALLTYPE IASIOThiscallResolver::AddRef() ULONG STDMETHODCALLTYPE IASIOThiscallResolver::Release() { assert( false ); // this function should never be called by the ASIO SDK. - + return 1; } @@ -465,7 +465,7 @@ ASIOError IASIOThiscallResolver::getSampleRate(ASIOSampleRate *sampleRate) } ASIOError IASIOThiscallResolver::setSampleRate(ASIOSampleRate sampleRate) -{ +{ ASIOBool result; CALL_THISCALL_1_DOUBLE( result, that_, 56, sampleRate ); return result; diff --git a/Libraries/RtAudio/sdk/include/iasiothiscallresolver.h b/Libraries/RtAudio/sdk/include/iasiothiscallresolver.h index a477a73..5d5a2d1 100644 --- a/Libraries/RtAudio/sdk/include/iasiothiscallresolver.h +++ b/Libraries/RtAudio/sdk/include/iasiothiscallresolver.h @@ -1,7 +1,7 @@ // **************************************************************************** // // Changed: I have modified this file slightly (includes) to work with -// RtAudio. RtAudio.cpp must include this file after asio.h. +// RtAudio. RtAudio.cpp must include this file after asio.h. // // File: IASIOThiscallResolver.h // Description: The IASIOThiscallResolver class implements the IASIO diff --git a/Libraries/RtAudio/sdk/include/soundcard.h b/Libraries/RtAudio/sdk/include/soundcard.h index e8fc9f6..9ba8a86 100644 --- a/Libraries/RtAudio/sdk/include/soundcard.h +++ b/Libraries/RtAudio/sdk/include/soundcard.h @@ -79,7 +79,7 @@ #ifndef __SIOWR #if defined(__hpux) || (defined(_IOWR) && (defined(_AIX) || (!defined(sun) && !defined(sparc) && !defined(__INCioctlh) && !defined(__Lynx__)))) -/* +/* * Make sure the ioctl macros are compatible with the ones already used * by this operating system. */ @@ -234,7 +234,7 @@ struct patch_info int len; /* Size of the wave data in bytes */ int loop_start, loop_end; /* Byte offsets from the beginning */ -/* +/* * The base_freq and base_note fields are used when computing the * playback speed for a note. The base_note defines the tone frequency * which is heard if the sample is played using the base_freq as the @@ -261,7 +261,7 @@ struct patch_info unsigned char env_rate[6]; /* GUS HW ramping rate */ unsigned char env_offset[6]; /* 255 == 100% */ - /* + /* * The tremolo, vibrato and scale info are not supported yet. * Enable by setting the mode bits WAVE_TREMOLO, WAVE_VIBRATO or * WAVE_SCALE @@ -299,7 +299,7 @@ struct sysex_info * /dev/sequencer input events. * * The data written to the /dev/sequencer is a stream of events. Events - * are records of 4 or 8 bytes. The first byte defines the size. + * are records of 4 or 8 bytes. The first byte defines the size. * Any number of events can be written with a write call. There * is a set of macros for sending these events. Use these macros if you * want to maximize portability of your program. @@ -437,13 +437,13 @@ struct sysex_info * of the associated synthesizer device. There is no limit to the size * of the extended events. These events are not queued but executed * immediately when the write() is called (execution can take several - * seconds of time). + * seconds of time). * * When a SEQ_FULLSIZE message is written to the device, it must * be written using exactly one write() call. Other events cannot * be mixed to the same write. - * - * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the + * + * For FM synths (YM3812/OPL3) use struct sbi_instrument and write it to the * /dev/sequencer. Don't write other data together with the instrument structure * Set the key field of the structure to FM_PATCH. The device field is used to * route the patch to the corresponding device. @@ -520,7 +520,7 @@ struct midi_info /* OBSOLETE */ /* * The 4 most significant bits of byte 0 specify the class of - * the event: + * the event: * * 0x8X = system level events, * 0x9X = device/port specific events, event[1] = device/port, @@ -660,16 +660,16 @@ EXTERNC int OSS_write_patch2 (int fd, unsigned char *buf, int len); /* * This variation of the sequencer macros is used just to format one event * using fixed buffer. - * + * * The program using the macro library must define the following macros before * using this library. * - * #define _seqbuf name of the buffer (unsigned char[]) + * #define _seqbuf name of the buffer (unsigned char[]) * #define _SEQ_ADVBUF(len) If the applic needs to know the exact * size of the event, this macro can be used. * Otherwise this must be defined as empty. * #define _seqbufptr Define the name of index variable or 0 if - * not required. + * not required. */ #define _SEQ_NEEDBUF(len) /* empty */ #endif @@ -731,7 +731,7 @@ EXTERNC int OSS_write_patch2 (int fd, unsigned char *buf, int len); * sending any MIDI bytes but it's absolutely not possible. Trying to do * so _will_ cause problems with MPU401 intelligent mode). * - * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be + * Sysex messages are sent in blocks of 1 to 6 bytes. Longer messages must be * sent by calling SEQ_SYSEX() several times (there must be no other events * between them). First sysex fragment must have 0xf0 in the first byte * and the last byte (buf[len-1] of the last fragment must be 0xf7. No byte @@ -838,7 +838,7 @@ EXTERNC int OSS_write_patch2 (int fd, unsigned char *buf, int len); #define SEQ_PLAYAUDIO3(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO3, devmask) #define SEQ_PLAYAUDIO4(devmask) _LOCAL_EVENT(LOCL_STARTAUDIO4, devmask) /* - * Events for the level 1 interface only + * Events for the level 1 interface only */ #define SEQ_MIDIOUT(device, byte) {_SEQ_NEEDBUF(4);\ @@ -870,7 +870,7 @@ EXTERNC int OSS_write_patch2 (int fd, unsigned char *buf, int len); /* **************************************************************************** - * ioctl commands for the /dev/midi## + * ioctl commands for the /dev/midi## ****************************************************************************/ #define SNDCTL_MIDI_PRETIME __SIOWR('m', 0, int) @@ -878,7 +878,7 @@ EXTERNC int OSS_write_patch2 (int fd, unsigned char *buf, int len); /* * The SNDCTL_MIDI_MPUMODE and SNDCTL_MIDI_MPUCMD calls * are completely obsolete. The hardware device (MPU-401 "intelligent mode" - * and compatibles) has disappeared from the market 10 years ago so there + * and compatibles) has disappeared from the market 10 years ago so there * is no need for this stuff. The MPU-401 "UART" mode devices don't support * this stuff. */ @@ -899,13 +899,13 @@ typedef struct * The argument is the MTC mode: * * -1 = Turn MTC messages OFF (default) - * 24 = 24 FPS - * 25 = 25 FPS + * 24 = 24 FPS + * 25 = 25 FPS * 29 = 30 FPS drop frame - * 30 = 30 FPS + * 30 = 30 FPS * * Note that 25 FPS mode is probably the only mode that is supported. Other - * modes may be supported in the future versions of OSS, 25 FPS is handy + * modes may be supported in the future versions of OSS, 25 FPS is handy * because it generates 25*4=100 quarter frame messages per second which * matches the usual 100 HZ system timer rate). * @@ -962,9 +962,9 @@ typedef struct int parm; int filler[3]; /* Fur future expansion - init to zeros */ } midi_packet_header_t; -/* +/* * MIDI_PAYLOAD_SIZE is the maximum size of one MIDI input chunk. It must be - * less (or equal) than 1024 which is the read size recommended in the + * less (or equal) than 1024 which is the read size recommended in the * documentation. TODO: Explain this better. */ #define MIDI_PAYLOAD_SIZE 1000 @@ -1120,7 +1120,7 @@ typedef struct audio_buf_info # define PCM_CAP_ADMASK 0x00f00000 /* * NOTE! (capabilities & PCM_CAP_ADMASK)==0 means just that the - * digital/analog interface control features are not supported by the + * digital/analog interface control features are not supported by the * device/driver. However the device still supports analog, digital or * both inputs/outputs (depending on the device). See the OSS Programmer's * Guide for full details. @@ -1137,7 +1137,7 @@ typedef struct audio_buf_info * the initial setup. However the user should be able to override this * selection. * - * To find out which modes are actually supported the application should + * To find out which modes are actually supported the application should * try to select them using SNDCTL_DSP_CHANNELS. */ # define DSP_CH_MASK 0x06000000 /* Mask */ @@ -1460,7 +1460,7 @@ typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS]; * Mixer controls * * There can be up to 20 different analog mixer channels. The - * SOUND_MIXER_NRDEVICES gives the currently supported maximum. + * SOUND_MIXER_NRDEVICES gives the currently supported maximum. * The SOUND_MIXER_READ_DEVMASK returns a bitmask which tells * the devices supported by the particular mixer. * @@ -1483,10 +1483,10 @@ typedef unsigned short oss_peaks_t[MAX_PEAK_CHANNELS]; #define SOUND_MIXER_RECLEV 11 /* Recording level */ #define SOUND_MIXER_IGAIN 12 /* Input gain */ #define SOUND_MIXER_OGAIN 13 /* Output gain */ -/* - * Some soundcards have three line level inputs (line, aux1 and aux2). - * Since each card manufacturer has assigned different meanings to - * these inputs, it's impractical to assign specific meanings +/* + * Some soundcards have three line level inputs (line, aux1 and aux2). + * Since each card manufacturer has assigned different meanings to + * these inputs, it's impractical to assign specific meanings * (eg line, cd, synth etc.) to them. */ #define SOUND_MIXER_LINE1 14 /* Input source 1 (aux1) */ @@ -1820,7 +1820,7 @@ typedef struct oss_mixext /* (-1 means not indicated) */ /* - * The desc field is reserved for internal purposes of OSS. It should not be + * The desc field is reserved for internal purposes of OSS. It should not be * used by applications. */ unsigned int desc; diff --git a/Libraries/enet/enet.lua b/Libraries/enet/enet.lua index 08fc0a0..7add890 100644 --- a/Libraries/enet/enet.lua +++ b/Libraries/enet/enet.lua @@ -1,6 +1,6 @@ local module_filename = ModuleFilename() Libraries["enet"] = { - Build = function(settings) + Build = function(settings) settings.cc.defines:Add("CONF_WITH_ENET") settings.cc.includes:Add(Path(PathDir(module_filename) .. "/sdk/include")) src = Collect(Path(PathDir(module_filename) .. "/sdk/src/*.c")) diff --git a/Libraries/enet/sdk/include/enet/callbacks.h b/Libraries/enet/sdk/include/enet/callbacks.h index be29ae0..d511168 100644 --- a/Libraries/enet/sdk/include/enet/callbacks.h +++ b/Libraries/enet/sdk/include/enet/callbacks.h @@ -1,4 +1,4 @@ -/** +/** @file callbacks.h @brief ENet callbacks */ diff --git a/Libraries/enet/sdk/include/enet/enet.h b/Libraries/enet/sdk/include/enet/enet.h index cf7b2d0..2ce9cc8 100644 --- a/Libraries/enet/sdk/include/enet/enet.h +++ b/Libraries/enet/sdk/include/enet/enet.h @@ -1,4 +1,4 @@ -/** +/** @file enet.h @brief ENet public header file */ @@ -59,10 +59,10 @@ enum }; /** - * Portable internet address structure. + * Portable internet address structure. * - * The host must be specified in network byte-order, and the port must be in host - * byte-order. The constant ENET_HOST_ANY may be used to specify the default + * The host must be specified in network byte-order, and the port must be in host + * byte-order. The constant ENET_HOST_ANY may be used to specify the default * server host. The constant ENET_HOST_BROADCAST may be used to specify the * broadcast address (255.255.255.255). This makes sense for enet_host_connect, * but not for enet_host_create. Once a server responds to a broadcast, the @@ -80,7 +80,7 @@ typedef struct _ENetAddress * The host must be specified in network byte-order, and the port must be in * host byte-order. The constant ENET_HOST_ANY may be used to specify the * default server host. - + @sa ENetPacket */ typedef enum @@ -102,20 +102,20 @@ typedef void (ENET_CALLBACK * ENetPacketFreeCallback) (struct _ENetPacket *); /** * ENet packet structure. * - * An ENet data packet that may be sent to or received from a peer. The shown - * fields should only be read and never modified. The data field contains the - * allocated data for the packet. The dataLength fields specifies the length - * of the allocated data. The flags field is either 0 (specifying no flags), + * An ENet data packet that may be sent to or received from a peer. The shown + * fields should only be read and never modified. The data field contains the + * allocated data for the packet. The dataLength fields specifies the length + * of the allocated data. The flags field is either 0 (specifying no flags), * or a bitwise-or of any combination of the following flags: * * ENET_PACKET_FLAG_RELIABLE - packet must be received by the target peer * and resend attempts should be made until the packet is delivered * - * ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets + * ENET_PACKET_FLAG_UNSEQUENCED - packet will not be sequenced with other packets * (not supported for reliable packets) * * ENET_PACKET_FLAG_NO_ALLOCATE - packet will not allocate data, and user must supply it instead - + @sa ENetPacketFlag */ typedef struct _ENetPacket @@ -150,7 +150,7 @@ typedef struct _ENetOutgoingCommand } ENetOutgoingCommand; typedef struct _ENetIncomingCommand -{ +{ ENetListNode incomingCommandList; enet_uint16 reliableSequenceNumber; enet_uint16 unreliableSequenceNumber; @@ -172,7 +172,7 @@ typedef enum ENET_PEER_STATE_DISCONNECT_LATER = 6, ENET_PEER_STATE_DISCONNECTING = 7, ENET_PEER_STATE_ACKNOWLEDGING_DISCONNECT = 8, - ENET_PEER_STATE_ZOMBIE = 9 + ENET_PEER_STATE_ZOMBIE = 9 } ENetPeerState; #ifndef ENET_BUFFER_MAXIMUM @@ -189,7 +189,7 @@ enum ENET_PEER_DEFAULT_ROUND_TRIP_TIME = 500, ENET_PEER_DEFAULT_PACKET_THROTTLE = 32, ENET_PEER_PACKET_THROTTLE_SCALE = 32, - ENET_PEER_PACKET_THROTTLE_COUNTER = 7, + ENET_PEER_PACKET_THROTTLE_COUNTER = 7, ENET_PEER_PACKET_THROTTLE_ACCELERATION = 2, ENET_PEER_PACKET_THROTTLE_DECELERATION = 2, ENET_PEER_PACKET_THROTTLE_INTERVAL = 5000, @@ -220,12 +220,12 @@ typedef struct _ENetChannel } ENetChannel; /** - * An ENet peer which data packets may be sent or received from. + * An ENet peer which data packets may be sent or received from. * - * No fields should be modified unless otherwise specified. + * No fields should be modified unless otherwise specified. */ typedef struct _ENetPeer -{ +{ struct _ENetHost * host; enet_uint16 outgoingPeerID; enet_uint16 incomingPeerID; @@ -274,7 +274,7 @@ typedef struct _ENetPeer ENetList outgoingUnreliableCommands; enet_uint16 incomingUnsequencedGroup; enet_uint16 outgoingUnsequencedGroup; - enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; + enet_uint32 unsequencedWindow [ENET_PEER_UNSEQUENCED_WINDOW_SIZE / 32]; enet_uint32 disconnectData; } ENetPeer; @@ -322,21 +322,21 @@ typedef struct _ENetHost typedef enum { /** no event occurred within the specified time limit */ - ENET_EVENT_TYPE_NONE = 0, + ENET_EVENT_TYPE_NONE = 0, - /** a connection request initiated by enet_host_connect has completed. - * The peer field contains the peer which successfully connected. + /** a connection request initiated by enet_host_connect has completed. + * The peer field contains the peer which successfully connected. */ - ENET_EVENT_TYPE_CONNECT = 1, + ENET_EVENT_TYPE_CONNECT = 1, - /** a peer has disconnected. This event is generated on a successful - * completion of a disconnect initiated by enet_pper_disconnect, if - * a peer has timed out, or if a connection request intialized by - * enet_host_connect has timed out. The peer field contains the peer - * which disconnected. The data field contains user supplied data + /** a peer has disconnected. This event is generated on a successful + * completion of a disconnect initiated by enet_pper_disconnect, if + * a peer has timed out, or if a connection request intialized by + * enet_host_connect has timed out. The peer field contains the peer + * which disconnected. The data field contains user supplied data * describing the disconnection, or 0, if none is available. */ - ENET_EVENT_TYPE_DISCONNECT = 2, + ENET_EVENT_TYPE_DISCONNECT = 2, /** a packet has been received from a peer. The peer field specifies the * peer which sent the packet. The channelID field specifies the channel @@ -349,10 +349,10 @@ typedef enum /** * An ENet event as returned by enet_host_service(). - + @sa enet_host_service */ -typedef struct _ENetEvent +typedef struct _ENetEvent { ENetEventType type; /**< type of the event */ ENetPeer * peer; /**< peer that generated a connect, disconnect or receive event */ @@ -362,17 +362,17 @@ typedef struct _ENetEvent } ENetEvent; /** @defgroup global ENet global functions - @{ + @{ */ -/** +/** Initializes ENet globally. Must be called prior to using any functions in ENet. @returns 0 on success, < 0 on failure */ ENET_API int enet_initialize (void); -/** +/** Initializes ENet globally and supplies user-overridden callbacks. Must be called prior to using any functions in ENet. Do not use enet_initialize() if you use this variant. @param version the constant ENET_VERSION should be supplied so ENet knows which version of ENetCallbacks struct to use @@ -381,7 +381,7 @@ ENET_API int enet_initialize (void); */ ENET_API int enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits); -/** +/** Shuts down ENet globally. Should be called when a program that has initialized ENet exits. */ @@ -457,7 +457,7 @@ ENET_API ENetPacket * enet_packet_create (const void *, size_t, enet_uint32); ENET_API void enet_packet_destroy (ENetPacket *); ENET_API int enet_packet_resize (ENetPacket *, size_t); extern enet_uint32 enet_crc32 (const ENetBuffer *, size_t); - + ENET_API ENetHost * enet_host_create (const ENetAddress *, size_t, enet_uint32, enet_uint32); ENET_API void enet_host_destroy (ENetHost *); ENET_API ENetPeer * enet_host_connect (ENetHost *, const ENetAddress *, size_t); diff --git a/Libraries/enet/sdk/include/enet/list.h b/Libraries/enet/sdk/include/enet/list.h index 99bc4ae..cf03a57 100644 --- a/Libraries/enet/sdk/include/enet/list.h +++ b/Libraries/enet/sdk/include/enet/list.h @@ -1,6 +1,6 @@ -/** +/** @file list.h - @brief ENet list management + @brief ENet list management */ #ifndef __ENET_LIST_H__ #define __ENET_LIST_H__ diff --git a/Libraries/enet/sdk/include/enet/protocol.h b/Libraries/enet/sdk/include/enet/protocol.h index 363857b..5e5c776 100644 --- a/Libraries/enet/sdk/include/enet/protocol.h +++ b/Libraries/enet/sdk/include/enet/protocol.h @@ -1,4 +1,4 @@ -/** +/** @file protocol.h @brief ENet protocol */ diff --git a/Libraries/enet/sdk/include/enet/time.h b/Libraries/enet/sdk/include/enet/time.h index c82a546..118b661 100644 --- a/Libraries/enet/sdk/include/enet/time.h +++ b/Libraries/enet/sdk/include/enet/time.h @@ -1,4 +1,4 @@ -/** +/** @file time.h @brief ENet time constants and macros */ diff --git a/Libraries/enet/sdk/include/enet/types.h b/Libraries/enet/sdk/include/enet/types.h index ab010a4..8973613 100644 --- a/Libraries/enet/sdk/include/enet/types.h +++ b/Libraries/enet/sdk/include/enet/types.h @@ -1,4 +1,4 @@ -/** +/** @file types.h @brief type definitions for ENet */ diff --git a/Libraries/enet/sdk/include/enet/unix.h b/Libraries/enet/sdk/include/enet/unix.h index 087015e..be7eea7 100644 --- a/Libraries/enet/sdk/include/enet/unix.h +++ b/Libraries/enet/sdk/include/enet/unix.h @@ -1,4 +1,4 @@ -/** +/** @file unix.h @brief ENet Unix header */ @@ -40,6 +40,6 @@ typedef fd_set ENetSocketSet; #define ENET_SOCKETSET_ADD(sockset, socket) FD_SET (socket, & (sockset)) #define ENET_SOCKETSET_REMOVE(sockset, socket) FD_CLEAR (socket, & (sockset)) #define ENET_SOCKETSET_CHECK(sockset, socket) FD_ISSET (socket, & (sockset)) - + #endif /* __ENET_UNIX_H__ */ diff --git a/Libraries/enet/sdk/include/enet/utility.h b/Libraries/enet/sdk/include/enet/utility.h index e48a476..8370dac 100644 --- a/Libraries/enet/sdk/include/enet/utility.h +++ b/Libraries/enet/sdk/include/enet/utility.h @@ -1,4 +1,4 @@ -/** +/** @file utility.h @brief ENet utility header */ diff --git a/Libraries/enet/sdk/include/enet/win32.h b/Libraries/enet/sdk/include/enet/win32.h index 0e1cf0c..653bcd0 100644 --- a/Libraries/enet/sdk/include/enet/win32.h +++ b/Libraries/enet/sdk/include/enet/win32.h @@ -1,4 +1,4 @@ -/** +/** @file win32.h @brief ENet Win32 header */ diff --git a/Libraries/enet/sdk/src/callbacks.c b/Libraries/enet/sdk/src/callbacks.c index 7f960af..eb30eae 100644 --- a/Libraries/enet/sdk/src/callbacks.c +++ b/Libraries/enet/sdk/src/callbacks.c @@ -1,4 +1,4 @@ -/** +/** @file callbacks.c @brief ENet callback functions */ @@ -21,13 +21,13 @@ enet_initialize_with_callbacks (ENetVersion version, const ENetCallbacks * inits callbacks.malloc = inits -> malloc; callbacks.free = inits -> free; } - + if (inits -> rand != NULL) callbacks.rand = inits -> rand; return enet_initialize (); } - + void * enet_malloc (size_t size) { diff --git a/Libraries/enet/sdk/src/host.c b/Libraries/enet/sdk/src/host.c index 30eaded..ff9b05c 100644 --- a/Libraries/enet/sdk/src/host.c +++ b/Libraries/enet/sdk/src/host.c @@ -1,4 +1,4 @@ -/** +/** @file host.c @brief ENet host management functions */ @@ -10,7 +10,7 @@ @{ */ -/** Creates a host for communicating to peers. +/** Creates a host for communicating to peers. @param address the address at which other peers may connect to this host. If NULL, then no peers may connect to the host. @param peerCount the maximum number of peers that should be allocated for the host. @@ -68,7 +68,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, enet_uint32 inc host -> receivedAddress.host = ENET_HOST_ANY; host -> receivedAddress.port = 0; host -> receivedDataLength = 0; - + for (currentPeer = host -> peers; currentPeer < & host -> peers [host -> peerCount]; ++ currentPeer) @@ -85,7 +85,7 @@ enet_host_create (const ENetAddress * address, size_t peerCount, enet_uint32 inc enet_peer_reset (currentPeer); } - + return host; } @@ -152,7 +152,7 @@ enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelC currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; else currentPeer -> windowSize = (host -> outgoingBandwidth / - ENET_PEER_WINDOW_SIZE_SCALE) * + ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) @@ -160,7 +160,7 @@ enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelC else if (currentPeer -> windowSize > ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE) currentPeer -> windowSize = ENET_PROTOCOL_MAXIMUM_WINDOW_SIZE; - + for (channel = currentPeer -> channels; channel < & currentPeer -> channels [channelCount]; ++ channel) @@ -175,7 +175,7 @@ enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelC channel -> usedReliableWindows = 0; memset (channel -> reliableWindows, 0, sizeof (channel -> reliableWindows)); } - + command.header.command = ENET_PROTOCOL_COMMAND_CONNECT | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; command.header.channelID = 0xFF; command.connect.outgoingPeerID = ENET_HOST_TO_NET_16 (currentPeer -> incomingPeerID); @@ -188,7 +188,7 @@ enet_host_connect (ENetHost * host, const ENetAddress * address, size_t channelC command.connect.packetThrottleAcceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleAcceleration); command.connect.packetThrottleDeceleration = ENET_HOST_TO_NET_32 (currentPeer -> packetThrottleDeceleration); command.connect.sessionID = currentPeer -> sessionID; - + enet_peer_queue_outgoing_command (currentPeer, & command, NULL, 0, 0); return currentPeer; @@ -276,7 +276,7 @@ enet_host_bandwidth_throttle (ENetHost * host) while (peersRemaining > 0 && needsAdjustment != 0) { needsAdjustment = 0; - + if (dataTotal < bandwidth) throttle = ENET_PEER_PACKET_THROTTLE_SCALE; else @@ -287,7 +287,7 @@ enet_host_bandwidth_throttle (ENetHost * host) ++ peer) { enet_uint32 peerBandwidth; - + if ((peer -> state != ENET_PEER_STATE_CONNECTED && peer -> state != ENET_PEER_STATE_DISCONNECT_LATER) || peer -> incomingBandwidth == 0 || peer -> outgoingBandwidthThrottleEpoch == timeCurrent) @@ -297,18 +297,18 @@ enet_host_bandwidth_throttle (ENetHost * host) if ((throttle * peer -> outgoingDataTotal) / ENET_PEER_PACKET_THROTTLE_SCALE <= peerBandwidth) continue; - peer -> packetThrottleLimit = (peerBandwidth * + peer -> packetThrottleLimit = (peerBandwidth * ENET_PEER_PACKET_THROTTLE_SCALE) / peer -> outgoingDataTotal; - + if (peer -> packetThrottleLimit == 0) peer -> packetThrottleLimit = 1; - + if (peer -> packetThrottle > peer -> packetThrottleLimit) peer -> packetThrottle = peer -> packetThrottleLimit; peer -> outgoingBandwidthThrottleEpoch = timeCurrent; - + needsAdjustment = 1; -- peersRemaining; bandwidth -= peerBandwidth; @@ -330,7 +330,7 @@ enet_host_bandwidth_throttle (ENetHost * host) if (peer -> packetThrottle > peer -> packetThrottleLimit) peer -> packetThrottle = peer -> packetThrottleLimit; } - + if (host -> recalculateBandwidthLimits) { host -> recalculateBandwidthLimits = 0; @@ -360,7 +360,7 @@ enet_host_bandwidth_throttle (ENetHost * host) continue; peer -> incomingBandwidthThrottleEpoch = timeCurrent; - + needsAdjustment = 1; -- peersRemaining; bandwidth -= peer -> outgoingBandwidth; @@ -384,7 +384,7 @@ enet_host_bandwidth_throttle (ENetHost * host) command.bandwidthLimit.incomingBandwidth = ENET_HOST_TO_NET_32 (bandwidthLimit); enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); - } + } } host -> bandwidthThrottleEpoch = timeCurrent; @@ -397,5 +397,5 @@ enet_host_bandwidth_throttle (ENetHost * host) peer -> outgoingDataTotal = 0; } } - + /** @} */ diff --git a/Libraries/enet/sdk/src/list.c b/Libraries/enet/sdk/src/list.c index 1a4aa3a..4cb8697 100644 --- a/Libraries/enet/sdk/src/list.c +++ b/Libraries/enet/sdk/src/list.c @@ -1,11 +1,11 @@ -/** +/** @file list.c @brief ENet linked list functions */ #define ENET_BUILDING_LIB 1 #include "enet/list.h" -/** +/** @defgroup list ENet linked list utility functions @ingroup private @{ @@ -50,7 +50,7 @@ enet_list_size (ENetList * list) position != enet_list_end (list); position = enet_list_next (position)) ++ size; - + return size; } diff --git a/Libraries/enet/sdk/src/packet.c b/Libraries/enet/sdk/src/packet.c index 7f18e49..2d1e30e 100644 --- a/Libraries/enet/sdk/src/packet.c +++ b/Libraries/enet/sdk/src/packet.c @@ -1,4 +1,4 @@ -/** +/** @file packet.c @brief ENet packet management functions */ @@ -6,8 +6,8 @@ #define ENET_BUILDING_LIB 1 #include "enet/enet.h" -/** @defgroup Packet ENet packet functions - @{ +/** @defgroup Packet ENet packet functions + @{ */ /** Creates a packet that may be sent to a peer. @@ -57,8 +57,8 @@ enet_packet_destroy (ENetPacket * packet) enet_free (packet); } -/** Attempts to resize the data in the packet to length specified in the - dataLength parameter +/** Attempts to resize the data in the packet to length specified in the + dataLength parameter @param packet packet to resize @param dataLength new size for the packet data @returns 0 on success, < 0 on failure @@ -67,7 +67,7 @@ int enet_packet_resize (ENetPacket * packet, size_t dataLength) { enet_uint8 * newData; - + if (dataLength <= packet -> dataLength || (packet -> flags & ENET_PACKET_FLAG_NO_ALLOCATE)) { packet -> dataLength = dataLength; @@ -81,7 +81,7 @@ enet_packet_resize (ENetPacket * packet, size_t dataLength) memcpy (newData, packet -> data, packet -> dataLength); enet_free (packet -> data); - + packet -> data = newData; packet -> dataLength = dataLength; @@ -91,21 +91,21 @@ enet_packet_resize (ENetPacket * packet, size_t dataLength) static int initializedCRC32 = 0; static enet_uint32 crcTable [256]; -static enet_uint32 +static enet_uint32 reflect_crc (int val, int bits) { int result = 0, bit; for (bit = 0; bit < bits; bit ++) { - if(val & 1) result |= 1 << (bits - 1 - bit); + if(val & 1) result |= 1 << (bits - 1 - bit); val >>= 1; } return result; } -static void +static void initialize_crc32 () { int byte; @@ -128,12 +128,12 @@ initialize_crc32 () initializedCRC32 = 1; } - + enet_uint32 enet_crc32 (const ENetBuffer * buffers, size_t bufferCount) { enet_uint32 crc = 0xFFFFFFFF; - + if (! initializedCRC32) initialize_crc32 (); while (bufferCount -- > 0) @@ -143,7 +143,7 @@ enet_crc32 (const ENetBuffer * buffers, size_t bufferCount) while (data < dataEnd) { - crc = (crc >> 8) ^ crcTable [(crc & 0xFF) ^ *data++]; + crc = (crc >> 8) ^ crcTable [(crc & 0xFF) ^ *data++]; } ++ buffers; diff --git a/Libraries/enet/sdk/src/peer.c b/Libraries/enet/sdk/src/peer.c index 52e34a5..3102edf 100644 --- a/Libraries/enet/sdk/src/peer.c +++ b/Libraries/enet/sdk/src/peer.c @@ -1,4 +1,4 @@ -/** +/** @file peer.c @brief ENet peer management functions */ @@ -6,7 +6,7 @@ #define ENET_BUILDING_LIB 1 #include "enet/enet.h" -/** @defgroup peer ENet peer functions +/** @defgroup peer ENet peer functions @{ */ @@ -18,23 +18,23 @@ The lowest mean round trip time from the sending of a reliable packet to the receipt of its acknowledgement is measured over an amount of time specified by the interval parameter in milliseconds. If a measured round trip time happens to - be significantly less than the mean round trip time measured over the interval, + be significantly less than the mean round trip time measured over the interval, then the throttle probability is increased to allow more traffic by an amount specified in the acceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. If a measured round trip time happens to be significantly greater than the mean round trip time measured over the interval, then the throttle probability is decreased to limit traffic by an amount specified in the deceleration parameter, which is a ratio to the ENET_PEER_PACKET_THROTTLE_SCALE constant. When the throttle has - a value of ENET_PEER_PACKET_THROTTLE_SCALE, on unreliable packets are dropped by + a value of ENET_PEER_PACKET_THROTTLE_SCALE, on unreliable packets are dropped by ENet, and so 100% of all unreliable packets will be sent. When the throttle has a value of 0, all unreliable packets are dropped by ENet, and so 0% of all unreliable packets will be sent. Intermediate values for the throttle represent intermediate probabilities between 0% and 100% of unreliable packets being sent. The bandwidth - limits of the local and foreign hosts are taken into account to determine a + limits of the local and foreign hosts are taken into account to determine a sensible limit for the throttle probability above which it should not raise even in the best of conditions. - @param peer peer to configure + @param peer peer to configure @param interval interval, in milliseconds, over which to measure lowest mean RTT; the default value is ENET_PEER_PACKET_THROTTLE_INTERVAL. @param acceleration rate at which to increase the throttle probability as mean RTT declines @param deceleration rate at which to decrease the throttle probability as mean RTT increases @@ -352,13 +352,13 @@ enet_peer_reset (ENetPeer * peer) peer -> disconnectData = 0; memset (peer -> unsequencedWindow, 0, sizeof (peer -> unsequencedWindow)); - + enet_peer_reset_queues (peer); } /** Sends a ping request to a peer. @param peer destination for the ping request - @remarks ping requests factor into the mean round trip time as designated by the + @remarks ping requests factor into the mean round trip time as designated by the roundTripTime field in the ENetPeer structure. Enet automatically pings all connected peers at regular intervals, however, this function may be called to ensure more frequent ping requests. @@ -373,7 +373,7 @@ enet_peer_ping (ENetPeer * peer) command.header.command = ENET_PROTOCOL_COMMAND_PING | ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; command.header.channelID = 0xFF; - + enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); } @@ -435,8 +435,8 @@ enet_peer_disconnect (ENetPeer * peer, enet_uint32 data) if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_ACKNOWLEDGE; else - command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; - + command.header.command |= ENET_PROTOCOL_COMMAND_FLAG_UNSEQUENCED; + enet_peer_queue_outgoing_command (peer, & command, NULL, 0, 0); if (peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) @@ -456,10 +456,10 @@ enet_peer_disconnect (ENetPeer * peer, enet_uint32 data) */ void enet_peer_disconnect_later (ENetPeer * peer, enet_uint32 data) -{ - if ((peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) && +{ + if ((peer -> state == ENET_PEER_STATE_CONNECTED || peer -> state == ENET_PEER_STATE_DISCONNECT_LATER) && ! (enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && + enet_list_empty (& peer -> outgoingUnreliableCommands) && enet_list_empty (& peer -> sentReliableCommands))) { peer -> state = ENET_PEER_STATE_DISCONNECT_LATER; @@ -493,9 +493,9 @@ enet_peer_queue_acknowledgement (ENetPeer * peer, const ENetProtocol * command, acknowledgement -> sentTime = sentTime; acknowledgement -> command = * command; - + enet_list_insert (enet_list_end (& peer -> acknowledgements), acknowledgement); - + return acknowledgement; } @@ -536,11 +536,11 @@ enet_peer_queue_outgoing_command (ENetPeer * peer, const ENetProtocol * command, else { ++ channel -> outgoingUnreliableSequenceNumber; - + outgoingCommand -> reliableSequenceNumber = channel -> outgoingReliableSequenceNumber; outgoingCommand -> unreliableSequenceNumber = channel -> outgoingUnreliableSequenceNumber; } - + outgoingCommand -> sendAttempts = 0; outgoingCommand -> sentTime = 0; outgoingCommand -> roundTripTimeout = 0; @@ -586,14 +586,14 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, if (reliableWindow < currentWindow || reliableWindow >= currentWindow + ENET_PEER_FREE_RELIABLE_WINDOWS - 1) goto freePacket; } - + switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) { case ENET_PROTOCOL_COMMAND_SEND_FRAGMENT: case ENET_PROTOCOL_COMMAND_SEND_RELIABLE: if (reliableSequenceNumber == channel -> incomingReliableSequenceNumber) goto freePacket; - + for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); currentCommand != enet_list_end (& channel -> incomingReliableCommands); currentCommand = enet_list_previous (currentCommand)) @@ -673,9 +673,9 @@ enet_peer_queue_incoming_command (ENetPeer * peer, const ENetProtocol * command, incomingCommand -> fragmentsRemaining = fragmentCount; incomingCommand -> packet = packet; incomingCommand -> fragments = NULL; - + if (fragmentCount > 0) - { + { incomingCommand -> fragments = (enet_uint32 *) enet_malloc ((fragmentCount + 31) / 32 * sizeof (enet_uint32)); memset (incomingCommand -> fragments, 0, (fragmentCount + 31) / 32 * sizeof (enet_uint32)); } diff --git a/Libraries/enet/sdk/src/protocol.c b/Libraries/enet/sdk/src/protocol.c index 47bf844..d81c84f 100644 --- a/Libraries/enet/sdk/src/protocol.c +++ b/Libraries/enet/sdk/src/protocol.c @@ -1,4 +1,4 @@ -/** +/** @file protocol.c @brief ENet protocol functions */ @@ -40,7 +40,7 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) do { ++ currentPeer; - + if (currentPeer >= & host -> peers [host -> peerCount]) currentPeer = host -> peers; @@ -54,7 +54,7 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) event -> peer = currentPeer; return 1; - + case ENET_PEER_STATE_ZOMBIE: host -> recalculateBandwidthLimits = 1; @@ -83,7 +83,7 @@ enet_protocol_dispatch_incoming_commands (ENetHost * host, ENetEvent * event) event -> packet = enet_peer_receive (currentPeer, channel - currentPeer -> channels); if (event -> packet == NULL) continue; - + event -> type = ENET_EVENT_TYPE_RECEIVE; event -> peer = currentPeer; event -> channelID = (enet_uint8) (channel - currentPeer -> channels); @@ -142,7 +142,7 @@ enet_protocol_remove_sent_unreliable_commands (ENetPeer * peer) while (! enet_list_empty (& peer -> sentUnreliableCommands)) { outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentUnreliableCommands); - + enet_list_remove (& outgoingCommand -> outgoingCommandList); if (outgoingCommand -> packet != NULL) @@ -169,7 +169,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl currentCommand = enet_list_next (currentCommand)) { outgoingCommand = (ENetOutgoingCommand *) currentCommand; - + if (outgoingCommand -> reliableSequenceNumber == reliableSequenceNumber && outgoingCommand -> command.header.channelID == channelID) break; @@ -207,7 +207,7 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl } commandNumber = (ENetProtocolCommand) (outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK); - + enet_list_remove (& outgoingCommand -> outgoingCommandList); if (outgoingCommand -> packet != NULL) @@ -224,13 +224,13 @@ enet_protocol_remove_sent_reliable_command (ENetPeer * peer, enet_uint16 reliabl if (enet_list_empty (& peer -> sentReliableCommands)) return commandNumber; - + outgoingCommand = (ENetOutgoingCommand *) enet_list_front (& peer -> sentReliableCommands); - + peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; return commandNumber; -} +} static ENetPeer * enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENetProtocol * command) @@ -260,7 +260,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> header.reliableSequenceNumber); } #endif - + channelCount = ENET_NET_TO_HOST_32 (command -> connect.channelCount); if (channelCount < ENET_PROTOCOL_MINIMUM_CHANNEL_COUNT || @@ -337,7 +337,7 @@ enet_protocol_handle_connect (ENetHost * host, ENetProtocolHeader * header, ENet ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; else currentPeer -> windowSize = (ENET_MIN (host -> outgoingBandwidth, currentPeer -> incomingBandwidth) / - ENET_PEER_WINDOW_SIZE_SCALE) * + ENET_PEER_WINDOW_SIZE_SCALE) * ENET_PROTOCOL_MINIMUM_WINDOW_SIZE; if (currentPeer -> windowSize < ENET_PROTOCOL_MINIMUM_WINDOW_SIZE) @@ -417,11 +417,11 @@ enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const E dataLength = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.dataLength); * currentData += dataLength; if (* currentData > & host -> receivedData [host -> receivedDataLength]) - return -1; + return -1; unsequencedGroup = ENET_NET_TO_HOST_16 (command -> sendUnsequenced.unsequencedGroup); index = unsequencedGroup % ENET_PEER_UNSEQUENCED_WINDOW_SIZE; - + if (unsequencedGroup < peer -> incomingUnsequencedGroup) unsequencedGroup += 0x10000; @@ -439,16 +439,16 @@ enet_protocol_handle_send_unsequenced (ENetHost * host, ENetPeer * peer, const E else if (peer -> unsequencedWindow [index / 32] & (1 << (index % 32))) return 0; - + peer -> unsequencedWindow [index / 32] |= 1 << (index % 32); - - + + packet = enet_packet_create ((const enet_uint8 *) command + sizeof (ENetProtocolSendUnsequenced), dataLength, ENET_PACKET_FLAG_UNSEQUENCED); if (packet == NULL) return -1; - + enet_peer_queue_incoming_command (peer, command, packet, 0); return 0; } @@ -516,12 +516,12 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet fragmentCount = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentCount); fragmentOffset = ENET_NET_TO_HOST_32 (command -> sendFragment.fragmentOffset); totalLength = ENET_NET_TO_HOST_32 (command -> sendFragment.totalLength); - + if (fragmentOffset >= totalLength || fragmentOffset + fragmentLength > totalLength || fragmentNumber >= fragmentCount) return -1; - + for (currentCommand = enet_list_previous (enet_list_end (& channel -> incomingReliableCommands)); currentCommand != enet_list_end (& channel -> incomingReliableCommands); currentCommand = enet_list_previous (currentCommand)) @@ -541,7 +541,7 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet { if (incomingCommand -> reliableSequenceNumber < startSequenceNumber) break; - + if ((incomingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) != ENET_PROTOCOL_COMMAND_SEND_FRAGMENT || totalLength != incomingCommand -> packet -> dataLength || fragmentCount != incomingCommand -> fragmentCount) @@ -551,7 +551,7 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet break; } } - + if (startCommand == NULL) { ENetProtocol hostCommand = * command; @@ -571,7 +571,7 @@ enet_protocol_handle_send_fragment (ENetHost * host, ENetPeer * peer, const ENet if (startCommand == NULL) return -1; } - + if ((startCommand -> fragments [fragmentNumber / 32] & (1 << (fragmentNumber % 32))) == 0) { -- startCommand -> fragmentsRemaining; @@ -692,7 +692,7 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * if (peer -> roundTripTime < peer -> lowestRoundTripTime) peer -> lowestRoundTripTime = peer -> roundTripTime; - if (peer -> roundTripTimeVariance > peer -> highestRoundTripTimeVariance) + if (peer -> roundTripTimeVariance > peer -> highestRoundTripTimeVariance) peer -> highestRoundTripTimeVariance = peer -> roundTripTimeVariance; if (peer -> packetThrottleEpoch == 0 || @@ -727,12 +727,12 @@ enet_protocol_handle_acknowledge (ENetHost * host, ENetEvent * event, ENetPeer * case ENET_PEER_STATE_DISCONNECT_LATER: if (enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && + enet_list_empty (& peer -> outgoingUnreliableCommands) && enet_list_empty (& peer -> sentReliableCommands)) enet_peer_disconnect (peer, peer -> disconnectData); break; } - + return 0; } @@ -756,14 +756,14 @@ enet_protocol_handle_verify_connect (ENetHost * host, ENetEvent * event, ENetPee } enet_protocol_remove_sent_reliable_command (peer, 1, 0xFF); - + peer -> outgoingPeerID = ENET_NET_TO_HOST_16 (command -> verifyConnect.outgoingPeerID); mtu = ENET_NET_TO_HOST_16 (command -> verifyConnect.mtu); if (mtu < ENET_PROTOCOL_MINIMUM_MTU) mtu = ENET_PROTOCOL_MINIMUM_MTU; - else + else if (mtu > ENET_PROTOCOL_MAXIMUM_MTU) mtu = ENET_PROTOCOL_MAXIMUM_MTU; @@ -817,7 +817,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) peer = & host -> peers [peerID]; if (peer -> state == ENET_PEER_STATE_DISCONNECTED || - peer -> state == ENET_PEER_STATE_ZOMBIE || + peer -> state == ENET_PEER_STATE_ZOMBIE || (host -> receivedAddress.host != peer -> address.host && peer -> address.host != ENET_HOST_BROADCAST)) return 0; @@ -844,10 +844,10 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) peer -> address.port = host -> receivedAddress.port; peer -> incomingDataTotal += host -> receivedDataLength; } - + headerSize = (flags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME ? sizeof (ENetProtocolHeader) : (size_t) & ((ENetProtocolHeader *) 0) -> sentTime); currentData = host -> receivedData + headerSize; - + while (currentData < & host -> receivedData [host -> receivedDataLength]) { enet_uint8 commandNumber; @@ -859,9 +859,9 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) break; commandNumber = command -> header.command & ENET_PROTOCOL_COMMAND_MASK; - if (commandNumber >= ENET_PROTOCOL_COMMAND_COUNT) + if (commandNumber >= ENET_PROTOCOL_COMMAND_COUNT) break; - + commandSize = commandSizes [commandNumber]; if (commandSize == 0 || currentData + commandSize > & host -> receivedData [host -> receivedDataLength]) break; @@ -870,7 +870,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) if (peer == NULL && commandNumber != ENET_PROTOCOL_COMMAND_CONNECT) break; - + command -> header.reliableSequenceNumber = ENET_NET_TO_HOST_16 (command -> header.reliableSequenceNumber); switch (command -> header.command & ENET_PROTOCOL_COMMAND_MASK) @@ -956,8 +956,8 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) enet_peer_queue_acknowledgement (peer, command, sentTime); break; - default: - enet_peer_queue_acknowledgement (peer, command, sentTime); + default: + enet_peer_queue_acknowledgement (peer, command, sentTime); break; } } @@ -969,7 +969,7 @@ enet_protocol_handle_incoming_commands (ENetHost * host, ENetEvent * event) return 0; } - + static int enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) { @@ -993,12 +993,12 @@ enet_protocol_receive_incoming_commands (ENetHost * host, ENetEvent * event) return 0; host -> receivedDataLength = receivedLength; - + switch (enet_protocol_handle_incoming_commands (host, event)) { case 1: return 1; - + case -1: return -1; @@ -1017,9 +1017,9 @@ enet_protocol_send_acknowledgements (ENetHost * host, ENetPeer * peer) ENetBuffer * buffer = & host -> buffers [host -> bufferCount]; ENetAcknowledgement * acknowledgement; ENetListIterator currentAcknowledgement; - + currentAcknowledgement = enet_list_begin (& peer -> acknowledgements); - + while (currentAcknowledgement != enet_list_end (& peer -> acknowledgements)) { if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || @@ -1032,19 +1032,19 @@ enet_protocol_send_acknowledgements (ENetHost * host, ENetPeer * peer) } acknowledgement = (ENetAcknowledgement *) currentAcknowledgement; - + currentAcknowledgement = enet_list_next (currentAcknowledgement); buffer -> data = command; buffer -> dataLength = sizeof (ENetProtocolAcknowledge); host -> packetSize += buffer -> dataLength; - + command -> header.command = ENET_PROTOCOL_COMMAND_ACKNOWLEDGE; command -> header.channelID = acknowledgement -> command.header.channelID; command -> acknowledge.receivedReliableSequenceNumber = ENET_HOST_TO_NET_16 (acknowledgement -> command.header.reliableSequenceNumber); command -> acknowledge.receivedSentTime = ENET_HOST_TO_NET_16 (acknowledgement -> sentTime); - + if ((acknowledgement -> command.header.command & ENET_PROTOCOL_COMMAND_MASK) == ENET_PROTOCOL_COMMAND_DISCONNECT) peer -> state = ENET_PEER_STATE_ZOMBIE; @@ -1068,7 +1068,7 @@ enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * pee ENetListIterator currentCommand; currentCommand = enet_list_begin (& peer -> outgoingUnreliableCommands); - + while (currentCommand != enet_list_end (& peer -> outgoingUnreliableCommands)) { size_t commandSize; @@ -1093,34 +1093,34 @@ enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * pee { peer -> packetThrottleCounter += ENET_PEER_PACKET_THROTTLE_COUNTER; peer -> packetThrottleCounter %= ENET_PEER_PACKET_THROTTLE_SCALE; - + if (peer -> packetThrottleCounter > peer -> packetThrottle) { -- outgoingCommand -> packet -> referenceCount; if (outgoingCommand -> packet -> referenceCount == 0) enet_packet_destroy (outgoingCommand -> packet); - + enet_list_remove (& outgoingCommand -> outgoingCommandList); enet_free (outgoingCommand); - + continue; } } buffer -> data = command; buffer -> dataLength = commandSize; - + host -> packetSize += buffer -> dataLength; * command = outgoingCommand -> command; - + enet_list_remove (& outgoingCommand -> outgoingCommandList); if (outgoingCommand -> packet != NULL) { ++ buffer; - + buffer -> data = outgoingCommand -> packet -> data; buffer -> dataLength = outgoingCommand -> packet -> dataLength; @@ -1133,14 +1133,14 @@ enet_protocol_send_unreliable_outgoing_commands (ENetHost * host, ENetPeer * pee ++ command; ++ buffer; - } + } host -> commandCount = command - host -> commands; host -> bufferCount = buffer - host -> buffers; - if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER && + if (peer -> state == ENET_PEER_STATE_DISCONNECT_LATER && enet_list_empty (& peer -> outgoingReliableCommands) && - enet_list_empty (& peer -> outgoingUnreliableCommands) && + enet_list_empty (& peer -> outgoingUnreliableCommands) && enet_list_empty (& peer -> sentReliableCommands)) enet_peer_disconnect (peer, peer -> disconnectData); } @@ -1179,7 +1179,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even if (outgoingCommand -> packet != NULL) peer -> reliableDataInTransit -= outgoingCommand -> fragmentLength; - + ++ peer -> packetsLost; outgoingCommand -> roundTripTimeout *= 2; @@ -1194,7 +1194,7 @@ enet_protocol_check_timeouts (ENetHost * host, ENetPeer * peer, ENetEvent * even peer -> nextTimeout = outgoingCommand -> sentTime + outgoingCommand -> roundTripTimeout; } } - + return 0; } @@ -1210,28 +1210,28 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) size_t commandSize; currentCommand = enet_list_begin (& peer -> outgoingReliableCommands); - + while (currentCommand != enet_list_end (& peer -> outgoingReliableCommands)) { outgoingCommand = (ENetOutgoingCommand *) currentCommand; channel = outgoingCommand -> command.header.channelID < peer -> channelCount ? & peer -> channels [outgoingCommand -> command.header.channelID] : NULL; reliableWindow = outgoingCommand -> reliableSequenceNumber / ENET_PEER_RELIABLE_WINDOW_SIZE; - if (channel != NULL && - outgoingCommand -> sendAttempts < 1 && + if (channel != NULL && + outgoingCommand -> sendAttempts < 1 && ! (outgoingCommand -> reliableSequenceNumber % ENET_PEER_RELIABLE_WINDOW_SIZE) && (channel -> reliableWindows [(reliableWindow + ENET_PEER_RELIABLE_WINDOWS - 1) % ENET_PEER_RELIABLE_WINDOWS] >= ENET_PEER_RELIABLE_WINDOW_SIZE || - channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | + channel -> usedReliableWindows & ((((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) << reliableWindow) | (((1 << ENET_PEER_FREE_RELIABLE_WINDOWS) - 1) >> (ENET_PEER_RELIABLE_WINDOW_SIZE - reliableWindow))))) break; - + commandSize = commandSizes [outgoingCommand -> command.header.command & ENET_PROTOCOL_COMMAND_MASK]; if (command >= & host -> commands [sizeof (host -> commands) / sizeof (ENetProtocol)] || buffer + 1 >= & host -> buffers [sizeof (host -> buffers) / sizeof (ENetBuffer)] || peer -> mtu - host -> packetSize < commandSize) { host -> continueSending = 1; - + break; } @@ -1247,7 +1247,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) break; } } - + currentCommand = enet_list_next (currentCommand); if (channel != NULL && outgoingCommand -> sendAttempts < 1) @@ -1257,7 +1257,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) } ++ outgoingCommand -> sendAttempts; - + if (outgoingCommand -> roundTripTimeout == 0) { outgoingCommand -> roundTripTimeout = peer -> roundTripTime + 4 * peer -> roundTripTimeVariance; @@ -1283,7 +1283,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) if (outgoingCommand -> packet != NULL) { ++ buffer; - + buffer -> data = outgoingCommand -> packet -> data + outgoingCommand -> fragmentOffset; buffer -> dataLength = outgoingCommand -> fragmentLength; @@ -1293,7 +1293,7 @@ enet_protocol_send_reliable_outgoing_commands (ENetHost * host, ENetPeer * peer) } ++ peer -> packetsSent; - + ++ command; ++ buffer; } @@ -1308,7 +1308,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch ENetProtocolHeader header; ENetPeer * currentPeer; int sentLength; - + host -> continueSending = 1; while (host -> continueSending) @@ -1341,11 +1341,11 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch if (enet_list_empty (& currentPeer -> sentReliableCommands) && ENET_TIME_DIFFERENCE (host -> serviceTime, currentPeer -> lastReceiveTime) >= ENET_PEER_PING_INTERVAL && currentPeer -> mtu - host -> packetSize >= sizeof (ENetProtocolPing)) - { + { enet_peer_ping (currentPeer); enet_protocol_send_reliable_outgoing_commands (host, currentPeer); } - + if (! enet_list_empty (& currentPeer -> outgoingUnreliableCommands)) enet_protocol_send_unreliable_outgoing_commands (host, currentPeer); @@ -1364,11 +1364,11 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch #ifdef WIN32 printf ( #else - fprintf (stderr, + fprintf (stderr, #endif "peer %u: %f%%+-%f%% packet loss, %u+-%u ms round trip time, %f%% throttle, %u/%u outgoing, %u/%u incoming\n", currentPeer -> incomingPeerID, currentPeer -> packetLoss / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> packetLossVariance / (float) ENET_PEER_PACKET_LOSS_SCALE, currentPeer -> roundTripTime, currentPeer -> roundTripTimeVariance, currentPeer -> packetThrottle / (float) ENET_PEER_PACKET_THROTTLE_SCALE, enet_list_size (& currentPeer -> outgoingReliableCommands), enet_list_size (& currentPeer -> outgoingUnreliableCommands), currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingReliableCommands) : 0, currentPeer -> channels != NULL ? enet_list_size (& currentPeer -> channels -> incomingUnreliableCommands) : 0); #endif - + currentPeer -> packetLossVariance -= currentPeer -> packetLossVariance / 4; if (packetLoss >= currentPeer -> packetLoss) @@ -1389,7 +1389,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch header.checksum = currentPeer -> sessionID; header.peerID = ENET_HOST_TO_NET_16 (currentPeer -> outgoingPeerID | host -> headerFlags); - + host -> buffers -> data = & header; if (host -> headerFlags & ENET_PROTOCOL_HEADER_FLAG_SENT_TIME) { @@ -1399,7 +1399,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch } else host -> buffers -> dataLength = (size_t) & ((ENetProtocolHeader *) 0) -> sentTime; - + #ifdef USE_CRC32 header.checksum = enet_crc32 (host -> buffers, host -> bufferCount); #endif @@ -1413,7 +1413,7 @@ enet_protocol_send_outgoing_commands (ENetHost * host, ENetEvent * event, int ch if (sentLength < 0) return -1; } - + return 0; } @@ -1492,7 +1492,7 @@ enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout) } host -> serviceTime = enet_time_get (); - + timeout += host -> serviceTime; do @@ -1568,10 +1568,10 @@ enet_host_service (ENetHost * host, ENetEvent * event, enet_uint32 timeout) if (enet_socket_wait (host -> socket, & waitCondition, ENET_TIME_DIFFERENCE (timeout, host -> serviceTime)) != 0) return -1; - + host -> serviceTime = enet_time_get (); } while (waitCondition == ENET_SOCKET_WAIT_RECEIVE); - return 0; + return 0; } diff --git a/Libraries/enet/sdk/src/unix.c b/Libraries/enet/sdk/src/unix.c index c2caac7..3ca0d30 100644 --- a/Libraries/enet/sdk/src/unix.c +++ b/Libraries/enet/sdk/src/unix.c @@ -1,4 +1,4 @@ -/** +/** @file unix.c @brief ENet Unix system specific functions */ @@ -68,7 +68,7 @@ enet_time_set (enet_uint32 newTimeBase) struct timeval timeVal; gettimeofday (& timeVal, NULL); - + timeBase = timeVal.tv_sec * 1000 + timeVal.tv_usec / 1000 - newTimeBase; } @@ -175,10 +175,10 @@ enet_socket_bind (ENetSocket socket, const ENetAddress * address) return bind (socket, (struct sockaddr *) & sin, - sizeof (struct sockaddr_in)); + sizeof (struct sockaddr_in)); } -int +int enet_socket_listen (ENetSocket socket, int backlog) { return listen (socket, backlog < 0 ? SOMAXCONN : backlog); @@ -247,10 +247,10 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address) struct sockaddr_in sin; socklen_t sinLength = sizeof (struct sockaddr_in); - result = accept (socket, - address != NULL ? (struct sockaddr *) & sin : NULL, + result = accept (socket, + address != NULL ? (struct sockaddr *) & sin : NULL, address != NULL ? & sinLength : NULL); - + if (result == -1) return ENET_SOCKET_NULL; @@ -261,8 +261,8 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address) } return result; -} - +} + void enet_socket_destroy (ENetSocket socket) { @@ -297,7 +297,7 @@ enet_socket_send (ENetSocket socket, msgHdr.msg_iovlen = bufferCount; sentLength = sendmsg (socket, & msgHdr, MSG_NOSIGNAL); - + if (sentLength == -1) { if (errno == EWOULDBLOCK) @@ -371,7 +371,7 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou #ifdef HAS_POLL struct pollfd pollSocket; int pollCount; - + pollSocket.fd = socket; pollSocket.events = 0; @@ -393,7 +393,7 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou if (pollSocket.revents & POLLOUT) * condition |= ENET_SOCKET_WAIT_SEND; - + if (pollSocket.revents & POLLIN) * condition |= ENET_SOCKET_WAIT_RECEIVE; diff --git a/Libraries/enet/sdk/src/win32.c b/Libraries/enet/sdk/src/win32.c index e1fae23..e32ae3f 100644 --- a/Libraries/enet/sdk/src/win32.c +++ b/Libraries/enet/sdk/src/win32.c @@ -1,4 +1,4 @@ -/** +/** @file win32.c @brief ENet Win32 system specific functions */ @@ -15,7 +15,7 @@ enet_initialize (void) { WORD versionRequested = MAKEWORD (1, 1); WSADATA wsaData; - + if (WSAStartup (versionRequested, & wsaData)) return -1; @@ -23,7 +23,7 @@ enet_initialize (void) HIBYTE (wsaData.wVersion) != 1) { WSACleanup (); - + return -1; } @@ -88,9 +88,9 @@ enet_address_get_host (const ENetAddress * address, char * name, size_t nameLeng { struct in_addr in; struct hostent * hostEntry; - + in.s_addr = address -> host; - + hostEntry = gethostbyaddr ((char *) & in, sizeof (struct in_addr), AF_INET); if (hostEntry == NULL) return enet_address_get_host_ip (address, name, nameLength); @@ -193,8 +193,8 @@ enet_socket_accept (ENetSocket socket, ENetAddress * address) struct sockaddr_in sin; int sinLength = sizeof (struct sockaddr_in); - result = accept (socket, - address != NULL ? (struct sockaddr *) & sin : NULL, + result = accept (socket, + address != NULL ? (struct sockaddr *) & sin : NULL, address != NULL ? & sinLength : NULL); if (result == INVALID_SOCKET) @@ -233,7 +233,7 @@ enet_socket_send (ENetSocket socket, sin.sin_addr.s_addr = address -> host; } - if (WSASendTo (socket, + if (WSASendTo (socket, (LPWSABUF) buffers, (DWORD) bufferCount, & sentLength, @@ -312,10 +312,10 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou fd_set readSet, writeSet; struct timeval timeVal; int selectCount; - + timeVal.tv_sec = timeout / 1000; timeVal.tv_usec = (timeout % 1000) * 1000; - + FD_ZERO (& readSet); FD_ZERO (& writeSet); @@ -337,12 +337,12 @@ enet_socket_wait (ENetSocket socket, enet_uint32 * condition, enet_uint32 timeou if (FD_ISSET (socket, & writeSet)) * condition |= ENET_SOCKET_WAIT_SEND; - + if (FD_ISSET (socket, & readSet)) * condition |= ENET_SOCKET_WAIT_RECEIVE; return 0; -} +} #endif diff --git a/Libraries/glew/glew.lua b/Libraries/glew/glew.lua index eecffa2..53476cb 100644 --- a/Libraries/glew/glew.lua +++ b/Libraries/glew/glew.lua @@ -6,7 +6,7 @@ Libraries["glew"] = { settings.cc.includes:Add(Path(PathDir(module_filename) .. "/sdk/include")) src = Collect(Path(PathDir(module_filename) .. "/sdk/source/*.c")) - + return Compile(settings, src) end } \ No newline at end of file diff --git a/Libraries/glew/sdk/include/GL/glew.h b/Libraries/glew/sdk/include/GL/glew.h index 04b8f7e..3793374 100644 --- a/Libraries/glew/sdk/include/GL/glew.h +++ b/Libraries/glew/sdk/include/GL/glew.h @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -55,7 +55,7 @@ /* ** Copyright (c) 2007 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -63,10 +63,10 @@ ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. diff --git a/Libraries/glew/sdk/include/GL/glxew.h b/Libraries/glew/sdk/include/GL/glxew.h index f19e573..2569700 100644 --- a/Libraries/glew/sdk/include/GL/glxew.h +++ b/Libraries/glew/sdk/include/GL/glxew.h @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -55,7 +55,7 @@ /* ** Copyright (c) 2007 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -63,10 +63,10 @@ ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -138,7 +138,7 @@ typedef struct __glXContextRec *GLXContext; typedef struct __GLXcontextRec *GLXContext; #endif -typedef unsigned int GLXVideoDeviceNV; +typedef unsigned int GLXVideoDeviceNV; extern Bool glXQueryExtension (Display *dpy, int *errorBase, int *eventBase); extern Bool glXQueryVersion (Display *dpy, int *major, int *minor); @@ -260,21 +260,21 @@ typedef XID GLXPbuffer; typedef struct __GLXFBConfigRec *GLXFBConfig; typedef struct { - int event_type; - int draw_type; - unsigned long serial; - Bool send_event; - Display *display; - GLXDrawable drawable; - unsigned int buffer_mask; - unsigned int aux_buffer; - int x, y; - int width, height; - int count; + int event_type; + int draw_type; + unsigned long serial; + Bool send_event; + Display *display; + GLXDrawable drawable; + unsigned int buffer_mask; + unsigned int aux_buffer; + int x, y; + int width, height; + int count; } GLXPbufferClobberEvent; typedef union __GLXEvent { - GLXPbufferClobberEvent glxpbufferclobber; - long pad[24]; + GLXPbufferClobberEvent glxpbufferclobber; + long pad[24]; } GLXEvent; typedef GLXFBConfig* ( * PFNGLXCHOOSEFBCONFIGPROC) (Display *dpy, int screen, const int *attrib_list, int *nelements); @@ -970,32 +970,32 @@ typedef XVisualInfo* ( * PFNGLXGETVISUALFROMFBCONFIGSGIXPROC) (Display *dpy, GLX #define GLX_HYPERPIPE_ID_SGIX 0x8030 typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int networkId; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int networkId; } GLXHyperpipeNetworkSGIX; typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int XOrigin; - int YOrigin; - int maxHeight; - int maxWidth; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int XOrigin; + int YOrigin; + int maxHeight; + int maxWidth; } GLXPipeRectLimits; typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int channel; - unsigned int participationType; - int timeSlice; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int channel; + unsigned int participationType; + int timeSlice; } GLXHyperpipeConfigSGIX; typedef struct { - char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; - int srcXOrigin; - int srcYOrigin; - int srcWidth; - int srcHeight; - int destXOrigin; - int destYOrigin; - int destWidth; - int destHeight; + char pipeName[GLX_HYPERPIPE_PIPE_NAME_LENGTH_SGIX]; + int srcXOrigin; + int srcYOrigin; + int srcWidth; + int srcHeight; + int destXOrigin; + int destYOrigin; + int destWidth; + int destHeight; } GLXPipeRect; typedef int ( * PFNGLXBINDHYPERPIPESGIXPROC) (Display *dpy, int hpId); diff --git a/Libraries/glew/sdk/include/GL/wglew.h b/Libraries/glew/sdk/include/GL/wglew.h index 7c7a380..6576ece 100644 --- a/Libraries/glew/sdk/include/GL/wglew.h +++ b/Libraries/glew/sdk/include/GL/wglew.h @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -31,7 +31,7 @@ /* ** Copyright (c) 2007 The Khronos Group Inc. -** +** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the ** "Materials"), to deal in the Materials without restriction, including @@ -39,10 +39,10 @@ ** distribute, sublicense, and/or sell copies of the Materials, and to ** permit persons to whom the Materials are furnished to do so, subject to ** the following conditions: -** +** ** The above copyright notice and this permission notice shall be included ** in all copies or substantial portions of the Materials. -** +** ** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, ** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF ** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. @@ -848,11 +848,11 @@ typedef BOOL (WINAPI * PFNWGLCOPYIMAGESUBDATANVPROC) (HGLRC hSrcRC, GLuint srcNa DECLARE_HANDLE(HGPUNV); typedef struct _GPU_DEVICE { - DWORD cb; - CHAR DeviceName[32]; - CHAR DeviceString[128]; - DWORD Flags; - RECT rcVirtualScreen; + DWORD cb; + CHAR DeviceName[32]; + CHAR DeviceString[128]; + DWORD Flags; + RECT rcVirtualScreen; } GPU_DEVICE, *PGPU_DEVICE; typedef HDC (WINAPI * PFNWGLCREATEAFFINITYDCNVPROC) (const HGPUNV *phGpuList); diff --git a/Libraries/glew/sdk/source/glew.c b/Libraries/glew/sdk/source/glew.c index 624222f..046ac6e 100644 --- a/Libraries/glew/sdk/source/glew.c +++ b/Libraries/glew/sdk/source/glew.c @@ -4,24 +4,24 @@ ** Copyright (C) 2002-2008, Marcelo E. Magallon ** Copyright (C) 2002, Lev Povalahev ** All rights reserved. -** -** Redistribution and use in source and binary forms, with or without +** +** Redistribution and use in source and binary forms, with or without ** modification, are permitted provided that the following conditions are met: -** -** * Redistributions of source code must retain the above copyright notice, +** +** * Redistributions of source code must retain the above copyright notice, ** this list of conditions and the following disclaimer. -** * Redistributions in binary form must reproduce the above copyright notice, -** this list of conditions and the following disclaimer in the documentation +** * Redistributions in binary form must reproduce the above copyright notice, +** this list of conditions and the following disclaimer in the documentation ** and/or other materials provided with the distribution. -** * The name of the author may be used to endorse or promote products +** * The name of the author may be used to endorse or promote products ** derived from this software without specific prior written permission. ** -** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE -** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE -** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR -** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF +** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE +** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR +** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF ** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS ** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN ** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) @@ -77,7 +77,7 @@ void* NSGLGetProcAddress (const GLubyte *name) { static void* image = NULL; - if (NULL == image) + if (NULL == image) { image = dlopen("/System/Library/Frameworks/OpenGL.framework/Versions/Current/OpenGL", RTLD_LAZY); } @@ -6784,14 +6784,14 @@ static GLboolean _glewInit_GL_WIN_swap_hint (GLEW_CONTEXT_ARG_DEF_INIT) /* ------------------------------------------------------------------------- */ -/* +/* * Search for name in the extensions string. Use of strstr() * is not sufficient because extension names can be prefixes of * other extension names. Could use strtok() but the constant * string returned by glGetString might be in read-only memory. */ GLboolean glewGetExtension (const char* name) -{ +{ GLubyte* p; GLubyte* end; GLuint len = _glewStrLen((const GLubyte*)name); @@ -6822,7 +6822,7 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) dot = _glewStrCLen(s, '.'); if (dot == 0) return GLEW_ERROR_NO_GL_VERSION; - + major = s[dot-1]-'0'; minor = s[dot+1]-'0'; @@ -6830,7 +6830,7 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) minor = 0; if (major<0 || major>9) return GLEW_ERROR_NO_GL_VERSION; - + if (major == 1 && minor == 0) { @@ -6839,7 +6839,7 @@ GLenum glewContextInit (GLEW_CONTEXT_ARG_DEF_LIST) else { CONST_CAST(GLEW_VERSION_3_0) = ( major >= 3 ) ? GL_TRUE : GL_FALSE; - CONST_CAST(GLEW_VERSION_2_1) = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE; + CONST_CAST(GLEW_VERSION_2_1) = GLEW_VERSION_3_0 == GL_TRUE || ( major == 2 && minor >= 1 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_2_0) = GLEW_VERSION_2_1 == GL_TRUE || ( major == 2 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_5) = GLEW_VERSION_2_0 == GL_TRUE || ( major == 1 && minor >= 5 ) ? GL_TRUE : GL_FALSE; CONST_CAST(GLEW_VERSION_1_4) = GLEW_VERSION_1_5 == GL_TRUE || ( major == 1 && minor >= 4 ) ? GL_TRUE : GL_FALSE; @@ -8782,7 +8782,7 @@ static PFNWGLGETEXTENSIONSSTRINGARBPROC _wglewGetExtensionsStringARB = NULL; static PFNWGLGETEXTENSIONSSTRINGEXTPROC _wglewGetExtensionsStringEXT = NULL; GLboolean wglewGetExtension (const char* name) -{ +{ GLubyte* p; GLubyte* end; GLuint len = _glewStrLen((const GLubyte*)name); @@ -9691,7 +9691,7 @@ static GLboolean _glewInit_GLX_SUN_video_resize (GLXEW_CONTEXT_ARG_DEF_INIT) /* ------------------------------------------------------------------------ */ GLboolean glxewGetExtension (const char* name) -{ +{ GLubyte* p; GLubyte* end; GLuint len; diff --git a/Libraries/glfw/glfw.lua b/Libraries/glfw/glfw.lua index 184d7bc..878fd9d 100644 --- a/Libraries/glfw/glfw.lua +++ b/Libraries/glfw/glfw.lua @@ -10,7 +10,7 @@ Libraries["glfw"] = { elseif family == "windows" then glfw_platform = "win32" end - + settings.cc.defines:Add("CONF_WITH_GLFW") settings.cc.includes:Add(Path(PathDir(module_filename) .. "/sdk/include")) settings.cc.includes:Add(Path(PathDir(module_filename) .. "/sdk/src")) diff --git a/Libraries/glfw/sdk/src/enable.c b/Libraries/glfw/sdk/src/enable.c index 3207428..bdb369b 100644 --- a/Libraries/glfw/sdk/src/enable.c +++ b/Libraries/glfw/sdk/src/enable.c @@ -63,7 +63,7 @@ static void _glfwEnableMouseCursor( void ) if( _glfwWin.MousePosCallback ) { - _glfwWin.MousePosCallback( _glfwInput.MousePosX, + _glfwWin.MousePosCallback( _glfwInput.MousePosX, _glfwInput.MousePosY ); } } diff --git a/Libraries/glfw/sdk/src/macosx/macosx_fullscreen.c b/Libraries/glfw/sdk/src/macosx/macosx_fullscreen.c index 57fcd5f..b59e071 100644 --- a/Libraries/glfw/sdk/src/macosx/macosx_fullscreen.c +++ b/Libraries/glfw/sdk/src/macosx/macosx_fullscreen.c @@ -39,17 +39,17 @@ static int _glfwVideoModesEqual( GLFWvidmode* first, { if( first->Width != second->Width ) return 0; - + if( first->Height != second->Height ) return 0; - + if( first->RedBits + first->GreenBits + first->BlueBits != second->RedBits + second->GreenBits + second->BlueBits ) return 0; - + return 1; } - + //======================================================================== // _glfwCGToGLFWVideoMode() - Converts a CG mode to a GLFW mode //======================================================================== @@ -99,14 +99,14 @@ int _glfwPlatformGetVideoModes( GLFWvidmode *list, int maxcount ) // Is it a valid mode? (only list depths >= 15 bpp) if( mode.RedBits + mode.GreenBits + mode.BlueBits < 15 ) continue; - + // Check for duplicate of current mode in target list for( j = 0; j < numModes; ++j ) { if( _glfwVideoModesEqual( &mode, &(list[j]) ) ) break; } - + // If empty list or no match found if( numModes == 0 || j == numModes ) list[numModes++] = mode; diff --git a/Libraries/glfw/sdk/src/macosx/macosx_init.c b/Libraries/glfw/sdk/src/macosx/macosx_init.c index e41f20e..d87e328 100644 --- a/Libraries/glfw/sdk/src/macosx/macosx_init.c +++ b/Libraries/glfw/sdk/src/macosx/macosx_init.c @@ -74,7 +74,7 @@ void _glfwChangeToResourcesDirectory( void ) CFBundleRef mainBundle = CFBundleGetMainBundle(); CFURLRef resourcesURL = CFBundleCopyResourcesDirectoryURL( mainBundle ); char resourcesPath[ _GLFW_MAX_PATH_LENGTH ]; - + CFStringRef lastComponent = CFURLCopyLastPathComponent( resourcesURL ); if ( kCFCompareEqualTo != CFStringCompare( CFSTR( "Resources" ), @@ -83,7 +83,7 @@ void _glfwChangeToResourcesDirectory( void ) { UNBUNDLED; } - + CFRelease( lastComponent ); if( !CFURLGetFileSystemRepresentation( resourcesURL, @@ -116,11 +116,11 @@ int _glfwPlatformInit( void ) _glfwWin.CommandUPP = NULL; _glfwWin.KeyboardUPP = NULL; _glfwWin.WindowUPP = NULL; - + _glfwInput.Modifiers = 0; - + _glfwLibrary.Unbundled = 0; - + _glfwLibrary.Libs.OpenGLFramework = CFBundleGetBundleWithIdentifier( CFSTR( "com.apple.opengl" ) ); if( _glfwLibrary.Libs.OpenGLFramework == NULL ) @@ -188,7 +188,7 @@ int _glfwPlatformTerminate( void ) DisposeEventHandlerUPP( _glfwWin.KeyboardUPP ); _glfwWin.KeyboardUPP = NULL; } - + return GL_TRUE; } diff --git a/Libraries/glfw/sdk/src/macosx/macosx_window.c b/Libraries/glfw/sdk/src/macosx/macosx_window.c index 21af88f..a074d9c 100644 --- a/Libraries/glfw/sdk/src/macosx/macosx_window.c +++ b/Libraries/glfw/sdk/src/macosx/macosx_window.c @@ -722,7 +722,7 @@ int _glfwPlatformOpenWindow( int width, _glfwPlatformCloseWindow(); return GL_FALSE; } - + /* Keith Bauer 2007-07-12 - I don't believe this is desirable if( SetFrontProcess( &psn ) != noErr ) { @@ -732,7 +732,7 @@ int _glfwPlatformOpenWindow( int width, } */ } - + // create window Rect windowContentBounds; windowContentBounds.left = 0; diff --git a/Libraries/glfw/sdk/src/macosx/platform.h b/Libraries/glfw/sdk/src/macosx/platform.h index 2b2b45c..591b45e 100644 --- a/Libraries/glfw/sdk/src/macosx/platform.h +++ b/Libraries/glfw/sdk/src/macosx/platform.h @@ -279,9 +279,9 @@ GLFWGLOBAL struct { // Bundle for dynamically-loading extension function pointers CFBundleRef OpenGLFramework; } Libs; - + int Unbundled; - + } _glfwLibrary; diff --git a/Libraries/glfw/sdk/src/stream.c b/Libraries/glfw/sdk/src/stream.c index f14d5c3..5478990 100644 --- a/Libraries/glfw/sdk/src/stream.c +++ b/Libraries/glfw/sdk/src/stream.c @@ -88,7 +88,7 @@ long _glfwReadStream( _GLFWstream *stream, void *data, long size ) { size = stream->Size - stream->Position; } - + // Perform data read memcpy( data, (unsigned char*) stream->Data + stream->Position, size ); stream->Position += size; @@ -168,7 +168,7 @@ int _glfwSeekStream( _GLFWstream *stream, long offset, int whence ) { stream->Position = position; } - + return GL_TRUE; } diff --git a/Libraries/glfw/sdk/src/win32/Makefile.win32.cross-mgw b/Libraries/glfw/sdk/src/win32/Makefile.win32.cross-mgw index 875f352..fa3dcf6 100644 --- a/Libraries/glfw/sdk/src/win32/Makefile.win32.cross-mgw +++ b/Libraries/glfw/sdk/src/win32/Makefile.win32.cross-mgw @@ -15,15 +15,15 @@ default: libglfw.a glfw.dll # Install GLFW header and static library ########################################################################## install: glfw.dll libglfw.a libglfw.pc - $(INSTALL) -d $(PREFIX)/bin - $(INSTALL) -c glfw.dll $(PREFIX)/bin/glfw.dll + $(INSTALL) -d $(PREFIX)/bin + $(INSTALL) -c glfw.dll $(PREFIX)/bin/glfw.dll $(INSTALL) -d $(PREFIX)/lib $(INSTALL) -c -m 644 libglfw.a $(PREFIX)/lib/libglfw.a $(INSTALL) -d $(PREFIX)/include/GL $(INSTALL) -c -m 644 ../../include/GL/glfw.h $(PREFIX)/include/GL/glfw.h $(INSTALL) -d $(PREFIX)/lib/pkgconfig $(INSTALL) -c -m 644 libglfw.pc $(PREFIX)/lib/pkgconfig/libglfw.pc - + ########################################################################## # Clean up generated files ########################################################################## @@ -68,8 +68,8 @@ LINKLIBS = -lopengl32 DLLTOOL = dlltool -SED = sed -INSTALL = install +SED = sed +INSTALL = install ########################################################################## # Object files for static library diff --git a/Libraries/glfw/sdk/src/win32/platform.h b/Libraries/glfw/sdk/src/win32/platform.h index 47a16d9..4708af3 100644 --- a/Libraries/glfw/sdk/src/win32/platform.h +++ b/Libraries/glfw/sdk/src/win32/platform.h @@ -151,14 +151,14 @@ typedef const char *(APIENTRY * WGLGETEXTENSIONSSTRINGARB_T)( HDC ); #define WGL_GREEN_BITS_ARB 0x2017 #define WGL_BLUE_BITS_ARB 0x2019 #define WGL_ALPHA_BITS_ARB 0x201B -#define WGL_ACCUM_BITS_ARB 0x201D -#define WGL_ACCUM_RED_BITS_ARB 0x201E -#define WGL_ACCUM_GREEN_BITS_ARB 0x201F -#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 -#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 +#define WGL_ACCUM_BITS_ARB 0x201D +#define WGL_ACCUM_RED_BITS_ARB 0x201E +#define WGL_ACCUM_GREEN_BITS_ARB 0x201F +#define WGL_ACCUM_BLUE_BITS_ARB 0x2020 +#define WGL_ACCUM_ALPHA_BITS_ARB 0x2021 #define WGL_DEPTH_BITS_ARB 0x2022 #define WGL_STENCIL_BITS_ARB 0x2023 -#define WGL_AUX_BUFFERS_ARB 0x2024 +#define WGL_AUX_BUFFERS_ARB 0x2024 #define WGL_SAMPLE_BUFFERS_ARB 0x2041 #define WGL_SAMPLES_ARB 0x2042 diff --git a/Libraries/glfw/sdk/src/win32/win32_window.c b/Libraries/glfw/sdk/src/win32/win32_window.c index 2a3d165..2803ae3 100644 --- a/Libraries/glfw/sdk/src/win32/win32_window.c +++ b/Libraries/glfw/sdk/src/win32/win32_window.c @@ -230,7 +230,7 @@ static int _glfwSetPixelFormatAttrib( int redbits, int greenbits, int bluebits, int PixelFormat, dummy, count = 0; int attribs[128]; PIXELFORMATDESCRIPTOR pfd; - + int accumredbits = hints->AccumRedBits; int accumgreenbits = hints->AccumGreenBits; int accumbluebits = hints->AccumBlueBits; @@ -248,7 +248,7 @@ static int _glfwSetPixelFormatAttrib( int redbits, int greenbits, int bluebits, _glfwSetWGLAttribute( WGL_DEPTH_BITS_ARB, depthbits ); _glfwSetWGLAttribute( WGL_STENCIL_BITS_ARB, stencilbits ); _glfwSetWGLAttribute( WGL_AUX_BUFFERS_ARB, hints->AuxBuffers ); - + if( accumredbits || accumgreenbits || accumbluebits || accumalphabits ) { _glfwSetWGLAttribute( WGL_ACCUM_BITS_ARB, accumredbits + @@ -291,7 +291,7 @@ static int _glfwSetPixelFormatAttrib( int redbits, int greenbits, int bluebits, return GL_FALSE; } - return GL_TRUE; + return GL_TRUE; } #undef _glfwSetWGLAttribute @@ -645,7 +645,7 @@ static LRESULT CALLBACK _glfwWindowCallback( HWND hWnd, UINT uMsg, _glfwTranslateChar( (DWORD) wParam, (DWORD) lParam, GLFW_PRESS ); } return 0; - } + } // Is a key being released? case WM_KEYUP: @@ -757,7 +757,7 @@ static LRESULT CALLBACK _glfwWindowCallback( HWND hWnd, UINT uMsg, _glfwInput.OldMouseX = NewMouseX; _glfwInput.OldMouseY = NewMouseY; _glfwInput.MouseMoved = GL_TRUE; - + // Call user callback function if( _glfwWin.MousePosCallback ) { @@ -937,7 +937,7 @@ static void _glfwInitWGLExtensions( void ) { _glfwWin.SwapInterval = NULL; } - + if( has_pixel_format ) { _glfwWin.ChoosePixelFormat = (WGLCHOOSEPIXELFORMATARB_T) @@ -949,7 +949,7 @@ static void _glfwInitWGLExtensions( void ) { _glfwWin.ChoosePixelFormat = NULL; _glfwWin.GetPixelFormatAttribiv = NULL; - } + } } @@ -975,7 +975,7 @@ static int _glfwCreateWindow( int redbits, int greenbits, int bluebits, // Adjust window position to working area (e.g. if the task bar is at // the top of the display). Fullscreen windows are always opened in - // the upper left corner regardless of the desktop working area. + // the upper left corner regardless of the desktop working area. if( _glfwWin.Fullscreen ) { wa.left = wa.top = 0; @@ -1140,7 +1140,7 @@ int _glfwPlatformOpenWindow( int width, int height, if( !wc.hIcon ) { // Load default icon - wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); + wc.hIcon = LoadIcon( NULL, IDI_WINLOGO ); } // Register the window class @@ -1173,7 +1173,7 @@ int _glfwPlatformOpenWindow( int width, int height, // Win98/ME/2K/.NET/+) /* if( _glfwLibrary.Sys.WinVer != _GLFW_WIN_95 && - _glfwLibrary.Sys.WinVer != _GLFW_WIN_NT4 && + _glfwLibrary.Sys.WinVer != _GLFW_WIN_NT4 && _glfwLibrary.Sys.WinVer != _GLFW_WIN_XP ) { dwStyle |= WS_MINIMIZE; @@ -1516,8 +1516,8 @@ void _glfwPlatformRefreshWindowParams( void ) int values[sizeof(attribs) / sizeof(attribs[0])]; - _glfwWin.GetPixelFormatAttribiv( _glfwWin.DC, PixelFormat, 0, - sizeof(attribs) / sizeof(attribs[0]), + _glfwWin.GetPixelFormatAttribiv( _glfwWin.DC, PixelFormat, 0, + sizeof(attribs) / sizeof(attribs[0]), attribs, values); // Is current OpenGL context accelerated? @@ -1531,7 +1531,7 @@ void _glfwPlatformRefreshWindowParams( void ) _glfwWin.DepthBits = values[5]; _glfwWin.StencilBits = values[6]; _glfwWin.AccumRedBits = values[7]; - _glfwWin.AccumGreenBits = values[8]; + _glfwWin.AccumGreenBits = values[8]; _glfwWin.AccumBlueBits = values[9]; _glfwWin.AccumAlphaBits = values[10]; _glfwWin.AuxBuffers = values[11]; diff --git a/Libraries/glfw/sdk/src/x11/x11_fullscreen.c b/Libraries/glfw/sdk/src/x11/x11_fullscreen.c index fb72c13..75b6fb9 100644 --- a/Libraries/glfw/sdk/src/x11/x11_fullscreen.c +++ b/Libraries/glfw/sdk/src/x11/x11_fullscreen.c @@ -119,7 +119,7 @@ int _glfwGetClosestVideoMode( int screen, int *width, int *height, int *rate ) bestrate = ratelist[i]; } } - + if( bestrate != -1 ) { *rate = bestrate; diff --git a/Libraries/glfw/sdk/src/x11/x11_joystick.c b/Libraries/glfw/sdk/src/x11/x11_joystick.c index 3fcb315..a8d92d9 100644 --- a/Libraries/glfw/sdk/src/x11/x11_joystick.c +++ b/Libraries/glfw/sdk/src/x11/x11_joystick.c @@ -126,7 +126,7 @@ void _glfwInitJoysticks( void ) { // Remember fd _glfwJoy[ joy_count ].fd = fd; - + // Check that the joystick driver version is 1.0+ ioctl( fd, JSIOCGVERSION, &driver_version ); if( driver_version < 0x010000 ) @@ -135,15 +135,15 @@ void _glfwInitJoysticks( void ) close( fd ); continue; } - + // Get number of joystick axes ioctl( fd, JSIOCGAXES, &ret_data ); _glfwJoy[ joy_count ].NumAxes = (int) ret_data; - + // Get number of joystick buttons ioctl( fd, JSIOCGBUTTONS, &ret_data ); _glfwJoy[ joy_count ].NumButtons = (int) ret_data; - + // Allocate memory for joystick state _glfwJoy[ joy_count ].Axis = (float *) malloc( sizeof(float) * @@ -172,7 +172,7 @@ void _glfwInitJoysticks( void ) { _glfwJoy[ joy_count ].Button[ n ] = GLFW_RELEASE; } - + // The joystick is supported and connected _glfwJoy[ joy_count ].Present = GL_TRUE; joy_count ++; diff --git a/Libraries/glfw/sdk/src/x11/x11_keysym2unicode.c b/Libraries/glfw/sdk/src/x11/x11_keysym2unicode.c index ebbc6d7..92e87b2 100644 --- a/Libraries/glfw/sdk/src/x11/x11_keysym2unicode.c +++ b/Libraries/glfw/sdk/src/x11/x11_keysym2unicode.c @@ -828,8 +828,8 @@ static struct codepair { { 0x13bc, 0x0152 }, { 0x13bd, 0x0153 }, { 0x13be, 0x0178 }, - { 0x20ac, 0x20ac }, - // Numeric keypad with numlock on + { 0x20ac, 0x20ac }, + // Numeric keypad with numlock on { XK_KP_Space, ' ' }, { XK_KP_Equal, '=' }, { XK_KP_Multiply, '*' }, @@ -838,16 +838,16 @@ static struct codepair { { XK_KP_Subtract, '-' }, { XK_KP_Decimal, '.' }, { XK_KP_Divide, '/' }, - { XK_KP_0, 0x0030 }, - { XK_KP_1, 0x0031 }, - { XK_KP_2, 0x0032 }, - { XK_KP_3, 0x0033 }, - { XK_KP_4, 0x0034 }, - { XK_KP_5, 0x0035 }, - { XK_KP_6, 0x0036 }, - { XK_KP_7, 0x0037 }, - { XK_KP_8, 0x0038 }, - { XK_KP_9, 0x0039 } + { XK_KP_0, 0x0030 }, + { XK_KP_1, 0x0031 }, + { XK_KP_2, 0x0032 }, + { XK_KP_3, 0x0033 }, + { XK_KP_4, 0x0034 }, + { XK_KP_5, 0x0035 }, + { XK_KP_6, 0x0036 }, + { XK_KP_7, 0x0037 }, + { XK_KP_8, 0x0038 }, + { XK_KP_9, 0x0039 } }; diff --git a/Libraries/glfw/sdk/src/x11/x11_window.c b/Libraries/glfw/sdk/src/x11/x11_window.c index 237b310..999d58a 100644 --- a/Libraries/glfw/sdk/src/x11/x11_window.c +++ b/Libraries/glfw/sdk/src/x11/x11_window.c @@ -34,10 +34,10 @@ /* Defines some GLX FSAA tokens if not yet defined */ #ifndef GLX_SAMPLE_BUFFERS # define GLX_SAMPLE_BUFFERS 100000 -#endif -#ifndef GLX_SAMPLES +#endif +#ifndef GLX_SAMPLES # define GLX_SAMPLES 100001 -#endif +#endif /* KDE decoration values */ @@ -291,11 +291,11 @@ XVisualInfo * _glfwChooseVisual( Display *Dpy, int Screen, int r, int g, // Convenience pre-calculation accum = (ar > 0 || ag > 0 || ab > 0 || aa > 0); - + samples = fsaa; samplebuffers = (fsaa > 0) ? 1 : 0; - - + + // Loop through list of visuals to find best match best_vis = -1; @@ -328,7 +328,7 @@ XVisualInfo * _glfwChooseVisual( Display *Dpy, int Screen, int r, int g, glXGetConfig( Dpy, &VI_list[i], GLX_AUX_BUFFERS, &vi_aux ); glXGetConfig( Dpy, &VI_list[i], GLX_SAMPLE_BUFFERS, &vi_samplebuffers ); glXGetConfig( Dpy, &VI_list[i], GLX_SAMPLES, &vi_samples ); - + vi_accum = (vi_ar > 0 || vi_ag > 0 || vi_ab > 0 || vi_aa > 0); // Check how many buffers are missing @@ -339,7 +339,7 @@ XVisualInfo * _glfwChooseVisual( Display *Dpy, int Screen, int r, int g, if( accum && !vi_accum ) missing ++; if( aux > 0 && vi_aux == 0 ) missing ++; if( samplebuffers > 0 && vi_samplebuffers == 0 ) missing ++; - + // Calculate color diff color_diff = (r - vi_r) * (r - vi_r) + @@ -374,7 +374,7 @@ XVisualInfo * _glfwChooseVisual( Display *Dpy, int Screen, int r, int g, if( samples > 0 ) { extra_diff += (samples - vi_samples) * (samples - vi_samples); - + } // Check if this is a better match. We implement some // complicated rules, by prioritizing in this order: @@ -1469,14 +1469,14 @@ void _glfwPlatformRefreshWindowParams( void ) // Get multisample buffer samples glXGetConfig( _glfwLibrary.Dpy, _glfwWin.VI, GLX_SAMPLES, &_glfwWin.Samples ); - glXGetConfig( _glfwLibrary.Dpy, _glfwWin.VI, GLX_SAMPLE_BUFFERS, + glXGetConfig( _glfwLibrary.Dpy, _glfwWin.VI, GLX_SAMPLE_BUFFERS, &sample_buffers ); if( sample_buffers == 0 ) _glfwWin.Samples = 0; - + // Default to refresh rate unknown (=0 according to GLFW spec) _glfwWin.RefreshRate = 0; - + // Retrieve refresh rate, if possible #if defined( _GLFW_HAS_XRANDR ) if( _glfwLibrary.XRandR.Available ) diff --git a/Libraries/lua/lua.lua b/Libraries/lua/lua.lua index 31c878c..730ab7e 100644 --- a/Libraries/lua/lua.lua +++ b/Libraries/lua/lua.lua @@ -1,6 +1,6 @@ local module_filename = ModuleFilename() Libraries["lua"] = { - Build = function(settings) + Build = function(settings) settings.cc.defines:Add("CONF_WITH_LUA") settings.cc.includes:Add(Path(PathDir(module_filename) .. "/sdk/include")) src = Collect(Path(PathDir(module_filename) .. "/sdk/src/*.c")) diff --git a/Libraries/lua/sdk/include/llimits.h b/Libraries/lua/sdk/include/llimits.h index ca8dcb7..20475d4 100644 --- a/Libraries/lua/sdk/include/llimits.h +++ b/Libraries/lua/sdk/include/llimits.h @@ -107,7 +107,7 @@ typedef lu_int32 Instruction; #ifndef lua_lock -#define lua_lock(L) ((void) 0) +#define lua_lock(L) ((void) 0) #define lua_unlock(L) ((void) 0) #endif @@ -118,7 +118,7 @@ typedef lu_int32 Instruction; /* ** macro to control inclusion of some hard tests on stack reallocation -*/ +*/ #ifndef HARDSTACKTESTS #define condhardstacktests(x) ((void)0) #else diff --git a/Libraries/lua/sdk/include/lobject.h b/Libraries/lua/sdk/include/lobject.h index f1e447e..577c6cc 100644 --- a/Libraries/lua/sdk/include/lobject.h +++ b/Libraries/lua/sdk/include/lobject.h @@ -337,7 +337,7 @@ typedef struct Node { typedef struct Table { CommonHeader; - lu_byte flags; /* 1<

    C) then pc++ */ -OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ +OP_TEST,/* A C if not (R(A) <=> C) then pc++ */ +OP_TESTSET,/* A B C if (R(B) <=> C) then R(A) := R(B) else pc++ */ OP_CALL,/* A B C R(A), ... ,R(A+C-2) := R(A)(R(A+1), ... ,R(A+B-1)) */ OP_TAILCALL,/* A B C return R(A)(R(A+1), ... ,R(A+B-1)) */ @@ -197,8 +197,8 @@ OP_FORLOOP,/* A sBx R(A)+=R(A+2); if R(A) =) R(A)*/ @@ -240,7 +240,7 @@ OP_VARARG/* A B R(A), R(A+1), ..., R(A+B-1) = vararg */ ** bits 4-5: B arg mode ** bit 6: instruction set register A ** bit 7: operator is a test -*/ +*/ enum OpArgMask { OpArgN, /* argument is not used */ diff --git a/Libraries/lua/sdk/include/lua.h b/Libraries/lua/sdk/include/lua.h index e4bdfd3..b796878 100644 --- a/Libraries/lua/sdk/include/lua.h +++ b/Libraries/lua/sdk/include/lua.h @@ -245,7 +245,7 @@ LUA_API void lua_setallocf (lua_State *L, lua_Alloc f, void *ud); -/* +/* ** =============================================================== ** some useful macros ** =============================================================== diff --git a/Libraries/lua/sdk/include/lualib.h b/Libraries/lua/sdk/include/lualib.h index 469417f..e9ff9ba 100644 --- a/Libraries/lua/sdk/include/lualib.h +++ b/Libraries/lua/sdk/include/lualib.h @@ -41,7 +41,7 @@ LUALIB_API int (luaopen_package) (lua_State *L); /* open all previous libraries */ -LUALIB_API void (luaL_openlibs) (lua_State *L); +LUALIB_API void (luaL_openlibs) (lua_State *L); diff --git a/Libraries/lua/sdk/src/lapi.c b/Libraries/lua/sdk/src/lapi.c index 5d5145d..86ebb51 100644 --- a/Libraries/lua/sdk/src/lapi.c +++ b/Libraries/lua/sdk/src/lapi.c @@ -211,7 +211,7 @@ LUA_API void lua_replace (lua_State *L, int idx) { api_checkvalidindex(L, o); if (idx == LUA_ENVIRONINDEX) { Closure *func = curr_func(L); - api_check(L, ttistable(L->top - 1)); + api_check(L, ttistable(L->top - 1)); func->c.env = hvalue(L->top - 1); luaC_barrier(L, func, L->top - 1); } @@ -771,7 +771,7 @@ LUA_API int lua_setfenv (lua_State *L, int idx) { #define checkresults(L,na,nr) \ api_check(L, (nr) == LUA_MULTRET || (L->ci->top - L->top >= (nr) - (na))) - + LUA_API void lua_call (lua_State *L, int nargs, int nresults) { StkId func; diff --git a/Libraries/lua/sdk/src/ldblib.c b/Libraries/lua/sdk/src/ldblib.c index 67de122..5e1314e 100644 --- a/Libraries/lua/sdk/src/ldblib.c +++ b/Libraries/lua/sdk/src/ldblib.c @@ -138,7 +138,7 @@ static int db_getinfo (lua_State *L) { treatstackoption(L, L1, "func"); return 1; /* return table */ } - + static int db_getlocal (lua_State *L) { int arg; diff --git a/Libraries/lua/sdk/src/ldebug.c b/Libraries/lua/sdk/src/ldebug.c index 50ad3d3..69456b9 100644 --- a/Libraries/lua/sdk/src/ldebug.c +++ b/Libraries/lua/sdk/src/ldebug.c @@ -184,7 +184,7 @@ static void collectvalidlines (lua_State *L, Closure *f) { int i; for (i=0; il.p->sizelineinfo; i++) setbvalue(luaH_setnum(L, t, lineinfo[i]), 1); - sethvalue(L, L->top, t); + sethvalue(L, L->top, t); } incr_top(L); } diff --git a/Libraries/lua/sdk/src/ldo.c b/Libraries/lua/sdk/src/ldo.c index 8de05f7..7cac000 100644 --- a/Libraries/lua/sdk/src/ldo.c +++ b/Libraries/lua/sdk/src/ldo.c @@ -365,7 +365,7 @@ int luaD_poscall (lua_State *L, StkId firstResult) { ** The arguments are on the stack, right after the function. ** When returns, all the results are on the stack, starting at the original ** function position. -*/ +*/ void luaD_call (lua_State *L, StkId func, int nResults) { if (++L->nCcalls >= LUAI_MAXCCALLS) { if (L->nCcalls == LUAI_MAXCCALLS) diff --git a/Libraries/lua/sdk/src/lgc.c b/Libraries/lua/sdk/src/lgc.c index d9e0b78..e0c69a7 100644 --- a/Libraries/lua/sdk/src/lgc.c +++ b/Libraries/lua/sdk/src/lgc.c @@ -310,7 +310,7 @@ static l_mem propagatemark (global_State *g) { traverseproto(g, p); return sizeof(Proto) + sizeof(Instruction) * p->sizecode + sizeof(Proto *) * p->sizep + - sizeof(TValue) * p->sizek + + sizeof(TValue) * p->sizek + sizeof(int) * p->sizelineinfo + sizeof(LocVar) * p->sizelocvars + sizeof(TString *) * p->sizeupvalues; @@ -697,7 +697,7 @@ void luaC_linkupval (lua_State *L, UpVal *uv) { GCObject *o = obj2gco(uv); o->gch.next = g->rootgc; /* link upvalue into `rootgc' list */ g->rootgc = o; - if (isgray(o)) { + if (isgray(o)) { if (g->gcstate == GCSpropagate) { gray2black(o); /* closed upvalues need barrier */ luaC_barrier(L, uv, uv->v); diff --git a/Libraries/lua/sdk/src/loadlib.c b/Libraries/lua/sdk/src/loadlib.c index 0d401eb..0eac6fb 100644 --- a/Libraries/lua/sdk/src/loadlib.c +++ b/Libraries/lua/sdk/src/loadlib.c @@ -502,7 +502,7 @@ static int ll_require (lua_State *L) { ** 'module' function ** ======================================================= */ - + static void setfenv (lua_State *L) { lua_Debug ar; @@ -632,7 +632,7 @@ LUALIB_API int luaopen_package (lua_State *L) { lua_setfield(L, -2, "__gc"); /* create `package' table */ luaL_register(L, LUA_LOADLIBNAME, pk_funcs); -#if defined(LUA_COMPAT_LOADLIB) +#if defined(LUA_COMPAT_LOADLIB) lua_getfield(L, -1, "loadlib"); lua_setfield(L, LUA_GLOBALSINDEX, "loadlib"); #endif diff --git a/Libraries/lua/sdk/src/lstate.c b/Libraries/lua/sdk/src/lstate.c index 4313b83..2bdbb62 100644 --- a/Libraries/lua/sdk/src/lstate.c +++ b/Libraries/lua/sdk/src/lstate.c @@ -36,7 +36,7 @@ typedef struct LG { lua_State l; global_State g; } LG; - + static void stack_init (lua_State *L1, lua_State *L) { diff --git a/Libraries/lua/sdk/src/lstrlib.c b/Libraries/lua/sdk/src/lstrlib.c index 1b4763d..b478e05 100644 --- a/Libraries/lua/sdk/src/lstrlib.c +++ b/Libraries/lua/sdk/src/lstrlib.c @@ -636,7 +636,7 @@ static void add_value (MatchState *ms, luaL_Buffer *b, const char *s, lua_pushlstring(L, s, e - s); /* keep original text */ } else if (!lua_isstring(L, -1)) - luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); + luaL_error(L, "invalid replacement value (a %s)", luaL_typename(L, -1)); luaL_addvalue(b); /* add result to accumulator */ } diff --git a/Libraries/lua/sdk/src/ltable.c b/Libraries/lua/sdk/src/ltable.c index ec84f4f..677b0e9 100644 --- a/Libraries/lua/sdk/src/ltable.c +++ b/Libraries/lua/sdk/src/ltable.c @@ -48,7 +48,7 @@ #define hashpow2(t,n) (gnode(t, lmod((n), sizenode(t)))) - + #define hashstr(t,str) hashpow2(t, (str)->tsv.hash) #define hashboolean(t,p) hashpow2(t, p) @@ -302,7 +302,7 @@ static void resize (lua_State *L, Table *t, int nasize, int nhsize) { if (nasize > oldasize) /* array part must grow? */ setarrayvector(L, t, nasize); /* create new hash part with appropriate size */ - setnodevector(L, t, nhsize); + setnodevector(L, t, nhsize); if (nasize < oldasize) { /* array part must shrink? */ t->sizearray = nasize; /* re-insert elements from vanishing slice */ @@ -390,11 +390,11 @@ static Node *getfreepos (Table *t) { /* -** inserts a new key into a hash table; first, check whether key's main -** position is free. If not, check whether colliding node is in its main -** position or not: if it is not, move colliding node to an empty place and -** put new key in its main position; otherwise (colliding node is in its main -** position), new key goes to an empty position. +** inserts a new key into a hash table; first, check whether key's main +** position is free. If not, check whether colliding node is in its main +** position or not: if it is not, move colliding node to an empty place and +** put new key in its main position; otherwise (colliding node is in its main +** position), new key goes to an empty position. */ static TValue *newkey (lua_State *L, Table *t, const TValue *key) { Node *mp = mainposition(t, key); diff --git a/Libraries/lua/sdk/src/lvm.c b/Libraries/lua/sdk/src/lvm.c index ee3256a..c7c0e57 100644 --- a/Libraries/lua/sdk/src/lvm.c +++ b/Libraries/lua/sdk/src/lvm.c @@ -125,7 +125,7 @@ void luaV_gettable (lua_State *L, const TValue *t, TValue *key, StkId val) { callTMres(L, val, tm, t, key); return; } - t = tm; /* else repeat with `tm' */ + t = tm; /* else repeat with `tm' */ } luaG_runerror(L, "loop in gettable"); } @@ -152,7 +152,7 @@ void luaV_settable (lua_State *L, const TValue *t, TValue *key, StkId val) { callTM(L, tm, t, key, val); return; } - t = tm; /* else repeat with `tm' */ + t = tm; /* else repeat with `tm' */ } luaG_runerror(L, "loop in settable"); } diff --git a/Libraries/luasocket/luasocket.lua b/Libraries/luasocket/luasocket.lua index 3944939..fccf788 100644 --- a/Libraries/luasocket/luasocket.lua +++ b/Libraries/luasocket/luasocket.lua @@ -1,7 +1,7 @@ local module_filename = ModuleFilename() Libraries["luasocket"] = { - Build = function(settings) + Build = function(settings) settings.cc.defines:Add("CONF_WITH_LUASOCKET") --settings.cc.defines:Add("LUASOCKET_API") settings.cc.includes:Add(Path(PathDir(module_filename) .. "/sdk/include")) diff --git a/Libraries/luasocket/sdk/include/auxiliar.h b/Libraries/luasocket/sdk/include/auxiliar.h index 18b8495..07e4213 100644 --- a/Libraries/luasocket/sdk/include/auxiliar.h +++ b/Libraries/luasocket/sdk/include/auxiliar.h @@ -4,12 +4,12 @@ * Auxiliar routines for class hierarchy manipulation * LuaSocket toolkit (but completely independent of other LuaSocket modules) * -* A LuaSocket class is a name associated with Lua metatables. A LuaSocket -* group is a name associated with a class. A class can belong to any number +* A LuaSocket class is a name associated with Lua metatables. A LuaSocket +* group is a name associated with a class. A class can belong to any number * of groups. This module provides the functionality to: * -* - create new classes -* - add classes to groups +* - create new classes +* - add classes to groups * - set the class of objects * - check if an object belongs to a given class or group * - get the userdata associated to objects @@ -26,7 +26,7 @@ * "class" with the class name. * * The mapping from class name to the corresponding metatable and the -* reverse mapping are done using lauxlib. +* reverse mapping are done using lauxlib. * * RCS ID: $Id: auxiliar.h,v 1.9 2005/10/07 04:40:59 diego Exp $ \*=========================================================================*/ diff --git a/Libraries/luasocket/sdk/include/buffer.h b/Libraries/luasocket/sdk/include/buffer.h index baf93ca..7a7ea31 100644 --- a/Libraries/luasocket/sdk/include/buffer.h +++ b/Libraries/luasocket/sdk/include/buffer.h @@ -1,13 +1,13 @@ #ifndef BUF_H -#define BUF_H +#define BUF_H /*=========================================================================*\ * Input/Output interface for Lua programs * LuaSocket toolkit * * Line patterns require buffering. Reading one character at a time involves * too many system calls and is very slow. This module implements the -* LuaSocket interface for input/output on connected objects, as seen by -* Lua programs. +* LuaSocket interface for input/output on connected objects, as seen by +* Lua programs. * * Input is buffered. Output is *not* buffered because there was no simple * way of making sure the buffered output data would ever be sent. diff --git a/Libraries/luasocket/sdk/include/except.h b/Libraries/luasocket/sdk/include/except.h index 81efb29..cb4855b 100644 --- a/Libraries/luasocket/sdk/include/except.h +++ b/Libraries/luasocket/sdk/include/except.h @@ -16,14 +16,14 @@ * * The idea is to nest function calls with the "try" function. This function * checks the first value, and calls "error" on the second if the first is -* nil. Otherwise, it returns all values it received. +* nil. Otherwise, it returns all values it received. * * The protect function returns a new function that behaves exactly like the * function it receives, but the new function doesn't throw exceptions: it * returns nil followed by the error message instead. * * With these two function, it's easy to write functions that throw -* exceptions on error, but that don't interrupt the user script. +* exceptions on error, but that don't interrupt the user script. * * RCS ID: $Id: except.h,v 1.2 2005/09/29 06:11:41 diego Exp $ \*=========================================================================*/ diff --git a/Libraries/luasocket/sdk/include/inet.h b/Libraries/luasocket/sdk/include/inet.h index 7662266..36d2bbb 100644 --- a/Libraries/luasocket/sdk/include/inet.h +++ b/Libraries/luasocket/sdk/include/inet.h @@ -1,12 +1,12 @@ -#ifndef INET_H -#define INET_H +#ifndef INET_H +#define INET_H /*=========================================================================*\ * Internet domain functions * LuaSocket toolkit * * This module implements the creation and connection of internet domain * sockets, on top of the socket.h interface, and the interface of with the -* resolver. +* resolver. * * The function inet_aton is provided for the platforms where it is not * available. The module also implements the interface of the internet @@ -27,9 +27,9 @@ int inet_open(lua_State *L); const char *inet_trycreate(p_socket ps, int type); -const char *inet_tryconnect(p_socket ps, const char *address, +const char *inet_tryconnect(p_socket ps, const char *address, unsigned short port, p_timeout tm); -const char *inet_trybind(p_socket ps, const char *address, +const char *inet_trybind(p_socket ps, const char *address, unsigned short port); int inet_meth_getpeername(lua_State *L, p_socket ps); diff --git a/Libraries/luasocket/sdk/include/mime.h b/Libraries/luasocket/sdk/include/mime.h index 85ee2a3..897e90c 100644 --- a/Libraries/luasocket/sdk/include/mime.h +++ b/Libraries/luasocket/sdk/include/mime.h @@ -1,12 +1,12 @@ -#ifndef MIME_H -#define MIME_H +#ifndef MIME_H +#define MIME_H /*=========================================================================*\ * Core MIME support * LuaSocket toolkit * * This module provides functions to implement transfer content encodings * and formatting conforming to RFC 2045. It is used by mime.lua, which -* provide a higher level interface to this functionality. +* provide a higher level interface to this functionality. * * RCS ID: $Id: mime.h,v 1.15 2007/06/11 23:44:54 diego Exp $ \*=========================================================================*/ diff --git a/Libraries/luasocket/sdk/include/options.h b/Libraries/luasocket/sdk/include/options.h index 4981cf2..121ae6b 100644 --- a/Libraries/luasocket/sdk/include/options.h +++ b/Libraries/luasocket/sdk/include/options.h @@ -1,11 +1,11 @@ #ifndef OPTIONS_H #define OPTIONS_H /*=========================================================================*\ -* Common option interface +* Common option interface * LuaSocket toolkit * * This module provides a common interface to socket options, used mainly by -* modules UDP and TCP. +* modules UDP and TCP. * * RCS ID: $Id: options.h,v 1.4 2005/10/07 04:40:59 diego Exp $ \*=========================================================================*/ diff --git a/Libraries/luasocket/sdk/include/select.h b/Libraries/luasocket/sdk/include/select.h index aa3db4a..318b165 100644 --- a/Libraries/luasocket/sdk/include/select.h +++ b/Libraries/luasocket/sdk/include/select.h @@ -4,9 +4,9 @@ * Select implementation * LuaSocket toolkit * -* Each object that can be passed to the select function has to export +* Each object that can be passed to the select function has to export * method getfd() which returns the descriptor to be passed to the -* underlying select function. Another method, dirty(), should return +* underlying select function. Another method, dirty(), should return * true if there is data ready for reading (required for buffered input). * * RCS ID: $Id: select.h,v 1.7 2004/06/16 01:02:07 diego Exp $ diff --git a/Libraries/luasocket/sdk/include/socket.h b/Libraries/luasocket/sdk/include/socket.h index 656c7f5..c3ee9b5 100644 --- a/Libraries/luasocket/sdk/include/socket.h +++ b/Libraries/luasocket/sdk/include/socket.h @@ -26,7 +26,7 @@ * The connect and accept functions accept a timeout and their * implementations are somewhat complicated. We chose to move * the timeout control into this module for these functions in -* order to simplify the modules that use them. +* order to simplify the modules that use them. \*=========================================================================*/ #include "timeout.h" @@ -34,38 +34,38 @@ typedef struct sockaddr SA; /*=========================================================================*\ -* Functions bellow implement a comfortable platform independent +* Functions bellow implement a comfortable platform independent * interface to sockets \*=========================================================================*/ int socket_open(void); int socket_close(void); void socket_destroy(p_socket ps); -void socket_shutdown(p_socket ps, int how); -int socket_sendto(p_socket ps, const char *data, size_t count, +void socket_shutdown(p_socket ps, int how); +int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, SA *addr, socklen_t addr_len, p_timeout tm); -int socket_recvfrom(p_socket ps, char *data, size_t count, +int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, SA *addr, socklen_t *addr_len, p_timeout tm); void socket_setnonblocking(p_socket ps); void socket_setblocking(p_socket ps); int socket_waitfd(p_socket ps, int sw, p_timeout tm); -int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, +int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, p_timeout tm); -int socket_connect(p_socket ps, SA *addr, socklen_t addr_len, p_timeout tm); +int socket_connect(p_socket ps, SA *addr, socklen_t addr_len, p_timeout tm); int socket_create(p_socket ps, int domain, int type, int protocol); -int socket_bind(p_socket ps, SA *addr, socklen_t addr_len); +int socket_bind(p_socket ps, SA *addr, socklen_t addr_len); int socket_listen(p_socket ps, int backlog); -int socket_accept(p_socket ps, p_socket pa, SA *addr, +int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *addr_len, p_timeout tm); const char *socket_hoststrerror(int err); const char *socket_strerror(int err); -/* these are perfect to use with the io abstraction module +/* these are perfect to use with the io abstraction module and the buffered input module */ -int socket_send(p_socket ps, const char *data, size_t count, +int socket_send(p_socket ps, const char *data, size_t count, size_t *sent, p_timeout tm); int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm); const char *socket_ioerror(p_socket ps, int err); diff --git a/Libraries/luasocket/sdk/include/udp.h b/Libraries/luasocket/sdk/include/udp.h index 2801712..1a413e9 100644 --- a/Libraries/luasocket/sdk/include/udp.h +++ b/Libraries/luasocket/sdk/include/udp.h @@ -8,7 +8,7 @@ * (AF_INET, SOCK_DGRAM). * * Two classes are defined: connected and unconnected. UDP objects are -* originally unconnected. They can be "connected" to a given address +* originally unconnected. They can be "connected" to a given address * with a call to the setpeername function. The same function can be used to * break the connection. * diff --git a/Libraries/luasocket/sdk/include/unix.h b/Libraries/luasocket/sdk/include/unix.h index 32b7380..508c790 100644 --- a/Libraries/luasocket/sdk/include/unix.h +++ b/Libraries/luasocket/sdk/include/unix.h @@ -4,7 +4,7 @@ * Unix domain object * LuaSocket toolkit * -* This module is just an example of how to extend LuaSocket with a new +* This module is just an example of how to extend LuaSocket with a new * domain. * * RCS ID: $Id: unix.h,v 1.9 2006/03/13 07:16:39 diego Exp $ diff --git a/Libraries/luasocket/sdk/lua_src/http.lua b/Libraries/luasocket/sdk/lua_src/http.lua index ad8db1e..0bfe256 100644 --- a/Libraries/luasocket/sdk/lua_src/http.lua +++ b/Libraries/luasocket/sdk/lua_src/http.lua @@ -215,7 +215,7 @@ local function adjustheaders(reqt) } -- if we have authentication information, pass it along if reqt.user and reqt.password then - lower["authorization"] = + lower["authorization"] = "Basic " .. (mime.b64(reqt.user .. ":" .. reqt.password)) end -- override with user headers @@ -239,7 +239,7 @@ local function adjustrequest(reqt) -- explicit components override url for i,v in base.pairs(reqt) do nreqt[i] = v end if nreqt.port == "" then nreqt.port = 80 end - socket.try(nreqt.host and nreqt.host ~= "", + socket.try(nreqt.host and nreqt.host ~= "", "invalid host '" .. base.tostring(nreqt.host) .. "'") -- compute uri if user hasn't overriden nreqt.uri = reqt.uri or adjusturi(nreqt) @@ -277,10 +277,10 @@ function tredirect(reqt, location) source = reqt.source, sink = reqt.sink, headers = reqt.headers, - proxy = reqt.proxy, + proxy = reqt.proxy, nredirects = (reqt.nredirects or 0) + 1, create = reqt.create - } + } -- pass location header back as a hint we redirected headers = headers or {} headers.location = headers.location or location @@ -297,7 +297,7 @@ function trequest(reqt) h:sendheaders(nreqt.headers) -- if there is a body, send it if nreqt.source then - h:sendbody(nreqt.headers, nreqt.source, nreqt.step) + h:sendbody(nreqt.headers, nreqt.source, nreqt.step) end local code, status = h:receivestatusline() -- if it is an HTTP/0.9 server, simply get the body and we are done @@ -307,13 +307,13 @@ function trequest(reqt) end local headers -- ignore any 100-continue messages - while code == 100 do + while code == 100 do headers = h:receiveheaders() code, status = h:receivestatusline() end headers = h:receiveheaders() -- at this point we should have a honest reply from the server - -- we can't redirect if we already used the source, so we report the error + -- we can't redirect if we already used the source, so we report the error if shouldredirect(nreqt, code, headers) and not nreqt.source then h:close() return tredirect(reqt, headers.location) diff --git a/Libraries/luasocket/sdk/lua_src/mime.lua b/Libraries/luasocket/sdk/lua_src/mime.lua index 169eda2..3f9a222 100644 --- a/Libraries/luasocket/sdk/lua_src/mime.lua +++ b/Libraries/luasocket/sdk/lua_src/mime.lua @@ -27,7 +27,7 @@ local function choose(table) name, opt1, opt2 = "default", name, opt1 end local f = table[name or "nil"] - if not f then + if not f then base.error("unknown key (" .. base.tostring(name) .. ")", 3) else return f(opt1, opt2) end end diff --git a/Libraries/luasocket/sdk/lua_src/url.lua b/Libraries/luasocket/sdk/lua_src/url.lua index 0e31d8a..5a1ea21 100644 --- a/Libraries/luasocket/sdk/lua_src/url.lua +++ b/Libraries/luasocket/sdk/lua_src/url.lua @@ -233,7 +233,7 @@ function absolute(base_url, relative_url) relative_parsed.query = base_parsed.query end end - else + else relative_parsed.path = absolute_path(base_parsed.path or "", relative_parsed.path) end diff --git a/Libraries/luasocket/sdk/src/auxiliar.c b/Libraries/luasocket/sdk/src/auxiliar.c index 9514970..5984dde 100644 --- a/Libraries/luasocket/sdk/src/auxiliar.c +++ b/Libraries/luasocket/sdk/src/auxiliar.c @@ -28,7 +28,7 @@ void auxiliar_newclass(lua_State *L, const char *classname, luaL_reg *func) { luaL_newmetatable(L, classname); /* mt */ /* create __index table to place methods */ lua_pushstring(L, "__index"); /* mt,"__index" */ - lua_newtable(L); /* mt,"__index",it */ + lua_newtable(L); /* mt,"__index",it */ /* put class name into class metatable */ lua_pushstring(L, "class"); /* mt,"__index",it,"class" */ lua_pushstring(L, classname); /* mt,"__index",it,"class",classname */ @@ -86,7 +86,7 @@ int auxiliar_checkboolean(lua_State *L, int objidx) { } /*-------------------------------------------------------------------------*\ -* Return userdata pointer if object belongs to a given class, abort with +* Return userdata pointer if object belongs to a given class, abort with * error otherwise \*-------------------------------------------------------------------------*/ void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx) { @@ -100,7 +100,7 @@ void *auxiliar_checkclass(lua_State *L, const char *classname, int objidx) { } /*-------------------------------------------------------------------------*\ -* Return userdata pointer if object belongs to a given group, abort with +* Return userdata pointer if object belongs to a given group, abort with * error otherwise \*-------------------------------------------------------------------------*/ void *auxiliar_checkgroup(lua_State *L, const char *groupname, int objidx) { @@ -123,7 +123,7 @@ void auxiliar_setclass(lua_State *L, const char *classname, int objidx) { } /*-------------------------------------------------------------------------*\ -* Get a userdata pointer if object belongs to a given group. Return NULL +* Get a userdata pointer if object belongs to a given group. Return NULL * otherwise \*-------------------------------------------------------------------------*/ void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx) { @@ -141,7 +141,7 @@ void *auxiliar_getgroupudata(lua_State *L, const char *groupname, int objidx) { } /*-------------------------------------------------------------------------*\ -* Get a userdata pointer if object belongs to a given class. Return NULL +* Get a userdata pointer if object belongs to a given class. Return NULL * otherwise \*-------------------------------------------------------------------------*/ void *auxiliar_getclassudata(lua_State *L, const char *classname, int objidx) { diff --git a/Libraries/luasocket/sdk/src/buffer.c b/Libraries/luasocket/sdk/src/buffer.c index 73f4ffa..a2e0f68 100644 --- a/Libraries/luasocket/sdk/src/buffer.c +++ b/Libraries/luasocket/sdk/src/buffer.c @@ -39,7 +39,7 @@ int buffer_open(lua_State *L) { } /*-------------------------------------------------------------------------*\ -* Initializes C structure +* Initializes C structure \*-------------------------------------------------------------------------*/ void buffer_init(p_buffer buf, p_io io, p_timeout tm) { buf->first = buf->last = 0; @@ -63,8 +63,8 @@ int buffer_meth_getstats(lua_State *L, p_buffer buf) { * object:setstats() interface \*-------------------------------------------------------------------------*/ int buffer_meth_setstats(lua_State *L, p_buffer buf) { - buf->received = (long) luaL_optnumber(L, 2, buf->received); - buf->sent = (long) luaL_optnumber(L, 3, buf->sent); + buf->received = (long) luaL_optnumber(L, 2, buf->received); + buf->sent = (long) luaL_optnumber(L, 3, buf->sent); if (lua_isnumber(L, 4)) buf->birthday = timeout_gettime() - lua_tonumber(L, 4); lua_pushnumber(L, 1); return 1; @@ -89,7 +89,7 @@ int buffer_meth_send(lua_State *L, p_buffer buf) { /* check if there was an error */ if (err != IO_DONE) { lua_pushnil(L); - lua_pushstring(L, buf->io->error(buf->io->ctx, err)); + lua_pushstring(L, buf->io->error(buf->io->ctx, err)); lua_pushnumber(L, sent+start-1); } else { lua_pushnumber(L, sent+start-1); @@ -112,7 +112,7 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) { size_t size; const char *part = luaL_optlstring(L, 3, "", &size); p_timeout tm = timeout_markstart(buf->tm); - /* initialize buffer with optional extra prefix + /* initialize buffer with optional extra prefix * (useful for concatenating previous partial results) */ luaL_buffinit(L, &b); luaL_addlstring(&b, part, size); @@ -120,9 +120,9 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) { if (!lua_isnumber(L, 2)) { const char *p= luaL_optstring(L, 2, "*l"); if (p[0] == '*' && p[1] == 'l') err = recvline(buf, &b); - else if (p[0] == '*' && p[1] == 'a') err = recvall(buf, &b); + else if (p[0] == '*' && p[1] == 'a') err = recvall(buf, &b); else luaL_argcheck(L, 0, 2, "invalid receive pattern"); - /* get a fixed number of bytes (minus what was already partially + /* get a fixed number of bytes (minus what was already partially * received) */ } else err = recvraw(buf, (size_t) lua_tonumber(L, 2)-size, &b); /* check if there was an error */ @@ -130,8 +130,8 @@ int buffer_meth_receive(lua_State *L, p_buffer buf) { /* we can't push anyting in the stack before pushing the * contents of the buffer. this is the reason for the complication */ luaL_pushresult(&b); - lua_pushstring(L, buf->io->error(buf->io->ctx, err)); - lua_pushvalue(L, -2); + lua_pushstring(L, buf->io->error(buf->io->ctx, err)); + lua_pushvalue(L, -2); lua_pushnil(L); lua_replace(L, -4); } else { @@ -214,7 +214,7 @@ static int recvall(p_buffer buf, luaL_Buffer *b) { } /*-------------------------------------------------------------------------*\ -* Reads a line terminated by a CR LF pair or just by a LF. The CR and LF +* Reads a line terminated by a CR LF pair or just by a LF. The CR and LF * are not returned by the function and are discarded from the buffer \*-------------------------------------------------------------------------*/ static int recvline(p_buffer buf, luaL_Buffer *b) { @@ -244,7 +244,7 @@ static int recvline(p_buffer buf, luaL_Buffer *b) { static void buffer_skip(p_buffer buf, size_t count) { buf->received += count; buf->first += count; - if (buffer_isempty(buf)) + if (buffer_isempty(buf)) buf->first = buf->last = 0; } diff --git a/Libraries/luasocket/sdk/src/except.c b/Libraries/luasocket/sdk/src/except.c index 5faa5be..98aecc9 100644 --- a/Libraries/luasocket/sdk/src/except.c +++ b/Libraries/luasocket/sdk/src/except.c @@ -50,9 +50,9 @@ static int finalize(lua_State *L) { } else return lua_gettop(L); } -static int do_nothing(lua_State *L) { +static int do_nothing(lua_State *L) { (void) L; - return 0; + return 0; } static int global_newtry(lua_State *L) { diff --git a/Libraries/luasocket/sdk/src/inet.c b/Libraries/luasocket/sdk/src/inet.c index f2cddee..8e45a70 100644 --- a/Libraries/luasocket/sdk/src/inet.c +++ b/Libraries/luasocket/sdk/src/inet.c @@ -54,7 +54,7 @@ static int inet_gethost(const char *address, struct hostent **hp) { struct in_addr addr; if (inet_aton(address, &addr)) return socket_gethostbyaddr((char *) &addr, sizeof(addr), hp); - else + else return socket_gethostbyname(address, hp); } @@ -64,7 +64,7 @@ static int inet_gethost(const char *address, struct hostent **hp) { \*-------------------------------------------------------------------------*/ static int inet_global_tohostname(lua_State *L) { const char *address = luaL_checkstring(L, 1); - struct hostent *hp = NULL; + struct hostent *hp = NULL; int err = inet_gethost(address, &hp); if (err != IO_DONE) { lua_pushnil(L); @@ -83,7 +83,7 @@ static int inet_global_tohostname(lua_State *L) { static int inet_global_toip(lua_State *L) { const char *address = luaL_checkstring(L, 1); - struct hostent *hp = NULL; + struct hostent *hp = NULL; int err = inet_gethost(address, &hp); if (err != IO_DONE) { lua_pushnil(L); @@ -205,7 +205,7 @@ const char *inet_trycreate(p_socket ps, int type) { /*-------------------------------------------------------------------------*\ * Tries to connect to remote address (address, port) \*-------------------------------------------------------------------------*/ -const char *inet_tryconnect(p_socket ps, const char *address, +const char *inet_tryconnect(p_socket ps, const char *address, unsigned short port, p_timeout tm) { struct sockaddr_in remote; @@ -249,7 +249,7 @@ const char *inet_trybind(p_socket ps, const char *address, unsigned short port) } err = socket_bind(ps, (SA *) &local, sizeof(local)); if (err != IO_DONE) socket_destroy(ps); - return socket_strerror(err); + return socket_strerror(err); } /*-------------------------------------------------------------------------*\ diff --git a/Libraries/luasocket/sdk/src/io.c b/Libraries/luasocket/sdk/src/io.c index 06dc50e..52dc211 100644 --- a/Libraries/luasocket/sdk/src/io.c +++ b/Libraries/luasocket/sdk/src/io.c @@ -27,6 +27,6 @@ const char *io_strerror(int err) { case IO_DONE: return NULL; case IO_CLOSED: return "closed"; case IO_TIMEOUT: return "timeout"; - default: return "unknown error"; + default: return "unknown error"; } } diff --git a/Libraries/luasocket/sdk/src/mime.c b/Libraries/luasocket/sdk/src/mime.c index 700fa05..c5b6e42 100644 --- a/Libraries/luasocket/sdk/src/mime.c +++ b/Libraries/luasocket/sdk/src/mime.c @@ -43,7 +43,7 @@ static size_t b64decode(UC c, UC *input, size_t size, luaL_Buffer *buffer); static void qpsetup(UC *qpclass, UC *qpunbase); static void qpquote(UC c, luaL_Buffer *buffer); static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer); -static size_t qpencode(UC c, UC *input, size_t size, +static size_t qpencode(UC c, UC *input, size_t size, const char *marker, luaL_Buffer *buffer); static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer); @@ -100,9 +100,9 @@ MIME_API int luaopen_mime_core(lua_State *L) /*-------------------------------------------------------------------------*\ * Incrementaly breaks a string into lines. The string can have CRLF breaks. * A, n = wrp(l, B, length) -* A is a copy of B, broken into lines of at most 'length' bytes. -* 'l' is how many bytes are left for the first line of B. -* 'n' is the number of bytes left in the last line of A. +* A is a copy of B, broken into lines of at most 'length' bytes. +* 'l' is how many bytes are left for the first line of B. +* 'n' is the number of bytes left in the last line of A. \*-------------------------------------------------------------------------*/ static int mime_global_wrp(lua_State *L) { @@ -120,7 +120,7 @@ static int mime_global_wrp(lua_State *L) else lua_pushnil(L); lua_pushnumber(L, length); return 2; - } + } luaL_buffinit(L, &buffer); while (input < last) { switch (*input) { @@ -147,9 +147,9 @@ static int mime_global_wrp(lua_State *L) } /*-------------------------------------------------------------------------*\ -* Fill base64 decode map. +* Fill base64 decode map. \*-------------------------------------------------------------------------*/ -static void b64setup(UC *b64unbase) +static void b64setup(UC *b64unbase) { int i; for (i = 0; i <= 255; i++) b64unbase[i] = (UC) 255; @@ -158,11 +158,11 @@ static void b64setup(UC *b64unbase) } /*-------------------------------------------------------------------------*\ -* Acumulates bytes in input buffer until 3 bytes are available. +* Acumulates bytes in input buffer until 3 bytes are available. * Translate the 3 bytes into Base64 form and append to buffer. * Returns new number of bytes in buffer. \*-------------------------------------------------------------------------*/ -static size_t b64encode(UC c, UC *input, size_t size, +static size_t b64encode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { input[size++] = c; @@ -171,7 +171,7 @@ static size_t b64encode(UC c, UC *input, size_t size, unsigned long value = 0; value += input[0]; value <<= 8; value += input[1]; value <<= 8; - value += input[2]; + value += input[2]; code[3] = b64base[value & 0x3f]; value >>= 6; code[2] = b64base[value & 0x3f]; value >>= 6; code[1] = b64base[value & 0x3f]; value >>= 6; @@ -183,11 +183,11 @@ static size_t b64encode(UC c, UC *input, size_t size, } /*-------------------------------------------------------------------------*\ -* Encodes the Base64 last 1 or 2 bytes and adds padding '=' +* Encodes the Base64 last 1 or 2 bytes and adds padding '=' * Result, if any, is appended to buffer. * Returns 0. \*-------------------------------------------------------------------------*/ -static size_t b64pad(const UC *input, size_t size, +static size_t b64pad(const UC *input, size_t size, luaL_Buffer *buffer) { unsigned long value = 0; @@ -200,7 +200,7 @@ static size_t b64pad(const UC *input, size_t size, luaL_addlstring(buffer, (char *) code, 4); break; case 2: - value = input[0]; value <<= 8; + value = input[0]; value <<= 8; value |= input[1]; value <<= 2; code[2] = b64base[value & 0x3f]; value >>= 6; code[1] = b64base[value & 0x3f]; value >>= 6; @@ -214,11 +214,11 @@ static size_t b64pad(const UC *input, size_t size, } /*-------------------------------------------------------------------------*\ -* Acumulates bytes in input buffer until 4 bytes are available. +* Acumulates bytes in input buffer until 4 bytes are available. * Translate the 4 bytes from Base64 form and append to buffer. * Returns new number of bytes in buffer. \*-------------------------------------------------------------------------*/ -static size_t b64decode(UC c, UC *input, size_t size, +static size_t b64decode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { /* ignore invalid characters */ @@ -236,7 +236,7 @@ static size_t b64decode(UC c, UC *input, size_t size, decoded[1] = (UC) (value & 0xff); value >>= 8; decoded[0] = (UC) value; /* take care of paddding */ - valid = (input[2] == '=') ? 1 : (input[3] == '=') ? 2 : 3; + valid = (input[2] == '=') ? 1 : (input[3] == '=') ? 2 : 3; luaL_addlstring(buffer, (char *) decoded, valid); return 0; /* need more data */ @@ -248,7 +248,7 @@ static size_t b64decode(UC c, UC *input, size_t size, * A, B = b64(C, D) * A is the encoded version of the largest prefix of C .. D that is * divisible by 3. B has the remaining bytes of C .. D, *without* encoding. -* The easiest thing would be to concatenate the two strings and +* The easiest thing would be to concatenate the two strings and * encode the result, but we can't afford that or Lua would dupplicate * every chunk we received. \*-------------------------------------------------------------------------*/ @@ -267,7 +267,7 @@ static int mime_global_b64(lua_State *L) } /* process first part of the input */ luaL_buffinit(L, &buffer); - while (input < last) + while (input < last) asize = b64encode(*input++, atom, asize, &buffer); input = (UC *) luaL_optlstring(L, 2, NULL, &isize); /* if second part is nil, we are done */ @@ -280,7 +280,7 @@ static int mime_global_b64(lua_State *L) } /* otherwise process the second part */ last = input + isize; - while (input < last) + while (input < last) asize = b64encode(*input++, atom, asize, &buffer); luaL_pushresult(&buffer); lua_pushlstring(L, (char *) atom, asize); @@ -308,7 +308,7 @@ static int mime_global_unb64(lua_State *L) } /* process first part of the input */ luaL_buffinit(L, &buffer); - while (input < last) + while (input < last) asize = b64decode(*input++, atom, asize, &buffer); input = (UC *) luaL_optlstring(L, 2, NULL, &isize); /* if second is nil, we are done */ @@ -320,7 +320,7 @@ static int mime_global_unb64(lua_State *L) } /* otherwise, process the rest of the input */ last = input + isize; - while (input < last) + while (input < last) asize = b64decode(*input++, atom, asize, &buffer); luaL_pushresult(&buffer); lua_pushlstring(L, (char *) atom, asize); @@ -336,7 +336,7 @@ static int mime_global_unb64(lua_State *L) * 9 and 32 can be plain, unless in the end of a line, where must be =XX * encoded lines must be no longer than 76 not counting CRLF * soft line-break are =CRLF -* To encode one byte, we need to see the next two. +* To encode one byte, we need to see the next two. * Worst case is when we see a space, and wonder if a CRLF is comming \*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*\ @@ -349,7 +349,7 @@ static void qpsetup(UC *qpclass, UC *qpunbase) for (i = 0; i < 256; i++) qpclass[i] = QP_QUOTED; for (i = 33; i <= 60; i++) qpclass[i] = QP_PLAIN; for (i = 62; i <= 126; i++) qpclass[i] = QP_PLAIN; - qpclass['\t'] = QP_IF_LAST; + qpclass['\t'] = QP_IF_LAST; qpclass[' '] = QP_IF_LAST; qpclass['\r'] = QP_CR; for (i = 0; i < 256; i++) qpunbase[i] = 255; @@ -375,9 +375,9 @@ static void qpquote(UC c, luaL_Buffer *buffer) /*-------------------------------------------------------------------------*\ * Accumulate characters until we are sure about how to deal with them. -* Once we are sure, output to the buffer, in the correct form. +* Once we are sure, output to the buffer, in the correct form. \*-------------------------------------------------------------------------*/ -static size_t qpencode(UC c, UC *input, size_t size, +static size_t qpencode(UC c, UC *input, size_t size, const char *marker, luaL_Buffer *buffer) { input[size++] = c; @@ -418,7 +418,7 @@ static size_t qpencode(UC c, UC *input, size_t size, } /*-------------------------------------------------------------------------*\ -* Deal with the final characters +* Deal with the final characters \*-------------------------------------------------------------------------*/ static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer) { @@ -435,8 +435,8 @@ static size_t qppad(UC *input, size_t size, luaL_Buffer *buffer) * Incrementally converts a string to quoted-printable * A, B = qp(C, D, marker) * Marker is the text to be used to replace CRLF sequences found in A. -* A is the encoded version of the largest prefix of C .. D that -* can be encoded without doubts. +* A is the encoded version of the largest prefix of C .. D that +* can be encoded without doubts. * B has the remaining bytes of C .. D, *without* encoding. \*-------------------------------------------------------------------------*/ static int mime_global_qp(lua_State *L) @@ -478,7 +478,7 @@ static int mime_global_qp(lua_State *L) /*-------------------------------------------------------------------------*\ * Accumulate characters until we are sure about how to deal with them. -* Once we are sure, output the to the buffer, in the correct form. +* Once we are sure, output the to the buffer, in the correct form. \*-------------------------------------------------------------------------*/ static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { int d; @@ -486,8 +486,8 @@ static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { /* deal with all characters we can deal */ switch (input[0]) { /* if we have an escape character */ - case '=': - if (size < 3) return size; + case '=': + if (size < 3) return size; /* eliminate soft line break */ if (input[1] == '\r' && input[2] == '\n') return 0; /* decode quoted representation */ @@ -497,7 +497,7 @@ static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { else luaL_putchar(buffer, (c << 4) + d); return 0; case '\r': - if (size < 2) return size; + if (size < 2) return size; if (input[1] == '\n') luaL_addlstring(buffer, (char *)input, 2); return 0; default: @@ -510,8 +510,8 @@ static size_t qpdecode(UC c, UC *input, size_t size, luaL_Buffer *buffer) { /*-------------------------------------------------------------------------*\ * Incrementally decodes a string in quoted-printable * A, B = qp(C, D) -* A is the decoded version of the largest prefix of C .. D that -* can be decoded without doubts. +* A is the decoded version of the largest prefix of C .. D that +* can be decoded without doubts. * B has the remaining bytes of C .. D, *without* decoding. \*-------------------------------------------------------------------------*/ static int mime_global_unqp(lua_State *L) @@ -538,7 +538,7 @@ static int mime_global_unqp(lua_State *L) if (!(*lua_tostring(L, -1))) lua_pushnil(L); lua_pushnil(L); return 2; - } + } /* otherwise process rest of input */ last = input + isize; while (input < last) @@ -551,9 +551,9 @@ static int mime_global_unqp(lua_State *L) /*-------------------------------------------------------------------------*\ * Incrementally breaks a quoted-printed string into lines * A, n = qpwrp(l, B, length) -* A is a copy of B, broken into lines of at most 'length' bytes. -* 'l' is how many bytes are left for the first line of B. -* 'n' is the number of bytes left in the last line of A. +* A is a copy of B, broken into lines of at most 'length' bytes. +* 'l' is how many bytes are left for the first line of B. +* 'n' is the number of bytes left in the last line of A. * There are two complications: lines can't be broken in the middle * of an encoded =XX, and there might be line breaks already \*-------------------------------------------------------------------------*/ @@ -586,11 +586,11 @@ static int mime_global_qpwrp(lua_State *L) if (left <= 3) { left = length; luaL_addstring(&buffer, EQCRLF); - } + } luaL_putchar(&buffer, *input); left--; break; - default: + default: if (left <= 1) { left = length; luaL_addstring(&buffer, EQCRLF); @@ -618,7 +618,7 @@ static int mime_global_qpwrp(lua_State *L) * last is the previous character \*-------------------------------------------------------------------------*/ #define eolcandidate(c) (c == '\r' || c == '\n') -static int eolprocess(int c, int last, const char *marker, +static int eolprocess(int c, int last, const char *marker, luaL_Buffer *buffer) { if (eolcandidate(c)) { @@ -636,10 +636,10 @@ static int eolprocess(int c, int last, const char *marker, } /*-------------------------------------------------------------------------*\ -* Converts a string to uniform EOL convention. +* Converts a string to uniform EOL convention. * A, n = eol(o, B, marker) * A is the converted version of the largest prefix of B that can be -* converted unambiguously. 'o' is the context returned by the previous +* converted unambiguously. 'o' is the context returned by the previous * call. 'n' is the new context. \*-------------------------------------------------------------------------*/ static int mime_global_eol(lua_State *L) @@ -666,18 +666,18 @@ static int mime_global_eol(lua_State *L) } /*-------------------------------------------------------------------------*\ -* Takes one byte and stuff it if needed. +* Takes one byte and stuff it if needed. \*-------------------------------------------------------------------------*/ static size_t dot(int c, size_t state, luaL_Buffer *buffer) { luaL_putchar(buffer, c); switch (c) { - case '\r': + case '\r': return 1; - case '\n': - return (state == 1)? 2: 0; - case '.': - if (state == 2) + case '\n': + return (state == 1)? 2: 0; + case '.': + if (state == 2) luaL_putchar(buffer, '.'); default: return 0; @@ -702,7 +702,7 @@ static int mime_global_dot(lua_State *L) } /* process all input */ luaL_buffinit(L, &buffer); - while (input < last) + while (input < last) state = dot(*input++, state, &buffer); luaL_pushresult(&buffer); lua_pushnumber(L, state); diff --git a/Libraries/luasocket/sdk/src/options.c b/Libraries/luasocket/sdk/src/options.c index 5da3c51..c481e31 100644 --- a/Libraries/luasocket/sdk/src/options.c +++ b/Libraries/luasocket/sdk/src/options.c @@ -1,10 +1,10 @@ /*=========================================================================*\ -* Common option interface +* Common option interface * LuaSocket toolkit * * RCS ID: $Id: options.c,v 1.6 2005/11/20 07:20:23 diego Exp $ \*=========================================================================*/ -#include +#include #include "lauxlib.h" @@ -18,7 +18,7 @@ \*=========================================================================*/ static int opt_setmembership(lua_State *L, p_socket ps, int level, int name); static int opt_setboolean(lua_State *L, p_socket ps, int level, int name); -static int opt_set(lua_State *L, p_socket ps, int level, int name, +static int opt_set(lua_State *L, p_socket ps, int level, int name, void *val, int len); /*=========================================================================*\ @@ -43,18 +43,18 @@ int opt_meth_setoption(lua_State *L, p_opt opt, p_socket ps) /* enables reuse of local address */ int opt_reuseaddr(lua_State *L, p_socket ps) { - return opt_setboolean(L, ps, SOL_SOCKET, SO_REUSEADDR); + return opt_setboolean(L, ps, SOL_SOCKET, SO_REUSEADDR); } /* disables the Naggle algorithm */ int opt_tcp_nodelay(lua_State *L, p_socket ps) { - return opt_setboolean(L, ps, IPPROTO_TCP, TCP_NODELAY); + return opt_setboolean(L, ps, IPPROTO_TCP, TCP_NODELAY); } int opt_keepalive(lua_State *L, p_socket ps) { - return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE); + return opt_setboolean(L, ps, SOL_SOCKET, SO_KEEPALIVE); } int opt_dontroute(lua_State *L, p_socket ps) @@ -78,12 +78,12 @@ int opt_linger(lua_State *L, p_socket ps) if (!lua_istable(L, 3)) luaL_typerror(L, 3, lua_typename(L, LUA_TTABLE)); lua_pushstring(L, "on"); lua_gettable(L, 3); - if (!lua_isboolean(L, -1)) + if (!lua_isboolean(L, -1)) luaL_argerror(L, 3, "boolean 'on' field expected"); li.l_onoff = (u_short) lua_toboolean(L, -1); lua_pushstring(L, "timeout"); lua_gettable(L, 3); - if (!lua_isnumber(L, -1)) + if (!lua_isnumber(L, -1)) luaL_argerror(L, 3, "number 'timeout' field expected"); li.l_linger = (u_short) lua_tonumber(L, -1); return opt_set(L, ps, SOL_SOCKET, SO_LINGER, (char *) &li, sizeof(li)); @@ -114,22 +114,22 @@ static int opt_setmembership(lua_State *L, p_socket ps, int level, int name) if (!lua_istable(L, 3)) luaL_typerror(L, 3, lua_typename(L, LUA_TTABLE)); lua_pushstring(L, "multiaddr"); lua_gettable(L, 3); - if (!lua_isstring(L, -1)) + if (!lua_isstring(L, -1)) luaL_argerror(L, 3, "string 'multiaddr' field expected"); - if (!inet_aton(lua_tostring(L, -1), &val.imr_multiaddr)) + if (!inet_aton(lua_tostring(L, -1), &val.imr_multiaddr)) luaL_argerror(L, 3, "invalid 'multiaddr' ip address"); lua_pushstring(L, "interface"); lua_gettable(L, 3); - if (!lua_isstring(L, -1)) + if (!lua_isstring(L, -1)) luaL_argerror(L, 3, "string 'interface' field expected"); val.imr_interface.s_addr = htonl(INADDR_ANY); if (strcmp(lua_tostring(L, -1), "*") && - !inet_aton(lua_tostring(L, -1), &val.imr_interface)) + !inet_aton(lua_tostring(L, -1), &val.imr_interface)) luaL_argerror(L, 3, "invalid 'interface' ip address"); return opt_set(L, ps, level, name, (char *) &val, sizeof(val)); } -static +static int opt_set(lua_State *L, p_socket ps, int level, int name, void *val, int len) { if (setsockopt(*ps, level, name, (char *) val, len) < 0) { diff --git a/Libraries/luasocket/sdk/src/select.c b/Libraries/luasocket/sdk/src/select.c index d70f662..adec13e 100644 --- a/Libraries/luasocket/sdk/src/select.c +++ b/Libraries/luasocket/sdk/src/select.c @@ -18,10 +18,10 @@ \*=========================================================================*/ static t_socket getfd(lua_State *L); static int dirty(lua_State *L); -static t_socket collect_fd(lua_State *L, int tab, t_socket max_fd, +static t_socket collect_fd(lua_State *L, int tab, t_socket max_fd, int itab, fd_set *set); static int check_dirty(lua_State *L, int tab, int dtab, fd_set *set); -static void return_fd(lua_State *L, fd_set *set, t_socket max_fd, +static void return_fd(lua_State *L, fd_set *set, t_socket max_fd, int itab, int tab, int start); static void make_assoc(lua_State *L, int tab); static int global_select(lua_State *L); @@ -92,9 +92,9 @@ static t_socket getfd(lua_State *L) { if (!lua_isnil(L, -1)) { lua_pushvalue(L, -2); lua_call(L, 1, 1); - if (lua_isnumber(L, -1)) - fd = (t_socket) lua_tonumber(L, -1); - } + if (lua_isnumber(L, -1)) + fd = (t_socket) lua_tonumber(L, -1); + } lua_pop(L, 1); return fd; } @@ -107,15 +107,15 @@ static int dirty(lua_State *L) { lua_pushvalue(L, -2); lua_call(L, 1, 1); is = lua_toboolean(L, -1); - } + } lua_pop(L, 1); return is; } -static t_socket collect_fd(lua_State *L, int tab, t_socket max_fd, +static t_socket collect_fd(lua_State *L, int tab, t_socket max_fd, int itab, fd_set *set) { int i = 1; - if (lua_isnil(L, tab)) + if (lua_isnil(L, tab)) return max_fd; while (1) { t_socket fd; @@ -128,7 +128,7 @@ static t_socket collect_fd(lua_State *L, int tab, t_socket max_fd, fd = getfd(L); if (fd != SOCKET_INVALID) { FD_SET(fd, set); - if (max_fd == SOCKET_INVALID || max_fd < fd) + if (max_fd == SOCKET_INVALID || max_fd < fd) max_fd = fd; lua_pushnumber(L, fd); lua_pushvalue(L, -2); @@ -142,9 +142,9 @@ static t_socket collect_fd(lua_State *L, int tab, t_socket max_fd, static int check_dirty(lua_State *L, int tab, int dtab, fd_set *set) { int ndirty = 0, i = 1; - if (lua_isnil(L, tab)) + if (lua_isnil(L, tab)) return 0; - while (1) { + while (1) { t_socket fd; lua_pushnumber(L, i); lua_gettable(L, tab); @@ -165,7 +165,7 @@ static int check_dirty(lua_State *L, int tab, int dtab, fd_set *set) { return ndirty; } -static void return_fd(lua_State *L, fd_set *set, t_socket max_fd, +static void return_fd(lua_State *L, fd_set *set, t_socket max_fd, int itab, int tab, int start) { t_socket fd; for (fd = 0; fd < max_fd; fd++) { diff --git a/Libraries/luasocket/sdk/src/tcp.c b/Libraries/luasocket/sdk/src/tcp.c index 6b8a79b..715c430 100644 --- a/Libraries/luasocket/sdk/src/tcp.c +++ b/Libraries/luasocket/sdk/src/tcp.c @@ -1,10 +1,10 @@ /*=========================================================================*\ -* TCP object +* TCP object * LuaSocket toolkit * * RCS ID: $Id: tcp.c,v 1.41 2005/10/07 04:40:59 diego Exp $ \*=========================================================================*/ -#include +#include #include "lua.h" #include "lauxlib.h" @@ -92,7 +92,7 @@ int tcp_open(lua_State *L) auxiliar_add2group(L, "tcp{client}", "tcp{any}"); auxiliar_add2group(L, "tcp{server}", "tcp{any}"); /* define library functions */ - luaL_openlib(L, NULL, func, 0); + luaL_openlib(L, NULL, func, 0); return 0; } @@ -145,7 +145,7 @@ static int meth_getfd(lua_State *L) static int meth_setfd(lua_State *L) { p_tcp tcp = (p_tcp) auxiliar_checkgroup(L, "tcp{any}", 1); - tcp->sock = (t_socket) luaL_checknumber(L, 2); + tcp->sock = (t_socket) luaL_checknumber(L, 2); return 0; } @@ -157,8 +157,8 @@ static int meth_dirty(lua_State *L) } /*-------------------------------------------------------------------------*\ -* Waits for and returns a client object attempting connection to the -* server object +* Waits for and returns a client object attempting connection to the +* server object \*-------------------------------------------------------------------------*/ static int meth_accept(lua_State *L) { @@ -173,20 +173,20 @@ static int meth_accept(lua_State *L) /* initialize structure fields */ socket_setnonblocking(&sock); clnt->sock = sock; - io_init(&clnt->io, (p_send) socket_send, (p_recv) socket_recv, + io_init(&clnt->io, (p_send) socket_send, (p_recv) socket_recv, (p_error) socket_ioerror, &clnt->sock); timeout_init(&clnt->tm, -1, -1); buffer_init(&clnt->buf, &clnt->io, &clnt->tm); return 1; } else { - lua_pushnil(L); + lua_pushnil(L); lua_pushstring(L, socket_strerror(err)); return 2; } } /*-------------------------------------------------------------------------*\ -* Binds an object to an address +* Binds an object to an address \*-------------------------------------------------------------------------*/ static int meth_bind(lua_State *L) { @@ -226,7 +226,7 @@ static int meth_connect(lua_State *L) } /*-------------------------------------------------------------------------*\ -* Closes socket used by object +* Closes socket used by object \*-------------------------------------------------------------------------*/ static int meth_close(lua_State *L) { @@ -311,14 +311,14 @@ static int meth_settimeout(lua_State *L) * Library functions \*=========================================================================*/ /*-------------------------------------------------------------------------*\ -* Creates a master tcp object +* Creates a master tcp object \*-------------------------------------------------------------------------*/ static int global_create(lua_State *L) { t_socket sock; const char *err = inet_trycreate(&sock, SOCK_STREAM); /* try to allocate a system socket */ - if (!err) { + if (!err) { /* allocate tcp object */ p_tcp tcp = (p_tcp) lua_newuserdata(L, sizeof(t_tcp)); /* set its type as master object */ @@ -326,7 +326,7 @@ static int global_create(lua_State *L) /* initialize remaining structure fields */ socket_setnonblocking(&sock); tcp->sock = sock; - io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv, + io_init(&tcp->io, (p_send) socket_send, (p_recv) socket_recv, (p_error) socket_ioerror, &tcp->sock); timeout_init(&tcp->tm, -1, -1); buffer_init(&tcp->buf, &tcp->io, &tcp->tm); diff --git a/Libraries/luasocket/sdk/src/timeout.c b/Libraries/luasocket/sdk/src/timeout.c index c1df102..211d8aa 100644 --- a/Libraries/luasocket/sdk/src/timeout.c +++ b/Libraries/luasocket/sdk/src/timeout.c @@ -52,7 +52,7 @@ void timeout_init(p_timeout tm, double block, double total) { /*-------------------------------------------------------------------------*\ * Determines how much time we have left for the next system call, -* if the previous call was successful +* if the previous call was successful * Input * tm: timeout control structure * Returns @@ -107,7 +107,7 @@ double timeout_getretry(p_timeout tm) { } /*-------------------------------------------------------------------------*\ -* Marks the operation start time in structure +* Marks the operation start time in structure * Input * tm: timeout control structure \*-------------------------------------------------------------------------*/ @@ -117,7 +117,7 @@ p_timeout timeout_markstart(p_timeout tm) { } /*-------------------------------------------------------------------------*\ -* Gets time in s, relative to January 1, 1970 (UTC) +* Gets time in s, relative to January 1, 1970 (UTC) * Returns * time in s. \*-------------------------------------------------------------------------*/ @@ -159,7 +159,7 @@ int timeout_meth_settimeout(lua_State *L, p_timeout tm) { const char *mode = luaL_optstring(L, 3, "b"); switch (*mode) { case 'b': - tm->block = t; + tm->block = t; break; case 'r': case 't': tm->total = t; diff --git a/Libraries/luasocket/sdk/src/udp.c b/Libraries/luasocket/sdk/src/udp.c index fc25aa0..f39e725 100644 --- a/Libraries/luasocket/sdk/src/udp.c +++ b/Libraries/luasocket/sdk/src/udp.c @@ -1,10 +1,10 @@ /*=========================================================================*\ -* UDP object +* UDP object * LuaSocket toolkit * * RCS ID: $Id: udp.c,v 1.29 2005/10/07 04:40:59 diego Exp $ \*=========================================================================*/ -#include +#include #include "lua.h" #include "lauxlib.h" @@ -18,10 +18,10 @@ /* min and max macros */ #ifndef MIN #define MIN(x, y) ((x) < (y) ? x : y) -#endif +#endif #ifndef MAX #define MAX(x, y) ((x) > (y) ? x : y) -#endif +#endif /*=========================================================================*\ * Internal function prototypes @@ -95,7 +95,7 @@ int udp_open(lua_State *L) auxiliar_add2group(L, "udp{connected}", "select{able}"); auxiliar_add2group(L, "udp{unconnected}", "select{able}"); /* define library functions */ - luaL_openlib(L, NULL, func, 0); + luaL_openlib(L, NULL, func, 0); return 0; } @@ -142,12 +142,12 @@ static int meth_sendto(lua_State *L) { struct sockaddr_in addr; int err; memset(&addr, 0, sizeof(addr)); - if (!inet_aton(ip, &addr.sin_addr)) + if (!inet_aton(ip, &addr.sin_addr)) luaL_argerror(L, 3, "invalid ip address"); addr.sin_family = AF_INET; addr.sin_port = htons(port); timeout_markstart(tm); - err = socket_sendto(&udp->sock, data, count, &sent, + err = socket_sendto(&udp->sock, data, count, &sent, (SA *) &addr, sizeof(addr), tm); if (err != IO_DONE) { lua_pushnil(L); @@ -192,7 +192,7 @@ static int meth_receivefrom(lua_State *L) { p_timeout tm = &udp->tm; timeout_markstart(tm); count = MIN(count, sizeof(buffer)); - err = socket_recvfrom(&udp->sock, buffer, count, &got, + err = socket_recvfrom(&udp->sock, buffer, count, &got, (SA *) &addr, &addr_len, tm); if (err == IO_DONE) { lua_pushlstring(L, buffer, got); @@ -266,8 +266,8 @@ static int meth_setpeername(lua_State *L) { p_timeout tm = &udp->tm; const char *address = luaL_checkstring(L, 2); int connecting = strcmp(address, "*"); - unsigned short port = connecting ? - (unsigned short) luaL_checknumber(L, 3) : + unsigned short port = connecting ? + (unsigned short) luaL_checknumber(L, 3) : (unsigned short) luaL_optnumber(L, 3, 0); const char *err = inet_tryconnect(&udp->sock, address, port, tm); if (err) { @@ -283,7 +283,7 @@ static int meth_setpeername(lua_State *L) { } /*-------------------------------------------------------------------------*\ -* Closes socket used by object +* Closes socket used by object \*-------------------------------------------------------------------------*/ static int meth_close(lua_State *L) { p_udp udp = (p_udp) auxiliar_checkgroup(L, "udp{any}", 1); @@ -313,13 +313,13 @@ static int meth_setsockname(lua_State *L) { * Library functions \*=========================================================================*/ /*-------------------------------------------------------------------------*\ -* Creates a master udp object +* Creates a master udp object \*-------------------------------------------------------------------------*/ static int global_create(lua_State *L) { t_socket sock; const char *err = inet_trycreate(&sock, SOCK_DGRAM); /* try to allocate a system socket */ - if (!err) { + if (!err) { /* allocate tcp object */ p_udp udp = (p_udp) lua_newuserdata(L, sizeof(t_udp)); auxiliar_setclass(L, "udp{unconnected}", -1); diff --git a/Libraries/luasocket/sdk/src/unix/unix.c b/Libraries/luasocket/sdk/src/unix/unix.c index 158d319..b6703bc 100644 --- a/Libraries/luasocket/sdk/src/unix/unix.c +++ b/Libraries/luasocket/sdk/src/unix/unix.c @@ -1,10 +1,10 @@ /*=========================================================================*\ -* Unix domain socket +* Unix domain socket * LuaSocket toolkit * * RCS ID: $Id: unix.c,v 1.13 2006/03/13 07:16:39 diego Exp $ \*=========================================================================*/ -#include +#include #include "lua.h" #include "lauxlib.h" @@ -13,7 +13,7 @@ #include "socket.h" #include "options.h" #include "unix.h" -#include +#include /*=========================================================================*\ * Internal function prototypes @@ -143,7 +143,7 @@ static int meth_getfd(lua_State *L) { /* this is very dangerous, but can be handy for those that are brave enough */ static int meth_setfd(lua_State *L) { p_unix un = (p_unix) auxiliar_checkgroup(L, "unix{any}", 1); - un->sock = (t_socket) luaL_checknumber(L, 2); + un->sock = (t_socket) luaL_checknumber(L, 2); return 0; } @@ -154,8 +154,8 @@ static int meth_dirty(lua_State *L) { } /*-------------------------------------------------------------------------*\ -* Waits for and returns a client object attempting connection to the -* server object +* Waits for and returns a client object attempting connection to the +* server object \*-------------------------------------------------------------------------*/ static int meth_accept(lua_State *L) { p_unix server = (p_unix) auxiliar_checkclass(L, "unix{server}", 1); @@ -169,20 +169,20 @@ static int meth_accept(lua_State *L) { /* initialize structure fields */ socket_setnonblocking(&sock); clnt->sock = sock; - io_init(&clnt->io, (p_send)socket_send, (p_recv)socket_recv, + io_init(&clnt->io, (p_send)socket_send, (p_recv)socket_recv, (p_error) socket_ioerror, &clnt->sock); timeout_init(&clnt->tm, -1, -1); buffer_init(&clnt->buf, &clnt->io, &clnt->tm); return 1; } else { - lua_pushnil(L); + lua_pushnil(L); lua_pushstring(L, socket_strerror(err)); return 2; } } /*-------------------------------------------------------------------------*\ -* Binds an object to an address +* Binds an object to an address \*-------------------------------------------------------------------------*/ static const char *unix_trybind(p_unix un, const char *path) { struct sockaddr_un local; @@ -193,16 +193,16 @@ static const char *unix_trybind(p_unix un, const char *path) { strcpy(local.sun_path, path); local.sun_family = AF_UNIX; #ifdef UNIX_HAS_SUN_LEN - local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len) + local.sun_len = sizeof(local.sun_family) + sizeof(local.sun_len) + len + 1; err = socket_bind(&un->sock, (SA *) &local, local.sun_len); -#else - err = socket_bind(&un->sock, (SA *) &local, +#else + err = socket_bind(&un->sock, (SA *) &local, sizeof(local.sun_family) + len); #endif if (err != IO_DONE) socket_destroy(&un->sock); - return socket_strerror(err); + return socket_strerror(err); } static int meth_bind(lua_State *L) { @@ -232,11 +232,11 @@ static const char *unix_tryconnect(p_unix un, const char *path) remote.sun_family = AF_UNIX; timeout_markstart(&un->tm); #ifdef UNIX_HAS_SUN_LEN - remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len) + remote.sun_len = sizeof(remote.sun_family) + sizeof(remote.sun_len) + len + 1; err = socket_connect(&un->sock, (SA *) &remote, remote.sun_len, &un->tm); #else - err = socket_connect(&un->sock, (SA *) &remote, + err = socket_connect(&un->sock, (SA *) &remote, sizeof(remote.sun_family) + len, &un->tm); #endif if (err != IO_DONE) socket_destroy(&un->sock); @@ -260,7 +260,7 @@ static int meth_connect(lua_State *L) } /*-------------------------------------------------------------------------*\ -* Closes socket used by object +* Closes socket used by object \*-------------------------------------------------------------------------*/ static int meth_close(lua_State *L) { @@ -329,13 +329,13 @@ static int meth_settimeout(lua_State *L) { * Library functions \*=========================================================================*/ /*-------------------------------------------------------------------------*\ -* Creates a master unix object +* Creates a master unix object \*-------------------------------------------------------------------------*/ static int global_create(lua_State *L) { t_socket sock; int err = socket_create(&sock, AF_UNIX, SOCK_STREAM, 0); /* try to allocate a system socket */ - if (err == IO_DONE) { + if (err == IO_DONE) { /* allocate unix object */ p_unix un = (p_unix) lua_newuserdata(L, sizeof(t_unix)); /* set its type as master object */ @@ -343,7 +343,7 @@ static int global_create(lua_State *L) { /* initialize remaining structure fields */ socket_setnonblocking(&sock); un->sock = sock; - io_init(&un->io, (p_send) socket_send, (p_recv) socket_recv, + io_init(&un->io, (p_send) socket_send, (p_recv) socket_recv, (p_error) socket_ioerror, &un->sock); timeout_init(&un->tm, -1, -1); buffer_init(&un->buf, &un->io, &un->tm); diff --git a/Libraries/luasocket/sdk/src/unix/usocket.c b/Libraries/luasocket/sdk/src/unix/usocket.c index 9291e76..1255a30 100644 --- a/Libraries/luasocket/sdk/src/unix/usocket.c +++ b/Libraries/luasocket/sdk/src/unix/usocket.c @@ -4,11 +4,11 @@ * * The code is now interrupt-safe. * The penalty of calling select to avoid busy-wait is only paid when -* the I/O call fail in the first place. +* the I/O call fail in the first place. * * RCS ID: $Id: usocket.c,v 1.38 2007/10/13 23:55:20 diego Exp $ \*=========================================================================*/ -#include +#include #include #include "socket.h" @@ -73,7 +73,7 @@ int socket_waitfd(p_socket ps, int sw, p_timeout tm) { /*-------------------------------------------------------------------------*\ -* Initializes module +* Initializes module \*-------------------------------------------------------------------------*/ int socket_open(void) { /* instals a handler to ignore sigpipe or it will crash us */ @@ -82,7 +82,7 @@ int socket_open(void) { } /*-------------------------------------------------------------------------*\ -* Close module +* Close module \*-------------------------------------------------------------------------*/ int socket_close(void) { return 1; @@ -102,7 +102,7 @@ void socket_destroy(p_socket ps) { /*-------------------------------------------------------------------------*\ * Select with timeout control \*-------------------------------------------------------------------------*/ -int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, +int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, p_timeout tm) { int ret; do { @@ -121,8 +121,8 @@ int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, \*-------------------------------------------------------------------------*/ int socket_create(p_socket ps, int domain, int type, int protocol) { *ps = socket(domain, type, protocol); - if (*ps != SOCKET_INVALID) return IO_DONE; - else return errno; + if (*ps != SOCKET_INVALID) return IO_DONE; + else return errno; } /*-------------------------------------------------------------------------*\ @@ -131,24 +131,24 @@ int socket_create(p_socket ps, int domain, int type, int protocol) { int socket_bind(p_socket ps, SA *addr, socklen_t len) { int err = IO_DONE; socket_setblocking(ps); - if (bind(*ps, addr, len) < 0) err = errno; + if (bind(*ps, addr, len) < 0) err = errno; socket_setnonblocking(ps); return err; } /*-------------------------------------------------------------------------*\ -* +* \*-------------------------------------------------------------------------*/ int socket_listen(p_socket ps, int backlog) { - int err = IO_DONE; + int err = IO_DONE; socket_setblocking(ps); - if (listen(*ps, backlog)) err = errno; + if (listen(*ps, backlog)) err = errno; socket_setnonblocking(ps); return err; } /*-------------------------------------------------------------------------*\ -* +* \*-------------------------------------------------------------------------*/ void socket_shutdown(p_socket ps, int how) { socket_setblocking(ps); @@ -167,7 +167,7 @@ int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) { do if (connect(*ps, addr, len) == 0) return IO_DONE; while ((err = errno) == EINTR); /* if connection failed immediately, return error code */ - if (err != EINPROGRESS && err != EAGAIN) return err; + if (err != EINPROGRESS && err != EAGAIN) return err; /* zero timeout case optimization */ if (timeout_iszero(tm)) return IO_TIMEOUT; /* wait until we have the result of the connection attempt or timeout */ @@ -184,7 +184,7 @@ int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) { int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, p_timeout tm) { SA daddr; socklen_t dlen = sizeof(daddr); - if (*ps == SOCKET_INVALID) return IO_CLOSED; + if (*ps == SOCKET_INVALID) return IO_CLOSED; if (!addr) addr = &daddr; if (!len) len = &dlen; for ( ;; ) { @@ -202,7 +202,7 @@ int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, p_timeout /*-------------------------------------------------------------------------*\ * Send with timeout \*-------------------------------------------------------------------------*/ -int socket_send(p_socket ps, const char *data, size_t count, +int socket_send(p_socket ps, const char *data, size_t count, size_t *sent, p_timeout tm) { int err; @@ -218,7 +218,7 @@ int socket_send(p_socket ps, const char *data, size_t count, return IO_DONE; } err = errno; - /* send can't really return 0, but EPIPE means the connection was + /* send can't really return 0, but EPIPE means the connection was closed */ if (put == 0 || err == EPIPE) return IO_CLOSED; /* we call was interrupted, just try again */ @@ -235,14 +235,14 @@ int socket_send(p_socket ps, const char *data, size_t count, /*-------------------------------------------------------------------------*\ * Sendto with timeout \*-------------------------------------------------------------------------*/ -int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, +int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, SA *addr, socklen_t len, p_timeout tm) { int err; *sent = 0; if (*ps == SOCKET_INVALID) return IO_CLOSED; for ( ;; ) { - long put = (long) sendto(*ps, data, count, 0, addr, len); + long put = (long) sendto(*ps, data, count, 0, addr, len); if (put > 0) { *sent = put; return IO_DONE; @@ -272,8 +272,8 @@ int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm err = errno; if (taken == 0) return IO_CLOSED; if (err == EINTR) continue; - if (err != EAGAIN) return err; - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; + if (err != EAGAIN) return err; + if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; } return IO_UNKNOWN; } @@ -281,7 +281,7 @@ int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm /*-------------------------------------------------------------------------*\ * Recvfrom with timeout \*-------------------------------------------------------------------------*/ -int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, +int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, SA *addr, socklen_t *len, p_timeout tm) { int err; *got = 0; @@ -295,8 +295,8 @@ int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, err = errno; if (taken == 0) return IO_CLOSED; if (err == EINTR) continue; - if (err != EAGAIN) return err; - if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; + if (err != EAGAIN) return err; + if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; } return IO_UNKNOWN; } @@ -320,7 +320,7 @@ void socket_setnonblocking(p_socket ps) { } /*-------------------------------------------------------------------------*\ -* DNS helpers +* DNS helpers \*-------------------------------------------------------------------------*/ int socket_gethostbyaddr(const char *addr, socklen_t len, struct hostent **hp) { *hp = gethostbyaddr(addr, len, AF_INET); @@ -367,4 +367,4 @@ const char *socket_strerror(int err) { const char *socket_ioerror(p_socket ps, int err) { (void) ps; return socket_strerror(err); -} \ No newline at end of file +} \ No newline at end of file diff --git a/Libraries/luasocket/sdk/src/windows/wsocket.c b/Libraries/luasocket/sdk/src/windows/wsocket.c index 2dcc5b1..ce1fa2e 100644 --- a/Libraries/luasocket/sdk/src/windows/wsocket.c +++ b/Libraries/luasocket/sdk/src/windows/wsocket.c @@ -3,7 +3,7 @@ * LuaSocket toolkit * * The penalty of calling select to avoid busy-wait is only paid when -* the I/O call fail in the first place. +* the I/O call fail in the first place. * * RCS ID: $Id: wsocket.c,v 1.36 2007/06/11 23:44:54 diego Exp $ \*=========================================================================*/ @@ -15,23 +15,23 @@ static const char *wstrerror(int err); /*-------------------------------------------------------------------------*\ -* Initializes module +* Initializes module \*-------------------------------------------------------------------------*/ int socket_open(void) { WSADATA wsaData; - WORD wVersionRequested = MAKEWORD(2, 0); + WORD wVersionRequested = MAKEWORD(2, 0); int err = WSAStartup(wVersionRequested, &wsaData ); if (err != 0) return 0; if ((LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 0) && (LOBYTE(wsaData.wVersion) != 1 || HIBYTE(wsaData.wVersion) != 1)) { WSACleanup(); - return 0; + return 0; } return 1; } /*-------------------------------------------------------------------------*\ -* Close module +* Close module \*-------------------------------------------------------------------------*/ int socket_close(void) { WSACleanup(); @@ -52,10 +52,10 @@ int socket_waitfd(p_socket ps, int sw, p_timeout tm) { struct timeval tv, *tp = NULL; double t; if (timeout_iszero(tm)) return IO_TIMEOUT; /* optimize timeout == 0 case */ - if (sw & WAITFD_R) { - FD_ZERO(&rfds); + if (sw & WAITFD_R) { + FD_ZERO(&rfds); FD_SET(*ps, &rfds); - rp = &rfds; + rp = &rfds; } if (sw & WAITFD_W) { FD_ZERO(&wfds); FD_SET(*ps, &wfds); wp = &wfds; } if (sw & WAITFD_C) { FD_ZERO(&efds); FD_SET(*ps, &efds); ep = &efds; } @@ -74,9 +74,9 @@ int socket_waitfd(p_socket ps, int sw, p_timeout tm) { /*-------------------------------------------------------------------------*\ * Select with int timeout in ms \*-------------------------------------------------------------------------*/ -int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, +int socket_select(t_socket n, fd_set *rfds, fd_set *wfds, fd_set *efds, p_timeout tm) { - struct timeval tv; + struct timeval tv; double t = timeout_get(tm); tv.tv_sec = (int) t; tv.tv_usec = (int) ((t - tv.tv_sec) * 1.0e6); @@ -98,7 +98,7 @@ void socket_destroy(p_socket ps) { } /*-------------------------------------------------------------------------*\ -* +* \*-------------------------------------------------------------------------*/ void socket_shutdown(p_socket ps, int how) { socket_setblocking(ps); @@ -136,10 +136,10 @@ int socket_connect(p_socket ps, SA *addr, socklen_t len, p_timeout tm) { /* give windows time to set the error (yes, disgusting) */ Sleep(10); /* find out why we failed */ - getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &len); + getsockopt(*ps, SOL_SOCKET, SO_ERROR, (char *)&err, &len); /* we KNOW there was an error. if 'why' is 0, we will return * "unknown error", but it's not really our fault */ - return err > 0? err: IO_UNKNOWN; + return err > 0? err: IO_UNKNOWN; } else return err; } @@ -156,7 +156,7 @@ int socket_bind(p_socket ps, SA *addr, socklen_t len) { } /*-------------------------------------------------------------------------*\ -* +* \*-------------------------------------------------------------------------*/ int socket_listen(p_socket ps, int backlog) { int err = IO_DONE; @@ -169,7 +169,7 @@ int socket_listen(p_socket ps, int backlog) { /*-------------------------------------------------------------------------*\ * Accept with timeout \*-------------------------------------------------------------------------*/ -int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, +int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, p_timeout tm) { SA daddr; socklen_t dlen = sizeof(daddr); @@ -181,23 +181,23 @@ int socket_accept(p_socket ps, p_socket pa, SA *addr, socklen_t *len, /* try to get client socket */ if ((*pa = accept(*ps, addr, len)) != SOCKET_INVALID) return IO_DONE; /* find out why we failed */ - err = WSAGetLastError(); + err = WSAGetLastError(); /* if we failed because there was no connectoin, keep trying */ if (err != WSAEWOULDBLOCK && err != WSAECONNABORTED) return err; /* call select to avoid busy wait */ if ((err = socket_waitfd(ps, WAITFD_R, tm)) != IO_DONE) return err; - } + } /* can't reach here */ - return IO_UNKNOWN; + return IO_UNKNOWN; } /*-------------------------------------------------------------------------*\ * Send with timeout -* On windows, if you try to send 10MB, the OS will buffer EVERYTHING -* this can take an awful lot of time and we will end up blocked. +* On windows, if you try to send 10MB, the OS will buffer EVERYTHING +* this can take an awful lot of time and we will end up blocked. * Therefore, whoever calls this function should not pass a huge buffer. \*-------------------------------------------------------------------------*/ -int socket_send(p_socket ps, const char *data, size_t count, +int socket_send(p_socket ps, const char *data, size_t count, size_t *sent, p_timeout tm) { int err; @@ -214,12 +214,12 @@ int socket_send(p_socket ps, const char *data, size_t count, return IO_DONE; } /* deal with failure */ - err = WSAGetLastError(); + err = WSAGetLastError(); /* we can only proceed if there was no serious error */ if (err != WSAEWOULDBLOCK) return err; /* avoid busy wait */ if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; - } + } /* can't reach here */ return IO_UNKNOWN; } @@ -227,7 +227,7 @@ int socket_send(p_socket ps, const char *data, size_t count, /*-------------------------------------------------------------------------*\ * Sendto with timeout \*-------------------------------------------------------------------------*/ -int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, +int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, SA *addr, socklen_t len, p_timeout tm) { int err; @@ -239,10 +239,10 @@ int socket_sendto(p_socket ps, const char *data, size_t count, size_t *sent, *sent = put; return IO_DONE; } - err = WSAGetLastError(); + err = WSAGetLastError(); if (err != WSAEWOULDBLOCK) return err; if ((err = socket_waitfd(ps, WAITFD_W, tm)) != IO_DONE) return err; - } + } return IO_UNKNOWN; } @@ -270,7 +270,7 @@ int socket_recv(p_socket ps, char *data, size_t count, size_t *got, p_timeout tm /*-------------------------------------------------------------------------*\ * Recvfrom with timeout \*-------------------------------------------------------------------------*/ -int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, +int socket_recvfrom(p_socket ps, char *data, size_t count, size_t *got, SA *addr, socklen_t *len, p_timeout tm) { int err; *got = 0; @@ -306,7 +306,7 @@ void socket_setnonblocking(p_socket ps) { } /*-------------------------------------------------------------------------*\ -* DNS helpers +* DNS helpers \*-------------------------------------------------------------------------*/ int socket_gethostbyaddr(const char *addr, socklen_t len, struct hostent **hp) { *hp = gethostbyaddr(addr, len, AF_INET); @@ -327,7 +327,7 @@ const char *socket_hoststrerror(int err) { if (err <= 0) return io_strerror(err); switch (err) { case WSAHOST_NOT_FOUND: return "host not found"; - default: return wstrerror(err); + default: return wstrerror(err); } } @@ -369,8 +369,8 @@ static const char *wstrerror(int err) { case WSAESOCKTNOSUPPORT: return "Socket type not supported"; case WSAEOPNOTSUPP: return "Operation not supported"; case WSAEPFNOSUPPORT: return "Protocol family not supported"; - case WSAEAFNOSUPPORT: - return "Address family not supported by protocol family"; + case WSAEAFNOSUPPORT: + return "Address family not supported by protocol family"; case WSAEADDRINUSE: return "Address already in use"; case WSAEADDRNOTAVAIL: return "Cannot assign requested address"; case WSAENETDOWN: return "Network is down"; @@ -389,12 +389,12 @@ static const char *wstrerror(int err) { case WSAEPROCLIM: return "Too many processes"; case WSASYSNOTREADY: return "Network subsystem is unavailable"; case WSAVERNOTSUPPORTED: return "Winsock.dll version out of range"; - case WSANOTINITIALISED: + case WSANOTINITIALISED: return "Successful WSAStartup not yet performed"; case WSAEDISCON: return "Graceful shutdown in progress"; case WSAHOST_NOT_FOUND: return "Host not found"; case WSATRY_AGAIN: return "Nonauthoritative host not found"; - case WSANO_RECOVERY: return "Nonrecoverable name lookup error"; + case WSANO_RECOVERY: return "Nonrecoverable name lookup error"; case WSANO_DATA: return "Valid name, no data record of requested type"; default: return "Unknown error"; } diff --git a/Libraries/s7/sdk/s7.c b/Libraries/s7/sdk/s7.c index 054f046..b2618e5 100644 --- a/Libraries/s7/sdk/s7.c +++ b/Libraries/s7/sdk/s7.c @@ -40,7 +40,7 @@ * * many minor changes! * - * deliberate omission from r5rs: + * deliberate omission from r5rs: * no syntax-rules or any of its friends * no force and delay unless WITH_FORCE is 1 (default is 0) * no inexact integer or ratio (so, for example, truncate returns an exact integer), no exact complex or exact real @@ -52,14 +52,14 @@ * I also choose not to include numbers such as +i (= 0+i) -- include the real part! * * deliberate difference from r5rs: - * modulo, remainder, and quotient take integer, ratio, or real args + * modulo, remainder, and quotient take integer, ratio, or real args * lcm and gcd can take integer or ratio args * continuation? function to distinguish a continuation from a procedure * log takes an optional 2nd arg (base) - * '.' and an exponent can occur in a number in any base -- they do not mean "base 10"! + * '.' and an exponent can occur in a number in any base -- they do not mean "base 10"! * However, the exponent itself is always in base 10 (this follows gmp usage). * - * other additions: + * other additions: * random for any numeric type and any numeric argument, including 0 ferchrissake! * sinh, cosh, tanh, asinh, acosh, atanh * read-line, read-byte, write-byte @@ -89,12 +89,12 @@ * Documentation is in s7.h and s7.html. s7test.scm is a regression test. * * - * ---------------- compile time switches ---------------- + * ---------------- compile time switches ---------------- */ #include "config.h" -/* +/* * Your config file goes here, or just replace that #include line with the defines you need. * The compile-time switches involve booleans, threads, complex numbers, multiprecision arithmetic, profiling, and sort!. * Currently we assume we have setjmp.h (used by the error handlers). @@ -152,10 +152,10 @@ #define SYMBOL_TABLE_SIZE 9601 /* names are hashed into the symbol table (a vector) and collisions are chained as lists. */ -#define INITIAL_STACK_SIZE 4000 +#define INITIAL_STACK_SIZE 4000 /* the stack grows as needed, each frame takes 4 entries, this is its initial size */ -#define INITIAL_PROTECTED_OBJECTS_SIZE 16 +#define INITIAL_PROTECTED_OBJECTS_SIZE 16 /* a vector of objects that are (semi-permanently) protected from the GC, grows as needed */ #define GC_TEMPS_SIZE 128 @@ -184,7 +184,7 @@ #ifndef WITH_PROFILING #define WITH_PROFILING 0 - /* this includes a simple profiler -- see the profile function in Snd's extensions.scm + /* this includes a simple profiler -- see the profile function in Snd's extensions.scm * added function: symbol-calls */ #endif @@ -289,49 +289,49 @@ #define M_PI 3.1415926535897932384626433832795029L #endif -typedef enum {OP_READ_INTERNAL, OP_EVAL, OP_EVAL_ARGS0, OP_EVAL_ARGS1, OP_APPLY, OP_EVAL_MACRO, OP_LAMBDA, OP_QUOTE, - OP_DEFINE0, OP_DEFINE1, OP_BEGIN, OP_IF0, OP_IF1, OP_SET0, OP_SET1, OP_SET2, - OP_LET0, OP_LET1, OP_LET2, OP_LET_STAR0, OP_LET_STAR1, - OP_LETREC0, OP_LETREC1, OP_LETREC2, OP_COND0, OP_COND1, - OP_AND0, OP_AND1, OP_OR0, OP_OR1, OP_DEFMACRO, OP_DEFMACRO_STAR, OP_MACRO0, OP_MACRO1, +typedef enum {OP_READ_INTERNAL, OP_EVAL, OP_EVAL_ARGS0, OP_EVAL_ARGS1, OP_APPLY, OP_EVAL_MACRO, OP_LAMBDA, OP_QUOTE, + OP_DEFINE0, OP_DEFINE1, OP_BEGIN, OP_IF0, OP_IF1, OP_SET0, OP_SET1, OP_SET2, + OP_LET0, OP_LET1, OP_LET2, OP_LET_STAR0, OP_LET_STAR1, + OP_LETREC0, OP_LETREC1, OP_LETREC2, OP_COND0, OP_COND1, + OP_AND0, OP_AND1, OP_OR0, OP_OR1, OP_DEFMACRO, OP_DEFMACRO_STAR, OP_MACRO0, OP_MACRO1, OP_DEFINE_MACRO, OP_DEFINE_MACRO_STAR, OP_DEFINE_EXPANSION, OP_EXPANSION, - OP_CASE0, OP_CASE1, OP_CASE2, OP_READ_LIST, OP_READ_DOT, OP_READ_QUOTE, - OP_READ_QUASIQUOTE, OP_READ_QUASIQUOTE_VECTOR, OP_READ_UNQUOTE, OP_READ_UNQUOTE_SPLICING, - OP_READ_VECTOR, OP_READ_RETURN_EXPRESSION, OP_READ_POP_AND_RETURN_EXPRESSION, + OP_CASE0, OP_CASE1, OP_CASE2, OP_READ_LIST, OP_READ_DOT, OP_READ_QUOTE, + OP_READ_QUASIQUOTE, OP_READ_QUASIQUOTE_VECTOR, OP_READ_UNQUOTE, OP_READ_UNQUOTE_SPLICING, + OP_READ_VECTOR, OP_READ_RETURN_EXPRESSION, OP_READ_POP_AND_RETURN_EXPRESSION, OP_LOAD_RETURN_IF_EOF, OP_LOAD_CLOSE_AND_POP_IF_EOF, OP_EVAL_STRING, OP_EVAL_STRING_DONE, OP_EVAL_DONE, - OP_QUIT, OP_CATCH, OP_DYNAMIC_WIND, OP_LIST_FOR_EACH, OP_LIST_MAP, OP_DEFINE_CONSTANT0, OP_DEFINE_CONSTANT1, + OP_QUIT, OP_CATCH, OP_DYNAMIC_WIND, OP_LIST_FOR_EACH, OP_LIST_MAP, OP_DEFINE_CONSTANT0, OP_DEFINE_CONSTANT1, OP_DO, OP_DO_END0, OP_DO_END1, OP_DO_STEP0, OP_DO_STEP1, OP_DO_STEP2, OP_DO_INIT, - OP_DEFINE_STAR, OP_LAMBDA_STAR, OP_ERROR_QUIT, OP_UNWIND_INPUT, OP_UNWIND_OUTPUT, + OP_DEFINE_STAR, OP_LAMBDA_STAR, OP_ERROR_QUIT, OP_UNWIND_INPUT, OP_UNWIND_OUTPUT, OP_TRACE_RETURN, OP_ERROR_HOOK_QUIT, OP_TRACE_HOOK_QUIT, OP_WITH_ENV0, OP_WITH_ENV1, OP_WITH_ENV2, OP_VECTOR_FOR_EACH, OP_VECTOR_MAP0, OP_VECTOR_MAP1, OP_STRING_FOR_EACH, OP_OBJECT_FOR_EACH, - OP_HASH_TABLE_FOR_EACH, + OP_HASH_TABLE_FOR_EACH, OP_MAX_DEFINED} opcode_t; #define NUM_SMALL_INTS 256 /* this needs to be at least OP_MAX_DEFINED = 87 */ -typedef enum {TOKEN_EOF, TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKEN_DOT, TOKEN_ATOM, TOKEN_QUOTE, TOKEN_DOUBLE_QUOTE, +typedef enum {TOKEN_EOF, TOKEN_LEFT_PAREN, TOKEN_RIGHT_PAREN, TOKEN_DOT, TOKEN_ATOM, TOKEN_QUOTE, TOKEN_DOUBLE_QUOTE, TOKEN_BACK_QUOTE, TOKEN_COMMA, TOKEN_AT_MARK, TOKEN_SHARP_CONST, TOKEN_VECTOR} token_t; typedef struct s7_num_t { char type; union { - + s7_Int integer_value; - + s7_Double real_value; - + struct { s7_Int numerator; s7_Int denominator; } fraction_value; - + struct { s7_Double real; s7_Double imag; } complex_value; - + unsigned long ul_value; /* these two are not used by s7 in any way */ unsigned long long ull_value; @@ -350,7 +350,7 @@ typedef struct s7_port_t { int file_number; char *filename; char *value; - int size, point; + int size, point; s7_pointer (*input_function)(s7_scheme *sc, s7_read_t read_choice, s7_pointer port); void (*output_function)(s7_scheme *sc, char c, s7_pointer port); void *data; @@ -382,23 +382,23 @@ typedef struct s7_cell { long long int calls; #endif union { - + struct { int length; char *svalue; s7_pointer global_slot; /* for strings that represent symbol names, this is the current global environment (symbol value) cons */ } string; - + s7_num_t number; - + s7_port_t *port; - + unsigned char cvalue; - + opcode_t proc_num; void *c_pointer; - + struct { s7_Int length; s7_pointer *elements; @@ -406,33 +406,33 @@ typedef struct s7_cell { s7_vdims_t *dim_info; #endif } vector; - + s7_func_t *ffptr; - + struct { struct s7_cell *car; struct s7_cell *cdr; int line; } cons; - + struct { int type; void *value; } fobj; - + struct { int stack_size, stack_top; s7_pointer stack; } continuation; - + int goto_loc; - + struct { int goto_loc; s7_pointer tag; s7_pointer handler; } rcatch; /* C++ reserves "catch" I guess */ - + struct { s7_pointer in, out, body; } winder; @@ -450,7 +450,7 @@ typedef struct { #endif -struct s7_scheme { +struct s7_scheme { s7_cell **heap, **free_heap; unsigned int heap_size, free_heap_top; @@ -460,40 +460,40 @@ struct s7_scheme { * vectors might be full of the same object (sc->NIL for example), so there * we need ca 38 GBytes RAM (8 bytes per pointer). */ - + s7_pointer args; /* arguments of current function */ s7_pointer envir; /* current environment */ s7_pointer code, cur_code; /* current code */ - + s7_pointer stack; /* stack is a vector */ int stack_size, stack_top, stack_size2; s7_pointer *small_ints; /* permanent numbers for opcode entries in the stack */ s7_pointer real_zero, real_one; - + s7_pointer protected_objects; /* a vector of gc-protected objects */ int *protected_objects_size, *protected_objects_loc; /* pointers so they're global across threads */ struct s7_cell _NIL; s7_pointer NIL; /* empty list */ - + struct s7_cell _T; s7_pointer T; /* #t */ - + struct s7_cell _F; s7_pointer F; /* #f */ - + struct s7_cell _EOF_OBJECT; s7_pointer EOF_OBJECT; /* end-of-file object */ - - struct s7_cell _UNDEFINED; + + struct s7_cell _UNDEFINED; s7_pointer UNDEFINED; /* unset or undefined object */ - + struct s7_cell _UNSPECIFIED; s7_pointer UNSPECIFIED; /* the unspecified value */ - + s7_pointer symbol_table; /* symbol table */ s7_pointer global_env; /* global environment */ - + s7_pointer LAMBDA, LAMBDA_STAR, QUOTE, QUASIQUOTE, UNQUOTE, UNQUOTE_SPLICING, MACROEXPAND; s7_pointer APPLY, VECTOR, CONS, APPEND, CDR, VECTOR_FUNCTION, VALUES, ELSE, SET; s7_pointer ERROR, WRONG_TYPE_ARG, OUT_OF_RANGE, FORMAT_ERROR, WRONG_NUMBER_OF_ARGS; @@ -501,13 +501,13 @@ struct s7_scheme { s7_pointer FEED_TO; /* => */ s7_pointer OBJECT_SET; /* applicable object set method */ s7_pointer VECTOR_SET, STRING_SET, LIST_SET, HASH_TABLE_SET; - + s7_pointer input_port; /* current-input-port (nil = stdin) */ s7_pointer input_port_stack; /* input port stack (load and read internally) */ s7_pointer output_port; /* current-output-port (nil = stderr) */ s7_pointer error_port; /* current-error-port (nil = stderr) */ s7_pointer error_info; /* the vector bound to *error-info* */ - + /* these 6 are pointers so that all thread refs are to the same thing */ bool *gc_off; /* if true, the GC won't run */ bool *tracing, *trace_all; /* if tracing, each function on the *trace* list prints its args upon application */ @@ -516,11 +516,11 @@ struct s7_scheme { #if WITH_ENCAPSULATION s7_pointer encapsulators; #endif - + #define INITIAL_STRBUF_SIZE 1024 int strbuf_size; char *strbuf; - + char *read_line_buf; int read_line_buf_size; @@ -538,7 +538,7 @@ struct s7_scheme { jmp_buf goto_start, goto_qsort_end; bool longjmp_ok; void (*error_exiter)(void); - + #if HAVE_PTHREADS struct s7_scheme *orig_sc; s7_pointer key_values; @@ -731,7 +731,7 @@ struct s7_scheme { #define small_int(Sc, Val) (Sc)->small_ints[Val] -#define is_input_port(p) (type(p) == T_INPUT_PORT) +#define is_input_port(p) (type(p) == T_INPUT_PORT) #define is_output_port(p) (type(p) == T_OUTPUT_PORT) #define is_string_port(p) ((p)->object.port->type == STRING_PORT) #define is_file_port(p) ((p)->object.port->type == FILE_PORT) @@ -895,31 +895,31 @@ static const char *s7_type_name(s7_pointer arg); /* -------------------------------- constants -------------------------------- */ -s7_pointer s7_f(s7_scheme *sc) +s7_pointer s7_f(s7_scheme *sc) { return(sc->F); } -s7_pointer s7_t(s7_scheme *sc) +s7_pointer s7_t(s7_scheme *sc) { return(sc->T); } -s7_pointer s7_nil(s7_scheme *sc) +s7_pointer s7_nil(s7_scheme *sc) { return(sc->NIL); } -s7_pointer s7_undefined(s7_scheme *sc) +s7_pointer s7_undefined(s7_scheme *sc) { return(sc->UNDEFINED); } -s7_pointer s7_unspecified(s7_scheme *sc) +s7_pointer s7_unspecified(s7_scheme *sc) { return(sc->UNSPECIFIED); } @@ -931,7 +931,7 @@ bool s7_is_unspecified(s7_scheme *sc, s7_pointer val) } -s7_pointer s7_eof_object(s7_scheme *sc) +s7_pointer s7_eof_object(s7_scheme *sc) { return(sc->EOF_OBJECT); } @@ -969,14 +969,14 @@ static s7_pointer g_is_boolean(s7_scheme *sc, s7_pointer args) } -static bool s7_is_immutable(s7_pointer p) -{ +static bool s7_is_immutable(s7_pointer p) +{ return((typeflag(p) & T_IMMUTABLE) != 0); } -static s7_pointer s7_set_immutable(s7_pointer p) -{ +static s7_pointer s7_set_immutable(s7_pointer p) +{ typeflag(p) |= T_IMMUTABLE; return(p); } @@ -991,11 +991,11 @@ static s7_pointer set_pair_line_number(s7_pointer p, int n) } -bool s7_is_constant(s7_pointer p) -{ +bool s7_is_constant(s7_pointer p) +{ /* this means "not settable": numbers, characters, strings, keywords, #f #t pi etc */ /* so to be non-constant, it has to be a non-keyword symbol with the immutable bit not set, I think */ - + return((type(p) != T_SYMBOL) || ((typeflag(p) & T_IMMUTABLE) != 0) || (s7_is_keyword(p))); @@ -1021,7 +1021,7 @@ static pthread_mutex_t protected_objects_lock = PTHREAD_MUTEX_INITIALIZER; int s7_gc_protect(s7_scheme *sc, s7_pointer x) { int i, loc, new_size; - + #if HAVE_PTHREADS pthread_mutex_lock(&protected_objects_lock); #endif @@ -1039,7 +1039,7 @@ int s7_gc_protect(s7_scheme *sc, s7_pointer x) return(loc); } } - + for (i = 0; i < (*(sc->protected_objects_size)); i++) if (vector_element(sc->protected_objects, i) == sc->NIL) { @@ -1049,7 +1049,7 @@ int s7_gc_protect(s7_scheme *sc, s7_pointer x) #endif return(i); } - + loc = (*(sc->protected_objects_size)); new_size = 2 * (*(sc->protected_objects_size)); vector_elements(sc->protected_objects) = (s7_pointer *)realloc(vector_elements(sc->protected_objects), new_size * sizeof(s7_pointer)); @@ -1058,7 +1058,7 @@ int s7_gc_protect(s7_scheme *sc, s7_pointer x) vector_length(sc->protected_objects) = new_size; (*(sc->protected_objects_size)) = new_size; vector_element(sc->protected_objects, loc) = x; - + #if HAVE_PTHREADS pthread_mutex_unlock(&protected_objects_lock); #endif @@ -1124,14 +1124,14 @@ s7_pointer s7_gc_protected_at(s7_scheme *sc, int loc) } -static void finalize_s7_cell(s7_scheme *sc, s7_pointer a) +static void finalize_s7_cell(s7_scheme *sc, s7_pointer a) { switch (type(a)) { case T_STRING: free(string_value(a)); /* calloc'd in make-*-string */ break; - + case T_INPUT_PORT: if (port_needs_free(a)) { @@ -1149,10 +1149,10 @@ static void finalize_s7_cell(s7_scheme *sc, s7_pointer a) } free(a->object.port); break; - + case T_OUTPUT_PORT: s7_close_output_port(sc, a); - if ((is_file_port(a)) && + if ((is_file_port(a)) && (port_filename(a))) { free(port_filename(a)); @@ -1160,16 +1160,16 @@ static void finalize_s7_cell(s7_scheme *sc, s7_pointer a) } free(a->object.port); break; - + case T_C_OBJECT: s7_free_object(a); break; - + case T_C_FUNCTION: case T_C_MACRO: s7_free_function(a); break; - + case T_VECTOR: case T_HASH_TABLE: if (vector_length(a) > 0) @@ -1185,7 +1185,7 @@ static void finalize_s7_cell(s7_scheme *sc, s7_pointer a) #endif } break; - + default: break; } @@ -1197,7 +1197,7 @@ static void s7_mark_object_1(s7_pointer p); #if defined(__GNUC__) && (!(defined(__cplusplus))) #define S7_MARK(Obj) ({ s7_pointer _p_; _p_ = Obj; if (!is_marked(_p_)) s7_mark_object_1(_p_); }) #else - #define S7_MARK(Obj) if (!is_marked(Obj)) s7_mark_object_1(Obj) + #define S7_MARK(Obj) if (!is_marked(Obj)) s7_mark_object_1(Obj) #endif /* this is slightly faster than if we first call s7_mark_object, then check the mark bit */ @@ -1212,13 +1212,13 @@ static void mark_vector(s7_pointer p, s7_Int top) { int j, jlen; jlen = top; - for (j = 0; j < jlen; j++) + for (j = 0; j < jlen; j++) S7_MARK(tp[j]); } else { s7_Int i; - for (i = 0; i < top; i++) + for (i = 0; i < top; i++) S7_MARK(tp[i]); } } @@ -1227,9 +1227,9 @@ static void mark_vector(s7_pointer p, s7_Int top) static void s7_mark_object_1(s7_pointer p) { set_mark(p); - + if (is_simple(p)) return; - + switch (type(p)) { case T_UNTYPED: /* 0 actually -- a cell still being set up when the GC was triggered */ @@ -1239,7 +1239,7 @@ static void s7_mark_object_1(s7_pointer p) case T_HASH_TABLE: mark_vector(p, vector_length(p)); return; - + case T_C_OBJECT: s7_mark_embedded_objects(p); return; @@ -1262,11 +1262,11 @@ static void s7_mark_object_1(s7_pointer p) default: break; } - + /* this should follow s7_is_object -- the latter is an atom, but we have to run the object's internal mark function */ if (is_atom(p)) return; - + S7_MARK(car(p)); S7_MARK(cdr(p)); } @@ -1282,7 +1282,7 @@ static int gc(s7_scheme *sc) { int i; unsigned int old_free_heap_top; - + /* mark all live objects (the symbol table is in permanent memory, not the heap) */ S7_MARK(sc->global_env); S7_MARK(sc->args); @@ -1293,7 +1293,7 @@ static int gc(s7_scheme *sc) S7_MARK(sc->x); S7_MARK(sc->y); S7_MARK(sc->z); - S7_MARK(sc->value); + S7_MARK(sc->value); S7_MARK(sc->input_port); S7_MARK(sc->input_port_stack); @@ -1303,7 +1303,7 @@ static int gc(s7_scheme *sc) #if WITH_ENCAPSULATION S7_MARK(sc->encapsulators); #endif - + S7_MARK(sc->protected_objects); { s7_pointer *tmps; @@ -1328,10 +1328,10 @@ static int gc(s7_scheme *sc) { if (is_marked(p)) /* it's marginally faster to switch the order of these checks */ clear_mark(p); - else + else { if (is_finalizable(p)) - finalize_s7_cell(sc, p); + finalize_s7_cell(sc, p); typeflag(p) = 0; fp[sc->free_heap_top++] = p; } @@ -1340,7 +1340,7 @@ static int gc(s7_scheme *sc) } /* fprintf(stderr, "gc: %d of %u\n", sc->free_heap_top - old_free_heap_top, sc->heap_size); */ - + return(sc->free_heap_top - old_free_heap_top); /* needed by cell allocator to decide when to increase heap size */ } @@ -1383,7 +1383,7 @@ static s7_pointer new_cell(s7_scheme *sc) #endif { s7_pointer p; - + #if HAVE_PTHREADS s7_scheme *sc; pthread_mutex_lock(&alloc_lock); @@ -1394,11 +1394,11 @@ static s7_pointer new_cell(s7_scheme *sc) { /* no free heap */ unsigned int k, old_size, freed_heap = 0; - + if (!(*(sc->gc_off))) freed_heap = gc(sc); /* when threads, the gc function can be interrupted at any point and resumed later -- mark bits need to be preserved during this interruption */ - + if (freed_heap < sc->heap_size / 4) /* was 1000, setting it to 2 made no difference in run time */ { /* alloc more heap */ @@ -1413,9 +1413,9 @@ static s7_pointer new_cell(s7_scheme *sc) sc->free_heap = (s7_cell **)realloc(sc->free_heap, sc->heap_size * sizeof(s7_cell *)); if (!(sc->free_heap)) - fprintf(stderr, "free heap reallocation failed! tried to get %lu bytes\n", (unsigned long)(sc->heap_size * sizeof(s7_cell *))); + fprintf(stderr, "free heap reallocation failed! tried to get %lu bytes\n", (unsigned long)(sc->heap_size * sizeof(s7_cell *))); - { + { /* optimization suggested by K Matheussen */ s7_cell *cells = (s7_cell *)calloc(sc->heap_size - old_size, sizeof(s7_cell)); for (k = old_size; k < sc->heap_size; k++) @@ -1460,7 +1460,7 @@ static s7_pointer new_cell(s7_scheme *sc) * betweeen gc calls that we end up calling the gc twice as often overall. */ - + return(p); } @@ -1487,7 +1487,7 @@ static s7_pointer g_gc(s7_scheme *sc, s7_pointer args) } gc(sc); #endif - + return(sc->UNSPECIFIED); } @@ -1506,7 +1506,7 @@ void s7_remove_from_heap(s7_scheme *sc, s7_pointer x) int loc; /* global functions are very rarely redefined, so we can remove the function body from * the heap when it is defined. If redefined, we currently lose the memory held by the - * old definition. If this memory leak becomes a problem, we could notice the redefinition + * old definition. If this memory leak becomes a problem, we could notice the redefinition * in add_to_environment, and GC the old body by hand. */ @@ -1576,14 +1576,14 @@ void s7_remove_from_heap(s7_scheme *sc, s7_pointer x) /* -------------------------------- stack -------------------------------- */ -static void stack_reset(s7_scheme *sc) -{ +static void stack_reset(s7_scheme *sc) +{ sc->stack_top = 0; -} +} -static void pop_stack(s7_scheme *sc) -{ +static void pop_stack(s7_scheme *sc) +{ /* avoid "if..then" here and in push_stack -- these 2 are called a zillion times */ s7_pointer *vel; sc->stack_top -= 4; @@ -1592,11 +1592,11 @@ static void pop_stack(s7_scheme *sc) sc->envir = vel[1]; sc->args = vel[2]; sc->op = (opcode_t)integer(number(vel[3])); -} +} static void push_stack(s7_scheme *sc, opcode_t op, s7_pointer args, s7_pointer code) -{ +{ s7_pointer *vel; vel = (s7_pointer *)(vector_elements(sc->stack) + sc->stack_top); vel[0] = code; @@ -1617,7 +1617,7 @@ static void increase_stack_size(s7_scheme *sc) vector_length(sc->stack) = new_size; sc->stack_size2 = sc->stack_size; sc->stack_size = new_size; -} +} static s7_pointer g_stack(s7_scheme *sc, s7_pointer args) @@ -1638,7 +1638,7 @@ internally by the evaluator. If a continuation is passed, its stack and stack-t f = (thred *)s7_object_value(car(args)); return(make_list_2(sc, s7_make_integer(sc, f->sc->stack_top), f->sc->stack)); } -#endif +#endif } return(make_list_2(sc, s7_make_integer(sc, sc->stack_top), sc->stack)); @@ -1648,65 +1648,65 @@ internally by the evaluator. If a continuation is passed, its stack and stack-t #if 0 static void show_stack(s7_scheme *sc) { - const char *ops[OP_MAX_DEFINED] = - {"read_internal", "eval", "eval_args0", "eval_args1", "apply", "eval_macro", "lambda", "quote", - "define0", "define1", "begin", "if0", "if1", "set0", "set1", "set2", "let0", "let1", "let2", - "let_star0", "let_star1", "letrec0", "letrec1", "letrec2", "cond0", "cond1", - "and0", "and1", "or0", "or1", "defmacro", "defmacro_star", "macro0", "macro1", - "define_macro", "define_macro_star", "define_expansion", "expansion", - "case0", "case1", "case2", "read_list", "read_dot", "read_quote", "read_quasiquote", "read_quasiquote_vector", - "read_unquote", "read_unquote_splicing", "read_vector", "read_return_expression", - "read_and_return_expression", "load_return_if_eof", "load_close_and_pop_if_eof", "eval_string", - "eval_string_done", "eval_done", "quit", "catch", "dynamic_wind", "for_list_each", "list_map", "define_constant0", - "define_constant1", "do", "do_end0", "do_end1", "do_step0", "do_step1", "do_step2", "do_init", "define_star", + const char *ops[OP_MAX_DEFINED] = + {"read_internal", "eval", "eval_args0", "eval_args1", "apply", "eval_macro", "lambda", "quote", + "define0", "define1", "begin", "if0", "if1", "set0", "set1", "set2", "let0", "let1", "let2", + "let_star0", "let_star1", "letrec0", "letrec1", "letrec2", "cond0", "cond1", + "and0", "and1", "or0", "or1", "defmacro", "defmacro_star", "macro0", "macro1", + "define_macro", "define_macro_star", "define_expansion", "expansion", + "case0", "case1", "case2", "read_list", "read_dot", "read_quote", "read_quasiquote", "read_quasiquote_vector", + "read_unquote", "read_unquote_splicing", "read_vector", "read_return_expression", + "read_and_return_expression", "load_return_if_eof", "load_close_and_pop_if_eof", "eval_string", + "eval_string_done", "eval_done", "quit", "catch", "dynamic_wind", "for_list_each", "list_map", "define_constant0", + "define_constant1", "do", "do_end0", "do_end1", "do_step0", "do_step1", "do_step2", "do_init", "define_star", "lambda_star", "error_quit", "unwind_input", "unwind_output", "trace_return", "error_hook_quit", "trace_hook_quit", - "with_env0", "with_env1", "with_env2", "vector_for_each", "vector_map0", "vector_map1", "string_for_each", + "with_env0", "with_env1", "with_env2", "vector_for_each", "vector_map0", "vector_map1", "string_for_each", "object_for_each", "hash-table-for-each"}; int i; for (i = sc->stack_top - 4; i >= 0; i -= 4) - fprintf(stderr, "[%s: (%s %s)]\n", + fprintf(stderr, "[%s: (%s %s)]\n", ops[(int)integer(number(vector_element(sc->stack, i + 3)))], s7_object_to_c_string(sc, vector_element(sc->stack, i + 0)), s7_object_to_c_string(sc, vector_element(sc->stack, i + 2))); } -#endif +#endif /* -------------------------------- symbols -------------------------------- */ -static s7_Int hash_table_hash(const char *key, s7_Int table_size) -{ +static s7_Int hash_table_hash(const char *key, s7_Int table_size) +{ /* I tried several other hash functions, but they gave about the same incidence of collisions */ - unsigned long long int hashed = 0; - const char *c; - for (c = key; *c; c++) + unsigned long long int hashed = 0; + const char *c; + for (c = key; *c; c++) hashed = *c + hashed * 37; - return(hashed % table_size); -} + return(hashed % table_size); +} -static int symbol_table_hash(const char *key, int table_size) -{ +static int symbol_table_hash(const char *key, int table_size) +{ unsigned int hashed = 0; - const char *c; - for (c = key; *c; c++) + const char *c; + for (c = key; *c; c++) hashed = *c + hashed * 37; - return(hashed % table_size); + return(hashed % table_size); /* using ints here is much faster, and the symbol table will not be enormous, so it's worth splitting out this case */ -} +} #if HAVE_PTHREADS static pthread_mutex_t symtab_lock = PTHREAD_MUTEX_INITIALIZER; #endif -static s7_pointer symbol_table_add_by_name_at_location(s7_scheme *sc, const char *name, int location) -{ - s7_pointer x, str; - +static s7_pointer symbol_table_add_by_name_at_location(s7_scheme *sc, const char *name, int location) +{ + s7_pointer x, str; + str = s7_make_permanent_string(name); x = s7_permanent_cons(str, sc->NIL, T_SYMBOL | T_ATOM | T_SIMPLE | T_DONT_COPY | T_ETERNAL); symbol_location(x) = location; @@ -1716,49 +1716,49 @@ static s7_pointer symbol_table_add_by_name_at_location(s7_scheme *sc, const char pthread_mutex_lock(&symtab_lock); #endif - vector_element(sc->symbol_table, location) = s7_permanent_cons(x, - vector_element(sc->symbol_table, location), + vector_element(sc->symbol_table, location) = s7_permanent_cons(x, + vector_element(sc->symbol_table, location), T_PAIR | T_ATOM | T_SIMPLE | T_IMMUTABLE | T_DONT_COPY); #if HAVE_PTHREADS pthread_mutex_unlock(&symtab_lock); #endif - - return(x); -} + + return(x); +} -static s7_pointer symbol_table_add_by_name(s7_scheme *sc, const char *name) +static s7_pointer symbol_table_add_by_name(s7_scheme *sc, const char *name) { - return(symbol_table_add_by_name_at_location(sc, name, symbol_table_hash(name, vector_length(sc->symbol_table)))); + return(symbol_table_add_by_name_at_location(sc, name, symbol_table_hash(name, vector_length(sc->symbol_table)))); } -static s7_pointer symbol_table_find_by_name(s7_scheme *sc, const char *name, int location) -{ - s7_pointer x; +static s7_pointer symbol_table_find_by_name(s7_scheme *sc, const char *name, int location) +{ + s7_pointer x; #if HAVE_PTHREADS pthread_mutex_lock(&symtab_lock); #endif - for (x = vector_element(sc->symbol_table, location); x != sc->NIL; x = cdr(x)) - { - const char *s; - s = s7_symbol_name(car(x)); + for (x = vector_element(sc->symbol_table, location); x != sc->NIL; x = cdr(x)) + { + const char *s; + s = s7_symbol_name(car(x)); if ((s) && (strcmp(name, s) == 0)) { #if HAVE_PTHREADS pthread_mutex_unlock(&symtab_lock); #endif - return(car(x)); + return(car(x)); } - } + } #if HAVE_PTHREADS pthread_mutex_unlock(&symtab_lock); #endif - return(sc->NIL); -} + return(sc->NIL); +} static s7_pointer g_symbol_table(s7_scheme *sc, s7_pointer args) @@ -1770,15 +1770,15 @@ static s7_pointer g_symbol_table(s7_scheme *sc, s7_pointer args) void s7_for_each_symbol_name(s7_scheme *sc, bool (*symbol_func)(const char *symbol_name, void *data), void *data) { - int i; - s7_pointer x; + int i; + s7_pointer x; #if HAVE_PTHREADS pthread_mutex_lock(&symtab_lock); #endif - for (i = 0; i < vector_length(sc->symbol_table); i++) - for (x = vector_element(sc->symbol_table, i); x != sc->NIL; x = cdr(x)) + for (i = 0; i < vector_length(sc->symbol_table); i++) + for (x = vector_element(sc->symbol_table, i); x != sc->NIL; x = cdr(x)) if (symbol_func(s7_symbol_name(car(x)), data)) { #if HAVE_PTHREADS @@ -1795,15 +1795,15 @@ void s7_for_each_symbol_name(s7_scheme *sc, bool (*symbol_func)(const char *symb void s7_for_each_symbol(s7_scheme *sc, bool (*symbol_func)(const char *symbol_name, s7_pointer value, void *data), void *data) { - int i; - s7_pointer x; + int i; + s7_pointer x; #if HAVE_PTHREADS pthread_mutex_lock(&symtab_lock); #endif - for (i = 0; i < vector_length(sc->symbol_table); i++) - for (x = vector_element(sc->symbol_table, i); x != sc->NIL; x = cdr(x)) + for (i = 0; i < vector_length(sc->symbol_table); i++) + for (x = vector_element(sc->symbol_table, i); x != sc->NIL; x = cdr(x)) if (symbol_func(s7_symbol_name(car(x)), cdr(x), data)) { #if HAVE_PTHREADS @@ -1818,50 +1818,50 @@ void s7_for_each_symbol(s7_scheme *sc, bool (*symbol_func)(const char *symbol_na } -s7_pointer s7_make_symbol(s7_scheme *sc, const char *name) -{ - s7_pointer x; +s7_pointer s7_make_symbol(s7_scheme *sc, const char *name) +{ + s7_pointer x; int location; - location = symbol_table_hash(name, vector_length(sc->symbol_table)); - x = symbol_table_find_by_name(sc, name, location); - if (x != sc->NIL) - return(x); - return(symbol_table_add_by_name_at_location(sc, name, location)); -} + location = symbol_table_hash(name, vector_length(sc->symbol_table)); + x = symbol_table_find_by_name(sc, name, location); + if (x != sc->NIL) + return(x); + return(symbol_table_add_by_name_at_location(sc, name, location)); +} s7_pointer s7_gensym(s7_scheme *sc, const char *prefix) -{ +{ char *name; int len, location; s7_pointer x; - + len = safe_strlen(prefix) + 32; name = (char *)calloc(len, sizeof(char)); - - for (; (*(sc->gensym_counter)) < LONG_MAX; ) - { - snprintf(name, len, "%s-%ld", prefix, (*(sc->gensym_counter))++); - location = symbol_table_hash(name, vector_length(sc->symbol_table)); - x = symbol_table_find_by_name(sc, name, location); + + for (; (*(sc->gensym_counter)) < LONG_MAX; ) + { + snprintf(name, len, "%s-%ld", prefix, (*(sc->gensym_counter))++); + location = symbol_table_hash(name, vector_length(sc->symbol_table)); + x = symbol_table_find_by_name(sc, name, location); if (x != sc->NIL) { if (s7_symbol_value(sc, x) != sc->UNDEFINED) - continue; + continue; free(name); - return(x); + return(x); } - - x = symbol_table_add_by_name_at_location(sc, name, location); + + x = symbol_table_add_by_name_at_location(sc, name, location); free(name); - return(x); - } + return(x); + } free(name); - return(sc->NIL); -} + return(sc->NIL); +} -static s7_pointer g_gensym(s7_scheme *sc, s7_pointer args) +static s7_pointer g_gensym(s7_scheme *sc, s7_pointer args) { #define H_gensym "(gensym :optional prefix) returns a new (or at least an un-used) symbol" if (args != sc->NIL) @@ -1880,8 +1880,8 @@ s7_pointer s7_name_to_value(s7_scheme *sc, const char *name) } -bool s7_is_symbol(s7_pointer p) -{ +bool s7_is_symbol(s7_pointer p) +{ return(type(p) == T_SYMBOL); } @@ -1893,8 +1893,8 @@ static s7_pointer g_is_symbol(s7_scheme *sc, s7_pointer args) } -const char *s7_symbol_name(s7_pointer p) -{ +const char *s7_symbol_name(s7_pointer p) +{ return(symbol_name(p)); } @@ -1934,7 +1934,7 @@ static s7_pointer g_symbol_calls(s7_scheme *sc, s7_pointer args) { #define H_symbol_calls "(symbol-calls sym) returns the number of times sym was called (applied)" if (!s7_is_symbol(car(args))) - return(s7_wrong_type_arg_error(sc, "symbol-calls", 0, car(args), "a symbol")); + return(s7_wrong_type_arg_error(sc, "symbol-calls", 0, car(args), "a symbol")); return(s7_make_integer(sc, symbol_calls(eval_symbol(sc, car(args))))); } #endif @@ -1943,14 +1943,14 @@ static s7_pointer g_symbol_calls(s7_scheme *sc, s7_pointer args) /* -------------------------------- environments -------------------------------- */ -static s7_pointer new_frame_in_env(s7_scheme *sc, s7_pointer old_env) -{ +static s7_pointer new_frame_in_env(s7_scheme *sc, s7_pointer old_env) +{ return(s7_cons(sc, sc->NIL, old_env)); -} +} -static s7_pointer add_to_environment(s7_scheme *sc, s7_pointer env, s7_pointer variable, s7_pointer value) -{ +static s7_pointer add_to_environment(s7_scheme *sc, s7_pointer env, s7_pointer variable, s7_pointer value) +{ s7_pointer slot, e; e = car(env); @@ -1978,7 +1978,7 @@ static s7_pointer add_to_environment(s7_scheme *sc, s7_pointer env, s7_pointer v { s7_pointer x; #if HAVE_PTHREADS - x = new_cell(sc); + x = new_cell(sc); #else if (sc->free_heap_top > 0) x = sc->free_heap[--(sc->free_heap_top)]; @@ -1992,20 +1992,20 @@ static s7_pointer add_to_environment(s7_scheme *sc, s7_pointer env, s7_pointer v } return(slot); -} +} -static s7_pointer add_to_current_environment(s7_scheme *sc, s7_pointer variable, s7_pointer value) -{ +static s7_pointer add_to_current_environment(s7_scheme *sc, s7_pointer variable, s7_pointer value) +{ if (is_immutable(variable)) return(s7_error(sc, sc->ERROR, make_list_2(sc, s7_make_string(sc, "can't bind or set an immutable object: ~S"), variable))); - return(add_to_environment(sc, sc->envir, variable, value)); -} + return(add_to_environment(sc, sc->envir, variable, value)); +} -static s7_pointer add_to_local_environment(s7_scheme *sc, s7_pointer variable, s7_pointer value) -{ +static s7_pointer add_to_local_environment(s7_scheme *sc, s7_pointer variable, s7_pointer value) +{ /* this is called when it is guaranteed that there is a local environment */ s7_pointer x; @@ -2013,7 +2013,7 @@ static s7_pointer add_to_local_environment(s7_scheme *sc, s7_pointer variable, s return(s7_error(sc, sc->ERROR, make_list_2(sc, s7_make_string(sc, "can't bind or set an immutable object: ~S"), variable))); #if HAVE_PTHREADS - x = new_cell(sc); + x = new_cell(sc); #else if (sc->free_heap_top > 0) x = sc->free_heap[--(sc->free_heap_top)]; @@ -2025,28 +2025,28 @@ static s7_pointer add_to_local_environment(s7_scheme *sc, s7_pointer variable, s car(sc->envir) = x; set_local(variable); return(car(x)); -} +} -static s7_pointer s7_find_symbol_in_environment(s7_scheme *sc, s7_pointer env, s7_pointer hdl, bool all_envirs) -{ +static s7_pointer s7_find_symbol_in_environment(s7_scheme *sc, s7_pointer env, s7_pointer hdl, bool all_envirs) +{ s7_pointer x, y; /* this is a list (of alists, each representing a frame) ending with a vector (the global environment) */ - for (x = env; is_pair(x); x = cdr(x)) - { + for (x = env; is_pair(x); x = cdr(x)) + { if (s7_is_vector(car(x))) return(symbol_global_slot(hdl)); - + for (y = car(x); is_pair(y); y = cdr(y)) if (caar(y) == hdl) return(car(y)); - if (!all_envirs) - return(sc->NIL); + if (!all_envirs) + return(sc->NIL); } - return(sc->NIL); -} + return(sc->NIL); +} s7_pointer s7_symbol_value(s7_scheme *sc, s7_pointer sym) /* was searching just the global environment? */ @@ -2121,7 +2121,7 @@ static s7_pointer lambda_star_argument_default_value(s7_scheme *sc, s7_pointer v if (s7_is_symbol(val)) { x = s7_find_symbol_in_environment(sc, sc->envir, val, true); - if (x != sc->NIL) + if (x != sc->NIL) return(symbol_value(x)); } if ((is_pair(val)) && @@ -2162,7 +2162,7 @@ static s7_pointer g_current_environment(s7_scheme *sc, s7_pointer args) } -static s7_pointer make_closure(s7_scheme *sc, s7_pointer c, s7_pointer e, int type) +static s7_pointer make_closure(s7_scheme *sc, s7_pointer c, s7_pointer e, int type) { /* c is code. e is environment */ /* this is called every time a lambda form is evaluated, or during letrec, etc */ @@ -2178,7 +2178,7 @@ static s7_pointer make_closure(s7_scheme *sc, s7_pointer c, s7_pointer e, int ty s7_pointer s7_make_closure(s7_scheme *sc, s7_pointer c, s7_pointer e) { - /* c is a list: args code, so + /* c is a list: args code, so * (define (proc a b) (+ a b)) becomes * make_closure ((a b) (+ a b)) e */ @@ -2186,13 +2186,13 @@ s7_pointer s7_make_closure(s7_scheme *sc, s7_pointer c, s7_pointer e) } -s7_pointer s7_global_environment(s7_scheme *sc) +s7_pointer s7_global_environment(s7_scheme *sc) { return(sc->global_env); } -s7_pointer s7_current_environment(s7_scheme *sc) +s7_pointer s7_current_environment(s7_scheme *sc) { return(sc->envir); } @@ -2205,10 +2205,10 @@ static s7_pointer g_is_defined(s7_scheme *sc, s7_pointer args) if (!s7_is_symbol(car(args))) return(s7_wrong_type_arg_error(sc, "defined?", 0, car(args), "a symbol")); - + if (is_syntax(car(args))) return(sc->T); - + if (cdr(args) != sc->NIL) { if (!is_pair(cadr(args))) @@ -2216,18 +2216,18 @@ static s7_pointer g_is_defined(s7_scheme *sc, s7_pointer args) x = cadr(args); } else x = sc->envir; - + x = s7_find_symbol_in_environment(sc, x, car(args), true); return(make_boolean(sc, (x != sc->NIL) && (x != sc->UNDEFINED))); } -void s7_define(s7_scheme *sc, s7_pointer envir, s7_pointer symbol, s7_pointer value) +void s7_define(s7_scheme *sc, s7_pointer envir, s7_pointer symbol, s7_pointer value) { s7_pointer x; x = s7_find_symbol_in_environment(sc, envir, symbol, false); - if (x != sc->NIL) - set_symbol_value(x, value); + if (x != sc->NIL) + set_symbol_value(x, value); else add_to_environment(sc, envir, symbol, value); /* I think this means C code can override "constant" defs */ } @@ -2235,7 +2235,7 @@ void s7_define(s7_scheme *sc, s7_pointer envir, s7_pointer symbol, s7_pointer va void s7_define_variable(s7_scheme *sc, const char *name, s7_pointer value) { s7_pointer sym; - + sym = s7_make_symbol(sc, name); s7_define(sc, s7_global_environment(sc), sym, value); } @@ -2244,7 +2244,7 @@ void s7_define_variable(s7_scheme *sc, const char *name, s7_pointer value) void s7_define_constant(s7_scheme *sc, const char *name, s7_pointer value) { s7_pointer x, sym; - + sym = s7_make_symbol(sc, name); s7_define(sc, s7_global_environment(sc), sym, value); @@ -2260,13 +2260,13 @@ void s7_define_constant(s7_scheme *sc, const char *name, s7_pointer value) static s7_pointer s7_find_value_in_environment(s7_scheme *sc, s7_pointer val) -{ - s7_pointer x, y, vec; - for (x = sc->envir; (x != sc->NIL) && (!s7_is_vector(car(x))); x = cdr(x)) - for (y = car(x); y != sc->NIL; y = cdr(y)) +{ + s7_pointer x, y, vec; + for (x = sc->envir; (x != sc->NIL) && (!s7_is_vector(car(x))); x = cdr(x)) + for (y = car(x); y != sc->NIL; y = cdr(y)) if (cdr(car(y)) == val) return(car(y)); - + if (s7_is_vector(car(x))) { int i, len; @@ -2274,12 +2274,12 @@ static s7_pointer s7_find_value_in_environment(s7_scheme *sc, s7_pointer val) len = vector_length(vec); for (i = 0; i < len; i++) if (vector_element(vec, i) != sc->NIL) - for (y = vector_element(vec, i); y != sc->NIL; y = cdr(y)) + for (y = vector_element(vec, i); y != sc->NIL; y = cdr(y)) if (cdr(car(y)) == val) return(car(y)); } - return(sc->F); -} + return(sc->F); +} @@ -2310,17 +2310,17 @@ s7_pointer s7_make_keyword(s7_scheme *sc, const char *key) { s7_pointer sym, x; char *name; - + name = (char *)malloc((safe_strlen(key) + 2) * sizeof(char)); sprintf(name, ":%s", key); /* prepend ":" */ sym = s7_make_symbol(sc, name); - typeflag(sym) |= (T_IMMUTABLE | T_DONT_COPY); + typeflag(sym) |= (T_IMMUTABLE | T_DONT_COPY); free(name); - + x = s7_find_symbol_in_environment(sc, sc->envir, sym, true); /* is it already defined? */ - if (x == sc->NIL) + if (x == sc->NIL) add_to_environment(sc, sc->envir, sym, sym); /* its value is itself, skip the immutable check in add_to_current_environment */ - + return(sym); } @@ -2370,13 +2370,13 @@ static s7_pointer g_symbol_to_keyword(s7_scheme *sc, s7_pointer args) /* for uninterpreted pointers */ -bool s7_is_c_pointer(s7_pointer arg) +bool s7_is_c_pointer(s7_pointer arg) { return(type(arg) == T_C_POINTER); } -void *s7_c_pointer(s7_pointer p) +void *s7_c_pointer(s7_pointer p) { if ((type(p) == T_NUMBER) && (s7_integer(p) == 0)) return(NULL); /* special case where the null pointer has been cons'd up by hand */ @@ -2402,8 +2402,8 @@ s7_pointer s7_make_c_pointer(s7_scheme *sc, void *ptr) /* -------------------------------- continuations and gotos -------------------------------- */ -bool s7_is_continuation(s7_pointer p) -{ +bool s7_is_continuation(s7_pointer p) +{ return(type(p) == T_CONTINUATION); } @@ -2435,7 +2435,7 @@ static s7_pointer copy_object(s7_scheme *sc, s7_pointer obj) memcpy((void *)nobj, (void *)obj, sizeof(s7_cell)); nobj->hloc = nloc; } - + if (dont_copy(car(obj))) car(nobj) = car(obj); else car(nobj) = copy_object(sc, car(obj)); @@ -2443,11 +2443,11 @@ static s7_pointer copy_object(s7_scheme *sc, s7_pointer obj) if ((dont_copy(cdr(obj))) || (is_closure(obj)) || (is_closure_star(obj)) || - (is_macro(obj)) || + (is_macro(obj)) || (s7_is_function(obj))) cdr(nobj) = cdr(obj); /* closure_environment in func cases */ else cdr(nobj) = copy_object(sc, cdr(obj)); - + return(nobj); } @@ -2466,7 +2466,7 @@ static s7_pointer copy_stack(s7_scheme *sc, s7_pointer old_v, int top) nv = vector_elements(new_v); ov = vector_elements(old_v); - + s7_gc_on(sc, false); for (i = 0; i < top; i += 4) @@ -2480,13 +2480,13 @@ static s7_pointer copy_stack(s7_scheme *sc, s7_pointer old_v, int top) else nv[i + 2] = ov[i + 2]; /* is this a safe assumption? */ nv[i + 3] = ov[i + 3]; /* op (constant int) */ } - + s7_gc_on(sc, true); return(new_v); } -static s7_pointer s7_make_goto(s7_scheme *sc) +static s7_pointer s7_make_goto(s7_scheme *sc) { s7_pointer x; x = new_cell(sc); @@ -2496,7 +2496,7 @@ static s7_pointer s7_make_goto(s7_scheme *sc) } -s7_pointer s7_make_continuation(s7_scheme *sc) +s7_pointer s7_make_continuation(s7_scheme *sc) { s7_pointer x; @@ -2519,7 +2519,7 @@ s7_pointer s7_make_continuation(s7_scheme *sc) static void check_for_dynamic_winds(s7_scheme *sc, s7_pointer c) { int i, s_base = 0, c_base = -1; - + for (i = sc->stack_top - 1; i > 0; i -= 4) { s7_pointer x; @@ -2537,13 +2537,13 @@ static void check_for_dynamic_winds(s7_scheme *sc, s7_pointer c) c_base = j; break; } - + if (s_base != 0) - break; - + break; + if (dynamic_wind_state(x) == T_DWIND_BODY) { - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = sc->NIL; sc->code = dynamic_wind_out(x); eval(sc, OP_APPLY); @@ -2555,13 +2555,13 @@ static void check_for_dynamic_winds(s7_scheme *sc, s7_pointer c) sc->trace_depth--; } } - + for (i = c_base + 4; i < continuation_stack_top(c); i += 4) if ((opcode_t)s7_integer(vector_element(continuation_stack(c), i)) == OP_DYNAMIC_WIND) { s7_pointer x; x = vector_element(continuation_stack(c), i - 3); - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = sc->NIL; sc->code = dynamic_wind_in(x); eval(sc, OP_APPLY); @@ -2576,7 +2576,7 @@ static s7_pointer g_call_cc(s7_scheme *sc, s7_pointer args) s7_pointer proc_args; /* car(args) is the procedure passed to call/cc */ - + if (!is_procedure(car(args))) /* this includes continuations */ return(s7_wrong_type_arg_error(sc, "call/cc", 1, car(args), "a procedure")); @@ -2597,26 +2597,26 @@ static s7_pointer g_call_cc(s7_scheme *sc, s7_pointer args) static s7_pointer g_call_with_exit(s7_scheme *sc, s7_pointer args) { #define H_call_with_exit "(call-with-exit ...) is a simplified call/cc" - + /* (call-with-exit (lambda (return) ...)) */ /* perhaps "call/exit"? */ - + if (!is_procedure(car(args))) /* this includes continuations */ return(s7_wrong_type_arg_error(sc, "call-with-exit", 1, car(args), "a procedure")); sc->code = car(args); /* the lambda form */ sc->args = make_list_1(sc, s7_make_goto(sc)); /* the argument to the lambda (the goto = "return" above) */ push_stack(sc, OP_APPLY, sc->args, sc->code); /* apply looks at sc->code to decide what to do (it will see the lambda) */ - - /* if the lambda body calls the argument as a function, + + /* if the lambda body calls the argument as a function, * it is applied to its arguments, apply notices that it is a goto, and... - * - * sc->stack_top = (sc->code)->object.goto_loc; + * + * sc->stack_top = (sc->code)->object.goto_loc; * s_pop(sc, sc->args != sc->NIL ? car(sc->args) : sc->NIL); - * + * * which jumps to the point of the goto returning car(args) */ - + return(sc->NIL); } @@ -2631,8 +2631,8 @@ static s7_pointer g_call_with_exit(s7_scheme *sc, s7_pointer args) static s7_pointer string_to_either_ratio(s7_scheme *sc, const char *nstr, const char *dstr, int radix); static s7_pointer string_to_either_real(s7_scheme *sc, const char *str, int radix); static s7_pointer string_to_either_complex(s7_scheme *sc, - char *q, char *slash1, char *ex1, bool has_dec_point1, - char *plus, char *slash2, char *ex2, bool has_dec_point2, + char *q, char *slash1, char *ex1, bool has_dec_point1, + char *plus, char *slash2, char *ex2, bool has_dec_point2, int radix, int has_plus_or_minus); static s7_pointer big_add(s7_scheme *sc, s7_pointer args); static s7_pointer big_subtract(s7_scheme *sc, s7_pointer args); @@ -2656,27 +2656,27 @@ static s7_pointer g_call_with_exit(s7_scheme *sc, s7_pointer args) /* need to provide inverse hyperbolic trig funcs and cbrt */ double asinh(double x); -double asinh(double x) -{ - return(log(x + sqrt(1.0 + x * x))); -} +double asinh(double x) +{ + return(log(x + sqrt(1.0 + x * x))); +} double acosh(double x); double acosh(double x) -{ - return(log(x + sqrt(x * x - 1.0))); +{ + return(log(x + sqrt(x * x - 1.0))); /* perhaps less prone to numerical troubles (untested): * 2.0 * log(sqrt(0.5 * (x + 1.0)) + sqrt(0.5 * (x - 1.0))) */ -} +} double atanh(double x); double atanh(double x) -{ - return(log((1.0 + x) / (1.0 - x)) / 2.0); -} +{ + return(log((1.0 + x) / (1.0 - x)) / 2.0); +} double cbrt(double x); @@ -2708,149 +2708,149 @@ double cbrt(double x) typedef double complex s7_Complex; #endif -/* Trigonometric functions. FreeBSD's math library does not include the complex form of the trig funcs. */ +/* Trigonometric functions. FreeBSD's math library does not include the complex form of the trig funcs. */ /* FreeBSD supplies cabs carg cimag creal conj csqrt, so can we assume those exist if complex.h exists? */ #if 0 static s7_Double carg(s7_Complex z) -{ - return(atan2(cimag(z), creal(z))); -} - - -static s7_Double cabs(s7_Complex z) -{ - return(hypot(creal(z), cimag(z))); -} - - -static s7_Complex conj(s7_Complex z) -{ - return(~z); -} - - -static s7_Complex csqrt(s7_Complex z) -{ - if (cimag(z) < 0.0) - return(conj(csqrt(conj(z)))); - else - { - s7_Double r = cabs(z); - s7_Double x = creal(z); - - return(sqrt((r + x) / 2.0) + sqrt((r - x) / 2.0) * _Complex_I); - } -} +{ + return(atan2(cimag(z), creal(z))); +} + + +static s7_Double cabs(s7_Complex z) +{ + return(hypot(creal(z), cimag(z))); +} + + +static s7_Complex conj(s7_Complex z) +{ + return(~z); +} + + +static s7_Complex csqrt(s7_Complex z) +{ + if (cimag(z) < 0.0) + return(conj(csqrt(conj(z)))); + else + { + s7_Double r = cabs(z); + s7_Double x = creal(z); + + return(sqrt((r + x) / 2.0) + sqrt((r - x) / 2.0) * _Complex_I); + } +} #endif #if (!HAVE_COMPLEX_TRIG) #if (!__cplusplus) -static s7_Complex csin(s7_Complex z) -{ - return(sin(creal(z)) * cosh(cimag(z)) + (cos(creal(z)) * sinh(cimag(z))) * _Complex_I); -} +static s7_Complex csin(s7_Complex z) +{ + return(sin(creal(z)) * cosh(cimag(z)) + (cos(creal(z)) * sinh(cimag(z))) * _Complex_I); +} -static s7_Complex ccos(s7_Complex z) -{ - return(cos(creal(z)) * cosh(cimag(z)) + (-sin(creal(z)) * sinh(cimag(z))) * _Complex_I); -} +static s7_Complex ccos(s7_Complex z) +{ + return(cos(creal(z)) * cosh(cimag(z)) + (-sin(creal(z)) * sinh(cimag(z))) * _Complex_I); +} -static s7_Complex csinh(s7_Complex z) -{ - return(sinh(creal(z)) * cos(cimag(z)) + (cosh(creal(z)) * sin(cimag(z))) * _Complex_I); -} +static s7_Complex csinh(s7_Complex z) +{ + return(sinh(creal(z)) * cos(cimag(z)) + (cosh(creal(z)) * sin(cimag(z))) * _Complex_I); +} -static s7_Complex ccosh(s7_Complex z) -{ - return(cosh(creal(z)) * cos(cimag(z)) + (sinh(creal(z)) * sin(cimag(z))) * _Complex_I); -} +static s7_Complex ccosh(s7_Complex z) +{ + return(cosh(creal(z)) * cos(cimag(z)) + (sinh(creal(z)) * sin(cimag(z))) * _Complex_I); +} #endif -static s7_Complex ctan(s7_Complex z) -{ - return(csin(z) / ccos(z)); -} +static s7_Complex ctan(s7_Complex z) +{ + return(csin(z) / ccos(z)); +} -static s7_Complex ctanh(s7_Complex z) -{ - return(csinh(z) / ccosh(z)); -} +static s7_Complex ctanh(s7_Complex z) +{ + return(csinh(z) / ccosh(z)); +} #if (!__cplusplus) -static s7_Complex cexp(s7_Complex z) -{ - return(exp(creal(z)) * cos(cimag(z)) + (exp(creal(z)) * sin(cimag(z))) * _Complex_I); -} - - -static s7_Complex clog(s7_Complex z) -{ - return(log(s7_Double_abs(cabs(z))) + carg(z) * _Complex_I); -} - - -static s7_Complex cpow(s7_Complex x, s7_Complex y) -{ - s7_Double r = cabs(x); - s7_Double theta = carg(x); - s7_Double yre = creal(y); - s7_Double yim = cimag(y); - s7_Double nr = exp(yre * log(r) - yim * theta); - s7_Double ntheta = yre * theta + yim * log(r); - - return(nr * cos(ntheta) + (nr * sin(ntheta)) * _Complex_I); /* make-polar */ -} +static s7_Complex cexp(s7_Complex z) +{ + return(exp(creal(z)) * cos(cimag(z)) + (exp(creal(z)) * sin(cimag(z))) * _Complex_I); +} + + +static s7_Complex clog(s7_Complex z) +{ + return(log(s7_Double_abs(cabs(z))) + carg(z) * _Complex_I); +} + + +static s7_Complex cpow(s7_Complex x, s7_Complex y) +{ + s7_Double r = cabs(x); + s7_Double theta = carg(x); + s7_Double yre = creal(y); + s7_Double yim = cimag(y); + s7_Double nr = exp(yre * log(r) - yim * theta); + s7_Double ntheta = yre * theta + yim * log(r); + + return(nr * cos(ntheta) + (nr * sin(ntheta)) * _Complex_I); /* make-polar */ +} #endif -static s7_Complex casin(s7_Complex z) -{ - return(-_Complex_I * clog(_Complex_I * z + csqrt(1.0 - z * z))); -} +static s7_Complex casin(s7_Complex z) +{ + return(-_Complex_I * clog(_Complex_I * z + csqrt(1.0 - z * z))); +} -static s7_Complex cacos(s7_Complex z) -{ - return(-_Complex_I * clog(z + _Complex_I * csqrt(1.0 - z * z))); -} +static s7_Complex cacos(s7_Complex z) +{ + return(-_Complex_I * clog(z + _Complex_I * csqrt(1.0 - z * z))); +} -static s7_Complex catan(s7_Complex z) -{ - return(_Complex_I * clog((_Complex_I + z) / (_Complex_I - z)) / 2.0); -} +static s7_Complex catan(s7_Complex z) +{ + return(_Complex_I * clog((_Complex_I + z) / (_Complex_I - z)) / 2.0); +} -static s7_Complex casinh(s7_Complex z) -{ - return(clog(z + csqrt(1.0 + z * z))); -} +static s7_Complex casinh(s7_Complex z) +{ + return(clog(z + csqrt(1.0 + z * z))); +} -static s7_Complex cacosh(s7_Complex z) -{ - return(clog(z + csqrt(z * z - 1.0))); +static s7_Complex cacosh(s7_Complex z) +{ + return(clog(z + csqrt(z * z - 1.0))); /* perhaps less prone to numerical troubles (untested): * 2.0 * clog(csqrt(0.5 * (z + 1.0)) + csqrt(0.5 * (z - 1.0))) */ -} +} -static s7_Complex catanh(s7_Complex z) -{ - return(clog((1.0 + z) / (1.0 - z)) / 2.0); -} +static s7_Complex catanh(s7_Complex z) +{ + return(clog((1.0 + z) / (1.0 - z)) / 2.0); +} #endif #else @@ -2887,20 +2887,20 @@ bool s7_is_number(s7_pointer p) } -bool s7_is_integer(s7_pointer p) -{ +bool s7_is_integer(s7_pointer p) +{ if (!(s7_is_number(p))) return(false); - + return(number_type(p) == NUM_INT); } -bool s7_is_real(s7_pointer p) -{ +bool s7_is_real(s7_pointer p) +{ if (!(s7_is_number(p))) return(false); - + return(number_type(p) < NUM_COMPLEX); } @@ -2909,7 +2909,7 @@ bool s7_is_rational(s7_pointer p) { if (!(s7_is_number(p))) return(false); - + return(number_type(p) <= NUM_RATIO); } @@ -2918,7 +2918,7 @@ bool s7_is_ratio(s7_pointer p) { if (!(s7_is_number(p))) return(false); - + return(number_type(p) == NUM_RATIO); } @@ -2928,7 +2928,7 @@ bool s7_is_complex(s7_pointer p) return(s7_is_number(p)); } -#endif +#endif /* WITH_GMP */ @@ -2959,7 +2959,7 @@ static s7_Int c_mod(s7_Int x, s7_Int y) static s7_Int c_gcd(s7_Int u, s7_Int v) { s7_Int a, b, temp; - + a = s7_Int_abs(u); b = s7_Int_abs(v); while (b != 0) @@ -3009,7 +3009,7 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * (set! r (min (floor (/ e0 e1)) (ceiling (/ e0p e1p))))))))) */ - + s7_Double x0, x1, val; s7_Int i, i0, i1, r, r1, p0, q0, p1, q1; s7_Double e0, e1, e0p, e1p; @@ -3021,7 +3021,7 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * x0 = ux - error; x1 = ux + error; i = (s7_Int)ceil(x0); - + if (error >= 1.0) /* aw good grief! */ { if (x0 < 0) @@ -3037,7 +3037,7 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * (*denom) = 1; return(true); } - + if (x1 >= i) { if (i >= 0) @@ -3050,10 +3050,10 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * i0 = (s7_Int)floor(x0); i1 = (s7_Int)ceil(x1); - p0 = i0; + p0 = i0; q0 = 1; - p1 = i1; - q1 = 1; + p1 = i1; + q1 = 1; e0 = i1 - x0; e1 = x0 - i0; e0p = i1 - x1; @@ -3062,7 +3062,7 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * while (true) { val = (double)p0 / (double)q0; - + if ((x0 <= val) && (val <= x1)) { (*numer) = p0; @@ -3098,16 +3098,16 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * * Bill Gosper's farint: (define* (farint x (err 1/1000000)) - + (define* (farint-1 x nhi dhi (ln 0) (ld 1) (hn 1) (hd 0)) (if (> (+ ln hn) (* (+ ld hd) x)) - (let* ((m (min (if (= 0 ln) - nhi + (let* ((m (min (if (= 0 ln) + nhi (floor (/ (- nhi hn) ln))) (floor (/ (- dhi hd) ld)))) (d (- (* x ld) ln)) - (k (if (= 0 d) - m + (k (if (= 0 d) + m (ceiling (/ (- hn (* x hd)) d))))) (if (< k m) (let ((hn1 (+ (* k ln) hn)) @@ -3116,16 +3116,16 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * (let* ((n (+ (* m ln) hn)) (d (+ (* m ld) hd))) (if (< (* 2 d ld x) (+ (* ld n) (* ln d))) - (/ ln ld) + (/ ln ld) (/ n d))))) (let* ((m (min (floor (/ (- nhi ln) hn)) - (if (= 0 hd) - dhi + (if (= 0 hd) + dhi (floor (/ (- dhi ld) hd))))) (d (- hn (* x hd))) - (k (if (= 0 d) - m + (k (if (= 0 d) + m (ceiling (/ (- (* x ld) ln) d))))) (if (< k m) (let ((ln1 (+ (* k hn) ln)) @@ -3133,7 +3133,7 @@ static bool c_rationalize(s7_Double ux, s7_Double error, s7_Int *numer, s7_Int * (farint-1 x nhi dhi (- ln1 hn) (- ld1 hd) ln1 ld1)) (let* ((n (+ (* m hn) ln)) (d (+ (* m hd) ld))) (if (< (* 2 d hd x) (+ (* hd n) (* hn d))) - (/ n d) + (/ n d) (/ hn hd))))))) (farint-1 x (/ err) (/ err))) @@ -3208,20 +3208,20 @@ static s7_num_t make_ratio(s7_Int numer, s7_Int denom) integer(ret) = 0; return(ret); } - + if (denom < 0) { numer = -numer; denom = -denom; } - + divisor = c_gcd(numer, denom); if (divisor != 1) { numer /= divisor; denom /= divisor; } - + if (denom == 1) { ret.type = NUM_INT; @@ -3258,7 +3258,7 @@ static s7_num_t make_complex(s7_Double rl, s7_Double im) return(ret); } -s7_pointer s7_make_integer(s7_scheme *sc, s7_Int n) +s7_pointer s7_make_integer(s7_scheme *sc, s7_Int n) { s7_pointer x; if ((n >= 0) && (n < NUM_SMALL_INTS)) @@ -3268,10 +3268,10 @@ s7_pointer s7_make_integer(s7_scheme *sc, s7_Int n) x = new_cell(sc); set_type(x, T_NUMBER | T_ATOM | T_SIMPLE | T_DONT_COPY); - + number_type(x) = NUM_INT; integer(number(x)) = n; - + return(x); } @@ -3287,7 +3287,7 @@ static s7_pointer make_mutable_integer(s7_scheme *sc, s7_Int n) } -s7_pointer s7_make_real(s7_scheme *sc, s7_Double n) +s7_pointer s7_make_real(s7_scheme *sc, s7_Double n) { s7_pointer x; if (n == 0.0) @@ -3297,10 +3297,10 @@ s7_pointer s7_make_real(s7_scheme *sc, s7_Double n) x = new_cell(sc); set_type(x, T_NUMBER | T_ATOM | T_SIMPLE | T_DONT_COPY); - + number_type(x) = NUM_REAL; real(number(x)) = n; - + return(x); } @@ -3328,7 +3328,7 @@ s7_pointer s7_make_complex(s7_scheme *sc, s7_Double a, s7_Double b) s7_pointer s7_make_ratio(s7_scheme *sc, s7_Int a, s7_Int b) { /* make_number calls us, so we can't call it as a convenience! */ - + s7_num_t ret; s7_pointer x; @@ -3339,7 +3339,7 @@ s7_pointer s7_make_ratio(s7_scheme *sc, s7_Int a, s7_Int b) set_type(x, T_NUMBER | T_ATOM | T_SIMPLE | T_DONT_COPY); ret = make_ratio(a, b); - + number_type(x) = ret.type; if (ret.type == NUM_INT) integer(number(x)) = numerator(ret); @@ -3352,7 +3352,7 @@ s7_pointer s7_make_ratio(s7_scheme *sc, s7_Int a, s7_Int b) } -static s7_pointer make_number(s7_scheme *sc, s7_num_t n) +static s7_pointer make_number(s7_scheme *sc, s7_num_t n) { /* using pointers rather than (presumably copied) structs here slowed us down? */ switch (num_type(n)) @@ -3378,7 +3378,7 @@ static double default_rationalize_error = 1.0e-12; static s7_pointer inexact_to_exact(s7_scheme *sc, s7_pointer x) { - if ((s7_is_real(x)) && + if ((s7_is_real(x)) && (!s7_is_rational(x))) { s7_Int numer = 0, denom = 1; @@ -3456,23 +3456,23 @@ static s7_pointer s7_from_c_complex(s7_scheme *sc, s7_Complex z) } -static s7_num_t num_max(s7_num_t a, s7_num_t b) +static s7_num_t num_max(s7_num_t a, s7_num_t b) { s7_num_t ret; ret.type = a.type | b.type; - + switch (num_type(ret)) { - case NUM_INT: + case NUM_INT: if (integer(a) >= integer(b)) integer(ret) = integer(a); else integer(ret) = integer(b); break; - + case NUM_RATIO: { s7_Int vala, valb; - vala = num_to_numerator(a) / num_to_denominator(a); + vala = num_to_numerator(a) / num_to_denominator(a); valb = num_to_numerator(b) / num_to_denominator(b); if ((vala > valb) || @@ -3490,7 +3490,7 @@ static s7_num_t num_max(s7_num_t a, s7_num_t b) return(b); } break; - + default: if (num_to_real(a) >= num_to_real(b)) real(ret) = num_to_real(a); @@ -3501,23 +3501,23 @@ static s7_num_t num_max(s7_num_t a, s7_num_t b) } -static s7_num_t num_min(s7_num_t a, s7_num_t b) +static s7_num_t num_min(s7_num_t a, s7_num_t b) { s7_num_t ret; ret.type = a.type | b.type; - + switch (num_type(ret)) { - case NUM_INT: + case NUM_INT: if (integer(a) < integer(b)) integer(ret) = integer(a); else integer(ret) = integer(b); break; - + case NUM_RATIO: { s7_Int vala, valb; - vala = num_to_numerator(a) / num_to_denominator(a); + vala = num_to_numerator(a) / num_to_denominator(a); valb = num_to_numerator(b) / num_to_denominator(b); if ((vala < valb) || @@ -3535,7 +3535,7 @@ static s7_num_t num_min(s7_num_t a, s7_num_t b) return(b); } break; - + default: if (num_to_real(a) < num_to_real(b)) real(ret) = num_to_real(a); @@ -3549,13 +3549,13 @@ static s7_num_t num_min(s7_num_t a, s7_num_t b) static int integer_length(s7_Int a) { static int bits[256] = - {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, - 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, - 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + {0, 1, 2, 2, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, + 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, + 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 8}; #define I_8 256LL @@ -3580,17 +3580,17 @@ static int integer_length(s7_Int a) static int s7_int_max = 0, s7_int_min = 0, s7_int_bits = 0, s7_int_digits = 0; /* initialized later */ -static s7_num_t num_add(s7_num_t a, s7_num_t b) +static s7_num_t num_add(s7_num_t a, s7_num_t b) { s7_num_t ret; ret.type = a.type | b.type; - + switch (num_type(ret)) { - case NUM_INT: + case NUM_INT: integer(ret) = integer(a) + integer(b); break; - + case NUM_RATIO: { s7_Int d1, d2, n1, n2; @@ -3618,12 +3618,12 @@ static s7_num_t num_add(s7_num_t a, s7_num_t b) return(make_ratio(n1 * d2 + n2 * d1, d1 * d2)); } break; - + case NUM_REAL2: case NUM_REAL: real(ret) = num_to_real(a) + num_to_real(b); break; - + default: /* NUM_COMPLEX is 4 separate types */ return(make_complex(num_to_real_part(a) + num_to_real_part(b), @@ -3638,23 +3638,23 @@ static s7_num_t num_negate(s7_num_t a) { s7_num_t ret; ret.type = a.type; - + switch (num_type(ret)) { - case NUM_INT: + case NUM_INT: integer(ret) = -integer(a); break; - + case NUM_RATIO: numerator(ret) = -numerator(a); denominator(ret) = denominator(a); break; - + case NUM_REAL2: case NUM_REAL: real(ret) = -real(a); break; - + default: real_part(ret) = -real_part(a); imag_part(ret) = -imag_part(a); @@ -3664,17 +3664,17 @@ static s7_num_t num_negate(s7_num_t a) } -static s7_num_t num_sub(s7_num_t a, s7_num_t b) +static s7_num_t num_sub(s7_num_t a, s7_num_t b) { s7_num_t ret; ret.type = a.type | b.type; - + switch (num_type(ret)) { - case NUM_INT: + case NUM_INT: integer(ret) = integer(a) - integer(b); break; - + case NUM_RATIO: { s7_Int d1, d2, n1, n2; @@ -3703,12 +3703,12 @@ static s7_num_t num_sub(s7_num_t a, s7_num_t b) return(make_ratio(n1 * d2 - n2 * d1, d1 * d2)); } break; - + case NUM_REAL2: case NUM_REAL: real(ret) = num_to_real(a) - num_to_real(b); break; - + default: return(make_complex(num_to_real_part(a) - num_to_real_part(b), num_to_imag_part(a) - num_to_imag_part(b))); @@ -3718,17 +3718,17 @@ static s7_num_t num_sub(s7_num_t a, s7_num_t b) } -static s7_num_t num_mul(s7_num_t a, s7_num_t b) +static s7_num_t num_mul(s7_num_t a, s7_num_t b) { s7_num_t ret; ret.type = a.type | b.type; - + switch (num_type(ret)) { - case NUM_INT: + case NUM_INT: integer(ret) = integer(a) * integer(b); break; - + case NUM_RATIO: { s7_Int d1, d2, n1, n2; @@ -3749,12 +3749,12 @@ static s7_num_t num_mul(s7_num_t a, s7_num_t b) return(make_ratio(n1 * n2, d1 * d2)); } break; - + case NUM_REAL2: case NUM_REAL: real(ret) = num_to_real(a) * num_to_real(b); break; - + default: { s7_Double r1, r2, i1, i2; @@ -3762,7 +3762,7 @@ static s7_num_t num_mul(s7_num_t a, s7_num_t b) r2 = num_to_real_part(b); i1 = num_to_imag_part(a); i2 = num_to_imag_part(b); - return(make_complex(r1 * r2 - i1 * i2, + return(make_complex(r1 * r2 - i1 * i2, r1 * i2 + r2 * i1)); } break; @@ -3777,7 +3777,7 @@ static s7_num_t num_invert(s7_num_t a) case NUM_INT: /* a already checked, not 0 */ return(make_ratio(1, integer(a))); - + case NUM_RATIO: return(make_ratio(denominator(a), numerator(a))); @@ -3797,17 +3797,17 @@ static s7_num_t num_invert(s7_num_t a) } -static s7_num_t num_div(s7_num_t a, s7_num_t b) +static s7_num_t num_div(s7_num_t a, s7_num_t b) { s7_num_t ret; ret.type = a.type | b.type; - + switch (num_type(ret)) { - case NUM_INT: + case NUM_INT: /* b checked for 0 below */ return(make_ratio(integer(a), integer(b))); - + case NUM_RATIO: { s7_Int d1, d2, n1, n2; @@ -3831,7 +3831,7 @@ static s7_num_t num_div(s7_num_t a, s7_num_t b) return(make_ratio(n1 * d2, d1 * n2)); } break; - + case NUM_REAL2: case NUM_REAL: { @@ -3840,7 +3840,7 @@ static s7_num_t num_div(s7_num_t a, s7_num_t b) real(ret) = num_to_real(a) / rb; } break; - + default: { s7_Double r1, r2, i1, i2, den; @@ -3853,7 +3853,7 @@ static s7_num_t num_div(s7_num_t a, s7_num_t b) } break; } - + return(ret); } @@ -3866,7 +3866,7 @@ static s7_Int s7_truncate(s7_Double xf) } -static s7_num_t num_quotient(s7_num_t a, s7_num_t b) +static s7_num_t num_quotient(s7_num_t a, s7_num_t b) { /* (define (quo x1 x2) (truncate (/ x1 x2))) ; slib */ s7_num_t ret; @@ -3878,19 +3878,19 @@ static s7_num_t num_quotient(s7_num_t a, s7_num_t b) } -static s7_num_t num_rem(s7_num_t a, s7_num_t b) +static s7_num_t num_rem(s7_num_t a, s7_num_t b) { /* (define (rem x1 x2) (- x1 (* x2 (quo x1 x2)))) ; slib */ s7_num_t ret; ret.type = a.type | b.type; switch (ret.type) { - case NUM_INT: + case NUM_INT: integer(ret) = integer(a) % integer(b); break; - case NUM_RATIO: - return(make_ratio(num_to_numerator(a) * num_to_denominator(b) - + case NUM_RATIO: + return(make_ratio(num_to_numerator(a) * num_to_denominator(b) - num_to_numerator(b) * num_to_denominator(a) * integer(num_quotient(a, b)), num_to_denominator(a) * num_to_denominator(b))); break; @@ -3903,7 +3903,7 @@ static s7_num_t num_rem(s7_num_t a, s7_num_t b) } -static s7_num_t num_mod(s7_num_t a, s7_num_t b) +static s7_num_t num_mod(s7_num_t a, s7_num_t b) { /* (define (mod x1 x2) (- x1 (* x2 (floor (/ x1 x2))))) ; slib */ s7_num_t ret; @@ -3915,7 +3915,7 @@ static s7_num_t num_mod(s7_num_t a, s7_num_t b) break; case NUM_RATIO: - return(make_ratio(num_to_numerator(a) * num_to_denominator(b) - + return(make_ratio(num_to_numerator(a) * num_to_denominator(b) - num_to_numerator(b) * num_to_denominator(a) * (s7_Int)floor(num_to_real(a) / num_to_real(b)), num_to_denominator(a) * num_to_denominator(b))); break; @@ -3928,27 +3928,27 @@ static s7_num_t num_mod(s7_num_t a, s7_num_t b) } -static bool num_eq(s7_num_t a, s7_num_t b) +static bool num_eq(s7_num_t a, s7_num_t b) { switch (num_type(a)) { case NUM_INT: switch (num_type(b)) { - case NUM_INT: + case NUM_INT: return(integer(a) == integer(b)); case NUM_RATIO: return(false); case NUM_REAL: case NUM_REAL2: return(integer(a) == real(b)); - default: + default: return((real_part(b) == integer(a)) && (imag_part(b) == 0.0)); } break; - - case NUM_RATIO: + + case NUM_RATIO: switch (num_type(b)) { case NUM_RATIO: @@ -3966,7 +3966,7 @@ static bool num_eq(s7_num_t a, s7_num_t b) #t :(= 245850922/78256779 884279719003555/281474976710656) #f - + should I rationalize the float before the comparison? These results are not incorrect (pace r6rs) -- if you use a float, it infects the rest of the numbers, as anywhere else. */ @@ -3974,9 +3974,9 @@ static bool num_eq(s7_num_t a, s7_num_t b) return(false); } break; - + case NUM_REAL2: - case NUM_REAL: + case NUM_REAL: switch (num_type(b)) { case NUM_INT: @@ -3991,7 +3991,7 @@ static bool num_eq(s7_num_t a, s7_num_t b) (imag_part(b) == 0.0)); } break; - + default: switch (num_type(b)) { @@ -4015,7 +4015,7 @@ static bool num_eq(s7_num_t a, s7_num_t b) } -static bool num_gt(s7_num_t a, s7_num_t b) +static bool num_gt(s7_num_t a, s7_num_t b) { /* the ">" operator here is a problem. * we get different results depending on the gcc optimization level for cases like (< 1234/11 1234/11) @@ -4024,7 +4024,7 @@ static bool num_gt(s7_num_t a, s7_num_t b) * #f */ s7_num_t val; - if ((num_type(a) == NUM_INT) && + if ((num_type(a) == NUM_INT) && (num_type(b) == NUM_INT)) return(integer(a) > integer(b)); @@ -4036,7 +4036,7 @@ static bool num_gt(s7_num_t a, s7_num_t b) default: return(real(val) > 0.0); } -#if 0 +#if 0 /* this is the flakey version */ if ((num_type(a) == NUM_INT) && (num_type(b) == NUM_INT)) @@ -4046,10 +4046,10 @@ static bool num_gt(s7_num_t a, s7_num_t b) } -static bool num_lt(s7_num_t a, s7_num_t b) +static bool num_lt(s7_num_t a, s7_num_t b) { s7_num_t val; - if ((num_type(a) == NUM_INT) && + if ((num_type(a) == NUM_INT) && (num_type(b) == NUM_INT)) return(integer(a) < integer(b)); @@ -4063,25 +4063,25 @@ static bool num_lt(s7_num_t a, s7_num_t b) } -static bool num_ge(s7_num_t a, s7_num_t b) +static bool num_ge(s7_num_t a, s7_num_t b) { return(!num_lt(a, b)); } -static bool num_le(s7_num_t a, s7_num_t b) +static bool num_le(s7_num_t a, s7_num_t b) { return(!num_gt(a, b)); } -static s7_Double round_per_R5RS(s7_Double x) +static s7_Double round_per_R5RS(s7_Double x) { s7_Double fl = floor(x); s7_Double ce = ceil(x); s7_Double dfl = x - fl; s7_Double dce = ce - x; - + if (dfl > dce) return(ce); if (dfl < dce) return(fl); if (fmod(fl, 2.0) == 0.0) return(fl); @@ -4172,7 +4172,7 @@ static void s7_Int_to_string(char *p, s7_Int n, int radix, int width) { start = width - len - 1; end += start; - for (i = 0; i < start; i++) + for (i = 0; i < start; i++) p[i] = ' '; } @@ -4204,18 +4204,18 @@ static char *s7_number_to_string_base_10(s7_pointer obj, int width, int precisio { case NUM_INT: p = (char *)malloc(64 * sizeof(char)); - snprintf(p, 64, + snprintf(p, 64, (sizeof(int) >= sizeof(s7_Int)) ? "%*d" : "%*lld", width, s7_integer(obj)); break; - + case NUM_RATIO: p = (char *)malloc(128 * sizeof(char)); snprintf(p, 128, - (sizeof(int) >= sizeof(s7_Int)) ? "%d/%d" : "%lld/%lld", + (sizeof(int) >= sizeof(s7_Int)) ? "%d/%d" : "%lld/%lld", s7_numerator(obj), s7_denominator(obj)); break; - + case NUM_REAL2: case NUM_REAL: { @@ -4236,7 +4236,7 @@ static char *s7_number_to_string_base_10(s7_pointer obj, int width, int precisio } if (loc == -1) /* no, so make it explicitly a float! */ { - for (i = 0; i < len; i++) + for (i = 0; i < len; i++) if (p[i] == '.') break; if (i == len) { @@ -4247,7 +4247,7 @@ static char *s7_number_to_string_base_10(s7_pointer obj, int width, int precisio } } break; - + default: { const char *frmt; @@ -4256,10 +4256,10 @@ static char *s7_number_to_string_base_10(s7_pointer obj, int width, int precisio if (sizeof(double) >= sizeof(s7_Double)) { if (s7_imag_part(obj) >= 0.0) - frmt = (float_choice == 'g') ? "%.*g+%.*gi" : ((float_choice == 'f') ? "%.*f+%.*fi" : "%.*e+%.*ei"); + frmt = (float_choice == 'g') ? "%.*g+%.*gi" : ((float_choice == 'f') ? "%.*f+%.*fi" : "%.*e+%.*ei"); else frmt = (float_choice == 'g') ? "%.*g%.*gi" : ((float_choice == 'f') ? "%.*f-%.*fi" :"%.*e-%.*ei"); } - else + else { if (s7_imag_part(obj) >= 0.0) frmt = (float_choice == 'g') ? "%.*Lg+%.*Lgi" : ((float_choice == 'f') ? "%.*Lf+%.*Lfi" : "%.*Le+%.*Lei"); @@ -4292,7 +4292,7 @@ static char *s7_number_to_string_with_radix(s7_scheme *sc, s7_pointer obj, int r p = (char *)malloc(128 * sizeof(char)); s7_Int_to_string(p, s7_integer(obj), radix, width); break; - + case NUM_RATIO: { n = (char *)malloc(128 * sizeof(char)); @@ -4305,7 +4305,7 @@ static char *s7_number_to_string_with_radix(s7_scheme *sc, s7_pointer obj, int r free(d); } break; - + case NUM_REAL2: case NUM_REAL: { @@ -4353,7 +4353,7 @@ static char *s7_number_to_string_with_radix(s7_scheme *sc, s7_pointer obj, int r free(n); free(d); break; - + } return(p); } @@ -4413,7 +4413,7 @@ static s7_pointer g_number_to_string(s7_scheme *sc, s7_pointer args) res = s7_number_to_string_with_radix(sc, x, radix, 0, (radix == 10) ? size : 20, 'g'); } else res = s7_number_to_string_base_10(x, 0, size, 'g'); - + { s7_pointer y; y = s7_make_string(sc, res); @@ -4435,7 +4435,7 @@ static void init_ctables(void) exponent_table = (bool *)calloc(CTABLE_SIZE, sizeof(bool)); slashify_table = (bool *)calloc(CTABLE_SIZE, sizeof(bool)); string_delimiter_table = (bool *)calloc(CTABLE_SIZE, sizeof(bool)); - + dot_table['\n'] = true; dot_table['\t'] = true; dot_table[' '] = true; @@ -4444,9 +4444,9 @@ static void init_ctables(void) dot_table['#'] = true; dot_table['\\'] = true; dot_table['\''] = true; - + exponent_table['e'] = true; exponent_table['E'] = true; - exponent_table['s'] = true; exponent_table['S'] = true; + exponent_table['s'] = true; exponent_table['S'] = true; exponent_table['f'] = true; exponent_table['F'] = true; exponent_table['d'] = true; exponent_table['D'] = true; exponent_table['l'] = true; exponent_table['L'] = true; @@ -4502,7 +4502,7 @@ static bool is_radix_prefix(char prefix) } -static s7_pointer make_sharp_constant(s7_scheme *sc, char *name, bool at_top) +static s7_pointer make_sharp_constant(s7_scheme *sc, char *name, bool at_top) { /* name is the stuff after the '#', return sc->NIL if not a recognized #... entity */ int len; @@ -4510,17 +4510,17 @@ static s7_pointer make_sharp_constant(s7_scheme *sc, char *name, bool at_top) if (strcmp(name, "t") == 0) return(sc->T); - + if (strcmp(name, "f") == 0) return(sc->F); - + len = strlen(name); if (len == 0) return(sc->NIL); if (len < 2) /* # (except ':', sigh) is an error in this scheme */ return(sc->NIL); - + switch (name[0]) { case 'o': /* #o (octal) */ @@ -4530,7 +4530,7 @@ static s7_pointer make_sharp_constant(s7_scheme *sc, char *name, bool at_top) { bool to_inexact = false, to_exact = false; int num_at = 1; - + if (name[1] == '#') { if (!at_top) @@ -4577,7 +4577,7 @@ static s7_pointer make_sharp_constant(s7_scheme *sc, char *name, bool at_top) if (s7_is_number(x)) return(exact_to_inexact(sc, x)); return(sc->NIL); - + case 'e': /* #e = ->exact */ if (name[1] == '#') { @@ -4598,40 +4598,40 @@ static s7_pointer make_sharp_constant(s7_scheme *sc, char *name, bool at_top) case '\\': /* #\space or whatever (named character) */ - { + { int c = 0; - if (strcmp(name + 1, "space") == 0) + if (strcmp(name + 1, "space") == 0) c =' '; - else + else { if ((strcmp(name + 1, "newline") == 0) || (strcmp(name + 1, "linefeed") == 0)) c ='\n'; - else + else { - if (strcmp(name + 1, "return") == 0) + if (strcmp(name + 1, "return") == 0) c ='\r'; - else + else { - if (strcmp(name + 1, "tab") == 0) + if (strcmp(name + 1, "tab") == 0) c ='\t'; - else + else { if ((strcmp(name + 1, "null") == 0) || (strcmp(name + 1, "nul") == 0)) c ='\0'; - else + else { - if ((name[1] == 'x') && + if ((name[1] == 'x') && (name[2] != 0)) /* #\x is just x, but apparently #\x is int->char? #\x65 -> #\e */ { int c1 = 0; - if ((sscanf(name + 2, "%x", &c1) == 1) && + if ((sscanf(name + 2, "%x", &c1) == 1) && (c1 < 256)) c = c1; else return(sc->NIL); /* #\xx -> "undefined sharp expression" */ } - else + else { - if (name[2] == 0) + if (name[2] == 0) c = name[1]; else return(sc->NIL); }}}}}} @@ -4651,7 +4651,7 @@ static s7_Double string_to_double_with_radix(char *str, int radix) long long int int_part = 0, frac_part = 0, exponent = 0; /* there's an ambiguity in number notation here if we allow "1e1" or "1.e1" in base 16 (or 15) -- is e a digit or an exponent marker? - * but 1e+1, for example disambiguates it -- kind of messy! -- the scheme spec says "e" can only occur in base 10. + * but 1e+1, for example disambiguates it -- kind of messy! -- the scheme spec says "e" can only occur in base 10. * mpfr says "e" as exponent only in bases <= 10 -- else use '@' which works in any base. This can only cause confusion * in scheme, unfortunately, due to the idiotic scheme polar notation. So... here the exponent can occur only in * bases <= 10. @@ -4728,7 +4728,7 @@ static s7_Double string_to_double_with_radix(char *str, int radix) /* make symbol or number atom from string */ -static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) +static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) { #define ISDIGIT(Chr, Rad) (digits[(int)Chr] < Rad) @@ -4743,74 +4743,74 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) current_radix = radix; p = q; - c = *p++; - + c = *p++; + /* a number starts with + - . or digit, but so does 1+ for example */ - + if (c == '#') return(make_sharp_constant(sc, p, true)); /* make_sharp_constant expects the '#' to be removed */ - - if ((c == '+') || (c == '-')) - { - c = *p++; - if (c == '.') - { - has_dec_point1 = true; - c = *p++; - } + + if ((c == '+') || (c == '-')) + { + c = *p++; + if (c == '.') + { + has_dec_point1 = true; + c = *p++; + } if (!ISDIGIT(c, current_radix)) return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); - } - else + } + else { if (c == '.') /* .0 */ - { - has_dec_point1 = true; - c = *p++; + { + has_dec_point1 = true; + c = *p++; if (!ISDIGIT(c, current_radix)) - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); - } - else + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + } + else { if (!ISDIGIT(c, current_radix)) - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); } } - - for ( ; (c = *p) != 0; ++p) + + for ( ; (c = *p) != 0; ++p) { - if (!ISDIGIT(c, current_radix)) + if (!ISDIGIT(c, current_radix)) { current_radix = radix; - if (c =='.') + if (c =='.') { if (((has_dec_point1) || (slash1)) && (has_plus_or_minus == 0)) /* 1.. or 1/2. */ - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); if (((has_dec_point2) || (slash2)) && (has_plus_or_minus != 0)) /* 1+1.. or 1+1/2. */ - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); if ((!ISDIGIT(p[1], current_radix)) && - (!ISDIGIT(p[-1], current_radix))) - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); - + (!ISDIGIT(p[-1], current_radix))) + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + if (has_plus_or_minus == 0) has_dec_point1 = true; else has_dec_point2 = true; continue; } - else + else { if (exponent_table[(int)c]) { if (current_radix > 10) - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); /* see note above */ current_radix = 10; @@ -4818,23 +4818,23 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) if (((ex1) || (slash1)) && (has_plus_or_minus == 0)) /* ee */ - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); if (((ex2) || (slash2)) && (has_plus_or_minus != 0)) /* 1+1.0ee */ - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); if ((!ISDIGIT(p[-1], current_radix)) && (p[-1] != '.')) - return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); + return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); if (has_plus_or_minus == 0) { ex1 = p; has_dec_point1 = true; /* decimal point illegal from now on */ } - else + else { ex2 = p; has_dec_point2 = true; @@ -4850,7 +4850,7 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) { if (has_plus_or_minus != 0) /* already have the separator */ return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); - + if (c == '+') has_plus_or_minus = 1; else has_plus_or_minus = -1; plus = (char *)(p + 1); continue; @@ -4870,7 +4870,7 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) (slash2) || (has_dec_point2))) return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); - + if (has_plus_or_minus == 0) slash1 = (char *)(p + 1); else slash2 = (char *)(p + 1); @@ -4883,8 +4883,8 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) } else { - if ((has_plus_or_minus != 0) && - (!has_i) && + if ((has_plus_or_minus != 0) && + (!has_i) && (c == 'i')) { has_i = true; @@ -4897,7 +4897,7 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); } } - + if ((has_plus_or_minus != 0) && (!has_i)) return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); @@ -4911,7 +4911,7 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) int len; char *saved_q; len = strlen(q); - + if (q[len - 1] != 'i') return((want_symbol) ? s7_make_symbol(sc, q) : sc->F); @@ -4921,7 +4921,7 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) if ((q[len - 2] == '+') || (q[len - 2] == '-')) q[len - 1] = '1'; else q[len - 1] = '\0'; /* remove 'i' */ - + if (ex1) (*ex1) = 'e'; if (ex2) (*ex2) = 'e'; (*((char *)(plus - 1))) = '\0'; @@ -4950,7 +4950,7 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) im = (s7_Double)ATOLL(plus) / (s7_Double)ATOLL(slash2); else im = (s7_Double)ATOLL(plus); } - if ((has_plus_or_minus == -1) && + if ((has_plus_or_minus == -1) && (im != 0.0)) im = -im; result = s7_make_complex(sc, rl, im); @@ -4963,7 +4963,7 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) return(result); } - + if ((has_dec_point1) || (ex1)) { @@ -4984,20 +4984,20 @@ static s7_pointer make_atom(s7_scheme *sc, char *q, int radix, bool want_symbol) #else result = string_to_either_real(sc, q, radix); #endif - + if (ex1) (*ex1) = old_e; return(result); } - + if (slash1) #if (!WITH_GMP) return(s7_make_ratio(sc, ATOLL(q), ATOLL(slash1))); #else return(string_to_either_ratio(sc, q, slash1, radix)); #endif - + #if (!WITH_GMP) return(s7_make_integer(sc, ATOLL(q))); #else @@ -5053,7 +5053,7 @@ static bool numbers_are_eqv(s7_pointer a, s7_pointer b) { case NUM_INT: return((integer(number(a)) == integer(number(b)))); - + case NUM_RATIO: return((numerator(number(a)) == numerator(number(b))) && (denominator(number(a)) == denominator(number(b)))); @@ -5061,12 +5061,12 @@ static bool numbers_are_eqv(s7_pointer a, s7_pointer b) case NUM_REAL: case NUM_REAL2: return(real(number(a)) == real(number(b))); - + default: return((real_part(number(a)) == real_part(number(b))) && (imag_part(number(a)) == imag_part(number(b)))); } - + return(false); } @@ -5075,12 +5075,12 @@ static s7_pointer g_make_polar(s7_scheme *sc, s7_pointer args) { s7_Double ang, mag; #define H_make_polar "(make-polar mag ang) returns a complex number with magnitude mag and angle ang" - + if (!s7_is_real(car(args))) return(s7_wrong_type_arg_error(sc, "make-polar", 1, car(args), "a real")); if (!s7_is_real(cadr(args))) return(s7_wrong_type_arg_error(sc, "make-polar", 2, cadr(args), "a real")); - + mag = num_to_real(number(car(args))); ang = num_to_real(number(cadr(args))); if (ang == 0.0) @@ -5094,14 +5094,14 @@ static s7_pointer g_make_polar(s7_scheme *sc, s7_pointer args) static s7_pointer g_make_rectangular(s7_scheme *sc, s7_pointer args) { #define H_make_rectangular "(make-rectangular x1 x2) returns a complex number with real-part x1 and imaginary-part x2" - + if (!s7_is_real(car(args))) return(s7_wrong_type_arg_error(sc, "make-rectangular", 1, car(args), "a real")); if (!s7_is_real(cadr(args))) return(s7_wrong_type_arg_error(sc, "make-rectangular", 2, cadr(args), "a real")); - - return(s7_make_complex(sc, - num_to_real(number(car(args))), + + return(s7_make_complex(sc, + num_to_real(number(car(args))), num_to_real(number(cadr(args))))); } @@ -5123,7 +5123,7 @@ static s7_pointer g_abs(s7_scheme *sc, s7_pointer args) integer(n) = s7_Int_abs(integer(n)); else numerator(n) = s7_Int_abs(numerator(n)); } - return(make_number(sc, n)); + return(make_number(sc, n)); } @@ -5138,7 +5138,7 @@ static s7_pointer g_magnitude(s7_scheme *sc, s7_pointer args) n = number(car(args)); if (num_type(n) < NUM_COMPLEX) return(g_abs(sc, args)); - + return(s7_make_real(sc, hypot(imag_part(n), real_part(n)))); } @@ -5206,7 +5206,7 @@ static s7_pointer g_log(s7_scheme *sc, s7_pointer args) { #define H_log "(log z1 :optional z2) returns log(z1) / log(z2) where z2 (the base) defaults to e: (log 8 2) = 3" s7_pointer x; - + x = car(args); if (!s7_is_number(x)) @@ -5215,7 +5215,7 @@ static s7_pointer g_log(s7_scheme *sc, s7_pointer args) if ((is_pair(cdr(args))) && (!(s7_is_number(cadr(args))))) return(s7_wrong_type_arg_error(sc, "log", 2, cadr(args), "a number")); - + if (is_pair(cdr(args))) { s7_pointer y; @@ -5223,7 +5223,7 @@ static s7_pointer g_log(s7_scheme *sc, s7_pointer args) y = cadr(args); if ((s7_is_zero(y)) || (s7_is_one(y))) return(s7_out_of_range_error(sc, "log", 2, y, "base can't be 0.0 or 1.0")); - + if ((s7_is_real(x)) && (s7_is_real(y)) && (s7_is_positive(x)) && @@ -5324,7 +5324,7 @@ static s7_pointer g_asin(s7_scheme *sc, s7_pointer args) absx = s7_Double_abs(x); if (absx <= 1.0) return(s7_make_real(sc, asin(x))); - + /* otherwise use maxima code: */ recip = 1.0 / absx; result = (M_PI / 2.0) - (_Complex_I * clog(absx * (1.0 + (sqrt(1.0 + recip) * csqrt(1.0 - recip))))); @@ -5346,7 +5346,7 @@ static s7_pointer g_asin(s7_scheme *sc, s7_pointer args) z = s7_complex(n); sq1mz = csqrt(1.0 - z); sq1pz = csqrt(1.0 + z); - return(s7_make_complex(sc, + return(s7_make_complex(sc, atan(s7_real_part(n) / creal(sq1mz * sq1pz)), asinh(cimag(sq1pz * conj(sq1mz))))); } @@ -5373,7 +5373,7 @@ static s7_pointer g_acos(s7_scheme *sc, s7_pointer args) absx = s7_Double_abs(x); if (absx <= 1.0) return(s7_make_real(sc, acos(x))); - + /* else follow maxima again: */ recip = 1.0 / absx; if (x > 0.0) @@ -5394,7 +5394,7 @@ static s7_pointer g_acos(s7_scheme *sc, s7_pointer args) z = s7_complex(n); sq1mz = csqrt(1.0 - z); sq1pz = csqrt(1.0 + z); - return(s7_make_complex(sc, + return(s7_make_complex(sc, 2.0 * atan(creal(sq1mz) / creal(sq1pz)), asinh(cimag(sq1mz * conj(sq1pz))))); } @@ -5417,7 +5417,7 @@ static s7_pointer g_atan(s7_scheme *sc, s7_pointer args) if (s7_is_real(x)) return(s7_make_real(sc, atan(num_to_real(number(x))))); return(s7_from_c_complex(sc, catan(s7_complex(x)))); - } + } y = cadr(args); if (!s7_is_real(x)) @@ -5425,9 +5425,9 @@ static s7_pointer g_atan(s7_scheme *sc, s7_pointer args) if (!s7_is_real(y)) return(s7_wrong_type_arg_error(sc, "atan", 2, y, "a real")); - return(s7_make_real(sc, atan2(num_to_real(number(x)), + return(s7_make_real(sc, atan2(num_to_real(number(x)), num_to_real(number(y))))); -} +} static s7_pointer g_sinh(s7_scheme *sc, s7_pointer args) @@ -5581,8 +5581,8 @@ static s7_Int int_to_int(s7_Int x, s7_Int n) static long long int nth_roots[63] = { - LLONG_MAX, LLONG_MAX, 3037000499LL, 2097151, 55108, 6208, 1448, 511, 234, 127, 78, 52, 38, 28, 22, - 18, 15, 13, 11, 9, 8, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, + LLONG_MAX, LLONG_MAX, 3037000499LL, 2097151, 55108, 6208, 1448, 511, 234, 127, 78, 52, 38, 28, 22, + 18, 15, 13, 11, 9, 8, 7, 7, 6, 6, 5, 5, 5, 4, 4, 4, 4, 3, 3, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2}; static long int_nth_roots[31] = { @@ -5602,7 +5602,7 @@ static s7_pointer g_expt(s7_scheme *sc, s7_pointer args) { #define H_expt "(expt z1 z2) returns z1^z2" s7_pointer n, pw; - + n = car(args); pw = cadr(args); @@ -5644,7 +5644,7 @@ static s7_pointer g_expt(s7_scheme *sc, s7_pointer args) return(s7_make_real(sc, num_to_real(number(n)))); return(n); } - + if (number_type(pw) == NUM_INT) { s7_Int y; @@ -5662,7 +5662,7 @@ static s7_pointer g_expt(s7_scheme *sc, s7_pointer args) x = s7_integer(n); if (x == 1) return(n); - + if (x == -1) { if (s7_Int_abs(y) & 1) @@ -5682,7 +5682,7 @@ static s7_pointer g_expt(s7_scheme *sc, s7_pointer args) if (number_type(n) == NUM_RATIO) { s7_Int nm, dn; - + nm = numerator(number(n)); dn = denominator(number(n)); @@ -5695,7 +5695,7 @@ static s7_pointer g_expt(s7_scheme *sc, s7_pointer args) } } /* occasionally int^rat can be int but it happens so infrequently it's probably not worth checking */ - /* but... it's sad that + /* but... it's sad that * :(expt -8 1/3) * 1+1.7320508075689i ; a real always has a real cbrt -- would be nice to stick to that * ; expts x y [x and y rational] -> a list of values? @@ -5752,13 +5752,13 @@ static s7_pointer g_floor(s7_scheme *sc, s7_pointer args) switch (number_type(x)) { - case NUM_INT: + case NUM_INT: return(x); - case NUM_RATIO: + case NUM_RATIO: { s7_Int val; - val = numerator(number(x)) / denominator(number(x)); + val = numerator(number(x)) / denominator(number(x)); /* C "/" truncates? -- C spec says "truncation toward 0" */ /* we're avoiding "floor" here because the int->double conversion introduces inaccuracies for big numbers */ if (numerator(number(x)) < 0) /* not "val" because it might be truncated to 0 */ @@ -5766,8 +5766,8 @@ static s7_pointer g_floor(s7_scheme *sc, s7_pointer args) return(s7_make_integer(sc, val)); } - default: - return(s7_make_integer(sc, (s7_Int)floor(real(number(x))))); + default: + return(s7_make_integer(sc, (s7_Int)floor(real(number(x))))); } } @@ -5783,7 +5783,7 @@ static s7_pointer g_ceiling(s7_scheme *sc, s7_pointer args) switch (number_type(x)) { - case NUM_INT: + case NUM_INT: return(x); case NUM_RATIO: @@ -5795,8 +5795,8 @@ static s7_pointer g_ceiling(s7_scheme *sc, s7_pointer args) return(s7_make_integer(sc, val + 1)); } - default: - return(s7_make_integer(sc, (s7_Int)ceil(real(number(x))))); + default: + return(s7_make_integer(sc, (s7_Int)ceil(real(number(x))))); } } @@ -5812,14 +5812,14 @@ static s7_pointer g_truncate(s7_scheme *sc, s7_pointer args) switch (number_type(x)) { - case NUM_INT: + case NUM_INT: return(x); - case NUM_RATIO: + case NUM_RATIO: return(s7_make_integer(sc, (s7_Int)(numerator(number(x)) / denominator(number(x))))); /* C "/" already truncates */ - default: - return(s7_make_integer(sc, s7_truncate(real(number(x))))); + default: + return(s7_make_integer(sc, s7_truncate(real(number(x))))); } } @@ -5835,10 +5835,10 @@ static s7_pointer g_round(s7_scheme *sc, s7_pointer args) switch (number_type(x)) { - case NUM_INT: + case NUM_INT: return(x); - case NUM_RATIO: + case NUM_RATIO: { s7_Int truncated, remains; long double frac; @@ -5858,8 +5858,8 @@ static s7_pointer g_round(s7_scheme *sc, s7_pointer args) return(s7_make_integer(sc, truncated)); } - default: - return(s7_make_integer(sc, (s7_Int)round_per_R5RS(num_to_real(number(x))))); + default: + return(s7_make_integer(sc, (s7_Int)round_per_R5RS(num_to_real(number(x))))); } } @@ -5872,14 +5872,14 @@ static s7_pointer g_lcm(s7_scheme *sc, s7_pointer args) bool rats = false; s7_pointer x; - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_rational(car(x))) return(s7_wrong_type_arg_error(sc, "lcm", i, car(x), "an integer or ratio")); else rats = ((rats) || (number_type(car(x)) == NUM_RATIO)); if (!rats) { - for (x = args; x != sc->NIL; x = cdr(x)) + for (x = args; x != sc->NIL; x = cdr(x)) { n = c_lcm(n, s7_integer(car(x))); #if WITH_GMP @@ -5892,7 +5892,7 @@ static s7_pointer g_lcm(s7_scheme *sc, s7_pointer args) return(s7_make_integer(sc, n)); } /* from A Jaffer */ - for (x = args; x != sc->NIL; x = cdr(x)) + for (x = args; x != sc->NIL; x = cdr(x)) { n = c_lcm(n, s7_numerator(car(x))); #if WITH_GMP @@ -5915,14 +5915,14 @@ static s7_pointer g_gcd(s7_scheme *sc, s7_pointer args) s7_Int n = 0, d = 1; s7_pointer x; - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_rational(car(x))) return(s7_wrong_type_arg_error(sc, "gcd", i, car(x), "an integer")); else rats = ((rats) || (number_type(car(x)) == NUM_RATIO)); - + if (!rats) { - for (x = args; x != sc->NIL; x = cdr(x)) + for (x = args; x != sc->NIL; x = cdr(x)) { n = c_gcd(n, s7_integer(car(x))); if (n == 1) @@ -5931,7 +5931,7 @@ static s7_pointer g_gcd(s7_scheme *sc, s7_pointer args) return(s7_make_integer(sc, n)); } /* from A Jaffer */ - for (x = args; x != sc->NIL; x = cdr(x)) + for (x = args; x != sc->NIL; x = cdr(x)) { n = c_gcd(n, s7_numerator(car(x))); d = c_lcm(d, s7_denominator(car(x))); @@ -5946,7 +5946,7 @@ static s7_pointer g_add_unchecked(s7_scheme *sc, s7_pointer args) s7_num_t n; n = number(car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { #if WITH_GMP switch (n.type) @@ -5979,8 +5979,8 @@ static s7_pointer g_add(s7_scheme *sc, s7_pointer args) if (args == sc->NIL) return(small_int(sc, 0)); - - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_number(car(x))) return(s7_wrong_type_arg_error(sc, "+", i, car(x), "a number")); @@ -5994,7 +5994,7 @@ static s7_pointer g_subtract_unchecked(s7_scheme *sc, s7_pointer args) s7_num_t n; n = number(car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { #if WITH_GMP switch (n.type) @@ -6028,8 +6028,8 @@ static s7_pointer g_subtract(s7_scheme *sc, s7_pointer args) for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_number(car(x))) return(s7_wrong_type_arg_error(sc, "-", i, car(x), "a number")); - - if (cdr(args) == sc->NIL) + + if (cdr(args) == sc->NIL) return(make_number(sc, num_negate(number(car(args))))); return(g_subtract_unchecked(sc, args)); @@ -6042,7 +6042,7 @@ static s7_pointer g_multiply_unchecked(s7_scheme *sc, s7_pointer args) s7_num_t n; n = number(car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { #if WITH_GMP switch (n.type) @@ -6075,8 +6075,8 @@ static s7_pointer g_multiply(s7_scheme *sc, s7_pointer args) if (args == sc->NIL) return(small_int(sc, 1)); - - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_number(car(x))) return(s7_wrong_type_arg_error(sc, "*", i, car(x), "a number")); @@ -6152,7 +6152,7 @@ static s7_pointer g_max(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "max", 1, car(args), "a real")); n = number(car(args)); - for (i = 2, x = cdr(args); x != sc->NIL; i++, x = cdr(x)) + for (i = 2, x = cdr(args); x != sc->NIL; i++, x = cdr(x)) { if (!s7_is_real(car(x))) return(s7_wrong_type_arg_error(sc, "max", i, car(x), "a real")); @@ -6173,7 +6173,7 @@ static s7_pointer g_min(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "min", 1, car(args), "a real")); n = number(car(args)); - for (i = 2, x = cdr(args); x != sc->NIL; i++, x = cdr(x)) + for (i = 2, x = cdr(args); x != sc->NIL; i++, x = cdr(x)) { if (!s7_is_real(car(x))) return(s7_wrong_type_arg_error(sc, "min", i, car(x), "a real")); @@ -6186,7 +6186,7 @@ static s7_pointer g_min(s7_scheme *sc, s7_pointer args) static s7_pointer g_quotient(s7_scheme *sc, s7_pointer args) { #define H_quotient "(quotient x1 x2) returns the integer quotient of x1 and x2; (quotient 4 3) = 1" - + if (!s7_is_real(car(args))) return(s7_wrong_type_arg_error(sc, "quotient", 1, car(args), "a real")); if (!s7_is_real(cadr(args))) @@ -6201,14 +6201,14 @@ static s7_pointer g_quotient(s7_scheme *sc, s7_pointer args) static s7_pointer g_remainder(s7_scheme *sc, s7_pointer args) { #define H_remainder "(remainder x1 x2) returns the integer remainder of x1 and x2; (remainder 10 3) = 1" - + if (!s7_is_real(car(args))) return(s7_wrong_type_arg_error(sc, "remainder", 1, car(args), "a real")); if (!s7_is_real(cadr(args))) return(s7_wrong_type_arg_error(sc, "remainder", 2, cadr(args), "a real")); - if (s7_is_zero(cadr(args))) + if (s7_is_zero(cadr(args))) return(s7_division_by_zero_error(sc, "remainder", args)); - + return(make_number(sc, num_rem(number(car(args)), number(cadr(args))))); } @@ -6216,7 +6216,7 @@ static s7_pointer g_remainder(s7_scheme *sc, s7_pointer args) static s7_pointer g_modulo(s7_scheme *sc, s7_pointer args) { #define H_modulo "(modulo x1 x2) returns x1 mod x2; (modulo 4 3) = 1. The arguments can be real numbers." - + if (!s7_is_real(car(args))) return(s7_wrong_type_arg_error(sc, "modulo", 1, car(args), "a real")); if (!s7_is_real(cadr(args))) @@ -6240,11 +6240,11 @@ static s7_pointer g_equal(s7_scheme *sc, s7_pointer args) for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_number(car(x))) return(s7_wrong_type_arg_error(sc, "=", i, car(x), "a number")); - + n = number(car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { - if (!num_eq(n, number(car(x)))) + if (!num_eq(n, number(car(x)))) return(sc->F); n = number(car(x)); } @@ -6270,15 +6270,15 @@ static s7_pointer compare_numbers(s7_scheme *sc, compare_t op, s7_pointer args) case N_LESS_OR_EQUAL: comp_func = num_le; op_name = "<="; break; case N_GREATER_OR_EQUAL: comp_func = num_ge; op_name = ">="; break; } - + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_real(car(x))) return(s7_wrong_type_arg_error(sc, op_name, i, car(x), "a real")); - + n = number(car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { - if (!comp_func(n, number(car(x)))) + if (!comp_func(n, number(car(x)))) return(sc->F); n = number(car(x)); } @@ -6358,35 +6358,35 @@ static s7_pointer g_denominator(s7_scheme *sc, s7_pointer args) } -static s7_pointer g_is_number(s7_scheme *sc, s7_pointer args) +static s7_pointer g_is_number(s7_scheme *sc, s7_pointer args) { #define H_is_number "(number? obj) returns #t if obj is a number" return(make_boolean(sc, s7_is_number(car(args)))); } -static s7_pointer g_is_integer(s7_scheme *sc, s7_pointer args) +static s7_pointer g_is_integer(s7_scheme *sc, s7_pointer args) { #define H_is_integer "(integer? obj) returns #t if obj is an integer" return(make_boolean(sc, s7_is_integer(car(args)))); } -static s7_pointer g_is_real(s7_scheme *sc, s7_pointer args) +static s7_pointer g_is_real(s7_scheme *sc, s7_pointer args) { #define H_is_real "(real? obj) returns #t if obj is a real number" return(make_boolean(sc, s7_is_real(car(args)))); } -static s7_pointer g_is_complex(s7_scheme *sc, s7_pointer args) +static s7_pointer g_is_complex(s7_scheme *sc, s7_pointer args) { #define H_is_complex "(complex? obj) returns #t if obj is a complex number" return(make_boolean(sc, s7_is_complex(car(args)))); } -static s7_pointer g_is_rational(s7_scheme *sc, s7_pointer args) +static s7_pointer g_is_rational(s7_scheme *sc, s7_pointer args) { #define H_is_rational "(rational? obj) returns #t if obj is a rational number" return(make_boolean(sc, s7_is_rational(car(args)))); @@ -6474,48 +6474,48 @@ static s7_pointer g_is_inexact(s7_scheme *sc, s7_pointer args) } -bool s7_is_ulong(s7_pointer arg) +bool s7_is_ulong(s7_pointer arg) { return(s7_is_integer(arg)); } -unsigned long s7_ulong(s7_pointer p) +unsigned long s7_ulong(s7_pointer p) { return(number(p).value.ul_value); } -s7_pointer s7_make_ulong(s7_scheme *sc, unsigned long n) +s7_pointer s7_make_ulong(s7_scheme *sc, unsigned long n) { s7_pointer x; x = new_cell(sc); set_type(x, T_NUMBER | T_ATOM | T_SIMPLE | T_DONT_COPY); - + number_type(x) = NUM_INT; number(x).value.ul_value = n; return(x); } -bool s7_is_ulong_long(s7_pointer arg) +bool s7_is_ulong_long(s7_pointer arg) { return(s7_is_integer(arg)); } -unsigned long long s7_ulong_long(s7_pointer p) +unsigned long long s7_ulong_long(s7_pointer p) { return(number(p).value.ull_value); } -s7_pointer s7_make_ulong_long(s7_scheme *sc, unsigned long long n) +s7_pointer s7_make_ulong_long(s7_scheme *sc, unsigned long long n) { s7_pointer x; x = new_cell(sc); set_type(x, T_NUMBER | T_ATOM | T_SIMPLE | T_DONT_COPY); - + number_type(x) = NUM_INT; number(x).value.ull_value = n; return(x); @@ -6528,7 +6528,7 @@ static s7_pointer g_integer_length(s7_scheme *sc, s7_pointer args) s7_Int x; if (!s7_is_integer(car(args))) return(s7_wrong_type_arg_error(sc, "integer-length", 0, car(args), "an integer")); - + x = s7_integer(car(args)); if (x < 0) return(s7_make_integer(sc, integer_length(-(x + 1)))); @@ -6540,7 +6540,7 @@ static s7_pointer g_logior(s7_scheme *sc, s7_pointer args) { #define H_logior "(logior i1 ...) returns the bitwise OR of its integer arguments" s7_Int result = 0; - int i; + int i; s7_pointer x; for (i = 0, x = args; x != sc->NIL; i++, x = cdr(x)) @@ -6602,7 +6602,7 @@ static s7_pointer g_ash(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "ash", 1, car(args), "an integer")); if (!s7_is_integer(cadr(args))) return(s7_wrong_type_arg_error(sc, "ash", 2, cadr(args), "an integer")); - + arg1 = s7_integer(car(args)); if (arg1 == 0) return(small_int(sc, 0)); @@ -6657,7 +6657,7 @@ static bool equal_rng(void *val1, void *val2) return(val1 == val2); } - + static s7_pointer g_make_random_state(s7_scheme *sc, s7_pointer args) { #define H_make_random_state "(make-random-state seed) returns a new random number state initialized with 'seed'" @@ -6689,18 +6689,18 @@ static s7_pointer copy_random_state(s7_scheme *sc, s7_pointer obj) #if HAVE_PTHREADS static pthread_mutex_t rng_lock = PTHREAD_MUTEX_INITIALIZER; #endif - + static double next_random(s7_rng_t *r) { - /* The multiply-with-carry generator for 32-bit integers: - * x(n)=a*x(n-1) + carry mod 2^32 - * Choose multiplier a from this list: - * 1791398085 1929682203 1683268614 1965537969 1675393560 - * 1967773755 1517746329 1447497129 1655692410 1606218150 - * 2051013963 1075433238 1557985959 1781943330 1893513180 - * 1631296680 2131995753 2083801278 1873196400 1554115554 - * ( or any 'a' for which both a*2^32-1 and a*2^31-1 are prime) + /* The multiply-with-carry generator for 32-bit integers: + * x(n)=a*x(n-1) + carry mod 2^32 + * Choose multiplier a from this list: + * 1791398085 1929682203 1683268614 1965537969 1675393560 + * 1967773755 1517746329 1447497129 1655692410 1606218150 + * 2051013963 1075433238 1557985959 1781943330 1893513180 + * 1631296680 2131995753 2083801278 1873196400 1554115554 + * ( or any 'a' for which both a*2^32-1 and a*2^31-1 are prime) */ double result; unsigned long long int temp; @@ -6750,7 +6750,7 @@ static s7_pointer g_random(s7_scheme *sc, s7_pointer args) s7_pointer num, state; s7_rng_t *r; double dnum; - + num = car(args); if (!s7_is_number(num)) return(s7_wrong_type_arg_error(sc, "random", 1, num, "a number")); @@ -6792,7 +6792,7 @@ static s7_pointer g_random(s7_scheme *sc, s7_pointer args) case NUM_REAL2: return(s7_make_real(sc, dnum * next_random(r))); - default: + default: return(s7_make_complex(sc, dnum * next_random(r), dnum * next_random(r))); } @@ -6904,7 +6904,7 @@ static s7_pointer g_is_char(s7_scheme *sc, s7_pointer args) } -s7_pointer s7_make_character(s7_scheme *sc, int c) +s7_pointer s7_make_character(s7_scheme *sc, int c) { s7_pointer x = new_cell(sc); set_type(x, T_CHARACTER | T_ATOM | T_SIMPLE | T_DONT_COPY); @@ -6913,14 +6913,14 @@ s7_pointer s7_make_character(s7_scheme *sc, int c) } -bool s7_is_character(s7_pointer p) -{ +bool s7_is_character(s7_pointer p) +{ return(type(p) == T_CHARACTER); } -char s7_character(s7_pointer p) -{ +char s7_character(s7_pointer p) +{ return(character(p)); } @@ -6928,7 +6928,7 @@ char s7_character(s7_pointer p) static int charcmp(unsigned char c1, unsigned char c2, bool ci) { if (ci) - return(charcmp(toupper(c1), toupper(c2), false)); + return(charcmp(toupper(c1), toupper(c2), false)); /* not tolower here -- the single case is apparently supposed to be upper case * this matters in a case like (char-ciNIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_character(car(x))) return(s7_wrong_type_arg_error(sc, name, i, car(x), "a character")); - + last_chr = character(car(args)); for (x = cdr(args); x != sc->NIL; x = cdr(x)) { @@ -6967,11 +6967,11 @@ static s7_pointer g_char_cmp_not(s7_scheme *sc, s7_pointer args, int val, const int i; s7_pointer x; unsigned char last_chr; - - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_character(car(x))) return(s7_wrong_type_arg_error(sc, name, i, car(x), "a character")); - + last_chr = character(car(args)); for (x = cdr(args); x != sc->NIL; x = cdr(x)) { @@ -6987,14 +6987,14 @@ static s7_pointer g_chars_are_equal(s7_scheme *sc, s7_pointer args) { #define H_chars_are_equal "(char=? chr...) returns #t if all the character arguments are equal" return(g_char_cmp(sc, args, 0, "char=?", false)); -} +} static s7_pointer g_chars_are_less(s7_scheme *sc, s7_pointer args) { #define H_chars_are_less "(char=? chr...) returns #t if all the character arguments are equal or decreasing" return(g_char_cmp_not(sc, args, -1, "char>=?", false)); -} +} static s7_pointer g_chars_are_leq(s7_scheme *sc, s7_pointer args) @@ -7029,14 +7029,14 @@ static s7_pointer g_chars_are_ci_less(s7_scheme *sc, s7_pointer args) { #define H_chars_are_ci_less "(char-ci? chr...) returns #t if all the character arguments are decreasing, ignoring case" return(g_char_cmp(sc, args, 1, "char-ci>?", true)); -} +} static s7_pointer g_chars_are_ci_geq(s7_scheme *sc, s7_pointer args) @@ -7057,7 +7057,7 @@ static s7_pointer g_chars_are_ci_leq(s7_scheme *sc, s7_pointer args) /* -------------------------------- strings -------------------------------- */ -s7_pointer s7_make_string_with_length(s7_scheme *sc, const char *str, int len) +s7_pointer s7_make_string_with_length(s7_scheme *sc, const char *str, int len) { s7_pointer x; x = new_cell(sc); @@ -7068,12 +7068,12 @@ s7_pointer s7_make_string_with_length(s7_scheme *sc, const char *str, int len) } -static s7_pointer make_empty_string(s7_scheme *sc, int len, char fill) +static s7_pointer make_empty_string(s7_scheme *sc, int len, char fill) { s7_pointer x; x = new_cell(sc); set_type(x, T_STRING | T_ATOM | T_FINALIZABLE | T_SIMPLE | T_DONT_COPY); - + string_value(x) = (char *)malloc((len + 1) * sizeof(char)); memset((void *)(string_value(x)), fill, len); string_value(x)[len] = 0; @@ -7083,13 +7083,13 @@ static s7_pointer make_empty_string(s7_scheme *sc, int len, char fill) } -s7_pointer s7_make_string(s7_scheme *sc, const char *str) +s7_pointer s7_make_string(s7_scheme *sc, const char *str) { return(s7_make_string_with_length(sc, str, safe_strlen(str))); } -s7_pointer s7_make_permanent_string(const char *str) +s7_pointer s7_make_permanent_string(const char *str) { /* for the symbol table which is never GC'd */ s7_pointer x; @@ -7101,7 +7101,7 @@ s7_pointer s7_make_permanent_string(const char *str) string_length(x) = strlen(str); string_value(x) = s7_strdup_with_len(str, string_length(x)); } - else + else { string_value(x) = NULL; string_length(x) = 0; @@ -7112,12 +7112,12 @@ s7_pointer s7_make_permanent_string(const char *str) bool s7_is_string(s7_pointer p) { - return((type(p) == T_STRING)); + return((type(p) == T_STRING)); } -const char *s7_string(s7_pointer p) -{ +const char *s7_string(s7_pointer p) +{ return(string_value(p)); } @@ -7134,12 +7134,12 @@ static s7_pointer g_make_string(s7_scheme *sc, s7_pointer args) #define H_make_string "(make-string len :optional val) makes a string of length len filled with the character val (default: space)" int len; char fill = ' '; - + if ((!s7_is_integer(car(args))) || (s7_integer(car(args)) < 0)) return(s7_wrong_type_arg_error(sc, "make-string", 1, car(args), "a non-negative integer")); - + len = s7_integer(car(args)); - if (cdr(args) != sc->NIL) + if (cdr(args) != sc->NIL) { if (!s7_is_character(cadr(args))) return(s7_wrong_type_arg_error(sc, "make-string", 2, cadr(args), "a character")); @@ -7161,13 +7161,13 @@ static s7_pointer g_string_length(s7_scheme *sc, s7_pointer args) static s7_pointer g_string_ref(s7_scheme *sc, s7_pointer args) { #define H_string_ref "(string-ref str index) returns the character at the index-th element of the string str" - + s7_pointer index; char *str; s7_Int ind; index = cadr(args); - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "string-ref", 1, car(args), "a string")); if (!s7_is_integer(index)) @@ -7179,7 +7179,7 @@ static s7_pointer g_string_ref(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "string-ref", 2, index, "a non-negative integer")); if (ind >= string_length(car(args))) return(s7_out_of_range_error(sc, "string-ref", 2, index, "index should be less than string length")); - + str = string_value(car(args)); return(s7_make_character(sc, ((unsigned char *)str)[ind])); } @@ -7188,14 +7188,14 @@ static s7_pointer g_string_ref(s7_scheme *sc, s7_pointer args) static s7_pointer g_string_set(s7_scheme *sc, s7_pointer args) { #define H_string_set "(string-set! str index chr) sets the index-th element of the string str to the character chr" - + s7_pointer x, index; char *str; s7_Int ind; x = car(args); index = cadr(args); - + if (!s7_is_string(x)) return(s7_wrong_type_arg_error(sc, "string-set!", 1, x, "a string")); if (!s7_is_character(caddr(args))) @@ -7211,7 +7211,7 @@ static s7_pointer g_string_set(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "string-set!", 2, index, "a non-negative integer")); if (ind >= string_length(x)) return(s7_out_of_range_error(sc, "string-set!", 2, index, "index should be less than string length")); - + /* I believe this does not need a lock in the multithread case -- local vars are specific * to each thread, and it should be obvious to anyone writing such code that a global * variable needs its lock (caller-supplied) -- it's not s7's job to protect even the @@ -7228,23 +7228,23 @@ static s7_pointer g_string_append_1(s7_scheme *sc, s7_pointer args, const char * int i, len = 0; s7_pointer x, newstr; char *pos; - + if (args == sc->NIL) return(s7_make_string_with_length(sc, "", 0)); - + /* get length for new string */ - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) { if (!s7_is_string(car(x))) return(s7_wrong_type_arg_error(sc, name, i, car(x), "a string")); len += string_length(car(x)); } - + /* store the contents of the argument strings into the new string */ newstr = make_empty_string(sc, len, 0); - for (pos = string_value(newstr), x = args; x != sc->NIL; pos += string_length(car(x)), x = cdr(x)) + for (pos = string_value(newstr), x = args; x != sc->NIL; pos += string_length(car(x)), x = cdr(x)) memcpy(pos, string_value(car(x)), string_length(car(x))); - + return(newstr); } @@ -7261,7 +7261,7 @@ static s7_pointer g_string_copy(s7_scheme *sc, s7_pointer args) #define H_string_copy "(string-copy str) returns a copy of its string argument" if (args == sc->NIL) return(s7_wrong_type_arg_error(sc, "string-copy", 0, car(args), "a string")); - + return(g_string_append_1(sc, args, "string-copy")); } @@ -7269,21 +7269,21 @@ static s7_pointer g_string_copy(s7_scheme *sc, s7_pointer args) static s7_pointer g_substring(s7_scheme *sc, s7_pointer args) { #define H_substring "(substring str start :optional end) returns the portion of the string str between start and end" - + s7_pointer x, start, end, str; s7_Int i0, i1; int len; char *s; - + str = car(args); start = cadr(args); - + if (!s7_is_string(str)) return(s7_wrong_type_arg_error(sc, "substring", 1, str, "a string")); - + if ((!s7_is_integer(start)) || (s7_integer(start) < 0)) return(s7_wrong_type_arg_error(sc, "substring", 2, start, "a non-negative integer")); - + if (cddr(args) != sc->NIL) { end = caddr(args); @@ -7292,14 +7292,14 @@ static s7_pointer g_substring(s7_scheme *sc, s7_pointer args) i1 = s7_integer(end); } else i1 = string_length(str); - + i0 = s7_integer(start); s = string_value(str); - - if ((i0 > i1) || + + if ((i0 > i1) || (i1 > string_length(str))) return(s7_out_of_range_error(sc, "substring", 2, start, "start <= end <= string length")); - + len = i1 - i0; x = make_empty_string(sc, len, 0); memcpy(string_value(x), s + i0, len); @@ -7342,11 +7342,11 @@ static s7_pointer g_string_cmp(s7_scheme *sc, s7_pointer args, int val, const ch int i; s7_pointer x; const char *last_str = NULL; - - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_string(car(x))) return(s7_wrong_type_arg_error(sc, name, i, car(x), "a string")); - + last_str = string_value(car(args)); for (x = cdr(args); x != sc->NIL; x = cdr(x)) { @@ -7363,11 +7363,11 @@ static s7_pointer g_string_cmp_not(s7_scheme *sc, s7_pointer args, int val, cons int i; s7_pointer x; const char *last_str = NULL; - - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_string(car(x))) return(s7_wrong_type_arg_error(sc, name, i, car(x), "a string")); - + last_str = string_value(car(args)); for (x = cdr(args); x != sc->NIL; x = cdr(x)) { @@ -7383,35 +7383,35 @@ static s7_pointer g_strings_are_equal(s7_scheme *sc, s7_pointer args) { #define H_strings_are_equal "(string=? str...) returns #t if all the string arguments are equal" return(g_string_cmp(sc, args, 0, "string=?")); -} +} static s7_pointer g_strings_are_less(s7_scheme *sc, s7_pointer args) { #define H_strings_are_less "(string? str...) returns #t if all the string arguments are decreasing" return(g_string_cmp(sc, args, 1, "string>?")); -} +} static s7_pointer g_strings_are_geq(s7_scheme *sc, s7_pointer args) { #define H_strings_are_geq "(string>=? str...) returns #t if all the string arguments are equal or decreasing" return(g_string_cmp_not(sc, args, -1, "string>=?")); -} +} static s7_pointer g_strings_are_leq(s7_scheme *sc, s7_pointer args) { #define H_strings_are_leq "(string<=? str...) returns #t if all the string arguments are equal or increasing" return(g_string_cmp_not(sc, args, 1, "string<=?")); -} +} static int safe_strcasecmp(const char *s1, const char *s2) @@ -7443,7 +7443,7 @@ static int safe_strcasecmp(const char *s1, const char *s2) return(1); } - if (len1 < len2) + if (len1 < len2) return(-1); if (len1 > len2) return(1); @@ -7457,11 +7457,11 @@ static s7_pointer g_string_ci_cmp(s7_scheme *sc, s7_pointer args, int val, const int i; s7_pointer x; const char *last_str = NULL; - - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_string(car(x))) return(s7_wrong_type_arg_error(sc, name, i, car(x), "a string")); - + last_str = string_value(car(args)); for (x = cdr(args); x != sc->NIL; x = cdr(x)) { @@ -7478,11 +7478,11 @@ static s7_pointer g_string_ci_cmp_not(s7_scheme *sc, s7_pointer args, int val, c int i; s7_pointer x; const char *last_str = NULL; - - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_string(car(x))) return(s7_wrong_type_arg_error(sc, name, i, car(x), "a string")); - + last_str = string_value(car(args)); for (x = cdr(args); x != sc->NIL; x = cdr(x)) { @@ -7498,35 +7498,35 @@ static s7_pointer g_strings_are_ci_equal(s7_scheme *sc, s7_pointer args) { #define H_strings_are_ci_equal "(string-ci=? str...) returns #t if all the string arguments are equal, ignoring case" return(g_string_ci_cmp(sc, args, 0, "string-ci=?")); -} +} static s7_pointer g_strings_are_ci_less(s7_scheme *sc, s7_pointer args) { #define H_strings_are_ci_less "(string-ci? str...) returns #t if all the string arguments are decreasing, ignoring case" return(g_string_ci_cmp(sc, args, 1, "string-ci>?")); -} +} static s7_pointer g_strings_are_ci_geq(s7_scheme *sc, s7_pointer args) { #define H_strings_are_ci_geq "(string-ci>=? str...) returns #t if all the string arguments are equal or decreasing, ignoring case" return(g_string_ci_cmp_not(sc, args, -1, "string-ci>=?")); -} +} static s7_pointer g_strings_are_ci_leq(s7_scheme *sc, s7_pointer args) { #define H_strings_are_ci_leq "(string-ci<=? str...) returns #t if all the string arguments are equal or increasing, ignoring case" return(g_string_ci_cmp_not(sc, args, 1, "string-ci<=?")); -} +} static s7_pointer g_string_fill(s7_scheme *sc, s7_pointer args) @@ -7546,7 +7546,7 @@ static s7_pointer g_string_fill(s7_scheme *sc, s7_pointer args) * set when it is created, and (apparently) can contain an embedded 0, so its * print length is not its length. * char *str; char c; str = string_value(car(args)); c = character(cadr(args)); - * int i, len = 0; if (str) len = strlen(str); if (len > 0) for (i = 0; i < len; i++) str[i] = c; + * int i, len = 0; if (str) len = strlen(str); if (len > 0) for (i = 0; i < len; i++) str[i] = c; */ memset((void *)(string_value(x)), (int)character(cadr(args)), string_length(x)); /* presumably memset can fill 0 bytes if empty string */ return(x); /* or perhaps sc->UNSPECIFIED */ @@ -7557,16 +7557,16 @@ static s7_pointer g_string_1(s7_scheme *sc, s7_pointer args, const char *name) { int i, len; s7_pointer x, newstr; - + /* get length for new string and check arg types */ - for (len = 0, x = args; x != sc->NIL; len++, x = cdr(x)) + for (len = 0, x = args; x != sc->NIL; len++, x = cdr(x)) if (!s7_is_character(car(x))) return(s7_wrong_type_arg_error(sc, name, len + 1, car(x), "a character")); - + newstr = make_empty_string(sc, len, 0); - for (i = 0, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 0, x = args; x != sc->NIL; i++, x = cdr(x)) string_value(newstr)[i] = character(car(x)); - + return(newstr); } @@ -7585,10 +7585,10 @@ static s7_pointer g_list_to_string(s7_scheme *sc, s7_pointer args) #define H_list_to_string "(list->string lst) appends all the list's characters into one string" if (car(args) == sc->NIL) return(s7_make_string_with_length(sc, "", 0)); - + if (!is_proper_list(sc, car(args))) return(s7_wrong_type_arg_error(sc, "list->string", 0, car(args), "a (proper, non-circular) list of characters")); - + return(g_string_1(sc, car(args), "list->string")); } @@ -7596,15 +7596,15 @@ static s7_pointer g_list_to_string(s7_scheme *sc, s7_pointer args) static s7_pointer g_string_to_list(s7_scheme *sc, s7_pointer args) { #define H_string_to_list "(string->list str) returns the elements of the string str in a list" - + int i, len = 0; char *str; s7_pointer lst; lst = sc->NIL; - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "string->list", 0, car(args), "a string")); - + str = string_value(car(args)); if (str) len = strlen(str); if (len == 0) @@ -7645,12 +7645,12 @@ static s7_pointer g_string_for_each(s7_scheme *sc, s7_pointer args) fargs = s7_cons(sc, sc->NIL, fargs); } } - /* during the loop we need the string list (cdddr(sc->args)), the function (sc->code), + /* during the loop we need the string list (cdddr(sc->args)), the function (sc->code), * the (mutable) loop counter (car(sc->args)) and end (cadr(sc->args)), and the current function arg list (caddr(sc->args)). */ - sc->args = s7_cons(sc, make_mutable_integer(sc, 0), - s7_cons(sc, s7_make_integer(sc, len), + sc->args = s7_cons(sc, make_mutable_integer(sc, 0), + s7_cons(sc, s7_make_integer(sc, len), s7_cons(sc, fargs, cdr(args)))); push_stack(sc, OP_STRING_FOR_EACH, sc->args, sc->code); return(sc->UNSPECIFIED); @@ -7712,8 +7712,8 @@ static s7_pointer g_port_filename(s7_scheme *sc, s7_pointer args) } -bool s7_is_input_port(s7_scheme *sc, s7_pointer p) -{ +bool s7_is_input_port(s7_scheme *sc, s7_pointer p) +{ return((p == sc->NIL) || /* stdin? */ (is_input_port(p))); } @@ -7726,8 +7726,8 @@ static s7_pointer g_is_input_port(s7_scheme *sc, s7_pointer args) } -bool s7_is_output_port(s7_scheme *sc, s7_pointer p) -{ +bool s7_is_output_port(s7_scheme *sc, s7_pointer p) +{ return((p == sc->NIL) || /* stderr? */ (is_output_port(p))); } @@ -7859,7 +7859,7 @@ static s7_pointer g_is_char_ready(s7_scheme *sc, s7_pointer args) return(make_boolean(sc, is_string_port(pt))); } return(make_boolean(sc, (is_input_port(sc->input_port)) && (is_string_port(sc->input_port)))); -} +} static s7_pointer g_is_eof_object(s7_scheme *sc, s7_pointer args) @@ -7874,7 +7874,7 @@ void s7_close_input_port(s7_scheme *sc, s7_pointer p) if ((p == sc->NIL) || ((is_input_port(p)) && (port_is_closed(p)))) return; - + if ((is_file_port(p)) && (port_file(p))) { @@ -7911,7 +7911,7 @@ void s7_close_output_port(s7_scheme *sc, s7_pointer p) if ((p == sc->NIL) || ((is_output_port(p)) && (port_is_closed(p)))) return; - + if (is_file_port(p)) { if (port_file(p)) @@ -7949,7 +7949,7 @@ static s7_pointer s7_make_input_file(s7_scheme *sc, const char *name, FILE *fp) s7_pointer x; x = new_cell(sc); set_type(x, T_INPUT_PORT | T_ATOM | T_FINALIZABLE | T_SIMPLE | T_DONT_COPY); - + /* set up the port struct */ x->object.port = (s7_port_t *)calloc(1, sizeof(s7_port_t)); port_file(x) = fp; @@ -7966,11 +7966,11 @@ s7_pointer s7_open_input_file(s7_scheme *sc, const char *name, const char *mode) { FILE *fp; /* see if we can open this file before allocating a port */ - + fp = fopen(name, mode); if (!fp) return(s7_file_error(sc, "open-input-file", "can't open", name)); - + return(s7_make_input_file(sc, name, fp)); } @@ -7981,7 +7981,7 @@ static s7_pointer g_open_input_file(s7_scheme *sc, s7_pointer args) s7_pointer name = car(args); if (!s7_is_string(name)) return(s7_wrong_type_arg_error(sc, "open-input-file", 1, name, "a string (a filename)")); - + if (is_pair(cdr(args))) { if (!s7_is_string(cadr(args))) @@ -7997,14 +7997,14 @@ s7_pointer s7_open_output_file(s7_scheme *sc, const char *name, const char *mode FILE *fp; s7_pointer x; /* see if we can open this file before allocating a port */ - + fp = fopen(name, mode); if (!fp) return(s7_file_error(sc, "open-output-file", "can't open", name)); - + x = new_cell(sc); set_type(x, T_OUTPUT_PORT | T_ATOM | T_FINALIZABLE | T_SIMPLE | T_DONT_COPY); - + x->object.port = (s7_port_t *)calloc(1, sizeof(s7_port_t)); port_type(x) = FILE_PORT; port_is_closed(x) = false; @@ -8022,7 +8022,7 @@ static s7_pointer g_open_output_file(s7_scheme *sc, s7_pointer args) s7_pointer name = car(args); if (!s7_is_string(name)) return(s7_wrong_type_arg_error(sc, "open-output-file", 1, name, "a string (a filename)")); - + if (is_pair(cdr(args))) { if (!s7_is_string(cadr(args))) @@ -8038,7 +8038,7 @@ s7_pointer s7_open_input_string(s7_scheme *sc, const char *input_string) s7_pointer x; x = new_cell(sc); set_type(x, T_INPUT_PORT | T_ATOM | T_FINALIZABLE | T_SIMPLE | T_DONT_COPY); - + x->object.port = (s7_port_t *)calloc(1, sizeof(s7_port_t)); port_type(x) = STRING_PORT; port_is_closed(x) = false; @@ -8059,7 +8059,7 @@ static s7_pointer g_open_input_string(s7_scheme *sc, s7_pointer args) s7_pointer input_string = car(args); if (!s7_is_string(input_string)) return(s7_wrong_type_arg_error(sc, "open-input-string", 0, input_string, "a string")); - + return(s7_open_input_string(sc, s7_string(input_string))); /* presumably the caller is protecting the input string?? */ } @@ -8071,7 +8071,7 @@ s7_pointer s7_open_output_string(s7_scheme *sc) s7_pointer x; x = new_cell(sc); set_type(x, T_OUTPUT_PORT | T_ATOM | T_FINALIZABLE | T_SIMPLE | T_DONT_COPY); - + x->object.port = (s7_port_t *)calloc(1, sizeof(s7_port_t)); port_type(x) = STRING_PORT; port_is_closed(x) = false; @@ -8111,7 +8111,7 @@ s7_pointer s7_open_input_function(s7_scheme *sc, s7_pointer (*function)(s7_schem s7_pointer x; x = new_cell(sc); set_type(x, T_INPUT_PORT | T_ATOM | T_FINALIZABLE | T_SIMPLE | T_DONT_COPY); - + x->object.port = (s7_port_t *)calloc(1, sizeof(s7_port_t)); port_type(x) = FUNCTION_PORT; port_is_closed(x) = false; @@ -8126,7 +8126,7 @@ s7_pointer s7_open_output_function(s7_scheme *sc, void (*function)(s7_scheme *sc s7_pointer x; x = new_cell(sc); set_type(x, T_OUTPUT_PORT | T_ATOM | T_FINALIZABLE | T_SIMPLE | T_DONT_COPY); - + x->object.port = (s7_port_t *)calloc(1, sizeof(s7_port_t)); port_type(x) = FUNCTION_PORT; port_is_closed(x) = false; @@ -8176,10 +8176,10 @@ static int inchar(s7_scheme *sc, s7_pointer pt) { int c; if (pt == sc->NIL) return(EOF); - + if (is_file_port(pt)) c = fgetc(port_file(pt)); - else + else { if ((!(port_string(pt))) || (port_string_length(pt) <= port_string_point(pt))) @@ -8194,16 +8194,16 @@ static int inchar(s7_scheme *sc, s7_pointer pt) } -static void backchar(s7_scheme *sc, char c, s7_pointer pt) +static void backchar(s7_scheme *sc, char c, s7_pointer pt) { if (pt == sc->NIL) return; - + if (c == '\n') port_line_number(pt)--; if (is_file_port(pt)) ungetc(c, port_file(pt)); - else + else { if (port_string_point(pt) > 0) port_string_point(pt)--; @@ -8248,10 +8248,10 @@ static s7_pointer g_read_char_1(s7_scheme *sc, s7_pointer args, bool peek) else port = sc->input_port; if (!s7_is_input_port(sc, port)) return(s7_wrong_type_arg_error(sc, (peek) ? "peek-char" : "read-char", 0, port, "an input port")); - + c = s7_read_char_1(sc, port, (peek) ? S7_PEEK_CHAR : S7_READ_CHAR); if (c == EOF) - return(sc->EOF_OBJECT); + return(sc->EOF_OBJECT); return(s7_make_character(sc, c)); } @@ -8358,12 +8358,12 @@ static s7_pointer g_read(s7_scheme *sc, s7_pointer args) { #define H_read "(read :optional port) returns the next object in the input port" s7_pointer port; - + if (args != sc->NIL) port = car(args); else port = sc->input_port; - - if (!is_input_port(port)) + + if (!is_input_port(port)) /* s7_is_input_port here lets NIL through as stdin, but that segfaults in token * should stdin work in that case? */ @@ -8371,7 +8371,7 @@ static s7_pointer g_read(s7_scheme *sc, s7_pointer args) if (is_function_port(port)) return((*(port_input_function(port)))(sc, S7_READ, port)); - + push_input_port(sc, port); push_stack(sc, OP_READ_POP_AND_RETURN_EXPRESSION, sc->NIL, sc->NIL); /* this stops the internal read process so we only get one form */ push_stack(sc, OP_READ_INTERNAL, sc->NIL, sc->NIL); @@ -8461,7 +8461,7 @@ static void run_load_hook(s7_scheme *sc, const char *filename) load_hook = s7_symbol_value(sc, s7_make_symbol(sc, "*load-hook*")); if (is_procedure(load_hook)) { - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = make_list_1(sc, s7_make_string(sc, filename)); sc->code = load_hook; eval(sc, OP_APPLY); @@ -8474,7 +8474,7 @@ s7_pointer s7_load(s7_scheme *sc, const char *filename) bool old_longjmp; s7_pointer port; FILE *fp; - + fp = fopen(filename, "r"); if (!fp) fp = search_load_path(sc, filename); @@ -8486,15 +8486,15 @@ s7_pointer s7_load(s7_scheme *sc, const char *filename) port = load_file(sc, fp, filename); port_file_number(port) = remember_file_name(filename); push_input_port(sc, port); - + /* it's possible to call this recursively (s7_load is XEN_LOAD_FILE which can be invoked via s7_call) * but in that case, we actually want it to behave like g_load and continue the evaluation upon completion */ - + if (!sc->longjmp_ok) { push_stack(sc, OP_LOAD_RETURN_IF_EOF, port, sc->NIL); - + old_longjmp = sc->longjmp_ok; if (!sc->longjmp_ok) { @@ -8503,7 +8503,7 @@ s7_pointer s7_load(s7_scheme *sc, const char *filename) eval(sc, sc->op); else eval(sc, OP_READ_INTERNAL); } - sc->longjmp_ok = old_longjmp; + sc->longjmp_ok = old_longjmp; pop_input_port(sc); s7_close_input_port(sc, port); } @@ -8528,26 +8528,26 @@ defaults to the global environment; to load into the current environment instead FILE *fp = NULL; s7_pointer name, port; const char *fname; - + name = car(args); if (!s7_is_string(name)) return(s7_wrong_type_arg_error(sc, "load", 1, name, "a string (a filename)")); - + fname = s7_string(name); - + fp = fopen(fname, "r"); if (!fp) fp = search_load_path(sc, fname); if (!fp) return(s7_file_error(sc, "open-input-file", "can't open", fname)); - + run_load_hook(sc, fname); port = load_file(sc, fp, fname); port_file_number(port) = remember_file_name(fname); push_input_port(sc, port); - if (cdr(args) != sc->NIL) + if (cdr(args) != sc->NIL) { if (!is_pair(cadr(args))) return(s7_wrong_type_arg_error(sc, "load", 2, cadr(args), "an environment")); @@ -8557,7 +8557,7 @@ defaults to the global environment; to load into the current environment instead push_stack(sc, OP_LOAD_CLOSE_AND_POP_IF_EOF, sc->NIL, sc->NIL); /* was pushing args and code, but I don't think they're used later */ push_stack(sc, OP_READ_INTERNAL, sc->NIL, sc->NIL); - + return(sc->UNSPECIFIED); } @@ -8577,10 +8577,10 @@ s7_pointer s7_add_to_load_path(s7_scheme *sc, const char *dir) if (is_encapsulating(sc)) encapsulate(sc, load_path); #endif - s7_symbol_set_value(sc, + s7_symbol_set_value(sc, load_path, - s7_cons(sc, - s7_make_string(sc, dir), + s7_cons(sc, + s7_make_string(sc, dir), s7_symbol_value(sc, load_path))); return(s7_load_path(sc)); } @@ -8593,7 +8593,7 @@ static s7_pointer g_eval_string(s7_scheme *sc, s7_pointer args) if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "eval-string", 0, car(args), "a string")); - + if (cdr(args) != sc->NIL) { if (!is_pair(cadr(args))) @@ -8624,13 +8624,13 @@ s7_pointer s7_eval_c_string(s7_scheme *sc, const char *str) if (sc->longjmp_ok) return(g_eval_string(sc, make_list_1(sc, s7_make_string(sc, str)))); - - stack_reset(sc); - sc->envir = sc->global_env; + + stack_reset(sc); + sc->envir = sc->global_env; port = s7_open_input_string(sc, str); push_input_port(sc, port); push_stack(sc, OP_EVAL_STRING, sc->NIL, sc->NIL); - + old_longjmp = sc->longjmp_ok; if (!sc->longjmp_ok) { @@ -8639,11 +8639,11 @@ s7_pointer s7_eval_c_string(s7_scheme *sc, const char *str) eval(sc, sc->op); else eval(sc, OP_READ_INTERNAL); } - + sc->longjmp_ok = old_longjmp; pop_input_port(sc); s7_close_input_port(sc, port); - + return(sc->value); } @@ -8667,15 +8667,15 @@ static s7_pointer call_with_input(s7_scheme *sc, s7_pointer port, s7_pointer arg static s7_pointer g_call_with_input_string(s7_scheme *sc, s7_pointer args) { #define H_call_with_input_string "(call-with-input-string str proc) opens a string port for str and applies proc to it" - + /* (call-with-input-string "44" (lambda (p) (+ 1 (read p)))) -> 45 */ - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "call-with-input-string", 1, car(args), "a string")); if (!is_procedure(cadr(args))) return(s7_wrong_type_arg_error(sc, "call-with-input-string", 2, cadr(args), "a procedure")); - + return(call_with_input(sc, s7_open_input_string(sc, s7_string(car(args))), args)); } @@ -8683,12 +8683,12 @@ static s7_pointer g_call_with_input_string(s7_scheme *sc, s7_pointer args) static s7_pointer g_call_with_input_file(s7_scheme *sc, s7_pointer args) { #define H_call_with_input_file "(call-with-input-file filename proc) opens filename and calls proc with the input port as its argument" - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "call-with-input-file", 1, car(args), "a string (a filename)")); if (!is_procedure(cadr(args))) return(s7_wrong_type_arg_error(sc, "call-with-input-file", 2, cadr(args), "a procedure")); - + return(call_with_input(sc, s7_open_input_file(sc, s7_string(car(args)), "r"), args)); } @@ -8698,12 +8698,12 @@ static s7_pointer with_input(s7_scheme *sc, s7_pointer port, s7_pointer args) s7_pointer old_input_port; old_input_port = sc->input_port; sc->input_port = port; - + push_stack(sc, OP_UNWIND_INPUT, old_input_port, port); sc->code = cadr(args); sc->args = sc->NIL; eval(sc, OP_APPLY); - + s7_close_input_port(sc, sc->input_port); sc->input_port = old_input_port; @@ -8718,12 +8718,12 @@ static s7_pointer with_input(s7_scheme *sc, s7_pointer port, s7_pointer args) static s7_pointer g_with_input_from_string(s7_scheme *sc, s7_pointer args) { #define H_with_input_from_string "(with-input-from-string str thunk) opens str as the temporary current-input-port and calls thunk" - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "with-input-from-string", 1, car(args), "a string")); if (!is_thunk(sc, cadr(args))) return(s7_wrong_type_arg_error(sc, "with-input-from-string", 2, cadr(args), "a thunk")); - + return(with_input(sc, s7_open_input_string(sc, s7_string(car(args))), args)); } @@ -8731,12 +8731,12 @@ static s7_pointer g_with_input_from_string(s7_scheme *sc, s7_pointer args) static s7_pointer g_with_input_from_file(s7_scheme *sc, s7_pointer args) { #define H_with_input_from_file "(with-input-from-file filename thunk) opens filename as the temporary current-input-port and calls thunk" - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "with-input-from-file", 1, car(args), "a string (a filename)")); if (!is_thunk(sc, cadr(args))) return(s7_wrong_type_arg_error(sc, "with-input-from-file", 2, cadr(args), "a thunk")); - + return(with_input(sc, s7_open_input_file(sc, s7_string(car(args)), "r"), args)); } @@ -8756,7 +8756,7 @@ static void char_to_string_port(char c, s7_pointer pt) } -static void write_char(s7_scheme *sc, char c, s7_pointer pt) +static void write_char(s7_scheme *sc, char c, s7_pointer pt) { if (pt == sc->NIL) fputc(c, stderr); @@ -8766,7 +8766,7 @@ static void write_char(s7_scheme *sc, char c, s7_pointer pt) return; if (is_file_port(pt)) fputc(c, port_file(pt)); - else + else { if (is_string_port(pt)) char_to_string_port(c, pt); @@ -8776,27 +8776,27 @@ static void write_char(s7_scheme *sc, char c, s7_pointer pt) } -static void write_string(s7_scheme *sc, const char *s, s7_pointer pt) +static void write_string(s7_scheme *sc, const char *s, s7_pointer pt) { if (!s) return; - + if (pt == sc->NIL) fputs(s, stderr); else { if (port_is_closed(pt)) return; - + if (is_file_port(pt)) fputs(s, port_file(pt)); - else + else { if (is_string_port(pt)) { for (; *s; s++) char_to_string_port(*s, pt); } - else + else { for (; *s; s++) (*(port_output_function(pt)))(sc, *s, pt); @@ -8812,47 +8812,47 @@ static char *slashify_string(const char *p) char *s; len = safe_strlen(p); s = (char *)calloc(len + 256, sizeof(char)); - + s[j++] = '"'; - for (i = 0; i < len; i++) + for (i = 0; i < len; i++) { if (slashify_table[(int)p[i]]) { s[j++] = '\\'; - switch (p[i]) + switch (p[i]) { case '"': s[j++] = '"'; break; - + #if 0 case '\n': s[j++] = 'n'; break; #endif - + case '\t': s[j++] = 't'; break; - + case '\r': s[j++] = 'r'; break; - + case '\\': s[j++] = '\\'; break; - - default: - { + + default: + { int d = p[i] / 16; s[j++] = 'x'; - if (d < 10) + if (d < 10) s[j++] = d + '0'; else s[j++] = d - 10 + 'A'; - + d = p[i] % 16; - if (d < 10) + if (d < 10) s[j++] = d + '0'; else s[j++] = d - 10 + 'A'; } @@ -8876,15 +8876,15 @@ static char *s7_atom_to_c_string(s7_scheme *sc, s7_pointer obj, bool use_write) case T_NIL: return(s7_strdup("()")); - + case T_UNTYPED: if (obj == sc->EOF_OBJECT) return(s7_strdup("#")); - - if (obj == sc->UNDEFINED) + + if (obj == sc->UNDEFINED) return(s7_strdup("#")); - - if (obj == sc->UNSPECIFIED) + + if (obj == sc->UNSPECIFIED) return(s7_strdup("#")); break; @@ -8894,11 +8894,11 @@ static char *s7_atom_to_c_string(s7_scheme *sc, s7_pointer obj, bool use_write) case T_NUMBER: return(s7_number_to_string_base_10(obj, 0, 14, 'g')); /* 20 digits is excessive in this context */ - + case T_STRING: if (string_length(obj) > 0) { - if (!use_write) + if (!use_write) return(s7_strdup_with_len(string_value(obj), string_length(obj))); return(slashify_string(string_value(obj))); } @@ -8913,29 +8913,29 @@ static char *s7_atom_to_c_string(s7_scheme *sc, s7_pointer obj, bool use_write) unsigned char c; p = (char *)malloc(P_SIZE * sizeof(char)); c = (unsigned char)s7_character(obj); /* if not unsigned, (write (integer->char 212) -> #\xffffffd4! */ - if (!use_write) + if (!use_write) { p[0]= c; p[1]= 0; - } - else + } + else { - switch (c) + switch (c) { case ' ': - snprintf(p, P_SIZE, "#\\space"); + snprintf(p, P_SIZE, "#\\space"); break; case '\n': - snprintf(p, P_SIZE, "#\\newline"); + snprintf(p, P_SIZE, "#\\newline"); break; case '\r': - snprintf(p, P_SIZE, "#\\return"); + snprintf(p, P_SIZE, "#\\return"); break; case '\t': - snprintf(p, P_SIZE, "#\\tab"); + snprintf(p, P_SIZE, "#\\tab"); break; case '\0': @@ -8943,21 +8943,21 @@ static char *s7_atom_to_c_string(s7_scheme *sc, s7_pointer obj, bool use_write) break; default: - if (c < 32) + if (c < 32) snprintf(p, P_SIZE, "#\\x%x", c); - else snprintf(p, P_SIZE, "#\\%c", c); + else snprintf(p, P_SIZE, "#\\%c", c); break; } } return(p); } - + case T_SYMBOL: return(s7_strdup(symbol_name(obj))); - + case T_MACRO: return(s7_strdup("#")); - + case T_CLOSURE: case T_CLOSURE_STAR: { @@ -8968,28 +8968,28 @@ static char *s7_atom_to_c_string(s7_scheme *sc, s7_pointer obj, bool use_write) return(s7_strdup(symbol_name(car(binding)))); return(s7_strdup("#")); } - + case T_C_FUNCTION: return(s7_strdup(c_function_name(obj))); case T_C_MACRO: return(s7_strdup(c_macro_name(obj))); - + case T_C_POINTER: return(s7_strdup("#")); - + case T_CONTINUATION: return(s7_strdup("#")); - + case T_GOTO: return(s7_strdup("#")); - + case T_CATCH: return(s7_strdup("#")); - + case T_DYNAMIC_WIND: return(s7_strdup("#")); - + case T_C_OBJECT: return(s7_describe_object(sc, obj)); /* this allocates already */ @@ -9000,8 +9000,8 @@ static char *s7_atom_to_c_string(s7_scheme *sc, s7_pointer obj, bool use_write) { char *buf; buf = (char *)calloc(512, sizeof(char)); - snprintf(buf, 512, "", - type(obj), + snprintf(buf, 512, "", + type(obj), (type(obj) < BUILT_IN_TYPES) ? s7_type_name(obj) : "none", typeflag(obj), is_simple(obj) ? " simple" : "", @@ -9074,19 +9074,19 @@ static char *s7_vector_to_c_string(s7_scheme *sc, s7_pointer vect, int depth, bo bool too_long = false; char **elements = NULL; char *buf; - + len = vector_length(vect); if (len == 0) return(s7_strdup("#()")); - + if (!to_file) { int plen; /* if to_file we ignore *vector-print-length* so a subsequent read will be ok * - * (with-output-to-file "test.test" - * (lambda () - * (let ((vect (make-vector (+ *vector-print-length* 2) 1.0))) + * (with-output-to-file "test.test" + * (lambda () + * (let ((vect (make-vector (+ *vector-print-length* 2) 1.0))) * (write vect)))) */ plen = s7_integer(s7_symbol_value(sc, s7_make_symbol(sc, "*vector-print-length*"))); @@ -9158,14 +9158,14 @@ static char *s7_list_to_c_string(s7_scheme *sc, s7_pointer lst, int depth) len = (-len + 1); dotted = true; } - + if (len == 0) /* either '() or a circular list */ { if (lst != sc->NIL) return(s7_strdup("[circular list]")); return(s7_strdup("()")); } - + if (depth < CIRCULAR_REFS_SIZE) sc->circular_refs[depth] = lst; /* (let ((l (list 1 2))) (list-set! l 0 l) l) */ @@ -9183,10 +9183,10 @@ static char *s7_list_to_c_string(s7_scheme *sc, s7_pointer lst, int depth) elements[i] = object_to_c_string_with_circle_check(sc, x, depth); bufsize += safe_strlen(elements[i]); } - + bufsize += (256 + len * 2); /* len spaces */ buf = (char *)malloc(bufsize * sizeof(char)); - + sprintf(buf, "("); for (i = 0; i < len - 1; i++) { @@ -9254,7 +9254,7 @@ static s7_pointer g_newline(s7_scheme *sc, s7_pointer args) { #define H_newline "(newline :optional port) writes a carriage return to the port" s7_pointer port; - + if (args != sc->NIL) { port = car(args); @@ -9262,7 +9262,7 @@ static s7_pointer g_newline(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "newline", 0, port, "an output port")); } else port = sc->output_port; - + s7_newline(sc, port); return(sc->UNSPECIFIED); } @@ -9278,10 +9278,10 @@ static s7_pointer g_write_char(s7_scheme *sc, s7_pointer args) { #define H_write_char "(write-char char :optional port) writes char to the output port" s7_pointer port; - + if (!s7_is_character(car(args))) return(s7_wrong_type_arg_error(sc, "write-char", 1, car(args), "a character")); - + if (is_pair(cdr(args))) { port = cadr(args); @@ -9313,7 +9313,7 @@ static s7_pointer g_write(s7_scheme *sc, s7_pointer args) { #define H_write "(write str :optional port) writes str (a string) to the output port" s7_pointer port; - + if (is_pair(cdr(args))) { port = cadr(args); @@ -9336,7 +9336,7 @@ static s7_pointer g_display(s7_scheme *sc, s7_pointer args) { #define H_display "(display str :optional port) writes str (a string) to the output port" s7_pointer port; - + if (is_pair(cdr(args))) { port = cadr(args); @@ -9353,7 +9353,7 @@ static s7_pointer g_read_byte(s7_scheme *sc, s7_pointer args) { #define H_read_byte "(read-byte :optional port): reads a byte from the input port" s7_pointer port; - + if (args != sc->NIL) port = car(args); else port = sc->input_port; @@ -9373,17 +9373,17 @@ static s7_pointer g_write_byte(s7_scheme *sc, s7_pointer args) { #define H_write_byte "(write-byte byte :optional port): writes byte to the output port" s7_pointer port; - + if (!s7_is_integer(car(args))) return(s7_wrong_type_arg_error(sc, "write-byte", 1, car(args), "an integer")); - + if (is_pair(cdr(args))) port = cadr(args); else port = sc->output_port; if ((!is_output_port(port)) || (is_string_port(port))) return(s7_wrong_type_arg_error(sc, "write-byte", 2, port, "an output file or function port")); - + if (is_file_port(port)) fputc((unsigned char)s7_integer(car(args)), port_file(port)); else (*(port_output_function(port)))(sc, (char)s7_integer(car(args)), port); @@ -9399,7 +9399,7 @@ static s7_pointer g_call_with_output_string(s7_scheme *sc, s7_pointer args) if (!is_procedure(car(args))) return(s7_wrong_type_arg_error(sc, "call-with-output-string", 1, car(args), "a procedure")); - + port = s7_open_output_string(sc); push_stack(sc, OP_UNWIND_OUTPUT, sc->F, port); sc->code = car(args); @@ -9415,12 +9415,12 @@ static s7_pointer g_call_with_output_file(s7_scheme *sc, s7_pointer args) { #define H_call_with_output_file "(call-with-output-file filename proc) opens filename and calls proc with the output port as its argument" s7_pointer port; - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "call-with-output-file", 1, car(args), "a string (a filename)")); if (!is_procedure(cadr(args))) return(s7_wrong_type_arg_error(sc, "call-with-output-file", 2, cadr(args), "a procedure")); - + port = s7_open_output_file(sc, s7_string(car(args)), "w"); push_stack(sc, OP_UNWIND_OUTPUT, sc->F, port); sc->code = cadr(args); @@ -9443,7 +9443,7 @@ static s7_pointer g_with_output_to_string(s7_scheme *sc, s7_pointer args) if (!is_thunk(sc, car(args))) return(s7_wrong_type_arg_error(sc, "with-output-to-string", 1, car(args), "a thunk")); - + old_output_port = sc->output_port; sc->output_port = s7_open_output_string(sc); push_stack(sc, OP_UNWIND_OUTPUT, old_output_port, sc->output_port); @@ -9463,12 +9463,12 @@ static s7_pointer g_with_output_to_file(s7_scheme *sc, s7_pointer args) { #define H_with_output_to_file "(with-output-to-file filename thunk) opens filename as the temporary current-output-port and calls thunk" s7_pointer old_output_port; - + if (!s7_is_string(car(args))) return(s7_wrong_type_arg_error(sc, "with-output-to-file", 1, car(args), "a string (a filename)")); if (!is_thunk(sc, cadr(args))) return(s7_wrong_type_arg_error(sc, "with-output-to-file", 2, cadr(args), "a thunk")); - + old_output_port = sc->output_port; sc->output_port = s7_open_output_file(sc, s7_string(car(args)), "w"); push_stack(sc, OP_UNWIND_OUTPUT, old_output_port, sc->output_port); @@ -9478,7 +9478,7 @@ static s7_pointer g_with_output_to_file(s7_scheme *sc, s7_pointer args) s7_close_output_port(sc, sc->output_port); sc->output_port = old_output_port; - if ((is_pair(sc->value)) && + if ((is_pair(sc->value)) && (car(sc->value) == sc->VALUES)) sc->value = splice_in_values(sc, cdr(sc->value)); @@ -9500,7 +9500,7 @@ static s7_pointer s7_immutable_cons(s7_scheme *sc, s7_pointer a, s7_pointer b) } -s7_pointer s7_cons(s7_scheme *sc, s7_pointer a, s7_pointer b) +s7_pointer s7_cons(s7_scheme *sc, s7_pointer a, s7_pointer b) { s7_pointer x; @@ -9537,39 +9537,39 @@ static s7_pointer s7_permanent_cons(s7_pointer a, s7_pointer b, int type) } -bool s7_is_pair(s7_pointer p) -{ +bool s7_is_pair(s7_pointer p) +{ return(is_pair(p)); } -s7_pointer s7_car(s7_pointer p) +s7_pointer s7_car(s7_pointer p) { return(car(p)); } -s7_pointer s7_cdr(s7_pointer p) +s7_pointer s7_cdr(s7_pointer p) { return(cdr(p)); } -s7_pointer s7_set_car(s7_pointer p, s7_pointer q) -{ +s7_pointer s7_set_car(s7_pointer p, s7_pointer q) +{ car(p) = q; return(p); } -s7_pointer s7_set_cdr(s7_pointer p, s7_pointer q) -{ +s7_pointer s7_set_cdr(s7_pointer p, s7_pointer q) +{ cdr(p) = q; return(p); } -static s7_pointer make_list_1(s7_scheme *sc, s7_pointer a) +static s7_pointer make_list_1(s7_scheme *sc, s7_pointer a) { s7_pointer x; x = new_cell(sc); @@ -9580,7 +9580,7 @@ static s7_pointer make_list_1(s7_scheme *sc, s7_pointer a) } -static s7_pointer make_list_2(s7_scheme *sc, s7_pointer a, s7_pointer b) +static s7_pointer make_list_2(s7_scheme *sc, s7_pointer a, s7_pointer b) { s7_pointer x, y; y = new_cell(sc); @@ -9595,7 +9595,7 @@ static s7_pointer make_list_2(s7_scheme *sc, s7_pointer a, s7_pointer b) } -static s7_pointer make_list_3(s7_scheme *sc, s7_pointer a, s7_pointer b, s7_pointer c) +static s7_pointer make_list_3(s7_scheme *sc, s7_pointer a, s7_pointer b, s7_pointer c) { s7_pointer x, y, z; z = new_cell(sc); @@ -9618,7 +9618,7 @@ s7_pointer s7_list_ref(s7_scheme *sc, s7_pointer lst, int num) { int i; s7_pointer x; - + if (num == 0) return(s7_car(lst)); if (num < 0) @@ -9664,11 +9664,11 @@ s7_pointer s7_assoc(s7_scheme *sc, s7_pointer sym, s7_pointer lst) } -s7_pointer s7_reverse(s7_scheme *sc, s7_pointer a) +s7_pointer s7_reverse(s7_scheme *sc, s7_pointer a) { /* reverse list -- produce new list */ s7_pointer p = sc->NIL; - for ( ; is_pair(a); a = cdr(a)) + for ( ; is_pair(a); a = cdr(a)) p = s7_cons(sc, car(a), p); if (a == sc->NIL) return(p); @@ -9676,7 +9676,7 @@ s7_pointer s7_reverse(s7_scheme *sc, s7_pointer a) } -static s7_pointer s7_reverse_in_place(s7_scheme *sc, s7_pointer term, s7_pointer list) +static s7_pointer s7_reverse_in_place(s7_scheme *sc, s7_pointer term, s7_pointer list) { s7_pointer p = list, result = term, q; while (p != sc->NIL) @@ -9710,14 +9710,14 @@ static s7_pointer safe_reverse_in_place(s7_scheme *sc, s7_pointer list) /* "safe } -s7_pointer s7_append(s7_scheme *sc, s7_pointer a, s7_pointer b) +s7_pointer s7_append(s7_scheme *sc, s7_pointer a, s7_pointer b) { s7_pointer p = b, q; - - if (a != sc->NIL) + + if (a != sc->NIL) { a = s7_reverse(sc, a); - while (a != sc->NIL) + while (a != sc->NIL) { q = cdr(a); cdr(a) = p; @@ -9739,11 +9739,11 @@ static int safe_list_length(s7_scheme *sc, s7_pointer a) } -int s7_list_length(s7_scheme *sc, s7_pointer a) +int s7_list_length(s7_scheme *sc, s7_pointer a) { int i; s7_pointer slow, fast; - + slow = fast = a; for (i = 0; ; i += 2) { @@ -9753,18 +9753,18 @@ int s7_list_length(s7_scheme *sc, s7_pointer a) return(i); return(-i); } - + fast = cdr(fast); - if (!is_pair(fast)) + if (!is_pair(fast)) { if (fast == sc->NIL) return(i + 1); return(-i - 1); } - + fast = cdr(fast); slow = cdr(slow); - if (fast == slow) + if (fast == slow) { /* the fast pointer has looped back around and caught up with the slow pointer, hence the structure is circular, @@ -9803,16 +9803,16 @@ static bool is_proper_list(s7_scheme *sc, s7_pointer lst) slow = fast = lst; while (true) { - if (!is_pair(fast)) + if (!is_pair(fast)) return(fast == sc->NIL); /* else it's an improper list */ - + fast = cdr(fast); - if (!is_pair(fast)) + if (!is_pair(fast)) return(fast == sc->NIL); - + fast = cdr(fast); slow = cdr(slow); - if (fast == slow) + if (fast == slow) return(false); } return(true); @@ -9843,7 +9843,7 @@ static s7_pointer g_make_list(s7_scheme *sc, s7_pointer args) if (is_pair(cdr(args))) init = cadr(args); else init = sc->F; - + result = sc->NIL; if (sc->free_heap_top <= (unsigned int)len) gc(sc); @@ -9859,7 +9859,7 @@ static s7_pointer g_make_list(s7_scheme *sc, s7_pointer args) static s7_pointer g_list_ref(s7_scheme *sc, s7_pointer args) { #define H_list_ref "(list-ref lst i) returns the i-th element (0-based) of the list" - + int i; s7_Int index; s7_pointer p; @@ -9869,18 +9869,18 @@ static s7_pointer g_list_ref(s7_scheme *sc, s7_pointer args) if ((!s7_is_integer(cadr(args))) || (s7_integer(cadr(args)) < 0)) return(s7_wrong_type_arg_error(sc, "list-ref", 2, cadr(args), "a non-negative integer")); - + index = s7_integer(cadr(args)); if (index < 0) return(s7_out_of_range_error(sc, "list-ref", 2, cadr(args), "index should be non-negative")); - + for (i = 0, p = car(args); (i < index) && is_pair(p); i++, p = cdr(p)) {} - + if (p == sc->NIL) return(s7_out_of_range_error(sc, "list-ref", 2, cadr(args), "index should be less than list length")); if (!is_pair(p)) return(s7_wrong_type_arg_error(sc, "list-ref", i, p, "a proper list")); - + return(car(p)); } @@ -9888,28 +9888,28 @@ static s7_pointer g_list_ref(s7_scheme *sc, s7_pointer args) static s7_pointer g_list_set(s7_scheme *sc, s7_pointer args) { #define H_list_set "(list-set! lst i val) sets the i-th element (0-based) of the list to val" - + int i; s7_Int index; s7_pointer p; - + if (!is_pair(car(args))) return(s7_wrong_type_arg_error(sc, "list-set!", 1, car(args), "a pair")); if ((!s7_is_integer(cadr(args))) || (s7_integer(cadr(args)) < 0)) return(s7_wrong_type_arg_error(sc, "list-set!", 2, cadr(args), "a non-negative integer")); - + index = s7_integer(cadr(args)); if (index < 0) return(s7_out_of_range_error(sc, "list-set!", 2, cadr(args), "index should be non-negative")); - + for (i = 0, p = car(args); (i < index) && is_pair(p); i++, p = cdr(p)) {} - + if (p == sc->NIL) return(s7_out_of_range_error(sc, "list-set!", 2, cadr(args), "index should be less than list length")); if (!is_pair(p)) return(s7_wrong_type_arg_error(sc, "list-set!", i, p, "a proper list")); - + car(p) = caddr(args); return(caddr(args)); } @@ -9918,7 +9918,7 @@ static s7_pointer g_list_set(s7_scheme *sc, s7_pointer args) static s7_pointer g_list_tail(s7_scheme *sc, s7_pointer args) { #define H_list_tail "(list-tail lst i) returns the list from the i-th element on" - + int i; s7_Int index; s7_pointer p; @@ -9928,16 +9928,16 @@ static s7_pointer g_list_tail(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "list-tail", 1, car(args), "a list")); if (!s7_is_integer(cadr(args))) return(s7_wrong_type_arg_error(sc, "list-tail", 2, cadr(args), "an integer")); - + index = s7_integer(cadr(args)); if (index < 0) return(s7_out_of_range_error(sc, "list-tail", 2, cadr(args), "index should be non-negative")); - + for (i = 0, p = car(args); (i < index) && is_pair(p); i++, p = cdr(p)) {} - + if (i < index) return(s7_out_of_range_error(sc, "list-tail", 2, cadr(args), "index should be less than list length")); - + return(p); } @@ -9946,7 +9946,7 @@ static s7_pointer g_car(s7_scheme *sc, s7_pointer args) { #define H_car "(car pair) returns the first element of the pair" if (!is_pair(car(args))) return(s7_wrong_type_arg_error(sc, "car", 0, car(args), "a pair")); - + return(caar(args)); } @@ -9955,7 +9955,7 @@ static s7_pointer g_cdr(s7_scheme *sc, s7_pointer args) { #define H_cdr "(cdr pair) returns the second element of the pair" if (!is_pair(car(args))) return(s7_wrong_type_arg_error(sc, "cdr", 0, car(args), "a pair")); - + return(cdar(args)); } @@ -9967,7 +9967,7 @@ static s7_pointer g_cons(s7_scheme *sc, s7_pointer args) /* (set! (cadr (cons 1 2 3)) 4) -> (1 4 . 3) */ #define H_cons "(cons a b) returns a pair containing a and b" - + /* cdr(args) = cadr(args); * this is not safe -- it changes a variable's value directly: * (let ((lst (list 1 2))) (list (apply cons lst) lst)) -> '((1 . 2) (1 . 2)) @@ -9997,13 +9997,13 @@ static s7_pointer g_cons(s7_scheme *sc, s7_pointer args) static s7_pointer g_set_car(s7_scheme *sc, s7_pointer args) { #define H_set_car "(set-car! pair val) sets the pair's first element to val" - + if (!is_pair(car(args))) return(s7_wrong_type_arg_error(sc, "set-car!", 1, car(args), "a pair")); if (s7_is_immutable(car(args))) return(s7_wrong_type_arg_error(sc, "set-car!", 1, car(args), "a mutable pair")); - + caar(args) = cadr(args); /* return(args); - * (set-car! (cdr (cons 1 (cons 2 3))) 4) -> ((4 . 3) 4)?? + * (set-car! (cdr (cons 1 (cons 2 3))) 4) -> ((4 . 3) 4)?? * perhaps this should return # instead since: * (let ((lst (cons 1 (cons 2 3)))) (set-car! (cdr lst) 4) lst) -> (1 4 . 3) */ @@ -10014,10 +10014,10 @@ static s7_pointer g_set_car(s7_scheme *sc, s7_pointer args) static s7_pointer g_set_cdr(s7_scheme *sc, s7_pointer args) { #define H_set_cdr "(set-cdr! pair val) sets the pair's second element to val" - + if (!is_pair(car(args))) return(s7_wrong_type_arg_error(sc, "set-cdr!", 1, car(args), "a pair")); if (s7_is_immutable(car(args))) return(s7_wrong_type_arg_error(sc, "set-cdr!", 1, car(args), "a mutable pair")); - + cdar(args) = cadr(args); return(sc->UNSPECIFIED); /* see above */ } @@ -10403,18 +10403,18 @@ static s7_pointer g_reverse(s7_scheme *sc, s7_pointer args) { #define H_reverse "(reverse lst) returns a list with the elements of lst in reverse order" s7_pointer p, np; - + p = car(args); if (p == sc->NIL) return(sc->NIL); if (!is_pair(p)) return(s7_wrong_type_arg_error(sc, "reverse", 0, p, "a list")); - + np = s7_reverse(sc, p); if (np == sc->NIL) return(s7_wrong_type_arg_error(sc, "reverse", 0, p, "a proper list")); - + return(np); } @@ -10423,23 +10423,23 @@ static s7_pointer g_reverse_in_place(s7_scheme *sc, s7_pointer args) { #define H_reverse_in_place "(reverse! lst) reverses lst in place" s7_pointer p, np; - + p = car(args); if (p == sc->NIL) return(sc->NIL); - + if (!is_pair(p)) return(s7_wrong_type_arg_error(sc, "reverse!", 0, p, "a list")); - + np = s7_reverse_in_place(sc, sc->NIL, p); if (np == sc->NIL) return(s7_wrong_type_arg_error(sc, "reverse!", 0, p, "a proper list")); - + return(np); } -s7_pointer s7_remv(s7_scheme *sc, s7_pointer a, s7_pointer obj) +s7_pointer s7_remv(s7_scheme *sc, s7_pointer a, s7_pointer obj) { /* used in xen.c */ s7_pointer p = sc->NIL; @@ -10465,14 +10465,14 @@ static s7_pointer g_assq_1(s7_scheme *sc, s7_pointer args, const char *name, boo if (s7_list_length(sc, cadr(args)) <= 0) return(s7_wrong_type_arg_error(sc, name, 2, cadr(args), "a proper list")); - + x = car(args); - for (y = cadr(args); is_pair(y) && is_pair(car(y)); y = cdr(y)) + for (y = cadr(args); is_pair(y) && is_pair(car(y)); y = cdr(y)) if (eq_func(x, caar(y))) return(car(y)); - + return(sc->F); -} +} static s7_pointer g_assq(s7_scheme *sc, s7_pointer args) {return(g_assq_1(sc, args, "assq", s7_is_eq));} @@ -10495,13 +10495,13 @@ static s7_pointer g_memq_1(s7_scheme *sc, s7_pointer args, const char *name, boo if (s7_list_length(sc, cadr(args)) <= 0) return(s7_wrong_type_arg_error(sc, name, 2, cadr(args), "a proper list")); - - for (x = cadr(args); is_pair(x); x = cdr(x)) + + for (x = cadr(args); is_pair(x); x = cdr(x)) if (eq_func(car(args), car(x))) return(x); - + return(sc->F); -} +} static s7_pointer g_memq(s7_scheme *sc, s7_pointer args) {return(g_memq_1(sc, args, "memq", s7_is_eq));} @@ -10544,10 +10544,10 @@ static s7_pointer g_provide(s7_scheme *sc, s7_pointer args) if (is_encapsulating(sc)) encapsulate(sc, features); #endif - s7_symbol_set_value(sc, + s7_symbol_set_value(sc, features, - s7_cons(sc, - car(args), + s7_cons(sc, + car(args), s7_symbol_value(sc, features))); } return(car(args)); @@ -10568,21 +10568,21 @@ static s7_pointer g_append(s7_scheme *sc, s7_pointer args) s7_pointer x, y; int i; - if (args == sc->NIL) + if (args == sc->NIL) return(sc->NIL); if (cdr(args) == sc->NIL) - return(car(args)); - + return(car(args)); + x = sc->NIL; - for (i = 1, y = args; y != sc->NIL; i++, y = cdr(y)) + for (i = 1, y = args; y != sc->NIL; i++, y = cdr(y)) { if (cdr(y) == sc->NIL) return(s7_append(sc, x, car(y))); - + if (!is_proper_list(sc, car(y))) return(s7_wrong_type_arg_error(sc, "append", i, car(y), "a list")); - + x = s7_append(sc, x, car(y)); } return(x); @@ -10592,13 +10592,13 @@ static s7_pointer g_append(s7_scheme *sc, s7_pointer args) /* -------------------------------- vectors -------------------------------- */ -bool s7_is_vector(s7_pointer p) -{ +bool s7_is_vector(s7_pointer p) +{ return(type(p) == T_VECTOR); } -static s7_pointer s7_make_vector_1(s7_scheme *sc, s7_Int len, bool filled) +static s7_pointer s7_make_vector_1(s7_scheme *sc, s7_Int len, bool filled) { s7_pointer x; if (len > 0) @@ -10688,13 +10688,13 @@ static void vector_fill(s7_scheme *sc, s7_pointer vec, s7_pointer obj) { int j, jlen; jlen = len; - for (j = 0; j < jlen; j++) + for (j = 0; j < jlen; j++) tp[j] = obj; } else { s7_Int i; - for (i = 0; i < len; i++) + for (i = 0; i < len; i++) tp[i] = obj; } } @@ -10707,7 +10707,7 @@ static s7_pointer s7_vector_copy(s7_scheme *sc, s7_pointer old_vect) len = vector_length(old_vect); new_vect = s7_make_vector_1(sc, len, false); - /* + /* * here and in vector-fill! we have a problem with bignums -- should new bignums be allocated? (copy_list also) */ memcpy((void *)(vector_elements(new_vect)), (void *)(vector_elements(old_vect)), len * sizeof(s7_pointer)); @@ -10732,7 +10732,7 @@ static s7_pointer g_vector_fill(s7_scheme *sc, s7_pointer args) } -s7_pointer s7_vector_ref(s7_scheme *sc, s7_pointer vec, s7_Int index) +s7_pointer s7_vector_ref(s7_scheme *sc, s7_pointer vec, s7_Int index) { if (index >= vector_length(vec)) return(s7_out_of_range_error(sc, "vector-ref", 2, s7_make_integer(sc, index), "index should be less than vector length")); @@ -10741,7 +10741,7 @@ s7_pointer s7_vector_ref(s7_scheme *sc, s7_pointer vec, s7_Int index) } -s7_pointer s7_vector_set(s7_scheme *sc, s7_pointer vec, s7_Int index, s7_pointer a) +s7_pointer s7_vector_set(s7_scheme *sc, s7_pointer vec, s7_Int index, s7_pointer a) { /* it's possible to have a vector that points to itself: * (let ((v (make-vector 2))) (vector-set! v 0 v) v) @@ -10852,16 +10852,16 @@ static s7_pointer g_vector(s7_scheme *sc, s7_pointer args) #define H_vector "(vector ...) returns a vector whose elements are the arguments" s7_Int i, len; s7_pointer vec; - + len = s7_list_length(sc, args); - if (len < 0) + if (len < 0) return(s7_wrong_type_arg_error(sc, "vector", 1, car(args), "a proper list")); - + vec = s7_make_vector_1(sc, len, false); if (len > 0) { s7_pointer x; - for (x = args, i = 0; is_pair(x); x = cdr(x), i++) + for (x = args, i = 0; is_pair(x); x = cdr(x), i++) vector_element(vec, i) = car(x); } return(vec); @@ -10871,7 +10871,7 @@ static s7_pointer g_vector(s7_scheme *sc, s7_pointer args) static s7_pointer g_list_to_vector(s7_scheme *sc, s7_pointer args) { #define H_list_to_vector "(list->vector lst) returns a vector containing the elements of lst" - + if (car(args) == sc->NIL) return(s7_make_vector(sc, 0)); if (!is_proper_list(sc, car(args))) @@ -10903,7 +10903,7 @@ static s7_pointer vector_ref_1(s7_scheme *sc, s7_pointer vect, s7_pointer indice if (!s7_is_integer(car(x))) return(s7_wrong_type_arg_error(sc, "vector ref", i + 2, car(x), "an integer")); n = s7_integer(car(x)); - if ((n < 0) || + if ((n < 0) || (n >= vector_dimension(vect, i))) return(s7_out_of_range_error(sc, "vector ref", i + 2, car(x), "index should be between 0 and the dimension size")); index += n * vector_offset(vect, i); @@ -10961,13 +10961,13 @@ can also use 'set!' instead of 'vector-set!': (set! (v ...) val) -- I find this #endif s7_pointer vec, val; s7_Int index; - + vec = car(args); if (!s7_is_vector(vec)) return(s7_wrong_type_arg_error(sc, "vector-set!", 1, vec, "a vector")); if (s7_is_immutable(vec)) return(s7_wrong_type_arg_error(sc, "vector-set!", 1, vec, "a mutable vector")); - + #if WITH_MULTIDIMENSIONAL_VECTORS if (vector_is_multidimensional(vec)) { @@ -10980,7 +10980,7 @@ can also use 'set!' instead of 'vector-set!': (set! (v ...) val) -- I find this if (!s7_is_integer(car(x))) return(s7_wrong_type_arg_error(sc, "vector-set!", i + 2, car(x), "an integer")); n = s7_integer(car(x)); - if ((n < 0) || + if ((n < 0) || (n >= vector_dimension(vec, i))) return(s7_out_of_range_error(sc, "vector-set!", i, car(x), "index should be between 0 and the dimension size")); index += n * vector_offset(vec, i); @@ -11006,7 +11006,7 @@ can also use 'set!' instead of 'vector-set!': (set! (v ...) val) -- I find this val = caddr(args); } - + vector_element(vec, index) = val; return(val); } @@ -11062,8 +11062,8 @@ returns a 2 dimensional vector of 6 total elements, all initialized to 1.0." } } #endif - - if (cdr(args) != sc->NIL) + + if (cdr(args) != sc->NIL) fill = cadr(args); vec = s7_make_vector_1(sc, len, false); @@ -11139,7 +11139,7 @@ static s7_pointer g_vector_dimensions(s7_scheme *sc, s7_pointer args) lst = s7_cons(sc, s7_make_integer(sc, vector_dimension(x, i)), lst); return(lst); } - + return(make_list_1(sc, s7_make_integer(sc, vector_length(x)))); } #endif @@ -11177,13 +11177,13 @@ static s7_pointer g_vector_for_each(s7_scheme *sc, s7_pointer args) /* the actual loop has to be done in the evaluator else (for example) call/cc won't work right */ /* (call/cc (lambda (return) (vector-for-each (lambda (n) (display n) (if (even? n) (return n))) (vector 1 3 8 7 9 10)))) */ - - /* during the loop we need the vector list (cdddr(sc->args)), the function (sc->code), + + /* during the loop we need the vector list (cdddr(sc->args)), the function (sc->code), * the (mutable) loop counter (car(sc->args)) and end (cadr(sc->args)), and the current function arg list (caddr(sc->args)). */ - sc->args = s7_cons(sc, make_mutable_integer(sc, 0), - s7_cons(sc, s7_make_integer(sc, len), + sc->args = s7_cons(sc, make_mutable_integer(sc, 0), + s7_cons(sc, s7_make_integer(sc, len), s7_cons(sc, fargs, cdr(args)))); push_stack(sc, OP_VECTOR_FOR_EACH, sc->args, sc->code); return(sc->UNSPECIFIED); @@ -11220,8 +11220,8 @@ static s7_pointer g_hash_table_for_each(s7_scheme *sc, s7_pointer args) } } - sc->args = s7_cons(sc, make_mutable_integer(sc, 0), - s7_cons(sc, s7_make_integer(sc, len), + sc->args = s7_cons(sc, make_mutable_integer(sc, 0), + s7_cons(sc, s7_make_integer(sc, len), s7_cons(sc, fargs, cdr(args)))); push_stack(sc, OP_HASH_TABLE_FOR_EACH, sc->args, sc->code); return(sc->UNSPECIFIED); @@ -11260,14 +11260,14 @@ static s7_pointer g_vector_map(s7_scheme *sc, s7_pointer args) /* the actual loop has to be done in the evaluator else (for example) call/cc won't work right */ /* (call/cc (lambda (return) (vector-for-each (lambda (n) (display n) (if (even? n) (return n))) (vector 1 3 8 7 9 10)))) */ - + /* during the loop we need the vector list (cddddr(sc->args)), the function (sc->code), the new vector (car(sc->args)), * the (mutable) loop counter (cadr(sc->args)) and end (caddr(sc->args)), and the current function arg list (cadddr(sc->args)). */ sc->args = s7_cons(sc, s7_make_vector(sc, len), - s7_cons(sc, make_mutable_integer(sc, 0), - s7_cons(sc, s7_make_integer(sc, len), + s7_cons(sc, make_mutable_integer(sc, 0), + s7_cons(sc, s7_make_integer(sc, len), s7_cons(sc, fargs, cdr(args))))); push_stack(sc, OP_VECTOR_MAP0, sc->args, sc->code); return(sc->UNSPECIFIED); @@ -11288,7 +11288,7 @@ static s7_pointer g_vector_map(s7_scheme *sc, s7_pointer args) cadr(compare_proc_args) = (*(s7_pointer *)v2); start = compare_sc->stack_top; /* see note below */ - push_stack(compare_sc, OP_EVAL_DONE, compare_sc->args, compare_sc->code); + push_stack(compare_sc, OP_EVAL_DONE, compare_sc->args, compare_sc->code); compare_sc->args = compare_proc_args; compare_sc->code = compare_proc; eval(compare_sc, OP_APPLY); @@ -11336,7 +11336,7 @@ If its first argument is a list, the list is copied (despite the '!')." * an error? */ - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = compare_proc_args; sc->code = compare_proc; eval(sc, OP_APPLY); @@ -11359,8 +11359,8 @@ If its first argument is a list, the list is copied (despite the '!')." s7_pointer val; if (sc->free_heap_top < 4096) gc(sc); s7_gc_on(sc, false); - val = g_sort_in_place(sc, make_list_2(sc, - g_list_to_vector(sc, make_list_1(sc, vect)), + val = g_sort_in_place(sc, make_list_2(sc, + g_list_to_vector(sc, make_list_1(sc, vect)), cadr(args))); if (s7_is_vector(val)) val = s7_vector_to_list(sc, val); @@ -11449,7 +11449,7 @@ static s7_pointer g_make_hash_table(s7_scheme *sc, s7_pointer args) } else return(s7_wrong_type_arg_error(sc, "make-hash-table", 0, car(args), "an integer")); } - + return(s7_make_hash_table(sc, size)); } @@ -11458,12 +11458,12 @@ s7_pointer s7_hash_table_ref(s7_scheme *sc, s7_pointer table, const char *name) { s7_Int location; s7_pointer x; - + location = hash_table_hash(name, vector_length(table)); - for (x = vector_element(table, location); x != sc->NIL; x = cdr(x)) - if (strcmp(name, string_value(caar(x))) == 0) - return(cdar(x)); - + for (x = vector_element(table, location); x != sc->NIL; x = cdr(x)) + if (strcmp(name, string_value(caar(x))) == 0) + return(cdar(x)); + return(sc->F); } @@ -11472,20 +11472,20 @@ s7_pointer s7_hash_table_set(s7_scheme *sc, s7_pointer table, const char *name, { s7_Int location; s7_pointer x; - location = hash_table_hash(name, vector_length(table)); - + location = hash_table_hash(name, vector_length(table)); + /* if it exists, update value, else add to table */ - for (x = vector_element(table, location); x != sc->NIL; x = cdr(x)) + for (x = vector_element(table, location); x != sc->NIL; x = cdr(x)) if (strcmp(name, string_value(caar(x))) == 0) { cdar(x) = value; return(value); } - vector_element(table, location) = s7_cons(sc, - s7_cons(sc, - s7_make_string(sc, name), + vector_element(table, location) = s7_cons(sc, + s7_cons(sc, + s7_make_string(sc, name), value), - vector_element(table, location)); + vector_element(table, location)); return(value); } @@ -11517,13 +11517,13 @@ static s7_pointer g_hash_table_ref(s7_scheme *sc, s7_pointer args) table = car(args); key = cadr(args); - + if (!s7_is_hash_table(table)) return(s7_wrong_type_arg_error(sc, "hash-table-ref", 1, table, "a hash-table")); if (s7_is_string(key)) name = string_value(key); - else + else { if (s7_is_symbol(key)) name = s7_symbol_name(key); @@ -11552,13 +11552,13 @@ static s7_pointer g_hash_table_set(s7_scheme *sc, s7_pointer args) table = car(args); key = cadr(args); - + if (!s7_is_hash_table(table)) return(s7_wrong_type_arg_error(sc, "hash-table-set!", 1, table, "a hash-table")); if (s7_is_string(key)) name = string_value(key); - else + else { if (s7_is_symbol(key)) name = s7_symbol_name(key); @@ -11574,7 +11574,7 @@ static s7_pointer g_hash_table_set(s7_scheme *sc, s7_pointer args) } } } - + return(s7_hash_table_set(sc, table, name, caddr(args))); } @@ -11600,14 +11600,14 @@ static s7_pointer g_hash_table_set(s7_scheme *sc, s7_pointer args) * should probably add a list of methods (reverse, member, etc) */ -bool s7_is_function(s7_pointer p) -{ +bool s7_is_function(s7_pointer p) +{ return(is_c_function(p)); } -bool s7_is_object(s7_pointer p) -{ +bool s7_is_object(s7_pointer p) +{ return(is_c_object(p)); } @@ -11680,7 +11680,7 @@ static int pws_get_opt_args(s7_pointer x); s7_pointer s7_procedure_source(s7_scheme *sc, s7_pointer p) { /* make it look like an internal lambda form */ - + /* in this context, there's no way to distinguish between: * (procedure-source (let ((b 1)) (lambda (a) (+ a b)))) * and @@ -11688,18 +11688,18 @@ s7_pointer s7_procedure_source(s7_scheme *sc, s7_pointer p) * both become: * ((a) (+ a b)) (((b . 1)) #(() () () () () ((make-filtered-comb . make-filtered-comb)) () () ...)) */ - + if (is_closure(p) || is_closure_star(p) || is_macro(p)) { - return(s7_cons(sc, - s7_append(sc, - make_list_2(sc, - (is_closure_star(p)) ? sc->LAMBDA_STAR : sc->LAMBDA, + return(s7_cons(sc, + s7_append(sc, + make_list_2(sc, + (is_closure_star(p)) ? sc->LAMBDA_STAR : sc->LAMBDA, closure_args(p)), closure_body(p)), closure_environment(p))); } - + if (s7_is_procedure_with_setter(p)) return(pws_source(sc, p)); return(sc->NIL); @@ -11710,9 +11710,9 @@ static s7_pointer g_procedure_source(s7_scheme *sc, s7_pointer args) { /* make it look like a scheme-level lambda */ s7_pointer p; - + #define H_procedure_source "(procedure-source func) tries to return the definition of func" - + if (s7_is_symbol(car(args))) p = s7_symbol_value(sc, car(args)); else p = car(args); @@ -11721,9 +11721,9 @@ static s7_pointer g_procedure_source(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "procedure-source", 0, p, "a procedure or a macro")); if (is_closure(p) || is_closure_star(p) || is_macro(p)) - return(s7_append(sc, - make_list_2(sc, - (is_closure_star(p)) ? sc->LAMBDA_STAR : sc->LAMBDA, + return(s7_append(sc, + make_list_2(sc, + (is_closure_star(p)) ? sc->LAMBDA_STAR : sc->LAMBDA, closure_args(p)), closure_body(p))); @@ -11733,8 +11733,8 @@ static s7_pointer g_procedure_source(s7_scheme *sc, s7_pointer args) } -s7_pointer s7_procedure_environment(s7_pointer p) -{ +s7_pointer s7_procedure_environment(s7_pointer p) +{ return(closure_environment(p)); } @@ -11742,9 +11742,9 @@ s7_pointer s7_procedure_environment(s7_pointer p) static s7_pointer g_procedure_environment(s7_scheme *sc, s7_pointer args) { s7_pointer p; - + #define H_procedure_environment "(procedure-environment func) tries to return func's environment" - + if (s7_is_symbol(car(args))) p = s7_symbol_value(sc, car(args)); else p = car(args); @@ -11791,13 +11791,13 @@ void s7_define_function_star(s7_scheme *sc, const char *name, s7_function fnc, c int arglist_len, len, args; const char *local_sym; s7_pointer local_args; - + arglist_len = safe_strlen(arglist); internal_arglist = (char *)calloc(arglist_len + 64, sizeof(char)); snprintf(internal_arglist, arglist_len + 64, "(map (lambda (arg) (if (symbol? arg) arg (car arg))) '(%s))", arglist); local_args = s7_eval_c_string(sc, internal_arglist); free(internal_arglist); - + args = s7_list_length(sc, local_args); internal_arglist = s7_object_to_c_string(sc, local_args); /* this has an opening paren which we don't want */ @@ -11824,15 +11824,15 @@ const char *s7_procedure_documentation(s7_scheme *sc, s7_pointer x) if ((s7_is_function(x)) || (is_c_macro(x))) return((char *)c_function_documentation(x)); - - if (((is_closure(x)) || + + if (((is_closure(x)) || (is_closure_star(x))) && (s7_is_string(car(closure_body(x))))) return(s7_string(car(closure_body(x)))); - + if (s7_is_procedure_with_setter(x)) return(pws_documentation(x)); - + return(""); /* not NULL here so that (string=? "" (procedure-documentation no-doc-func)) -> #t */ } @@ -11854,37 +11854,37 @@ static s7_pointer g_procedure_documentation(s7_scheme *sc, s7_pointer args) s7_pointer s7_procedure_arity(s7_scheme *sc, s7_pointer x) { if (s7_is_function(x)) - return(make_list_3(sc, - s7_make_integer(sc, c_function_required_args(x)), + return(make_list_3(sc, + s7_make_integer(sc, c_function_required_args(x)), s7_make_integer(sc, c_function_optional_args(x)), (c_function_has_rest_arg(x)) ? sc->T : sc->F)); - + if ((is_closure(x)) || (is_closure_star(x)) || (is_pair(x))) { int len; - + if (is_pair(x)) len = s7_list_length(sc, car(x)); - else + else { if (s7_is_symbol(closure_args(x))) return(make_list_3(sc, small_int(sc, 0), small_int(sc, 0), sc->T)); len = s7_list_length(sc, closure_args(x)); } - + if (is_closure_star(x)) return(make_list_3(sc, small_int(sc, 0), s7_make_integer(sc, abs(len)), make_boolean(sc, len < 0))); return(make_list_3(sc, s7_make_integer(sc, abs(len)), small_int(sc, 0), make_boolean(sc, len < 0))); } - + if (s7_is_procedure_with_setter(x)) - return(make_list_3(sc, + return(make_list_3(sc, s7_make_integer(sc, pws_get_req_args(x)), s7_make_integer(sc, pws_get_opt_args(x)), sc->F)); - + if ((s7_is_applicable_object(x)) || (s7_is_continuation(x))) return(make_list_3(sc, small_int(sc, 0), small_int(sc, 0), sc->T)); @@ -11948,9 +11948,9 @@ static int object_types_size = 0; static int num_types = 0; -int s7_new_type(const char *name, - char *(*print)(s7_scheme *sc, void *value), - void (*free)(void *value), +int s7_new_type(const char *name, + char *(*print)(s7_scheme *sc, void *value), + void (*free)(void *value), bool (*equal)(void *val1, void *val2), void (*gc_mark)(void *val), s7_pointer (*apply)(s7_scheme *sc, s7_pointer obj, s7_pointer args), @@ -11986,9 +11986,9 @@ int s7_new_type(const char *name, } -int s7_new_type_x(const char *name, - char *(*print)(s7_scheme *sc, void *value), - void (*free)(void *value), +int s7_new_type_x(const char *name, + char *(*print)(s7_scheme *sc, void *value), + void (*free)(void *value), bool (*equal)(void *val1, void *val2), void (*gc_mark)(void *val), s7_pointer (*apply)(s7_scheme *sc, s7_pointer obj, s7_pointer args), @@ -12176,8 +12176,8 @@ static s7_pointer g_object_for_each(s7_scheme *sc, s7_pointer args) } } - sc->args = s7_cons(sc, make_mutable_integer(sc, 0), - s7_cons(sc, s7_make_integer(sc, len), + sc->args = s7_cons(sc, make_mutable_integer(sc, 0), + s7_cons(sc, s7_make_integer(sc, len), s7_cons(sc, fargs, cdr(args)))); push_stack(sc, OP_OBJECT_FOR_EACH, sc->args, sc->code); return(sc->UNSPECIFIED); @@ -12201,9 +12201,9 @@ typedef struct { } s7_pws_t; -s7_pointer s7_make_procedure_with_setter(s7_scheme *sc, +s7_pointer s7_make_procedure_with_setter(s7_scheme *sc, const char *name, - s7_pointer (*getter)(s7_scheme *sc, s7_pointer args), + s7_pointer (*getter)(s7_scheme *sc, s7_pointer args), int get_req_args, int get_opt_args, s7_pointer (*setter)(s7_scheme *sc, s7_pointer args), int set_req_args, int set_opt_args, @@ -12277,7 +12277,7 @@ static s7_pointer pws_apply(s7_scheme *sc, s7_pointer obj, s7_pointer args) if (f->getter != NULL) return((*(f->getter))(sc, args)); - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = args; sc->code = f->scheme_getter; eval(sc, OP_APPLY); @@ -12293,7 +12293,7 @@ static s7_pointer pws_set(s7_scheme *sc, s7_pointer obj, s7_pointer args) if (f->setter != NULL) return((*(f->setter))(sc, args)); - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = args; sc->code = f->scheme_setter; eval(sc, OP_APPLY); @@ -12326,13 +12326,13 @@ occurs as the object of set!." (is_closure_star(getter))) f->get_req_args = s7_list_length(sc, closure_args(getter)); else f->get_req_args = s7_list_length(sc, caar(args)); - + f->scheme_setter = setter; if ((is_closure(setter)) || (is_closure_star(setter))) f->set_req_args = s7_list_length(sc, closure_args(setter)); else f->set_req_args = s7_list_length(sc, caadr(args)); - + return(p); } @@ -12417,7 +12417,7 @@ static s7_pointer pws_source(s7_scheme *sc, s7_pointer x) f = (s7_pws_t *)s7_object_value(x); if ((is_closure(f->scheme_getter)) || (is_closure_star(f->scheme_getter))) - return(s7_append(sc, + return(s7_append(sc, make_list_2(sc, (is_closure(f->scheme_getter)) ? sc->LAMBDA : sc->LAMBDA_STAR, closure_args(f->scheme_getter)), @@ -12428,7 +12428,7 @@ static s7_pointer pws_source(s7_scheme *sc, s7_pointer x) void s7_define_function_with_setter(s7_scheme *sc, const char *name, s7_function get_fnc, s7_function set_fnc, int req_args, int opt_args, const char *doc) { - s7_define_variable(sc, name, + s7_define_variable(sc, name, s7_make_procedure_with_setter(sc, name, get_fnc, req_args, opt_args, set_fnc, req_args + 1, opt_args, doc)); } @@ -12442,65 +12442,65 @@ bool s7_is_eq(s7_pointer obj1, s7_pointer obj2) } -bool s7_is_eqv(s7_pointer a, s7_pointer b) +bool s7_is_eqv(s7_pointer a, s7_pointer b) { - if (a == b) + if (a == b) return(true); - + #if WITH_GMP if (big_numbers_are_eqv(a, b)) return(true); /* T_NUMBER != T_C_OBJECT but both can represent numbers */ #endif - if (type(a) != type(b)) + if (type(a) != type(b)) return(false); - - if (s7_is_string(a)) + + if (s7_is_string(a)) return(string_value(a) == string_value(b)); - + if (s7_is_number(a)) return(numbers_are_eqv(a, b)); - + if (s7_is_character(a)) return(s7_character(a) == s7_character(b)); - + return(false); } bool s7_is_equal(s7_pointer x, s7_pointer y) { - if (x == y) + if (x == y) return(true); - + #if WITH_GMP if (big_numbers_are_eqv(x, y)) return(true); /* T_NUMBER != T_C_OBJECT but both can represent numbers */ #endif - if (type(x) != type(y)) + if (type(x) != type(y)) return(false); - + if (is_pair(x)) return((s7_is_equal(car(x), car(y))) && (s7_is_equal(cdr(x), cdr(y)))); - + if (s7_is_string(x)) return((string_length(x) == string_length(y)) && ((string_length(x) == 0) || (strcmp(string_value(x), string_value(y)) == 0))); - + if (is_c_object(x)) return(s7_equalp_objects(x, y)); - + if ((s7_is_vector(x)) || (s7_is_hash_table(x))) return(vectors_equal(x, y)); - - if (s7_is_character(x)) + + if (s7_is_character(x)) return(s7_character(x) == s7_character(y)); - + if (s7_is_number(x)) return(numbers_are_eqv(x, y)); - + return(false); /* we already checked that x != y (port etc) */ } @@ -12532,9 +12532,9 @@ static s7_pointer g_is_equal(s7_scheme *sc, s7_pointer args) static s7_pointer g_length(s7_scheme *sc, s7_pointer args) { #define H_length "(length obj) returns the length of obj, which can be a list, vector, string, or hash-table" - + s7_pointer lst = car(args); - + if (lst == sc->NIL) return(small_int(sc, 0)); @@ -12544,12 +12544,12 @@ static s7_pointer g_length(s7_scheme *sc, s7_pointer args) { int len; len = s7_list_length(sc, lst); - - if (len < 0) + + if (len < 0) return(s7_wrong_type_arg_error(sc, "length:", 0, lst, "a proper (not a dotted) list")); if (len == 0) return(s7_wrong_type_arg_error(sc, "length:", 0, lst, "a proper (not a circular) list")); - + return(s7_make_integer(sc, len)); } @@ -12568,7 +12568,7 @@ static s7_pointer g_length(s7_scheme *sc, s7_pointer args) default: return(s7_wrong_type_arg_error(sc, "length", 0, lst, "a list, vector, string, or hash-table")); } - + return(small_int(sc, 0)); } @@ -12647,7 +12647,7 @@ static s7_pointer g_fill(s7_scheme *sc, s7_pointer args) case T_PAIR: return(s7_list_fill(sc, car(args), cadr(args))); - + } return(cadr(args)); } @@ -12659,16 +12659,16 @@ static s7_pointer g_fill(s7_scheme *sc, s7_pointer args) /* encapsulate: open-encapsulator, close-encapsulator, (obj) to restore, encapsulator-bindings - - (define-macro (encapsulate . body) + + (define-macro (encapsulate . body) (let ((encap (gensym))) `(let ((,encap (open-encapsulator))) (dynamic-wind - (lambda () + (lambda () #f) - (lambda () + (lambda () ,@body) - (lambda () + (lambda () ((,encap)) ; restore saved vars (close-encapsulator ,encap)))))) */ @@ -12725,7 +12725,7 @@ static s7_pointer g_open_encapsulator(s7_scheme *sc, s7_pointer args) e = (encap_t *)malloc(sizeof(encap_t)); e->bindings = sc->NIL; e->envir = sc->envir; - obj = s7_make_object(sc, encapsulator_tag, (void *)e); + obj = s7_make_object(sc, encapsulator_tag, (void *)e); sc->encapsulators = s7_cons(sc, obj, sc->encapsulators); return(obj); } @@ -12738,7 +12738,7 @@ static s7_pointer g_close_encapsulator(s7_scheme *sc, s7_pointer args) /* remove from s7 list */ encap_t *e; s7_pointer x, obj; - + obj = car(args); if ((!is_c_object(obj)) || (c_object_type(obj) != encapsulator_tag)) @@ -12780,7 +12780,7 @@ static s7_pointer g_encapsulator_bindings(s7_scheme *sc, s7_pointer args) encap_t *e; s7_pointer obj; - + obj = car(args); if ((!is_c_object(obj)) || (c_object_type(obj) != encapsulator_tag)) @@ -12800,7 +12800,7 @@ static s7_pointer encapsulator_apply(s7_scheme *sc, s7_pointer obj, s7_pointer a { /* no args, restore all values */ s7_pointer x, y; - for (x = e->bindings; is_pair(x); x = cdr(x)) + for (x = e->bindings; is_pair(x); x = cdr(x)) { y = s7_find_symbol_in_environment(sc, sc->envir, caar(x), true); if (y != sc->NIL) @@ -12815,10 +12815,10 @@ static s7_pointer encapsulator_apply(s7_scheme *sc, s7_pointer obj, s7_pointer a /* find symbol in this encapsulation, return its value */ s7_pointer y, sym; sym = car(args); - for (y = e->bindings; is_pair(y); y = cdr(y)) + for (y = e->bindings; is_pair(y); y = cdr(y)) if (sym == caar(y)) return(cdar(y)); - + return(sc->UNDEFINED); } else return(s7_wrong_type_arg_error(sc, "encapsulator", 0, car(args), "a symbol")); @@ -12839,7 +12839,7 @@ static void encapsulate(s7_scheme *sc, s7_pointer sym) e = (encap_t *)s7_object_value(car(x)); - for (y = e->bindings; is_pair(y); y = cdr(y)) + for (y = e->bindings; is_pair(y); y = cdr(y)) if (sym == caar(y)) { ok = true; @@ -12850,9 +12850,9 @@ static void encapsulate(s7_scheme *sc, s7_pointer sym) { y = s7_find_symbol_in_environment(sc, e->envir, sym, true); if (y != sc->NIL) - e->bindings = s7_cons(sc, - s7_cons(sc, sym, s7_copy(sc, symbol_value(y))), - e->bindings); + e->bindings = s7_cons(sc, + s7_cons(sc, sym, s7_copy(sc, symbol_value(y))), + e->bindings); /* a C-side procedure-with-setter becomes a no-op here -- accessing the underlying value is too tricky */ } @@ -12884,7 +12884,7 @@ static char *s7_format_error(s7_scheme *sc, const char *msg, const char *str, s7 errmsg = (char *)malloc(len * sizeof(char)); snprintf(errmsg, len, "format ~S ~{~A~^ ~}: %s", msg); } - else + else { char *filler; int i; @@ -13008,7 +13008,7 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, format_append_char(fdat, '\n'); i++; break; - + case '~': /* -------- tilde -------- */ format_append_char(fdat, '~'); i++; @@ -13022,7 +13022,7 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, break; } break; - + case '*': /* -------- ignore arg -------- */ i++; fdat->args = cdr(fdat->args); @@ -13036,7 +13036,7 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, } i++; break; - + case 'A': case 'a': /* -------- object->string -------- */ case 'C': case 'c': case 'S': case 's': @@ -13056,7 +13056,7 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, if (tmp) free(tmp); fdat->args = cdr(fdat->args); break; - + case '{': /* -------- iteration -------- */ { s7_pointer curly_arg; @@ -13094,7 +13094,7 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, curly_str[k] = str[i + 2 + k]; curly_str[curly_len - 1] = '\0'; - curly_arg = car(fdat->args); + curly_arg = car(fdat->args); while (curly_arg != sc->NIL) { s7_pointer new_arg = sc->NIL; @@ -13114,10 +13114,10 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, free(curly_str); } break; - + case '}': return(s7_format_error(sc, "unmatched '}'", str, args, fdat)); - + /* -------- numeric args -------- */ case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': case ',': @@ -13172,7 +13172,7 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, for (k = outstr_len - 1; k > 0; k--) if (fdat->str[k] == '\n') break; - + if (precision > 0) { int mult; @@ -13214,7 +13214,7 @@ static char *format_to_c_string(s7_scheme *sc, const char *str, s7_pointer args, case 'B': case 'b': format_number(sc, fdat, 2, width, (precision < 0) ? 0 : precision, 'b', pad); break; - + default: return(s7_format_error(sc, "unimplemented format directive", str, args, fdat)); } @@ -13254,8 +13254,8 @@ static s7_pointer format_to_output(s7_scheme *sc, s7_pointer out_loc, const char if (!in_str) { if (args != sc->NIL) - return(s7_error(sc, - sc->FORMAT_ERROR, + return(s7_error(sc, + sc->FORMAT_ERROR, make_list_2(sc, s7_make_string(sc, "format control string is null, but there are other arguments"), args))); return(s7_make_string(sc, "")); } @@ -13291,7 +13291,7 @@ spacing (and spacing character) and precision. ~{ starts an embedded format dir if (!s7_is_string(cadr(args))) return(s7_wrong_type_arg_error(sc, "format", 2, cadr(args), "a string")); - + if (!((s7_is_boolean(pt)) || /* #f or #t */ (pt == sc->NIL) || /* default current-output-port = stdout -> nil */ (s7_is_output_port(sc, pt)))) /* (current-output-port) or call-with-open-file arg, etc */ @@ -13312,7 +13312,7 @@ const char *s7_format(s7_scheme *sc, s7_pointer args) /* -------- trace -------- */ -/* +/* (define (hiho arg) (if (> arg 0) (+ 1 (hiho (- arg 1))) 0)) (trace hiho) (hiho 3) @@ -13348,14 +13348,14 @@ untrace without arguments to turn this off." (*(sc->tracing)) = true; return(sc->F); } - - for (i = 0, x = args; x != sc->NIL; i++, x = cdr(x)) + + for (i = 0, x = args; x != sc->NIL; i++, x = cdr(x)) if ((!s7_is_symbol(car(x))) && (!s7_is_procedure(car(x))) && (!is_any_macro(car(x)))) return(s7_wrong_type_arg_error(sc, "trace", i + 1, car(x), "a symbol, a function, or some other applicable object")); - for (i = 0, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 0, x = args; x != sc->NIL; i++, x = cdr(x)) { if (s7_is_symbol(car(x))) sc->trace_list[sc->trace_top++] = eval_symbol(sc, car(x)); @@ -13393,23 +13393,23 @@ If untrace is called with no arguments, all functions are removed, turning off a return(sc->F); } - for (x = args; x != sc->NIL; x = cdr(x)) + for (x = args; x != sc->NIL; x = cdr(x)) { s7_pointer value; if (s7_is_symbol(car(x))) value = eval_symbol(sc, car(x)); else value = car(x); - + for (i = 0; i < sc->trace_top; i++) if (value == sc->trace_list[i]) sc->trace_list[i] = sc->NIL; } - + /* now collapse list and reset trace_top (and possibly tracing) */ for (i = 0, j = 0; i < sc->trace_top; i++) if (sc->trace_list[i] != sc->NIL) sc->trace_list[j++] = sc->trace_list[i]; - + sc->trace_top = j; (*(sc->tracing)) = (sc->trace_top > 0); return(sc->T); @@ -13449,17 +13449,17 @@ static void trace_apply(s7_scheme *sc) len = safe_strlen(tmp2); tmp2[0] = ' '; tmp2[len - 1] = ']'; - + len += (safe_strlen(tmp1) + sc->trace_depth + 64); str = (char *)calloc(len, sizeof(char)); - + for (k = 0; k < sc->trace_depth; k++) str[k] = ' '; str[k] = '['; strcat(str, tmp1); strcat(str, tmp2); free(tmp1); free(tmp2); - + #if HAVE_PTHREADS if (id != 0) /* main thread */ { @@ -13470,11 +13470,11 @@ static void trace_apply(s7_scheme *sc) free(tmp3); } #endif - + strcat(str, "\n"); write_string(sc, str, sc->output_port); free(str); - + sc->trace_depth++; { @@ -13503,7 +13503,7 @@ static void trace_return(s7_scheme *sc) sc = sc->orig_sc; #endif - tmp = s7_object_to_c_string(sc, sc->value); + tmp = s7_object_to_c_string(sc, sc->value); len = sc->trace_depth + safe_strlen(tmp) + 2; str = (char *)calloc(len, sizeof(char)); @@ -13565,14 +13565,14 @@ static const char *s7_type_name(s7_pointer arg) return("output string port"); return("output port"); } - - case T_NUMBER: + + case T_NUMBER: { switch (number_type(arg)) { case NUM_INT: return("integer"); case NUM_RATIO: return("ratio"); - case NUM_REAL: + case NUM_REAL: case NUM_REAL2: return("real"); default: return("complex number"); /* "a complex" doesn't sound right */ } @@ -13616,7 +13616,7 @@ s7_pointer s7_out_of_range_error(s7_scheme *sc, const char *caller, int arg_n, s int len, slen; char *errmsg; s7_pointer x; - + len = safe_strlen(descr) + safe_strlen(caller) + 64; errmsg = (char *)malloc(len * sizeof(char)); if (arg_n <= 0) arg_n = 1; @@ -13684,7 +13684,7 @@ each a function of no arguments, guaranteeing that finish is called even if body return(s7_wrong_type_arg_error(sc, "dynamic-wind", 2, cadr(args), "a thunk")); if (!is_thunk(sc, caddr(args))) return(s7_wrong_type_arg_error(sc, "dynamic-wind", 3, caddr(args), "a thunk")); - + p = new_cell(sc); dynamic_wind_in(p) = car(args); dynamic_wind_body(p) = cadr(args); @@ -13692,7 +13692,7 @@ each a function of no arguments, guaranteeing that finish is called even if body set_type(p, T_DYNAMIC_WIND | T_ATOM | T_DWIND_INIT | T_DONT_COPY); /* atom -> don't mark car/cdr, don't copy */ push_stack(sc, OP_DYNAMIC_WIND, sc->NIL, p); /* args will be the saved result, code = s7_dynwind_t obj */ - + sc->args = sc->NIL; sc->code = car(args); push_stack(sc, OP_APPLY, sc->args, sc->code); @@ -13709,7 +13709,7 @@ static s7_pointer g_catch(s7_scheme *sc, s7_pointer args) return(s7_wrong_type_arg_error(sc, "catch", 2, cadr(args), "a thunk")); if (!is_procedure(caddr(args))) return(s7_wrong_type_arg_error(sc, "catch", 3, caddr(args), "a procedure")); - + p = new_cell(sc); catch_tag(p) = car(args); catch_goto_loc(p) = sc->stack_top; @@ -13837,7 +13837,7 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo (remembered_file_name(line))) { vector_element(sc->error_info, ERROR_CODE_LINE) = s7_make_integer(sc, remembered_line_number(line)); - vector_element(sc->error_info, ERROR_CODE_FILE) = s7_make_string(sc, remembered_file_name(line)); + vector_element(sc->error_info, ERROR_CODE_FILE) = s7_make_string(sc, remembered_file_name(line)); } for (top = sc->stack_top, j = ERROR_ENVIRONMENT + 1; (top > 0) && (j < ERROR_INFO_SIZE); top -= 4, j++) @@ -13856,14 +13856,14 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo opcode_t op; s7_pointer x; op = (opcode_t)s7_integer(vector_element(sc->stack, i)); - + switch (op) { case OP_DYNAMIC_WIND: x = vector_element(sc->stack, i - 3); if (dynamic_wind_state(x) == T_DWIND_BODY) { - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = sc->NIL; sc->code = dynamic_wind_out(x); eval(sc, OP_APPLY); @@ -13902,7 +13902,7 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo break; } } - + GOT_CATCH: if (catcher != sc->F) { @@ -13912,8 +13912,8 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo sc->op = OP_APPLY; /* explicit eval needed if s7_call called into scheme where a caught error occurred (ex6 in exs7.c) - * but putting it here (via eval(sc, OP_APPLY)) means the C stack is not cleared correctly in non-s7-call cases, - * so defer it until s7_call + * but putting it here (via eval(sc, OP_APPLY)) means the C stack is not cleared correctly in non-s7-call cases, + * so defer it until s7_call */ } else @@ -13941,8 +13941,8 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo */ if ((!s7_is_list(sc, info)) || (!s7_is_string(car(info)))) - format_to_output(sc, - s7_current_error_port(sc), + format_to_output(sc, + s7_current_error_port(sc), "\n;~A ~A", make_list_2(sc, type, info)); else @@ -13950,7 +13950,7 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo const char *carstr; int i, len; bool use_format = false; - + /* it's possible that the error string is just a string -- not intended for format */ carstr = s7_string(car(info)); len = string_length(car(info)); @@ -13960,7 +13960,7 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo use_format = true; break; } - + if (use_format) { char *errstr; @@ -13968,38 +13968,38 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo errstr = (char *)malloc(len * sizeof(char)); snprintf(errstr, len, "\n;%s", s7_string(car(info))); format_to_output(sc, - s7_current_error_port(sc), + s7_current_error_port(sc), errstr, cdr(info)); free(errstr); } - else format_to_output(sc, - s7_current_error_port(sc), + else format_to_output(sc, + s7_current_error_port(sc), "\n;~A ~A", make_list_2(sc, type, info)); } - + /* now display location and \n at end */ - + if (is_input_port(sc->input_port)) { const char *filename = NULL; int line; - + filename = port_filename(sc->input_port); line = port_line_number(sc->input_port); - + if (filename) format_to_output(sc, - s7_current_error_port(sc), + s7_current_error_port(sc), ", ~A[~D]", make_list_2(sc, s7_make_string(sc, filename), s7_make_integer(sc, line))); - else + else { if (line > 0) format_to_output(sc, - s7_current_error_port(sc), - ", line ~D", + s7_current_error_port(sc), + ", line ~D", make_list_1(sc, s7_make_integer(sc, line))); } } @@ -14007,24 +14007,24 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo if (is_pair(vector_element(sc->error_info, ERROR_CODE))) { - format_to_output(sc, - s7_current_error_port(sc), - "; ~A", + format_to_output(sc, + s7_current_error_port(sc), + "; ~A", make_list_1(sc, vector_element(sc->error_info, ERROR_CODE))); s7_newline(sc, s7_current_error_port(sc)); if (s7_is_string(vector_element(sc->error_info, ERROR_CODE_FILE))) { format_to_output(sc, - s7_current_error_port(sc), + s7_current_error_port(sc), "; [~S, line ~D]", - make_list_2(sc, - vector_element(sc->error_info, ERROR_CODE_FILE), + make_list_2(sc, + vector_element(sc->error_info, ERROR_CODE_FILE), vector_element(sc->error_info, ERROR_CODE_LINE))); s7_newline(sc, s7_current_error_port(sc)); } } - + if ((exit_eval) && (sc->error_exiter)) (*(sc->error_exiter))(); @@ -14037,7 +14037,7 @@ static s7_pointer s7_error_1(s7_scheme *sc, s7_pointer type, s7_pointer info, bo sc->op = OP_ERROR_QUIT; } } - + if (sc->longjmp_ok) { longjmp(sc->goto_start, 1); /* this is trying to clear the C stack back to some clean state */ @@ -14083,7 +14083,7 @@ static s7_pointer read_error(s7_scheme *sc, const char *errmsg) #define QUOTE_SIZE 12 int start, end, slen; char *recent_input = NULL; - + start = port_string_point(pt) - QUOTE_SIZE; if (start < 0) start = 0; end = port_string_point(pt) + QUOTE_SIZE; @@ -14115,7 +14115,7 @@ static s7_pointer read_error(s7_scheme *sc, const char *errmsg) msg = (char *)malloc(len * sizeof(char)); len = snprintf(msg, len, "%s: %s", errmsg, (recent_input) ? recent_input : ""); } - + if (recent_input) free(recent_input); } else @@ -14124,14 +14124,14 @@ static s7_pointer read_error(s7_scheme *sc, const char *errmsg) msg = (char *)malloc(len * sizeof(char)); len = snprintf(msg, len, "%s %s[%d]", errmsg, port_filename(pt), port_line_number(pt)); } - + s7_newline(sc, s7_current_error_port(sc)); write_string(sc, msg, s7_current_error_port(sc)); /* make sure we complain ... */ s7_newline(sc, s7_current_error_port(sc)); - result = make_list_3(sc, - s7_symbol_value(sc, sc->ERROR), - sc->ERROR, + result = make_list_3(sc, + s7_symbol_value(sc, sc->ERROR), + sc->ERROR, s7_make_string_with_length(sc, msg, len)); free(msg); @@ -14167,9 +14167,9 @@ static s7_pointer missing_close_paren_error(s7_scheme *sc) s7_pointer result; char *str1; int len; - len = 64 + safe_strlen(port_filename(sc->input_port)); + len = 64 + safe_strlen(port_filename(sc->input_port)); str1 = (char *)malloc(len * sizeof(char)); - len = snprintf(str1, len, "missing close paren, list started around line %d of %s: ~A", + len = snprintf(str1, len, "missing close paren, list started around line %d of %s: ~A", remembered_line_number(line), port_filename(sc->input_port)); result = s7_make_string_with_length(sc, str1, len); free(str1); @@ -14203,7 +14203,7 @@ static void display_frame(s7_scheme *sc, s7_pointer envir) local_env = s7_reverse(sc, args); if (!s7_is_symbol(cdr(lst))) file_info = cddr(lst); - + format_to_output(sc, s7_current_output_port(sc), "(~A~{ ~A~})", make_list_2(sc, sym, local_env)); if (is_pair(file_info)) format_to_output(sc, s7_current_output_port(sc), " [~S ~D]", file_info); @@ -14218,7 +14218,7 @@ static void display_frame(s7_scheme *sc, s7_pointer envir) static s7_pointer g_stacktrace(s7_scheme *sc, s7_pointer args) { - /* 4 cases currently: + /* 4 cases currently: * if args=nil, show current stack * =thread obj, show its stack * =vector, assume it is a vector of envs from *error-info* @@ -14267,11 +14267,11 @@ is a continuation, its stack is displayed." stk = f->sc->stack; } } -#endif +#endif } if (stk == sc->F) return(s7_wrong_type_arg_error(sc, "stacktrace", 0, car(args), "a vector, thread object, or continuation")); - + for (i = top; i > 0; i -= 4) display_frame(sc, vector_element(stk, i - 3)); @@ -14306,18 +14306,18 @@ void s7_quit(s7_scheme *sc) } -static s7_pointer apply_list_star(s7_scheme *sc, s7_pointer d) +static s7_pointer apply_list_star(s7_scheme *sc, s7_pointer d) { s7_pointer p, q; - if (cdr(d) == sc->NIL) + if (cdr(d) == sc->NIL) return(car(d)); - + p = s7_cons(sc, car(d), cdr(d)); q = p; - while (cdr(cdr(p)) != sc->NIL) + while (cdr(cdr(p)) != sc->NIL) { d = s7_cons(sc, car(p), cdr(p)); - if (cdr(cdr(p)) != sc->NIL) + if (cdr(cdr(p)) != sc->NIL) p = cdr(d); } cdr(p) = car(cdr(p)); @@ -14331,7 +14331,7 @@ static s7_pointer g_apply(s7_scheme *sc, s7_pointer args) sc->code = car(args); if (cdr(args) == sc->NIL) sc->args = sc->NIL; - else + else { sc->args = apply_list_star(sc, cdr(args)); @@ -14354,7 +14354,7 @@ pass (global-environment):\n\ (eval 'x (global-environment)))\n\ \n\ returns 32" - + if (cdr(args) != sc->NIL) { if (!is_pair(cadr(args))) @@ -14368,13 +14368,13 @@ pass (global-environment):\n\ s7_pointer s7_call(s7_scheme *sc, s7_pointer func, s7_pointer args) -{ +{ bool old_longjmp; jmp_buf old_goto_start; /* this can be called while we are in the eval loop (within eval_c_string for instance), * and if we reset the stack, the previously running evaluation steps off the end - * of the stack == segfault. + * of the stack == segfault. */ old_longjmp = sc->longjmp_ok; memcpy((void *)old_goto_start, (void *)(sc->goto_start), sizeof(jmp_buf)); @@ -14391,7 +14391,7 @@ s7_pointer s7_call(s7_scheme *sc, s7_pointer func, s7_pointer args) { sc->longjmp_ok = old_longjmp; memcpy((void *)(sc->goto_start), (void *)old_goto_start, sizeof(jmp_buf)); - + if ((sc->op == OP_ERROR_QUIT) && (sc->longjmp_ok)) { @@ -14403,14 +14403,14 @@ s7_pointer s7_call(s7_scheme *sc, s7_pointer func, s7_pointer args) } push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); /* this saves the current evaluation and will eventually finish this (possibly) nested call */ - sc->args = args; - sc->code = func; + sc->args = args; + sc->code = func; eval(sc, OP_APPLY); sc->longjmp_ok = old_longjmp; memcpy((void *)(sc->goto_start), (void *)old_goto_start, sizeof(jmp_buf)); return(sc->value); -} +} static s7_pointer g_s7_version(s7_scheme *sc, s7_pointer args) @@ -14438,26 +14438,26 @@ static s7_pointer g_list_for_each(s7_scheme *sc, s7_pointer args) for (i = 2, y = lists; y != sc->NIL; i++, y = cdr(y)) if (car(y) != sc->NIL) return(s7_wrong_type_arg_error(sc, "for-each", i, car(y), "a nil list (first list was nil)")); - + return(sc->NIL); /* not a bug -- (for-each (lambda (x) x) '()) -> no-op */ } sc->x = sc->NIL; - + /* get car of each arg list making the current proc arglist */ sc->args = sc->NIL; - + for (i = 2, y = lists; y != sc->NIL; i++, y = cdr(y)) { if (!is_proper_list(sc, car(y))) return(s7_wrong_type_arg_error(sc, "for-each", i, car(y), "a list")); - + sc->args = s7_cons(sc, caar(y), sc->args); sc->x = s7_cons(sc, cdar(y), sc->x); } sc->args = safe_reverse_in_place(sc, sc->args); sc->x = safe_reverse_in_place(sc, sc->x); - + /* if lists have no cdr (just 1 set of args), apply the proc to them */ if (car(sc->x) == sc->NIL) { @@ -14467,7 +14467,7 @@ static s7_pointer g_list_for_each(s7_scheme *sc, s7_pointer args) push_stack(sc, OP_APPLY, sc->args, sc->code); return(sc->NIL); } - + /* set up for repeated call walking down the lists of args */ push_stack(sc, OP_LIST_FOR_EACH, sc->x, sc->code); push_stack(sc, OP_APPLY, sc->args, sc->code); @@ -14480,7 +14480,7 @@ static s7_pointer g_list_map(s7_scheme *sc, s7_pointer args) #define H_list_map "(map proc lst . lists) applies proc to a list made up of the car of each arg list, returning a list of the values returned by proc" s7_pointer lists, y; int i; - + if ((!is_procedure(car(args))) || (is_thunk(sc, car(args)))) return(s7_wrong_type_arg_error(sc, "map", 1, car(args), "a thunk")); @@ -14493,26 +14493,26 @@ static s7_pointer g_list_map(s7_scheme *sc, s7_pointer args) for (i = 2, y = lists; y != sc->NIL; i++, y = cdr(y)) if (car(y) != sc->NIL) return(s7_wrong_type_arg_error(sc, "map", i, car(y), "a nil list (first list was nil)")); - + return(sc->NIL); } sc->x = sc->NIL; - + /* get car of each arg list making the current proc arglist */ sc->args = sc->NIL; for (i = 2, y = lists; y != sc->NIL; i++, y = cdr(y)) { if (!is_proper_list(sc, car(y))) return(s7_wrong_type_arg_error(sc, "map", i, car(y), "a list")); - + sc->args = s7_cons(sc, caar(y), sc->args); /* car(y) = cdar(y); */ /* this clobbers the original lists -- we need to copy */ sc->x = s7_cons(sc, cdar(y), sc->x); } sc->args = safe_reverse_in_place(sc, sc->args); sc->x = safe_reverse_in_place(sc, sc->x); - + /* set up for repeated call walking down the lists of args, values list is cdr, current args is car */ push_stack(sc, OP_LIST_MAP, make_list_1(sc, sc->x), sc->code); push_stack(sc, OP_APPLY, sc->args, sc->code); @@ -14539,7 +14539,7 @@ static s7_pointer g_for_each(s7_scheme *sc, s7_pointer args) if (s7_is_applicable_object(car(fargs))) return(g_object_for_each(sc, args)); - + return(s7_wrong_type_arg_error(sc, "for-each", 2, car(fargs), "an applicable object")); } @@ -14552,7 +14552,7 @@ static s7_pointer g_map(s7_scheme *sc, s7_pointer args) return(g_list_map(sc, args)); if (s7_is_vector(car(fargs))) return(g_vector_map(sc, args)); - + return(s7_wrong_type_arg_error(sc, "map", 2, car(fargs), "a list or a vector")); } @@ -14592,10 +14592,10 @@ static s7_pointer splice_in_values(s7_scheme *sc, s7_pointer args) static s7_pointer g_values(s7_scheme *sc, s7_pointer args) { #define H_values "(values obj ...) splices its arguments into whatever list holds it (its 'continuation')" - + if (args == sc->NIL) return(sc->NIL); - + if (cdr(args) == sc->NIL) return(car(args)); @@ -14608,7 +14608,7 @@ s7_pointer s7_values(s7_scheme *sc, int num_values, ...) s7_pointer args = sc->NIL; int i; va_list ap; - + if (num_values == 0) return(sc->NIL); @@ -14650,10 +14650,10 @@ static s7_pointer g_quasiquote_1(s7_scheme *sc, int level, s7_pointer form) { if (car(form) == sc->UNQUOTE) return(car(cdr(form))); - + if (car(form) == sc->UNQUOTE_SPLICING) return(form); - + if ((is_pair(car(form))) && (caar(form) == sc->UNQUOTE_SPLICING)) { @@ -14670,7 +14670,7 @@ static s7_pointer g_quasiquote_1(s7_scheme *sc, int level, s7_pointer form) return(l); return(make_list_3(sc, sc->APPEND, l, r)); } - + goto MCONS; } @@ -14687,7 +14687,7 @@ static s7_pointer g_quasiquote_1(s7_scheme *sc, int level, s7_pointer form) return(make_list_3(sc, sc->CONS, make_list_2(sc, sc->QUOTE, sc->UNQUOTE), r)); } - + if (car(form) == sc->UNQUOTE_SPLICING) { s7_pointer r; @@ -14700,7 +14700,7 @@ static s7_pointer g_quasiquote_1(s7_scheme *sc, int level, s7_pointer form) return(make_list_3(sc, sc->CONS, make_list_2(sc, sc->QUOTE, sc->UNQUOTE_SPLICING), r)); } - + MCONS: { s7_pointer l, r; @@ -14739,7 +14739,7 @@ static s7_pointer g_quasiquote_2(s7_scheme *sc, int level, s7_pointer form) static s7_pointer g_quasiquote(s7_scheme *sc, s7_pointer args) { return(g_quasiquote_2(sc, s7_integer(car(args)), cadr(args))); -} +} @@ -14779,7 +14779,7 @@ static token_t token(s7_scheme *sc) if (c == '\n') port_line_number(pt)++; } - else + else { char *orig_str, *str; str = (char *)(port_string(pt) + port_string_point(pt)); @@ -14790,18 +14790,18 @@ static token_t token(s7_scheme *sc) port_string_point(pt) += (str - orig_str); } - switch (c) + switch (c) { case EOF: case 0: return(TOKEN_EOF); - + case '(': return(TOKEN_LEFT_PAREN); - + case ')': return(TOKEN_RIGHT_PAREN); - + case '.': c = inchar(sc, pt); if (dot_table[c]) @@ -14820,7 +14820,7 @@ static token_t token(s7_scheme *sc) */ case '\'': return(TOKEN_QUOTE); - + case ';': { int c; @@ -14835,10 +14835,10 @@ static token_t token(s7_scheme *sc) case '"': return(TOKEN_DOUBLE_QUOTE); - + case '`': return(TOKEN_BACK_QUOTE); - + case ',': /* here we probably should check for symbol names that start with "@": @@ -14847,7 +14847,7 @@ static token_t token(s7_scheme *sc) hi :(hi 2) ;foo: unbound variable - + but :(defmacro hi (.foo) `(+ ,.foo 1)) @@ -14859,15 +14859,15 @@ static token_t token(s7_scheme *sc) :(defmacro hi (@foo foo) `(+ ,@foo 1)) */ - if ((c = inchar(sc, pt)) == '@') + if ((c = inchar(sc, pt)) == '@') return(TOKEN_AT_MARK); - + backchar(sc, c, pt); return(TOKEN_COMMA); - + case '#': c = inchar(sc, pt); - if (c == '(') + if (c == '(') return(TOKEN_VECTOR); if (c == ':') /* turn #: into : */ @@ -14877,7 +14877,7 @@ static token_t token(s7_scheme *sc) } /* block comments in either #! ... !# */ - if (c == '!') + if (c == '!') { char last_char; last_char = ' '; @@ -14890,9 +14890,9 @@ static token_t token(s7_scheme *sc) } return(token(sc)); } - + /* or #| ... |# */ - if (c == '|') + if (c == '|') { char last_char; last_char = ' '; @@ -14905,11 +14905,11 @@ static token_t token(s7_scheme *sc) } return(token(sc)); } - + backchar(sc, c, pt); return(TOKEN_SHARP_CONST); /* next stage notices any errors */ - - default: + + default: sc->strbuf[0] = c; /* every TOKEN_ATOM return goes to read_string_upto, so we save a backchar/inchar shuffle by starting the read here */ return(TOKEN_ATOM); } @@ -14926,7 +14926,7 @@ static void resize_strbuf(s7_scheme *sc) } -static char *read_string_upto(s7_scheme *sc, int start) +static char *read_string_upto(s7_scheme *sc, int start) { int i, c; s7_pointer pt; @@ -14947,10 +14947,10 @@ static char *read_string_upto(s7_scheme *sc, int start) } while ((c != EOF) && (string_delimiter_table[c])); - if ((i == 2) && + if ((i == 2) && (sc->strbuf[0] == '\\')) sc->strbuf[i] = '\0'; - else + else { if (c != EOF) { @@ -14980,10 +14980,10 @@ static char *read_string_upto(s7_scheme *sc, int start) memcpy((void *)(sc->strbuf + start), (void *)orig_str, k); - if ((i == 2) && + if ((i == 2) && (sc->strbuf[0] == '\\')) sc->strbuf[i] = '\0'; - else + else { if (c != 0) { @@ -15002,7 +15002,7 @@ static s7_pointer read_string_constant(s7_scheme *sc, s7_pointer pt) { /* sc->F => error */ int i, c; - for (i = 0; ; ) + for (i = 0; ; ) { c = inchar(sc, pt); if (c == EOF) @@ -15028,7 +15028,7 @@ static s7_pointer read_string_constant(s7_scheme *sc, s7_pointer pt) { if (c == 'n') sc->strbuf[i++] = '\n'; - else + else { if (!isspace(c)) return(sc->T); /* #f here would give confusing error message "end of input", so return #t=bad backslash */ @@ -15046,25 +15046,25 @@ static s7_pointer read_string_constant(s7_scheme *sc, s7_pointer pt) static s7_pointer read_expression(s7_scheme *sc) { - while (true) + while (true) { int c; - switch (sc->tok) + switch (sc->tok) { case TOKEN_EOF: return(sc->EOF_OBJECT); - + case TOKEN_VECTOR: /* already read #( */ push_stack(sc, OP_READ_VECTOR, sc->NIL, sc->NIL); /* fall through */ - + case TOKEN_LEFT_PAREN: sc->tok = token(sc); if (sc->tok == TOKEN_RIGHT_PAREN) return(sc->NIL); - if (sc->tok == TOKEN_DOT) + if (sc->tok == TOKEN_DOT) { back_up_stack(sc); do {c = inchar(sc, sc->input_port);} while ((c != ')') && (c != EOF)); @@ -15076,36 +15076,36 @@ static s7_pointer read_expression(s7_scheme *sc) push_stack(sc, OP_READ_LIST, sc->NIL, sc->NIL); break; - + case TOKEN_QUOTE: push_stack(sc, OP_READ_QUOTE, sc->NIL, sc->NIL); sc->tok = token(sc); break; - + case TOKEN_BACK_QUOTE: sc->tok = token(sc); - if (sc->tok == TOKEN_VECTOR) + if (sc->tok == TOKEN_VECTOR) { push_stack(sc, OP_READ_QUASIQUOTE_VECTOR, sc->NIL, sc->NIL); sc->tok= TOKEN_LEFT_PAREN; - } + } else push_stack(sc, OP_READ_QUASIQUOTE, sc->NIL, sc->NIL); break; - + case TOKEN_COMMA: push_stack(sc, OP_READ_UNQUOTE, sc->NIL, sc->NIL); sc->tok = token(sc); break; - + case TOKEN_AT_MARK: push_stack(sc, OP_READ_UNQUOTE_SPLICING, sc->NIL, sc->NIL); sc->tok = token(sc); break; - + case TOKEN_ATOM: return(make_atom(sc, read_string_upto(sc, 1), 10, true)); /* true = not just string->number */ /* If reading list (from lparen), this will finally get us to op_read_list */ - + case TOKEN_DOUBLE_QUOTE: sc->value = read_string_constant(sc, sc->input_port); if (sc->value == sc->F) /* can happen if input code ends in the middle of a string */ @@ -15113,7 +15113,7 @@ static s7_pointer read_expression(s7_scheme *sc) if (sc->value == sc->T) return(read_error(sc, "unknown backslash usage")); return(sc->value); - + case TOKEN_SHARP_CONST: { char *expr; @@ -15149,12 +15149,12 @@ static s7_pointer eval_symbol(s7_scheme *sc, s7_pointer sym) x = s7_find_symbol_in_environment(sc, sc->envir, sym, true); - if (x != sc->NIL) + if (x != sc->NIL) return(symbol_value(x)); if (s7_is_keyword(sym)) return(sym); - + x = symbol_table_find_by_name(sc, symbol_name(sym), symbol_location(sym)); if (is_syntax(x)) return(x); @@ -15168,11 +15168,11 @@ static s7_pointer eval_symbol(s7_scheme *sc, s7_pointer sym) } -static void assign_syntax(s7_scheme *sc, const char *name, opcode_t op) +static void assign_syntax(s7_scheme *sc, const char *name, opcode_t op) { s7_pointer x; - x = symbol_table_add_by_name(sc, name); - typeflag(x) |= (T_SYNTAX | T_DONT_COPY); + x = symbol_table_add_by_name(sc, name); + typeflag(x) |= (T_SYNTAX | T_DONT_COPY); clear_finalizable(x); syntax_opcode(x) = (int)op; } @@ -15185,19 +15185,19 @@ static void assign_syntax(s7_scheme *sc, const char *name, opcode_t op) /* all explicit write-* in eval assume current-output-port -- error fallback handling, etc */ /* internal reads assume sc->input_port is the input port */ -static s7_pointer eval(s7_scheme *sc, opcode_t first_op) +static s7_pointer eval(s7_scheme *sc, opcode_t first_op) { sc->cur_code = ERROR_INFO_DEFAULT; sc->op = first_op; - + /* this procedure can be entered recursively (via s7_call for example), so it's no place for a setjmp * I don't think the recursion can hurt our continuations because s7_call is coming from hooks and * callbacks that are implicit in our stack. */ - + START: - switch (sc->op) + switch (sc->op) { /* in gcc, this becomes a jump table, so we're not doing a linear search (gcc s7.c -S -I.) */ case OP_READ_INTERNAL: @@ -15221,20 +15221,20 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) goto START; } - - /* g_read(p) from C - * read one expr, return it, let caller deal with input port setup + + /* g_read(p) from C + * read one expr, return it, let caller deal with input port setup */ case OP_READ_RETURN_EXPRESSION: return(sc->F); - - + + /* (read p) from scheme * "p" becomes current input port for eval's duration, then pops back before returning value into calling expr */ case OP_READ_POP_AND_RETURN_EXPRESSION: pop_input_port(sc); - + if (sc->tok == TOKEN_EOF) { sc->value = sc->EOF_OBJECT; @@ -15243,8 +15243,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } pop_stack(sc); goto START; - - + + /* load("file"); from C (g_load) -- assume caller will clean up * read and evaluate exprs until EOF that matches (stack reflects nesting) */ @@ -15257,9 +15257,9 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) goto EVAL; /* we read an expression, now evaluate it, and return to read the next */ } return(sc->F); - - - /* (load "file") in scheme + + + /* (load "file") in scheme * read and evaluate all exprs, then upon EOF, close current and pop input port stack */ case OP_LOAD_CLOSE_AND_POP_IF_EOF: @@ -15274,17 +15274,17 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) pop_input_port(sc); pop_stack(sc); goto START; - - + + /* read and evaluate string expression(s?) * assume caller (C via g_eval_c_string) is dealing with the string port */ case OP_EVAL_STRING: - /* (eval-string (string-append "(list 1 2 3)" (string #\newline) (string #\newline))) + /* (eval-string (string-append "(list 1 2 3)" (string #\newline) (string #\newline))) * needs to be sure to get rid of the trailing white space before checking for EOF * else it tries to eval twice and gets "attempt to apply 1?, line 2" */ - if ((sc->tok != TOKEN_EOF) && + if ((sc->tok != TOKEN_EOF) && (port_string_point(sc->input_port) < port_string_length(sc->input_port))) /* ran past end somehow? */ { int c = 0; @@ -15303,8 +15303,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) else push_stack(sc, OP_EVAL_STRING_DONE, sc->NIL, sc->value); sc->code = sc->value; goto EVAL; - - + + case OP_EVAL_DONE: case OP_EVAL_STRING_DONE: return(sc->F); @@ -15332,13 +15332,13 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } push_stack(sc, OP_LIST_FOR_EACH, sc->x, sc->code); goto APPLY; - - + + case OP_LIST_MAP: /* car of args incoming is arglist, cdr is values list (nil to start) */ sc->x = sc->args; cdr(sc->x) = s7_cons(sc, sc->value, cdr(sc->x)); /* add current value to list */ - + if (caar(sc->x) == sc->NIL) { for (sc->y = cdar(sc->x); sc->y != sc->NIL; sc->y = cdr(sc->y)) @@ -15386,12 +15386,12 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = fargs; goto APPLY; } - + /* loop done */ sc->value = sc->UNSPECIFIED; pop_stack(sc); goto START; - + case OP_VECTOR_MAP1: { @@ -15402,14 +15402,14 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } /* drop into VECTOR_MAP0 */ - + case OP_VECTOR_MAP0: - /* func = sc->code, - * new-vector = car(sc->args), - * func-args = cadddr(sc->args), - * counter = cadr(sc->args), - * len = caddr(sc->args), - * vector(s) = cddddr(sc->args) + /* func = sc->code, + * new-vector = car(sc->args), + * func-args = cadddr(sc->args), + * counter = cadr(sc->args), + * len = caddr(sc->args), + * vector(s) = cddddr(sc->args) */ if (s7_integer(cadr(sc->args)) < s7_integer(caddr(sc->args))) { @@ -15427,13 +15427,13 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = fargs; goto APPLY; } - + /* loop done */ sc->value = car(sc->args); pop_stack(sc); goto START; - - + + case OP_STRING_FOR_EACH: /* func = sc->code, func-args = caddr(sc->args), counter = car(sc->args), len = cadr(sc->args), string(s) = cdddr(sc->args) */ if (s7_integer(car(sc->args)) < s7_integer(cadr(sc->args))) @@ -15452,11 +15452,11 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = fargs; goto APPLY; } - + sc->value = sc->UNSPECIFIED; pop_stack(sc); goto START; - + case OP_OBJECT_FOR_EACH: /* func = sc->code, func-args = caddr(sc->args), counter = car(sc->args), len = cadr(sc->args), object(s) = cdddr(sc->args) */ @@ -15478,13 +15478,13 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = fargs; goto APPLY; } - + sc->value = sc->UNSPECIFIED; pop_stack(sc); goto START; - - case OP_DO: + + case OP_DO: /* setup is very similar to let */ /* sc->code is the stuff after "do" */ @@ -15499,19 +15499,19 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) if (car(sc->code) == sc->NIL) /* (do () ...) */ { - sc->envir = new_frame_in_env(sc, sc->envir); + sc->envir = new_frame_in_env(sc, sc->envir); sc->args = s7_cons(sc, sc->NIL, cadr(sc->code)); sc->code = cddr(sc->code); goto DO_END0; } - + /* eval each init value, then set up the new frame (like let, not let*) */ - + sc->args = sc->NIL; /* the evaluated var-data */ sc->value = sc->code; /* protect it */ sc->code = car(sc->code); /* the vars */ - - + + case OP_DO_INIT: sc->args = s7_cons(sc, sc->value, sc->args); /* code will be last element (first after reverse) */ if (is_pair(sc->code)) @@ -15528,7 +15528,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) (cddar(sc->code) != sc->NIL)) /* (do ((i 0 . 1)) ...) */ return(eval_error(sc, "do: variable info is an improper list?: ~A", sc->code)); - if ((is_pair(cddar(sc->code))) && + if ((is_pair(cddar(sc->code))) && (cdr(cddar(sc->code)) != sc->NIL)) /* (do ((i 0 1 (+ i 1))) ...) */ return(eval_error(sc, "do: variable info has extra stuff after the increment: ~A", sc->code)); } @@ -15541,22 +15541,22 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) if (sc->code != sc->NIL) /* (do ((i 0 i) . 1) ((= i 1))) */ return(eval_error(sc, "do: list of variables is improper: ~A", sc->code)); - + /* all done */ sc->args = safe_reverse_in_place(sc, sc->args); sc->code = car(sc->args); /* saved at the start */ sc->args = cdr(sc->args); /* init values */ - sc->envir = new_frame_in_env(sc, sc->envir); + sc->envir = new_frame_in_env(sc, sc->envir); sc->value = sc->NIL; - for (sc->x = car(sc->code), sc->y = sc->args; sc->y != sc->NIL; sc->x = cdr(sc->x), sc->y = cdr(sc->y)) + for (sc->x = car(sc->code), sc->y = sc->args; sc->y != sc->NIL; sc->x = cdr(sc->x), sc->y = cdr(sc->y)) sc->value = s7_cons(sc, add_to_local_environment(sc, caar(sc->x), car(sc->y)), sc->value); /* now we've set up the environment, next set up for loop */ sc->y = safe_reverse_in_place(sc, sc->value); sc->args = sc->NIL; - for (sc->x = car(sc->code); sc->y != sc->NIL; sc->x = cdr(sc->x), sc->y = cdr(sc->y)) + for (sc->x = car(sc->code); sc->y != sc->NIL; sc->x = cdr(sc->x), sc->y = cdr(sc->y)) if (cddar(sc->x) != sc->NIL) /* no incr expr, so ignore it henceforth */ { sc->value = s7_cons(sc, caddar(sc->x), sc->NIL); @@ -15566,22 +15566,22 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->value = safe_reverse_in_place(sc, sc->args); sc->args = s7_cons(sc, sc->value, cadr(sc->code)); sc->code = cddr(sc->code); - - + + DO_END0: case OP_DO_END0: /* here vars have been init'd or incr'd * args = (cons var-data end-data) * code = body */ - + push_stack(sc, OP_DO_END1, sc->args, sc->code); /* evaluate the endtest */ sc->code = cadr(sc->args); sc->args = sc->NIL; goto EVAL; - - + + case OP_DO_END1: /* sc->value should be result of endtest evaluation */ if (is_true(sc, sc->value)) @@ -15591,26 +15591,26 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = sc->NIL; goto BEGIN; } - + /* evaluate the body and step vars, etc */ push_stack(sc, OP_DO_STEP0, sc->args, sc->code); /* sc->code is ready to go */ sc->args = sc->NIL; goto BEGIN; - - + + case OP_DO_STEP0: - /* increment all vars, return to endtest + /* increment all vars, return to endtest * these are also updated in parallel at the end, so we gather all the incremented values first */ if (car(sc->args) == sc->NIL) goto DO_END0; - + push_stack(sc, OP_DO_END0, sc->args, sc->code); sc->code = s7_cons(sc, sc->NIL, car(sc->args)); /* car = list of newly incremented values, cdr = list of slots */ sc->args = car(sc->args); - - + + DO_STEP1: case OP_DO_STEP1: if (sc->args == sc->NIL) @@ -15649,25 +15649,25 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * * s7 says 3, guile says 1. */ - + sc->value = sc->NIL; - pop_stack(sc); + pop_stack(sc); goto DO_END0; } push_stack(sc, OP_DO_STEP2, sc->args, sc->code); /* here sc->args is a list like (((i . 0) (+ i 1)) ...) - * so sc->code becomes (+ i 1) in this case + * so sc->code becomes (+ i 1) in this case */ sc->code = cadar(sc->args); sc->args = sc->NIL; goto EVAL; - + case OP_DO_STEP2: car(sc->code) = s7_cons(sc, sc->value, car(sc->code)); /* add this value to our growing list */ sc->args = cdr(sc->args); /* go to next */ goto DO_STEP1; - + case OP_WITH_ENV1: sc->envir = sc->args; /* restore previous environment */ @@ -15683,7 +15683,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->code = car(sc->code); /* eval env arg */ goto EVAL; - + case OP_WITH_ENV2: sc->envir = sc->value; /* in new env... */ sc->code = cdr(sc->code); /* handle body */ @@ -15692,7 +15692,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) BEGIN: case OP_BEGIN: - if (!is_pair(sc->code)) + if (!is_pair(sc->code)) { if (sc->code != sc->NIL) /* (begin . 1) */ return(eval_error(sc, "unexpected dot or '() at end of body?", sc->code)); @@ -15701,14 +15701,14 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) pop_stack(sc); goto START; } - - if (cdr(sc->code) != sc->NIL) + + if (cdr(sc->code) != sc->NIL) push_stack(sc, OP_BEGIN, sc->NIL, cdr(sc->code)); - + sc->code = car(sc->code); sc->cur_code = sc->code; /* goto EVAL; */ - + EVAL: case OP_EVAL: /* main part of evaluation */ @@ -15717,15 +15717,15 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) /* using a local s7_pointer for sc->x here drastically slows things down?!? */ sc->x = car(sc->code); if (is_syntax(sc->x)) - { + { sc->code = cdr(sc->code); sc->op = (opcode_t)syntax_opcode(sc->x); goto START; - } + } push_stack(sc, OP_EVAL_ARGS0, sc->NIL, sc->code); sc->code = sc->x; goto EVAL; - } + } if (s7_is_symbol(sc->code)) { @@ -15734,7 +15734,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) if (is_not_local(sc->code)) x = symbol_global_slot(sc->code); else x = s7_find_symbol_in_environment(sc, sc->envir, sc->code, true); - if (x != sc->NIL) + if (x != sc->NIL) sc->value = symbol_value(x); else sc->value = eval_symbol(sc, sc->code); pop_stack(sc); @@ -15744,20 +15744,20 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->value = sc->code; pop_stack(sc); goto START; - - + + case OP_EVAL_ARGS0: if (is_any_macro(sc->value)) - { + { /* macro expansion */ if (!(is_c_macro(sc->value))) push_stack(sc, OP_EVAL_MACRO, sc->NIL, sc->NIL); /* code is the macro invocation: (mac-name ...), args is nil, value is the macro code bound to mac-name */ - sc->args = make_list_1(sc, sc->code); + sc->args = make_list_1(sc, sc->code); sc->code = sc->value; goto APPLY; - } - else + } + else { /* here sc->value is the func, sc->code is the entire expression */ #if WITH_ENCAPSULATION @@ -15766,18 +15766,18 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) (is_setter(sc->value)) && (s7_is_symbol(cadr(sc->code)))) encapsulate(sc, cadr(sc->code)); - + /* we currently ignore any case that involves an accessor such as (string-set! (vector-ref ...)). * In cases that don't involve set-applicable objects, we can say (for example) that the vector itself is not * being changed, and it is impossible to handle multi-level cases because we have to save both the values - * and the accessor-paths to those values: + * and the accessor-paths to those values: * * (let* ((s (make-string 8 #\x)) (v (vector s))) (encapsulate (string-set! (vector-ref v 0) 1 #\a))) * * here both the vector string value, and its reference back to the string variable need to be saved, * else a later string-set! is ambiguous (if a new string holds the original string value, "s" won't change - * in the post-encapsulated new string-set! case, but would have changed without the encapsulation). The set-applicable - * object case ought to be do-able, but then the check above becomes very messy -- we have to make sure + * in the post-encapsulated new string-set! case, but would have changed without the encapsulation). The set-applicable + * object case ought to be do-able, but then the check above becomes very messy -- we have to make sure * it's a single level reference, eval_symbol caadr(?), save, but then restore becomes problematic. * This has become trickier than I expected. */ @@ -15799,8 +15799,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * e1args: (6 2 1 +), value: +, code: () */ } - - + + EVAL_ARGS: case OP_EVAL_ARGS1: /* this is where most of s7's compute time goes */ @@ -15809,7 +15809,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) { s7_pointer x; #if HAVE_PTHREADS - x = new_cell(sc); + x = new_cell(sc); #else if (sc->free_heap_top > 0) x = sc->free_heap[--(sc->free_heap_top)]; @@ -15823,7 +15823,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) /* 1st time, value = op, args = nil (only e0 entry is from op_eval above), code is full list (at e0) */ if (is_pair(sc->code)) /* evaluate current arg */ - { + { int typ; s7_pointer car_code; car_code = car(sc->code); @@ -15844,11 +15844,11 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) if (is_not_local(car_code)) x = symbol_global_slot(car_code); else x = s7_find_symbol_in_environment(sc, sc->envir, car_code, true); - if (x != sc->NIL) + if (x != sc->NIL) sc->value = symbol_value(x); else sc->value = eval_symbol(sc, car_code); } - + else sc->value = car_code; sc->code = cdr(sc->code); goto EVAL_ARGS; @@ -15860,8 +15860,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) int len; char *msg, *argstr; s7_pointer result; - argstr = s7_object_to_c_string(sc, s7_append(sc, - s7_reverse(sc, cdr(sc->args)), + argstr = s7_object_to_c_string(sc, s7_append(sc, + s7_reverse(sc, cdr(sc->args)), s7_cons(sc, car(sc->args), sc->code))); len = strlen(argstr) + 32; msg = (char *)malloc(len * sizeof(char)); @@ -15872,7 +15872,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) s7_error(sc, sc->ERROR, result); } - sc->args = safe_reverse_in_place(sc, sc->args); + sc->args = safe_reverse_in_place(sc, sc->args); /* we could omit this reversal in many cases: all built in ops could * assume reversed args, things like eq? and + don't care about order, etc. * But, I think the reversal is not taking any noticeable percentage of @@ -15882,8 +15882,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = cdr(sc->args); /* goto APPLY; */ } - - + + /* ---------------- OP_APPLY ---------------- */ APPLY: case OP_APPLY: /* apply 'code' to 'args' */ @@ -15892,7 +15892,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) symbol_calls(sc->code)++; #endif - if (*(sc->tracing)) + if (*(sc->tracing)) trace_apply(sc); APPLY_WITHOUT_TRACE: @@ -15906,16 +15906,16 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) int len; len = safe_list_length(sc, sc->args); if (len < c_function_required_args(sc->code)) - return(s7_error(sc, - sc->WRONG_NUMBER_OF_ARGS, - make_list_3(sc, - s7_make_string_with_length(sc, "~A: not enough arguments: ~A", 28), + return(s7_error(sc, + sc->WRONG_NUMBER_OF_ARGS, + make_list_3(sc, + s7_make_string_with_length(sc, "~A: not enough arguments: ~A", 28), sc->code, sc->args))); - + if (c_function_all_args(sc->code) < len) - return(s7_error(sc, - sc->WRONG_NUMBER_OF_ARGS, - make_list_3(sc, + return(s7_error(sc, + sc->WRONG_NUMBER_OF_ARGS, + make_list_3(sc, s7_make_string_with_length(sc, "~A: too many arguments: ~A", 26), sc->code, sc->args))); @@ -15930,7 +15930,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * (define (tanhsin gen) #f) * (define (crash) (let ((hi (make-tanhsin))) (catch #t (lambda () (mus-run hi 0.0)) (lambda args 123)))) * (crash) - * and we pop_stack once too often somewhere. I'd put a guard OP_QUIT at the start, but + * and we pop_stack once too often somewhere. I'd put a guard OP_QUIT at the start, but * reset_stack would need to be changed and so on. */ @@ -15947,16 +15947,16 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) len = safe_list_length(sc, sc->args); if (len < c_macro_required_args(sc->code)) - return(s7_error(sc, - sc->WRONG_NUMBER_OF_ARGS, - make_list_3(sc, - s7_make_string_with_length(sc, "~A: not enough arguments: ~A", 28), + return(s7_error(sc, + sc->WRONG_NUMBER_OF_ARGS, + make_list_3(sc, + s7_make_string_with_length(sc, "~A: not enough arguments: ~A", 28), macsym, sc->args))); - + if (c_macro_all_args(sc->code) < len) - return(s7_error(sc, - sc->WRONG_NUMBER_OF_ARGS, - make_list_3(sc, + return(s7_error(sc, + sc->WRONG_NUMBER_OF_ARGS, + make_list_3(sc, s7_make_string_with_length(sc, "~A: too many arguments: ~A", 26), macsym, sc->args))); @@ -15965,44 +15965,44 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) goto EVAL; } - + case T_CLOSURE: /* -------- normal function (lambda), or macro -------- */ case T_MACRO: - sc->envir = new_frame_in_env(sc, closure_environment(sc->code)); - + sc->envir = new_frame_in_env(sc, closure_environment(sc->code)); + /* load up the current args into the ((args) (lambda)) layout [via the current environment] */ /* (defmacro hi (a b) `(+ ,a ,b)) */ /* -> code: #, args: ((hi 2 3)), closure args: (defmac-9) */ /* then back again: code: #, args: (2 3), closure args: (a b) */ - for (sc->x = closure_args(sc->code), sc->y = sc->args; is_pair(sc->x); sc->x = cdr(sc->x), sc->y = cdr(sc->y)) + for (sc->x = closure_args(sc->code), sc->y = sc->args; is_pair(sc->x); sc->x = cdr(sc->x), sc->y = cdr(sc->y)) { if (sc->y == sc->NIL) - return(s7_error(sc, - sc->WRONG_NUMBER_OF_ARGS, - make_list_3(sc, + return(s7_error(sc, + sc->WRONG_NUMBER_OF_ARGS, + make_list_3(sc, s7_make_string_with_length(sc, "~A: not enough arguments: ~A", 28), - g_procedure_source(sc, make_list_1(sc, sc->code)), + g_procedure_source(sc, make_list_1(sc, sc->code)), sc->args))); add_to_local_environment(sc, car(sc->x), car(sc->y)); } - - if (sc->x == sc->NIL) + + if (sc->x == sc->NIL) { if (sc->y != sc->NIL) - return(s7_error(sc, - sc->WRONG_NUMBER_OF_ARGS, - make_list_3(sc, - s7_make_string_with_length(sc, "~A: too many arguments: ~A", 26), - g_procedure_source(sc, make_list_1(sc, sc->code)), + return(s7_error(sc, + sc->WRONG_NUMBER_OF_ARGS, + make_list_3(sc, + s7_make_string_with_length(sc, "~A: too many arguments: ~A", 26), + g_procedure_source(sc, make_list_1(sc, sc->code)), sc->args))); - } - else + } + else { if (s7_is_symbol(sc->x)) - add_to_local_environment(sc, sc->x, sc->y); - else + add_to_local_environment(sc, sc->x, sc->y); + else { if (is_macro(sc->code)) return(eval_error(sc, "~A: undefined argument to macro?", sc->x)); @@ -16013,11 +16013,11 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->code = closure_body(sc->code); sc->args = sc->NIL; goto BEGIN; - + case T_CLOSURE_STAR: /* -------- define* (lambda*) -------- */ - { - sc->envir = new_frame_in_env(sc, closure_environment(sc->code)); - + { + sc->envir = new_frame_in_env(sc, closure_environment(sc->code)); + /* sc->code is a closure: ((args body) envir) * (define* (hi a (b 1)) (+ a b)) * (procedure-source hi) -> (lambda* (a (b 1)) (+ a b)) @@ -16027,7 +16027,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * we scan the current args, and match against the * template in the car of the closure, binding as we go. * - * for each actual arg, if it's not a keyword that matches a member of the + * for each actual arg, if it's not a keyword that matches a member of the * template, bind it to its current (place-wise) arg, else bind it to * that arg. If it's the symbol :key or :optional, just go on. * If it's :rest bind the next arg to the trailing args at this point. @@ -16036,7 +16036,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * * all args are optional, any arg with no default value defaults to #f. */ - + /* set all default values */ for (sc->z = closure_args(sc->code); is_pair(sc->z); sc->z = cdr(sc->z)) { @@ -16047,7 +16047,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) { if (is_pair(car(sc->z))) /* (define* (hi (a mus-next)) a) */ add_to_local_environment(sc, /* or (define* (hi (a 'hi)) (list a (eq? a 'hi))) */ - caar(sc->z), + caar(sc->z), lambda_star_argument_default_value(sc, cadar(sc->z))); /* mus-next, for example, needs to be evaluated before binding */ else add_to_local_environment(sc, car(sc->z), sc->F); @@ -16055,10 +16055,10 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } if (s7_is_symbol(sc->z)) /* dotted (last) arg? -- make sure its name exists in the current environment */ add_to_local_environment(sc, sc->z, sc->F); - + /* now get the current args, re-setting args that have explicit values */ sc->x = closure_args(sc->code); - sc->y = sc->args; + sc->y = sc->args; sc->z = sc->NIL; while ((is_pair(sc->x)) && (is_pair(sc->y))) @@ -16105,7 +16105,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->y = cdr(sc->y); } } - else + else { if (is_pair(car(sc->x))) lambda_star_argument_set_value(sc, caar(sc->x), car(sc->y)); @@ -16124,18 +16124,18 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) (is_pair(sc->y))) { if (sc->z != sc->KEY_REST) - return(s7_error(sc, - sc->WRONG_NUMBER_OF_ARGS, - make_list_3(sc, - s7_make_string_with_length(sc, "~A: too many arguments: ~A", 22), - g_procedure_source(sc, make_list_1(sc, sc->code)), + return(s7_error(sc, + sc->WRONG_NUMBER_OF_ARGS, + make_list_3(sc, + s7_make_string_with_length(sc, "~A: too many arguments: ~A", 22), + g_procedure_source(sc, make_list_1(sc, sc->code)), sc->args))); - } - else + } + else { /* final arg was dotted? */ if (s7_is_symbol(sc->x)) - add_to_local_environment(sc, sc->x, sc->y); + add_to_local_environment(sc, sc->x, sc->y); } } @@ -16144,7 +16144,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = sc->NIL; goto BEGIN; } - + case T_CONTINUATION: /* -------- continuation ("call-with-continuation") -------- */ { check_for_dynamic_winds(sc, sc->code); @@ -16178,7 +16178,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->z = vector_element(sc->stack, i - 3); if (dynamic_wind_state(sc->z) == T_DWIND_BODY) { - push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); + push_stack(sc, OP_EVAL_DONE, sc->args, sc->code); sc->args = sc->NIL; sc->code = dynamic_wind_out(sc->z); eval(sc, OP_APPLY); @@ -16190,7 +16190,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->trace_depth--; } } - + sc->stack_top = new_stack_top; sc->value = (sc->args != sc->NIL) ? car(sc->args) : sc->NIL; pop_stack(sc); @@ -16219,7 +16219,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) case T_PAIR: /* -------- list as applicable object -------- */ if (cdr(sc->args) != sc->NIL) return(s7_wrong_number_of_args_error(sc, "list ref (via list as applicable object)", sc->args)); - /* + /* * I suppose we could take n args here = repeated list-refs * ((list (list 1 2) 3) 0 0) -> 1 (caar) */ @@ -16239,14 +16239,14 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } /* ---------------- end OP_APPLY ---------------- */ - + case OP_EVAL_MACRO: /* after (scheme-side) macroexpansion, evaluate the resulting expression */ /* if the macro is more than a quasiquoted expression, then we come through here twice */ sc->code = sc->value; goto EVAL; - - - case OP_LAMBDA: + + + case OP_LAMBDA: /* this includes unevaluated symbols (direct symbol table refs) in macro arg list */ if ((!is_pair(sc->code)) || (!is_pair(cdr(sc->code)))) /* (lambda) or (lambda #f) */ @@ -16281,9 +16281,9 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) return(eval_error(sc, "lambda* parameter ~S is not a symbol", car(sc->code))); } else - { + { for (sc->x = car(sc->code); sc->x != sc->NIL; sc->x = cdr(sc->x)) - if ((!s7_is_symbol(sc->x)) && + if ((!s7_is_symbol(sc->x)) && ((!is_pair(sc->x)) || ((!s7_is_symbol(car(sc->x))) && ((!is_pair(car(sc->x))) || /* check for stuff like (lambda* (()) 1) (lambda* ((a . 0)) 1) etc */ @@ -16295,8 +16295,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->value = make_closure(sc, sc->code, sc->envir, T_CLOSURE_STAR); pop_stack(sc); goto START; - - + + case OP_QUOTE: if ((!is_pair(sc->code)) || /* (quote . -1) */ (cdr(sc->code) != sc->NIL)) /* (quote . (1 2)) or (quote 1 1) */ @@ -16307,7 +16307,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) pop_stack(sc); goto START; - + case OP_DEFINE_CONSTANT1: /* define-constant -> OP_DEFINE_CONSTANT0 -> OP_DEFINE0..1, then back to here */ /* at this point, sc->value is the symbol that we want to be immutable, sc->code is the original pair */ @@ -16321,7 +16321,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) case OP_DEFINE_CONSTANT0: push_stack(sc, OP_DEFINE_CONSTANT1, sc->NIL, sc->code); - + case OP_DEFINE_STAR: case OP_DEFINE0: if (!is_pair(sc->code)) @@ -16334,14 +16334,14 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) (cddr(sc->code) != sc->NIL)) /* (define var 1 . 2) */ return(eval_error(sc, "define: more than 1 value? ~A", sc->code)); /* (define var 1 2) */ - if (is_pair(car(sc->code))) + if (is_pair(car(sc->code))) { sc->x = caar(sc->code); if (sc->op == OP_DEFINE_STAR) sc->code = s7_cons(sc, sc->LAMBDA_STAR, s7_cons(sc, cdar(sc->code), cdr(sc->code))); else sc->code = s7_cons(sc, sc->LAMBDA, s7_cons(sc, cdar(sc->code), cdr(sc->code))); - } - else + } + else { sc->x = car(sc->code); sc->code = cadr(sc->code); @@ -16351,11 +16351,11 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) if (s7_is_immutable(sc->x)) /* (define pi 3) or (define (pi a) a) */ return(eval_error(sc, "define: ~S is immutable", sc->x)); - + push_stack(sc, OP_DEFINE1, sc->NIL, sc->x); goto EVAL; - - + + case OP_DEFINE1: /* sc->code is the symbol being defined, sc->value is its value * if sc->value is a closure, car is of the form ((args...) body...) @@ -16364,27 +16364,27 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) */ /* it's not possible to expand and replace macros at this point without evaluating - * the body. Just as examples, say we have a macro "mac", + * the body. Just as examples, say we have a macro "mac", * (define (hi) (call/cc (lambda (mac) (mac 1)))) * (define (hi) (quote (mac 1))) or macroexpand etc * (define (hi mac) (mac 1)) assuming mac here is a function passed as an arg, - * etc... + * etc... */ /* if we're defining a function, add its symbol to the new function's environment under the name __func__ */ - if ((is_closure(sc->value)) || + if ((is_closure(sc->value)) || (is_closure_star(sc->value))) - closure_environment(sc->value) = - s7_cons(sc, - s7_cons(sc, - port_filename(sc->input_port) ? s7_immutable_cons(sc, - sc->__FUNC__, - make_list_3(sc, + closure_environment(sc->value) = + s7_cons(sc, + s7_cons(sc, + port_filename(sc->input_port) ? s7_immutable_cons(sc, + sc->__FUNC__, + make_list_3(sc, sc->code, s7_make_string(sc, port_filename(sc->input_port)), s7_make_integer(sc, port_line_number(sc->input_port)))) : - s7_immutable_cons(sc, sc->__FUNC__, sc->code), - sc->NIL), + s7_immutable_cons(sc, sc->__FUNC__, sc->code), + sc->NIL), closure_environment(sc->value)); else { @@ -16397,25 +16397,25 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) /* add the newly defined thing to the current environment */ sc->x = s7_find_symbol_in_environment(sc, sc->envir, sc->code, false); - if (sc->x != sc->NIL) - set_symbol_value(sc->x, sc->value); - else add_to_current_environment(sc, sc->code, sc->value); + if (sc->x != sc->NIL) + set_symbol_value(sc->x, sc->value); + else add_to_current_environment(sc, sc->code, sc->value); sc->value = sc->code; pop_stack(sc); goto START; - - + + case OP_SET2: sc->code = s7_cons(sc, s7_cons(sc, sc->value, sc->args), sc->code); - + case OP_SET0: /* entry for set! */ if (!is_pair(sc->code)) return(eval_error(sc, "set! syntax error ~A", sc->code)); /* set! . 1) */ if (s7_is_immutable(car(sc->code))) /* (set! pi 3) */ return(eval_error(sc, "set!: can't alter immutable object: ~S", car(sc->code))); - + if ((cdr(sc->code) == sc->NIL) || (cddr(sc->code) != sc->NIL)) /* (set! var) */ return(eval_error(sc, "~A: wrong number of args to set!", sc->code)); @@ -16428,15 +16428,15 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->code = caar(sc->code); goto EVAL; } - + if (!s7_is_symbol(caar(sc->code))) /* (set! (1 2) #t) */ - return(eval_error(sc, "~A: non-symbol as generalized set! accessor?", sc->code)); + return(eval_error(sc, "~A: non-symbol as generalized set! accessor?", sc->code)); sc->x = s7_symbol_value(sc, caar(sc->code)); if ((is_c_object(sc->x)) && (object_set_function(sc->x))) sc->code = s7_cons(sc, sc->OBJECT_SET, s7_append(sc, car(sc->code), cdr(sc->code))); /* use set method (append flattens the lists) */ - else + else { switch (type(sc->x)) { @@ -16445,17 +16445,17 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) /* args have not been evaluated! */ sc->code = s7_cons(sc, sc->VECTOR_SET, s7_append(sc, car(sc->code), cdr(sc->code))); break; - + case T_STRING: - sc->code = s7_cons(sc, sc->STRING_SET, s7_append(sc, car(sc->code), cdr(sc->code))); + sc->code = s7_cons(sc, sc->STRING_SET, s7_append(sc, car(sc->code), cdr(sc->code))); break; case T_PAIR: - sc->code = s7_cons(sc, sc->LIST_SET, s7_append(sc, car(sc->code), cdr(sc->code))); + sc->code = s7_cons(sc, sc->LIST_SET, s7_append(sc, car(sc->code), cdr(sc->code))); break; case T_HASH_TABLE: - sc->code = s7_cons(sc, sc->HASH_TABLE_SET, s7_append(sc, car(sc->code), cdr(sc->code))); + sc->code = s7_cons(sc, sc->HASH_TABLE_SET, s7_append(sc, car(sc->code), cdr(sc->code))); break; default: @@ -16463,61 +16463,61 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } } } - else + else { if (!s7_is_symbol(car(sc->code))) /* (set! 12345 1) */ return(eval_error(sc, "set! can't change ~S", car(sc->code))); - + push_stack(sc, OP_SET1, sc->NIL, car(sc->code)); sc->code = cadr(sc->code); } goto EVAL; - - - case OP_SET1: + + + case OP_SET1: sc->y = s7_find_symbol_in_environment(sc, sc->envir, sc->code, true); - if (sc->y != sc->NIL) + if (sc->y != sc->NIL) { #if WITH_ENCAPSULATION if (is_encapsulating(sc)) encapsulate(sc, sc->code); #endif - set_symbol_value(sc->y, sc->value); + set_symbol_value(sc->y, sc->value); pop_stack(sc); goto START; } return(eval_error(sc, "set! ~A: unbound variable", sc->code)); - - + + case OP_IF0: if (!is_pair(sc->code)) /* (if) or (if . 1) */ return(eval_error(sc, "(if): if needs at least 2 expressions", sc->code)); if (!is_pair(cdr(sc->code))) /* (if 1) */ return(eval_error(sc, "(if ~A): if needs another clause", car(sc->code))); - + if ((!is_pair(cddr(sc->code))) && (cddr(sc->code) != sc->NIL)) /* (if 1 2 . 3) */ return(eval_error(sc, "if: ~A has improper list?", sc->code)); - if ((is_pair(cddr(sc->code))) && + if ((is_pair(cddr(sc->code))) && (cdddr(sc->code) != sc->NIL)) /* (if 1 2 3 4) */ return(eval_error(sc, "too many clauses for if: ~A", sc->code)); - - + + push_stack(sc, OP_IF1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); goto EVAL; - - + + case OP_IF1: if (is_true(sc, sc->value)) sc->code = car(sc->code); else sc->code = cadr(sc->code); /* (if #f 1) ==> # because car(sc->NIL) = sc->UNSPECIFIED */ goto EVAL; - - + + case OP_LET0: /* sc->code is everything after the let: (let ((a 1)) a) so sc->code is (((a 1)) a) */ /* car it can be either a list or a symbol ("named let") */ @@ -16538,12 +16538,12 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = sc->NIL; sc->value = sc->code; sc->code = s7_is_symbol(car(sc->code)) ? cadr(sc->code) : car(sc->code); - - + + case OP_LET1: /* let -- calculate parameters */ sc->args = s7_cons(sc, sc->value, sc->args); - if (is_pair(sc->code)) - { + if (is_pair(sc->code)) + { if (!is_pair(car(sc->code))) /* (let ((x)) ...) or (let ((x 1) . (y 2)) ...) */ return(eval_error(sc, "let syntax error (no value?): ~A", car(sc->code))); @@ -16557,7 +16557,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->code = cadar(sc->code); sc->args = sc->NIL; goto EVAL; - } + } if (sc->code != sc->NIL) /* (let* ((a 1) . b) a) */ return(eval_error(sc, "let var list improper?: ~A", sc->code)); @@ -16565,11 +16565,11 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->args = safe_reverse_in_place(sc, sc->args); sc->code = car(sc->args); sc->args = cdr(sc->args); - - + + case OP_LET2: - sc->envir = new_frame_in_env(sc, sc->envir); - for (sc->x = s7_is_symbol(car(sc->code)) ? cadr(sc->code) : car(sc->code), sc->y = sc->args; sc->y != sc->NIL; sc->x = cdr(sc->x), sc->y = cdr(sc->y)) + sc->envir = new_frame_in_env(sc, sc->envir); + for (sc->x = s7_is_symbol(car(sc->code)) ? cadr(sc->code) : car(sc->code), sc->y = sc->args; sc->y != sc->NIL; sc->x = cdr(sc->x), sc->y = cdr(sc->y)) { if (!(s7_is_symbol(caar(sc->x)))) return(eval_error(sc, "bad variable ~S in let bindings", car(sc->code))); @@ -16580,48 +16580,48 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) add_to_local_environment(sc, caar(sc->x), car(sc->y)); /* expansion here does not help */ } - if (s7_is_symbol(car(sc->code))) + if (s7_is_symbol(car(sc->code))) { /* named let */ - for (sc->x = cadr(sc->code), sc->args = sc->NIL; sc->x != sc->NIL; sc->x = cdr(sc->x)) + for (sc->x = cadr(sc->code), sc->args = sc->NIL; sc->x != sc->NIL; sc->x = cdr(sc->x)) sc->args = s7_cons(sc, caar(sc->x), sc->args); - - sc->x = s7_make_closure(sc, s7_cons(sc, safe_reverse_in_place(sc, sc->args), cddr(sc->code)), sc->envir); - add_to_local_environment(sc, car(sc->code), sc->x); + + sc->x = s7_make_closure(sc, s7_cons(sc, safe_reverse_in_place(sc, sc->args), cddr(sc->code)), sc->envir); + add_to_local_environment(sc, car(sc->code), sc->x); sc->code = cddr(sc->code); sc->args = sc->NIL; - } - else + } + else { sc->code = cdr(sc->code); sc->args = sc->NIL; } goto BEGIN; - - + + case OP_LET_STAR0: if ((!is_pair(sc->code)) || /* (let* . 1) */ (!is_pair(cdr(sc->code))) || /* (let*) */ ((!is_pair(car(sc->code))) && /* (let* 1 ...), also there's no named let* */ (car(sc->code) != sc->NIL))) return(eval_error(sc, "let* syntax error: ~A", sc->code)); - - if (car(sc->code) == sc->NIL) + + if (car(sc->code) == sc->NIL) { - sc->envir = new_frame_in_env(sc, sc->envir); + sc->envir = new_frame_in_env(sc, sc->envir); sc->code = cdr(sc->code); goto BEGIN; } - + if ((!is_pair(car(sc->code))) || /* (let* x ... ) */ (!is_pair(caar(sc->code))) || /* (let* (x) ...) */ (!is_pair(cdaar(sc->code)))) /* (let* ((x . 1)) ...) */ return(eval_error(sc, "let* variable list syntax error: ~A", sc->code)); - + push_stack(sc, OP_LET_STAR1, cdr(sc->code), car(sc->code)); sc->code = cadaar(sc->code); goto EVAL; - - + + case OP_LET_STAR1: /* let* -- calculate parameters */ if (!(s7_is_symbol(caar(sc->code)))) return(eval_error(sc, "bad variable ~S in let* bindings", car(sc->code))); @@ -16635,7 +16635,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) if (cddar(sc->code) != sc->NIL) /* (let* ((x 1 2 3)) ...) */ return(eval_error(sc, "let* syntax error (more than one value?): ~A", car(sc->code))); - sc->envir = new_frame_in_env(sc, sc->envir); + sc->envir = new_frame_in_env(sc, sc->envir); /* we can't skip this new frame -- we have to imitate a nested let, otherwise * * (let ((f1 (lambda (arg) (+ arg 1)))) @@ -16646,15 +16646,15 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * will hang. */ - add_to_local_environment(sc, caar(sc->code), sc->value); + add_to_local_environment(sc, caar(sc->code), sc->value); sc->code = cdr(sc->code); - if (is_pair(sc->code)) - { + if (is_pair(sc->code)) + { push_stack(sc, OP_LET_STAR1, sc->args, sc->code); sc->code = cadar(sc->code); sc->args = sc->NIL; goto EVAL; - } + } if (sc->code != sc->NIL) /* (let* ((a 1) . b) a) */ return(eval_error(sc, "let* var list improper?: ~A", sc->code)); @@ -16662,22 +16662,22 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->code = sc->args; sc->args = sc->NIL; goto BEGIN; - - + + case OP_LETREC0: if ((!is_pair(sc->code)) || /* (letrec . 1) */ (!is_pair(cdr(sc->code))) || /* (letrec) */ ((!is_pair(car(sc->code))) && /* (letrec 1 ...) */ (car(sc->code) != sc->NIL))) return(eval_error(sc, "letrec syntax error: ~A", sc->code)); - + /* get all local vars and set to #undefined * get parallel list of values * eval each member of values list with env still full of #undefined's * assign each value to its variable * eval body */ - sc->envir = new_frame_in_env(sc, sc->envir); + sc->envir = new_frame_in_env(sc, sc->envir); sc->args = sc->NIL; sc->value = sc->code; sc->code = car(sc->code); @@ -16691,11 +16691,11 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) add_to_local_environment(sc, caar(sc->x), sc->UNDEFINED); } - + case OP_LETREC1: /* letrec -- calculate parameters */ sc->args = s7_cons(sc, sc->value, sc->args); - if (is_pair(sc->code)) - { + if (is_pair(sc->code)) + { if (!is_pair(car(sc->code))) /* (letrec ((x)) x) -- perhaps this is legal? */ return(eval_error(sc, "letrec syntax error (no value?): ~A", car(sc->code))); @@ -16709,12 +16709,12 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->code = cadar(sc->code); sc->args = sc->NIL; goto EVAL; - } + } - sc->args = safe_reverse_in_place(sc, sc->args); + sc->args = safe_reverse_in_place(sc, sc->args); sc->code = car(sc->args); sc->args = cdr(sc->args); - + case OP_LETREC2: for (sc->x = car(sc->code), sc->y = sc->args; sc->y != sc->NIL; sc->x = cdr(sc->x), sc->y = cdr(sc->y)) @@ -16722,8 +16722,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->code = cdr(sc->code); sc->args = sc->NIL; goto BEGIN; - - + + case OP_COND0: if (!is_pair(sc->code)) return(eval_error(sc, "syntax error in cond: ~A", sc->code)); @@ -16734,8 +16734,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) push_stack(sc, OP_COND1, sc->NIL, sc->code); sc->code = caar(sc->code); goto EVAL; - - + + case OP_COND1: if (is_true(sc, sc->value)) /* got a hit */ { @@ -16747,17 +16747,17 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } if (!is_pair(sc->code)) /* (cond (1 . 2)...) */ return(eval_error(sc, "syntax error in cond: ~A", sc->code)); - - if (car(sc->code) == sc->FEED_TO) + + if (car(sc->code) == sc->FEED_TO) { - if (!is_pair(cdr(sc->code))) + if (!is_pair(cdr(sc->code))) return(eval_error(sc, "syntax error in cond: ~A", cdr(sc->code))); - sc->x = make_list_2(sc, sc->QUOTE, sc->value); + sc->x = make_list_2(sc, sc->QUOTE, sc->value); sc->code = make_list_2(sc, cadr(sc->code), sc->x); goto EVAL; } - + goto BEGIN; } @@ -16767,15 +16767,15 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->value = sc->NIL; pop_stack(sc); goto START; - } - + } + push_stack(sc, OP_COND1, sc->NIL, sc->code); sc->code = caar(sc->code); goto EVAL; - - + + case OP_AND0: - if (sc->code == sc->NIL) + if (sc->code == sc->NIL) { sc->value = sc->T; pop_stack(sc); @@ -16786,8 +16786,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) push_stack(sc, OP_AND1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); goto EVAL; - - + + case OP_AND1: if ((is_false(sc, sc->value)) || (sc->code == sc->NIL)) @@ -16802,10 +16802,10 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) push_stack(sc, OP_AND1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); goto EVAL; - - + + case OP_OR0: - if (sc->code == sc->NIL) + if (sc->code == sc->NIL) { sc->value = sc->F; pop_stack(sc); @@ -16816,8 +16816,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) push_stack(sc, OP_OR1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); goto EVAL; - - + + case OP_OR1: if ((is_true(sc, sc->value)) || (sc->code == sc->NIL)) @@ -16832,8 +16832,8 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) push_stack(sc, OP_OR1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); goto EVAL; - - + + case OP_MACRO0: /* this is tinyscheme's weird macro syntax */ /* (macro (when form) @@ -16849,35 +16849,35 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * goto eval popping to OP_MACRO1 * eval sees the lambda and creates a closure (s7_make_closure): car => code, cdr => environment */ - if (is_pair(car(sc->code))) + if (is_pair(car(sc->code))) { sc->x = caar(sc->code); sc->code = s7_cons(sc, sc->LAMBDA, s7_cons(sc, cdar(sc->code), cdr(sc->code))); - } - else + } + else { sc->x = car(sc->code); sc->code = cadr(sc->code); } - if (!s7_is_symbol(sc->x)) + if (!s7_is_symbol(sc->x)) return(eval_error(sc, "~S: variable is not a symbol", sc->x)); push_stack(sc, OP_MACRO1, sc->NIL, sc->x); /* sc->x (the name symbol) will be sc->code when we pop to OP_MACRO1 */ goto EVAL; - - + + case OP_MACRO1: /* here sc->code is the name (a symbol), sc->value is a closure object, its car is the form as called * (macro (when form) * `(if ,(cadr form) (begin ,@(cddr form)))) * has become: - * ((form) - * (quasiquote - * (if (unquote (cadr form)) + * ((form) + * (quasiquote + * (if (unquote (cadr form)) * (begin (unquote-splicing (cddr form)))))) - * with - * sc->code: when - * sc->value: # + * with + * sc->code: when + * sc->value: # * where "form" is the thing presented to us in the code, i.e. (when mumble do-this) * and the following code takes that as its argument and transforms it in some way */ @@ -16886,33 +16886,33 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) return(eval_error(sc, "macro name is not a symbol?", sc->code)); set_type(sc->value, T_MACRO | T_ANY_MACRO); - + /* find name in environment, and define it */ - sc->x = s7_find_symbol_in_environment(sc, sc->envir, sc->code, false); - if (sc->x != sc->NIL) - set_symbol_value(sc->x, sc->value); - else add_to_current_environment(sc, sc->code, sc->value); - + sc->x = s7_find_symbol_in_environment(sc, sc->envir, sc->code, false); + if (sc->x != sc->NIL) + set_symbol_value(sc->x, sc->value); + else add_to_current_environment(sc, sc->code, sc->value); + /* pop back to wherever the macro call was */ sc->x = sc->value; sc->value = sc->code; pop_stack(sc); goto START; - - + + case OP_DEFMACRO: case OP_DEFMACRO_STAR: - + /* (defmacro name (args) body) -> * * (macro (defmacro dform) - * (let ((form (gensym "defmac"))) - * `(macro (,(cadr dform) ,form) + * (let ((form (gensym "defmac"))) + * `(macro (,(cadr dform) ,form) * (apply - * (lambda ,(caddr dform) - * ,@(cdddr dform)) - * (cdr ,form))))) - * + * (lambda ,(caddr dform) + * ,@(cdddr dform)) + * (cdr ,form))))) + * * end up with name as sc->x, args and body as sc->z going to OP_MACRO1, ((gensym) (lambda (args) body)) going to eval */ @@ -16954,37 +16954,37 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * * Isn't it just as good to say: * - * (define-macro (mac a b) + * (define-macro (mac a b) * `(with-environment (global-environment) * (+ ,a ,b))) * * now if we rebind + * - * (let ((+ -)) + * (let ((+ -)) * (mac 1 2)) * 3 */ sc->x = car(sc->code); /* just in case g_quasiquote stepped on sc->x */ sc->y = s7_gensym(sc, "defmac"); - sc->code = s7_cons(sc, + sc->code = s7_cons(sc, sc->LAMBDA, - s7_cons(sc, + s7_cons(sc, make_list_1(sc, sc->y), - make_list_1(sc, - s7_cons(sc, + make_list_1(sc, + s7_cons(sc, sc->APPLY, - s7_cons(sc, - s7_cons(sc, + s7_cons(sc, + s7_cons(sc, (sc->op == OP_DEFMACRO_STAR) ? sc->LAMBDA_STAR : sc->LAMBDA, sc->z), make_list_1(sc, make_list_2(sc, sc->CDR, sc->y))))))); /* so, (defmacro hi (a b) `(+ ,a ,b)) becomes: * sc->x: hi - * sc->code: (lambda (defmac-21) - * (apply (lambda (a b) - * (cons (quote +) (cons a (cons b (quote ()))))) + * sc->code: (lambda (defmac-21) + * (apply (lambda (a b) + * (cons (quote +) (cons a (cons b (quote ()))))) * (cdr defmac-21))) */ push_stack(sc, OP_MACRO1, sc->NIL, sc->x); /* sc->x (the name symbol) will be sc->code when we pop to OP_MACRO1 */ @@ -17038,15 +17038,15 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->y = s7_gensym(sc, "defmac"); sc->code = s7_cons(sc, sc->LAMBDA, - s7_cons(sc, + s7_cons(sc, make_list_1(sc, sc->y), - make_list_1(sc, - s7_cons(sc, + make_list_1(sc, + s7_cons(sc, sc->APPLY, - s7_cons(sc, - s7_cons(sc, + s7_cons(sc, + s7_cons(sc, (sc->op == OP_DEFINE_MACRO_STAR) ? sc->LAMBDA_STAR : sc->LAMBDA, - s7_cons(sc, + s7_cons(sc, cdar(sc->code), /* arg list */ sc->z)), make_list_1(sc, make_list_2(sc, sc->CDR, sc->y))))))); @@ -17057,26 +17057,26 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) */ push_stack(sc, OP_MACRO1, sc->NIL, sc->x); /* sc->x (the name symbol) will be sc->code when we pop to OP_MACRO1 */ goto EVAL; - - + + case OP_CASE0: /* case, car(sc->code) is the selector */ if ((!is_pair(sc->code)) || (!is_pair(cdr(sc->code))) || - (!is_pair(cadr (sc->code)))) + (!is_pair(cadr (sc->code)))) return(eval_error(sc, "syntax error in case: ~A", sc->code)); - + push_stack(sc, OP_CASE1, sc->NIL, cdr(sc->code)); sc->code = car(sc->code); goto EVAL; - - - case OP_CASE1: - for (sc->x = sc->code; sc->x != sc->NIL; sc->x = cdr(sc->x)) + + + case OP_CASE1: + for (sc->x = sc->code; sc->x != sc->NIL; sc->x = cdr(sc->x)) { if ((!is_pair(sc->x)) || (!is_pair(car(sc->x)))) - return(eval_error(sc, "case clause ~A messed up", sc->x)); - + return(eval_error(sc, "case clause ~A messed up", sc->x)); + sc->y = caar(sc->x); if (!is_pair(sc->y)) { @@ -17087,43 +17087,43 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) break; } - for ( ; sc->y != sc->NIL; sc->y = cdr(sc->y)) - if (s7_is_eqv(car(sc->y), sc->value)) + for ( ; sc->y != sc->NIL; sc->y = cdr(sc->y)) + if (s7_is_eqv(car(sc->y), sc->value)) break; - - if (sc->y != sc->NIL) + + if (sc->y != sc->NIL) break; } - if (sc->x != sc->NIL) + if (sc->x != sc->NIL) { - if (is_pair(caar(sc->x))) + if (is_pair(caar(sc->x))) { sc->code = cdar(sc->x); goto BEGIN; - } + } push_stack(sc, OP_CASE2, sc->NIL, cdar(sc->x)); sc->code = caar(sc->x); goto EVAL; - } + } sc->value = sc->NIL; pop_stack(sc); goto START; - - - case OP_CASE2: - if (is_true(sc, sc->value)) + + + case OP_CASE2: + if (is_true(sc, sc->value)) goto BEGIN; sc->value = sc->NIL; pop_stack(sc); goto START; - + case OP_TRACE_HOOK_QUIT: goto APPLY_WITHOUT_TRACE; - + case OP_ERROR_HOOK_QUIT: s7_symbol_set_value(sc, sc->ERROR_HOOK, sc->code); @@ -17149,7 +17149,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) case OP_UNWIND_INPUT: return(sc->F); break; - + case OP_DYNAMIC_WIND: if (dynamic_wind_state(sc->code) == T_DWIND_INIT) @@ -17176,13 +17176,13 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) if ((is_pair(sc->args)) && (car(sc->args) == sc->VALUES)) sc->value = splice_in_values(sc, cdr(sc->args)); - else sc->value = sc->args; /* value saved above */ - pop_stack(sc); + else sc->value = sc->args; /* value saved above */ + pop_stack(sc); goto START; } } break; - + case OP_CATCH: pop_stack(sc); @@ -17193,11 +17193,11 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) trace_return(sc); pop_stack(sc); goto START; - - - case OP_READ_LIST: + + + case OP_READ_LIST: /* sc->args is sc->NIL at first */ - /* was: sc->args = s7_cons(sc, sc->value, sc->args); */ + /* was: sc->args = s7_cons(sc, sc->value, sc->args); */ { s7_pointer x; #if HAVE_PTHREADS @@ -17225,7 +17225,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * (define (ho b) (+ 1 (hi b))) * * here sc->value is: (ho b), (hi b), (+ 1 (hi b)), (define (ho b) (+ 1 (hi b))) - * + * * but... first we can't tell for sure at this point that "hi" really is a macro * * (letrec ((hi ... (hi...))) will be confused about the 2nd hi, @@ -17251,7 +17251,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) * (define (ho b) (+ 1 (hi b))) * (procedure-source ho) -> (lambda (b) (+ 1 (+ b 1))) */ - + if ((sc->value != sc->NIL) && (is_expansion(car(sc->value))) && (sc->stack_top >= 4) && @@ -17261,7 +17261,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) { s7_pointer x; x = symbol_value(s7_find_symbol_in_environment(sc, sc->envir, car(sc->value), true)); - sc->args = make_list_1(sc, sc->value); + sc->args = make_list_1(sc, sc->value); sc->code = x; goto APPLY; } @@ -17287,7 +17287,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) pop_stack(sc); goto START; - + case OP_READ_DOT: if (token(sc) != TOKEN_RIGHT_PAREN) { @@ -17297,7 +17297,7 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) } /* args = previously read stuff, value = thing just after the dot and before the ')': * (list 1 2 . 3) - * value: 3, args: (2 1 list) + * value: 3, args: (2 1 list) * '(1 . 2) * value: 2, args: (1) * @@ -17312,45 +17312,45 @@ static s7_pointer eval(s7_scheme *sc, opcode_t first_op) sc->value = s7_reverse_in_place(sc, sc->value, sc->args); pop_stack(sc); goto START; - - + + case OP_READ_QUOTE: sc->value = make_list_2(sc, sc->QUOTE, sc->value); pop_stack(sc); - goto START; - - + goto START; + + case OP_READ_QUASIQUOTE: sc->value = make_list_2(sc, sc->QUASIQUOTE, sc->value); pop_stack(sc); goto START; - - + + case OP_READ_QUASIQUOTE_VECTOR: sc->value = make_list_3(sc, sc->APPLY, sc->VECTOR, make_list_2(sc, sc->QUASIQUOTE, sc->value)); pop_stack(sc); goto START; - - + + case OP_READ_UNQUOTE: sc->value = make_list_2(sc, sc->UNQUOTE, sc->value); pop_stack(sc); goto START; - - + + case OP_READ_UNQUOTE_SPLICING: sc->value = make_list_2(sc, sc->UNQUOTE_SPLICING, sc->value); pop_stack(sc); goto START; - - + + case OP_READ_VECTOR: sc->value = g_vector(sc, sc->value); set_immutable(sc->value); /* a vector constant should be immutable? */ pop_stack(sc); goto START; - + default: return(eval_error(sc, "~A: unknown operator!", s7_make_integer(sc, sc->op))); } @@ -17371,23 +17371,23 @@ static s7_scheme *clone_s7(s7_scheme *sc, s7_pointer vect) new_sc = (s7_scheme *)malloc(sizeof(s7_scheme)); memcpy((void *)new_sc, (void *)sc, sizeof(s7_scheme)); - + /* share the heap, symbol table and global environment, protected objects list, and all the startup stuff (all via the memcpy), * but have separate stacks and eval locals */ - + new_sc->longjmp_ok = false; new_sc->strbuf_size = INITIAL_STRBUF_SIZE; new_sc->strbuf = (char *)calloc(new_sc->strbuf_size, sizeof(char)); new_sc->read_line_buf = NULL; new_sc->read_line_buf_size = 0; - + new_sc->stack_top = 0; new_sc->stack = vect; new_sc->stack_size = INITIAL_STACK_SIZE; new_sc->stack_size2 = new_sc->stack_size / 2; - + new_sc->x = new_sc->NIL; new_sc->y = new_sc->NIL; new_sc->z = new_sc->NIL; @@ -17399,7 +17399,7 @@ static s7_scheme *clone_s7(s7_scheme *sc, s7_pointer vect) #if WITH_ENCAPSULATION new_sc->encapsulators = sc->NIL; #endif - + new_sc->temps_size = GC_TEMPS_SIZE; new_sc->temps_ctr = 0; new_sc->temps = (s7_pointer *)malloc(new_sc->temps_size * sizeof(s7_pointer)); @@ -17517,18 +17517,18 @@ static s7_pointer g_make_thread(s7_scheme *sc, s7_pointer args) if (!is_procedure(car(args))) return(s7_wrong_type_arg_error(sc, "make-thread", 0, car(args), "a thunk")); - + pthread_mutex_lock(&alloc_lock); /* if currently in GC in some thread, wait for it */ pthread_mutex_unlock(&alloc_lock); - + frame = s7_immutable_cons(sc, sc->NIL, sc->envir); vect = s7_make_vector(sc, INITIAL_STACK_SIZE); - + f = (thred *)calloc(1, sizeof(thred)); f->func = car(args); - + obj = s7_make_object(sc, thread_tag, (void *)f); - + pthread_mutex_lock(&alloc_lock); f->sc = clone_s7(sc, vect); @@ -17538,7 +17538,7 @@ static s7_pointer g_make_thread(s7_scheme *sc, s7_pointer args) pthread_create(f->thread, NULL, run_thread_func, (void *)f); pthread_mutex_unlock(&alloc_lock); - + return(obj); } @@ -17556,7 +17556,7 @@ static s7_pointer g_join_thread(s7_scheme *sc, s7_pointer args) thred *f; if (g_is_thread(sc, args) == sc->F) return(s7_wrong_type_arg_error(sc, "join-thread", 0, car(args), "a thread")); - + f = (thred *)s7_object_value(car(args)); pthread_join(*(f->thread), NULL); return(car(args)); @@ -17617,7 +17617,7 @@ static s7_pointer g_make_lock(s7_scheme *sc, s7_pointer args) pthread_mutex_t *lock; lock = (pthread_mutex_t *)malloc(sizeof(pthread_mutex_t)); pthread_mutex_init(lock, NULL); - return(s7_make_object(sc, lock_tag, (void *)lock)); + return(s7_make_object(sc, lock_tag, (void *)lock)); } @@ -17648,7 +17648,7 @@ static int key_tag = 0; static void *key_value(s7_pointer obj) { - pthread_key_t *key; + pthread_key_t *key; key = (pthread_key_t *)s7_object_value(obj); return(pthread_getspecific(*key)); /* returns NULL if never set */ } @@ -17720,7 +17720,7 @@ static s7_pointer g_make_thread_variable(s7_scheme *sc, s7_pointer args) pthread_key_t *key; key = (pthread_key_t *)malloc(sizeof(pthread_key_t)); pthread_key_create(key, NULL); - return(s7_make_object(sc, key_tag, (void *)key)); + return(s7_make_object(sc, key_tag, (void *)key)); } @@ -17735,9 +17735,9 @@ static s7_pointer get_key(s7_scheme *sc, s7_pointer obj, s7_pointer args) static s7_pointer set_key(s7_scheme *sc, s7_pointer obj, s7_pointer args) { - pthread_key_t *key; + pthread_key_t *key; key = (pthread_key_t *)s7_object_value(obj); - pthread_setspecific(*key, (void *)car(args)); + pthread_setspecific(*key, (void *)car(args)); /* to protect from the GC until either the local key value is set again, or the thread is done, * we store the key's local value in an alist '(obj value) @@ -17828,20 +17828,20 @@ bool s7_is_number(s7_pointer p) } -bool s7_is_integer(s7_pointer p) -{ - return(((type(p) == T_NUMBER) && +bool s7_is_integer(s7_pointer p) +{ + return(((type(p) == T_NUMBER) && (number_type(p) == NUM_INT)) || - ((is_c_object(p)) && + ((is_c_object(p)) && (c_object_type(p) == big_integer_tag))); } -bool s7_is_real(s7_pointer p) -{ - return(((type(p) == T_NUMBER) && +bool s7_is_real(s7_pointer p) +{ + return(((type(p) == T_NUMBER) && (number_type(p) < NUM_COMPLEX)) || - ((is_c_object(p)) && + ((is_c_object(p)) && ((c_object_type(p) == big_integer_tag) || (c_object_type(p) == big_ratio_tag) || (c_object_type(p) == big_real_tag)))); @@ -17850,9 +17850,9 @@ bool s7_is_real(s7_pointer p) bool s7_is_rational(s7_pointer p) { - return(((type(p) == T_NUMBER) && + return(((type(p) == T_NUMBER) && (number_type(p) <= NUM_RATIO)) || - ((is_c_object(p)) && + ((is_c_object(p)) && ((c_object_type(p) == big_integer_tag) || (c_object_type(p) == big_ratio_tag)))); } @@ -17860,9 +17860,9 @@ bool s7_is_rational(s7_pointer p) bool s7_is_ratio(s7_pointer p) { - return(((type(p) == T_NUMBER) && + return(((type(p) == T_NUMBER) && (number_type(p) == NUM_RATIO)) || - ((is_c_object(p)) && + ((is_c_object(p)) && (c_object_type(p) == big_ratio_tag))); } @@ -17906,7 +17906,7 @@ static char *mpfr_to_string(mpfr_t val, int radix) len += 64; tmp = (char *)malloc(len * sizeof(char)); - + if (str[0] == '-') snprintf(tmp, len, "-%c.%sE%d", str[1], (char *)(str + 2), (int)expptr - 1); else snprintf(tmp, len, "%c.%sE%d", str[0], (char *)(str + 1), (int)expptr - 1); @@ -18115,7 +18115,7 @@ static s7_pointer s7_number_to_big_real(s7_scheme *sc, s7_pointer p) n = (mpfr_t *)malloc(sizeof(mpfr_t)); switch (number_type(p)) { - case NUM_INT: + case NUM_INT: { s7_Int val; val = s7_integer(p); @@ -18193,7 +18193,7 @@ static s7_pointer s7_number_to_big_complex(s7_scheme *sc, s7_pointer p) mpc_init(*n); switch (number_type(p)) { - case NUM_INT: + case NUM_INT: { s7_Int val; val = s7_integer(p); @@ -18517,7 +18517,7 @@ static bool big_numbers_are_eqv(s7_pointer a, s7_pointer b) bool result; if ((!is_c_object(a)) && (!is_c_object(b))) /* either or both can be big here, but not neither */ return(false); - + if (s7_is_integer(a)) { mpz_t a1, b1; @@ -18770,8 +18770,8 @@ static s7_pointer string_to_either_complex_1(s7_scheme *sc, char *q, char *slash #define T_BIG_COMPLEX 3 static s7_pointer string_to_either_complex(s7_scheme *sc, - char *q, char *slash1, char *ex1, bool has_dec_point1, - char *plus, char *slash2, char *ex2, bool has_dec_point2, + char *q, char *slash1, char *ex1, bool has_dec_point1, + char *plus, char *slash2, char *ex2, bool has_dec_point2, int radix, int has_plus_or_minus) { /* this can be just about anything involving 2 real/ratio/int portions, +/- in between and 'i' at the end */ @@ -18781,7 +18781,7 @@ static s7_pointer string_to_either_complex(s7_scheme *sc, p_rl = string_to_either_complex_1(sc, q, slash1, ex1, has_dec_point1, radix, &d_rl); p_im = string_to_either_complex_1(sc, plus, slash2, ex2, has_dec_point2, radix, &d_im); - + if ((!p_rl) && (!p_im)) return(s7_make_complex(sc, d_rl, (has_plus_or_minus == -1) ? (-d_im) : d_im)); @@ -18796,11 +18796,11 @@ static s7_pointer string_to_either_complex(s7_scheme *sc, mpfr_init_set(m_im, S7_BIG_REAL(promote_number(sc, T_BIG_REAL, p_im)), GMP_RNDN); else mpfr_init_set_d(m_im, d_im, GMP_RNDN); - if (has_plus_or_minus == -1) + if (has_plus_or_minus == -1) mpfr_neg(m_im, m_im, GMP_RNDN); result = make_big_complex(sc, m_rl, m_im); - + mpfr_clear(m_rl); mpfr_clear(m_im); return(result); @@ -18829,7 +18829,7 @@ static int canonicalize_result_type(int type) switch (type & 0x7) { case NUM_INT: - case NUM_RATIO: + case NUM_RATIO: return(T_BIG_RATIO); case NUM_REAL: @@ -18842,14 +18842,14 @@ static int canonicalize_result_type(int type) switch (type & 0x7) { - case NUM_INT: + case NUM_INT: return(T_BIG_INTEGER); /* NUM_INT is 0, so this includes the pure big ints case */ - case NUM_RATIO: + case NUM_RATIO: return(T_BIG_RATIO); case NUM_REAL: - case NUM_REAL2: + case NUM_REAL2: return(T_BIG_REAL); default: @@ -18865,7 +18865,7 @@ static s7_pointer promote_number_1(s7_scheme *sc, int type, s7_pointer x, bool c switch (type) { case T_BIG_INTEGER: - if (is_c_object(x)) + if (is_c_object(x)) { if (copy) return(mpz_to_big_integer(sc, S7_BIG_INTEGER(x))); @@ -18877,7 +18877,7 @@ static s7_pointer promote_number_1(s7_scheme *sc, int type, s7_pointer x, bool c case T_BIG_RATIO: if (is_c_object(x)) { - if (c_object_type(x) == big_ratio_tag) + if (c_object_type(x) == big_ratio_tag) { if (copy) return(mpq_to_big_ratio(sc, S7_BIG_RATIO(x))); @@ -18893,7 +18893,7 @@ static s7_pointer promote_number_1(s7_scheme *sc, int type, s7_pointer x, bool c case T_BIG_REAL: if (is_c_object(x)) { - if (c_object_type(x) == big_real_tag) + if (c_object_type(x) == big_real_tag) { if (copy) return(mpfr_to_big_real(sc, S7_BIG_REAL(x))); @@ -18908,7 +18908,7 @@ static s7_pointer promote_number_1(s7_scheme *sc, int type, s7_pointer x, bool c default: if (is_c_object(x)) { - if (c_object_type(x) == big_complex_tag) + if (c_object_type(x) == big_complex_tag) { if (copy) return(mpc_to_big_complex(sc, S7_BIG_COMPLEX(x))); @@ -18937,7 +18937,7 @@ static s7_pointer copy_and_promote_number(s7_scheme *sc, int type, s7_pointer x) } -void s7_vector_fill(s7_scheme *sc, s7_pointer vec, s7_pointer obj) +void s7_vector_fill(s7_scheme *sc, s7_pointer vec, s7_pointer obj) { s7_Int i, len; s7_pointer *tp; @@ -18952,7 +18952,7 @@ void s7_vector_fill(s7_scheme *sc, s7_pointer vec, s7_pointer obj) { int type; type = c_object_type(obj); - for (i = 0; i < len; i++) + for (i = 0; i < len; i++) { if (type == big_real_tag) tp[i] = mpfr_to_big_real(sc, S7_BIG_REAL(obj)); @@ -19018,7 +19018,7 @@ static s7_pointer big_add(s7_scheme *sc, s7_pointer args) if ((cdr(args) == sc->NIL) && (s7_is_number(car(args)))) return(car(args)); - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) { s7_pointer p; p = car(x); @@ -19037,7 +19037,7 @@ static s7_pointer big_add(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); result = copy_and_promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { s7_pointer arg; arg = promote_number(sc, result_type, car(x)); @@ -19046,21 +19046,21 @@ static s7_pointer big_add(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: mpz_add(S7_BIG_INTEGER(result), S7_BIG_INTEGER(result), S7_BIG_INTEGER(arg)); break; - + case T_BIG_RATIO: mpq_add(S7_BIG_RATIO(result), S7_BIG_RATIO(result), S7_BIG_RATIO(arg)); break; - + case T_BIG_REAL: mpfr_add(S7_BIG_REAL(result), S7_BIG_REAL(result), S7_BIG_REAL(arg), GMP_RNDN); break; - + case T_BIG_COMPLEX: mpc_add(S7_BIG_COMPLEX(result), S7_BIG_COMPLEX(result), S7_BIG_COMPLEX(arg), MPC_RNDNN); break; } } - + switch (result_type) { case T_BIG_RATIO: @@ -19128,11 +19128,11 @@ static s7_pointer big_subtract(s7_scheme *sc, s7_pointer args) if (!s7_is_number(car(args))) return(s7_wrong_type_arg_error(sc, "-", 1, car(args), "a number")); - - if (cdr(args) == sc->NIL) + + if (cdr(args) == sc->NIL) return(big_negate(sc, args)); - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) { s7_pointer p; p = car(x); @@ -19151,7 +19151,7 @@ static s7_pointer big_subtract(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); result = copy_and_promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { s7_pointer arg; arg = promote_number(sc, result_type, car(x)); @@ -19160,15 +19160,15 @@ static s7_pointer big_subtract(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: mpz_sub(S7_BIG_INTEGER(result), S7_BIG_INTEGER(result), S7_BIG_INTEGER(arg)); break; - + case T_BIG_RATIO: mpq_sub(S7_BIG_RATIO(result), S7_BIG_RATIO(result), S7_BIG_RATIO(arg)); break; - + case T_BIG_REAL: mpfr_sub(S7_BIG_REAL(result), S7_BIG_REAL(result), S7_BIG_REAL(arg), GMP_RNDN); break; - + case T_BIG_COMPLEX: mpc_sub(S7_BIG_COMPLEX(result), S7_BIG_COMPLEX(result), S7_BIG_COMPLEX(arg), MPC_RNDNN); break; @@ -19198,7 +19198,7 @@ static s7_pointer big_multiply(s7_scheme *sc, s7_pointer args) if ((cdr(args) == sc->NIL) && (s7_is_number(car(args)))) return(car(args)); - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) { s7_pointer p; p = car(x); @@ -19217,7 +19217,7 @@ static s7_pointer big_multiply(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); result = copy_and_promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { s7_pointer arg; arg = promote_number(sc, result_type, car(x)); @@ -19226,7 +19226,7 @@ static s7_pointer big_multiply(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: mpz_mul(S7_BIG_INTEGER(result), S7_BIG_INTEGER(result), S7_BIG_INTEGER(arg)); break; - + case T_BIG_RATIO: mpq_mul(S7_BIG_RATIO(result), S7_BIG_RATIO(result), S7_BIG_RATIO(arg)); break; @@ -19336,11 +19336,11 @@ static s7_pointer big_divide(s7_scheme *sc, s7_pointer args) if (!s7_is_number(car(args))) return(s7_wrong_type_arg_error(sc, "/", 1, car(args), "a number")); - - if (cdr(args) == sc->NIL) + + if (cdr(args) == sc->NIL) return(big_invert(sc, args)); - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) { s7_pointer p; p = car(x); @@ -19359,7 +19359,7 @@ static s7_pointer big_divide(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); divisor = copy_and_promote_number(sc, result_type, cadr(args)); - for (x = cddr(args); x != sc->NIL; x = cdr(x)) + for (x = cddr(args); x != sc->NIL; x = cdr(x)) { s7_pointer arg; arg = promote_number(sc, result_type, car(x)); @@ -19368,21 +19368,21 @@ static s7_pointer big_divide(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: mpz_mul(S7_BIG_INTEGER(divisor), S7_BIG_INTEGER(divisor), S7_BIG_INTEGER(arg)); break; - + case T_BIG_RATIO: mpq_mul(S7_BIG_RATIO(divisor), S7_BIG_RATIO(divisor), S7_BIG_RATIO(arg)); break; - + case T_BIG_REAL: mpfr_mul(S7_BIG_REAL(divisor), S7_BIG_REAL(divisor), S7_BIG_REAL(arg), GMP_RNDN); break; - + case T_BIG_COMPLEX: mpc_mul(S7_BIG_COMPLEX(divisor), S7_BIG_COMPLEX(divisor), S7_BIG_COMPLEX(arg), MPC_RNDNN); break; } } - + if (big_is_zero_1(sc, divisor) == sc->T) return(s7_division_by_zero_error(sc, "/", args)); @@ -19421,16 +19421,16 @@ then in init: signal(SIGFPE, s7_sigfpe); } return(s7_make_object(sc, big_ratio_tag, (void *)n)); } - + case T_BIG_RATIO: mpq_div(S7_BIG_RATIO(result), S7_BIG_RATIO(result), S7_BIG_RATIO(divisor)); return(make_big_integer_or_ratio(sc, result)); break; - + case T_BIG_REAL: mpfr_div(S7_BIG_REAL(result), S7_BIG_REAL(result), S7_BIG_REAL(divisor), GMP_RNDN); break; - + case T_BIG_COMPLEX: mpc_div(S7_BIG_COMPLEX(result), S7_BIG_COMPLEX(result), S7_BIG_COMPLEX(divisor), MPC_RNDNN); return(make_big_real_or_complex(sc, result)); @@ -19653,7 +19653,7 @@ static s7_pointer big_make_rectangular(s7_scheme *sc, s7_pointer args) p0 = car(args); p1 = cadr(args); if (((is_c_object(p0)) || (is_c_object(p1))) && /* if either is a bignum, and both are reals (not complex)... */ - (s7_is_real(p0)) && + (s7_is_real(p0)) && (s7_is_real(p1))) { mpc_t *n; @@ -19685,8 +19685,8 @@ static s7_pointer big_make_polar(s7_scheme *sc, s7_pointer args) s7_pointer p0, p1; p0 = car(args); p1 = cadr(args); - if (((is_c_object(p0)) || (is_c_object(p1))) && - (s7_is_real(p0)) && + if (((is_c_object(p0)) || (is_c_object(p1))) && + (s7_is_real(p0)) && (s7_is_real(p1))) { mpc_t *n; @@ -19756,7 +19756,7 @@ static s7_pointer big_log(s7_scheme *sc, s7_pointer args) { int p1_cmp = 0; p0 = promote_number(sc, T_BIG_REAL, p0); - if (p1) + if (p1) { if ((!is_c_object(p1)) && ((s7_is_zero(p1)) || (s7_is_one(p1)))) @@ -19930,7 +19930,7 @@ static s7_pointer big_sqrt(s7_scheme *sc, s7_pointer args) return(s7_make_object(sc, big_real_tag, (void *)n)); } } - + /* p is a big number, so it must be complex at this point */ { mpc_t *n; @@ -19947,7 +19947,7 @@ static s7_pointer big_sqrt(s7_scheme *sc, s7_pointer args) enum {TRIG_NO_CHECK, TRIG_TAN_CHECK, TRIG_TANH_CHECK}; -static s7_pointer big_trig(s7_scheme *sc, s7_pointer args, s7_function g_trig, +static s7_pointer big_trig(s7_scheme *sc, s7_pointer args, s7_function g_trig, int (*mpfr_trig)(mpfr_ptr, mpfr_srcptr, mpfr_rnd_t), int (*mpc_trig)(mpc_ptr, mpc_srcptr, mpc_rnd_t), int tan_case) @@ -19983,9 +19983,9 @@ static s7_pointer big_trig(s7_scheme *sc, s7_pointer args, s7_function g_trig, if (tan_case == TRIG_TAN_CHECK) { if ((MPC_INEX_IM(mpc_cmp_si_si(S7_BIG_COMPLEX(p), 1, 350))) > 0) - return(s7_make_complex(sc, 0.0, 1.0)); + return(s7_make_complex(sc, 0.0, 1.0)); if ((MPC_INEX_IM(mpc_cmp_si_si(S7_BIG_COMPLEX(p), 1, -350))) < 0) - return(s7_make_complex(sc, 0.0, -1.0)); + return(s7_make_complex(sc, 0.0, -1.0)); } if (tan_case == TRIG_TANH_CHECK) @@ -20078,7 +20078,7 @@ static s7_pointer big_expt(s7_scheme *sc, s7_pointer args) if (big_is_zero_1(sc, x) == sc->T) { - if ((s7_is_integer(x)) && + if ((s7_is_integer(x)) && (s7_is_integer(y)) && (big_is_zero_1(sc, y) == sc->T)) return(small_int(sc, 1)); @@ -20086,7 +20086,7 @@ static s7_pointer big_expt(s7_scheme *sc, s7_pointer args) if ((s7_is_real(y)) && (s7_is_negative(y))) return(s7_division_by_zero_error(sc, "expt", args)); - if ((s7_is_rational(x)) && + if ((s7_is_rational(x)) && (s7_is_rational(y))) return(small_int(sc, 0)); @@ -20176,7 +20176,7 @@ static s7_pointer big_expt(s7_scheme *sc, s7_pointer args) mpz_pow_ui(n, n, (unsigned int)yval); mpz_pow_ui(d, d, (unsigned int)yval); mpq_set_num(*r, d); - mpq_set_den(*r, n); + mpq_set_den(*r, n); mpq_canonicalize(*r); } mpz_clear(n); @@ -20241,10 +20241,10 @@ static s7_pointer big_expt(s7_scheme *sc, s7_pointer args) { mpc_t cy; mpc_t *z; - + x = promote_number(sc, T_BIG_COMPLEX, x); y = promote_number(sc, T_BIG_COMPLEX, y); - + z = (mpc_t *)malloc(sizeof(mpc_t)); mpc_init(*z); mpc_set(*z, S7_BIG_COMPLEX(x), MPC_RNDNN); @@ -20651,11 +20651,11 @@ static s7_pointer big_ash(s7_scheme *sc, s7_pointer args) s7_Int shift; if (((is_c_object(p0)) && - (mpz_cmp_ui(S7_BIG_INTEGER(p0), 0) == 0)) || + (mpz_cmp_ui(S7_BIG_INTEGER(p0), 0) == 0)) || ((!is_c_object(p0)) && (s7_integer(p0) == 0))) return(small_int(sc, 0)); - + if (is_c_object(p1)) { if (!mpz_fits_sint_p(S7_BIG_INTEGER(p1))) @@ -20682,7 +20682,7 @@ static s7_pointer big_ash(s7_scheme *sc, s7_pointer args) } -static s7_pointer big_bits(s7_scheme *sc, s7_pointer args, const char *name, int start, s7_function g_bits, +static s7_pointer big_bits(s7_scheme *sc, s7_pointer args, const char *name, int start, s7_function g_bits, void (*mpz_bits)(mpz_ptr, mpz_srcptr, mpz_srcptr)) { int i; @@ -20691,7 +20691,7 @@ static s7_pointer big_bits(s7_scheme *sc, s7_pointer args, const char *name, int for (i = 1, x = args; x != sc->NIL; x = cdr(x), i++) { if (!s7_is_integer(car(x))) - return(s7_wrong_type_arg_error(sc, name, i, car(x), "an integer")); + return(s7_wrong_type_arg_error(sc, name, i, car(x), "an integer")); if ((is_c_object(car(x))) && (c_object_type(car(x)) == big_integer_tag)) use_bigs = true; @@ -20705,7 +20705,7 @@ static s7_pointer big_bits(s7_scheme *sc, s7_pointer args, const char *name, int mpz_sub_ui(*n, *n, 1); for (x = args; x != sc->NIL; x = cdr(x)) mpz_bits(*n, *n, S7_BIG_INTEGER(promote_number(sc, T_BIG_INTEGER, car(x)))); - return(s7_make_object(sc, big_integer_tag, (void *)n)); + return(s7_make_object(sc, big_integer_tag, (void *)n)); } return(g_bits(sc, args)); } @@ -20738,7 +20738,7 @@ static s7_pointer big_rationalize(s7_scheme *sc, s7_pointer args) if (cdr(args) != sc->NIL) p1 = cadr(args); - if (((is_c_object(p0)) || + if (((is_c_object(p0)) || ((p1) && (is_c_object(p1)))) && /* one or other is big, perhaps */ (s7_is_real(p0)) && ((!p1) || (s7_is_real(p1)))) /* both are real (or error arg is omitted) */ @@ -20794,7 +20794,7 @@ static s7_pointer big_rationalize(s7_scheme *sc, s7_pointer args) { mpz_t *n; n = (mpz_t *)malloc(sizeof(mpz_t)); - + if (mpz_cmp_ui(i, 0) >= 0) /* if (i >= 0) */ mpz_init_set(*n, i); /* num = i */ else @@ -20808,7 +20808,7 @@ static s7_pointer big_rationalize(s7_scheme *sc, s7_pointer args) mpfr_clear(x0); mpfr_clear(x1); mpfr_clear(error); - return(s7_make_object(sc, big_integer_tag, (void *)n)); + return(s7_make_object(sc, big_integer_tag, (void *)n)); } { @@ -20873,7 +20873,7 @@ static s7_pointer big_rationalize(s7_scheme *sc, s7_pointer args) mpz_clear(q1); mpz_clear(old_p1); mpz_clear(old_q1); - + mpfr_clear(val); mpfr_clear(e0); mpfr_clear(e1); @@ -20883,16 +20883,16 @@ static s7_pointer big_rationalize(s7_scheme *sc, s7_pointer args) mpfr_clear(old_e1); mpfr_clear(old_e0p); - return(s7_make_object(sc, big_ratio_tag, (void *)q)); + return(s7_make_object(sc, big_ratio_tag, (void *)q)); } - + mpfr_div(val, e0, e1, GMP_RNDN); mpfr_get_z(r, val, GMP_RNDD); /* r = floor(e0/e1) */ mpfr_div(val, e0p, e1p, GMP_RNDN); mpfr_get_z(r1, val, GMP_RNDU); /* r1 = ceil(e0p/e1p) */ if (mpz_cmp(r1, r) < 0) /* if (r1 < r) */ mpz_set(r, r1); /* r = r1 */ - + mpz_set(old_p1, p1); /* old_p1 = p1 */ mpz_set(p1, p0); /* p1 = p0 */ mpz_set(old_q1, q1); /* old_q1 = q1 */ @@ -20905,16 +20905,16 @@ static s7_pointer big_rationalize(s7_scheme *sc, s7_pointer args) mpfr_set(old_e1, e1, GMP_RNDN); /* old_e1 = e1 */ mpz_mul(p0, p0, r); /* p0 = old_p1 + r * p0 */ - mpz_add(p0, p0, old_p1); - + mpz_add(p0, p0, old_p1); + mpz_mul(q0, q0, r); /* q0 = old_q1 + r * q0 */ - mpz_add(q0, q0, old_q1); - + mpz_add(q0, q0, old_q1); + mpfr_mul_z(e1, e1p, r, GMP_RNDN); /* e1 = old_e0p - r * e1p */ - mpfr_sub(e1, old_e0p, e1, GMP_RNDN); - + mpfr_sub(e1, old_e0p, e1, GMP_RNDN); + mpfr_mul_z(e1p, old_e1, r, GMP_RNDN); /* e1p = old_e0 - r * old_e1 */ - mpfr_sub(e1p, old_e0, e1p, GMP_RNDN); + mpfr_sub(e1p, old_e0, e1p, GMP_RNDN); } } } @@ -21106,7 +21106,7 @@ static s7_pointer big_quotient(s7_scheme *sc, s7_pointer args) if (big_is_zero_1(sc, divisor) == sc->T) return(s7_division_by_zero_error(sc, "quotient", args)); - + n = (mpz_t *)malloc(sizeof(mpz_t)); mpz_init_set(*n, S7_BIG_INTEGER(promote_number(sc, T_BIG_INTEGER, x))); mpz_tdiv_q(*n, *n, S7_BIG_INTEGER(divisor)); @@ -21135,7 +21135,7 @@ static s7_pointer big_remainder(s7_scheme *sc, s7_pointer args) if (big_is_zero_1(sc, divisor) == sc->T) return(s7_division_by_zero_error(sc, "remainder", args)); - + n = (mpz_t *)malloc(sizeof(mpz_t)); mpz_init_set(*n, S7_BIG_INTEGER(promote_number(sc, T_BIG_INTEGER, x))); mpz_tdiv_r(*n, *n, S7_BIG_INTEGER(divisor)); @@ -21179,13 +21179,13 @@ static s7_pointer big_modulo(s7_scheme *sc, s7_pointer args) return(s7_make_object(sc, big_integer_tag, (void *)n)); } - return(big_subtract(sc, - make_list_2(sc, a, - big_multiply(sc, - make_list_2(sc, b, - big_floor(sc, - s7_cons(sc, - big_divide(sc, + return(big_subtract(sc, + make_list_2(sc, a, + big_multiply(sc, + make_list_2(sc, b, + big_floor(sc, + s7_cons(sc, + big_divide(sc, make_list_2(sc, a, b)), sc->NIL))))))); } return(g_modulo(sc, args)); @@ -21197,7 +21197,7 @@ static int big_real_scan_args(s7_scheme *sc, s7_pointer args) int i, result_type = NUM_INT; s7_pointer arg; - for (i = 1, arg = args; arg != sc->NIL; i++, arg = cdr(arg)) + for (i = 1, arg = args; arg != sc->NIL; i++, arg = cdr(arg)) { s7_pointer p; p = car(arg); @@ -21215,7 +21215,7 @@ static s7_pointer big_max(s7_scheme *sc, s7_pointer args) { int result_type; s7_pointer x, result, arg; - + result_type = big_real_scan_args(sc, args); if (result_type < 0) return(s7_wrong_type_arg_error(sc, "max", -result_type, s7_list_ref(sc, args, -1 - result_type), "a real number")); @@ -21226,7 +21226,7 @@ static s7_pointer big_max(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); result = promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { arg = promote_number(sc, result_type, car(x)); switch (result_type) @@ -21235,7 +21235,7 @@ static s7_pointer big_max(s7_scheme *sc, s7_pointer args) if (mpz_cmp(S7_BIG_INTEGER(result), S7_BIG_INTEGER(arg)) < 0) result = arg; break; - + case T_BIG_RATIO: if (mpq_cmp(S7_BIG_RATIO(result), S7_BIG_RATIO(arg)) < 0) result = arg; @@ -21265,7 +21265,7 @@ static s7_pointer big_min(s7_scheme *sc, s7_pointer args) { int result_type; s7_pointer x, result, arg; - + result_type = big_real_scan_args(sc, args); if (result_type < 0) return(s7_wrong_type_arg_error(sc, "min", -result_type, s7_list_ref(sc, args, -1 - result_type), "a real number")); @@ -21276,7 +21276,7 @@ static s7_pointer big_min(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); result = promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { arg = promote_number(sc, result_type, car(x)); switch (result_type) @@ -21285,7 +21285,7 @@ static s7_pointer big_min(s7_scheme *sc, s7_pointer args) if (mpz_cmp(S7_BIG_INTEGER(result), S7_BIG_INTEGER(arg)) > 0) result = arg; break; - + case T_BIG_RATIO: if (mpq_cmp(S7_BIG_RATIO(result), S7_BIG_RATIO(arg)) > 0) result = arg; @@ -21315,7 +21315,7 @@ static s7_pointer big_less(s7_scheme *sc, s7_pointer args) { int result_type; s7_pointer x, previous, current; - + result_type = big_real_scan_args(sc, args); if (result_type < 0) return(s7_wrong_type_arg_error(sc, "<", -result_type, s7_list_ref(sc, args, -1 - result_type), "a real number")); @@ -21326,7 +21326,7 @@ static s7_pointer big_less(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); previous = promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { current = promote_number(sc, result_type, car(x)); switch (result_type) @@ -21334,7 +21334,7 @@ static s7_pointer big_less(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: if (mpz_cmp(S7_BIG_INTEGER(previous), S7_BIG_INTEGER(current)) >= 0) return(sc->F); break; - + case T_BIG_RATIO: if (mpq_cmp(S7_BIG_RATIO(previous), S7_BIG_RATIO(current)) >= 0) return(sc->F); break; @@ -21353,7 +21353,7 @@ static s7_pointer big_less_or_equal(s7_scheme *sc, s7_pointer args) { int result_type; s7_pointer x, previous, current; - + result_type = big_real_scan_args(sc, args); if (result_type < 0) return(s7_wrong_type_arg_error(sc, "<=", -result_type, s7_list_ref(sc, args, -1 - result_type), "a real number")); @@ -21364,7 +21364,7 @@ static s7_pointer big_less_or_equal(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); previous = promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { current = promote_number(sc, result_type, car(x)); switch (result_type) @@ -21372,7 +21372,7 @@ static s7_pointer big_less_or_equal(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: if (mpz_cmp(S7_BIG_INTEGER(previous), S7_BIG_INTEGER(current)) > 0) return(sc->F); break; - + case T_BIG_RATIO: if (mpq_cmp(S7_BIG_RATIO(previous), S7_BIG_RATIO(current)) > 0) return(sc->F); break; @@ -21402,7 +21402,7 @@ static s7_pointer big_greater(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); previous = promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { current = promote_number(sc, result_type, car(x)); switch (result_type) @@ -21410,7 +21410,7 @@ static s7_pointer big_greater(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: if (mpz_cmp(S7_BIG_INTEGER(previous), S7_BIG_INTEGER(current)) <= 0) return(sc->F); break; - + case T_BIG_RATIO: if (mpq_cmp(S7_BIG_RATIO(previous), S7_BIG_RATIO(current)) <= 0) return(sc->F); break; @@ -21429,7 +21429,7 @@ static s7_pointer big_greater_or_equal(s7_scheme *sc, s7_pointer args) { int result_type; s7_pointer x, previous, current; - + result_type = big_real_scan_args(sc, args); if (result_type < 0) return(s7_wrong_type_arg_error(sc, ">=", -result_type, s7_list_ref(sc, args, -1 - result_type), "a real number")); @@ -21440,7 +21440,7 @@ static s7_pointer big_greater_or_equal(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); previous = promote_number(sc, result_type, car(args)); - for (x = cdr(args); x != sc->NIL; x = cdr(x)) + for (x = cdr(args); x != sc->NIL; x = cdr(x)) { current = promote_number(sc, result_type, car(x)); switch (result_type) @@ -21448,7 +21448,7 @@ static s7_pointer big_greater_or_equal(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: if (mpz_cmp(S7_BIG_INTEGER(previous), S7_BIG_INTEGER(current)) < 0) return(sc->F); break; - + case T_BIG_RATIO: if (mpq_cmp(S7_BIG_RATIO(previous), S7_BIG_RATIO(current)) < 0) return(sc->F); break; @@ -21468,7 +21468,7 @@ static s7_pointer big_equal(s7_scheme *sc, s7_pointer args) int i, result_type = NUM_INT; s7_pointer x, y, result; - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) { s7_pointer p; p = car(x); @@ -21487,7 +21487,7 @@ static s7_pointer big_equal(s7_scheme *sc, s7_pointer args) result_type = canonicalize_result_type(result_type); result = promote_number(sc, result_type, car(args)); - for (y = cdr(args); y != sc->NIL; y = cdr(y)) + for (y = cdr(args); y != sc->NIL; y = cdr(y)) { s7_pointer arg; arg = promote_number(sc, result_type, car(y)); @@ -21496,15 +21496,15 @@ static s7_pointer big_equal(s7_scheme *sc, s7_pointer args) case T_BIG_INTEGER: if (mpz_cmp(S7_BIG_INTEGER(result), S7_BIG_INTEGER(arg)) != 0) return(sc->F); break; - + case T_BIG_RATIO: if (mpq_cmp(S7_BIG_RATIO(result), S7_BIG_RATIO(arg)) != 0) return(sc->F); break; - + case T_BIG_REAL: if (mpfr_cmp(S7_BIG_REAL(result), S7_BIG_REAL(arg)) != 0) return(sc->F); break; - + case T_BIG_COMPLEX: if (mpc_cmp(S7_BIG_COMPLEX(result), S7_BIG_COMPLEX(arg)) != 0) return(sc->F); break; @@ -21520,15 +21520,15 @@ static s7_pointer big_gcd(s7_scheme *sc, s7_pointer args) bool rats = false, bigs = false; s7_pointer x; - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_rational(car(x))) return(s7_wrong_type_arg_error(sc, "gcd", i, car(x), "an integer or ratio")); - else + else { rats = ((rats) || (!s7_is_integer(car(x)))); bigs = ((bigs) || (is_c_object(car(x)))); } - + if (!bigs) return(g_gcd(sc, args)); @@ -21537,7 +21537,7 @@ static s7_pointer big_gcd(s7_scheme *sc, s7_pointer args) mpz_t *n; n = (mpz_t *)malloc(sizeof(mpz_t)); mpz_init(*n); - for (x = args; x != sc->NIL; x = cdr(x)) + for (x = args; x != sc->NIL; x = cdr(x)) { mpz_gcd(*n, *n, S7_BIG_INTEGER(promote_number(sc, T_BIG_INTEGER, car(x)))); if (mpz_cmp_ui(*n, 1) == 0) @@ -21587,15 +21587,15 @@ static s7_pointer big_lcm(s7_scheme *sc, s7_pointer args) int i; bool rats = false, bigs = false; - for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) + for (i = 1, x = args; x != sc->NIL; i++, x = cdr(x)) if (!s7_is_rational(car(x))) return(s7_wrong_type_arg_error(sc, "lcm", i, car(x), "an integer or ratio")); - else + else { rats = ((rats) || (!s7_is_integer(car(x)))); bigs = ((bigs) || (is_c_object(car(x)))); } - + if (!bigs) return(g_lcm(sc, args)); @@ -21605,7 +21605,7 @@ static s7_pointer big_lcm(s7_scheme *sc, s7_pointer args) n = (mpz_t *)malloc(sizeof(mpz_t)); mpz_init(*n); mpz_set_ui(*n, 1); - for (x = args; x != sc->NIL; x = cdr(x)) + for (x = args; x != sc->NIL; x = cdr(x)) { mpz_lcm(*n, *n, S7_BIG_INTEGER(promote_number(sc, T_BIG_INTEGER, car(x)))); if (mpz_cmp_ui(*n, 0) == 0) @@ -21709,7 +21709,7 @@ static bool equal_big_rng(void *val1, void *val2) return(val1 == val2); } - + static s7_pointer make_big_random_state(s7_scheme *sc, s7_pointer args) { #define H_make_random_state "(make-random-state seed) returns a new random number state initialized with 'seed'" @@ -21737,7 +21737,7 @@ static s7_pointer big_random(s7_scheme *sc, s7_pointer args) s7_pointer num, state; state = sc->NIL; - num = car(args); + num = car(args); if (!s7_is_number(num)) return(s7_wrong_type_arg_error(sc, "random", 1, num, "a number")); @@ -21795,8 +21795,8 @@ static s7_pointer big_random(s7_scheme *sc, s7_pointer args) else { if (c_object_type(num) == big_ratio_tag) - num = s7_make_ratio(sc, - big_integer_to_s7_Int(mpq_numref(S7_BIG_RATIO(num))), + num = s7_make_ratio(sc, + big_integer_to_s7_Int(mpq_numref(S7_BIG_RATIO(num))), big_integer_to_s7_Int(mpq_denref(S7_BIG_RATIO(num)))); } } @@ -21829,7 +21829,7 @@ static s7_pointer big_random(s7_scheme *sc, s7_pointer args) } /* finally both the state and the number are big */ - + if (c_object_type(num) == big_integer_tag) { mpz_t *n; @@ -21844,7 +21844,7 @@ static s7_pointer big_random(s7_scheme *sc, s7_pointer args) #endif return(s7_make_object(sc, big_integer_tag, (void *)n)); } - + if (c_object_type(num) == big_ratio_tag) { mpfr_t *n; @@ -21863,7 +21863,7 @@ static s7_pointer big_random(s7_scheme *sc, s7_pointer args) mpfr_clear(rat); return(big_rationalize(sc, make_list_1(sc, s7_make_object(sc, big_real_tag, (void *)n)))); } - + if (c_object_type(num) == big_real_tag) { mpfr_t *n; @@ -21879,7 +21879,7 @@ static s7_pointer big_random(s7_scheme *sc, s7_pointer args) mpfr_mul(*n, *n, S7_BIG_REAL(num), GMP_RNDN); return(s7_make_object(sc, big_real_tag, (void *)n)); } - + if (c_object_type(num) == big_complex_tag) { mpc_t *n; @@ -21950,7 +21950,7 @@ static void s7_gmp_init(s7_scheme *sc) s7_define_function(sc, "logand", big_logand, 1, 0, true, H_logand); s7_define_function(sc, "ash", big_ash, 2, 0, false, H_ash); s7_define_function(sc, "integer-length", big_integer_length, 1, 0, false, H_integer_length); - + s7_define_function(sc, "even?", big_is_even, 1, 0, false, H_is_even); s7_define_function(sc, "odd?", big_is_odd, 1, 0, false, H_is_odd); s7_define_function(sc, "zero?", big_is_zero, 1, 0, false, H_is_zero); @@ -21984,7 +21984,7 @@ static void s7_gmp_init(s7_scheme *sc) s7_define_function_with_setter(sc, "bignum-precision", g_get_precision, g_set_precision, 0, 0, H_bignum_precision); add_max = (1 << (s7_int_bits - 1)); - mpfr_set_default_prec((mp_prec_t)128); + mpfr_set_default_prec((mp_prec_t)128); mpc_set_default_precision((mp_prec_t)128); s7_symbol_set_value(sc, s7_make_symbol(sc, "pi"), big_pi(sc)); @@ -21998,25 +21998,25 @@ static void s7_gmp_init(s7_scheme *sc) /* -------------------------------- initialization -------------------------------- */ -s7_scheme *s7_init(void) +s7_scheme *s7_init(void) { int i; s7_scheme *sc; - + init_ctables(); - + sc = (s7_scheme *)calloc(1, sizeof(s7_scheme)); /* malloc is not recommended here */ #if HAVE_PTHREADS sc->orig_sc = sc; #endif - + sc->gc_off = (bool *)calloc(1, sizeof(bool)); (*(sc->gc_off)) = true; /* sc->args and so on are not set yet, so a gc during init -> segfault */ sc->longjmp_ok = false; - + sc->strbuf_size = INITIAL_STRBUF_SIZE; sc->strbuf = (char *)calloc(sc->strbuf_size, sizeof(char)); - + sc->read_line_buf = NULL; sc->read_line_buf_size = 0; @@ -22024,30 +22024,30 @@ s7_scheme *s7_init(void) sc->T = &sc->_T; sc->F = &sc->_F; sc->EOF_OBJECT = &sc->_EOF_OBJECT; - sc->UNSPECIFIED = &sc->_UNSPECIFIED; + sc->UNSPECIFIED = &sc->_UNSPECIFIED; sc->UNDEFINED = &sc->_UNDEFINED; set_type(sc->NIL, T_NIL | T_ATOM | T_GC_MARK | T_IMMUTABLE | T_SIMPLE | T_DONT_COPY); car(sc->NIL) = cdr(sc->NIL) = sc->UNSPECIFIED; - + set_type(sc->T, T_BOOLEAN | T_ATOM | T_GC_MARK | T_IMMUTABLE | T_SIMPLE | T_DONT_COPY); car(sc->T) = cdr(sc->T) = sc->UNSPECIFIED; - + set_type(sc->F, T_BOOLEAN | T_ATOM | T_GC_MARK | T_IMMUTABLE | T_SIMPLE | T_DONT_COPY); car(sc->F) = cdr(sc->F) = sc->UNSPECIFIED; - + set_type(sc->EOF_OBJECT, T_UNTYPED | T_ATOM | T_GC_MARK | T_IMMUTABLE | T_SIMPLE | T_DONT_COPY); car(sc->EOF_OBJECT) = cdr(sc->EOF_OBJECT) = sc->UNSPECIFIED; - + set_type(sc->UNSPECIFIED, T_UNTYPED | T_ATOM | T_GC_MARK | T_IMMUTABLE | T_SIMPLE | T_DONT_COPY); car(sc->UNSPECIFIED) = cdr(sc->UNSPECIFIED) = sc->UNSPECIFIED; - + set_type(sc->UNDEFINED, T_UNTYPED | T_ATOM | T_GC_MARK | T_IMMUTABLE | T_SIMPLE | T_DONT_COPY); car(sc->UNDEFINED) = cdr(sc->UNDEFINED) = sc->UNSPECIFIED; - + sc->nil_vector = (s7_pointer *)malloc(BLOCK_VECTOR_SIZE * sizeof(s7_pointer)); sc->unspecified_vector = (s7_pointer *)malloc(BLOCK_VECTOR_SIZE * sizeof(s7_pointer)); - for (i = 0; i < BLOCK_VECTOR_SIZE; i++) + for (i = 0; i < BLOCK_VECTOR_SIZE; i++) { sc->nil_vector[i] = sc->NIL; sc->unspecified_vector[i] = sc->UNSPECIFIED; @@ -22057,7 +22057,7 @@ s7_scheme *s7_init(void) sc->input_port_stack = sc->NIL; sc->output_port = sc->NIL; sc->error_port = sc->NIL; - + sc->code = sc->NIL; sc->cur_code = ERROR_INFO_DEFAULT; sc->args = sc->NIL; @@ -22067,10 +22067,10 @@ s7_scheme *s7_init(void) sc->z = sc->NIL; sc->error_exiter = NULL; sc->default_rng = NULL; - + sc->heap_size = INITIAL_HEAP_SIZE; sc->heap = (s7_pointer *)malloc((sc->heap_size + 1) * sizeof(s7_pointer)); - + sc->free_heap = (s7_cell **)malloc(sc->heap_size * sizeof(s7_cell *)); sc->free_heap_top = INITIAL_HEAP_SIZE; { @@ -22083,7 +22083,7 @@ s7_scheme *s7_init(void) } sc->heap[sc->heap_size] = NULL; } - + /* this has to precede s7_make_* allocations */ sc->temps_size = GC_TEMPS_SIZE; sc->temps_ctr = 0; @@ -22092,7 +22092,7 @@ s7_scheme *s7_init(void) sc->temps[i] = sc->NIL; sc->circular_refs = (s7_pointer *)calloc(CIRCULAR_REFS_SIZE, sizeof(s7_pointer)); - + sc->protected_objects_size = (int *)malloc(sizeof(int)); (*(sc->protected_objects_size)) = INITIAL_PROTECTED_OBJECTS_SIZE; sc->protected_objects_loc = (int *)malloc(sizeof(int)); @@ -22100,12 +22100,12 @@ s7_scheme *s7_init(void) sc->protected_objects = s7_make_vector(sc, INITIAL_PROTECTED_OBJECTS_SIZE); /* realloc happens to the embedded array, so this pointer is global */ set_immutable(sc->protected_objects); typeflag(sc->protected_objects) |= T_DONT_COPY; - + sc->stack_top = 0; sc->stack = s7_make_vector(sc, INITIAL_STACK_SIZE); sc->stack_size = INITIAL_STACK_SIZE; sc->stack_size2 = sc->stack_size / 2; - + /* keep the symbol table out of the heap */ sc->symbol_table = (s7_pointer)calloc(1, sizeof(s7_cell)); set_type(sc->symbol_table, T_VECTOR | T_FINALIZABLE | T_DONT_COPY); @@ -22113,7 +22113,7 @@ s7_scheme *s7_init(void) vector_elements(sc->symbol_table) = (s7_pointer *)malloc(SYMBOL_TABLE_SIZE * sizeof(s7_pointer)); s7_vector_fill(sc, sc->symbol_table, sc->NIL); sc->symbol_table->hloc = NOT_IN_HEAP; - + sc->gensym_counter = (long *)calloc(1, sizeof(long)); sc->tracing = (bool *)calloc(1, sizeof(bool)); sc->trace_all = (bool *)calloc(1, sizeof(bool)); @@ -22132,13 +22132,13 @@ s7_scheme *s7_init(void) sc->thread_id = 0; sc->key_values = sc->NIL; #endif - + sc->global_env = s7_cons(sc, s7_make_vector(sc, SYMBOL_TABLE_SIZE), sc->NIL); sc->envir = sc->global_env; - + /* keep the small_ints out of the heap */ sc->small_ints = (s7_pointer *)malloc((NUM_SMALL_INTS + 1) * sizeof(s7_pointer)); - for (i = 0; i <= NUM_SMALL_INTS; i++) + for (i = 0; i <= NUM_SMALL_INTS; i++) { s7_pointer p; p = (s7_pointer)calloc(1, sizeof(s7_cell)); @@ -22148,7 +22148,7 @@ s7_scheme *s7_init(void) integer(number(p)) = (s7_Int)i; sc->small_ints[i] = p; } - + sc->real_zero = (s7_pointer)calloc(1, sizeof(s7_cell)); sc->real_zero->flag = T_OBJECT | T_IMMUTABLE | T_ATOM | T_NUMBER | T_SIMPLE | T_DONT_COPY; sc->real_zero->hloc = NOT_IN_HEAP; @@ -22182,96 +22182,96 @@ s7_scheme *s7_init(void) assign_syntax(sc, "defmacro", OP_DEFMACRO); /* CL-style macro syntax */ assign_syntax(sc, "defmacro*", OP_DEFMACRO_STAR); assign_syntax(sc, "define-macro", OP_DEFINE_MACRO); /* Scheme-style macro syntax */ - assign_syntax(sc, "define-macro*", OP_DEFINE_MACRO_STAR); + assign_syntax(sc, "define-macro*", OP_DEFINE_MACRO_STAR); assign_syntax(sc, "define-expansion", OP_DEFINE_EXPANSION); /* read-time (immediate) macro expansion */ assign_syntax(sc, "do", OP_DO); assign_syntax(sc, "with-environment", OP_WITH_ENV0); - + sc->LAMBDA = s7_make_symbol(sc, "lambda"); - typeflag(sc->LAMBDA) |= T_DONT_COPY; - + typeflag(sc->LAMBDA) |= T_DONT_COPY; + sc->LAMBDA_STAR = s7_make_symbol(sc, "lambda*"); - typeflag(sc->LAMBDA_STAR) |= T_DONT_COPY; - + typeflag(sc->LAMBDA_STAR) |= T_DONT_COPY; + sc->QUOTE = s7_make_symbol(sc, "quote"); - typeflag(sc->QUOTE) |= T_DONT_COPY; - + typeflag(sc->QUOTE) |= T_DONT_COPY; + sc->QUASIQUOTE = s7_make_symbol(sc, "quasiquote"); typeflag(sc->QUASIQUOTE) |= T_DONT_COPY; /* add the immutable bit later */ - + sc->UNQUOTE = s7_make_symbol(sc, "unquote"); - typeflag(sc->UNQUOTE) |= T_DONT_COPY; - + typeflag(sc->UNQUOTE) |= T_DONT_COPY; + sc->UNQUOTE_SPLICING = s7_make_symbol(sc, "unquote-splicing"); - typeflag(sc->UNQUOTE_SPLICING) |= T_DONT_COPY; - + typeflag(sc->UNQUOTE_SPLICING) |= T_DONT_COPY; + sc->MACROEXPAND = s7_make_symbol(sc, "macroexpand"); - typeflag(sc->MACROEXPAND) |= T_DONT_COPY; - + typeflag(sc->MACROEXPAND) |= T_DONT_COPY; + sc->FEED_TO = s7_make_symbol(sc, "=>"); - typeflag(sc->FEED_TO) |= T_DONT_COPY; - + typeflag(sc->FEED_TO) |= T_DONT_COPY; + #define object_set_name "(generalized set!)" sc->OBJECT_SET = s7_make_symbol(sc, object_set_name); /* will call g_object_set */ - typeflag(sc->OBJECT_SET) |= T_DONT_COPY; + typeflag(sc->OBJECT_SET) |= T_DONT_COPY; sc->APPLY = s7_make_symbol(sc, "apply"); - typeflag(sc->APPLY) |= T_DONT_COPY; - + typeflag(sc->APPLY) |= T_DONT_COPY; + sc->CONS = s7_make_symbol(sc, "cons"); - typeflag(sc->CONS) |= T_DONT_COPY; - + typeflag(sc->CONS) |= T_DONT_COPY; + sc->APPEND = s7_make_symbol(sc, "append"); - typeflag(sc->APPEND) |= T_DONT_COPY; - + typeflag(sc->APPEND) |= T_DONT_COPY; + sc->CDR = s7_make_symbol(sc, "cdr"); - typeflag(sc->CDR) |= T_DONT_COPY; - + typeflag(sc->CDR) |= T_DONT_COPY; + sc->ELSE = s7_make_symbol(sc, "else"); - typeflag(sc->ELSE) |= T_DONT_COPY; - add_to_current_environment(sc, sc->ELSE, sc->T); + typeflag(sc->ELSE) |= T_DONT_COPY; + add_to_current_environment(sc, sc->ELSE, sc->T); sc->VECTOR = s7_make_symbol(sc, "vector"); - typeflag(sc->VECTOR) |= T_DONT_COPY; - + typeflag(sc->VECTOR) |= T_DONT_COPY; + sc->VALUES = s7_make_symbol(sc, "values"); - typeflag(sc->VALUES) |= T_DONT_COPY; + typeflag(sc->VALUES) |= T_DONT_COPY; sc->ERROR = s7_make_symbol(sc, "error"); - typeflag(sc->ERROR) |= T_DONT_COPY; + typeflag(sc->ERROR) |= T_DONT_COPY; sc->WRONG_TYPE_ARG = s7_make_symbol(sc, "wrong-type-arg"); - typeflag(sc->WRONG_TYPE_ARG) |= T_DONT_COPY; + typeflag(sc->WRONG_TYPE_ARG) |= T_DONT_COPY; sc->WRONG_NUMBER_OF_ARGS = s7_make_symbol(sc, "wrong-number-of-args"); - typeflag(sc->WRONG_NUMBER_OF_ARGS) |= T_DONT_COPY; + typeflag(sc->WRONG_NUMBER_OF_ARGS) |= T_DONT_COPY; sc->FORMAT_ERROR = s7_make_symbol(sc, "format-error"); - typeflag(sc->FORMAT_ERROR) |= T_DONT_COPY; + typeflag(sc->FORMAT_ERROR) |= T_DONT_COPY; sc->OUT_OF_RANGE = s7_make_symbol(sc, "out-of-range"); - typeflag(sc->OUT_OF_RANGE) |= T_DONT_COPY; + typeflag(sc->OUT_OF_RANGE) |= T_DONT_COPY; sc->KEY_KEY = s7_make_keyword(sc, "key"); - typeflag(sc->KEY_KEY) |= T_DONT_COPY; - + typeflag(sc->KEY_KEY) |= T_DONT_COPY; + sc->KEY_OPTIONAL = s7_make_keyword(sc, "optional"); - typeflag(sc->KEY_OPTIONAL) |= T_DONT_COPY; - + typeflag(sc->KEY_OPTIONAL) |= T_DONT_COPY; + sc->KEY_REST = s7_make_keyword(sc, "rest"); - typeflag(sc->KEY_REST) |= T_DONT_COPY; + typeflag(sc->KEY_REST) |= T_DONT_COPY; sc->__FUNC__ = s7_make_symbol(sc, "__func__"); - typeflag(sc->__FUNC__) |= T_DONT_COPY; + typeflag(sc->__FUNC__) |= T_DONT_COPY; sc->ERROR_HOOK = s7_make_symbol(sc, "*error-hook*"); - typeflag(sc->ERROR_HOOK) |= T_DONT_COPY; + typeflag(sc->ERROR_HOOK) |= T_DONT_COPY; sc->TRACE_HOOK = s7_make_symbol(sc, "*trace-hook*"); - typeflag(sc->TRACE_HOOK) |= T_DONT_COPY; + typeflag(sc->TRACE_HOOK) |= T_DONT_COPY; sc->SET = s7_make_symbol(sc, "set!"); - typeflag(sc->SET) |= T_DONT_COPY; + typeflag(sc->SET) |= T_DONT_COPY; (*(sc->gc_off)) = false; @@ -22281,7 +22281,7 @@ s7_scheme *s7_init(void) s7_define_function(sc, "procedure-with-setter?", g_is_procedure_with_setter, 1, 0, false, H_is_procedure_with_setter); s7_define_function(sc, "procedure-with-setter-setter-arity", g_procedure_with_setter_setter_arity, 1, 0, false, "kludge to get setter's arity"); pws_tag = s7_new_type("", pws_print, pws_free, pws_equal, pws_mark, pws_apply, pws_set); - + s7_define_function(sc, "gensym", g_gensym, 0, 1, false, H_gensym); s7_define_function(sc, "symbol-table", g_symbol_table, 0, 0, false, H_symbol_table); @@ -22292,7 +22292,7 @@ s7_scheme *s7_init(void) #if WITH_PROFILING s7_define_function(sc, "symbol-calls", g_symbol_calls, 1, 0, false, H_symbol_calls); #endif - + s7_define_function(sc, "global-environment", g_global_environment, 0, 0, false, H_global_environment); s7_define_function(sc, "current-environment", g_current_environment, 0, CURRENT_ENVIRONMENT_OPTARGS, false, H_current_environment); s7_define_function(sc, "provided?", g_is_provided, 1, 0, false, H_is_provided); @@ -22300,28 +22300,28 @@ s7_scheme *s7_init(void) s7_define_function(sc, "defined?", g_is_defined, 1, 1, false, H_is_defined); s7_define_function(sc, "constant?", g_is_constant, 1, 0, false, H_is_constant); - + s7_define_function(sc, "keyword?", g_is_keyword, 1, 0, false, H_is_keyword); s7_define_function(sc, "make-keyword", g_make_keyword, 1, 0, false, H_make_keyword); s7_define_function(sc, "symbol->keyword", g_symbol_to_keyword, 1, 0, false, H_symbol_to_keyword); s7_define_function(sc, "keyword->symbol", g_keyword_to_symbol, 1, 0, false, H_keyword_to_symbol); - + s7_define_function(sc, "hash-table?", g_is_hash_table, 1, 0, false, H_is_hash_table); s7_define_function(sc, "make-hash-table", g_make_hash_table, 0, 1, false, H_make_hash_table); s7_define_function(sc, "hash-table-ref", g_hash_table_ref, 2, 0, false, H_hash_table_ref); s7_define_set_function(sc, "hash-table-set!", g_hash_table_set, 3, 0, false, H_hash_table_set); s7_define_function(sc, "hash-table-size", g_hash_table_size, 1, 0, false, H_hash_table_size); - s7_define_function(sc, "hash-table-for-each", g_hash_table_for_each, 2, 0, true, H_hash_table_for_each); - + s7_define_function(sc, "hash-table-for-each", g_hash_table_for_each, 2, 0, true, H_hash_table_for_each); + s7_define_function(sc, "port-line-number", g_port_line_number, 1, 0, false, H_port_line_number); s7_define_function(sc, "port-filename", g_port_filename, 1, 0, false, H_port_filename); - + s7_define_function(sc, "input-port?", g_is_input_port, 1, 0, false, H_is_input_port); s7_define_function(sc, "output-port?", g_is_output_port, 1, 0, false, H_is_output_port); s7_define_function(sc, "char-ready?", g_is_char_ready, 0, 1, false, H_is_char_ready); s7_define_function(sc, "eof-object?", g_is_eof_object, 1, 0, false, H_is_eof_object); - + s7_define_function(sc, "current-input-port", g_current_input_port, 0, 0, false, H_current_input_port); s7_define_function(sc, "set-current-input-port", g_set_current_input_port, 1, 0, false, H_set_current_input_port); s7_define_function(sc, "current-output-port", g_current_output_port, 0, 0, false, H_current_output_port); @@ -22335,7 +22335,7 @@ s7_scheme *s7_init(void) s7_define_function(sc, "open-input-string", g_open_input_string, 1, 0, false, H_open_input_string); s7_define_function(sc, "open-output-string", g_open_output_string, 0, 0, false, H_open_output_string); s7_define_function(sc, "get-output-string", g_get_output_string, 1, 0, false, H_get_output_string); - + s7_define_function(sc, "read-char", g_read_char, 0, 1, false, H_read_char); s7_define_function(sc, "peek-char", g_peek_char, 0, 1, false, H_peek_char); s7_define_function(sc, "read", g_read, 0, 1, false, H_read); @@ -22346,18 +22346,18 @@ s7_scheme *s7_init(void) s7_define_function(sc, "read-byte", g_read_byte, 0, 1, false, H_read_byte); s7_define_function(sc, "write-byte", g_write_byte, 1, 1, false, H_write_byte); s7_define_function(sc, "read-line", g_read_line, 0, 2, false, H_read_line); - + s7_define_function(sc, "call-with-input-string", g_call_with_input_string, 2, 0, false, H_call_with_input_string); s7_define_function(sc, "call-with-input-file", g_call_with_input_file, 2, 0, false, H_call_with_input_file); s7_define_function(sc, "with-input-from-string", g_with_input_from_string, 2, 0, false, H_with_input_from_string); s7_define_function(sc, "with-input-from-file", g_with_input_from_file, 2, 0, false, H_with_input_from_file); - + s7_define_function(sc, "call-with-output-string", g_call_with_output_string, 1, 0, false, H_call_with_output_string); s7_define_function(sc, "call-with-output-file", g_call_with_output_file, 2, 0, false, H_call_with_output_file); s7_define_function(sc, "with-output-to-string", g_with_output_to_string, 1, 0, false, H_with_output_to_string); s7_define_function(sc, "with-output-to-file", g_with_output_to_file, 2, 0, false, H_with_output_to_file); - - + + s7_define_function(sc, "number->string", g_number_to_string, 1, 2, false, H_number_to_string); s7_define_function(sc, "string->number", g_string_to_number, 1, 2, false, H_string_to_number); s7_define_function(sc, "make-polar", g_make_polar, 2, 0, false, H_make_polar); @@ -22427,24 +22427,24 @@ s7_scheme *s7_init(void) s7_define_function(sc, "logand", g_logand, 1, 0, true, H_logand); s7_define_function(sc, "lognot", g_lognot, 1, 0, false, H_lognot); s7_define_function(sc, "ash", g_ash, 2, 0, false, H_ash); - + rng_tag = s7_new_type_x("", print_rng, free_rng, equal_rng, NULL, NULL, NULL, NULL, copy_random_state, NULL); s7_define_function(sc, "random", g_random, 1, 1, false, H_random); s7_define_function(sc, "make-random-state", g_make_random_state, 1, 0, false, H_make_random_state); - + s7_define_function(sc, "char-upcase", g_char_upcase, 1, 0, false, H_char_upcase); s7_define_function(sc, "char-downcase", g_char_downcase, 1, 0, false, H_char_downcase); s7_define_function(sc, "char->integer", g_char_to_integer, 1, 0, false, H_char_to_integer); s7_define_function(sc, "integer->char", g_integer_to_char, 1, 0, false, H_integer_to_char); - + s7_define_function(sc, "char-upper-case?", g_is_char_upper_case, 1, 0, false, H_is_char_upper_case); s7_define_function(sc, "char-lower-case?", g_is_char_lower_case, 1, 0, false, H_is_char_lower_case); s7_define_function(sc, "char-alphabetic?", g_is_char_alphabetic, 1, 0, false, H_is_char_alphabetic); s7_define_function(sc, "char-numeric?", g_is_char_numeric, 1, 0, false, H_is_char_numeric); s7_define_function(sc, "char-whitespace?", g_is_char_whitespace, 1, 0, false, H_is_char_whitespace); s7_define_function(sc, "char?", g_is_char, 1, 0, false, H_is_char); - + s7_define_function(sc, "char=?", g_chars_are_equal, 2, 0, true, H_chars_are_equal); s7_define_function(sc, "char?", g_chars_are_greater, 2, 0, true, H_chars_are_greater); @@ -22455,14 +22455,14 @@ s7_scheme *s7_init(void) s7_define_function(sc, "char-ci>?", g_chars_are_ci_greater, 2, 0, true, H_chars_are_ci_greater); s7_define_function(sc, "char-ci<=?", g_chars_are_ci_leq, 2, 0, true, H_chars_are_ci_leq); s7_define_function(sc, "char-ci>=?", g_chars_are_ci_geq, 2, 0, true, H_chars_are_ci_geq); - - + + s7_define_function(sc, "string?", g_is_string, 1, 0, false, H_is_string); s7_define_function(sc, "make-string", g_make_string, 1, 1, false, H_make_string); s7_define_function(sc, "string-length", g_string_length, 1, 0, false, H_string_length); s7_define_function(sc, "string-ref", g_string_ref, 2, 0, false, H_string_ref); s7_define_set_function(sc, "string-set!", g_string_set, 3, 0, false, H_string_set); - + s7_define_function(sc, "string=?", g_strings_are_equal, 2, 0, true, H_strings_are_equal); s7_define_function(sc, "string?", g_strings_are_greater, 2, 0, true, H_strings_are_greater); @@ -22473,7 +22473,7 @@ s7_scheme *s7_init(void) s7_define_function(sc, "string-ci>?", g_strings_are_ci_greater, 2, 0, true, H_strings_are_ci_greater); s7_define_function(sc, "string-ci<=?", g_strings_are_ci_leq, 2, 0, true, H_strings_are_ci_leq); s7_define_function(sc, "string-ci>=?", g_strings_are_ci_geq, 2, 0, true, H_strings_are_ci_geq); - + s7_define_function(sc, "string-append", g_string_append, 0, 0, true, H_string_append); s7_define_set_function(sc, "string-fill!", g_string_fill, 2, 0, false, H_string_fill); s7_define_function(sc, "string-copy", g_string_copy, 1, 0, false, H_string_copy); @@ -22483,7 +22483,7 @@ s7_scheme *s7_init(void) s7_define_function(sc, "string->list", g_string_to_list, 1, 0, false, H_string_to_list); s7_define_function(sc, "object->string", g_object_to_string, 1, 0, false, H_object_to_string); s7_define_function(sc, "format", g_format, 1, 0, true, H_format); - s7_define_function(sc, "string-for-each", g_string_for_each, 2, 0, true, H_string_for_each); + s7_define_function(sc, "string-for-each", g_string_for_each, 2, 0, true, H_string_for_each); s7_define_function(sc, "null?", g_is_null, 1, 0, false, H_is_null); @@ -22540,8 +22540,8 @@ s7_scheme *s7_init(void) s7_define_function(sc, "length", g_length, 1, 0, false, H_length); s7_define_function(sc, "copy", g_copy, 1, 0, false, H_copy); s7_define_set_function(sc, "fill!", g_fill, 2, 0, false, H_fill); - - + + s7_define_function(sc, "vector?", g_is_vector, 1, 0, false, H_is_vector); s7_define_function(sc, "vector->list", g_vector_to_list, 1, 0, false, H_vector_to_list); s7_define_function(sc, "list->vector", g_list_to_vector, 1, 0, false, H_list_to_vector); @@ -22557,7 +22557,7 @@ s7_scheme *s7_init(void) s7_define_function(sc, "vector-for-each", g_vector_for_each, 2, 0, true, H_vector_for_each); s7_define_function(sc, "vector-map", g_vector_map, 2, 0, true, H_vector_map); s7_define_set_function(sc, "sort!", g_sort_in_place, 2, 0, false, H_sort_in_place); - + s7_define_function(sc, "call/cc", g_call_cc, 1, 0, false, H_call_cc); s7_define_function(sc, "call-with-current-continuation", g_call_cc, 1, 0, false, H_call_cc); @@ -22575,7 +22575,7 @@ s7_scheme *s7_init(void) s7_define_function(sc, "dynamic-wind", g_dynamic_wind, 3, 0, false, H_dynamic_wind); s7_define_function(sc, "catch", g_catch, 3, 0, false, H_catch); s7_define_function(sc, "error", g_error, 0, 0, true, H_error); - + s7_define_function(sc, "trace", g_trace, 0, 0, true, H_trace); s7_define_function(sc, "untrace", g_untrace, 0, 0, true, H_untrace); s7_define_variable(sc, "*trace-hook*", sc->NIL); @@ -22592,18 +22592,18 @@ s7_scheme *s7_init(void) s7_define_function(sc, "procedure-arity", g_procedure_arity, 1, 0, false, H_procedure_arity); s7_define_function(sc, "procedure-source", g_procedure_source, 1, 0, false, H_procedure_source); s7_define_function(sc, "procedure-environment", g_procedure_environment, 1, 0, false, H_procedure_environment); - - + + s7_define_function(sc, "not", g_not, 1, 0, false, H_not); s7_define_function(sc, "boolean?", g_is_boolean, 1, 0, false, H_is_boolean); s7_define_function(sc, "eq?", g_is_eq, 2, 0, false, H_is_eq); s7_define_function(sc, "eqv?", g_is_eqv, 2, 0, false, H_is_eqv); s7_define_function(sc, "equal?", g_is_equal, 2, 0, false, H_is_equal); - + s7_define_function(sc, "s7-version", g_s7_version, 0, 0, false, H_s7_version); s7_define_set_function(sc, object_set_name, g_object_set, 1, 0, true, "internal setter redirection"); s7_define_function(sc, "_quasiquote_", g_quasiquote, 2, 0, false, "internal quasiquote handler"); - + s7_define_variable(sc, "*features*", sc->NIL); s7_define_variable(sc, "*load-path*", sc->NIL); s7_define_variable(sc, "*vector-print-length*", sc->small_ints[8]); @@ -22612,7 +22612,7 @@ s7_scheme *s7_init(void) s7_define_variable(sc, "*error-hook*", sc->NIL); sc->error_info = s7_make_and_fill_vector(sc, ERROR_INFO_SIZE, ERROR_INFO_DEFAULT); s7_define_constant(sc, "*error-info*", sc->error_info); - + g_provide(sc, make_list_1(sc, s7_make_symbol(sc, "s7"))); #if HAVE_PTHREADS @@ -22650,16 +22650,16 @@ s7_scheme *s7_init(void) sc->VECTOR_FUNCTION = s7_name_to_value(sc, "vector"); sc->VECTOR_SET = s7_symbol_value(sc, s7_make_symbol(sc, "vector-set!")); - typeflag(sc->VECTOR_SET) |= T_DONT_COPY; + typeflag(sc->VECTOR_SET) |= T_DONT_COPY; sc->LIST_SET = s7_symbol_value(sc, s7_make_symbol(sc, "list-set!")); - typeflag(sc->LIST_SET) |= T_DONT_COPY; + typeflag(sc->LIST_SET) |= T_DONT_COPY; sc->HASH_TABLE_SET = s7_symbol_value(sc, s7_make_symbol(sc, "hash-table-set!")); - typeflag(sc->HASH_TABLE_SET) |= T_DONT_COPY; + typeflag(sc->HASH_TABLE_SET) |= T_DONT_COPY; sc->STRING_SET = s7_symbol_value(sc, s7_make_symbol(sc, "string-set!")); - typeflag(sc->STRING_SET) |= T_DONT_COPY; + typeflag(sc->STRING_SET) |= T_DONT_COPY; { int top; @@ -22691,7 +22691,7 @@ s7_scheme *s7_init(void) /* multiple values */ /* call-with-values is almost a no-op in this context */ - s7_eval_c_string(sc, "(define-macro (call-with-values producer consumer) `(,consumer (,producer)))"); + s7_eval_c_string(sc, "(define-macro (call-with-values producer consumer) `(,consumer (,producer)))"); /* (call-with-values (lambda () (values 1 2 3)) +) */ s7_eval_c_string(sc, "(define-macro (multiple-value-bind vars expression . body) `((lambda ,vars ,@body) ,expression))"); @@ -22760,7 +22760,7 @@ s7_scheme *s7_init(void) (set! result x) \n\ result)))))))"); #endif - + return(sc); } @@ -22794,7 +22794,7 @@ s7_scheme *s7_init(void) (floor (string->number x)) (if (char? x) (char->integer x) - (error 'wrong-type-arg "can't convert ~A to integer" x))))) + (error 'wrong-type-arg "can't convert ~A to integer" x))))) (define (->ratio x) (if (number? x) @@ -22824,7 +22824,7 @@ s7_scheme *s7_init(void) (if (and (string? x) (= (length x) 1)) (string-ref x 0) - (error 'wrong-type-arg "can't convert ~A to character" x))))) + (error 'wrong-type-arg "can't convert ~A to character" x))))) (define (->list x) (if (list? x) @@ -22835,7 +22835,7 @@ s7_scheme *s7_init(void) (vector->list x) (if (string? x) (string->list x) - (error 'wrong-type-arg "can't convert ~A to list" x)))))) + (error 'wrong-type-arg "can't convert ~A to list" x)))))) (define (->vector x) (if (vector? x) diff --git a/Libraries/s7/sdk/s7.h b/Libraries/s7/sdk/s7.h index 2e8b299..b346c2e 100644 --- a/Libraries/s7/sdk/s7.h +++ b/Libraries/s7/sdk/s7.h @@ -15,7 +15,7 @@ typedef double s7_Double; /* -------------------------------------------------------------------------------- * s7 itself is based on the types and functions in this file, so the first place to look for examples * is s7.c. There are also a few variations on a REPL at the end of s7.html. s7test.scm - * is a regression test for s7 -- it still turns up a few problems. More tests are certainly welcome! + * is a regression test for s7 -- it still turns up a few problems. More tests are certainly welcome! * Extended examples of s7 usage are: * * Snd: ftp://ccrma-ftp.stanford.edu/pub/Lisp/snd-11.tar.gz (a sound editor) @@ -30,13 +30,13 @@ typedef double s7_Double; * s7 (scheme) variables: * * *features* a list of symbols describing what is current available (initially '(s7)). - * "provide" adds a symbol to the list, + * "provide" adds a symbol to the list, * "provided?" returns #t if its symbol arg is in the list. * *vector-print-length* how many elements of a vector are printed (initially 8) * __func__ equivalent to C's __func__. The symbol of the function currently being defined. * *load-path* a list of directory names that "load" searches for scheme input files (initially '()) * *load-hook* called before a file is loaded, a function of one arg, the name of the file. - * *error-hook* called upon error, a function of two args, + * *error-hook* called upon error, a function of two args, * the error type (a symbol), and the info about it (a list). * *error-info* data describing last error (see below). * *trace-hook* called upon trace (a function of two args) @@ -62,7 +62,7 @@ typedef double s7_Double; * procedure-source returns the source (a list) of a procedure * help tries to find a help string associated with its argument * symbol-calls if profiling is enabled, returns the number of times its argument (a symbol) has been called - * trace and untrace add or subtract functions from the trace list; (trace abs). + * trace and untrace add or subtract functions from the trace list; (trace abs). * stacktrace show a stack trace, the stack at the point of an error: (stacktrace *error-info*), * or the stack at a break point: (stacktrace break-continuation) * @@ -73,16 +73,16 @@ typedef double s7_Double; * The functions length, copy, and fill! are generic. * * s7 non-standard object: - * + * * encapsulator a data "continuation" -- save the current environment for later restoration. * open-encapsulator this returns an encapsulation that when called as a thunk restores the current environment * close-encapsulator this closes (retires, puts an end to) an encapsulation * encapsulator-bindings these are the currently saved bindings awaiting restoration * encapsulator? #t if its argument is an encapsulator - * + * * -------------------------------------------------------------------------------- * - * I think s7 has built-in support for srfi-6 (basic string ports), srfi-8 (receive), srfi-17 (generalized-set!), + * I think s7 has built-in support for srfi-6 (basic string ports), srfi-8 (receive), srfi-17 (generalized-set!), * srfi-18 (multithreading), srfi-28 (format, also nearly all of srfi-48), srfi-30 (block comments), * srfi-88 (keywords(, and srfi-89 (define*). It also supports the functionality of many others * but under a slightly different syntax: srfi-69 (hash-tables), srfi-16 (define*), srfi-25 (multidimensional @@ -135,7 +135,7 @@ s7_pointer s7_eof_object(s7_scheme *sc); /* # * bool s7_is_valid_pointer(s7_pointer arg); /* these are the scheme constants; they do not change in value during a run, and - * are the same across all threads, so they can be safely assigned to C global variables if desired. + * are the same across all threads, so they can be safely assigned to C global variables if desired. */ bool s7_is_c_pointer(s7_pointer arg); @@ -169,7 +169,7 @@ s7_pointer s7_stacktrace(s7_scheme *sc, s7_pointer arg); /* these are equivalent to (error ...) in scheme * the first argument to s7_error is a symbol that can be caught (via (catch tag ...)) - * the rest of the arguments are passed to the error handler (if in catch) + * the rest of the arguments are passed to the error handler (if in catch) * or printed out (in the default case). If the first element of the list * of args ("info") is a string, the default error handler treats it as * a format control string, and passes it to format with the rest of the @@ -197,7 +197,7 @@ s7_pointer s7_stacktrace(s7_scheme *sc, s7_pointer arg); * 4: if not #f, the file name of that code * 5: the environment at the point of the error * 6..top: stack enviroment pointers (giving enough info to reconstruct the current call stack), ending in #f - * + * * to find a variable's value at the point of the error: * (symbol->value var (vector-ref *error-info* 5)) * @@ -218,17 +218,17 @@ void s7_remove_from_heap(s7_scheme *sc, s7_pointer x); * object in a vector that the GC always checks, returning the object's location * in that table. s7_gc_unprotect and s7_gc_unprotect_at unprotect the object * (remove it from the vector). s7_gc_unprotect_at uses the location passed - * to it, whereas s7_gc_unprotect scans the vector to find the object. + * to it, whereas s7_gc_unprotect scans the vector to find the object. * s7_gc_protected_at returns the object at the given location. - * + * * You can turn the GC on and off via s7_gc_on. * * There is a built-in lag between the creation of a new object and its first possible GC * (the lag time is set indirectly by GC_TEMPS_SIZE in s7.c), so you don't need to worry about * very short term temps such as the arguments to s7_cons in: * - * s7_cons(s7, s7_make_real(s7, 3.14), - * s7_cons(s7, s7_make_integer(s7, 123), + * s7_cons(s7, s7_make_real(s7, 3.14), + * s7_cons(s7, s7_make_integer(s7, 123), * s7_nil(s7))); */ @@ -330,7 +330,7 @@ int s7_vector_rank(s7_pointer vect); s7_Int *s7_vector_dimensions(s7_pointer vec); /* dimensions */ s7_Int *s7_vector_offsets(s7_pointer vec); /* precalculated offsets to speed-up addressing */ - /* if s7 is built with multidimensional and applicable vectors, + /* if s7 is built with multidimensional and applicable vectors, * * (vect i) is the same as (vector-ref vect i) * (set! (vect i) x) is the same as (vector-set! vect i x) @@ -339,7 +339,7 @@ s7_Int *s7_vector_offsets(s7_pointer vec); * (make-vector (list 2 3 4)) returns a 3-dimensional vector with the given dimension sizes * (make-vector '(2 3) 1.0) returns a 2-dim vector with all elements set to 1.0 */ - + /* since vectors and lists are set-applicable, and length is generic, we can write a * generic FFT that accepts both types or any other object that follows this syntax. @@ -353,7 +353,7 @@ s7_Int *s7_vector_offsets(s7_pointer vec); (set! (data j) (data i)) (set! (data i) temp))) (let ((m (/ n 2))) - (do () + (do () ((or (< m 2) (< j m))) (set! j (- j m)) (set! m (/ m 2))) @@ -379,19 +379,19 @@ s7_Int *s7_vector_offsets(s7_pointer vec); (set! wc (* wc wpc))) (set! prev mmax)))) data) - + > (cfft! (list 0.0 1+i 0.0 0.0)) (1+1i -1+1i -1-1i 1-1i) > (cfft! (vector 0.0 1+i 0.0 0.0)) #(1+1i -1+1i -1-1i 1-1i) */ - + bool s7_is_hash_table(s7_pointer p); /* (hash-table? p) */ s7_pointer s7_make_hash_table(s7_scheme *sc, s7_Int size); /* (make-hash-table size) */ -s7_pointer s7_hash_table_ref(s7_scheme *sc, s7_pointer table, const char *name); +s7_pointer s7_hash_table_ref(s7_scheme *sc, s7_pointer table, const char *name); /* (hash-table-ref table name) */ -s7_pointer s7_hash_table_set(s7_scheme *sc, s7_pointer table, const char *name, s7_pointer value); +s7_pointer s7_hash_table_set(s7_scheme *sc, s7_pointer table, const char *name, s7_pointer value); /* (hash-table-set! table name value) */ /* a hash-table is a vector of alists '((symbol value)), so to iterate over a hash-table * use hash-table-for-each which calls its function with each of these alists. An entry defaults to nil. @@ -415,19 +415,19 @@ s7_pointer s7_current_error_port(s7_scheme *sc); /* ( s7_pointer s7_set_current_error_port(s7_scheme *sc, s7_pointer port); /* (set-current-error-port port) */ void s7_close_input_port(s7_scheme *sc, s7_pointer p); /* (close-input-port p) */ void s7_close_output_port(s7_scheme *sc, s7_pointer p); /* (close-output-port p) */ -s7_pointer s7_open_input_file(s7_scheme *sc, const char *name, const char *mode); +s7_pointer s7_open_input_file(s7_scheme *sc, const char *name, const char *mode); /* (open-input-file name mode) */ -s7_pointer s7_open_output_file(s7_scheme *sc, const char *name, const char *mode); +s7_pointer s7_open_output_file(s7_scheme *sc, const char *name, const char *mode); /* (open-output-file name mode) */ /* mode here is an optional C style flag, "a" for "alter", etc ("r" is the input default, "w" is the output default) */ -s7_pointer s7_open_input_string(s7_scheme *sc, const char *input_string); +s7_pointer s7_open_input_string(s7_scheme *sc, const char *input_string); /* (open-input-string str) */ s7_pointer s7_open_output_string(s7_scheme *sc); /* (open-output-string) */ const char *s7_get_output_string(s7_scheme *sc, s7_pointer out_port); /* (get-output-string port) -- current contents of output string */ /* don't free the string */ typedef enum {S7_READ, S7_READ_CHAR, S7_READ_LINE, S7_READ_BYTE, S7_PEEK_CHAR, S7_IS_CHAR_READY} s7_read_t; -s7_pointer s7_open_output_function(s7_scheme *sc, void (*function)(s7_scheme *sc, char c, s7_pointer port)); +s7_pointer s7_open_output_function(s7_scheme *sc, void (*function)(s7_scheme *sc, char c, s7_pointer port)); s7_pointer s7_open_input_function(s7_scheme *sc, s7_pointer (*function)(s7_scheme *sc, s7_read_t read_choice, s7_pointer port)); void *s7_port_data(s7_pointer port); void *s7_port_set_data(s7_pointer port, void *stuff); @@ -497,8 +497,8 @@ s7_pointer s7_current_environment(s7_scheme *sc); /* ( (for-each (lambda (binding) (if (substring? name (symbol->string (car binding))) - (format (current-output-port) "~A: ~A~%" - (car binding) + (format (current-output-port) "~A: ~A~%" + (car binding) (if (procedure? (cdr binding)) (procedure-documentation (cdr binding)) (cdr binding))))) @@ -522,25 +522,25 @@ s7_pointer s7_current_environment(s7_scheme *sc); /* ( (set-cdr! e (list (car e))) (set-car! e (list binding))) (set-car! e (cons binding (car e))))) - + (define (pop-environment e) (if (not (vector? (car e))) (begin (set-car! e (cadr e)) (set-cdr! e (cddr e))))) - - (define-macro (define! e var val) + + (define-macro (define! e var val) `(push-environment ,e (cons ',var ,val))) (define (make-environment . initial-bindings) (cons initial-bindings (global-environment))) - * (let ((x 3)) + * (let ((x 3)) * (define! (current-environment) hi 21) * (+ x hi)) * -> 24 * - * (let ((x 32)) + * (let ((x 32)) * (eval `(+ x y) (make-environment '(x . 2) '(y . 4)))) * -> 6 */ @@ -551,7 +551,7 @@ s7_pointer s7_symbol_set_value(s7_scheme *sc, s7_pointer sym, s7_pointer val); s7_pointer s7_symbol_local_value(s7_scheme *sc, s7_pointer sym, s7_pointer local_env); void s7_for_each_symbol_name(s7_scheme *sc, bool (*symbol_func)(const char *symbol_name, void *data), void *data); void s7_for_each_symbol(s7_scheme *sc, bool (*symbol_func)(const char *symbol_name, s7_pointer value, void *data), void *data); - + /* these access the current environment and symbol table, providing * a symbol's current binding (s7_name_to_value takes the symbol name as a char*, * s7_symbol_value takes the symbol itself, s7_symbol_set_value changes the @@ -569,10 +569,10 @@ void s7_for_each_symbol(s7_scheme *sc, bool (*symbol_func)(const char *symbol_na * for any function that doesn't have documentation: * (let ((st (symbol-table))) - (do ((i 0 (+ i 1))) + (do ((i 0 (+ i 1))) ((= i (vector-length st))) (let ((lst (vector-ref st i))) - (for-each + (for-each (lambda (sym) (if (defined? sym) (let ((val (symbol->value sym))) @@ -602,7 +602,7 @@ bool s7_is_constant(s7_pointer p); * s7_define is equivalent to define! in scheme (see below). */ -bool s7_is_function(s7_pointer p); +bool s7_is_function(s7_pointer p); s7_pointer s7_make_function(s7_scheme *sc, const char *name, s7_function fnc, int required_args, int optional_args, bool rest_arg, const char *doc); void s7_define_function(s7_scheme *sc, const char *name, s7_function fnc, int required_args, int optional_args, bool rest_arg, const char *doc); @@ -625,7 +625,7 @@ void s7_define_macro(s7_scheme *sc, const char *name, s7_function fnc, int requi * global (top-level) environment, with the function as its value. For example, the scheme * function 'car' is essentially: * - * s7_pointer g_car(s7_scheme *sc, s7_pointer args) + * s7_pointer g_car(s7_scheme *sc, s7_pointer args) * {return(s7_car(sc, s7_car(sc, args)));} * * then bound to the name "car": @@ -649,7 +649,7 @@ void s7_define_macro(s7_scheme *sc, const char *name, s7_function fnc, int requi /* In s7, (define* (name . args) body) or (define name (lambda* args body)) * define a function that takes optional (keyword) named arguments. * The keywords :key and :optional are ok, but they are ignored -- - * they exist to be compatible with other define* implementations. + * they exist to be compatible with other define* implementations. * The "args" is a list that can contain either names (normal arguments), * or lists of the form (name default-value), in any order. When called, * the names are bound to their default values (or #f), then the function's @@ -657,7 +657,7 @@ void s7_define_macro(s7_scheme *sc, const char *name, s7_function fnc, int requi * precedes that argument's new value. Otherwise, as values occur, they * are plugged into the environment based on their position in the arglist * (as normal for a function). So, - * + * * (define* (hi a (b 32) (c "hi")) (list a b c)) * * is equivalent to other implementations (define* (hi a :key (b 32) ...)) @@ -671,7 +671,7 @@ void s7_define_macro(s7_scheme *sc, const char *name, s7_function fnc, int requi * and so on. :rest causes its argument to be bound to the rest * of the arguments at that point. * - * The C connection to this takes the function name, the C function to call, the argument + * The C connection to this takes the function name, the C function to call, the argument * list as written in Scheme, and the documentation string. s7 makes sure the arguments * are ordered correctly and have the specified defaults before calling the C function. * s7_define_function_star(sc, "a-func", a_func, "arg1 (arg2 32)", "an example of C define*"); @@ -683,19 +683,19 @@ void s7_define_macro(s7_scheme *sc, const char *name, s7_function fnc, int requi */ s7_pointer s7_call(s7_scheme *sc, s7_pointer func, s7_pointer args); - + /* s7_call takes a scheme function (e.g. g_car above), and applies it to 'args' (a list of arguments) * returning the result. - * + * * s7_integer(s7_call(s7, g_car, s7_cons(s7, s7_make_integer(sc, 123), s7_nil(s7)))); - * + * * returns 123. */ bool s7_is_procedure_with_setter(s7_pointer obj); -s7_pointer s7_make_procedure_with_setter(s7_scheme *sc, +s7_pointer s7_make_procedure_with_setter(s7_scheme *sc, const char *name, - s7_pointer (*getter)(s7_scheme *sc, s7_pointer args), + s7_pointer (*getter)(s7_scheme *sc, s7_pointer args), int get_req_args, int get_opt_args, s7_pointer (*setter)(s7_scheme *sc, s7_pointer args), int set_req_args, int set_opt_args, @@ -711,24 +711,24 @@ s7_pointer s7_procedure_with_setter_getter(s7_pointer obj); * In the example in s7.html we have dax-x as the procedure-with-setter, * (dac-x obj) returns the x field of obj * (set! (dac-x obj) value) sets that field to value - * + * * In the set! case, the new value is the last of the args passed to the setter. * s7_make_procedure_with_setter is equivalent to s7_make_function, so to bind it * to some name, you need to call s7_define_variable. */ -int s7_new_type(const char *name, - char *(*print)(s7_scheme *sc, void *value), - void (*free)(void *value), +int s7_new_type(const char *name, + char *(*print)(s7_scheme *sc, void *value), + void (*free)(void *value), bool (*equal)(void *val1, void *val2), void (*gc_mark)(void *val), s7_pointer (*apply)(s7_scheme *sc, s7_pointer obj, s7_pointer args), s7_pointer (*set)(s7_scheme *sc, s7_pointer obj, s7_pointer args)); -int s7_new_type_x(const char *name, - char *(*print)(s7_scheme *sc, void *value), - void (*free)(void *value), +int s7_new_type_x(const char *name, + char *(*print)(s7_scheme *sc, void *value), + void (*free)(void *value), bool (*equal)(void *val1, void *val2), void (*gc_mark)(void *val), s7_pointer (*apply)(s7_scheme *sc, s7_pointer obj, s7_pointer args), @@ -742,7 +742,7 @@ int s7_object_type(s7_pointer obj); void *s7_object_value(s7_pointer obj); s7_pointer s7_make_object(s7_scheme *sc, int type, void *value); void s7_mark_object(s7_pointer p); - + /* These functions create a new scheme object type. There is a simple example in s7.html. * * s7_new_type describes the type for scheme: @@ -793,7 +793,7 @@ void s7_mark_object(s7_pointer p); * * (lock? obj) returns #t if 'obj' is a lock (a mutex in pthread jargon) * (make-lock) creates a new lock and initializes it (pthread_mutex_init) - * (grab-lock lock) pthread_mutex_lock + * (grab-lock lock) pthread_mutex_lock * (release-lock lock) pthread_mutex_unlock * * (thread-variable? obj) returns #t if 'obj' is a key @@ -841,7 +841,7 @@ void s7_mark_object(s7_pointer p); /* -------------------------------------------------------------------------------- - * + * * s7 changes * * 16-Dec: hash-table-for-each. @@ -857,15 +857,15 @@ void s7_mark_object(s7_pointer p); * 14-Sep: s7_values, s7_make_continuation, and a better interrupt example. * vector-for-each, vector-map, string-for-each. * 7-Sep: s7_open_input_function. with-environment. receive. - * 3-Sep: s7.html, s7-slib-init.scm. + * 3-Sep: s7.html, s7-slib-init.scm. * s7_stacktrace in s7.h. * 27-Aug: vector and hash-table sizes are now s7_Ints, rather than ints. * 20-Aug: s7_remove_from_heap. * 17-Aug: *error-info*. * 14-Aug: define-expansion. - * 7-Aug: s7_define_function_with_setter. + * 7-Aug: s7_define_function_with_setter. * s7_quit and example of signal handling. - * 6-Aug: encapsulation. s7_define_set_function. s7_new_type_x. + * 6-Aug: encapsulation. s7_define_set_function. s7_new_type_x. * generic function: copy, and length is generic. * 1-Aug: lower-case versions of s7_T and friends. * s7_define_macro. macroexpand. @@ -899,7 +899,7 @@ void s7_mark_object(s7_pointer p); * 7-Nov: removed s7_is_immutable and friends, s7_reverse_in_place. * removed the s7_pointer arg to s7_gc_on. * added s7_UNSPECIFIED - * 25-Oct: added name arg to s7_make_procedure_with_setter, + * 25-Oct: added name arg to s7_make_procedure_with_setter, * and s7_scheme arg to new_type print func. * 1-Oct-08 version 1.0 */ diff --git a/Libraries/s7/sdk/s7.html b/Libraries/s7/sdk/s7.html index cec46e9..c7b59d0 100644 --- a/Libraries/s7/sdk/s7.html +++ b/Libraries/s7/sdk/s7.html @@ -4,7 +4,7 @@ s7