diff options
Diffstat (limited to 'indra/lscript')
45 files changed, 4680 insertions, 2643 deletions
diff --git a/indra/lscript/CMakeLists.txt b/indra/lscript/CMakeLists.txt new file mode 100644 index 0000000000..937e2ec0dc --- /dev/null +++ b/indra/lscript/CMakeLists.txt @@ -0,0 +1,21 @@ +# -*- cmake -*- + +set(lscript_HEADER_FILES + llscriptresource.h + llscriptresourceconsumer.h + llscriptresourcepool.h + lscript_alloc.h + lscript_byteconvert.h + lscript_byteformat.h + lscript_execute.h + lscript_export.h + lscript_http.h + lscript_library.h + lscript_rt_interface.h + ) + +add_subdirectory(lscript_compile) +add_subdirectory(lscript_execute) + +add_subdirectory(lscript_library) + diff --git a/indra/lscript/llscriptresource.h b/indra/lscript/llscriptresource.h new file mode 100644 index 0000000000..9dab9ff7ce --- /dev/null +++ b/indra/lscript/llscriptresource.h @@ -0,0 +1,69 @@ +/** + * @file llscriptresource.h + * @brief LLScriptResource class definition + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLSCRIPTRESOURCE_H +#define LL_LLSCRIPTRESOURCE_H + +#include "stdtypes.h" + +// An LLScriptResource is a limited resource per ID. +class LLScriptResource +{ +public: + LLScriptResource(); + + // If amount resources are available will mark amount resouces + // used and returns true + // Otherwise returns false and doesn't mark any resources used. + bool request(S32 amount = 1); + + // Release amount resources from use if at least amount resources are used and return true + // If amount is more than currently used no resources are released and return false + bool release(S32 amount = 1); + + // Returns how many resources are available + S32 getAvailable() const; + + // Sets the total amount of available resources + // It is possible to set the amount to less than currently used + // Most likely to happen on parcel ownership change + void setTotal(S32 amount); + + // Get the total amount of available resources + S32 getTotal() const; + + // Get the number of resources used + S32 getUsed() const; + + // true if more resources used than total available + bool isOverLimit() const; + +private: + S32 mTotal; // How many resources have been set aside + S32 mUsed; // How many resources are currently in use +}; + +#endif // LL_LLSCRIPTRESOURCE_H diff --git a/indra/lscript/llscriptresourceconsumer.h b/indra/lscript/llscriptresourceconsumer.h new file mode 100644 index 0000000000..82a490d28f --- /dev/null +++ b/indra/lscript/llscriptresourceconsumer.h @@ -0,0 +1,61 @@ +/** + * @file llscriptresourceconsumer.h + * @brief An interface for a script resource consumer. + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLSCRIPTRESOURCECONSUMER_H +#define LL_LLSCRIPTRESOURCECONSUMER_H + +#include "linden_common.h" + +class LLScriptResourcePool; + +// Entities that use limited script resources +// should implement this interface + +class LLScriptResourceConsumer +{ +public: + LLScriptResourceConsumer(); + + virtual ~LLScriptResourceConsumer() { } + + // Get the number of public urls used by this consumer. + virtual S32 getUsedPublicURLs() const = 0; + + // Get the resource pool this consumer is currently using. + LLScriptResourcePool& getScriptResourcePool(); + const LLScriptResourcePool& getScriptResourcePool() const; + + bool switchScriptResourcePools(LLScriptResourcePool& new_pool); + bool canUseScriptResourcePool(const LLScriptResourcePool& resource_pool); + bool isInPool(const LLScriptResourcePool& resource_pool); + +protected: + virtual void setScriptResourcePool(LLScriptResourcePool& pool); + + LLScriptResourcePool* mScriptResourcePool; +}; + +#endif // LL_LLSCRIPTRESOURCECONSUMER_H diff --git a/indra/lscript/llscriptresourcepool.h b/indra/lscript/llscriptresourcepool.h new file mode 100644 index 0000000000..4ea2556e0f --- /dev/null +++ b/indra/lscript/llscriptresourcepool.h @@ -0,0 +1,51 @@ +/** + * @file llscriptresourcepool.h + * @brief A collection of LLScriptResources + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#ifndef LL_LLSCRIPTRESOURCEPOOL_H +#define LL_LLSCRIPTRESOURCEPOOL_H + +#include "llscriptresource.h" + +// This is just a holder for LLSimResources +class LLScriptResourcePool +{ +public: + LLScriptResourcePool(); + // ~LLSimResourceMgr(); + + LLScriptResource& getPublicURLResource(); + const LLScriptResource& getPublicURLResource() const; + + // An empty resource pool. + static LLScriptResourcePool null; + +private: + LLScriptResource mLSLPublicURLs; +}; + + + +#endif diff --git a/indra/lscript/lscript_alloc.h b/indra/lscript/lscript_alloc.h index d90cc141f8..f8a4e298d2 100644 --- a/indra/lscript/lscript_alloc.h +++ b/indra/lscript/lscript_alloc.h @@ -2,30 +2,25 @@ * @file lscript_alloc.h * @brief General heap management for scripting system * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -118,7 +113,7 @@ inline void bytestream2alloc_entry(LLScriptAllocEntry &entry, U8 *buffer, S32 &o // create a heap from the HR to TM BOOL lsa_create_heap(U8 *heap_start, S32 size); -void lsa_fprint_heap(U8 *buffer, FILE *fp); +void lsa_fprint_heap(U8 *buffer, LLFILE *fp); void lsa_print_heap(U8 *buffer); diff --git a/indra/lscript/lscript_byteconvert.h b/indra/lscript/lscript_byteconvert.h index e8b727b737..5b08481d7d 100644 --- a/indra/lscript/lscript_byteconvert.h +++ b/indra/lscript/lscript_byteconvert.h @@ -2,30 +2,25 @@ * @file lscript_byteconvert.h * @brief Shared code for compiler and assembler for LSL * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -250,7 +245,7 @@ inline void bytestream2vector(LLVector3 &vector, const U8 *stream, S32 &offset) } } -inline void vector2bytestream(U8 *stream, S32 &offset, LLVector3 &vector) +inline void vector2bytestream(U8 *stream, S32 &offset, const LLVector3 &vector) { S32 value = *(S32 *)&vector.mV[VZ]; integer2bytestream(stream, offset, value); @@ -292,7 +287,7 @@ inline void bytestream2quaternion(LLQuaternion &quat, const U8 *stream, S32 &off } } -inline void quaternion2bytestream(U8 *stream, S32 &offset, LLQuaternion &quat) +inline void quaternion2bytestream(U8 *stream, S32 &offset, const LLQuaternion &quat) { S32 value = *(S32 *)&quat.mQ[VS]; integer2bytestream(stream, offset, value); @@ -415,7 +410,7 @@ inline void set_fault(const U8 *stream, LSCRIPTRunTimeFaults fault) reset_hp_to_safe_spot(stream); // lsa_print_heap((U8 *)stream); } - fr = LSCRIPTRunTimeFaultBits[fault]; + fr = fault; set_register((U8 *)stream, LREG_FR, fr); } } @@ -528,7 +523,7 @@ inline void lscript_push(U8 *stream, F32 value) } } -inline void lscript_push(U8 *stream, LLVector3 &value) +inline void lscript_push(U8 *stream, const LLVector3 &value) { S32 sp = get_register(stream, LREG_SP); sp -= LSCRIPTDataSize[LST_VECTOR]; @@ -539,7 +534,7 @@ inline void lscript_push(U8 *stream, LLVector3 &value) } } -inline void lscript_push(U8 *stream, LLQuaternion &value) +inline void lscript_push(U8 *stream, const LLQuaternion &value) { S32 sp = get_register(stream, LREG_SP); sp -= LSCRIPTDataSize[LST_QUATERNION]; @@ -679,13 +674,13 @@ inline void lscript_local_store(U8 *stream, S32 address, F32 value) float2bytestream(stream, address, value); } -inline void lscript_local_store(U8 *stream, S32 address, LLVector3 value) +inline void lscript_local_store(U8 *stream, S32 address, const LLVector3 value) { if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_VECTOR])) vector2bytestream(stream, address, value); } -inline void lscript_local_store(U8 *stream, S32 address, LLQuaternion value) +inline void lscript_local_store(U8 *stream, S32 address, const LLQuaternion value) { if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_QUATERNION])) quaternion2bytestream(stream, address, value); @@ -703,13 +698,13 @@ inline void lscript_global_store(U8 *stream, S32 address, F32 value) float2bytestream(stream, address, value); } -inline void lscript_global_store(U8 *stream, S32 address, LLVector3 value) +inline void lscript_global_store(U8 *stream, S32 address, const LLVector3 value) { if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_VECTOR])) vector2bytestream(stream, address, value); } -inline void lscript_global_store(U8 *stream, S32 address, LLQuaternion value) +inline void lscript_global_store(U8 *stream, S32 address, const LLQuaternion value) { if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_QUATERNION])) quaternion2bytestream(stream, address, value); @@ -1110,7 +1105,7 @@ inline void safe_heap_bytestream_count_char(U8 *stream, S32 &offset) ; } -inline void safe_instruction_char2bytestream(U8 *stream, S32 &offset, char *buffer) +inline void safe_instruction_char2bytestream(U8 *stream, S32 &offset, const char* buffer) { while ( (safe_instruction_check_address(stream, offset, 1)) &&(*(stream + offset++) = *buffer++)) @@ -1125,7 +1120,7 @@ inline void safe_instruction_bytestream2vector(LLVector3 &value, U8 *stream, S32 } } -inline void safe_instruction_vector2bytestream(U8 *stream, S32 &offset, LLVector3 &value) +inline void safe_instruction_vector2bytestream(U8 *stream, S32 &offset, const LLVector3 &value) { if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_VECTOR])) { @@ -1141,7 +1136,7 @@ inline void safe_instruction_bytestream2quaternion(LLQuaternion &value, U8 *stre } } -inline void safe_instruction_quaternion2bytestream(U8 *stream, S32 &offset, LLQuaternion &value) +inline void safe_instruction_quaternion2bytestream(U8 *stream, S32 &offset, const LLQuaternion &value) { if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_QUATERNION])) { diff --git a/indra/lscript/lscript_byteformat.h b/indra/lscript/lscript_byteformat.h index 4e8f13f68a..7dd21bb1ad 100644 --- a/indra/lscript/lscript_byteformat.h +++ b/indra/lscript/lscript_byteformat.h @@ -2,30 +2,25 @@ * @file lscript_byteformat.h * @brief Shared code between compiler and assembler and LSL * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -359,6 +354,7 @@ typedef enum e_lscript_state_event_type LSTT_OBJECT_REZ, LSTT_REMOTE_DATA, LSTT_HTTP_RESPONSE, + LSTT_HTTP_REQUEST, LSTT_EOF, LSTT_STATE_BEGIN = LSTT_STATE_ENTRY, @@ -400,7 +396,8 @@ const U64 LSCRIPTStateBitField[LSTT_EOF] = 0x0000000020000000, // LSTT_MOVING_END 0x0000000040000000, // LSTT_OBJECT_REZ 0x0000000080000000, // LSTT_REMOTE_DATA - 0x0000000100000000LL // LSTT_HTTP_RESPOSE + 0x0000000100000000LL, // LSTT_HTTP_RESPOSE + 0x0000000200000000LL // LSTT_HTTP_REQUEST }; inline S32 get_event_handler_jump_position(U64 bit_field, LSCRIPTStateEventType type) @@ -470,6 +467,7 @@ const U8 LSCRIPTTypeHi4Bits[LST_EOF] = LST_VECTOR << 4, LST_QUATERNION << 4, LST_LIST << 4, + LST_UNDEFINED << 4, }; const char * const LSCRIPTTypeNames[LST_EOF] = /*Flawfinder: ignore*/ @@ -512,25 +510,11 @@ typedef enum e_lscript_runtime_faults LSRF_CHAT_OVERRUN, LSRF_TOO_MANY_LISTENS, LSRF_NESTING_LISTS, + LSRF_CLI, LSRF_EOF } LSCRIPTRunTimeFaults; -extern char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ - -const S32 LSCRIPTRunTimeFaultBits[LSRF_EOF] = -{ - 0, // LSRF_INVALID - 1, // LSRF_MATH - 2, // LSRF_STACK_HEAP_COLLISION - 3, // LSREF_BOUND_CHECK_ERROR - 4, // LSREF_HEAP_ERROR - 5, // LSREF_VERSION_MISMATCH - 6, // LSREF_MISSING_INVENTORY - 7, // LSRF_SANDBOX - 8, // LSRF_CHAT_OVERRUN - 9, // LSRF_TOO_MANY_LISTENS - 10, // LSRF_NESTING_LISTS -}; +extern const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ typedef enum e_lscript_runtime_permissions { @@ -563,5 +547,10 @@ const U32 LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_EOF] = (0x1 << 11),// SCRIPT_PERMISSION_CONTROL_CAMERA }; +// http_request string constants +extern const char* URL_REQUEST_GRANTED; +extern const char* URL_REQUEST_DENIED; +extern const U64 LSL_HTTP_REQUEST_TIMEOUT_USEC; + #endif diff --git a/indra/lscript/lscript_compile/CMakeLists.txt b/indra/lscript/lscript_compile/CMakeLists.txt new file mode 100644 index 0000000000..3ed2892e0e --- /dev/null +++ b/indra/lscript/lscript_compile/CMakeLists.txt @@ -0,0 +1,150 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LLMessage) +include(LLInventory) +include(LLPrimitive) +include(LScript) + +include(FindCygwin) + +find_program(FLEX flex + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(FLEX) + +find_program(BISON bison + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(BISON) + +find_program(M4 m4 + "C:/Program Files/GnuWin32/bin" + ${CYGWIN_INSTALL_PATH}/bin + /bin + /usr/bin + /usr/local/bin + ) +mark_as_advanced(M4) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LLMESSAGE_INCLUDE_DIRS} + ${LLINVENTORY_INCLUDE_DIRS} + ${LLPRIMITIVE_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +set(lscript_generated_SOURCE_FILES + indra.l.cpp + indra.y.cpp + ) + +set(lscript_compile_SOURCE_FILES + lscript_alloc.cpp + lscript_bytecode.cpp + lscript_error.cpp + lscript_heap.cpp + lscript_resource.cpp + lscript_scope.cpp + lscript_tree.cpp + lscript_typecheck.cpp + ) + +set(lscript_compile_HEADER_FILES + CMakeLists.txt + + indra.l + indra.y + + ../lscript_alloc.h + ../lscript_byteformat.h + ../lscript_byteconvert.h + ../lscript_http.h + + lscript_error.h + lscript_bytecode.h + lscript_heap.h + lscript_resource.h + lscript_scope.h + lscript_tree.h + lscript_typecheck.h + ) + +set_source_files_properties(${lscript_compile_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +set_source_files_properties(${lscript_generated_SOURCE_FILES} + PROPERTIES HEADER_FILE_ONLY FALSE GENERATED TRUE) + +list(APPEND lscript_compile_SOURCE_FILES ${lscript_generated_SOURCE_FILES} ${lscript_compile_HEADER_FILES}) + +add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp + COMMAND ${FLEX} + ARGS + -o${CMAKE_CURRENT_BINARY_DIR}/indra.l.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.l + DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/indra.l + ) + +if (WINDOWS) + set_source_files_properties(indra.l.cpp + PROPERTIES COMPILE_FLAGS /DYY_NO_UNISTD_H) +endif (WINDOWS) + +if (WINDOWS) + get_filename_component(M4_PATH ${M4} PATH) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat + ${BISON} ${M4_PATH} + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/bison.bat + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + ) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}/windows) +else (WINDOWS) + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND + ${BISON} + ARGS + -d -o ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + DEPENDS + ${CMAKE_CURRENT_SOURCE_DIR}/indra.y + ) +endif (WINDOWS) + +if (DARWIN) + # Mac OS X 10.4 compatibility + add_custom_command( + OUTPUT + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + COMMAND + mv + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.cpp.h + ${CMAKE_CURRENT_BINARY_DIR}/indra.y.hpp + ) +endif (DARWIN) + +add_library (lscript_compile ${lscript_compile_SOURCE_FILES}) diff --git a/indra/lscript/lscript_compile/bison.bat b/indra/lscript/lscript_compile/bison.bat new file mode 100644 index 0000000000..54cf0231d9 --- /dev/null +++ b/indra/lscript/lscript_compile/bison.bat @@ -0,0 +1,11 @@ +@REM Run bison under Windows. This script is needed so that bison can +@REM find m4, even if neither program is present in PATH. + +@set bison=%1 +set M4PATH=%2 +set M4= +@set output=%3 +@set input=%4 + +set PATH=%M4PATH%;%PATH% +%bison% -d -o %output% %input% diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 8bb26abf4c..8fe9f5ed29 100644 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -12,17 +12,14 @@ FS (f|F) #include "linden_common.h" // Deal with the fact that lex/yacc generates unreachable code #ifdef LL_WINDOWS +#pragma warning (disable : 4018) // warning C4018: signed/unsigned mismatch #pragma warning (disable : 4702) // warning C4702: unreachable code #endif // LL_WINDOWS #include "llmath.h" #include "lscript_tree.h" #include "lscript_typecheck.h" #include "lscript_resource.h" -#if LL_WINDOWS -#include "ytab.h" -#else -#include "indra.y.h" -#endif +#include "indra.y.hpp" #include "lltimer.h" #include "indra_constants.h" #include "llagentconstants.h" @@ -37,14 +34,19 @@ FS (f|F) #include "llregionflags.h" #include "lscript_http.h" #include "llclickaction.h" +#include "llmediaentry.h" void count(); -void comment(); +void line_comment(); +void block_comment(); void parse_string(); #define YYLMAX 16384 #define YY_NEVER_INTERACTIVE 1 /* stops flex from calling isatty() */ - +#ifdef LL_WINDOWS +#define isatty(x) 0 /* hack for bug in cygwin flex 2.5.35 */ +#endif + #ifdef ECHO #undef ECHO #endif @@ -60,7 +62,8 @@ extern "C" { int yyerror(const char *fmt, ...); } %} %% -"//" { gInternalLine++; gInternalColumn = 0; comment(); } +"//" { gInternalLine++; gInternalColumn = 0; line_comment(); } +"/*" { block_comment(); } "integer" { count(); return(INTEGER); } "float" { count(); return(FLOAT_TYPE); } @@ -116,6 +119,7 @@ extern "C" { int yyerror(const char *fmt, ...); } "object_rez" { count(); return(OBJECT_REZ); } "remote_data" { count(); return(REMOTE_DATA); } "http_response" { count(); return(HTTP_RESPONSE); } +"http_request" { count(); return(HTTP_REQUEST); } "." { count(); return(PERIOD); } @@ -147,6 +151,7 @@ extern "C" { int yyerror(const char *fmt, ...); } "AGENT_CROUCHING" { count(); yylval.ival = AGENT_CROUCHING; return(INTEGER_CONSTANT); } "AGENT_BUSY" { count(); yylval.ival = AGENT_BUSY; return(INTEGER_CONSTANT); } "AGENT_ALWAYS_RUN" { count(); yylval.ival = AGENT_ALWAYS_RUN; return(INTEGER_CONSTANT); } +"AGENT_AUTOPILOT" { count(); yylval.ival = AGENT_AUTOPILOT; return(INTEGER_CONSTANT); } "CAMERA_PITCH" { count(); yylval.ival = FOLLOWCAM_PITCH; return(INTEGER_CONSTANT); } "CAMERA_FOCUS_OFFSET" { count(); yylval.ival = FOLLOWCAM_FOCUS_OFFSET; return (INTEGER_CONSTANT); } @@ -219,16 +224,18 @@ extern "C" { int yyerror(const char *fmt, ...); } "INVENTORY_ALL" { count(); yylval.ival = LLAssetType::AT_NONE; return(INTEGER_CONSTANT); } "INVENTORY_NONE" { count(); yylval.ival = LLAssetType::AT_NONE; return(INTEGER_CONSTANT); } -"CHANGED_INVENTORY" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); } -"CHANGED_COLOR" { count(); yylval.ival = 0x2; return(INTEGER_CONSTANT); } -"CHANGED_SHAPE" { count(); yylval.ival = 0x4; return(INTEGER_CONSTANT); } -"CHANGED_SCALE" { count(); yylval.ival = 0x8; return(INTEGER_CONSTANT); } -"CHANGED_TEXTURE" { count(); yylval.ival = 0x10; return(INTEGER_CONSTANT); } -"CHANGED_LINK" { count(); yylval.ival = 0x20; return(INTEGER_CONSTANT); } -"CHANGED_ALLOWED_DROP" { count(); yylval.ival = 0x40; return(INTEGER_CONSTANT); } -"CHANGED_OWNER" { count(); yylval.ival = 0x80; return(INTEGER_CONSTANT); } -"CHANGED_REGION" { count(); yylval.ival = 0x100; return(INTEGER_CONSTANT); } -"CHANGED_TELEPORT" { count(); yylval.ival = 0x200; return(INTEGER_CONSTANT); } +"CHANGED_INVENTORY" { count(); yylval.ival = CHANGED_INVENTORY; return(INTEGER_CONSTANT); } +"CHANGED_COLOR" { count(); yylval.ival = CHANGED_COLOR; return(INTEGER_CONSTANT); } +"CHANGED_SHAPE" { count(); yylval.ival = CHANGED_SHAPE; return(INTEGER_CONSTANT); } +"CHANGED_SCALE" { count(); yylval.ival = CHANGED_SCALE; return(INTEGER_CONSTANT); } +"CHANGED_TEXTURE" { count(); yylval.ival = CHANGED_TEXTURE; return(INTEGER_CONSTANT); } +"CHANGED_LINK" { count(); yylval.ival = CHANGED_LINK; return(INTEGER_CONSTANT); } +"CHANGED_ALLOWED_DROP" { count(); yylval.ival = CHANGED_ALLOWED_DROP; return(INTEGER_CONSTANT); } +"CHANGED_OWNER" { count(); yylval.ival = CHANGED_OWNER; return(INTEGER_CONSTANT); } +"CHANGED_REGION" { count(); yylval.ival = CHANGED_REGION; return(INTEGER_CONSTANT); } +"CHANGED_TELEPORT" { count(); yylval.ival = CHANGED_TELEPORT; return(INTEGER_CONSTANT); } +"CHANGED_REGION_START" { count(); yylval.ival = CHANGED_REGION_START; return(INTEGER_CONSTANT); } +"CHANGED_MEDIA" { count(); yylval.ival = CHANGED_MEDIA; return(INTEGER_CONSTANT); } "OBJECT_UNKNOWN_DETAIL" { count(); yylval.ival = OBJECT_UNKNOWN_DETAIL; return(INTEGER_CONSTANT); } "OBJECT_NAME" { count(); yylval.ival = OBJECT_NAME; return(INTEGER_CONSTANT); } @@ -250,6 +257,8 @@ extern "C" { int yyerror(const char *fmt, ...); } "NULL_KEY" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "00000000-0000-0000-0000-000000000000"); return(STRING_CONSTANT); } "EOF" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "\n\n\n"); return(STRING_CONSTANT); } +"URL_REQUEST_GRANTED" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, URL_REQUEST_GRANTED); return(STRING_CONSTANT); } +"URL_REQUEST_DENIED" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, URL_REQUEST_DENIED); return(STRING_CONSTANT); } "PI" { count(); yylval.fval = F_PI; return(FP_CONSTANT); } "TWO_PI" { count(); yylval.fval = F_TWO_PI; return(FP_CONSTANT); } @@ -501,6 +510,9 @@ extern "C" { int yyerror(const char *fmt, ...); } "PRIM_SCULPT_TYPE_TORUS" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_TORUS; return(INTEGER_CONSTANT); } "PRIM_SCULPT_TYPE_PLANE" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_PLANE; return(INTEGER_CONSTANT); } "PRIM_SCULPT_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_CYLINDER; return(INTEGER_CONSTANT); } +"PRIM_SCULPT_TYPE_MASK" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_MASK; return(INTEGER_CONSTANT); } +"PRIM_SCULPT_FLAG_MIRROR" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_MIRROR; return(INTEGER_CONSTANT); } +"PRIM_SCULPT_FLAG_INVERT" { count(); yylval.ival = LSL_PRIM_SCULPT_FLAG_INVERT; return(INTEGER_CONSTANT); } "MASK_BASE" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); } "MASK_OWNER" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } @@ -601,6 +613,57 @@ extern "C" { int yyerror(const char *fmt, ...); } "CLICK_ACTION_OPEN" { count(); yylval.ival = CLICK_ACTION_OPEN; return(INTEGER_CONSTANT); } "CLICK_ACTION_PLAY" { count(); yylval.ival = CLICK_ACTION_PLAY; return(INTEGER_CONSTANT); } "CLICK_ACTION_OPEN_MEDIA" { count(); yylval.ival = CLICK_ACTION_OPEN_MEDIA; return(INTEGER_CONSTANT); } +"CLICK_ACTION_ZOOM" { count(); yylval.ival = CLICK_ACTION_ZOOM; return(INTEGER_CONSTANT); } + +"TEXTURE_BLANK" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "5748decc-f629-461c-9a36-a35a221fe21f"); return(STRING_CONSTANT); } +"TEXTURE_DEFAULT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); } +"TEXTURE_MEDIA" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "8b5fec65-8d8d-9dc5-cda8-8fdf2716e361"); return(STRING_CONSTANT); } +"TEXTURE_PLYWOOD" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "89556747-24cb-43ed-920b-47caed15465f"); return(STRING_CONSTANT); } +"TEXTURE_TRANSPARENT" { yylval.sval = new char[UUID_STR_LENGTH]; strcpy(yylval.sval, "8dcd4a48-2d37-4909-9f78-f7a9eb4ef903"); return(STRING_CONSTANT); } + +"TOUCH_INVALID_FACE" { count(); yylval.ival = -1; return(INTEGER_CONSTANT); } +"TOUCH_INVALID_VECTOR" { count(); return(TOUCH_INVALID_VECTOR); } +"TOUCH_INVALID_TEXCOORD" { count(); return(TOUCH_INVALID_TEXCOORD); } + +"PRIM_MEDIA_ALT_IMAGE_ENABLE" { count(); yylval.ival = LLMediaEntry::ALT_IMAGE_ENABLE_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_CONTROLS" { count(); yylval.ival = LLMediaEntry::CONTROLS_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_CURRENT_URL" { count(); yylval.ival = LLMediaEntry::CURRENT_URL_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_HOME_URL" { count(); yylval.ival = LLMediaEntry::HOME_URL_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_AUTO_LOOP" { count(); yylval.ival = LLMediaEntry::AUTO_LOOP_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_AUTO_PLAY" { count(); yylval.ival = LLMediaEntry::AUTO_PLAY_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_AUTO_SCALE" { count(); yylval.ival = LLMediaEntry::AUTO_SCALE_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_AUTO_ZOOM" { count(); yylval.ival = LLMediaEntry::AUTO_ZOOM_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_FIRST_CLICK_INTERACT" { count(); yylval.ival = LLMediaEntry::FIRST_CLICK_INTERACT_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_WIDTH_PIXELS" { count(); yylval.ival = LLMediaEntry::WIDTH_PIXELS_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_HEIGHT_PIXELS" { count(); yylval.ival = LLMediaEntry::HEIGHT_PIXELS_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_WHITELIST_ENABLE" { count(); yylval.ival = LLMediaEntry::WHITELIST_ENABLE_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_WHITELIST" { count(); yylval.ival = LLMediaEntry::WHITELIST_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_PERMS_INTERACT" { count(); yylval.ival = LLMediaEntry::PERMS_INTERACT_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_PERMS_CONTROL" { count(); yylval.ival = LLMediaEntry::PERMS_CONTROL_ID; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_PARAM_MAX" { count(); yylval.ival = LLMediaEntry::PARAM_MAX_ID; return(INTEGER_CONSTANT); } + +"PRIM_MEDIA_CONTROLS_STANDARD" { count(); yylval.ival = LLMediaEntry::STANDARD; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_CONTROLS_MINI" { count(); yylval.ival = LLMediaEntry::MINI; return(INTEGER_CONSTANT); } + +"PRIM_MEDIA_PERM_NONE" { count(); yylval.ival = LLMediaEntry::PERM_NONE; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_PERM_OWNER" { count(); yylval.ival = LLMediaEntry::PERM_OWNER; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_PERM_GROUP" { count(); yylval.ival = LLMediaEntry::PERM_GROUP; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_PERM_ANYONE" { count(); yylval.ival = LLMediaEntry::PERM_ANYONE; return(INTEGER_CONSTANT); } + +"PRIM_MEDIA_MAX_URL_LENGTH" { count(); yylval.ival = LLMediaEntry::MAX_URL_LENGTH; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_MAX_WHITELIST_SIZE" { count(); yylval.ival = LLMediaEntry::MAX_WHITELIST_SIZE; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_MAX_WHITELIST_COUNT" { count(); yylval.ival = LLMediaEntry::MAX_WHITELIST_COUNT; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_MAX_WIDTH_PIXELS" { count(); yylval.ival = LLMediaEntry::MAX_WIDTH_PIXELS; return(INTEGER_CONSTANT); } +"PRIM_MEDIA_MAX_HEIGHT_PIXELS" { count(); yylval.ival = LLMediaEntry::MAX_HEIGHT_PIXELS; return(INTEGER_CONSTANT); } + +"STATUS_OK" { count(); yylval.ival = LSL_STATUS_OK; return(INTEGER_CONSTANT); } +"STATUS_MALFORMED_PARAMS" { count(); yylval.ival = LSL_STATUS_MALFORMED_PARAMS; return(INTEGER_CONSTANT); } +"STATUS_TYPE_MISMATCH" { count(); yylval.ival = LSL_STATUS_TYPE_MISMATCH; return(INTEGER_CONSTANT); } +"STATUS_BOUNDS_ERROR" { count(); yylval.ival = LSL_STATUS_BOUNDS_ERROR; return(INTEGER_CONSTANT); } +"STATUS_NOT_FOUND" { count(); yylval.ival = LSL_STATUS_NOT_FOUND; return(INTEGER_CONSTANT); } +"STATUS_NOT_SUPPORTED" { count(); yylval.ival = LSL_STATUS_NOT_SUPPORTED; return(INTEGER_CONSTANT); } +"STATUS_INTERNAL_ERROR" { count(); yylval.ival = LSL_STATUS_INTERNAL_ERROR; return(INTEGER_CONSTANT); } +"STATUS_WHITELIST_FAILED" { count(); yylval.ival = LSL_STATUS_WHITELIST_FAILED; return(INTEGER_CONSTANT); } {L}({L}|{N})* { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(IDENTIFIER); } @@ -670,7 +733,7 @@ int yyerror(const char *fmt, ...) //#define EMIT_CIL_ASSEMBLER BOOL lscript_compile(const char* src_filename, const char* dst_filename, - const char* err_filename, BOOL is_god_like) + const char* err_filename, BOOL compile_to_mono, const char* class_name, BOOL is_god_like) { BOOL b_parse_ok = FALSE; BOOL b_dummy = FALSE; @@ -686,10 +749,10 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, init_temp_jumps(); gAllocationManager = new LLScriptAllocationManager(); - yyin = LLFile::fopen(src_filename, "r"); + yyin = LLFile::fopen(std::string(src_filename), "r"); if (yyin) { - yyout = LLFile::fopen(err_filename, "w"); + yyout = LLFile::fopen(std::string(err_filename), "w"); // Reset the lexer's internal buffering. @@ -702,7 +765,7 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, #ifdef EMERGENCY_DEBUG_PRINTOUTS char compiled[256]; sprintf(compiled, "%s.o", src_filename); - FILE* compfile; + LLFILE* compfile; compfile = LLFile::fopen(compiled, "w"); #endif @@ -712,6 +775,8 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, } gScriptp->mGodLike = is_god_like; + + gScriptp->setClassName(class_name); gScopeStringTable = new LLStringTable(16384); #ifdef EMERGENCY_DEBUG_PRINTOUTS @@ -727,23 +792,14 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, #ifdef EMERGENCY_DEBUG_PRINTOUTS gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); #endif -#ifdef EMIT_CIL_ASSEMBLER - const char* cil_output_file_name = dst_filename? dst_filename : "lscript.cil"; - FILE* cilout = LLFile::fopen(cil_output_file_name, "w"); - if(NULL == cilout) + if(TRUE == compile_to_mono) { - fprintf(yyout, "Error opening cil output file %s\n", cil_output_file_name); + gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_CIL_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); } else { - gScriptp->recurse(cilout, 0, 0, LSCP_EMIT_CIL_ASSEMBLY, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); - if(fclose(cilout) == EOF) - { - fprintf(yyout, "Error closing cil output file %s\n", cil_output_file_name); - } + gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_BYTE_CODE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); } -#endif - gScriptp->recurse(yyout, 0, 0, LSCP_EMIT_BYTE_CODE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); } delete gScopeStringTable; gScopeStringTable = NULL; @@ -752,9 +808,9 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, #endif } fclose(yyout); + fclose(yyin); } - fclose(yyin); delete gAllocationManager; delete gScopeStringTable; @@ -762,13 +818,15 @@ BOOL lscript_compile(const char* src_filename, const char* dst_filename, } -BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE) +BOOL lscript_compile(char *filename, BOOL compile_to_mono, BOOL is_god_like = FALSE) { char src_filename[MAX_STRING]; sprintf(src_filename, "%s.lsl", filename); char err_filename[MAX_STRING]; sprintf(err_filename, "%s.out", filename); - return lscript_compile(src_filename, NULL, err_filename, is_god_like); + char class_name[MAX_STRING]; + sprintf(class_name, "%s", filename); + return lscript_compile(src_filename, NULL, err_filename, compile_to_mono, class_name, is_god_like); } @@ -781,7 +839,7 @@ S32 yywrap() return(1); } -void comment() +void line_comment() { char c; @@ -789,6 +847,25 @@ void comment() ; } +void block_comment() +{ + char c1 = 0; + char c2 = yyinput(); + while (c2 != 0 && c2 != EOF && !(c1 == '*' && c2 == '/')) { + if (c2 == '\n') + { + gInternalLine++; + gInternalColumn = 0; + } + else if (c2 == '\t') + gInternalColumn += 4 - (gInternalColumn % 8); + else + gInternalColumn++; + c1 = c2; + c2 = yyinput(); + } +} + void count() { S32 i; diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y index d10cbfedba..e4b10ffdd9 100644 --- a/indra/lscript/lscript_compile/indra.y +++ b/indra/lscript/lscript_compile/indra.y @@ -92,6 +92,7 @@ %token LINK_MESSAGE %token REMOTE_DATA %token HTTP_RESPONSE +%token HTTP_REQUEST %token <sval> IDENTIFIER %token <sval> STATE_DEFAULT @@ -136,6 +137,9 @@ %token ZERO_VECTOR %token ZERO_ROTATION +%token TOUCH_INVALID_VECTOR +%token TOUCH_INVALID_TEXCOORD + %nonassoc LOWER_THAN_ELSE %nonassoc ELSE @@ -192,6 +196,7 @@ %type <event> object_rez %type <event> remote_data %type <event> http_response +%type <event> http_request %type <event> link_message %type <event> timer %type <event> chat @@ -439,6 +444,40 @@ vector_constant $$ = new LLScriptSAVector(gLine, gColumn, sa0, sa1, sa2); gAllocationManager->addAllocation($$); } + | TOUCH_INVALID_VECTOR + { + LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf0); + LLScriptSAConstant *sa0 = new LLScriptSAConstant(gLine, gColumn, cf0); + gAllocationManager->addAllocation(sa0); + LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf1); + LLScriptSAConstant *sa1 = new LLScriptSAConstant(gLine, gColumn, cf1); + gAllocationManager->addAllocation(sa1); + LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf2); + LLScriptSAConstant *sa2 = new LLScriptSAConstant(gLine, gColumn, cf2); + gAllocationManager->addAllocation(sa2); + $$ = new LLScriptSAVector(gLine, gColumn, sa0, sa1, sa2); + gAllocationManager->addAllocation($$); + } + | TOUCH_INVALID_TEXCOORD + { + LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, -1.f); + gAllocationManager->addAllocation(cf0); + LLScriptSAConstant *sa0 = new LLScriptSAConstant(gLine, gColumn, cf0); + gAllocationManager->addAllocation(sa0); + LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, -1.f); + gAllocationManager->addAllocation(cf1); + LLScriptSAConstant *sa1 = new LLScriptSAConstant(gLine, gColumn, cf1); + gAllocationManager->addAllocation(sa1); + LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf2); + LLScriptSAConstant *sa2 = new LLScriptSAConstant(gLine, gColumn, cf2); + gAllocationManager->addAllocation(sa2); + $$ = new LLScriptSAVector(gLine, gColumn, sa0, sa1, sa2); + gAllocationManager->addAllocation($$); + } ; quaternion_constant @@ -811,6 +850,11 @@ event $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); gAllocationManager->addAllocation($$); } + | http_request compound_statement + { + $$ = new LLScriptEventHandler(gLine, gColumn, $1, $2); + gAllocationManager->addAllocation($$); + } ; state_entry @@ -1179,6 +1223,20 @@ http_response } ; +http_request + : HTTP_REQUEST '(' LLKEY IDENTIFIER ',' STRING IDENTIFIER ',' STRING IDENTIFIER ')' + { + LLScriptIdentifier *id1 = new LLScriptIdentifier(gLine, gColumn, $4); + gAllocationManager->addAllocation(id1); + LLScriptIdentifier *id2 = new LLScriptIdentifier(gLine, gColumn, $7); + gAllocationManager->addAllocation(id2); + LLScriptIdentifier *id3 = new LLScriptIdentifier(gLine, gColumn, $10); + gAllocationManager->addAllocation(id3); + $$ = new LLScriptHTTPRequestEvent(gLine, gColumn, id1, id2, id3); + gAllocationManager->addAllocation($$); + } + ; + compound_statement : '{' '}' { @@ -1645,6 +1703,40 @@ vector_initializer $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2); gAllocationManager->addAllocation($$); } + | TOUCH_INVALID_VECTOR + { + LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf0); + LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0); + gAllocationManager->addAllocation(sa0); + LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf1); + LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1); + gAllocationManager->addAllocation(sa1); + LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf2); + LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2); + gAllocationManager->addAllocation(sa2); + $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2); + gAllocationManager->addAllocation($$); + } + | TOUCH_INVALID_TEXCOORD + { + LLScriptConstantFloat *cf0 = new LLScriptConstantFloat(gLine, gColumn, -1.f); + gAllocationManager->addAllocation(cf0); + LLScriptConstantExpression *sa0 = new LLScriptConstantExpression(gLine, gColumn, cf0); + gAllocationManager->addAllocation(sa0); + LLScriptConstantFloat *cf1 = new LLScriptConstantFloat(gLine, gColumn, -1.f); + gAllocationManager->addAllocation(cf1); + LLScriptConstantExpression *sa1 = new LLScriptConstantExpression(gLine, gColumn, cf1); + gAllocationManager->addAllocation(sa1); + LLScriptConstantFloat *cf2 = new LLScriptConstantFloat(gLine, gColumn, 0.f); + gAllocationManager->addAllocation(cf2); + LLScriptConstantExpression *sa2 = new LLScriptConstantExpression(gLine, gColumn, cf2); + gAllocationManager->addAllocation(sa2); + $$ = new LLScriptVectorInitializer(gLine, gColumn, sa0, sa1, sa2); + gAllocationManager->addAllocation($$); + } ; quaternion_initializer diff --git a/indra/lscript/lscript_compile/lscript_alloc.cpp b/indra/lscript/lscript_compile/lscript_alloc.cpp index 873fc36f3a..5856a94e48 100644 --- a/indra/lscript/lscript_compile/lscript_alloc.cpp +++ b/indra/lscript/lscript_compile/lscript_alloc.cpp @@ -2,30 +2,25 @@ * @file lscript_alloc.cpp * @brief Allocation tracking * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp index c41c34c5e5..95b2f35a94 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp @@ -2,30 +2,25 @@ * @file lscript_bytecode.cpp * @brief classes to build actual bytecode * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -101,7 +96,7 @@ void LLScriptByteCodeChunk::addU16(U16 data) addBytes(temp, 2); } -void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) +void LLScriptByteCodeChunk::addBytes(const U8 *bytes, S32 size) { if (mCodeChunk) { @@ -118,7 +113,7 @@ void LLScriptByteCodeChunk::addBytes(U8 *bytes, S32 size) mCurrentOffset += size; } -void LLScriptByteCodeChunk::addBytes(char *bytes, S32 size) +void LLScriptByteCodeChunk::addBytes(const char *bytes, S32 size) { if (mCodeChunk) { @@ -245,7 +240,7 @@ LLScriptScriptCodeChunk::~LLScriptScriptCodeChunk() delete [] mCompleteCode; } -void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp) +void LLScriptScriptCodeChunk::build(LLFILE *efp, LLFILE *bcfp) { S32 code_data_size = mRegisters->mCurrentOffset + mGlobalVariables->mCurrentOffset + @@ -311,7 +306,7 @@ void LLScriptScriptCodeChunk::build(FILE *efp, FILE *bcfp) set_register(mCompleteCode, LREG_TM, mTotalSize); - if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != mTotalSize) + if (fwrite(mCompleteCode, 1, mTotalSize, bcfp) != (size_t)mTotalSize) { llwarns << "Short write" << llendl; } diff --git a/indra/lscript/lscript_compile/lscript_bytecode.h b/indra/lscript/lscript_compile/lscript_bytecode.h index 8db031af66..0933c78b6f 100644 --- a/indra/lscript/lscript_compile/lscript_bytecode.h +++ b/indra/lscript/lscript_compile/lscript_bytecode.h @@ -2,30 +2,25 @@ * @file lscript_bytecode.h * @brief classes to build actual bytecode * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -56,8 +51,8 @@ public: void addByte(U8 byte); void addU16(U16 data); - void addBytes(U8 *bytes, S32 size); - void addBytes(char *bytes, S32 size); + void addBytes(const U8 *bytes, S32 size); + void addBytes(const char *bytes, S32 size); void addBytes(S32 size); void addBytesDontInc(S32 size); void addInteger(S32 value); @@ -77,7 +72,7 @@ public: LLScriptScriptCodeChunk(S32 total_size); ~LLScriptScriptCodeChunk(); - void build(FILE *efp, FILE *bcfp); + void build(LLFILE *efp, LLFILE *bcfp); LLScriptByteCodeChunk *mRegisters; LLScriptByteCodeChunk *mGlobalVariables; diff --git a/indra/lscript/lscript_compile/lscript_error.cpp b/indra/lscript/lscript_compile/lscript_error.cpp index f4960fc541..a574981555 100644 --- a/indra/lscript/lscript_compile/lscript_error.cpp +++ b/indra/lscript/lscript_compile/lscript_error.cpp @@ -2,30 +2,25 @@ * @file lscript_error.cpp * @brief error reporting class and strings * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -40,7 +35,7 @@ S32 gInternalLine = 0; LLScriptGenerateErrorText gErrorToText; -void LLScriptFilePosition::fdotabs(FILE *fp, S32 tabs, S32 tabsize) +void LLScriptFilePosition::fdotabs(LLFILE *fp, S32 tabs, S32 tabsize) { S32 i; for (i = 0; i < tabs * tabsize; i++) @@ -49,13 +44,13 @@ void LLScriptFilePosition::fdotabs(FILE *fp, S32 tabs, S32 tabsize) } } -char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ +const char* gWarningText[LSWARN_EOF] = /*Flawfinder: ignore*/ { "INVALID", "Dead code found beyond return statement" }; -char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ +const char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ { "INVALID", "Syntax error", @@ -72,29 +67,37 @@ char* gErrorText[LSERROR_EOF] = /*Flawfinder: ignore*/ "Use of vector or quaternion method on incorrect type", "Lists can't be included in lists", "Unitialized variables can't be included in lists", - "Declaration requires a new scope -- use { and }" + "Declaration requires a new scope -- use { and }", + "CIL assembler failed", + "Bytecode transformer failed", + "Bytecode verification failed" }; -void LLScriptGenerateErrorText::writeWarning(FILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning) +void LLScriptGenerateErrorText::writeWarning(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning) { fprintf(fp, "(%d, %d) : WARNING : %s\n", pos->mLineNumber, pos->mColumnNumber, gWarningText[warning]); mTotalWarnings++; } -void LLScriptGenerateErrorText::writeWarning(FILE *fp, S32 line, S32 col, LSCRIPTWarnings warning) +void LLScriptGenerateErrorText::writeWarning(LLFILE *fp, S32 line, S32 col, LSCRIPTWarnings warning) { fprintf(fp, "(%d, %d) : WARNING : %s\n", line, col, gWarningText[warning]); mTotalWarnings++; } -void LLScriptGenerateErrorText::writeError(FILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error) +void LLScriptGenerateErrorText::writeError(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error) { fprintf(fp, "(%d, %d) : ERROR : %s\n", pos->mLineNumber, pos->mColumnNumber, gErrorText[error]); mTotalErrors++; } -void LLScriptGenerateErrorText::writeError(FILE *fp, S32 line, S32 col, LSCRIPTErrors error) +void LLScriptGenerateErrorText::writeError(LLFILE *fp, S32 line, S32 col, LSCRIPTErrors error) { fprintf(fp, "(%d, %d) : ERROR : %s\n", line, col, gErrorText[error]); mTotalErrors++; } + +std::string getLScriptErrorString(LSCRIPTErrors error) +{ + return gErrorText[error]; +} diff --git a/indra/lscript/lscript_compile/lscript_error.h b/indra/lscript/lscript_compile/lscript_error.h index aba3932c14..43fb968a40 100644 --- a/indra/lscript/lscript_compile/lscript_error.h +++ b/indra/lscript/lscript_compile/lscript_error.h @@ -2,30 +2,25 @@ * @file lscript_error.h * @brief error reporting class and strings * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -84,13 +79,13 @@ public: virtual ~LLScriptFilePosition() {} - virtual void recurse(FILE *fp, S32 tabs, S32 tabsize, + virtual void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) = 0; virtual S32 getSize() = 0; - void fdotabs(FILE *fp, S32 tabs, S32 tabsize); + void fdotabs(LLFILE *fp, S32 tabs, S32 tabsize); S32 mLineNumber; S32 mColumnNumber; @@ -124,6 +119,9 @@ typedef enum e_lscript_errors LSERROR_NO_LISTS_IN_LISTS, LSERROR_NO_UNITIALIZED_VARIABLES_IN_LISTS, LSERROR_NEED_NEW_SCOPE, + LSERROR_CIL_ASSEMBLER_FAILED = 16, // Mono build error. + LSERROR_BYTECODE_TRANSFORM_FAILED = 17, // Mono build error. + LSERROR_BYTECODE_VERIFICATION_FAILED, // Mono build error. LSERROR_EOF } LSCRIPTErrors; @@ -135,10 +133,10 @@ public: void init() { mTotalErrors = 0; mTotalWarnings = 0; } - void writeWarning(FILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning); - void writeWarning(FILE *fp, S32 line, S32 col, LSCRIPTWarnings warning); - void writeError(FILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error); - void writeError(FILE *fp, S32 line, S32 col, LSCRIPTErrors error); + void writeWarning(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTWarnings warning); + void writeWarning(LLFILE *fp, S32 line, S32 col, LSCRIPTWarnings warning); + void writeError(LLFILE *fp, LLScriptFilePosition *pos, LSCRIPTErrors error); + void writeError(LLFILE *fp, S32 line, S32 col, LSCRIPTErrors error); BOOL getErrors() { return mTotalErrors; } BOOL getWarnings() { return mTotalWarnings; } @@ -147,6 +145,8 @@ public: S32 mTotalWarnings; }; +std::string getLScriptErrorString(LSCRIPTErrors error); + extern LLScriptGenerateErrorText gErrorToText; #endif diff --git a/indra/lscript/lscript_compile/lscript_heap.cpp b/indra/lscript/lscript_compile/lscript_heap.cpp index 7242b72ba5..476c1ac5a6 100644 --- a/indra/lscript/lscript_compile/lscript_heap.cpp +++ b/indra/lscript/lscript_compile/lscript_heap.cpp @@ -2,30 +2,25 @@ * @file lscript_heap.cpp * @brief classes to manage script heap * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_compile/lscript_heap.h b/indra/lscript/lscript_compile/lscript_heap.h index a06466aa4b..7762a367d6 100644 --- a/indra/lscript/lscript_compile/lscript_heap.h +++ b/indra/lscript/lscript_compile/lscript_heap.h @@ -2,30 +2,25 @@ * @file lscript_heap.h * @brief classes to manage script heap * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_compile/lscript_resource.cpp b/indra/lscript/lscript_compile/lscript_resource.cpp index 0e013856e8..6cc3e3c5ee 100644 --- a/indra/lscript/lscript_compile/lscript_resource.cpp +++ b/indra/lscript/lscript_compile/lscript_resource.cpp @@ -2,30 +2,25 @@ * @file lscript_resource.cpp * @brief resource determination prior to assembly * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_compile/lscript_resource.h b/indra/lscript/lscript_compile/lscript_resource.h index 80e6c83926..82cece0a85 100644 --- a/indra/lscript/lscript_compile/lscript_resource.h +++ b/indra/lscript/lscript_compile/lscript_resource.h @@ -2,30 +2,25 @@ * @file lscript_resource.h * @brief resource determination prior to assembly * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_compile/lscript_scope.cpp b/indra/lscript/lscript_compile/lscript_scope.cpp index 4d00661b7d..e0fdf44d7a 100644 --- a/indra/lscript/lscript_compile/lscript_scope.cpp +++ b/indra/lscript/lscript_compile/lscript_scope.cpp @@ -2,30 +2,25 @@ * @file lscript_scope.cpp * @brief builds nametable and checks scope * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_compile/lscript_scope.h b/indra/lscript/lscript_compile/lscript_scope.h index c55d99577a..5b2a73ad92 100644 --- a/indra/lscript/lscript_compile/lscript_scope.h +++ b/indra/lscript/lscript_compile/lscript_scope.h @@ -2,30 +2,25 @@ * @file lscript_scope.h * @brief builds nametable and checks scope * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -277,14 +272,14 @@ public: class LLScriptScopeEntry { public: - LLScriptScopeEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) + LLScriptScopeEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type, S32 count = 0) : mIdentifier(identifier), mIDType(idtype), mType(type), mOffset(0), mSize(0), mAssignable(NULL), mCount(count), mLibraryNumber(0) { } ~LLScriptScopeEntry() {} - char *mIdentifier; + const char *mIdentifier; LSCRIPTIdentifierType mIDType; LSCRIPTType mType; S32 mOffset; @@ -309,9 +304,9 @@ public: mEntryMap.deleteAllData(); } - LLScriptScopeEntry *addEntry(char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) + LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); if (!mEntryMap.checkData(name)) { if (idtype == LIT_FUNCTION) @@ -329,9 +324,9 @@ public: } } - BOOL checkEntry(char *identifier) + BOOL checkEntry(const char *identifier) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); if (mEntryMap.checkData(name)) { return TRUE; @@ -343,9 +338,9 @@ public: } } - LLScriptScopeEntry *findEntry(char *identifier) + LLScriptScopeEntry *findEntry(const char *identifier) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); LLScriptScope *scope = this; while (scope) @@ -360,9 +355,9 @@ public: return NULL; } - LLScriptScopeEntry *findEntryTyped(char *identifier, LSCRIPTIdentifierType idtype) + LLScriptScopeEntry *findEntryTyped(const char *identifier, LSCRIPTIdentifierType idtype) { - char *name = mSTable->addString(identifier); + const char *name = mSTable->addString(identifier); LLScriptScope *scope = this; while (scope) @@ -397,7 +392,7 @@ public: mParentScope = scope; } - LLMap<char *, LLScriptScopeEntry *> mEntryMap; + LLMap<const char *, LLScriptScopeEntry *> mEntryMap; LLScriptScope *mParentScope; LLStringTable *mSTable; S32 mFunctionCount; diff --git a/indra/lscript/lscript_compile/lscript_tree.cpp b/indra/lscript/lscript_compile/lscript_tree.cpp index cad6fc207e..8a70dd9ac1 100644 --- a/indra/lscript/lscript_compile/lscript_tree.cpp +++ b/indra/lscript/lscript_compile/lscript_tree.cpp @@ -2,30 +2,25 @@ * @file lscript_tree.cpp * @brief implements methods for lscript_tree.h classes * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -43,32 +38,38 @@ //#define LSL_INCLUDE_DEBUG_INFO -void print_cil_box(FILE* fp, LSCRIPTType type) + +static void print_cil_box(LLFILE* fp, LSCRIPTType type) { - switch(type) + +switch(type) { case LST_INTEGER: fprintf(fp, "box [mscorlib]System.Int32\n"); break; case LST_FLOATINGPOINT: - fprintf(fp, "box [mscorlib]System.Double\n"); + fprintf(fp, "box [mscorlib]System.Single\n"); break; case LST_STRING: + // System.String is not a System.ValueType, + // so does not need to be boxed. + break; case LST_KEY: - fprintf(fp, "box [mscorlib]System.String\n"); + fprintf(fp, "box [ScriptTypes]LindenLab.SecondLife.Key\n"); break; case LST_VECTOR: - fprintf(fp, "box [LScriptLibrary]LLVector\n"); + fprintf(fp, "box [ScriptTypes]LindenLab.SecondLife.Vector\n"); break; case LST_QUATERNION: - fprintf(fp, "box [LScriptLibrary]LLQuaternion\n"); + fprintf(fp, "box [ScriptTypes]LindenLab.SecondLife.Quaternion\n"); break; default: + llassert(false); break; } } -void print_cil_type(FILE* fp, LSCRIPTType type) +static void print_cil_type(LLFILE* fp, LSCRIPTType type) { switch(type) { @@ -79,14 +80,16 @@ void print_cil_type(FILE* fp, LSCRIPTType type) fprintf(fp, "float32"); break; case LST_STRING: - case LST_KEY: fprintf(fp, "string"); + break; + case LST_KEY: + fprintf(fp, "valuetype [ScriptTypes]LindenLab.SecondLife.Key"); break; case LST_VECTOR: - fprintf(fp, "valuetype [LScriptLibrary]LLVector"); + fprintf(fp, "class [ScriptTypes]LindenLab.SecondLife.Vector"); break; case LST_QUATERNION: - fprintf(fp, "valuetype [LScriptLibrary]LLQuaternion"); + fprintf(fp, "class [ScriptTypes]LindenLab.SecondLife.Quaternion"); break; case LST_LIST: fprintf(fp, "class [mscorlib]System.Collections.ArrayList"); @@ -99,7 +102,7 @@ void print_cil_type(FILE* fp, LSCRIPTType type) } } -void LLScriptType::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptType::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -127,7 +130,7 @@ S32 LLScriptType::getSize() return LSCRIPTDataSize[mType]; } -void LLScriptConstant::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptConstant::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -152,7 +155,7 @@ S32 LLScriptConstant::getSize() -void LLScriptConstantInteger::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptConstantInteger::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -189,6 +192,7 @@ void LLScriptConstantInteger::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo break; case LSCP_EMIT_CIL_ASSEMBLY: fprintf(fp, "ldc.i4 %d\n", mValue); + type = mType; break; default: break; @@ -200,7 +204,7 @@ S32 LLScriptConstantInteger::getSize() return LSCRIPTDataSize[LST_INTEGER]; } -void LLScriptConstantFloat::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptConstantFloat::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -236,7 +240,13 @@ void LLScriptConstantFloat::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp } break; case LSCP_EMIT_CIL_ASSEMBLY: - fprintf(fp, "ldc.r8 %5.5f\n", mValue); // NOTE: Precision? + { + double v = (double)mValue; + U8 * p = (U8 *)&v; // See ECMA-335 Partition VI, Appendix C.4.6 Examples, line 4 + fprintf(fp, "ldc.r8 (%02x %02x %02x %02x %02x %02x %02x %02x)\n", p[0], p[1], p[2], p[3], p[4], p[5], p[6], p[7]); + type = mType; + } + break; default: break; } @@ -247,21 +257,39 @@ S32 LLScriptConstantFloat::getSize() return LSCRIPTDataSize[LST_FLOATINGPOINT]; } -void print_escape_quotes(FILE* fp, const char* str) +void print_escaped(LLFILE* fp, const char* str) { putc('"', fp); for(const char* c = str; *c != '\0'; ++c) { - if(*c == '"') + switch(*c) { - putc('\\', fp); + case '"': + putc('\\', fp); + putc(*c, fp); + break; + case '\n': + putc('\\', fp); + putc('n', fp); + break; + case '\t': + putc(' ', fp); + putc(' ', fp); + putc(' ', fp); + putc(' ', fp); + break; + case '\\': + putc('\\', fp); + putc('\\', fp); + break; + default: + putc(*c, fp); } - putc(*c, fp); } putc('"', fp); } -void LLScriptConstantString::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptConstantString::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -293,7 +321,7 @@ void LLScriptConstantString::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom case LSCP_TO_STACK: { chunk->addByte(LSCRIPTOpCodes[LOPC_PUSHARGS]); - chunk->addBytes(mValue, (S32)strlen(mValue) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mValue, (S32)strlen(mValue) + 1); type = mType; } break; @@ -304,7 +332,7 @@ void LLScriptConstantString::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom break; case LSCP_EMIT_CIL_ASSEMBLY: fprintf(fp, "ldstr "); - print_escape_quotes(fp, mValue); + print_escaped(fp, mValue); fprintf(fp, "\n"); default: break; @@ -313,11 +341,10 @@ void LLScriptConstantString::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom S32 LLScriptConstantString::getSize() { - return (S32)strlen(mValue) + 1; /*Flawfinder: ignore*/ + return (S32)strlen(mValue) + 1; } - -void LLScriptIdentifier::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -388,7 +415,7 @@ void LLScriptIdentifier::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile } break; case LSCP_EMIT_CIL_ASSEMBLY: - fprintf(fp, "%s", mName); + fprintf(fp, "'%s'", mName); break; default: break; @@ -412,7 +439,7 @@ void LLScriptSimpleAssignable::addAssignable(LLScriptSimpleAssignable *assign) mNextp = assign; } -void LLScriptSimpleAssignable::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptSimpleAssignable::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -428,7 +455,13 @@ S32 LLScriptSimpleAssignable::getSize() return 0; } -void LLScriptSAIdentifier::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +static void print_cil_member(LLFILE* fp, LLScriptIdentifier *ident) +{ + print_cil_type(fp, ident->mScopeEntry->mType); + fprintf(fp, " %s::'%s'\n", gScriptp->getClassName(), ident->mScopeEntry->mIdentifier); +} + +void LLScriptSAIdentifier::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -497,6 +530,19 @@ void LLScriptSAIdentifier::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi } } break; + + case LSCP_EMIT_CIL_ASSEMBLY: + { + fprintf(fp, "ldarg.0\n"); + fprintf(fp, "ldfld "); + print_cil_member(fp, mIdentifier); + fprintf(fp, "\n"); + if (mNextp) + { + mNextp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + } + break; + } default: mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); if (mNextp) @@ -512,7 +558,7 @@ S32 LLScriptSAIdentifier::getSize() return mIdentifier->getSize(); } -void LLScriptSAConstant::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptSAConstant::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -553,7 +599,8 @@ S32 LLScriptSAConstant::getSize() return mConstant->getSize(); } -void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) + +static void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) { switch(srcType) { @@ -567,9 +614,8 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) fprintf(fp, "call string class [mscorlib]System.Convert::ToString(int32)\n"); break; case LST_LIST: - fprintf(fp, "box [mscorlib]System.Int32\n"); - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::CreateList()\n"); - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::AddReturnList(object, class [mscorlib]System.Collections.ArrayList)\n"); + print_cil_box(fp, LST_INTEGER); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); break; default: break; @@ -579,13 +625,14 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) switch(targetType) { case LST_INTEGER: - fprintf(fp, "conv.i4\n"); + fprintf(fp, "call int32 [LslLibrary]LindenLab.SecondLife.LslRunTime::ToInteger(float32)\n"); break; case LST_STRING: - fprintf(fp, "call string class [mscorlib]System.Convert::ToString(float32)\n"); + fprintf(fp, "call string [LslLibrary]LindenLab.SecondLife.LslRunTime::ToString(float32)\n"); break; case LST_LIST: - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); + print_cil_box(fp, LST_FLOATINGPOINT); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); break; default: break; @@ -595,19 +642,22 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) switch(targetType) { case LST_INTEGER: - fprintf(fp, "call int32 valuetype [mscorlib]System.Int32::Parse(string)\n"); + fprintf(fp, "call int32 [LslLibrary]LindenLab.SecondLife.LslRunTime::StringToInt(string)\n"); break; case LST_FLOATINGPOINT: - fprintf(fp, "call float64 valuetype [mscorlib]System.Double::Parse(string)\n"); + fprintf(fp, "call float32 [LslLibrary]LindenLab.SecondLife.LslRunTime::StringToFloat(string)\n"); break; + case LST_KEY: + fprintf(fp, "call valuetype [ScriptTypes]LindenLab.SecondLife.Key class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateKey'(string)\n"); + break; case LST_LIST: - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); break; case LST_VECTOR: - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'Parse'(string)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'ParseVector'(string)\n"); break; case LST_QUATERNION: - fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'Parse'(string)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'ParseQuaternion'(string)\n"); break; default: break; @@ -619,9 +669,11 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) case LST_KEY: break; case LST_STRING: + fprintf(fp, "call string [LslUserScript]LindenLab.SecondLife.LslUserScript::'ToString'(valuetype [ScriptTypes]LindenLab.SecondLife.Key)\n"); break; case LST_LIST: - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); + print_cil_box(fp, LST_KEY); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); break; default: break; @@ -633,10 +685,11 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) case LST_VECTOR: break; case LST_STRING: - fprintf(fp, "call string valuetype [LScriptLibrary]LLVector::'ToString'(valuetype [LScriptLibrary]LLVector)\n"); + fprintf(fp, "call string [LslUserScript]LindenLab.SecondLife.LslUserScript::'ToString'(valuetype [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; case LST_LIST: - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); + print_cil_box(fp, LST_VECTOR); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); break; default: break; @@ -648,10 +701,11 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) case LST_QUATERNION: break; case LST_STRING: - fprintf(fp, "call string valuetype [LScriptLibrary]LLQuaternion::'ToString'(valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call string [LslUserScript]LindenLab.SecondLife.LslUserScript::'ToString'(valuetype [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); break; case LST_LIST: - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LScriptLibrary]LScriptInternal::CreateList(object)\n"); + print_cil_box(fp, LST_QUATERNION); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList(object)\n"); break; default: break; @@ -663,7 +717,7 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) case LST_LIST: break; case LST_STRING: - fprintf(fp, "call string [LScriptLibrary]LScriptInternal::ListToString(class [mscorlib]System.Collections.ArrayList)\n"); + fprintf(fp, "call string [LslLibrary]LindenLab.SecondLife.LslRunTime::ListToString(class [mscorlib]System.Collections.ArrayList)\n"); break; default: break; @@ -674,13 +728,60 @@ void print_cil_cast(FILE* fp, LSCRIPTType srcType, LSCRIPTType targetType) } } -bool is_SA_constant_integer(LLScriptSimpleAssignable* sa) +static void print_cil_numeric_cast(LLFILE* fp, LSCRIPTType currentArg, LSCRIPTType otherArg) { - // HACK: Downcast based on type. - return (sa->mType == LSSAT_CONSTANT && ((LLScriptSAConstant*) sa)->mConstant->mType == LST_INTEGER); + if((currentArg == LST_INTEGER) && ((otherArg == LST_FLOATINGPOINT) || (otherArg == LST_VECTOR))) + { + print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); + } +} + +static void print_cil_assignment_cast(LLFILE* fp, LSCRIPTType src, + LSCRIPTType dest) +{ + if (LST_STRING == src && LST_KEY == dest) + { + print_cil_cast(fp, src, dest); + } + else if(LST_KEY == src && LST_STRING == dest) + { + print_cil_cast(fp, src, dest); + } + else + { + print_cil_numeric_cast(fp, src, dest); + } +} + +// HACK! Babbage: should be converted to virtual on LSCRIPTSimpleAssignableType to avoid downcasts. +LSCRIPTType get_type(LLScriptSimpleAssignable* sa) +{ + LSCRIPTType result = LST_NULL; + switch(sa->mType) + { + case LSSAT_IDENTIFIER: + result = ((LLScriptSAIdentifier*) sa)->mIdentifier->mScopeEntry->mType; + break; + case LSSAT_CONSTANT: + result = ((LLScriptSAConstant*) sa)->mConstant->mType; + break; + case LSSAT_VECTOR_CONSTANT: + result = LST_VECTOR; + break; + case LSSAT_QUATERNION_CONSTANT: + result = LST_QUATERNION; + break; + case LSSAT_LIST_CONSTANT: + result = LST_LIST; + break; + default: + result = LST_UNDEFINED; + break; + } + return result; } -void LLScriptSAVector::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptSAVector::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -786,23 +887,23 @@ void LLScriptSAVector::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa // Load arguments. mEntry1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if(is_SA_constant_integer(mEntry1)) + if(LST_INTEGER == get_type(mEntry1)) { print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); } mEntry2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if(is_SA_constant_integer(mEntry3)) + if(LST_INTEGER == get_type(mEntry2)) { print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); } mEntry3->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if(is_SA_constant_integer(mEntry3)) + if(LST_INTEGER == get_type(mEntry3)) { print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); } // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'create'(float32, float32, float32)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); // Next. if (mNextp) @@ -827,7 +928,7 @@ S32 LLScriptSAVector::getSize() return mEntry1->getSize() + mEntry2->getSize() + mEntry3->getSize(); } -void LLScriptSAQuaternion::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptSAQuaternion::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -952,28 +1053,28 @@ void LLScriptSAQuaternion::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi // Load arguments. mEntry1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if(is_SA_constant_integer(mEntry1)) + if(LST_INTEGER == get_type(mEntry1)) { print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); } mEntry2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if(is_SA_constant_integer(mEntry2)) + if(LST_INTEGER == get_type(mEntry2)) { print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); } mEntry3->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if(is_SA_constant_integer(mEntry3)) + if(LST_INTEGER == get_type(mEntry3)) { print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); } mEntry4->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if(is_SA_constant_integer(mEntry4)) + if(LST_INTEGER == get_type(mEntry4)) { print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); } // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. - fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'create'(float32, float32, float32, float32)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); // Next. if (mNextp) @@ -999,7 +1100,7 @@ S32 LLScriptSAQuaternion::getSize() return mEntry1->getSize() + mEntry2->getSize() + mEntry3->getSize() + mEntry4->getSize(); } -void LLScriptSAList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptSAList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1049,6 +1150,40 @@ void LLScriptSAList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } } break; + case LSCP_EMIT_CIL_ASSEMBLY: + { + // Create list. + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); + + // Add elements. + LLScriptSimpleAssignable* current_entry = mEntryList; + LLScriptSimpleAssignable* next_entry = NULL; + while(NULL != current_entry) + { + next_entry = current_entry->mNextp; + + // Null mNextp pointer, so only current list element is processed. + current_entry->mNextp = NULL; + current_entry->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + + // Restore mNextp pointer. + current_entry->mNextp = next_entry; + + // Box element and store in list. + print_cil_box(fp, get_type(current_entry)); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(class [mscorlib]System.Collections.ArrayList, object)\n"); + + // Process next element. + current_entry = next_entry; + } + + // Process next list. + if (mNextp) + { + mNextp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + } + } + break; default: if (mEntryList) mEntryList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, ldata); @@ -1074,7 +1209,7 @@ void LLScriptGlobalVariable::addGlobal(LLScriptGlobalVariable *global) mNextp = global; } -void LLScriptGlobalVariable::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptGlobalVariable::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { switch(pass) { @@ -1093,7 +1228,46 @@ void LLScriptGlobalVariable::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp } } -void LLScriptGlobalVariable::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +// Push initialised variable of type on to stack. +static void print_cil_init_variable(LLFILE* fp, LSCRIPTType type) +{ + switch(type) + { + case LST_INTEGER: + fprintf(fp, "ldc.i4.0\n"); + break; + case LST_FLOATINGPOINT: + fprintf(fp, "ldc.r8 0\n"); + break; + case LST_STRING: + fprintf(fp, "ldstr \"\"\n"); + break; + case LST_KEY: + fprintf(fp, "ldstr \"\"\n"); + fprintf(fp, "call valuetype [ScriptTypes]LindenLab.SecondLife.Key class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateKey'(string)\n"); + break; + case LST_VECTOR: + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); + break; + case LST_QUATERNION: + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 1\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); + break; + case LST_LIST: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); + break; + default: + break; + } +} + +void LLScriptGlobalVariable::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1164,7 +1338,7 @@ void LLScriptGlobalVariable::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom // it also includes the name of the variable as well as the type // plus 4 bytes of offset from it's apparent address to the actual data #ifdef LSL_INCLUDE_DEBUG_INFO - count += strlen(mIdentifier->mName) + 1 + 1 + 4; /*Flawfinder: ignore*/ + count += strlen(mIdentifier->mName) + 1 + 1 + 4; #else count += 1 + 1 + 4; #endif @@ -1187,7 +1361,7 @@ void LLScriptGlobalVariable::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom chunk->addBytes(&vtype, 1); // null terminated name #ifdef LSL_INCLUDE_DEBUG_INFO - chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); #else chunk->addBytes(1); #endif @@ -1257,16 +1431,27 @@ void LLScriptGlobalVariable::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom case LSCP_EMIT_CIL_ASSEMBLY: // Initialisation inside ctor. + fprintf(fp, "ldarg.0\n"); if (mAssignable) { - fprintf(fp, "ldarg.0\n"); - mAssignable->recurse(fp, tabs, tabsize, LSCP_EMIT_CIL_ASSEMBLY, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "stfld "); - mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp," LSL::"); - mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "\n"); + // Initialise to value. + mAssignable->recurse(fp, tabs, tabsize, LSCP_EMIT_CIL_ASSEMBLY, + ptype, prunearg, scope, type, basetype, + count, chunk, heap, stacksize, entry, + entrycount, NULL); + print_cil_assignment_cast(fp, get_type(mAssignable), mType->mType); + } + else + { + // Initialise to zero. + print_cil_init_variable(fp, mType->mType); } + // Store value. + fprintf(fp, "stfld "); + mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp," %s::", gScriptp->getClassName()); + mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "\n"); break; default: mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -1288,7 +1473,7 @@ S32 LLScriptGlobalVariable::getSize() return return_size; } -void LLScriptEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { fprintf(fp, "Event Base Class -- should never get here!\n"); } @@ -1298,8 +1483,22 @@ S32 LLScriptEvent::getSize() printf("Event Base Class -- should never get here!\n"); return 0; } +static void checkForDuplicateHandler(LLFILE *fp, LLScriptFilePosition *pos, + LLScriptScope *scope, + const char* name) +{ + LLScriptScope *parent = scope->mParentScope; + if (parent->checkEntry((char*)name)) + { + gErrorToText.writeError(fp, pos, LSERROR_DUPLICATE_NAME); + } + else + { + parent->addEntry(((char*)name), LIT_HANDLER, LST_NULL); + } +} -void LLScriptStateEntryEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptStateEntryEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1314,11 +1513,14 @@ void LLScriptStateEntryEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo case LSCP_EMIT_ASSEMBLY: fprintf(fp, "state_entry()\n"); break; + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "state_entry"); + break; case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "state_entry"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); #endif } break; @@ -1335,7 +1537,7 @@ S32 LLScriptStateEntryEvent::getSize() return 0; } -void LLScriptStateExitEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptStateExitEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1347,6 +1549,9 @@ void LLScriptStateExitEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom fdotabs(fp, tabs, tabsize); fprintf(fp, "state_exit()\n"); break; + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "state_exit"); + break; case LSCP_EMIT_ASSEMBLY: fprintf(fp, "state_exit()\n"); break; @@ -1354,7 +1559,7 @@ void LLScriptStateExitEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "state_exit"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); #endif } break; @@ -1371,7 +1576,7 @@ S32 LLScriptStateExitEvent::getSize() return 0; } -void LLScriptTouchStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptTouchStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1388,6 +1593,7 @@ void LLScriptTouchStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo break; break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "touch_start"); if (scope->checkEntry(mCount->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1412,11 +1618,18 @@ void LLScriptTouchStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "touch_start"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "touch_start( int32 "); + mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; + break; default: mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1429,7 +1642,7 @@ S32 LLScriptTouchStartEvent::getSize() return 4; } -void LLScriptTouchEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptTouchEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1446,6 +1659,7 @@ void LLScriptTouchEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile break; break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "touch"); if (scope->checkEntry(mCount->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1470,11 +1684,18 @@ void LLScriptTouchEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "touch"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "touch( int32 "); + mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; + break; default: mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1487,7 +1708,7 @@ S32 LLScriptTouchEvent::getSize() return 4; } -void LLScriptTouchEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptTouchEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1504,6 +1725,7 @@ void LLScriptTouchEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp break; break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "touch_end"); if (scope->checkEntry(mCount->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1528,11 +1750,18 @@ void LLScriptTouchEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "touch_end"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "touch_end( int32 "); + mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; + break; default: mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1545,7 +1774,7 @@ S32 LLScriptTouchEndEvent::getSize() return 4; } -void LLScriptCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptCollisionStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1562,6 +1791,7 @@ void LLScriptCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRI break; break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "collision_start"); if (scope->checkEntry(mCount->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1586,11 +1816,17 @@ void LLScriptCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRI { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "collision_start"; - chunk->addBytes(name, (S32)strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mCount->mName, (S32)strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, (S32)strlen(name) + 1); + chunk->addBytes(mCount->mName, (S32)strlen(mCount->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "collision_start( int32 "); + mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1603,7 +1839,7 @@ S32 LLScriptCollisionStartEvent::getSize() return 4; } -void LLScriptCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptCollisionEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1620,6 +1856,7 @@ void LLScriptCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom break; break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "collision"); if (scope->checkEntry(mCount->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1644,11 +1881,16 @@ void LLScriptCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "collision"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fprintf(fp, "collision( int32 "); + mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1661,7 +1903,7 @@ S32 LLScriptCollisionEvent::getSize() return 4; } -void LLScriptCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptCollisionEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1678,6 +1920,7 @@ void LLScriptCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT break; break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "collision_end"); if (scope->checkEntry(mCount->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1702,11 +1945,17 @@ void LLScriptCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "collision_end"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mCount->mName, strlen(mCount->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "collision_end( int32 "); + mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mCount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1719,7 +1968,7 @@ S32 LLScriptCollisionEndEvent::getSize() return 4; } -void LLScriptLandCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptLandCollisionStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1735,6 +1984,7 @@ void LLScriptLandCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, L fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "land_collision_start"); if (scope->checkEntry(mPosition->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1759,11 +2009,17 @@ void LLScriptLandCollisionStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, L { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "land_collision_start"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "land_collision_start( class [ScriptTypes]LindenLab.SecondLife.Vector "); + mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1778,7 +2034,7 @@ S32 LLScriptLandCollisionStartEvent::getSize() -void LLScriptLandCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptLandCollisionEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1794,6 +2050,7 @@ void LLScriptLandCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIP fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "land_collision"); if (scope->checkEntry(mPosition->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1818,11 +2075,17 @@ void LLScriptLandCollisionEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIP { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "land_collision"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "land_collision( class [ScriptTypes]LindenLab.SecondLife.Vector "); + mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1836,7 +2099,7 @@ S32 LLScriptLandCollisionEvent::getSize() } -void LLScriptLandCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptLandCollisionEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1852,6 +2115,7 @@ void LLScriptLandCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSC fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "land_collision_end"); if (scope->checkEntry(mPosition->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1875,12 +2139,18 @@ void LLScriptLandCollisionEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSC case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO - char name[] = "land_collision_end"; /*Flawfinder: ignore*/ - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); /*Flawfinder: ignore*/ + char name[] = "land_collision_end"; + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mPosition->mName, strlen(mPosition->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "land_collision_end( class [ScriptTypes]LindenLab.SecondLife.Vector "); + mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1894,7 +2164,7 @@ S32 LLScriptLandCollisionEndEvent::getSize() } -void LLScriptInventoryEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptInventoryEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1910,6 +2180,7 @@ void LLScriptInventoryEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "changed"); if (scope->checkEntry(mChange->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1934,11 +2205,17 @@ void LLScriptInventoryEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "changed"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mChange->mName, strlen(mChange->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mChange->mName, strlen(mChange->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "changed( int32 "); + mChange->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mChange->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -1951,7 +2228,7 @@ S32 LLScriptInventoryEvent::getSize() return 4; } -void LLScriptAttachEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptAttachEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -1967,6 +2244,7 @@ void LLScriptAttachEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "attach"); if (scope->checkEntry(mAttach->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -1991,11 +2269,17 @@ void LLScriptAttachEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "attach"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mAttach->mName, strlen(mAttach->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mAttach->mName, strlen(mAttach->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "attach( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mAttach->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )\n"); + break; default: mAttach->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -2008,7 +2292,7 @@ S32 LLScriptAttachEvent::getSize() return 4; } -void LLScriptDataserverEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptDataserverEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2026,6 +2310,7 @@ void LLScriptDataserverEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "dataserver"); if (scope->checkEntry(mID->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2061,12 +2346,20 @@ void LLScriptDataserverEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "dataserver"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mData->mName, strlen(mData->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mID->mName, strlen(mID->mName) + 1); + chunk->addBytes(mData->mName, strlen(mData->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "dataserver( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mData->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mData->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2080,7 +2373,7 @@ S32 LLScriptDataserverEvent::getSize() return 8; } -void LLScriptTimerEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptTimerEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2095,14 +2388,21 @@ void LLScriptTimerEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile case LSCP_EMIT_ASSEMBLY: fprintf(fp, "timer()\n"); break; + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "timer"); + break; + case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "timer"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fprintf(fp, "timer()"); + break; default: break; } @@ -2113,7 +2413,7 @@ S32 LLScriptTimerEvent::getSize() return 0; } -void LLScriptMovingStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptMovingStartEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2126,14 +2426,21 @@ void LLScriptMovingStartEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTC fdotabs(fp, tabs, tabsize); fprintf(fp, "moving_start()\n"); break; + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "moving_start"); + break; + case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "moving_start"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fprintf(fp, "moving_start()"); + break; default: break; } @@ -2144,7 +2451,7 @@ S32 LLScriptMovingStartEvent::getSize() return 0; } -void LLScriptMovingEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptMovingEndEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2157,14 +2464,21 @@ void LLScriptMovingEndEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom fdotabs(fp, tabs, tabsize); fprintf(fp, "moving_end()\n"); break; + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "moving_end"); + break; + case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "moving_end"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fprintf(fp, "moving_end()"); + break; default: break; } @@ -2175,7 +2489,7 @@ S32 LLScriptMovingEndEvent::getSize() return 0; } -void LLScriptRTPEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptRTPEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2191,6 +2505,7 @@ void LLScriptRTPEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "run_time_perms"); if (scope->checkEntry(mRTPermissions->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2215,11 +2530,18 @@ void LLScriptRTPEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "chat"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mRTPermissions->mName, strlen(mRTPermissions->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mRTPermissions->mName, strlen(mRTPermissions->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + // NOTE: Not replicating LSL2 bug by calling RTP event hander "chat" + fdotabs(fp, tabs, tabsize); + fprintf(fp, "run_time_perms( int32 "); + mRTPermissions->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mRTPermissions->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -2232,7 +2554,7 @@ S32 LLScriptRTPEvent::getSize() return 4; } -void LLScriptChatEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptChatEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2254,6 +2576,7 @@ void LLScriptChatEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "listen"); // note: this is actually listen in lsl source if (scope->checkEntry(mChannel->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2311,14 +2634,26 @@ void LLScriptChatEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "chat"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mMessage->mName, strlen(mMessage->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); + chunk->addBytes(mName->mName, strlen(mName->mName) + 1); + chunk->addBytes(mID->mName, strlen(mID->mName) + 1); + chunk->addBytes(mMessage->mName, strlen(mMessage->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "chat( int32 "); + mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mMessage->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2334,7 +2669,7 @@ S32 LLScriptChatEvent::getSize() return 16; } -void LLScriptSensorEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptSensorEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2350,6 +2685,7 @@ void LLScriptSensorEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "sensor"); if (scope->checkEntry(mNumber->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2374,11 +2710,17 @@ void LLScriptSensorEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "sensor"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "sensor( int32 "); + mNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -2391,7 +2733,7 @@ S32 LLScriptSensorEvent::getSize() return 4; } -void LLScriptObjectRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptObjectRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2407,6 +2749,7 @@ void LLScriptObjectRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "object_rez"); if (scope->checkEntry(mID->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2431,11 +2774,17 @@ void LLScriptObjectRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "sensor"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mID->mName, strlen(mID->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "object_rez( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -2448,7 +2797,7 @@ S32 LLScriptObjectRezEvent::getSize() return 4; } -void LLScriptControlEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptControlEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2468,6 +2817,7 @@ void LLScriptControlEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "control"); if (scope->checkEntry(mName->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2514,13 +2864,23 @@ void LLScriptControlEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "control"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mLevels->mName, strlen(mLevels->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mEdges->mName, strlen(mEdges->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mName->mName, strlen(mName->mName) + 1); + chunk->addBytes(mLevels->mName, strlen(mLevels->mName) + 1); + chunk->addBytes(mEdges->mName, strlen(mEdges->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "control( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", int32 "); + mLevels->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", int32 "); + mEdges->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mLevels->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2535,7 +2895,7 @@ S32 LLScriptControlEvent::getSize() return 12; } -void LLScriptLinkMessageEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptLinkMessageEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2557,6 +2917,7 @@ void LLScriptLinkMessageEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTC fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "link_message"); if (scope->checkEntry(mSender->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2614,14 +2975,26 @@ void LLScriptLinkMessageEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTC { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "link_message"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mNum->mName, strlen(mNum->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mStr->mName, strlen(mStr->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mID->mName, strlen(mID->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); + chunk->addBytes(mNum->mName, strlen(mNum->mName) + 1); + chunk->addBytes(mStr->mName, strlen(mStr->mName) + 1); + chunk->addBytes(mID->mName, strlen(mID->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "link_message( int32 "); + mSender->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", int32 "); + mNum->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mStr->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mSender->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mNum->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2637,7 +3010,7 @@ S32 LLScriptLinkMessageEvent::getSize() return 16; } -void LLScriptRemoteEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptRemoteEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2663,6 +3036,7 @@ void LLScriptRemoteEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "remote_event"); if (scope->checkEntry(mType->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2742,16 +3116,32 @@ void LLScriptRemoteEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "remote_event"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mType->mName, strlen(mType->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mMessageID->mName, strlen(mMessageID->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mIntVal->mName, strlen(mIntVal->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mStrVal->mName, strlen(mStrVal->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mType->mName, strlen(mType->mName) + 1); + chunk->addBytes(mChannel->mName, strlen(mChannel->mName) + 1); + chunk->addBytes(mMessageID->mName, strlen(mMessageID->mName) + 1); + chunk->addBytes(mSender->mName, strlen(mSender->mName) + 1); + chunk->addBytes(mIntVal->mName, strlen(mIntVal->mName) + 1); + chunk->addBytes(mStrVal->mName, strlen(mStrVal->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "remote_event( int32 "); + mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mMessageID->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mSender->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", int32 "); + mIntVal->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mStrVal->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mChannel->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2769,7 +3159,7 @@ S32 LLScriptRemoteEvent::getSize() return 24; } -void LLScriptHTTPResponseEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptHTTPResponseEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2784,7 +3174,7 @@ void LLScriptHTTPResponseEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, ", integer "); mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, ", list "); + fprintf(fp, ", class [mscorlib]System.Collections.ArrayList "); mMetadata->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, ", string "); mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2792,6 +3182,7 @@ void LLScriptHTTPResponseEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "http_response"); if (scope->checkEntry(mRequestId->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2857,15 +3248,26 @@ void LLScriptHTTPResponseEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "http_response"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mStatus->mName, strlen(mStatus->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mMetadata->mName, strlen(mMetadata->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1); + chunk->addBytes(mStatus->mName, strlen(mStatus->mName) + 1); + chunk->addBytes(mMetadata->mName, strlen(mMetadata->mName) + 1); + chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); #endif } break; - + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "http_response( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", int32 "); + mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", class [mscorlib]System.Collections.ArrayList "); + mMetadata->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )\n"); + break; default: mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mStatus->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2881,8 +3283,112 @@ S32 LLScriptHTTPResponseEvent::getSize() return 16; } +void LLScriptHTTPRequestEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +{ + if (gErrorToText.getErrors()) + { + return; + } + switch(pass) + { + case LSCP_PRETTY_PRINT: + case LSCP_EMIT_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "http_request( key "); + mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mMethod->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )\n"); + break; + + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "http_request"); + if (scope->checkEntry(mRequestId->mName)) + { + gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); + } + else + { + mRequestId->mScopeEntry = scope->addEntry(mRequestId->mName, LIT_VARIABLE, LST_KEY); + } + + if (scope->checkEntry(mMethod->mName)) + { + gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); + } + else + { + mMethod->mScopeEntry = scope->addEntry(mMethod->mName, LIT_VARIABLE, LST_STRING); + } + + if (scope->checkEntry(mBody->mName)) + { + gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); + } + else + { + mBody->mScopeEntry = scope->addEntry(mBody->mName, LIT_VARIABLE, LST_STRING); + } + break; + + case LSCP_RESOURCE: + { + // we're just tryng to determine how much space the variable needs + if (mRequestId->mScopeEntry) + { + mRequestId->mScopeEntry->mOffset = (S32)count; + mRequestId->mScopeEntry->mSize = 4; + count += mRequestId->mScopeEntry->mSize; + + mMethod->mScopeEntry->mOffset = (S32)count; + mMethod->mScopeEntry->mSize = 4; + count += mMethod->mScopeEntry->mSize; + + mBody->mScopeEntry->mOffset = (S32)count; + mBody->mScopeEntry->mSize = 4; + count += mBody->mScopeEntry->mSize; + } + } + break; + + case LSCP_EMIT_BYTE_CODE: + { +#ifdef LSL_INCLUDE_DEBUG_INFO + char name[] = "http_request"; + chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mMethod->mName, strlen(mMethod->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/ +#endif + } + break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "http_request( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mMethod->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )\n"); + break; + default: + mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mMethod->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + break; + } +} + +S32 LLScriptHTTPRequestEvent::getSize() +{ + // key + string + string = 12 + return 12; +} -void LLScriptMoneyEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptMoneyEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2900,6 +3406,7 @@ void LLScriptMoneyEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "money"); if (scope->checkEntry(mName->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -2935,12 +3442,20 @@ void LLScriptMoneyEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "money"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mName->mName, strlen(mName->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mAmount->mName, strlen(mAmount->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mName->mName, strlen(mName->mName) + 1); + chunk->addBytes(mAmount->mName, strlen(mAmount->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "money( valuetype [ScriptTypes]LindenLab.SecondLife.Key "); + mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", int32 "); + mAmount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mName->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mAmount->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -2954,7 +3469,7 @@ S32 LLScriptMoneyEvent::getSize() return 8; } -void LLScriptEmailEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptEmailEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -2978,6 +3493,7 @@ void LLScriptEmailEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "email"); if (scope->checkEntry(mTime->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -3046,15 +3562,29 @@ void LLScriptEmailEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "email"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mTime->mName, strlen(mTime->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mAddress->mName, strlen(mAddress->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mSubject->mName, strlen(mSubject->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mTime->mName, strlen(mTime->mName) + 1); + chunk->addBytes(mAddress->mName, strlen(mAddress->mName) + 1); + chunk->addBytes(mSubject->mName, strlen(mSubject->mName) + 1); + chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); + chunk->addBytes(mNumber->mName, strlen(mNumber->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "email( string "); + mTime->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mAddress->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mSubject->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", string "); + mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", int32 "); + mNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mTime->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mAddress->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -3071,7 +3601,7 @@ S32 LLScriptEmailEvent::getSize() return 20; } -void LLScriptRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3087,6 +3617,7 @@ void LLScriptRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "on_rez"); if (scope->checkEntry(mStartParam->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -3111,11 +3642,17 @@ void LLScriptRezEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "rez"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mStartParam->mName, strlen(mStartParam->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mStartParam->mName, strlen(mStartParam->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "rez( int32 "); + mStartParam->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mStartParam->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -3128,7 +3665,7 @@ S32 LLScriptRezEvent::getSize() return 4; } -void LLScriptNoSensorEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptNoSensorEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3143,14 +3680,20 @@ void LLScriptNoSensorEvent::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp case LSCP_EMIT_ASSEMBLY: fprintf(fp, "no_sensor()\n"); break; - case LSCP_EMIT_BYTE_CODE: + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "no_sensor"); + break; + case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "no_sensor"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fprintf(fp, "no_sensor()"); + break; default: break; } @@ -3161,7 +3704,7 @@ S32 LLScriptNoSensorEvent::getSize() return 0; } -void LLScriptAtTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptAtTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3181,6 +3724,7 @@ void LLScriptAtTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "at_target"); if (scope->checkEntry(mTargetNumber->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -3226,14 +3770,24 @@ void LLScriptAtTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO - char name[] = "at_target"; /*Flawfinder: ignore*/ - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mTargetPosition->mName, strlen(mTargetPosition->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mOurPosition->mName, strlen(mOurPosition->mName) + 1); /*Flawfinder: ignore*/ + char name[] = "at_target"; + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); + chunk->addBytes(mTargetPosition->mName, strlen(mTargetPosition->mName) + 1); + chunk->addBytes(mOurPosition->mName, strlen(mOurPosition->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "at_target( int32 "); + mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Vector "); + mTargetPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Vector "); + mOurPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mTargetPosition->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -3250,7 +3804,7 @@ S32 LLScriptAtTarget::getSize() -void LLScriptNotAtTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptNotAtTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3265,14 +3819,21 @@ void LLScriptNotAtTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil case LSCP_EMIT_ASSEMBLY: fprintf(fp, "not_at_target()\n"); break; + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "not_at_target"); + break; + case LSCP_EMIT_BYTE_CODE: { #ifdef LSL_INCLUDE_DEBUG_INFO - char name[] = "not_at_target"; /*Flawfinder: ignore*/ - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + char name[] = "not_at_target"; + chunk->addBytes(name, strlen(name) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fprintf(fp, "not_at_target()"); + break; default: break; } @@ -3283,7 +3844,7 @@ S32 LLScriptNotAtTarget::getSize() return 0; } -void LLScriptAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptAtRotTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3294,7 +3855,7 @@ void LLScriptAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil case LSCP_PRETTY_PRINT: case LSCP_EMIT_ASSEMBLY: fdotabs(fp, tabs, tabsize); - fprintf(fp, "at_target( integer "); + fprintf(fp, "at_rot_target( integer "); mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, ", quaternion "); mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -3303,6 +3864,7 @@ void LLScriptAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil fprintf(fp, " )\n"); break; case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "at_rot_target"); if (scope->checkEntry(mTargetNumber->mName)) { gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); @@ -3349,13 +3911,23 @@ void LLScriptAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "at_rot_target"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mTargetRotation->mName, strlen(mTargetRotation->mName) + 1); /*Flawfinder: ignore*/ - chunk->addBytes(mOurRotation->mName, strlen(mOurRotation->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); + chunk->addBytes(mTargetNumber->mName, strlen(mTargetNumber->mName) + 1); + chunk->addBytes(mTargetRotation->mName, strlen(mTargetRotation->mName) + 1); + chunk->addBytes(mOurRotation->mName, strlen(mOurRotation->mName) + 1); #endif } break; + case LSCP_EMIT_CIL_ASSEMBLY: + fdotabs(fp, tabs, tabsize); + fprintf(fp, "at_rot_target( int32 "); + mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Quaternion "); + mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, ", class [ScriptTypes]LindenLab.SecondLife.Quaternion "); + mOurRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " )"); + break; default: mTargetNumber->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mTargetRotation->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -3372,7 +3944,7 @@ S32 LLScriptAtRotTarget::getSize() -void LLScriptNotAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptNotAtRotTarget::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3391,10 +3963,17 @@ void LLScriptNotAtRotTarget::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom { #ifdef LSL_INCLUDE_DEBUG_INFO char name[] = "not_at_rot_target"; - chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(name, strlen(name) + 1); #endif } break; + case LSCP_SCOPE_PASS1: + checkForDuplicateHandler(fp, this, scope, "not_at_rot_target"); + break; + + case LSCP_EMIT_CIL_ASSEMBLY: + fprintf(fp, "not_at_rot_target()"); + break; default: break; } @@ -3416,7 +3995,7 @@ void LLScriptExpression::addExpression(LLScriptExpression *expression) mNextp = expression; } -void LLScriptExpression::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptExpression::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { fprintf(fp, "Expression Base Class -- should never get here!\n"); } @@ -3427,7 +4006,7 @@ S32 LLScriptExpression::getSize() return 0; } -void LLScriptExpression::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptExpression::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3451,7 +4030,7 @@ void LLScriptExpression::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP } } -void LLScriptForExpressionList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptForExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3563,7 +4142,26 @@ S32 LLScriptForExpressionList::getSize() return 0; } -void LLScriptFuncExpressionList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +// CIL code generation requires both caller and callee scope entries, so cannot use normal recurse signature. +// TODO: Refactor general purpose recurse calls in to pass specific virtuals using visitor pattern to select method by pass and node type. +static void print_cil_func_expression_list(LLScriptFuncExpressionList* self, LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata, LLScriptScopeEntry *callee_entry) +{ + self->mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + LSCRIPTType argtype = callee_entry->mFunctionArgs.getType(entrycount); + if (argtype != self->mFirstp->mReturnType) + { + print_cil_cast(fp, self->mFirstp->mReturnType, argtype); + } + entrycount++; + if (self->mSecondp) + { + llassert(LET_FUNC_EXPRESSION_LIST == self->mSecondp->mType); + print_cil_func_expression_list((LLScriptFuncExpressionList*) self->mSecondp, fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL, callee_entry); + + } +} + +void LLScriptFuncExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3660,31 +4258,6 @@ void LLScriptFuncExpressionList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIP } } break; - /* TODO: Fix conflict between global/local variable determination needing caller scope and cast determination here needs callee scope... - case LSCP_EMIT_CIL_ASSEMBLY: - { - mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - LSCRIPTType argtype = entry->mFunctionArgs.getType(entrycount); - if (argtype != mFirstp->mReturnType) - { - print_cil_cast(fp, mFirstp->mReturnType, argtype); - } - entrycount++; - if (mSecondp) - { - mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if (mSecondp->mReturnType) - { - argtype = entry->mFunctionArgs.getType(entrycount); - if (argtype != mSecondp->mReturnType) - { - print_cil_cast(fp, mFirstp->mReturnType, argtype); - } - } - } - } - break; - */ default: mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); if (mSecondp) @@ -3700,7 +4273,7 @@ S32 LLScriptFuncExpressionList::getSize() return 0; } -void LLScriptListExpressionList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptListExpressionList::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -3753,8 +4326,13 @@ void LLScriptListExpressionList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIP } break; case LSCP_EMIT_CIL_ASSEMBLY: - // Evaluate expressions in reverse order so first expression is on top of stack. - // Results can then be popped and appended to list to result in list with correct order. + mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + if (mFirstp->mType != LET_LIST_EXPRESSION_LIST) + { + // Box value. + print_cil_box(fp, mFirstp->mReturnType); + ++count; + } if (mSecondp) { mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -3762,18 +4340,9 @@ void LLScriptListExpressionList::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIP { // Box value. print_cil_box(fp, mSecondp->mReturnType); - ++count; } } - mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if (mFirstp->mType != LET_LIST_EXPRESSION_LIST) - { - // Box value. - print_cil_box(fp, mFirstp->mReturnType); - - ++count; - } break; default: mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -3793,14 +4362,22 @@ S32 LLScriptListExpressionList::getSize() // Returns true if identifier is a parameter and false if identifier is a local variable within function_scope. bool is_parameter(LLScriptIdentifier* identifier, LLScriptScopeEntry* function_scope) { - // Function offset stores offset of first local. - // Compare variable offset with function offset to - // determine whether variable is local or parameter. - return (identifier->mScopeEntry->mOffset < function_scope->mOffset); + // Function stores offset of first local. + if(0 == function_scope->mOffset) + { + // Function offset 0 -> no parameters -> identifier is a local. + return false; + } + else + { + // Compare variable offset with function offset to + // determine whether variable is local or parameter. + return (identifier->mScopeEntry->mOffset < function_scope->mOffset); + } } // If assignment is to global variable, pushes this pointer on to stack. -void print_cil_load_address(FILE* fp, LLScriptExpression* exp, LLScriptScopeEntry* function_scope) +static void print_cil_load_address(LLFILE* fp, LLScriptExpression* exp, LLScriptScopeEntry* function_scope) { LLScriptLValue *lvalue = (LLScriptLValue *) exp; LLScriptIdentifier *ident = lvalue->mIdentifier; @@ -3811,7 +4388,7 @@ void print_cil_load_address(FILE* fp, LLScriptExpression* exp, LLScriptScopeEntr fprintf(fp, "ldarg.0\n"); } - // If accessor, load address of object. + // If accessor, load value type address, consumed by ldfld. if(lvalue->mAccessor) { if(ident->mScopeEntry->mIDType == LIT_VARIABLE) @@ -3819,7 +4396,7 @@ void print_cil_load_address(FILE* fp, LLScriptExpression* exp, LLScriptScopeEntr if(is_parameter(ident, function_scope)) { // Parameter, load by name. - fprintf(fp, "ldarga.s %s\n", ident->mScopeEntry->mIdentifier); + fprintf(fp, "ldarga.s '%s'\n", ident->mScopeEntry->mIdentifier); } else { @@ -3830,13 +4407,13 @@ void print_cil_load_address(FILE* fp, LLScriptExpression* exp, LLScriptScopeEntr else if (ident->mScopeEntry->mIDType == LIT_GLOBAL) { fprintf(fp, "ldflda "); - print_cil_type(fp, ident->mScopeEntry->mType); - fprintf(fp, " LSL::%s\n", ident->mScopeEntry->mIdentifier); + print_cil_member(fp, ident); } } } -void print_cil_accessor(FILE* fp, LLScriptLValue *lvalue) +static void print_cil_accessor(LLFILE* fp, LLScriptLValue *lvalue) + { LLScriptIdentifier *ident = lvalue->mIdentifier; print_cil_type(fp, lvalue->mReturnType); @@ -3845,13 +4422,7 @@ void print_cil_accessor(FILE* fp, LLScriptLValue *lvalue) fprintf(fp, "::%s\n", lvalue->mAccessor->mName); } -void print_cil_member(FILE* fp, LLScriptIdentifier *ident) -{ - print_cil_type(fp, ident->mScopeEntry->mType); - fprintf(fp, " LSL::%s\n", ident->mScopeEntry->mIdentifier); -} - -void LLScriptLValue::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptLValue::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -4106,7 +4677,7 @@ void LLScriptLValue::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass if(is_parameter(mIdentifier, entry)) { // Parameter, load by name. - fprintf(fp, "ldarg.s %s\n", mIdentifier->mScopeEntry->mIdentifier); + fprintf(fp, "ldarg.s '%s'\n", mIdentifier->mScopeEntry->mIdentifier); } else { @@ -4136,7 +4707,7 @@ S32 LLScriptLValue::getSize() return 0; } -void print_asignment(FILE *fp, LLScriptExpression *exp) +static void print_assignment(LLFILE *fp, LLScriptExpression *exp) { LLScriptLValue *lvalue = (LLScriptLValue *)exp; LLScriptIdentifier *ident = lvalue->mIdentifier; @@ -4164,7 +4735,7 @@ void print_asignment(FILE *fp, LLScriptExpression *exp) } } -void print_cil_asignment(FILE *fp, LLScriptExpression *exp, LLScriptScopeEntry* function_scope) +static void print_cil_assignment(LLFILE *fp, LLScriptExpression *exp, LLScriptScopeEntry* function_scope) { LLScriptLValue *lvalue = (LLScriptLValue *) exp; LLScriptIdentifier *ident = lvalue->mIdentifier; @@ -4191,7 +4762,7 @@ void print_cil_asignment(FILE *fp, LLScriptExpression *exp, LLScriptScopeEntry* if(is_parameter(ident, function_scope)) { // Parameter, store by name. - fprintf(fp, "starg.s %s\n", ident->mScopeEntry->mIdentifier); + fprintf(fp, "starg.s '%s'\n", ident->mScopeEntry->mIdentifier); } else { @@ -4215,7 +4786,7 @@ void print_cil_asignment(FILE *fp, LLScriptExpression *exp, LLScriptScopeEntry* } } -void print_cast(FILE *fp, LSCRIPTType ret_type, LSCRIPTType right_type) +void print_cast(LLFILE *fp, LSCRIPTType ret_type, LSCRIPTType right_type) { if (right_type != ret_type) { @@ -4319,15 +4890,7 @@ void store2stack(LLScriptExpression *exp, LLScriptExpression *lv, LLScriptByteCo chunk->addInteger(address); } -void print_cil_numeric_cast(FILE* fp, LSCRIPTType currentArg, LSCRIPTType otherArg) -{ - if((currentArg == LST_INTEGER) && (otherArg == LST_FLOATINGPOINT)) - { - print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); - } -} - -void LLScriptAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -4344,7 +4907,7 @@ void LLScriptAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile { mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cast(fp, mReturnType, mRightType); - print_asignment(fp, mLValue); + print_assignment(fp, mLValue); } break; case LSCP_TYPE: @@ -4370,8 +4933,8 @@ void LLScriptAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile { print_cil_load_address(fp, mLValue, entry); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mRightType, mReturnType); - print_cil_asignment(fp, mLValue, entry); + print_cil_assignment_cast(fp, mRightType, mReturnType); + print_cil_assignment(fp, mLValue, entry); } break; default: @@ -4387,8 +4950,15 @@ S32 LLScriptAssignment::getSize() return 0; } -void print_cil_add(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) +static void print_cil_add(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) { + if(LST_LIST == right_type && LST_LIST != left_type) + { + print_cil_box(fp, left_type); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Prepend(class [mscorlib]System.Collections.ArrayList, object)\n"); + return; + } + switch(left_type) { case LST_INTEGER: @@ -4402,34 +4972,56 @@ void print_cil_add(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) case LST_KEY: // String concatenation. - fprintf(fp, "call string valuetype [mscorlib]System.String::Concat(string, string)"); + fprintf(fp, "call string valuetype [LslUserScript]LindenLab.SecondLife.LslUserScript::Add(string, string)\n"); break; case LST_VECTOR: // Vector addition. - // TODO: Inline (requires temporary variables, which must be identified in earlier pass). - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'add_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Add'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; case LST_QUATERNION: // Rotation addition. - // TODO: Inline (requires temporary variables, which must be identified in earlier pass). - fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'add_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Add'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); break; case LST_LIST: - print_cil_box(fp, right_type); - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::AddReturnList(class [mscorlib]System.Collections.ArrayList, object)\n"); - break; + switch(right_type) + { + case LST_LIST: + // Concatenate lists. + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); + break; + case LST_INTEGER: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(int32, class [mscorlib]System.Collections.ArrayList)\n"); + break; + case LST_FLOATINGPOINT: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(float32, class [mscorlib]System.Collections.ArrayList)\n"); + break; + case LST_STRING: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(string, class [mscorlib]System.Collections.ArrayList)\n"); + break; + case LST_KEY: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(valuetype [ScriptTypes]LindenLab.SecondLife.Key, class [mscorlib]System.Collections.ArrayList)\n"); + break; + case LST_VECTOR: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(valuetype [ScriptTypes]LindenLab.SecondLife.Vector, class [mscorlib]System.Collections.ArrayList)\n"); + break; + case LST_QUATERNION: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Append(valuetype [ScriptTypes]LindenLab.SecondLife.Quaternion, class [mscorlib]System.Collections.ArrayList)\n"); + break; + default: + break; + } default: break; } } -void LLScriptAddAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptAddAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -4447,7 +5039,7 @@ void LLScriptAddAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "ADD %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); - print_asignment(fp, mLValue); + print_assignment(fp, mLValue); } break; case LSCP_TYPE: @@ -4475,12 +5067,12 @@ void LLScriptAddAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp case LSCP_EMIT_CIL_ASSEMBLY: { print_cil_load_address(fp, mLValue, entry); - mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); + mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); print_cil_add(fp, mLValue->mReturnType, mRightSide->mReturnType); - print_cil_asignment(fp, mLValue, entry); + print_cil_assignment(fp, mLValue, entry); } break; default: @@ -4496,29 +5088,30 @@ S32 LLScriptAddAssignment::getSize() return 0; } -void print_cil_sub(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) +static void print_cil_sub(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) { switch(left_type) { case LST_INTEGER: + if(LST_INTEGER == right_type) + { + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Subtract(int32, int32)\n"); + break; + } case LST_FLOATINGPOINT: - // Numeric subtraction. - fprintf(fp, "sub\n"); + fprintf(fp, "call float64 [LslUserScript]LindenLab.SecondLife.LslUserScript::Subtract(float64, float64)\n"); break; - case LST_VECTOR: // Vector subtraction. - // TODO: Inline (requires temporary variables, which must be identified in earlier pass). - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'subtract_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Subtract'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; case LST_QUATERNION: // Rotation subtraction. - // TODO: Inline (requires temporary variables, which must be identified in earlier pass). - fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'subtract_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Subtract'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); break; default: @@ -4528,7 +5121,7 @@ void print_cil_sub(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) } } -void LLScriptSubAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptSubAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -4546,7 +5139,7 @@ void LLScriptSubAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "SUB %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); - print_asignment(fp, mLValue); + print_assignment(fp, mLValue); } break; case LSCP_TYPE: @@ -4574,12 +5167,12 @@ void LLScriptSubAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp case LSCP_EMIT_CIL_ASSEMBLY: { print_cil_load_address(fp, mLValue, entry); - mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); + mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); print_cil_sub(fp, mLValue->mReturnType, mRightSide->mReturnType); - print_cil_asignment(fp, mLValue, entry); + print_cil_assignment(fp, mLValue, entry); } break; default: @@ -4595,41 +5188,93 @@ S32 LLScriptSubAssignment::getSize() return 0; } -void print_cil_mul(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) +static void print_cil_neg(LLFILE* fp, LSCRIPTType type) { - switch(left_type) + switch(type) { case LST_INTEGER: case LST_FLOATINGPOINT: + fprintf(fp, "neg\n"); + break; + case LST_VECTOR: + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Negate'(class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); + break; + case LST_QUATERNION: + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Negate'(class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); + break; + default: + break; + } +} + +static void print_cil_mul(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) +{ + switch(left_type) + { + case LST_INTEGER: + + switch(right_type) + { + case LST_INTEGER: + case LST_FLOATINGPOINT: + + // Numeric multiplication. + fprintf(fp, "mul\n"); + break; + + case LST_VECTOR: - // Numeric multiplication. - fprintf(fp, "mul\n"); + // Vector scaling. + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Vector, float32)\n"); + break; + default: + break; + } break; - - case LST_VECTOR: + + case LST_FLOATINGPOINT: switch(right_type) { case LST_INTEGER: + case LST_FLOATINGPOINT: - print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); + // Numeric multiplication. + fprintf(fp, "mul\n"); + break; + + case LST_VECTOR: + + // Vector scaling. + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Vector, float32)\n"); + break; + default: + break; + } + break; + + case LST_VECTOR: + + switch(right_type) + { + case LST_INTEGER: case LST_FLOATINGPOINT: // Vector scaling. - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'multiply_float'(valuetype [LScriptLibrary]LLVector, float32)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(float32, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; case LST_VECTOR: // Dot product. - fprintf(fp, "call float32 valuetype [LScriptLibrary]LLVector::'multiply_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); + fprintf(fp, "call float32 class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; case LST_QUATERNION: // Vector rotation. - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'multiply_quat'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; default: @@ -4640,7 +5285,7 @@ void print_cil_mul(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) case LST_QUATERNION: // Rotation multiplication. - fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'multiply_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Multiply'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); break; default: @@ -4650,7 +5295,7 @@ void print_cil_mul(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) } } -void LLScriptMulAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptMulAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -4668,7 +5313,7 @@ void LLScriptMulAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "MUL %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); - print_asignment(fp, mLValue); + print_assignment(fp, mLValue); } break; case LSCP_TYPE: @@ -4677,7 +5322,7 @@ void LLScriptMulAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp mLeftType = type; mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightType = type; - if (!legal_binary_expression(mReturnType, mLeftType, mRightType, mType)) + if (!legal_binary_expression(mReturnType, mLeftType, mRightType, mType) /*|| !legal_assignment(mLValue->mReturnType, mReturnType)*/) { gErrorToText.writeError(fp, this, LSERROR_TYPE_MISMATCH); } @@ -4696,12 +5341,17 @@ void LLScriptMulAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp case LSCP_EMIT_CIL_ASSEMBLY: { print_cil_load_address(fp, mLValue, entry); - mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); + mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); print_cil_mul(fp, mLValue->mReturnType, mRightSide->mReturnType); - print_cil_asignment(fp, mLValue, entry); + if((mLValue->mReturnType == LST_INTEGER) && + (mRightSide->mReturnType == LST_FLOATINGPOINT)) + { + print_cil_cast(fp, LST_FLOATINGPOINT, LST_INTEGER); + } + print_cil_assignment(fp, mLValue, entry); } break; default: @@ -4717,15 +5367,20 @@ S32 LLScriptMulAssignment::getSize() return 0; } -void print_cil_div(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) +static void print_cil_div(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) { switch(left_type) { case LST_INTEGER: + if(LST_INTEGER == right_type) + { + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Divide(int32, int32)\n"); + break; + } case LST_FLOATINGPOINT: - // Numeric addition. - fprintf(fp, "div\n"); + // Numeric division. + fprintf(fp, "call float64 [LslUserScript]LindenLab.SecondLife.LslUserScript::Divide(float64, float64)\n"); break; case LST_VECTOR: @@ -4733,19 +5388,16 @@ void print_cil_div(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) switch(right_type) { case LST_INTEGER: - - print_cil_cast(fp, LST_INTEGER, LST_FLOATINGPOINT); - case LST_FLOATINGPOINT: // Scale. - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'divide_float'(valuetype [LScriptLibrary]LLVector, float32)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Divide'(float32, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; case LST_QUATERNION: // Inverse rotation. - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'divide_quat'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Divide'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; default: @@ -4755,7 +5407,7 @@ void print_cil_div(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) case LST_QUATERNION: - fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'divide_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Divide'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); break; default: @@ -4765,7 +5417,7 @@ void print_cil_div(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) } } -void LLScriptDivAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptDivAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -4783,7 +5435,7 @@ void LLScriptDivAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "DIV %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); - print_asignment(fp, mLValue); + print_assignment(fp, mLValue); } break; case LSCP_TYPE: @@ -4811,12 +5463,12 @@ void LLScriptDivAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp case LSCP_EMIT_CIL_ASSEMBLY: { print_cil_load_address(fp, mLValue, entry); - mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLValue->mReturnType); + mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLValue->mReturnType, mRightSide->mReturnType); print_cil_div(fp, mLValue->mReturnType, mRightSide->mReturnType); - print_cil_asignment(fp, mLValue, entry); + print_cil_assignment(fp, mLValue, entry); } break; default: @@ -4832,20 +5484,20 @@ S32 LLScriptDivAssignment::getSize() return 0; } -void print_cil_mod(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) +static void print_cil_mod(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) { switch(left_type) { case LST_INTEGER: // Numeric remainder. - fprintf(fp, "rem\n"); + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Modulo(int32, int32)\n"); break; case LST_VECTOR: // Vector cross product. - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'mod_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'Modulo'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; default: @@ -4855,7 +5507,7 @@ void print_cil_mod(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) } } -void LLScriptModAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptModAssignment::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -4873,7 +5525,7 @@ void LLScriptModAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "MOD %s, %s\n", LSCRIPTTypeNames[mRightType], LSCRIPTTypeNames[mLeftType]); - print_asignment(fp, mLValue); + print_assignment(fp, mLValue); } break; case LSCP_TYPE: @@ -4901,10 +5553,10 @@ void LLScriptModAssignment::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp case LSCP_EMIT_CIL_ASSEMBLY: { print_cil_load_address(fp, mLValue, entry); - mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mLValue->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_mod(fp, mLValue->mReturnType, mRightSide->mReturnType); - print_cil_asignment(fp, mLValue, entry); + print_cil_assignment(fp, mLValue, entry); } break; default: @@ -4920,9 +5572,10 @@ S32 LLScriptModAssignment::getSize() return 0; } -void print_cil_eq(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) +static void print_cil_eq(LLFILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) { - switch(left_type) + + switch(right_type) { case LST_INTEGER: case LST_FLOATINGPOINT: @@ -4932,26 +5585,36 @@ void print_cil_eq(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) break; case LST_STRING: - case LST_KEY: - + // NOTE: babbage: strings and keys can be compared, so a cast + // may be required + print_cil_cast(fp, left_type, right_type); // String equality. fprintf(fp, "call bool valuetype [mscorlib]System.String::op_Equality(string, string)\n"); break; + + case LST_KEY: + // NOTE: babbage: strings and keys can be compared, so a cast + // may be required + print_cil_cast(fp, left_type, right_type); + + // Key equality. + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(valuetype [ScriptTypes]LindenLab.SecondLife.Key, valuetype [ScriptTypes]LindenLab.SecondLife.Key)\n"); + break; case LST_VECTOR: // Vector equality. - fprintf(fp, "call bool [LScriptLibrary]LLVector::'equals_vec'(valuetype [LScriptLibrary]LLVector, valuetype [LScriptLibrary]LLVector)\n"); + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); break; case LST_QUATERNION: // Rotation equality. - fprintf(fp, "call bool [LScriptLibrary]LLQuaternion::'equals_quat'(valuetype [LScriptLibrary]LLQuaternion, valuetype [LScriptLibrary]LLQuaternion)\n"); + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); break; case LST_LIST: - fprintf(fp, "call bool [LScriptLibrary]LScriptInternal::EqualsList(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::Equals(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); break; default: @@ -4961,7 +5624,7 @@ void print_cil_eq(FILE* fp, LSCRIPTType left_type, LSCRIPTType right_type) } } -void LLScriptEquality::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptEquality::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5002,10 +5665,10 @@ void LLScriptEquality::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); print_cil_eq(fp, mLeftSide->mReturnType, mRightSide->mReturnType); break; default: @@ -5021,7 +5684,7 @@ S32 LLScriptEquality::getSize() return 0; } -void LLScriptNotEquals::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptNotEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5063,10 +5726,19 @@ void LLScriptNotEquals::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP break; case LSCP_EMIT_CIL_ASSEMBLY: mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "ceq\n"); - fprintf(fp, "ldc.i4.0\n"); - fprintf(fp, "ceq\n"); // Compare result of first compare equal with 0 to get compare not equal. + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); + if (LST_LIST == mLeftSide->mReturnType) + { + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::NotEquals(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); + } + else + { + print_cil_eq(fp, mLeftSide->mReturnType, mRightSide->mReturnType); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); // Compare result of first compare equal with 0 to get compare not equal. + } break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5081,7 +5753,15 @@ S32 LLScriptNotEquals::getSize() return 0; } -void LLScriptLessEquals::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +static void print_cil_lte(LLFILE* fp) +{ + // NOTE: LSL pushes operands backwards, so <= becomes >= + fprintf(fp, "clt\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); +} + +void LLScriptLessEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5122,11 +5802,11 @@ void LLScriptLessEquals::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "cgt\n"); // Test greater than. - fprintf(fp, "ldc.i4.0\n"); // Use (b == 0) implementation of boolean not. - fprintf(fp, "ceq\n"); // Apply boolean not to greater than. If not greater than, then less or equal. + print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); + print_cil_lte(fp); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5141,7 +5821,15 @@ S32 LLScriptLessEquals::getSize() return 0; } -void LLScriptGreaterEquals::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +static void print_cil_gte(LLFILE* fp) +{ + // NOTE: LSL pushes operands backwards, so >= becomes <= + fprintf(fp, "cgt\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); +} + +void LLScriptGreaterEquals::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5182,11 +5870,11 @@ void LLScriptGreaterEquals::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "clt\n"); // Test less than. - fprintf(fp, "ldc.i4.0\n"); // Use (b == 0) implementation of boolean not. - fprintf(fp, "ceq\n"); // Apply boolean not to less than. If not less than, then greater or equal. + print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); + print_cil_gte(fp); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5201,7 +5889,13 @@ S32 LLScriptGreaterEquals::getSize() return 0; } -void LLScriptLessThan::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +static void print_cil_lt(LLFILE* fp) +{ + // NOTE: LSL pushes operands backwards, so < becomes > + fprintf(fp, "cgt\n"); +} + +void LLScriptLessThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5242,9 +5936,11 @@ void LLScriptLessThan::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "clt\n"); + print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); + print_cil_lt(fp); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5259,7 +5955,13 @@ S32 LLScriptLessThan::getSize() return 0; } -void LLScriptGreaterThan::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +static void print_cil_gt(LLFILE* fp) +{ + // NOTE: LSL pushes operands backwards, so > becomes < + fprintf(fp, "clt\n"); +} + +void LLScriptGreaterThan::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5300,9 +6002,11 @@ void LLScriptGreaterThan::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "cgt\n"); + print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); + print_cil_gt(fp); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5317,7 +6021,7 @@ S32 LLScriptGreaterThan::getSize() return 0; } -void LLScriptPlus::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptPlus::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5358,10 +6062,10 @@ void LLScriptPlus::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass p } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); print_cil_add(fp, mLeftSide->mReturnType, mRightSide->mReturnType); break; default: @@ -5377,7 +6081,7 @@ S32 LLScriptPlus::getSize() return 0; } -void LLScriptMinus::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptMinus::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5418,10 +6122,10 @@ void LLScriptMinus::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); print_cil_sub(fp, mLeftSide->mReturnType, mRightSide->mReturnType); break; default: @@ -5437,7 +6141,7 @@ S32 LLScriptMinus::getSize() return 0; } -void LLScriptTimes::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptTimes::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5478,10 +6182,10 @@ void LLScriptTimes::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); print_cil_mul(fp, mLeftSide->mReturnType, mRightSide->mReturnType); break; default: @@ -5497,7 +6201,7 @@ S32 LLScriptTimes::getSize() return 0; } -void LLScriptDivide::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptDivide::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5538,10 +6242,10 @@ void LLScriptDivide::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_numeric_cast(fp, mRightSide->mReturnType, mLeftSide->mReturnType); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_numeric_cast(fp, mLeftSide->mReturnType, mRightSide->mReturnType); print_cil_div(fp, mLeftSide->mReturnType, mRightSide->mReturnType); break; default: @@ -5557,7 +6261,7 @@ S32 LLScriptDivide::getSize() return 0; } -void LLScriptMod::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptMod::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5598,8 +6302,8 @@ void LLScriptMod::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pa } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); print_cil_mod(fp, mLeftSide->mReturnType, mRightSide->mReturnType); break; default: @@ -5615,7 +6319,7 @@ S32 LLScriptMod::getSize() return 0; } -void LLScriptBitAnd::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptBitAnd::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5654,8 +6358,8 @@ void LLScriptBitAnd::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "and\n"); break; default: @@ -5671,7 +6375,7 @@ S32 LLScriptBitAnd::getSize() return 0; } -void LLScriptBitOr::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptBitOr::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5710,8 +6414,8 @@ void LLScriptBitOr::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "or\n"); break; default: @@ -5727,7 +6431,7 @@ S32 LLScriptBitOr::getSize() return 0; } -void LLScriptBitXor::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptBitXor::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5766,8 +6470,8 @@ void LLScriptBitXor::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "xor\n"); break; default: @@ -5783,7 +6487,7 @@ S32 LLScriptBitXor::getSize() return 0; } -void LLScriptBooleanAnd::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptBooleanAnd::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5822,9 +6526,15 @@ void LLScriptBooleanAnd::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "and\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + fprintf(fp, "or\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5839,7 +6549,7 @@ S32 LLScriptBooleanAnd::getSize() return 0; } -void LLScriptBooleanOr::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptBooleanOr::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5881,6 +6591,10 @@ void LLScriptBooleanOr::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "or\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5895,7 +6609,7 @@ S32 LLScriptBooleanOr::getSize() return 0; } -void LLScriptShiftLeft::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptShiftLeft::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5934,9 +6648,9 @@ void LLScriptShiftLeft::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "shl\n"); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::ShiftLeft(int32, int32)\n"); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -5952,7 +6666,7 @@ S32 LLScriptShiftLeft::getSize() } -void LLScriptShiftRight::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptShiftRight::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -5991,9 +6705,9 @@ void LLScriptShiftRight::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile } break; case LSCP_EMIT_CIL_ASSEMBLY: - mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mRightSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "shr\n"); + mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "call int32 [LslUserScript]LindenLab.SecondLife.LslUserScript::ShiftRight(int32, int32)\n"); break; default: mLeftSide->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -6008,7 +6722,7 @@ S32 LLScriptShiftRight::getSize() return 0; } -void LLScriptParenthesis::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptParenthesis::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6041,7 +6755,7 @@ S32 LLScriptParenthesis::getSize() return 0; } -void LLScriptUnaryMinus::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptUnaryMinus::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6076,6 +6790,12 @@ void LLScriptUnaryMinus::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile chunk->addByte(typebyte); } break; + case LSCP_EMIT_CIL_ASSEMBLY: + { + mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_neg(fp, mLeftType); + } + break; default: mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -6088,7 +6808,7 @@ S32 LLScriptUnaryMinus::getSize() return 0; } -void LLScriptBooleanNot::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptBooleanNot::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6138,7 +6858,7 @@ S32 LLScriptBooleanNot::getSize() return 0; } -void LLScriptBitNot::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptBitNot::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6187,7 +6907,7 @@ S32 LLScriptBitNot::getSize() return 0; } -void LLScriptPreIncrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptPreIncrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6219,7 +6939,7 @@ void LLScriptPreIncrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi { fprintf(fp, "Unexpected Type\n"); } - print_asignment(fp, mExpression); + print_assignment(fp, mExpression); } break; case LSCP_TYPE: @@ -6266,21 +6986,21 @@ void LLScriptPreIncrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi print_cil_load_address(fp, mExpression, entry); if (mReturnType == LST_INTEGER) { - fprintf(fp, "ldc.i4.1\n"); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "ldc.i4.1\n"); fprintf(fp, "add\n"); } else if (mReturnType == LST_FLOATINGPOINT) { - fprintf(fp, "ldc.r8.1\n"); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "ldc.r8 1\n"); fprintf(fp, "add\n"); } else { fprintf(fp, "Unexpected Type\n"); } - print_cil_asignment(fp, mExpression, entry); + print_cil_assignment(fp, mExpression, entry); } break; default: @@ -6295,7 +7015,7 @@ S32 LLScriptPreIncrement::getSize() return 0; } -void LLScriptPreDecrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptPreDecrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6327,7 +7047,7 @@ void LLScriptPreDecrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi { fprintf(fp, "Unexpected Type\n"); } - print_asignment(fp, mExpression); + print_assignment(fp, mExpression); } break; case LSCP_TYPE: @@ -6374,21 +7094,21 @@ void LLScriptPreDecrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi print_cil_load_address(fp, mExpression, entry); if (mReturnType == LST_INTEGER) { - fprintf(fp, "ldc.i4.1\n"); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "ldc.i4.1\n"); fprintf(fp, "sub\n"); } else if (mReturnType == LST_FLOATINGPOINT) { - fprintf(fp, "ldc.r8.1\n"); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, "ldc.r8 1\n"); fprintf(fp, "sub\n"); } else { fprintf(fp, "Unexpected Type\n"); } - print_cil_asignment(fp, mExpression, entry); + print_cil_assignment(fp, mExpression, entry); } break; default: @@ -6403,7 +7123,7 @@ S32 LLScriptPreDecrement::getSize() return 0; } -void LLScriptTypeCast::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptTypeCast::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6455,7 +7175,7 @@ S32 LLScriptTypeCast::getSize() return 0; } -void LLScriptVectorInitializer::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptVectorInitializer::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6555,7 +7275,7 @@ void LLScriptVectorInitializer::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT print_cil_cast(fp, mExpression3->mReturnType, LST_FLOATINGPOINT); } // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. - fprintf(fp, "call valuetype [LScriptLibrary]LLVector valuetype [LScriptLibrary]LLVector::'create'(float32, float32, float32)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); break; default: mExpression1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -6571,7 +7291,7 @@ S32 LLScriptVectorInitializer::getSize() return 0; } -void LLScriptQuaternionInitializer::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptQuaternionInitializer::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6696,7 +7416,7 @@ void LLScriptQuaternionInitializer::recurse(FILE *fp, S32 tabs, S32 tabsize, LSC } // Call named ctor, which leaves new Vector on stack, so it can be saved in to local or argument just like a primitive type. - fprintf(fp, "call valuetype [LScriptLibrary]LLQuaternion valuetype [LScriptLibrary]LLQuaternion::'create'(float32, float32, float32, float32)\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); break; default: mExpression1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -6713,7 +7433,7 @@ S32 LLScriptQuaternionInitializer::getSize() return 0; } -void LLScriptListInitializer::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptListInitializer::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6743,14 +7463,15 @@ void LLScriptListInitializer::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo mReturnType = type = LST_LIST; break; case LSCP_TO_STACK: + { if (mExpressionList) { pass = LSCP_TO_STACK; - count = 0; - mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + U64 list_element_count = 0; + mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, list_element_count, chunk, heap, stacksize, entry, entrycount, NULL); chunk->addByte(LSCRIPTOpCodes[LOPC_STACKTOL]); - chunk->addInteger((S32)count); - count = 0; + chunk->addInteger((S32)list_element_count); + } else { @@ -6758,26 +7479,26 @@ void LLScriptListInitializer::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo chunk->addInteger(0); } break; + } case LSCP_EMIT_CIL_ASSEMBLY: - + { // Push boxed elements on stack. - count = 0; + U64 list_element_count = 0; if (mExpressionList) { - mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, list_element_count, chunk, heap, stacksize, entry, entrycount, NULL); } - // Create list on stack, consuming first boxed element. - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::CreateList()\n"); + // Create list on stack. + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); - // Call AddReturnList to add remaining boxed expressions. - for(U64 i = 0; i < count; i++) + // Call Prepend to add remaining boxed expressions. + for(U64 i = 0; i < list_element_count; i++) { - fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LScriptLibrary]LScriptInternal::AddReturnList(object, class [mscorlib]System.Collections.ArrayList)\n"); + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::Prepend(object, class [mscorlib]System.Collections.ArrayList)\n"); } - count = 0; - break; + } default: if (mExpressionList) { @@ -6793,7 +7514,7 @@ S32 LLScriptListInitializer::getSize() return 0; } -void LLScriptPostIncrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptPostIncrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6824,7 +7545,7 @@ void LLScriptPostIncrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp { fprintf(fp, "Unexpected Type\n"); } - print_asignment(fp, mExpression); + print_assignment(fp, mExpression); fprintf(fp, "%s\n", LSCRIPTTypePop[mReturnType]); } break; @@ -6893,24 +7614,34 @@ void LLScriptPostIncrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp break; case LSCP_EMIT_CIL_ASSEMBLY: { + // Push original value on to stack. + mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + + // Load address if needed for store. print_cil_load_address(fp, mExpression, entry); + + // Load value again. + // TODO: Work out if sideeffects can result in 2 evaluations of expression giving different values. + // Original LSL2 uses this method, so any bugs due to side effects will probably be identical ;-) mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp,"dup\n"); // Copy expression result to use as increment operand. if (mReturnType == LST_INTEGER) { fprintf(fp, "ldc.i4.1\n"); } else if (mReturnType == LST_FLOATINGPOINT) { - fprintf(fp, "ldc.r8.1\n"); + fprintf(fp, "ldc.r8 1\n"); } else { fprintf(fp, "Unexpected Type\n"); } fprintf(fp, "add\n"); - print_cil_asignment(fp, mExpression, entry); - fprintf(fp, "pop\n"); // Pop assignment result to leave original expression result on stack. TODO: Optimise away redundant pop/dup pairs. + print_cil_assignment(fp, mExpression, entry); + + // Pop assignment result to leave original expression result on stack. + // TODO: Optimise away redundant pop/dup pairs. + fprintf(fp, "pop\n"); } break; default: @@ -6925,7 +7656,7 @@ S32 LLScriptPostIncrement::getSize() return 0; } -void LLScriptPostDecrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptPostDecrement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -6956,7 +7687,7 @@ void LLScriptPostDecrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp { fprintf(fp, "Unexpected Type\n"); } - print_asignment(fp, mExpression); + print_assignment(fp, mExpression); fprintf(fp, "%s\n", LSCRIPTTypePop[mReturnType]); } break; @@ -7025,24 +7756,34 @@ void LLScriptPostDecrement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTComp break; case LSCP_EMIT_CIL_ASSEMBLY: { + // Push original value on to stack. + mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + + // Load address if needed for store. print_cil_load_address(fp, mExpression, entry); + + // Load value again. + // TODO: Work out if sideeffects can result in 2 evaluations of expression giving different values. + // Original LSL2 uses this method, so any bugs due to side effects will probably be identical ;-) mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp,"dup\n"); // Copy expression result to use as decrement operand. if (mReturnType == LST_INTEGER) { fprintf(fp, "ldc.i4.1\n"); } else if (mReturnType == LST_FLOATINGPOINT) { - fprintf(fp, "ldc.r8.1\n"); + fprintf(fp, "ldc.r8 1\n"); } else { fprintf(fp, "Unexpected Type\n"); } fprintf(fp, "sub\n"); - print_cil_asignment(fp, mExpression, entry); - fprintf(fp, "pop\n"); // Pop assignment result to leave original expression result on stack. TODO: Optimise away redundant pop/dup pairs. + print_cil_assignment(fp, mExpression, entry); + + // Pop assignment result to leave original expression result on stack. + // TODO: Optimise away redundant pop/dup pairs. + fprintf(fp, "pop\n"); } break; default: @@ -7058,20 +7799,23 @@ S32 LLScriptPostDecrement::getSize() } // Generate arg list. -void print_cil_arg_list(FILE *fp, LLScriptFuncExpressionList* exp_list) +static void print_cil_arg_list(LLFILE *fp, LLScriptArgString& args) { - // Print first argument. - print_cil_type(fp, exp_list->mFirstp->mReturnType); - - // Recursively print next arguments. - if(exp_list->mSecondp != NULL) + int i = 0; + bool finished = (i >= args.getNumber()); + while(! finished) { - fprintf(fp, ", "); - print_cil_arg_list(fp, (LLScriptFuncExpressionList*) exp_list->mSecondp); + print_cil_type(fp, args.getType(i)); + ++i; + finished = (i >= args.getNumber()); + if(! finished) + { + fprintf(fp, ", "); + } } } -void LLScriptFunctionCall::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptFunctionCall::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7146,7 +7890,7 @@ void LLScriptFunctionCall::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR); } } - else if (argcount != strlen(mIdentifier->mScopeEntry->mFunctionArgs.mString)) /*Flawfinder: ignore*/ + else if (argcount != strlen(mIdentifier->mScopeEntry->mFunctionArgs.mString)) { gErrorToText.writeError(fp, this, LSERROR_FUNCTION_TYPE_ERROR); } @@ -7217,13 +7961,15 @@ void LLScriptFunctionCall::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi // Load args on to stack. if (mExpressionList) { - mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry /* Needed for is_parameter calls */, 0, NULL); + //mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry /* Needed for is_parameter calls */, 0, NULL); + llassert(LET_FUNC_EXPRESSION_LIST == mExpressionList->mType); + print_cil_func_expression_list((LLScriptFuncExpressionList*) mExpressionList, fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry /* Caller entry needed for is_parameter calls */, 0, NULL, mIdentifier->mScopeEntry /* Callee entry needed for argument casting */); } // Make call. if (! library_call) { - fprintf(fp, "callvirt instance "); + fprintf(fp, "call instance "); } else { @@ -7233,16 +7979,18 @@ void LLScriptFunctionCall::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi fprintf(fp, " class "); if (library_call) { - fprintf(fp, "[LScriptLibrary]LScriptLibrary"); + fprintf(fp, "[LslLibrary]LindenLab.SecondLife.Library::'"); } else { - fprintf(fp, "LSL"); + // Prefix function name with g to distinguish from + // event handlers. + fprintf(fp, "%s", gScriptp->getClassName()); + fprintf(fp, "::'g"); } - fprintf(fp, "::"); - mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "("); - if (mExpressionList) {print_cil_arg_list(fp, (LLScriptFuncExpressionList*) mExpressionList);} + fprintf(fp, "%s", mIdentifier->mName); + fprintf(fp, "'("); + print_cil_arg_list(fp, mIdentifier->mScopeEntry->mFunctionArgs); fprintf(fp, ")\n"); } break; @@ -7260,7 +8008,7 @@ S32 LLScriptFunctionCall::getSize() return 0; } -void LLScriptPrint::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptPrint::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7287,6 +8035,11 @@ void LLScriptPrint::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass chunk->addByte(LSCRIPTOpCodes[LOPC_PRINT]); chunk->addByte(LSCRIPTTypeByte[mLeftType]); break; + case LSCP_EMIT_CIL_ASSEMBLY: + mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_cast(fp, mLeftType, LST_STRING); + fprintf(fp, "call void class [LslLibrary]LindenLab.SecondLife.Library::Print(string)"); + break; default: mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -7299,7 +8052,7 @@ S32 LLScriptPrint::getSize() return 0; } -void LLScriptConstantExpression::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptConstantExpression::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7338,7 +8091,7 @@ void LLScriptStatement::addStatement(LLScriptStatement *event) mNextp = event; } -void LLScriptStatement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptStatement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { fprintf(fp, "Statement Base Class -- should never get here!\n"); } @@ -7349,7 +8102,7 @@ S32 LLScriptStatement::getSize() return 0; } -void LLScriptStatement::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptStatement::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7384,7 +8137,7 @@ S32 LLScriptStatementSequence::getSize() return 0; } -void LLScriptStatementSequence::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptStatementSequence::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7404,8 +8157,19 @@ void LLScriptStatementSequence::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPT mFirstp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); if (prunearg) { + // babbage: only warn on first dead code block found. + if(ptype != LSPRUNE_DEAD_CODE) + { + gErrorToText.writeWarning(fp, this, LSWARN_DEAD_CODE); + } + + // babbage: set prune type to LSPRUNE_DEAD_CODE to mask other + // prune errors. ptype = LSPRUNE_DEAD_CODE; - gErrorToText.writeWarning(fp, this, LSWARN_DEAD_CODE); + + // babbage: reset prunearg, to track whether return needed at + // end of dead code path as CIL always needs a return/throw. + prunearg = FALSE; } mSecondp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -7431,7 +8195,7 @@ S32 LLScriptNOOP::getSize() return 0; } -void LLScriptNOOP::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptNOOP::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7444,10 +8208,7 @@ void LLScriptNOOP::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass p fprintf(fp, ";\n"); break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; default: break; @@ -7462,7 +8223,7 @@ void add_exit_pops(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry) if (entry->mLocals.mString) { - number = (S32)strlen(entry->mLocals.mString); /*Flawfinder: ignore*/ + number = (S32)strlen(entry->mLocals.mString); for (i = number - 1; i >= 0; i--) { switch(entry->mLocals.getType(i)) @@ -7495,7 +8256,7 @@ void add_exit_pops(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry) if (entry->mFunctionArgs.mString) { - number = (S32)strlen(entry->mFunctionArgs.mString); /*Flawfinder: ignore*/ + number = (S32)strlen(entry->mFunctionArgs.mString); for (i = number - 1; i >= 0; i--) { switch(entry->mFunctionArgs.getType(i)) @@ -7527,14 +8288,14 @@ void add_exit_pops(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry) } } -void print_exit_pops(FILE *fp, LLScriptScopeEntry *entry) +void print_exit_pops(LLFILE *fp, LLScriptScopeEntry *entry) { // remember that we need to pop in reverse order S32 number, i; if (entry->mLocals.mString) { - number = (S32)strlen(entry->mLocals.mString); /*Flawfinder: ignore*/ + number = (S32)strlen(entry->mLocals.mString); for (i = number - 1; i >= 0; i--) { fprintf(fp, "%s", LSCRIPTTypePop[entry->mLocals.getType(i)]); @@ -7543,7 +8304,7 @@ void print_exit_pops(FILE *fp, LLScriptScopeEntry *entry) if (entry->mFunctionArgs.mString) { - number = (S32)strlen(entry->mFunctionArgs.mString); /*Flawfinder: ignore*/ + number = (S32)strlen(entry->mFunctionArgs.mString); for (i = number - 1; i >= 0; i--) { fprintf(fp, "%s", LSCRIPTTypePop[entry->mFunctionArgs.getType(i)]); @@ -7557,7 +8318,7 @@ S32 LLScriptStateChange::getSize() return 0; } -void LLScriptStateChange::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptStateChange::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7583,10 +8344,7 @@ void LLScriptStateChange::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil { gErrorToText.writeError(fp, this, LSERROR_STATE_CHANGE_IN_GLOBAL); } - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_SCOPE_PASS2: { @@ -7609,11 +8367,19 @@ void LLScriptStateChange::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil chunk->addInteger(mIdentifier->mScopeEntry->mCount); } break; + case LSCP_TYPE: + mReturnType = basetype; + break; case LSCP_EMIT_CIL_ASSEMBLY: - fprintf(fp, "ldstr \""); - mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "\"\n"); - fprintf(fp, "call void class [LScriptLibrary]LScriptInternal::change_state(string)\n"); + fprintf(fp, "ldarg.0\n"); + fprintf(fp, "ldstr \"%s\"\n", mIdentifier->mName); + fprintf(fp, "call instance void class [LslUserScript]LindenLab.SecondLife.LslUserScript::ChangeState(string)\n"); + // We are doing a state change. In the LSL interpreter, this is basically a longjmp. We emulate it + // here using a call to the ChangeState followed by a short cut return of the current method. To + // maintain type safety we need to push an arbitrary variable of the current method's return type + // onto the stack before returning. This will be ignored and discarded. + print_cil_init_variable(fp, mReturnType); + fprintf(fp, "ret\n"); break; default: mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -7627,7 +8393,7 @@ S32 LLScriptJump::getSize() return 0; } -void LLScriptJump::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptJump::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7647,10 +8413,7 @@ void LLScriptJump::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass p fprintf(fp, "\n"); break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_SCOPE_PASS2: { @@ -7690,7 +8453,7 @@ S32 LLScriptLabel::getSize() return 0; } -void LLScriptLabel::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptLabel::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7747,7 +8510,7 @@ void add_return(LLScriptByteCodeChunk *chunk, LLScriptScopeEntry *entry) chunk->addByte(LSCRIPTOpCodes[LOPC_RETURN]); } -void print_return(FILE *fp, LLScriptScopeEntry *entry) +void print_return(LLFILE *fp, LLScriptScopeEntry *entry) { print_exit_pops(fp, entry); fprintf(fp, "RETURN\n"); @@ -7759,7 +8522,7 @@ S32 LLScriptReturn::getSize() return 0; } -void LLScriptReturn::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptReturn::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7820,6 +8583,10 @@ void LLScriptReturn::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass mType = basetype; } } + else if (basetype != LST_NULL) + { + gErrorToText.writeError(fp, this, LSERROR_TYPE_MISMATCH); + } break; case LSCP_EMIT_BYTE_CODE: if (mExpression) @@ -7863,6 +8630,7 @@ void LLScriptReturn::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass if (mExpression) { mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_cast(fp, mExpression->mReturnType, mType); } fprintf(fp, "ret\n"); break; @@ -7881,7 +8649,7 @@ S32 LLScriptExpressionStatement::getSize() return 0; } -void LLScriptExpressionStatement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptExpressionStatement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7902,10 +8670,7 @@ void LLScriptExpressionStatement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRI } break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_EMIT_BYTE_CODE: mExpression->recurse(fp, tabs, tabsize, LSCP_TO_STACK, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -7951,7 +8716,59 @@ S32 LLScriptIf::getSize() return 0; } -void LLScriptIf::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +static void print_cil_if_test(LLFILE* fp, LSCRIPTType type) +{ + switch(type) + { + case LST_INTEGER: + break; + case LST_FLOATINGPOINT: + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ceq\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + break; + case LST_VECTOR: + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); + fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Vector, class [ScriptTypes]LindenLab.SecondLife.Vector)\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + break; + case LST_QUATERNION: + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 0\n"); + fprintf(fp, "ldc.r8 1\n"); + fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); + fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::'Equals'(class [ScriptTypes]LindenLab.SecondLife.Quaternion, class [ScriptTypes]LindenLab.SecondLife.Quaternion)\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + break; + case LST_KEY: + fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::'IsNonNullUuid'(valuetype [ScriptTypes]LindenLab.SecondLife.Key)\n"); + break; + case LST_STRING: + fprintf(fp, "ldstr \"\"\n"); + fprintf(fp, "call bool string::op_Equality(string, string)\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + break; + case LST_LIST: + fprintf(fp, "call class [mscorlib]System.Collections.ArrayList class [LslUserScript]LindenLab.SecondLife.LslUserScript::CreateList()\n"); + fprintf(fp, "call bool [LslUserScript]LindenLab.SecondLife.LslUserScript::Equals(class [mscorlib]System.Collections.ArrayList, class [mscorlib]System.Collections.ArrayList)\n"); + fprintf(fp, "ldc.i4.0\n"); + fprintf(fp, "ceq\n"); + break; + default: + break; + } + +} + +void LLScriptIf::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -7976,15 +8793,16 @@ void LLScriptIf::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pas } break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_TYPE: mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + if (type == LST_NULL) + { + gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH); + } mType = type; - mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; case LSCP_EMIT_BYTE_CODE: { @@ -8004,6 +8822,7 @@ void LLScriptIf::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pas { S32 tjump = gTempJumpCount++; mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_if_test(fp, mExpression->mReturnType); fprintf(fp, "brfalse LabelTempJump%d\n", tjump); mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "LabelTempJump%d:\n", tjump); @@ -8022,7 +8841,7 @@ S32 LLScriptIfElse::getSize() return 0; } -void LLScriptIfElse::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptIfElse::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8063,6 +8882,10 @@ void LLScriptIfElse::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass break; case LSCP_TYPE: mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + if (type == LST_NULL) + { + gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH); + } mType = type; mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mStatement2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -8093,6 +8916,7 @@ void LLScriptIfElse::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass S32 tjump1 = gTempJumpCount++; S32 tjump2 = gTempJumpCount++; mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_if_test(fp, mExpression->mReturnType); fprintf(fp, "brfalse LabelTempJump%d\n", tjump1); mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "br LabelTempJump%d\n", tjump2); @@ -8115,7 +8939,7 @@ S32 LLScriptFor::getSize() return 0; } -void LLScriptFor::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptFor::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8155,15 +8979,16 @@ void LLScriptFor::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pa } break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_TYPE: if(mSequence) mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + if (type == LST_NULL) + { + gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH); + } mType = type; if(mExpressionList) mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -8203,6 +9028,7 @@ void LLScriptFor::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pa mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "LabelTempJump%d:\n", tjump1); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_if_test(fp, mExpression->mReturnType); fprintf(fp, "brfalse LabelTempJump%d\n", tjump2); if(mStatement) mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -8230,7 +9056,7 @@ S32 LLScriptDoWhile::getSize() return 0; } -void LLScriptDoWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptDoWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8257,14 +9083,15 @@ void LLScriptDoWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas } break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_TYPE: mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + if (type == LST_NULL) + { + gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH); + } mType = type; break; case LSCP_EMIT_BYTE_CODE: @@ -8287,6 +9114,7 @@ void LLScriptDoWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas fprintf(fp, "LabelTempJump%d:\n", tjump1); mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_if_test(fp, mExpression->mReturnType); fprintf(fp, "brtrue LabelTempJump%d\n", tjump1); } break; @@ -8303,7 +9131,7 @@ S32 LLScriptWhile::getSize() return 0; } -void LLScriptWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8331,13 +9159,14 @@ void LLScriptWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_TYPE: mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + if (type == LST_NULL) + { + gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH); + } mType = type; mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); break; @@ -8367,6 +9196,7 @@ void LLScriptWhile::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass S32 tjump2 = gTempJumpCount++; fprintf(fp, "LabelTempJump%d:\n", tjump1); mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + print_cil_if_test(fp, mExpression->mReturnType); fprintf(fp, "brfalse LabelTempJump%d\n", tjump2); mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, "br LabelTempJump%d\n", tjump1); @@ -8386,7 +9216,7 @@ S32 LLScriptDeclaration::getSize() return mType->getSize(); } -void LLScriptDeclaration::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptDeclaration::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8429,10 +9259,7 @@ void LLScriptDeclaration::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil } break; case LSCP_PRUNE: - if (ptype == LSPRUNE_DEAD_CODE) - prunearg = TRUE; - else - prunearg = FALSE; + prunearg = FALSE; break; case LSCP_SCOPE_PASS1: // Check to see if a declaration is valid here. @@ -8604,24 +9431,13 @@ void LLScriptDeclaration::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil if (mExpression) { mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - if (mIdentifier->mScopeEntry->mIDType == LIT_VARIABLE) - { - if(is_parameter(mIdentifier, entry)) - { - // Parameter, store by name. - fprintf(fp, "starg.s %s\n", mIdentifier->mScopeEntry->mIdentifier); - } - else - { - // Local, store by index. - fprintf(fp, "stloc.s %d\n", mIdentifier->mScopeEntry->mCount); - } - } - else if (mIdentifier->mScopeEntry->mIDType == LIT_GLOBAL) - { - gErrorToText.writeError(fp, this, LSERROR_UNDEFINED_NAME); - } + print_cil_cast(fp, mExpression->mReturnType, mIdentifier->mScopeEntry->mType); + } + else + { + print_cil_init_variable(fp, mIdentifier->mScopeEntry->mType); } + fprintf(fp, "stloc.s %d\n", mIdentifier->mScopeEntry->mCount); break; default: if (mExpression) @@ -8645,7 +9461,7 @@ S32 LLScriptCompoundStatement::getSize() return 0; } -void LLScriptCompoundStatement::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptCompoundStatement::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8721,7 +9537,7 @@ void LLScriptEventHandler::addEvent(LLScriptEventHandler *event) mNextp = event; } -void LLScriptEventHandler::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptEventHandler::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8751,7 +9567,7 @@ S32 LLScriptEventHandler::getSize() U64 gCurrentHandler = 0; -void print_cil_local_init(FILE* fp, LLScriptScopeEntry* scopeEntry) +static void print_cil_local_init(LLFILE* fp, LLScriptScopeEntry* scopeEntry) { if(scopeEntry->mLocals.getNumber() > 0) { @@ -8768,7 +9584,7 @@ void print_cil_local_init(FILE* fp, LLScriptScopeEntry* scopeEntry) } } -void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -8946,6 +9762,11 @@ void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi mScopeEntry->mFunctionArgs.addType(LST_LIST); mScopeEntry->mFunctionArgs.addType(LST_STRING); break; + case LSTT_HTTP_REQUEST: + mScopeEntry->mFunctionArgs.addType(LST_KEY); + mScopeEntry->mFunctionArgs.addType(LST_STRING); + mScopeEntry->mFunctionArgs.addType(LST_STRING); + break; default: break; @@ -8956,6 +9777,10 @@ void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi // first determine resource counts for globals count = 0; mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + + // Store offset of first local as with global functions, so locals and arguments can be distinguished with is_parameter when compiling to CIL. + mScopeEntry->mOffset = (S32) count; + if (mStatement) { entrycount = 0; @@ -8974,6 +9799,9 @@ void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi break; case LSCP_EMIT_BYTE_CODE: { + llassert(mEventp); + if (!mEventp) return; + // order for event handler // set jump table value S32 jumpoffset; @@ -8987,13 +9815,11 @@ void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi chunk->addBytes(4); // null terminated event name and null terminated parameters - if (mEventp) - { - LLScriptByteCodeChunk *event = new LLScriptByteCodeChunk(FALSE); - mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, event, heap, stacksize, entry, entrycount, NULL); - chunk->addBytes(event->mCodeChunk, event->mCurrentOffset); - delete event; - } + LLScriptByteCodeChunk *event = new LLScriptByteCodeChunk(FALSE); + mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, event, heap, stacksize, entry, entrycount, NULL); + chunk->addBytes(event->mCodeChunk, event->mCurrentOffset); + delete event; + chunk->addBytes(1); // now we're at the first opcode @@ -9024,8 +9850,11 @@ void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi // Method signature prefix. fprintf(fp, ".method public hidebysig instance default void "); - // Mangle event handler name by prefixing it with state name. Allows state changing by finding handlers prefixed with new state name. - fprintf(fp, entry->mIdentifier); /*Flawfinder: ignore*/ + // Mangle event handler name by prefixing it with state name. + // Allows state changing by finding handlers prefixed with new + // state name. Prefix disambiguates functions and event handlers. + fprintf(fp, "e"); + fprintf(fp, "%s", entry->mIdentifier); // Handler name and arguments. mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -9047,7 +9876,11 @@ void LLScriptEventHandler::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompi } // Function footer. - fprintf(fp, "\nret\n"); // TODO: Check whether return needed? + if (mbNeedTrailingReturn) + { + // TODO: throw exception? + fprintf(fp, "ret\n"); + } fprintf(fp, "}\n"); break; @@ -9071,7 +9904,7 @@ void LLScriptFunctionDec::addFunctionParameter(LLScriptFunctionDec *dec) mNextp = dec; } -void LLScriptFunctionDec::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptFunctionDec::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -9108,7 +9941,7 @@ S32 LLScriptFunctionDec::getSize() return 0; } -void LLScriptFunctionDec::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptFunctionDec::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -9161,7 +9994,7 @@ void LLScriptFunctionDec::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil chunk->addBytes(&typereturn, 1); // name #ifdef LSL_INCLUDE_DEBUG_INFO - chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); #else chunk->addBytes(1); #endif @@ -9176,6 +10009,10 @@ void LLScriptFunctionDec::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompil mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); fprintf(fp, " "); mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + if(NULL != mNextp) + { + fprintf(fp, ","); + } break; default: mType->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); @@ -9194,7 +10031,7 @@ void LLScriptGlobalFunctions::addGlobalFunction(LLScriptGlobalFunctions *global) mNextp = global; } -void LLScriptGlobalFunctions::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptGlobalFunctions::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -9222,7 +10059,7 @@ S32 LLScriptGlobalFunctions::getSize() return 0; } -void LLScriptGlobalFunctions::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptGlobalFunctions::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -9398,7 +10235,7 @@ void LLScriptGlobalFunctions::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo // null terminated function name #ifdef LSL_INCLUDE_DEBUG_INFO - chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); #else chunk->addBytes(1); #endif @@ -9444,11 +10281,13 @@ void LLScriptGlobalFunctions::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo break; case LSCP_EMIT_CIL_ASSEMBLY: { - // Function header. + // Function header. Prefix function name with g to distinguish + // from event handlers. fprintf(fp, ".method public hidebysig instance default "); print_cil_type(fp, mType ? mType->mType : LST_NULL); - fprintf(fp, " "); - mIdentifier->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(fp, " 'g"); + fprintf(fp, "%s", mIdentifier->mName); + fprintf(fp, "'"); if (mParameters) { fprintf(fp, "( "); @@ -9473,6 +10312,7 @@ void LLScriptGlobalFunctions::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCo // Function footer. if (mbNeedTrailingReturn) { + // TODO: throw exception? fprintf(fp, "ret\n"); } fprintf(fp, "}\n"); @@ -9507,7 +10347,7 @@ void LLScriptState::addState(LLScriptState *state) mNextp = state; } -void LLScriptState::gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptState::gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -9535,7 +10375,7 @@ S32 LLScriptState::getSize() return 0; } -void LLScriptState::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptState::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -9587,10 +10427,12 @@ void LLScriptState::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass { mIdentifier->mScopeEntry = scope->addEntry(mIdentifier->mName, LIT_STATE, LST_NULL); } + mStateScope = new LLScriptScope(gScopeStringTable); + mStateScope->addParentScope(scope); // now do the events if (mEvent) { - mEvent->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + mEvent->recurse(fp, tabs, tabsize, pass, ptype, prunearg, mStateScope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); } break; case LSCP_SCOPE_PASS2: @@ -9649,7 +10491,7 @@ void LLScriptState::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass // null terminated state name #ifdef LSL_INCLUDE_DEBUG_INFO - chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); /*Flawfinder: ignore*/ + chunk->addBytes(mIdentifier->mName, strlen(mIdentifier->mName) + 1); #else chunk->addBytes(1); #endif @@ -9693,6 +10535,38 @@ void LLScriptState::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass gonext(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); } +// Converts string to a valid CIL class name and stores the result +// in the supplied buffer, which should be at least 32 chars long. +// If the string starts with a UUID, all characters in the UUID are included +// in the generated name. +void to_class_name(char* buffer, const char* string) +{ + strcpy(buffer, "LSL-"); + strcat(buffer, string); + char* current_char = buffer; + while((*current_char) != 0) + { + if(isalnum(*current_char)) + { + ++current_char; + } + else if((*current_char) == '-') + { + (*current_char) = '_'; + ++current_char; + } + else + { + (*current_char) = 0; + } + } +} + +void LLScriptScript::setClassName(const char* class_name) +{ + to_class_name(mClassName, class_name); +} + S32 LLScriptScript::getSize() { return 0; @@ -9704,8 +10578,8 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals, mStates(states), mGlobalScope(NULL), mGlobals(NULL), mGlobalFunctions(NULL), mGodLike(FALSE) { const char DEFAULT_BYTECODE_FILENAME[] = "lscript.lso"; - strncpy(mBytecodeDest, DEFAULT_BYTECODE_FILENAME, sizeof(mBytecodeDest) -1); /*Flawfinder: ignore*/ - mBytecodeDest[MAX_STRING-1] = '\0'; + + mBytecodeDest = DEFAULT_BYTECODE_FILENAME; LLScriptGlobalVariable *tvar; LLScriptGlobalFunctions *tfunc; LLScritpGlobalStorage *temp; @@ -9747,28 +10621,27 @@ LLScriptScript::LLScriptScript(LLScritpGlobalStorage *globals, } temp = temp->mNextp; } + + mClassName[0] = '\0'; } void LLScriptScript::setBytecodeDest(const char* dst_filename) { - strncpy(mBytecodeDest, dst_filename, MAX_STRING); /*Flawfinder: ignore*/ - mBytecodeDest[MAX_STRING-1] = '\0'; + mBytecodeDest = ll_safe_string(dst_filename); } -void print_cil_globals(FILE* fp, LLScriptGlobalVariable* global) +static void print_cil_globals(LLFILE* fp, LLScriptGlobalVariable* global) { - fprintf(fp, ".field private "); + fprintf(fp, ".field public "); print_cil_type(fp, global->mType->mType); - fprintf(fp, " "); - fprintf(fp, global->mIdentifier->mName); /*Flawfinder: ignore*/ - fprintf(fp, "\n"); + fprintf(fp, " '%s'\n", global->mIdentifier->mName); if(NULL != global->mNextp) { print_cil_globals(fp, global->mNextp); } } -void LLScriptScript::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) +void LLScriptScript::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { if (gErrorToText.getErrors()) { @@ -9803,20 +10676,21 @@ void LLScriptScript::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass { mGlobalScope = new LLScriptScope(gScopeStringTable); // zeroth, add library functions to global scope - S32 i; - char *arg; + U16 function_index = 0; + const char *arg; LLScriptScopeEntry *sentry; - for (i = 0; i < gScriptLibrary.mNextNumber; i++) + for (std::vector<LLScriptLibraryFunction>::const_iterator i = gScriptLibrary.mFunctions.begin(); + i != gScriptLibrary.mFunctions.end(); ++i) { // First, check to make sure this isn't a god only function, or that the viewer's agent is a god. - if (!gScriptLibrary.mFunctions[i]->mGodOnly || mGodLike) + if (!i->mGodOnly || mGodLike) { - if (gScriptLibrary.mFunctions[i]->mReturnType) - sentry = mGlobalScope->addEntry(gScriptLibrary.mFunctions[i]->mName, LIT_LIBRARY_FUNCTION, char2type(*gScriptLibrary.mFunctions[i]->mReturnType)); + if (i->mReturnType) + sentry = mGlobalScope->addEntry(i->mName, LIT_LIBRARY_FUNCTION, char2type(*i->mReturnType)); else - sentry = mGlobalScope->addEntry(gScriptLibrary.mFunctions[i]->mName, LIT_LIBRARY_FUNCTION, LST_NULL); - sentry->mLibraryNumber = i; - arg = gScriptLibrary.mFunctions[i]->mArgs; + sentry = mGlobalScope->addEntry(i->mName, LIT_LIBRARY_FUNCTION, LST_NULL); + sentry->mLibraryNumber = function_index; + arg = i->mArgs; if (arg) { while (*arg) @@ -9828,6 +10702,7 @@ void LLScriptScript::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } } } + function_index++; } // first go and collect all the global variables if (mGlobals) @@ -9939,7 +10814,7 @@ void LLScriptScript::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass // now, put it all together and spit it out // we need - FILE* bcfp = LLFile::fopen(mBytecodeDest, "wb"); /*Flawfinder: ignore*/ + LLFILE* bcfp = LLFile::fopen(mBytecodeDest, "wb"); /*Flawfinder: ignore*/ code->build(fp, bcfp); fclose(bcfp); @@ -9948,72 +10823,66 @@ void LLScriptScript::recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass } break; case LSCP_EMIT_CIL_ASSEMBLY: + { + LLFILE *bcfp = LLFile::fopen(mBytecodeDest, "wb"); - // Output dependencies. - fprintf(fp, ".assembly extern mscorlib {.ver 1:0:5000:0}\n"); - fprintf(fp, ".assembly extern LScriptLibrary {.ver 0:0:0:0}\n"); + // Output dependencies. + fprintf(bcfp, ".assembly extern mscorlib {.ver 1:0:5000:0}\n"); + fprintf(bcfp, ".assembly extern LslLibrary {.ver 0:1:0:0}\n"); + fprintf(bcfp, ".assembly extern LslUserScript {.ver 0:1:0:0}\n"); + fprintf(bcfp, ".assembly extern ScriptTypes {.ver 0:1:0:0}\n"); - // Output assembly name. - fprintf(fp, ".assembly 'lsl' {.ver 0:0:0:0}\n"); + // Output assembly name. + fprintf(bcfp, ".assembly '%s' {.ver 0:0:0:0}\n", gScriptp->getClassName()); - // Output class header. - fprintf(fp, ".class public auto ansi beforefieldinit LSL extends [mscorlib]System.Object\n"); - fprintf(fp, "{\n"); + // Output class header. + fprintf(bcfp, ".class public auto ansi serializable beforefieldinit %s extends [LslUserScript]LindenLab.SecondLife.LslUserScript\n", gScriptp->getClassName()); + fprintf(bcfp, "{\n"); - // Output globals as members. - if(NULL != mGlobals) - { - print_cil_globals(fp, mGlobals); - } - - // Output "runtime". Only needed to allow stand alone execution. Not needed when compiling to DLL and using embedded runtime. - fprintf(fp, ".method public static hidebysig default void Main () cil managed\n"); - fprintf(fp, "{\n"); - fprintf(fp, ".entrypoint\n"); - fprintf(fp, ".maxstack 2\n"); - fprintf(fp, ".locals init (class LSL V_0)\n"); - fprintf(fp, "newobj instance void class LSL::.ctor()\n"); - fprintf(fp, "stloc.0\n"); - fprintf(fp, "ldloc.0\n"); - fprintf(fp, "callvirt instance void class LSL::defaultstate_entry()\n"); - fprintf(fp, "ret\n"); - fprintf(fp, "}\n"); + // Output globals as members. + if(NULL != mGlobals) + { + print_cil_globals(bcfp, mGlobals); + } - // Output ctor header. - fprintf(fp, ".method public hidebysig specialname rtspecialname instance default void .ctor () cil managed\n"); - fprintf(fp, "{\n"); - fprintf(fp, ".maxstack 500\n"); + // Output ctor header. + fprintf(bcfp, ".method public hidebysig specialname rtspecialname instance default void .ctor () cil managed\n"); + fprintf(bcfp, "{\n"); + fprintf(bcfp, ".maxstack 500\n"); - // Initialise globals as members in ctor. - if (mGlobals) - { - fdotabs(fp, tabs, tabsize); - mGlobals->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "\n"); - } + // Initialise globals as members in ctor. + if (mGlobals) + { + fdotabs(bcfp, tabs, tabsize); + mGlobals->recurse(bcfp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(bcfp, "\n"); + } - // Output ctor footer. - fprintf(fp, "ldarg.0\n"); - fprintf(fp, "call instance void valuetype [mscorlib]System.Object::.ctor()\n"); - fprintf(fp, "ret\n"); - fprintf(fp, "}\n"); + // Output ctor footer. + fprintf(bcfp, "ldarg.0\n"); + fprintf(bcfp, "call instance void [LslUserScript]LindenLab.SecondLife.LslUserScript::.ctor()\n"); + fprintf(bcfp, "ret\n"); + fprintf(bcfp, "}\n"); - // Output functions as methods. - if (mGlobalFunctions) - { - fdotabs(fp, tabs, tabsize); - mGlobalFunctions->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "\n"); - } + // Output functions as methods. + if (mGlobalFunctions) + { + fdotabs(bcfp, tabs, tabsize); + mGlobalFunctions->recurse(bcfp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(bcfp, "\n"); + } - // Output states as name mangled methods. - fdotabs(fp, tabs, tabsize); - mStates->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); - fprintf(fp, "\n"); + // Output states as name mangled methods. + fdotabs(bcfp, tabs, tabsize); + mStates->recurse(bcfp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); + fprintf(bcfp, "\n"); - // Output class footer. - fprintf(fp, "}\n"); + // Output class footer. + fprintf(bcfp, "}\n"); + // Close file. + fclose(bcfp); + } break; default: if (mGlobals) diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h index fee648ed69..bf29f44518 100644 --- a/indra/lscript/lscript_compile/lscript_tree.h +++ b/indra/lscript/lscript_compile/lscript_tree.h @@ -2,30 +2,25 @@ * @file lscript_tree.h * @brief provides the classes required to build lscript's abstract syntax tree and symbol table * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -53,7 +48,7 @@ public: ~LLScriptType() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LSCRIPTType mType; @@ -70,7 +65,7 @@ public: virtual ~LLScriptConstant() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LSCRIPTType mType; @@ -86,7 +81,7 @@ public: ~LLScriptConstantInteger() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); S32 mValue; @@ -102,7 +97,7 @@ public: ~LLScriptConstantFloat() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); F32 mValue; @@ -122,7 +117,7 @@ public: mValue = NULL; } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); char *mValue; @@ -143,7 +138,7 @@ public: mName = NULL; } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); char *mName; @@ -177,7 +172,7 @@ public: // don't delete next pointer because we're going to store allocation lists and delete from those } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LSCRIPTSimpleAssignableType mType; @@ -196,7 +191,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mIdentifier; @@ -214,7 +209,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptConstant *mConstant; @@ -235,7 +230,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptSimpleAssignable *mEntry1; @@ -259,7 +254,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptSimpleAssignable *mEntry1; @@ -280,7 +275,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptSimpleAssignable *mEntryList; @@ -303,9 +298,9 @@ public: { } - void gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptType *mType; @@ -330,7 +325,7 @@ public: // don't delete next pointer because we're going to store allocation lists and delete from those } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LSCRIPTStateEventType mType; @@ -344,7 +339,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); ~LLScriptStateEntryEvent() {} @@ -360,7 +355,7 @@ public: ~LLScriptStateExitEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); }; @@ -376,7 +371,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mCount; @@ -394,7 +389,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mCount; @@ -412,7 +407,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mCount; @@ -430,7 +425,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mCount; @@ -448,7 +443,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mCount; @@ -466,7 +461,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mCount; @@ -484,7 +479,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mPosition; @@ -502,7 +497,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mPosition; @@ -520,7 +515,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mPosition; @@ -536,7 +531,7 @@ public: ~LLScriptInventoryEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mChange; @@ -552,7 +547,7 @@ public: ~LLScriptAttachEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mAttach; @@ -568,7 +563,7 @@ public: ~LLScriptDataserverEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mID; @@ -585,7 +580,7 @@ public: ~LLScriptTimerEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); }; @@ -599,7 +594,7 @@ public: ~LLScriptMovingStartEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); }; @@ -613,7 +608,7 @@ public: ~LLScriptMovingEndEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); }; @@ -627,7 +622,7 @@ public: ~LLScriptRTPEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mRTPermissions; @@ -645,7 +640,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mChannel; @@ -666,7 +661,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mID; @@ -684,7 +679,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mNumber; @@ -702,7 +697,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mName; @@ -722,7 +717,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mSender; @@ -743,7 +738,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mType; @@ -758,16 +753,16 @@ class LLScriptHTTPResponseEvent : public LLScriptEvent { public: LLScriptHTTPResponseEvent(S32 line, S32 col, - LLScriptIdentifier *reqeust_id, + LLScriptIdentifier *request_id, LLScriptIdentifier *status, LLScriptIdentifier *metadata, LLScriptIdentifier *body) : LLScriptEvent(line, col, LSTT_HTTP_RESPONSE), - mRequestId(reqeust_id), mStatus(status), mMetadata(metadata), mBody(body) + mRequestId(request_id), mStatus(status), mMetadata(metadata), mBody(body) { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, @@ -782,6 +777,32 @@ public: LLScriptIdentifier *mBody; }; +class LLScriptHTTPRequestEvent : public LLScriptEvent +{ +public: + LLScriptHTTPRequestEvent(S32 line, S32 col, + LLScriptIdentifier *request_id, + LLScriptIdentifier *method, + LLScriptIdentifier *body) + : LLScriptEvent(line, col, LSTT_HTTP_REQUEST), + mRequestId(request_id), mMethod(method), mBody(body) + { + } + + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, + LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, + LSCRIPTType &type, LSCRIPTType basetype, U64 &count, + LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, + S32 stacksize, LLScriptScopeEntry *entry, + S32 entrycount, LLScriptLibData **ldata); + + S32 getSize(); + + LLScriptIdentifier *mRequestId; + LLScriptIdentifier *mMethod; + LLScriptIdentifier *mBody; +}; + class LLScriptRezEvent : public LLScriptEvent { public: @@ -791,7 +812,7 @@ public: } ~LLScriptRezEvent() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mStartParam; @@ -805,7 +826,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); ~LLScriptNoSensorEvent() {} @@ -819,7 +840,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); ~LLScriptAtTarget() {} @@ -837,7 +858,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); ~LLScriptNotAtTarget() {} @@ -851,7 +872,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); ~LLScriptAtRotTarget() {} @@ -869,7 +890,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); ~LLScriptNotAtRotTarget() {} @@ -887,7 +908,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mName; @@ -906,7 +927,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mTime; @@ -932,9 +953,9 @@ public: // don't delete next pointer because we're going to store allocation lists and delete from those } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); - void gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LSCRIPTExpressionType mType; @@ -955,7 +976,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mFirstp; @@ -974,7 +995,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mFirstp; @@ -993,7 +1014,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mFirstp; @@ -1012,7 +1033,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); S32 mOffset; @@ -1032,7 +1053,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLValue; @@ -1051,7 +1072,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLValue; @@ -1070,7 +1091,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLValue; @@ -1089,7 +1110,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLValue; @@ -1108,7 +1129,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLValue; @@ -1127,7 +1148,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLValue; @@ -1146,7 +1167,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1165,7 +1186,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1184,7 +1205,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1203,7 +1224,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1222,7 +1243,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1241,7 +1262,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1260,7 +1281,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1279,7 +1300,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1298,7 +1319,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1317,7 +1338,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1336,7 +1357,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1355,7 +1376,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1374,7 +1395,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1393,7 +1414,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1412,7 +1433,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1431,7 +1452,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1450,7 +1471,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1469,7 +1490,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mLeftSide; @@ -1488,7 +1509,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1506,7 +1527,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1524,7 +1545,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1542,7 +1563,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1560,7 +1581,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1578,7 +1599,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1596,7 +1617,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptType *mType; @@ -1620,7 +1641,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression1; @@ -1647,7 +1668,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression1; @@ -1668,7 +1689,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpressionList; @@ -1686,7 +1707,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1704,7 +1725,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1722,7 +1743,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mIdentifier; @@ -1741,7 +1762,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1759,7 +1780,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptConstant *mConstant; @@ -1801,9 +1822,9 @@ public: void addStatement(LLScriptStatement *event); - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); - void gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LSCRIPTStatementType mType; @@ -1824,7 +1845,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptStatement *mFirstp; @@ -1841,7 +1862,7 @@ public: ~LLScriptNOOP() {} - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); }; @@ -1849,7 +1870,7 @@ class LLScriptStateChange : public LLScriptStatement { public: LLScriptStateChange(S32 line, S32 col, LLScriptIdentifier *identifier) - : LLScriptStatement(line, col, LSSMT_STATE_CHANGE), mIdentifier(identifier) + : LLScriptStatement(line, col, LSSMT_STATE_CHANGE), mIdentifier(identifier), mReturnType(LST_NULL) { } @@ -1857,10 +1878,11 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mIdentifier; + LSCRIPTType mReturnType; }; class LLScriptJump : public LLScriptStatement @@ -1875,7 +1897,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mIdentifier; @@ -1893,7 +1915,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptIdentifier *mIdentifier; @@ -1911,7 +1933,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1930,7 +1952,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1948,7 +1970,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LSCRIPTType mType; @@ -1968,7 +1990,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -1989,7 +2011,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mSequence; @@ -2011,7 +2033,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptStatement *mStatement; @@ -2031,7 +2053,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptExpression *mExpression; @@ -2052,7 +2074,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptType *mType; @@ -2072,7 +2094,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptStatement *mStatement; @@ -2094,9 +2116,9 @@ public: void addEvent(LLScriptEventHandler *event); - void gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptEvent *mEventp; @@ -2126,9 +2148,9 @@ public: void addFunctionParameter(LLScriptFunctionDec *dec); - void gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptType *mType; @@ -2154,9 +2176,9 @@ public: delete mFunctionScope; } - void gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); LLScriptType *mType; @@ -2182,7 +2204,7 @@ class LLScriptState : public LLScriptFilePosition { public: LLScriptState(S32 line, S32 col, LSCRIPTStateType type, LLScriptIdentifier *identifier, LLScriptEventHandler *event) - : LLScriptFilePosition(line, col), mType(type), mIdentifier(identifier), mEvent(event), mNextp(NULL) + : LLScriptFilePosition(line, col), mType(type), mIdentifier(identifier), mEvent(event), mNextp(NULL), mStateScope(NULL) { } @@ -2192,16 +2214,16 @@ public: { } - void gonext(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void gonext(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); - LSCRIPTStateType mType; - LLScriptIdentifier *mIdentifier; - LLScriptEventHandler *mEvent; - LLScriptState *mNextp; - + LSCRIPTStateType mType; + LLScriptIdentifier *mIdentifier; + LLScriptEventHandler *mEvent; + LLScriptState *mNextp; + LLScriptScope *mStateScope; }; class LLScritpGlobalStorage : public LLScriptFilePosition @@ -2222,7 +2244,7 @@ public: { } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) { } @@ -2257,11 +2279,14 @@ public: delete mGlobalScope; } - void recurse(FILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); + void recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata); S32 getSize(); void setBytecodeDest(const char* dst_filename); + void setClassName(const char* class_name); + const char* getClassName() {return mClassName;} + LLScriptState *mStates; LLScriptScope *mGlobalScope; LLScriptGlobalVariable *mGlobals; @@ -2269,7 +2294,8 @@ public: BOOL mGodLike; private: - char mBytecodeDest[MAX_STRING]; /*Flawfinder: ignore*/ + std::string mBytecodeDest; + char mClassName[MAX_STRING]; }; class LLScriptAllocationManager diff --git a/indra/lscript/lscript_compile/lscript_typecheck.cpp b/indra/lscript/lscript_compile/lscript_typecheck.cpp index 847a54eb0a..c685621538 100644 --- a/indra/lscript/lscript_compile/lscript_typecheck.cpp +++ b/indra/lscript/lscript_compile/lscript_typecheck.cpp @@ -2,30 +2,25 @@ * @file lscript_typecheck.cpp * @brief typechecks script * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -66,7 +61,13 @@ LSCRIPTType implicit_casts(LSCRIPTType left_side, LSCRIPTType right_side) { // shouldn't be doing an operation on void types case LST_NULL: - return LST_NULL; + switch(right_side) + { + case LST_NULL: + return LST_NULL; + default: + return LST_UNDEFINED; + } // shouldn't be doing an operation on undefined types case LST_UNDEFINED: return LST_UNDEFINED; @@ -351,10 +352,10 @@ void init_supported_expressions(void) gSupportedExpressionArray[LET_MUL_ASSIGN][LST_INTEGER][LST_FLOATINGPOINT] = LST_FLOATINGPOINT; gSupportedExpressionArray[LET_MUL_ASSIGN][LST_FLOATINGPOINT][LST_FLOATINGPOINT] = LST_FLOATINGPOINT; gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_INTEGER] = LST_VECTOR; - gSupportedExpressionArray[LET_MUL_ASSIGN][LST_INTEGER][LST_VECTOR] = LST_VECTOR; + //gSupportedExpressionArray[LET_MUL_ASSIGN][LST_INTEGER][LST_VECTOR] = LST_VECTOR; gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_FLOATINGPOINT] = LST_VECTOR; - gSupportedExpressionArray[LET_MUL_ASSIGN][LST_FLOATINGPOINT][LST_VECTOR] = LST_VECTOR; - gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_VECTOR] = LST_FLOATINGPOINT; + //gSupportedExpressionArray[LET_MUL_ASSIGN][LST_FLOATINGPOINT][LST_VECTOR] = LST_VECTOR; + //gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_VECTOR] = LST_FLOATINGPOINT; gSupportedExpressionArray[LET_MUL_ASSIGN][LST_VECTOR][LST_QUATERNION] = LST_VECTOR; gSupportedExpressionArray[LET_MUL_ASSIGN][LST_QUATERNION][LST_QUATERNION] = LST_QUATERNION; diff --git a/indra/lscript/lscript_compile/lscript_typecheck.h b/indra/lscript/lscript_compile/lscript_typecheck.h index 0ebae2d91b..74f723506f 100644 --- a/indra/lscript/lscript_compile/lscript_typecheck.h +++ b/indra/lscript/lscript_compile/lscript_typecheck.h @@ -2,30 +2,25 @@ * @file lscript_typecheck.h * @brief typechecks script * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_compile/windows/unistd.h b/indra/lscript/lscript_compile/windows/unistd.h new file mode 100644 index 0000000000..49e9152d63 --- /dev/null +++ b/indra/lscript/lscript_compile/windows/unistd.h @@ -0,0 +1,24 @@ +/** + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +/* After all that, this file is empty. */ diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h index 1e11d32d09..fc491ead0f 100644 --- a/indra/lscript/lscript_execute.h +++ b/indra/lscript/lscript_execute.h @@ -2,30 +2,25 @@ * @file lscript_execute.h * @brief Classes to execute bytecode * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,6 +31,8 @@ #include "linked_lists.h" #include "lscript_library.h" +class LLTimer; + // Return values for run() methods const U32 NO_DELETE_FLAG = 0x0000; const U32 DELETE_FLAG = 0x0001; @@ -367,24 +364,190 @@ public: class LLScriptExecute { public: - LLScriptExecute(FILE *fp); - LLScriptExecute(U8 *buffer); - ~LLScriptExecute(); + LLScriptExecute(); + virtual ~LLScriptExecute() = 0; + virtual S32 getVersion() const = 0; + virtual void deleteAllEvents() = 0; + virtual void addEvent(LLScriptDataCollection* event) = 0; + virtual U32 getEventCount() = 0; + virtual void removeEventType(LSCRIPTStateEventType event_type) = 0; + virtual S32 getFaults() = 0; + virtual void setFault(LSCRIPTRunTimeFaults fault) = 0; + virtual U32 getFreeMemory() = 0; + virtual S32 getParameter() = 0; + virtual void setParameter(S32 value) = 0; + virtual F32 getSleep() const = 0; + virtual void setSleep(F32 value) = 0; + virtual F32 getEnergy() const = 0; + virtual void setEnergy(F32 value) = 0; + virtual U64 getCurrentEvents() = 0; + virtual void setCurrentEvents(U64 value) = 0; + virtual U64 getEventHandlers() = 0; + virtual void setEventHandlers(U64 value) = 0; + virtual U64 getCurrentHandler() = 0; + virtual void setCurrentHandler(U64 value) = 0; + virtual BOOL isFinished() const = 0; + virtual BOOL isStateChangePending() const = 0; + virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size) = 0; // Allocate memory for header, state and footer return size of state. + virtual U32 getEventsSavedSize() = 0; // Returns 0 if events are written with state. + virtual S32 writeEvents(U8 *dest) = 0; // Must write and return exactly the number of bytes returned by getEventsSavedSize. + virtual void readEvents(U8* src, S32& offset) = 0; + virtual S32 readState(U8 *src) = 0; // Returns number of bytes read. + virtual void reset(); + virtual const U8* getBytecode() const = 0; + virtual U32 getBytecodeSize() const = 0; + virtual bool isMono() const = 0; + virtual void error() {;} // Processing that must be performed when error flag is set and so run is not called. + + virtual U32 getUsedMemory() = 0; + + // Run current event handler for a maximum of time_slice seconds. + // Updates current handler and current events registers. + virtual void resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice) = 0; + + // Run handler for event for a maximum of time_slice seconds. + // Updates current handler and current events registers. + virtual void callEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) = 0;; + + // Run handler for next queued event for maximum of time_slice seconds. + // Updates current handler and current events registers. + // Removes processed event from queue. + virtual void callNextQueuedEventHandler(U64 event_register, const LLUUID &id, F32 time_slice) = 0; + + // Run handler for event for a maximum of time_slice seconds. + // Updates current handler and current events registers. + // Removes processed event from queue. + virtual void callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) = 0; + + // Switch to next state. + // Returns new set of handled events. + virtual U64 nextState() = 0; + + // Returns time taken. + virtual F32 runQuanta(BOOL b_print, const LLUUID &id, + const char **errorstr, + F32 quanta, + U32& events_processed, LLTimer& timer); + + // NOTE: babbage: this must be used on occasions where another script may already be executing. Only 2 levels of nesting are allowed. + // Provided to support bizarre detach behaviour only. Do not use. + virtual F32 runNested(BOOL b_print, const LLUUID &id, + const char **errorstr, + F32 quanta, + U32& events_processed, LLTimer& timer); + + // Run smallest possible amount of code: an instruction for LSL2, a segment + // between save tests for Mono + void runInstructions(BOOL b_print, const LLUUID &id, + const char **errorstr, + U32& events_processed, + F32 quanta); + + bool isYieldDue() const; + + void setReset(BOOL b) {mReset = b;} + BOOL getReset() const { return mReset; } + + // Called when the script is scheduled to be run from newsim/LLScriptData + virtual void startRunning() = 0; + + // Called when the script is scheduled to be stopped from newsim/LLScriptData + virtual void stopRunning() = 0; + + // A timer is regularly checked to see if script takes too long, but we + // don't do it every opcode due to performance hits. + static void setTimerCheckSkip( S32 value ) { sTimerCheckSkip = value; } + static S32 getTimerCheckSkip() { return sTimerCheckSkip; } + +private: + + BOOL mReset; + + static S32 sTimerCheckSkip; // Number of times to skip the timer check for performance reasons +}; + +class LLScriptExecuteLSL2 : public LLScriptExecute +{ +public: + LLScriptExecuteLSL2(LLFILE *fp); + LLScriptExecuteLSL2(const U8* bytecode, U32 bytecode_size); + virtual ~LLScriptExecuteLSL2(); + + virtual S32 getVersion() const {return get_register(mBuffer, LREG_VN);} + virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();} + virtual void addEvent(LLScriptDataCollection* event); + virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();} + virtual void removeEventType(LSCRIPTStateEventType event_type); + virtual S32 getFaults() {return get_register(mBuffer, LREG_FR);} + virtual void setFault(LSCRIPTRunTimeFaults fault) {set_fault(mBuffer, fault);} + virtual U32 getFreeMemory(); + virtual S32 getParameter(); + virtual void setParameter(S32 value); + virtual F32 getSleep() const; + virtual void setSleep(F32 value); + virtual F32 getEnergy() const; + virtual void setEnergy(F32 value); + virtual U64 getCurrentEvents() {return get_event_register(mBuffer, LREG_CE, getMajorVersion());} + virtual void setCurrentEvents(U64 value) {return set_event_register(mBuffer, LREG_CE, value, getMajorVersion());} + virtual U64 getEventHandlers() {return get_event_register(mBuffer, LREG_ER, getMajorVersion());} + virtual void setEventHandlers(U64 value) {set_event_register(mBuffer, LREG_ER, value, getMajorVersion());} + virtual U64 getCurrentHandler(); + virtual void setCurrentHandler(U64 value) {return set_event_register(mBuffer, LREG_IE, value, getMajorVersion());} + virtual BOOL isFinished() const {return get_register(mBuffer, LREG_IP) == 0;} + virtual BOOL isStateChangePending() const {return get_register(mBuffer, LREG_CS) != get_register(mBuffer, LREG_NS);} + virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size); // Not including Events. + virtual U32 getEventsSavedSize() {return mEventData.getSavedSize();} + virtual S32 writeEvents(U8 *dest) {return mEventData.write2bytestream(dest);} + virtual void readEvents(U8* src, S32& offset) {mEventData.set(src, offset);} + virtual S32 writeBytecode(U8 **dest); + virtual S32 readState(U8 *src); + virtual void reset(); + virtual const U8* getBytecode() const {return mBytecode;} + virtual U32 getBytecodeSize() const {return mBytecodeSize;} + virtual bool isMono() const {return false;} + virtual U32 getUsedMemory(); + // Run current event handler for a maximum of time_slice seconds. + // Updates current handler and current events registers. + virtual void resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice); + + // Run handler for event for a maximum of time_slice seconds. + // Updates current handler and current events registers. + virtual void callEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice); + + // Run handler for next queued event for maximum of time_slice seconds. + // Updates current handler and current events registers. + // Removes processed event from queue. + virtual void callNextQueuedEventHandler(U64 event_register, const LLUUID &id, F32 time_slice); + + // Run handler for event for a maximum of time_slice seconds. + // Updates current handler and current events registers. + // Removes processed event from queue. + virtual void callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice); + + // Switch to next state. + // Returns new set of handled events. + virtual U64 nextState(); void init(); - U32 run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition); BOOL (*mExecuteFuncs[0x100])(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id); U32 mInstructionCount; U8 *mBuffer; LLScriptEventData mEventData; - - static S64 sGlobalInstructionCount; + U8* mBytecode; // Initial state and bytecode. + U32 mBytecodeSize; private: + S32 getMajorVersion() const; void recordBoundaryError( const LLUUID &id ); void setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id ); + + // Called when the script is scheduled to be run from newsim/LLScriptData + virtual void startRunning(); + + // Called when the script is scheduled to be stopped from newsim/LLScriptData + virtual void stopRunning(); }; #endif diff --git a/indra/lscript/lscript_execute/CMakeLists.txt b/indra/lscript/lscript_execute/CMakeLists.txt new file mode 100644 index 0000000000..3a16ffdc01 --- /dev/null +++ b/indra/lscript/lscript_execute/CMakeLists.txt @@ -0,0 +1,40 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LScript) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +set(lscript_execute_SOURCE_FILES + llscriptresource.cpp + llscriptresourceconsumer.cpp + llscriptresourcepool.cpp + lscript_execute.cpp + lscript_heapruntime.cpp + lscript_readlso.cpp + ) + +set(lscript_execute_HEADER_FILES + CMakeLists.txt + + ../llscriptresource.h + ../llscriptresourceconsumer.h + ../llscriptresourcepool.h + ../lscript_execute.h + ../lscript_rt_interface.h + lscript_heapruntime.h + lscript_readlso.h + ) + +set_source_files_properties(${lscript_execute_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_execute_SOURCE_FILES ${lscript_execute_HEADER_FILES}) + +add_library (lscript_execute ${lscript_execute_SOURCE_FILES}) diff --git a/indra/lscript/lscript_execute/llscriptresource.cpp b/indra/lscript/lscript_execute/llscriptresource.cpp new file mode 100644 index 0000000000..2c6811b226 --- /dev/null +++ b/indra/lscript/lscript_execute/llscriptresource.cpp @@ -0,0 +1,93 @@ +/** + * @file llscriptresource.cpp + * @brief LLScriptResource class implementation for managing limited resources + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "linden_common.h" + +#include "llscriptresource.h" +#include "llerror.h" + +LLScriptResource::LLScriptResource() +: mTotal(0), + mUsed(0) +{ +} + +bool LLScriptResource::request(S32 amount /* = 1 */) +{ + if (mUsed + amount <= mTotal) + { + mUsed += amount; + return true; + } + + return false; +} + +bool LLScriptResource::release(S32 amount /* = 1 */) +{ + if (mUsed >= amount) + { + mUsed -= amount; + return true; + } + + return false; +} + +S32 LLScriptResource::getAvailable() const +{ + if (mUsed > mTotal) + { + // It is possible after a parcel ownership change for more than total to be used + // In this case the user of this class just wants to know + // whether or not they can use a resource + return 0; + } + return (mTotal - mUsed); +} + +void LLScriptResource::setTotal(S32 amount) +{ + // This may cause this resource to be over spent + // such that more are in use than total allowed + // Until those resources are released getAvailable will return 0. + mTotal = amount; +} + +S32 LLScriptResource::getTotal() const +{ + return mTotal; +} + +S32 LLScriptResource::getUsed() const +{ + return mUsed; +} + +bool LLScriptResource::isOverLimit() const +{ + return (mUsed > mTotal); +} diff --git a/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp b/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp new file mode 100644 index 0000000000..55d47b6de2 --- /dev/null +++ b/indra/lscript/lscript_execute/llscriptresourceconsumer.cpp @@ -0,0 +1,106 @@ +/** + * @file llscriptresourceconsumer.cpp + * @brief An interface for a script resource consumer. + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llscriptresourceconsumer.h" + +#include "llscriptresourcepool.h" + +LLScriptResourceConsumer::LLScriptResourceConsumer() + : mScriptResourcePool(&LLScriptResourcePool::null) +{ } + +// Get the resource pool this consumer is currently using. +// virtual +LLScriptResourcePool& LLScriptResourceConsumer::getScriptResourcePool() +{ + return *mScriptResourcePool; +} + +// Get the resource pool this consumer is currently using. +// virtual +const LLScriptResourcePool& LLScriptResourceConsumer::getScriptResourcePool() const +{ + return *mScriptResourcePool; +} + +// virtual +void LLScriptResourceConsumer::setScriptResourcePool(LLScriptResourcePool& new_pool) +{ + mScriptResourcePool = &new_pool; +} + +bool LLScriptResourceConsumer::switchScriptResourcePools(LLScriptResourcePool& new_pool) +{ + if (&new_pool == &LLScriptResourcePool::null) + { + llwarns << "New pool is null" << llendl; + } + + if (isInPool(new_pool)) + { + return true; + } + + if (!canUseScriptResourcePool(new_pool)) + { + return false; + } + + S32 used_urls = getUsedPublicURLs(); + + getScriptResourcePool().getPublicURLResource().release( used_urls ); + setScriptResourcePool(new_pool); + getScriptResourcePool().getPublicURLResource().request( used_urls ); + + return true; +} + +bool LLScriptResourceConsumer::canUseScriptResourcePool(const LLScriptResourcePool& resource_pool) +{ + if (isInPool(resource_pool)) + { + return true; + } + + if (resource_pool.getPublicURLResource().getAvailable() < getUsedPublicURLs()) + { + return false; + } + + return true; +} + +bool LLScriptResourceConsumer::isInPool(const LLScriptResourcePool& resource_pool) +{ + const LLScriptResourcePool& current_pool = getScriptResourcePool(); + if ( &resource_pool == ¤t_pool ) + { + // This consumer is already in this pool + return true; + } + return false; +} + diff --git a/indra/lscript/lscript_execute/llscriptresourcepool.cpp b/indra/lscript/lscript_execute/llscriptresourcepool.cpp new file mode 100644 index 0000000000..6bdc2bbd48 --- /dev/null +++ b/indra/lscript/lscript_execute/llscriptresourcepool.cpp @@ -0,0 +1,44 @@ +/** + * @file llscriptresourcepool.cpp + * @brief Collection of limited script resources + * + * $LicenseInfo:firstyear=2008&license=viewerlgpl$ + * Second Life Viewer Source Code + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA + * $/LicenseInfo$ + */ + +#include "llscriptresourcepool.h" + +LLScriptResourcePool LLScriptResourcePool::null; + +LLScriptResourcePool::LLScriptResourcePool() +{ + +} + +LLScriptResource& LLScriptResourcePool::getPublicURLResource() +{ + return mLSLPublicURLs; +} + +const LLScriptResource& LLScriptResourcePool::getPublicURLResource() const +{ + return mLSLPublicURLs; +} diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index 12b55c8ea8..d79e9f8bde 100644 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -2,35 +2,31 @@ * @file lscript_execute.cpp * @brief classes to execute bytecode * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #include "linden_common.h" +#include <algorithm> #include <sstream> #include "lscript_execute.h" @@ -39,13 +35,19 @@ #include "lscript_library.h" #include "lscript_heapruntime.h" #include "lscript_alloc.h" +#include "llstat.h" + + +// Static +const S32 DEFAULT_SCRIPT_TIMER_CHECK_SKIP = 4; +S32 LLScriptExecute::sTimerCheckSkip = DEFAULT_SCRIPT_TIMER_CHECK_SKIP; void (*binary_operations[LST_EOF][LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); void (*unary_operations[LST_EOF])(U8 *buffer, LSCRIPTOpCodesEnum opcode); -char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ +const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ { - "invalid", // LSRF_INVALID, + "Invalid", // LSRF_INVALID, "Math Error", // LSRF_MATH, "Stack-Heap Collision", // LSRF_STACK_HEAP_COLLISION, "Bounds Check Error", // LSRF_BOUND_CHECK_ERROR, @@ -55,16 +57,23 @@ char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/ "Hit Sandbox Limit", // LSRF_SANDBOX, "Chat Overrun", // LSRF_CHAT_OVERRUN, "Too Many Listens", // LSRF_TOO_MANY_LISTENS, - "Lists may not contain lists" // LSRF_NESTING_LISTS, + "Lists may not contain lists", // LSRF_NESTING_LISTS, + "CLI Exception" // LSRF_CLI }; -//static -S64 LLScriptExecute::sGlobalInstructionCount = 0; +void LLScriptExecuteLSL2::startRunning() {} +void LLScriptExecuteLSL2::stopRunning() {} + +const char* URL_REQUEST_GRANTED = "URL_REQUEST_GRANTED"; +const char* URL_REQUEST_DENIED = "URL_REQUEST_DENIED"; -LLScriptExecute::LLScriptExecute(FILE *fp) +// HTTP Requests to LSL scripts will time out after 25 seconds. +const U64 LSL_HTTP_REQUEST_TIMEOUT_USEC = 25 * USEC_PER_SEC; + +LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) { U8 sizearray[4]; - S32 filesize; + size_t filesize; S32 pos = 0; if (fread(&sizearray, 1, 4, fp) != 4) { @@ -84,19 +93,27 @@ LLScriptExecute::LLScriptExecute(FILE *fp) init(); } -LLScriptExecute::LLScriptExecute(U8 *buffer) +LLScriptExecuteLSL2::LLScriptExecuteLSL2(const U8* bytecode, U32 bytecode_size) { - mBuffer = buffer; - + mBuffer = new U8[TOP_OF_MEMORY]; + memset(mBuffer + bytecode_size, 0, TOP_OF_MEMORY - bytecode_size); + S32 src_offset = 0; + S32 dest_offset = 0; + bytestream2bytestream(mBuffer, dest_offset, bytecode, src_offset, bytecode_size); + mBytecodeSize = bytecode_size; + mBytecode = new U8[mBytecodeSize]; + memcpy(mBytecode, bytecode, mBytecodeSize); init(); } -LLScriptExecute::~LLScriptExecute() +LLScriptExecute::~LLScriptExecute() {} +LLScriptExecuteLSL2::~LLScriptExecuteLSL2() { - delete [] mBuffer; + delete[] mBuffer; + delete[] mBytecode; } -void LLScriptExecute::init() +void LLScriptExecuteLSL2::init() { S32 i, j; @@ -270,7 +287,7 @@ void LLScriptExecute::init() // Utility routine for when there's a boundary error parsing bytecode -void LLScriptExecute::recordBoundaryError( const LLUUID &id ) +void LLScriptExecuteLSL2::recordBoundaryError( const LLUUID &id ) { set_fault(mBuffer, LSRF_BOUND_CHECK_ERROR); llwarns << "Script boundary error for ID " << id << llendl; @@ -278,7 +295,7 @@ void LLScriptExecute::recordBoundaryError( const LLUUID &id ) // set IP to the event handler with some error checking -void LLScriptExecute::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id ) +void LLScriptExecuteLSL2::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id ) { S32 opcode_start = get_state_event_opcoode_start( mBuffer, state, event ); if ( opcode_start == -1 ) @@ -296,12 +313,499 @@ void LLScriptExecute::setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEv S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer); -U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL &state_transition) +void LLScriptExecuteLSL2::resumeEventHandler(BOOL b_print, const LLUUID &id, F32 time_slice) +{ + // call opcode run function pointer with buffer and IP + mInstructionCount++; + S32 value = get_register(mBuffer, LREG_IP); + S32 tvalue = value; + S32 opcode = safe_instruction_bytestream2byte(mBuffer, tvalue); + mExecuteFuncs[opcode](mBuffer, value, b_print, id); + set_ip(mBuffer, value); + add_register_fp(mBuffer, LREG_ESR, -0.1f); + // lsa_print_heap(mBuffer); + + if (b_print) + { + lsa_print_heap(mBuffer); + printf("ip: 0x%X\n", get_register(mBuffer, LREG_IP)); + printf("sp: 0x%X\n", get_register(mBuffer, LREG_SP)); + printf("bp: 0x%X\n", get_register(mBuffer, LREG_BP)); + printf("hr: 0x%X\n", get_register(mBuffer, LREG_HR)); + printf("hp: 0x%X\n", get_register(mBuffer, LREG_HP)); + } + + // NOTE: Babbage: all mExecuteFuncs return false. +} + +void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) +{ + S32 major_version = getMajorVersion(); + // push a zero to be popped + lscript_push(mBuffer, 0); + // push sp as current bp + S32 sp = get_register(mBuffer, LREG_SP); + lscript_push(mBuffer, sp); + + // Update current handler and current events registers. + set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); + U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); + current_events &= ~LSCRIPTStateBitField[event]; + set_event_register(mBuffer, LREG_CE, current_events, major_version); + + // now, push any additional stack space + U32 current_state = get_register(mBuffer, LREG_CS); + S32 additional_size = get_event_stack_size(mBuffer, current_state, event); + lscript_pusharge(mBuffer, additional_size); + + // now set the bp correctly + sp = get_register(mBuffer, LREG_SP); + sp += additional_size; + set_bp(mBuffer, sp); + + // set IP to the function + S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); + set_ip(mBuffer, opcode_start); +} + +//void callStateExitHandler() +//{ +// // push a zero to be popped +// lscript_push(mBuffer, 0); +// // push sp as current bp +// S32 sp = get_register(mBuffer, LREG_SP); +// lscript_push(mBuffer, sp); +// +// // now, push any additional stack space +// S32 additional_size = get_event_stack_size(mBuffer, current_state, LSTT_STATE_EXIT); +// lscript_pusharge(mBuffer, additional_size); +// +// sp = get_register(mBuffer, LREG_SP); +// sp += additional_size; +// set_bp(mBuffer, sp); +// +// // set IP to the event handler +// S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, LSTT_STATE_EXIT); +// set_ip(mBuffer, opcode_start); +//} +// +//void callStateEntryHandler() +//{ +// // push a zero to be popped +// lscript_push(mBuffer, 0); +// // push sp as current bp +// S32 sp = get_register(mBuffer, LREG_SP); +// lscript_push(mBuffer, sp); +// +// event = return_first_event((S32)LSCRIPTStateBitField[LSTT_STATE_ENTRY]); +// set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); +// current_events &= ~LSCRIPTStateBitField[event]; +// set_event_register(mBuffer, LREG_CE, current_events, major_version); +// +// // now, push any additional stack space +// S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; +// lscript_pusharge(mBuffer, additional_size); +// +// // now set the bp correctly +// sp = get_register(mBuffer, LREG_SP); +// sp += additional_size + size; +// set_bp(mBuffer, sp); +// // set IP to the function +// S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); +// set_ip(mBuffer, opcode_start); +//} + +void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) +{ + S32 major_version = getMajorVersion(); + LLScriptDataCollection* eventdata; + + for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) + { + if (eventdata->mType == event) + { + // push a zero to be popped + lscript_push(mBuffer, 0); + // push sp as current bp + S32 sp = get_register(mBuffer, LREG_SP); + lscript_push(mBuffer, sp); + + // Update current handler and current events registers. + set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); + U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); + current_events &= ~LSCRIPTStateBitField[event]; + set_event_register(mBuffer, LREG_CE, current_events, major_version); + + // push any arguments that need to be pushed onto the stack + // last piece of data will be type LST_NULL + LLScriptLibData *data = eventdata->mData; + U32 size = 0; + while (data->mType) + { + size += lscript_push_variable(data, mBuffer); + data++; + } + // now, push any additional stack space + U32 current_state = get_register(mBuffer, LREG_CS); + S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; + lscript_pusharge(mBuffer, additional_size); + + // now set the bp correctly + sp = get_register(mBuffer, LREG_SP); + sp += additional_size + size; + set_bp(mBuffer, sp); + + // set IP to the function + S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); + set_ip(mBuffer, opcode_start); + + mEventData.mEventDataList.deleteCurrentData(); + break; + } + } +} + +void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, const LLUUID &id, F32 time_slice) +{ + S32 major_version = getMajorVersion(); + LLScriptDataCollection* eventdata = mEventData.getNextEvent(); + if (eventdata) + { + LSCRIPTStateEventType event = eventdata->mType; + + // make sure that we can actually handle this one + if (LSCRIPTStateBitField[event] & event_register) + { + // push a zero to be popped + lscript_push(mBuffer, 0); + // push sp as current bp + S32 sp = get_register(mBuffer, LREG_SP); + lscript_push(mBuffer, sp); + + // Update current handler and current events registers. + set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); + U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); + current_events &= ~LSCRIPTStateBitField[event]; + set_event_register(mBuffer, LREG_CE, current_events, major_version); + + // push any arguments that need to be pushed onto the stack + // last piece of data will be type LST_NULL + LLScriptLibData *data = eventdata->mData; + U32 size = 0; + while (data->mType) + { + size += lscript_push_variable(data, mBuffer); + data++; + } + + // now, push any additional stack space + U32 current_state = get_register(mBuffer, LREG_CS); + S32 additional_size = get_event_stack_size(mBuffer, current_state, event) - size; + lscript_pusharge(mBuffer, additional_size); + + // now set the bp correctly + sp = get_register(mBuffer, LREG_SP); + sp += additional_size + size; + set_bp(mBuffer, sp); + + // set IP to the function + S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); + set_ip(mBuffer, opcode_start); + } + else + { + llwarns << "Somehow got an event that we're not registered for!" << llendl; + } + delete eventdata; + } +} + +U64 LLScriptExecuteLSL2::nextState() +{ + // copy NS to CS + S32 next_state = get_register(mBuffer, LREG_NS); + set_register(mBuffer, LREG_CS, next_state); + + // copy new state's handled events into ER (SR + CS*4 + 4) + return get_handled_events(mBuffer, next_state); +} + +//virtual +void LLScriptExecuteLSL2::addEvent(LLScriptDataCollection* event) +{ + mEventData.addEventData(event); +} + +//virtual +void LLScriptExecuteLSL2::removeEventType(LSCRIPTStateEventType event_type) +{ + mEventData.removeEventType(event_type); +} + +//virtual +F32 LLScriptExecuteLSL2::getSleep() const +{ + return get_register_fp(mBuffer, LREG_SLR); +} + +//virtual +void LLScriptExecuteLSL2::setSleep(F32 value) +{ + set_register_fp(mBuffer, LREG_SLR, value); +} + +//virtual +U64 LLScriptExecuteLSL2::getCurrentHandler() +{ + return get_event_register(mBuffer, LREG_IE, getMajorVersion()); +} + +//virtual +F32 LLScriptExecuteLSL2::getEnergy() const +{ + return get_register_fp(mBuffer, LREG_ESR); +} + +//virtual +void LLScriptExecuteLSL2::setEnergy(F32 value) +{ + set_register_fp(mBuffer, LREG_ESR, value); +} + +//virtual +U32 LLScriptExecuteLSL2::getFreeMemory() +{ + return get_register(mBuffer, LREG_SP) - get_register(mBuffer, LREG_HP); +} + +//virtual +S32 LLScriptExecuteLSL2::getParameter() +{ + return get_register(mBuffer, LREG_PR); +} + +//virtual +void LLScriptExecuteLSL2::setParameter(S32 value) +{ + set_register(mBuffer, LREG_PR, value); +} + + +S32 LLScriptExecuteLSL2::writeState(U8 **dest, U32 header_size, U32 footer_size) +{ + // data format: + // 4 bytes of size of Registers, Name and Description, and Global Variables + // Registers, Name and Description, and Global Variables data + // 4 bytes of size of Heap + // Heap data + // 4 bytes of stack size + // Stack data + + S32 registers_size = get_register(mBuffer, LREG_GFR); + + if (get_register(mBuffer, LREG_HP) > TOP_OF_MEMORY) + reset_hp_to_safe_spot(mBuffer); + + S32 heap_size = get_register(mBuffer, LREG_HP) - get_register(mBuffer, LREG_HR); + S32 stack_size = get_register(mBuffer, LREG_TM) - get_register(mBuffer, LREG_SP); + S32 total_size = registers_size + LSCRIPTDataSize[LST_INTEGER] + + heap_size + LSCRIPTDataSize[LST_INTEGER] + + stack_size + LSCRIPTDataSize[LST_INTEGER]; + + // actually allocate data + delete[] *dest; + *dest = new U8[header_size + total_size + footer_size]; + memset(*dest, 0, header_size + total_size + footer_size); + S32 dest_offset = header_size; + S32 src_offset = 0; + + // registers + integer2bytestream(*dest, dest_offset, registers_size); + + // llinfos << "Writing CE: " << getCurrentEvents() << llendl; + bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, registers_size); + + // heap + integer2bytestream(*dest, dest_offset, heap_size); + + src_offset = get_register(mBuffer, LREG_HR); + bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, heap_size); + + // stack + integer2bytestream(*dest, dest_offset, stack_size); + + src_offset = get_register(mBuffer, LREG_SP); + bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, stack_size); + + return total_size; +} + +S32 LLScriptExecuteLSL2::writeBytecode(U8 **dest) +{ + // data format: + // registers through top of heap + // Heap data + S32 total_size = get_register(mBuffer, LREG_HP); + + // actually allocate data + delete [] *dest; + *dest = new U8[total_size]; + S32 dest_offset = 0; + S32 src_offset = 0; + + bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, total_size); + + return total_size; +} + +S32 LLScriptExecuteLSL2::readState(U8 *src) +{ + // first, blitz heap and stack + S32 hr = get_register(mBuffer, LREG_HR); + S32 tm = get_register(mBuffer, LREG_TM); + memset(mBuffer + hr, 0, tm - hr); + + S32 src_offset = 0; + S32 dest_offset = 0; + S32 size; + + // read register size + size = bytestream2integer(src, src_offset); + + // copy data into register area + bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); +// llinfos << "Read CE: " << getCurrentEvents() << llendl; + if (get_register(mBuffer, LREG_TM) != TOP_OF_MEMORY) + { + llwarns << "Invalid state. Top of memory register does not match" + << " constant." << llendl; + reset_hp_to_safe_spot(mBuffer); + return -1; + } + + // read heap size + size = bytestream2integer(src, src_offset); + + // set dest offset + dest_offset = get_register(mBuffer, LREG_HR); + + if (dest_offset + size > TOP_OF_MEMORY) + { + reset_hp_to_safe_spot(mBuffer); + return -1; + } + + // copy data into heap area + bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); + + // read stack size + size = bytestream2integer(src, src_offset); + + // set dest offset + dest_offset = get_register(mBuffer, LREG_SP); + + if (dest_offset + size > TOP_OF_MEMORY) + { + reset_hp_to_safe_spot(mBuffer); + return -1; + } + + // copy data into heap area + bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); + + // Return offset to first byte after read data. + return src_offset; +} + +void LLScriptExecuteLSL2::reset() +{ + LLScriptExecute::reset(); + + const U8 *src = getBytecode(); + S32 size = getBytecodeSize(); + + if (!src) + return; + + // first, blitz heap and stack + S32 hr = get_register(mBuffer, LREG_HR); + S32 tm = get_register(mBuffer, LREG_TM); + memset(mBuffer + hr, 0, tm - hr); + + S32 dest_offset = 0; + S32 src_offset = 0; + + bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); +} + +S32 LLScriptExecuteLSL2::getMajorVersion() const +{ + S32 version = getVersion(); + S32 major_version = 0; + if (version == LSL2_VERSION1_END_NUMBER){ + major_version = 1; + } + else if (version == LSL2_VERSION_NUMBER) + { + major_version = 2; + } + return major_version; +} + +U32 LLScriptExecuteLSL2::getUsedMemory() +{ + return getBytecodeSize(); +} + +LLScriptExecute::LLScriptExecute() : + mReset(FALSE) +{ +} + +void LLScriptExecute::reset() +{ + mReset = FALSE; +} + +bool LLScriptExecute::isYieldDue() const +{ + if(mReset) + { + return true; + } + + if(getSleep() > 0.f) + { + return true; + } + + if(isFinished()) + { + return true; + } + + // State changes can occur within a single time slice, + // but LLScriptData's clean up is required. Yield here + // to allow LLScriptData to perform cleanup and then call + // runQuanta again. + if(isStateChangePending()) + { + return true; + } + + return false; +} + +// Run smallest number of instructions possible: +// a single instruction for LSL2, a segment between save tests for Mono +void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, + const char **errorstr, + U32& events_processed, + F32 quanta) { // is there a fault? // if yes, print out message and exit - state_transition = FALSE; - S32 value = get_register(mBuffer, LREG_VN); + S32 value = getVersion(); S32 major_version = 0; if (value == LSL2_VERSION1_END_NUMBER) { @@ -313,323 +817,156 @@ U32 LLScriptExecute::run(BOOL b_print, const LLUUID &id, char **errorstr, BOOL & } else { - set_fault(mBuffer, LSRF_VERSION_MISMATCH); + setFault(LSRF_VERSION_MISMATCH); } - value = get_register(mBuffer, LREG_FR); - if (value) + value = getFaults(); + if (value > LSRF_INVALID && value < LSRF_EOF) { if (b_print) { printf("Error!\n"); } *errorstr = LSCRIPTRunTimeFaultStrings[value]; - return NO_DELETE_FLAG; + return; } else { *errorstr = NULL; } - // Get IP - // is IP nonzero? - value = get_register(mBuffer, LREG_IP); - - if (value) + if (! isFinished()) { - // if yes, we're in opcodes, execute the next opcode by: - // call opcode run function pointer with buffer and IP - mInstructionCount++; - sGlobalInstructionCount++; - S32 tvalue = value; - S32 opcode = safe_instruction_bytestream2byte(mBuffer, tvalue); - S32 b_ret_val = mExecuteFuncs[opcode](mBuffer, value, b_print, id); - set_ip(mBuffer, value); - add_register_fp(mBuffer, LREG_ESR, -0.1f); - // lsa_print_heap(mBuffer); - - if (b_print) - { - lsa_print_heap(mBuffer); - printf("ip: 0x%X\n", get_register(mBuffer, LREG_IP)); - printf("sp: 0x%X\n", get_register(mBuffer, LREG_SP)); - printf("bp: 0x%X\n", get_register(mBuffer, LREG_BP)); - printf("hr: 0x%X\n", get_register(mBuffer, LREG_HR)); - printf("hp: 0x%X\n", get_register(mBuffer, LREG_HP)); - } - // update IP - if (b_ret_val) - { - return DELETE_FLAG | CREDIT_MONEY_FLAG; - } - else - { - return NO_DELETE_FLAG; - } + resumeEventHandler(b_print, id, quanta); + return; } else { // make sure that IE is zero - set_event_register(mBuffer, LREG_IE, 0, major_version); - - // if no, we're in a state and waiting for an event - S32 next_state = get_register(mBuffer, LREG_NS); - S32 current_state = get_register(mBuffer, LREG_CS); - U64 current_events = get_event_register(mBuffer, LREG_CE, major_version); - U64 event_register = get_event_register(mBuffer, LREG_ER, major_version); - // check NS to see if need to switch states (NS != CS) - if (next_state != current_state) + setCurrentHandler(0); + + // if no, we're in a state and waiting for an event + U64 current_events = getCurrentEvents(); + U64 event_register = getEventHandlers(); + + // check NS to see if need to switch states (NS != CS) + if (isStateChangePending()) { - state_transition = TRUE; // ok, blow away any pending events - mEventData.mEventDataList.deleteAllData(); + deleteAllEvents(); - // if yes, check state exit flag is set + // if yes, check state exit flag is set if (current_events & LSCRIPTStateBitField[LSTT_STATE_EXIT]) { - // if yes, clear state exit flag - set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[LSTT_STATE_EXIT], major_version); + // if yes, clear state exit flag + setCurrentHandler(LSCRIPTStateBitField[LSTT_STATE_EXIT]); current_events &= ~LSCRIPTStateBitField[LSTT_STATE_EXIT]; - set_event_register(mBuffer, LREG_CE, current_events, major_version); - // check state exit event handler - // if there is a handler, call it + setCurrentEvents(current_events); + + // check state exit event handler + // if there is a handler, call it if (event_register & LSCRIPTStateBitField[LSTT_STATE_EXIT]) { - // push a zero to be popped - lscript_push(mBuffer, 0); - // push sp as current bp - S32 sp = get_register(mBuffer, LREG_SP); - lscript_push(mBuffer, sp); - - // now, push any additional stack space - S32 additional_size = get_event_stack_size(mBuffer, current_state, LSTT_STATE_EXIT); - if ( additional_size == -1 ) - { - recordBoundaryError( id ); - } - else - { - lscript_pusharge(mBuffer, additional_size); - - sp = get_register(mBuffer, LREG_SP); - sp += additional_size; - set_bp(mBuffer, sp); - // set IP to the event handler - setStateEventOpcoodeStartSafely( current_state, LSTT_STATE_EXIT, id ); - } - return NO_DELETE_FLAG; + ++events_processed; + callEventHandler(LSTT_STATE_EXIT, id, quanta); + return; } } - // if no handler or no state exit flag switch to new state - // set state entry flag and clear other CE flags + + // if no handler or no state exit flag switch to new state + // set state entry flag and clear other CE flags current_events = LSCRIPTStateBitField[LSTT_STATE_ENTRY]; - set_event_register(mBuffer, LREG_CE, current_events, major_version); - // copy NS to CS - set_register(mBuffer, LREG_CS, next_state); - // copy new state's handled events into ER (SR + CS*4 + 4) - U64 handled_events = get_handled_events(mBuffer, next_state); - set_event_register(mBuffer, LREG_ER, handled_events, major_version); + setCurrentEvents(current_events); + + U64 handled_events = nextState(); + setEventHandlers(handled_events); } -// check to see if any current events are covered by events handled by this state (CE & ER != 0) -// now, we want to look like we were called like a function -// 0x0000: 00 00 00 00 (return ip) -// 0x0004: bp (current sp) -// 0x0008: parameters -// push sp -// add parameter size -// pop bp -// set ip - - S32 size = 0; -// try to get next event from stack + + // try to get next event from stack BOOL b_done = FALSE; LSCRIPTStateEventType event = LSTT_NULL; - LLScriptDataCollection *eventdata; - next_state = get_register(mBuffer, LREG_NS); - current_state = get_register(mBuffer, LREG_CS); - current_events = get_event_register(mBuffer, LREG_CE, major_version); - event_register = get_event_register(mBuffer, LREG_ER, major_version); + current_events = getCurrentEvents(); + event_register = getEventHandlers(); // first, check to see if state_entry or onrez are raised and handled - if ( (current_events & LSCRIPTStateBitField[LSTT_STATE_ENTRY]) + if ((current_events & LSCRIPTStateBitField[LSTT_STATE_ENTRY]) &&(current_events & event_register)) { - // ok, this is easy since there isn't any data waiting, just set it - // push a zero to be popped - lscript_push(mBuffer, 0); -// push sp as current bp - S32 sp = get_register(mBuffer, LREG_SP); - lscript_push(mBuffer, sp); - - event = return_first_event((S32)LSCRIPTStateBitField[LSTT_STATE_ENTRY]); - set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); - current_events &= ~LSCRIPTStateBitField[event]; - set_event_register(mBuffer, LREG_CE, current_events, major_version); -// now, push any additional stack space - S32 additional_size = get_event_stack_size(mBuffer, current_state, event); - if ( additional_size == -1 ) - { // b_done will be set, so we'll exit the loop at the bottom - recordBoundaryError( id ); - } - else - { - additional_size -= size; - lscript_pusharge(mBuffer, additional_size); - -// now set the bp correctly - sp = get_register(mBuffer, LREG_SP); - sp += additional_size + size; - set_bp(mBuffer, sp); -// set IP to the function - setStateEventOpcoodeStartSafely( current_state, event, id ); - } + ++events_processed; + callEventHandler(LSTT_STATE_ENTRY, id, quanta); b_done = TRUE; } - else if ( (current_events & LSCRIPTStateBitField[LSTT_REZ]) - &&(current_events & event_register)) + else if ((current_events & LSCRIPTStateBitField[LSTT_REZ]) + &&(current_events & event_register)) { - for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) - { - if (eventdata->mType & LSCRIPTStateBitField[LSTT_REZ]) - { - // push a zero to be popped - lscript_push(mBuffer, 0); - // push sp as current bp - S32 sp = get_register(mBuffer, LREG_SP); - lscript_push(mBuffer, sp); - - set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); - current_events &= ~LSCRIPTStateBitField[event]; - set_event_register(mBuffer, LREG_CE, current_events, major_version); - - // push any arguments that need to be pushed onto the stack - // last piece of data will be type LST_NULL - LLScriptLibData *data = eventdata->mData; - while (data->mType) - { - size += lscript_push_variable(data, mBuffer); - data++; - } - // now, push any additional stack space - S32 additional_size = get_event_stack_size(mBuffer, current_state, event); - if ( additional_size == -1 ) - { // b_done will be set, so we'll exit the loop at the bottom - recordBoundaryError( id ); - } - else - { - additional_size -= size; - lscript_pusharge(mBuffer, additional_size); - - // now set the bp correctly - sp = get_register(mBuffer, LREG_SP); - sp += additional_size + size; - set_bp(mBuffer, sp); - // set IP to the function - setStateEventOpcoodeStartSafely( current_state, event, id ); - mEventData.mEventDataList.deleteCurrentData(); - } - b_done = TRUE; - break; - } - } + ++events_processed; + callQueuedEventHandler(LSTT_REZ, id, quanta); + b_done = TRUE; } - while (!b_done) + if (!b_done) { - eventdata = mEventData.getNextEvent(); - if (eventdata) + // Call handler for next queued event. + if(getEventCount() > 0) { - event = eventdata->mType; - - // make sure that we can actually handle this one - if (LSCRIPTStateBitField[event] & event_register) - { - // push a zero to be popped - lscript_push(mBuffer, 0); - // push sp as current bp - S32 sp = get_register(mBuffer, LREG_SP); - lscript_push(mBuffer, sp); - - set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); - current_events &= ~LSCRIPTStateBitField[event]; - set_event_register(mBuffer, LREG_CE, current_events, major_version); - - // push any arguments that need to be pushed onto the stack - // last piece of data will be type LST_NULL - LLScriptLibData *data = eventdata->mData; - while (data->mType) - { - size += lscript_push_variable(data, mBuffer); - data++; - } - b_done = TRUE; - // now, push any additional stack space - S32 additional_size = get_event_stack_size(mBuffer, current_state, event); - if ( additional_size == -1 ) - { // b_done was just set, so we'll exit the loop at the bottom - recordBoundaryError( id ); - } - else - { - additional_size -= size; - lscript_pusharge(mBuffer, additional_size); - - // now set the bp correctly - sp = get_register(mBuffer, LREG_SP); - sp += additional_size + size; - set_bp(mBuffer, sp); - // set IP to the function - setStateEventOpcoodeStartSafely( current_state, event, id ); - } - } - else - { - llwarns << "Shit, somehow got an event that we're not registered for!" << llendl; - } - delete eventdata; + ++events_processed; + callNextQueuedEventHandler(event_register, id, quanta); } else { -// if no data waiting, do it the old way: + // if no data waiting, do it the old way: U64 handled_current = current_events & event_register; if (handled_current) { - // push a zero to be popped - lscript_push(mBuffer, 0); - // push sp as current bp - S32 sp = get_register(mBuffer, LREG_SP); - lscript_push(mBuffer, sp); - event = return_first_event((S32)handled_current); - set_event_register(mBuffer, LREG_IE, LSCRIPTStateBitField[event], major_version); - current_events &= ~LSCRIPTStateBitField[event]; - set_event_register(mBuffer, LREG_CE, current_events, major_version); - // now, push any additional stack space - S32 additional_size = get_event_stack_size(mBuffer, current_state, event); - if ( additional_size == -1 ) - { // b_done will be set, so we'll exit the loop at the bottom - recordBoundaryError( id ); - } - else - { - additional_size -= size; - lscript_pusharge(mBuffer, additional_size); - - // now set the bp correctly - sp = get_register(mBuffer, LREG_SP); - sp += additional_size + size; - set_bp(mBuffer, sp); - // set IP to the function - setStateEventOpcoodeStartSafely( current_state, event, id ); - } + ++events_processed; + callEventHandler(event, id, quanta); } - b_done = TRUE; } - } // while (!b_done) - } // end of else ... in state processing code + b_done = TRUE; + } + } +} + +// Run for a single timeslice, or until a yield or state transition is due +F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **errorstr, F32 quanta, U32& events_processed, LLTimer& timer) +{ + S32 timer_checks = 0; + F32 inloop = 0; - return NO_DELETE_FLAG; + // Loop while not finished, yield not due and time remaining + // NOTE: Default implementation does not do adaptive timer skipping + // to preserve current LSL behaviour and not break scripts that rely + // on current execution speed. + while(true) + { + runInstructions(b_print, id, errorstr, + events_processed, quanta); + + if(isYieldDue()) + { + break; + } + else if(timer_checks++ >= LLScriptExecute::sTimerCheckSkip) + { + inloop = timer.getElapsedTimeF32(); + if(inloop > quanta) + { + break; + } + timer_checks = 0; + } + } + if (inloop == 0.0f) + { + inloop = timer.getElapsedTimeF32(); + } + return inloop; +} + +F32 LLScriptExecute::runNested(BOOL b_print, const LLUUID &id, const char **errorstr, F32 quanta, U32& events_processed, LLTimer& timer) +{ + return LLScriptExecute::runQuanta(b_print, id, errorstr, quanta, events_processed, timer); } BOOL run_noop(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) @@ -2309,14 +2646,24 @@ void list_list_operation(U8 *buffer, LSCRIPTOpCodesEnum opcode) } } +static U8 safe_op_index(U8 index) +{ + if(index >= LST_EOF) + { + // Operations on LST_NULL will always be unknown_operation. + index = LST_NULL; + } + return index; +} + BOOL run_add(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) { if (b_print) printf("[0x%X]\tADD ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2334,8 +2681,8 @@ BOOL run_sub(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tSUB ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2352,8 +2699,8 @@ BOOL run_mul(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tMUL ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2370,8 +2717,8 @@ BOOL run_div(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tDIV ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2388,8 +2735,8 @@ BOOL run_mod(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tMOD ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2407,8 +2754,8 @@ BOOL run_eq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tEQ ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2425,8 +2772,8 @@ BOOL run_neq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tNEQ ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2443,8 +2790,8 @@ BOOL run_leq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tLEQ ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2461,8 +2808,8 @@ BOOL run_geq(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tGEQ ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2479,8 +2826,8 @@ BOOL run_less(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tLESS ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2497,8 +2844,8 @@ BOOL run_greater(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) printf("[0x%X]\tGREATER ", offset); offset++; U8 arg = safe_instruction_bytestream2byte(buffer, offset); - U8 arg1 = arg >> 4; - U8 arg2 = arg & 0xf; + U8 arg1 = safe_op_index(arg >> 4); + U8 arg2 = safe_op_index(arg & 0xf); if (b_print) { print_type(arg1); @@ -2640,13 +2987,12 @@ void quaternion_operation(U8 *buffer, LSCRIPTOpCodesEnum opcode) } } - BOOL run_neg(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) { if (b_print) printf("[0x%X]\tNEG ", offset); offset++; - U8 arg = safe_instruction_bytestream2byte(buffer, offset); + U8 arg = safe_op_index(safe_instruction_bytestream2byte(buffer, offset)); if (b_print) { print_type(arg); @@ -2972,7 +3318,7 @@ BOOL run_state(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) { major_version = 2; } - + S32 current_state = get_register(buffer, LREG_CS); if (state != current_state) { @@ -3027,46 +3373,19 @@ BOOL run_return(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) if (b_print) printf("[0x%X]\tRETURN\n", offset); offset++; - S32 bp = lscript_pop_int(buffer); + + // SEC-53: babbage: broken instructions may allow inbalanced pushes and + // pops which can cause caller BP and return IP to be corrupted, so restore + // SP from BP before popping caller BP and IP. + S32 bp = get_register(buffer, LREG_BP); + set_sp(buffer, bp); + + bp = lscript_pop_int(buffer); set_bp(buffer, bp); offset = lscript_pop_int(buffer); return FALSE; } -S32 axtoi(char *hexStg) -{ - S32 n = 0; // position in string - S32 m = 0; // position in digit[] to shift - S32 count; // loop index - S32 intValue = 0; // integer value of hex string - S32 digit[9]; // hold values to convert - while (n < 8) - { - if (hexStg[n]=='\0') - break; - if (hexStg[n] > 0x29 && hexStg[n] < 0x40 ) //if 0 to 9 - digit[n] = hexStg[n] & 0x0f; //convert to int - else if (hexStg[n] >='a' && hexStg[n] <= 'f') //if a to f - digit[n] = (hexStg[n] & 0x0f) + 9; //convert to int - else if (hexStg[n] >='A' && hexStg[n] <= 'F') //if A to F - digit[n] = (hexStg[n] & 0x0f) + 9; //convert to int - else break; - n++; - } - count = n; - m = n - 1; - n = 0; - while(n < count) - { - // digit[n] is value of hex digit at position n - // (m << 2) is the number of positions to shift - // OR the bits into return value - intValue = intValue | (digit[n] << (m << 2)); - m--; // adjust the position to set - n++; // next digit to process - } - return (intValue); -} BOOL run_cast(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) @@ -3702,56 +4021,49 @@ BOOL run_print(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) } -void lscript_run(char *filename, BOOL b_debug) +void lscript_run(const std::string& filename, BOOL b_debug) { LLTimer timer; - if (filename == NULL) + + const char *error; + LLScriptExecuteLSL2 *execute = NULL; + + if (filename.empty()) { llerrs << "filename is NULL" << llendl; // Just reporting error is likely not enough. Need // to check how to abort or error out gracefully // from this function. XXXTBD } - else + LLFILE* file = LLFile::fopen(filename, "r"); /* Flawfinder: ignore */ + if(file) { - char *error; - BOOL b_state; - LLScriptExecute *execute = NULL; - - FILE* file = LLFile::fopen(filename, "r"); - if (file) - { - execute = new LLScriptExecute(file); - // note: LLScriptExecute() closes file for us - } - file = LLFile::fopen(filename, "r"); - if (file) - { - FILE* fp = LLFile::fopen("lscript.parse", "w"); /*Flawfinder: ignore*/ - LLScriptLSOParse *parse = new LLScriptLSOParse(file); - parse->printData(fp); - delete parse; - fclose(file); - fclose(fp); - } - file = LLFile::fopen(filename, "r"); - if (file && execute) - { - timer.reset(); - while (!execute->run(b_debug, LLUUID::null, &error, b_state)) - ; - F32 time = timer.getElapsedTimeF32(); - F32 ips = execute->mInstructionCount / time; - llinfos << execute->mInstructionCount << " instructions in " << time << " seconds" << llendl; - llinfos << ips/1000 << "K instructions per second" << llendl; - printf("ip: 0x%X\n", get_register(execute->mBuffer, LREG_IP)); - printf("sp: 0x%X\n", get_register(execute->mBuffer, LREG_SP)); - printf("bp: 0x%X\n", get_register(execute->mBuffer, LREG_BP)); - printf("hr: 0x%X\n", get_register(execute->mBuffer, LREG_HR)); - printf("hp: 0x%X\n", get_register(execute->mBuffer, LREG_HP)); - delete execute; - fclose(file); - } + execute = new LLScriptExecuteLSL2(file); + fclose(file); + } + if (execute) + { + timer.reset(); + F32 time_slice = 3600.0f; // 1 hr. + U32 events_processed = 0; + + do { + LLTimer timer2; + execute->runQuanta(b_debug, LLUUID::null, &error, + time_slice, events_processed, timer2); + } while (!execute->isFinished()); + + F32 time = timer.getElapsedTimeF32(); + F32 ips = execute->mInstructionCount / time; + llinfos << execute->mInstructionCount << " instructions in " << time << " seconds" << llendl; + llinfos << ips/1000 << "K instructions per second" << llendl; + printf("ip: 0x%X\n", get_register(execute->mBuffer, LREG_IP)); + printf("sp: 0x%X\n", get_register(execute->mBuffer, LREG_SP)); + printf("bp: 0x%X\n", get_register(execute->mBuffer, LREG_BP)); + printf("hr: 0x%X\n", get_register(execute->mBuffer, LREG_HR)); + printf("hp: 0x%X\n", get_register(execute->mBuffer, LREG_HP)); + delete execute; + fclose(file); } } @@ -3772,7 +4084,8 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type) break; case 'k': data->mType = LST_KEY; - + data->mKey = NULL; + base_address = lscript_pop_int(buffer); // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization // and function clean up of ref counts isn't based on scope (a mistake, I know) @@ -3791,7 +4104,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type) } lsa_decrease_ref_count(buffer, base_address); } - else + if (data->mKey == NULL) { data->mKey = new char[1]; data->mKey[0] = 0; @@ -3799,6 +4112,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type) break; case 's': data->mType = LST_STRING; + data->mString = NULL; base_address = lscript_pop_int(buffer); // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization @@ -3818,7 +4132,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type) } lsa_decrease_ref_count(buffer, base_address); } - else + if (data->mString == NULL) { data->mString = new char[1]; data->mString[0] = 0; @@ -3917,19 +4231,16 @@ S32 lscript_push_variable(LLScriptLibData *data, U8 *buffer) return 4; } -BOOL run_calllib(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) + +// Shared code for run_calllib() and run_calllib_two_byte() +BOOL run_calllib_common(U8 *buffer, S32 &offset, const LLUUID &id, U16 arg) { - if (b_print) - printf("[0x%X]\tCALLLIB ", offset); - offset++; - U8 arg = safe_instruction_bytestream2byte(buffer, offset); - if (arg >= gScriptLibrary.mNextNumber) + if (arg >= gScriptLibrary.mFunctions.size()) { set_fault(buffer, LSRF_BOUND_CHECK_ERROR); return FALSE; } - if (b_print) - printf("%d (%s)\n", (U32)arg, gScriptLibrary.mFunctions[arg]->mName); + LLScriptLibraryFunction const & function = gScriptLibrary.mFunctions[arg]; // pull out the arguments and the return values LLScriptLibData *arguments = NULL; @@ -3937,14 +4248,14 @@ BOOL run_calllib(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) S32 i, number; - if (gScriptLibrary.mFunctions[arg]->mReturnType) + if (function.mReturnType) { returnvalue = new LLScriptLibData; } - if (gScriptLibrary.mFunctions[arg]->mArgs) + if (function.mArgs) { - number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs); /*Flawfinder: ignore*/ + number = (S32)strlen(function.mArgs); //Flawfinder: ignore arguments = new LLScriptLibData[number]; } else @@ -3954,24 +4265,18 @@ BOOL run_calllib(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) for (i = number - 1; i >= 0; i--) { - lscript_pop_variable(&arguments[i], buffer, gScriptLibrary.mFunctions[arg]->mArgs[i]); + lscript_pop_variable(&arguments[i], buffer, function.mArgs[i]); } - if (b_print) - { - printf("%s\n", gScriptLibrary.mFunctions[arg]->mDesc); - } + // Actually execute the function call + function.mExecFunc(returnvalue, arguments, id); - { - // LLFastTimer time_in_libraries1(LLFastTimer::FTM_TEMP7); - gScriptLibrary.mFunctions[arg]->mExecFunc(returnvalue, arguments, id); - } - add_register_fp(buffer, LREG_ESR, -gScriptLibrary.mFunctions[arg]->mEnergyUse); - add_register_fp(buffer, LREG_SLR, gScriptLibrary.mFunctions[arg]->mSleepTime); + add_register_fp(buffer, LREG_ESR, -(function.mEnergyUse)); + add_register_fp(buffer, LREG_SLR, function.mSleepTime); if (returnvalue) { - returnvalue->mType = char2type(*gScriptLibrary.mFunctions[arg]->mReturnType); + returnvalue->mType = char2type(*function.mReturnType); lscript_push_return_variable(returnvalue, buffer); } @@ -3988,72 +4293,32 @@ BOOL run_calllib(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) } -BOOL run_calllib_two_byte(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) +BOOL run_calllib(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) { - if (b_print) - printf("[0x%X]\tCALLLIB ", offset); offset++; - U16 arg = safe_instruction_bytestream2u16(buffer, offset); - if (arg >= gScriptLibrary.mNextNumber) + U16 arg = (U16) safe_instruction_bytestream2byte(buffer, offset); + if (b_print && + arg < gScriptLibrary.mFunctions.size()) { - set_fault(buffer, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - if (b_print) - printf("%d (%s)\n", (U32)arg, gScriptLibrary.mFunctions[arg]->mName); - - // pull out the arguments and the return values - LLScriptLibData *arguments = NULL; - LLScriptLibData *returnvalue = NULL; - - S32 i, number; - - if (gScriptLibrary.mFunctions[arg]->mReturnType) - { - returnvalue = new LLScriptLibData; - } - - if (gScriptLibrary.mFunctions[arg]->mArgs) - { - number = (S32)strlen(gScriptLibrary.mFunctions[arg]->mArgs); /*Flawfinder: ignore*/ - arguments = new LLScriptLibData[number]; - } - else - { - number = 0; - } - - for (i = number - 1; i >= 0; i--) - { - lscript_pop_variable(&arguments[i], buffer, gScriptLibrary.mFunctions[arg]->mArgs[i]); - } - - if (b_print) - { - printf("%s\n", gScriptLibrary.mFunctions[arg]->mDesc); - } - - { - // LLFastTimer time_in_libraries2(LLFastTimer::FTM_TEMP8); - gScriptLibrary.mFunctions[arg]->mExecFunc(returnvalue, arguments, id); + printf("[0x%X]\tCALLLIB ", offset); + LLScriptLibraryFunction const & function = gScriptLibrary.mFunctions[arg]; + printf("%d (%s)\n", (U32)arg, function.mName); + //printf("%s\n", function.mDesc); } - add_register_fp(buffer, LREG_ESR, -gScriptLibrary.mFunctions[arg]->mEnergyUse); - add_register_fp(buffer, LREG_SLR, gScriptLibrary.mFunctions[arg]->mSleepTime); + return run_calllib_common(buffer, offset, id, arg); +} - if (returnvalue) +BOOL run_calllib_two_byte(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id) +{ + offset++; + U16 arg = safe_instruction_bytestream2u16(buffer, offset); + if (b_print && + arg < gScriptLibrary.mFunctions.size()) { - returnvalue->mType = char2type(*gScriptLibrary.mFunctions[arg]->mReturnType); - lscript_push_return_variable(returnvalue, buffer); + printf("[0x%X]\tCALLLIB ", (offset-1)); + LLScriptLibraryFunction const & function = gScriptLibrary.mFunctions[arg]; + printf("%d (%s)\n", (U32)arg, function.mName); + //printf("%s\n", function.mDesc); } - - delete [] arguments; - delete returnvalue; - - // reset the BP after calling the library files - S32 bp = lscript_pop_int(buffer); - set_bp(buffer, bp); - - // pop off the spot for the instruction pointer - lscript_poparg(buffer, 4); - return FALSE; + return run_calllib_common(buffer, offset, id, arg); } diff --git a/indra/lscript/lscript_execute/lscript_heapruntime.cpp b/indra/lscript/lscript_execute/lscript_heapruntime.cpp index 057db79f6f..749857753d 100644 --- a/indra/lscript/lscript_execute/lscript_heapruntime.cpp +++ b/indra/lscript/lscript_execute/lscript_heapruntime.cpp @@ -2,30 +2,25 @@ * @file lscript_heapruntime.cpp * @brief classes to manage script heap at runtime * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_execute/lscript_heapruntime.h b/indra/lscript/lscript_execute/lscript_heapruntime.h index c4ade6cb62..0e924a2036 100644 --- a/indra/lscript/lscript_execute/lscript_heapruntime.h +++ b/indra/lscript/lscript_execute/lscript_heapruntime.h @@ -2,30 +2,25 @@ * @file lscript_heapruntime.h * @brief classes to manage script heap at runtime * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_execute/lscript_readlso.cpp b/indra/lscript/lscript_execute/lscript_readlso.cpp index e949374258..35caa41ae1 100644 --- a/indra/lscript/lscript_execute/lscript_readlso.cpp +++ b/indra/lscript/lscript_execute/lscript_readlso.cpp @@ -2,30 +2,25 @@ * @file lscript_readlso.cpp * @brief classes to read lso file * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -35,10 +30,10 @@ #include "lscript_library.h" #include "lscript_alloc.h" -LLScriptLSOParse::LLScriptLSOParse(FILE *fp) +LLScriptLSOParse::LLScriptLSOParse(LLFILE *fp) { U8 sizearray[4]; - S32 filesize; + size_t filesize; S32 pos = 0; if (fread(&sizearray, 1, 4, fp) != 4) { @@ -68,7 +63,7 @@ LLScriptLSOParse::~LLScriptLSOParse() delete [] mRawData; } -void LLScriptLSOParse::printData(FILE *fp) +void LLScriptLSOParse::printData(LLFILE *fp) { @@ -86,14 +81,14 @@ void LLScriptLSOParse::printData(FILE *fp) printHeap(fp); } -void LLScriptLSOParse::printNameDesc(FILE *fp) +void LLScriptLSOParse::printNameDesc(LLFILE *fp) { fprintf(fp, "=============================\n\n"); } S32 gMajorVersion = 0; -void LLScriptLSOParse::printRegisters(FILE *fp) +void LLScriptLSOParse::printRegisters(LLFILE *fp) { // print out registers first S32 i; @@ -125,7 +120,7 @@ void LLScriptLSOParse::printRegisters(FILE *fp) fprintf(fp, "=============================\n\n"); } -void LLScriptLSOParse::printGlobals(FILE *fp) +void LLScriptLSOParse::printGlobals(LLFILE *fp) { // print out registers first S32 offset, varoffset; @@ -195,7 +190,7 @@ void LLScriptLSOParse::printGlobals(FILE *fp) fprintf(fp, "=============================\n\n"); } -void LLScriptLSOParse::printGlobalFunctions(FILE *fp) +void LLScriptLSOParse::printGlobalFunctions(LLFILE *fp) { // print out registers first S32 i, offset; @@ -284,7 +279,7 @@ void LLScriptLSOParse::printGlobalFunctions(FILE *fp) fprintf(fp, "=============================\n\n"); } -void LLScriptLSOParse::printStates(FILE *fp) +void LLScriptLSOParse::printStates(LLFILE *fp) { // print out registers first S32 i, offset; @@ -624,6 +619,16 @@ void LLScriptLSOParse::printStates(FILE *fp) bytestream2char(name, mRawData, event_offset, sizeof(name)); fprintf(fp, "\t\tstring %s\n", name); break; + case LSTT_HTTP_REQUEST: // LSTT_HTTP_REQUEST + bytestream2char(name, mRawData, event_offset, sizeof(name)); + fprintf(fp, "%s\n", name); + bytestream2char(name, mRawData, event_offset, sizeof(name)); + fprintf(fp, "\t\tkey %s\n", name); + bytestream2char(name, mRawData, event_offset, sizeof(name)); + fprintf(fp, "\t\tstring %s\n", name); + bytestream2char(name, mRawData, event_offset, sizeof(name)); + fprintf(fp, "\t\tstring %s\n", name); + break; default: break; } @@ -637,7 +642,7 @@ void LLScriptLSOParse::printStates(FILE *fp) fprintf(fp, "=============================\n\n"); } -void LLScriptLSOParse::printHeap(FILE *fp) +void LLScriptLSOParse::printHeap(LLFILE *fp) { // print out registers first @@ -652,7 +657,7 @@ void LLScriptLSOParse::printHeap(FILE *fp) fprintf(fp, "=============================\n\n"); } -void lso_print_tabs(FILE *fp, S32 tabs) +void lso_print_tabs(LLFILE *fp, S32 tabs) { S32 i; for (i = 0; i < tabs; i++) @@ -661,13 +666,13 @@ void lso_print_tabs(FILE *fp, S32 tabs) } } -void LLScriptLSOParse::printOpCodes(FILE *fp, S32 &offset, S32 tabs) +void LLScriptLSOParse::printOpCodes(LLFILE *fp, S32 &offset, S32 tabs) { U8 opcode = *(mRawData + offset); mPrintOpCodes[opcode](fp, mRawData, offset, tabs); } -void LLScriptLSOParse::printOpCodeRange(FILE *fp, S32 start, S32 end, S32 tabs) +void LLScriptLSOParse::printOpCodeRange(LLFILE *fp, S32 start, S32 end, S32 tabs) { while (start < end) { @@ -791,43 +796,43 @@ void LLScriptLSOParse::initOpCodePrinting() mPrintOpCodes[LSCRIPTOpCodes[LOPC_CALLLIB_TWO_BYTE]] = print_calllib_two_byte; } -void print_noop(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_noop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tNOOP\n", offset++); } -void print_pop(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOP\n", offset++); } -void print_pops(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pops(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPS\n", offset++); } -void print_popl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_popl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPL\n", offset++); } -void print_popv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_popv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPV\n", offset++); } -void print_popq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_popq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPQ\n", offset++); } -void print_poparg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_poparg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -836,61 +841,61 @@ void print_poparg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_popip(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_popip(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPIP\n", offset++); } -void print_popbp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_popbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPBP\n", offset++); } -void print_popsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_popsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPSP\n", offset++); } -void print_popslr(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_popslr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPOPSLR\n", offset++); } -void print_dup(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_dup(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tDUP\n", offset++); } -void print_dups(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_dups(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tDUPS\n", offset++); } -void print_dupl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_dupl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tDUPL\n", offset++); } -void print_dupv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_dupv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tDUPV\n", offset++); } -void print_dupq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_dupq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tDUPQ\n", offset++); } -void print_store(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_store(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -899,7 +904,7 @@ void print_store(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_stores(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_stores(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -908,7 +913,7 @@ void print_stores(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_storel(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storel(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -917,7 +922,7 @@ void print_storel(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_storev(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -926,7 +931,7 @@ void print_storev(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_storeq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storeq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -935,7 +940,7 @@ void print_storeq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_storeg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storeg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -944,7 +949,7 @@ void print_storeg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_storegs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storegs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -953,7 +958,7 @@ void print_storegs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_storegl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storegl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -962,7 +967,7 @@ void print_storegl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_storegv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storegv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -971,7 +976,7 @@ void print_storegv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_storegq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_storegq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -980,7 +985,7 @@ void print_storegq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_loadp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -989,7 +994,7 @@ void print_loadp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_loadsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -998,7 +1003,7 @@ void print_loadsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_loadlp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadlp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1007,7 +1012,7 @@ void print_loadlp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_loadvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1016,7 +1021,7 @@ void print_loadvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_loadqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1025,7 +1030,7 @@ void print_loadqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_loadgp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadgp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1034,7 +1039,7 @@ void print_loadgp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_loadgsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadgsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1043,7 +1048,7 @@ void print_loadgsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_loadglp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadglp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1052,7 +1057,7 @@ void print_loadglp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_loadgvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadgvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1061,7 +1066,7 @@ void print_loadgvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_loadgqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_loadgqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1070,7 +1075,7 @@ void print_loadgqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg + get_register(buffer, LREG_GVR)); } -void print_push(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_push(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1079,7 +1084,7 @@ void print_push(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_pushs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1088,7 +1093,7 @@ void print_pushs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_pushl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1097,7 +1102,7 @@ void print_pushl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_pushv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1106,7 +1111,7 @@ void print_pushv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_pushq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1115,7 +1120,7 @@ void print_pushq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_pushg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1124,7 +1129,7 @@ void print_pushg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "0x%X\n", arg + get_register(buffer, LREG_GVR)); } -void print_pushgs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushgs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1133,7 +1138,7 @@ void print_pushgs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "0x%X\n", arg + get_register(buffer, LREG_GVR)); } -void print_pushgl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushgl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1142,7 +1147,7 @@ void print_pushgl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "0x%X\n", arg + get_register(buffer, LREG_GVR)); } -void print_pushgv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushgv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1151,7 +1156,7 @@ void print_pushgv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "0x%X\n", arg + get_register(buffer, LREG_GVR)); } -void print_pushgq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushgq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1160,25 +1165,25 @@ void print_pushgq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "0x%X\n", arg + get_register(buffer, LREG_GVR)); } -void print_puship(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_puship(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPUSHIP\n", offset++); } -void print_pushbp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPUSHBP\n", offset++); } -void print_pushsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPUSHSP\n", offset++); } -void print_pushargb(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushargb(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 arg; lso_print_tabs(fp, tabs); @@ -1187,7 +1192,7 @@ void print_pushargb(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", (U32)arg); } -void print_pushargi(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushargi(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1196,7 +1201,7 @@ void print_pushargi(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_pushargf(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushargf(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { F32 arg; lso_print_tabs(fp, tabs); @@ -1205,7 +1210,7 @@ void print_pushargf(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%f\n", arg); } -void print_pushargs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushargs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { char arg[1024]; /*Flawfinder: ignore*/ lso_print_tabs(fp, tabs); @@ -1214,7 +1219,7 @@ void print_pushargs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s\n", arg); } -void print_pushargv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushargv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { LLVector3 arg; lso_print_tabs(fp, tabs); @@ -1223,7 +1228,7 @@ void print_pushargv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "< %f, %f, %f >\n", arg.mV[VX], arg.mV[VY], arg.mV[VZ]); } -void print_pushargq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushargq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { LLQuaternion arg; lso_print_tabs(fp, tabs); @@ -1232,25 +1237,25 @@ void print_pushargq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "< %f, %f, %f, %f >\n", arg.mQ[VX], arg.mQ[VY], arg.mQ[VZ], arg.mQ[VS]); } -void print_pushe(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushe(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPUSHE\n", offset++); } -void print_pushev(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pushev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPUSHEV\n", offset++); } -void print_pusheq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pusheq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPUSHEQ\n", offset++); } -void print_pusharge(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_pusharge(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1260,7 +1265,7 @@ void print_pusharge(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) } -void print_add(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_add(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1273,7 +1278,7 @@ void print_add(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_sub(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_sub(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1286,7 +1291,7 @@ void print_sub(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_mul(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_mul(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1299,7 +1304,7 @@ void print_mul(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_div(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_div(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1312,7 +1317,7 @@ void print_div(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_mod(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_mod(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1325,7 +1330,7 @@ void print_mod(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_eq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_eq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1338,7 +1343,7 @@ void print_eq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_neq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_neq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1351,7 +1356,7 @@ void print_neq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_leq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_leq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1364,7 +1369,7 @@ void print_leq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_geq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_geq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1377,7 +1382,7 @@ void print_geq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_less(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_less(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1390,7 +1395,7 @@ void print_less(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_greater(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_greater(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1404,50 +1409,50 @@ void print_greater(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) } -void print_bitand(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_bitand(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tBITAND\n", offset++); } -void print_bitor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_bitor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tBITOR\n", offset++); } -void print_bitxor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_bitxor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tBITXOR\n", offset++); } -void print_booland(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_booland(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tBOOLAND\n", offset++); } -void print_boolor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_boolor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tBOOLOR\n", offset++); } -void print_shl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_shl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tSHL\n", offset++); } -void print_shr(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_shr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tSHR\n", offset++); } -void print_neg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_neg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 type; lso_print_tabs(fp, tabs); @@ -1456,19 +1461,19 @@ void print_neg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s\n", LSCRIPTTypeNames[type]); } -void print_bitnot(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_bitnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tBITNOT\n", offset++); } -void print_boolnot(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_boolnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tBOOLNOT\n", offset++); } -void print_jump(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_jump(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1477,7 +1482,7 @@ void print_jump(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_jumpif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_jumpif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; U8 type; @@ -1488,7 +1493,7 @@ void print_jumpif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %d\n", LSCRIPTTypeNames[type], arg); } -void print_jumpnif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_jumpnif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; U8 type; @@ -1499,7 +1504,7 @@ void print_jumpnif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %d\n", LSCRIPTTypeNames[type], arg); } -void print_state(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_state(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1508,7 +1513,7 @@ void print_state(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_call(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_call(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1517,13 +1522,13 @@ void print_call(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_return(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_return(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tRETURN\n", offset++); } -void print_cast(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_cast(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 types; U8 type1; @@ -1536,7 +1541,7 @@ void print_cast(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s, %s\n", LSCRIPTTypeNames[type1], LSCRIPTTypeNames[type2]); } -void print_stacktos(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_stacktos(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1545,7 +1550,7 @@ void print_stacktos(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_stacktol(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_stacktol(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { S32 arg; lso_print_tabs(fp, tabs); @@ -1554,7 +1559,7 @@ void print_stacktol(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%d\n", arg); } -void print_print(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_print(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tPRINT ", offset++); @@ -1562,22 +1567,22 @@ void print_print(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) fprintf(fp, "%s\n", LSCRIPTTypeNames[type]); } -void print_calllib(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_calllib(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U8 arg; lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tCALLLIB ", offset++); arg = *(buffer + offset++); - fprintf(fp, "%d (%s)\n", (U32)arg, gScriptLibrary.mFunctions[arg]->mName); + fprintf(fp, "%d (%s)\n", (U32)arg, gScriptLibrary.mFunctions[arg].mName); } -void print_calllib_two_byte(FILE *fp, U8 *buffer, S32 &offset, S32 tabs) +void print_calllib_two_byte(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs) { U16 arg; lso_print_tabs(fp, tabs); fprintf(fp, "[0x%X]\tCALLLIB_TWO_BYTE ", offset++); arg = bytestream2u16(buffer, offset); - fprintf(fp, "%d (%s)\n", (U32)arg, gScriptLibrary.mFunctions[arg]->mName); + fprintf(fp, "%d (%s)\n", (U32)arg, gScriptLibrary.mFunctions[arg].mName); } diff --git a/indra/lscript/lscript_execute/lscript_readlso.h b/indra/lscript/lscript_execute/lscript_readlso.h index 92c9dfab45..a545a9daf8 100644 --- a/indra/lscript/lscript_execute/lscript_readlso.h +++ b/indra/lscript/lscript_execute/lscript_readlso.h @@ -2,30 +2,25 @@ * @file lscript_readlso.h * @brief classes to read lso file * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -36,135 +31,135 @@ #include "linked_lists.h" // list of op code print functions -void print_noop(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pop(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pops(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_popl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_popv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_popq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_poparg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_popip(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_popbp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_popsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_popslr(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_dup(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_dups(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_dupl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_dupv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_dupq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_store(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_stores(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storel(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storev(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storeq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storeg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storegs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storegl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storegv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_storegq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadlp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadgp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadgsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadglp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadgvp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_loadgqp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_push(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushgl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushgs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushgv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushgq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_puship(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushbp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushsp(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushargb(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushargi(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushargf(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushargs(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushargv(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushargq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushe(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pushev(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pusheq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_pusharge(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_add(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_sub(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_mul(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_div(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_mod(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_eq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_neq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_leq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_geq(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_less(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_greater(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_bitand(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_bitor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_bitxor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_booland(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_boolor(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_shl(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_shr(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_neg(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_bitnot(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_boolnot(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_jump(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_jumpif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_jumpnif(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_state(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_call(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_return(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_cast(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_stacktos(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_stacktol(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_print(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); - -void print_calllib(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); -void print_calllib_two_byte(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_noop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pop(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pops(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_popl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_popv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_popq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_poparg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_popip(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_popbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_popsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_popslr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_dup(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_dups(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_dupl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_dupv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_dupq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_store(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_stores(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storel(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storeq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storeg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storegs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storegl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storegv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_storegq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadlp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadgp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadgsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadglp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadgvp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_loadgqp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_push(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushgl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushgs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushgv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushgq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_puship(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushbp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushsp(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushargb(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushargi(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushargf(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushargs(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushargv(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushargq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushe(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pushev(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pusheq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_pusharge(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_add(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_sub(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_mul(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_div(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_mod(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_eq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_neq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_leq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_geq(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_less(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_greater(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_bitand(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_bitor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_bitxor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_booland(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_boolor(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_shl(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_shr(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_neg(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_bitnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_boolnot(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_jump(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_jumpif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_jumpnif(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_state(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_call(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_return(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_cast(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_stacktos(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_stacktol(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_print(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); + +void print_calllib(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); +void print_calllib_two_byte(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); class LLScriptLSOParse { public: - LLScriptLSOParse(FILE *fp); + LLScriptLSOParse(LLFILE *fp); LLScriptLSOParse(U8 *buffer); ~LLScriptLSOParse(); void initOpCodePrinting(); - void printData(FILE *fp); - void printNameDesc(FILE *fp); - void printRegisters(FILE *fp); - void printGlobals(FILE *fp); - void printGlobalFunctions(FILE *fp); - void printStates(FILE *fp); - void printHeap(FILE *fp); - void printOpCodes(FILE *fp, S32 &offset, S32 tabs); - void printOpCodeRange(FILE *fp, S32 start, S32 end, S32 tabs); + void printData(LLFILE *fp); + void printNameDesc(LLFILE *fp); + void printRegisters(LLFILE *fp); + void printGlobals(LLFILE *fp); + void printGlobalFunctions(LLFILE *fp); + void printStates(LLFILE *fp); + void printHeap(LLFILE *fp); + void printOpCodes(LLFILE *fp, S32 &offset, S32 tabs); + void printOpCodeRange(LLFILE *fp, S32 start, S32 end, S32 tabs); U8 *mRawData; - void (*mPrintOpCodes[0x100])(FILE *fp, U8 *buffer, S32 &offset, S32 tabs); + void (*mPrintOpCodes[0x100])(LLFILE *fp, U8 *buffer, S32 &offset, S32 tabs); }; -void lso_print_tabs(FILE *fp, S32 tabs); +void lso_print_tabs(LLFILE *fp, S32 tabs); #endif diff --git a/indra/lscript/lscript_export.h b/indra/lscript/lscript_export.h index 0384569686..2043dd4558 100644 --- a/indra/lscript/lscript_export.h +++ b/indra/lscript/lscript_export.h @@ -2,30 +2,25 @@ * @file lscript_export.h * @brief Export interface class * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -34,6 +29,6 @@ #include "lscript_library.h" -extern LLScriptLibrary gScriptLibrary; + #endif diff --git a/indra/lscript/lscript_http.h b/indra/lscript/lscript_http.h index cb60090d25..c6f2325995 100644 --- a/indra/lscript/lscript_http.h +++ b/indra/lscript/lscript_http.h @@ -2,30 +2,25 @@ * @file lscript_http.h * @brief LSL HTTP keys * - * $LicenseInfo:firstyear=2006&license=viewergpl$ - * - * Copyright (c) 2006-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2006&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_library.h b/indra/lscript/lscript_library.h index d9702ced84..89a473a627 100644 --- a/indra/lscript/lscript_library.h +++ b/indra/lscript/lscript_library.h @@ -2,30 +2,25 @@ * @file lscript_library.h * @brief External library interface * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -43,16 +38,15 @@ class LLScriptLibData; class LLScriptLibraryFunction { public: - LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only = FALSE); + LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only = FALSE); ~LLScriptLibraryFunction(); F32 mEnergyUse; F32 mSleepTime; void (*mExecFunc)(LLScriptLibData *, LLScriptLibData *, const LLUUID &); - char *mName; - char *mReturnType; - char *mArgs; - char *mDesc; + const char *mName; + const char *mReturnType; + const char *mArgs; BOOL mGodOnly; }; @@ -64,14 +58,13 @@ public: void init(); - void addFunction(LLScriptLibraryFunction *func); - void assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); + void addFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only = FALSE); + void assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)); - S32 mNextNumber; - LLScriptLibraryFunction **mFunctions; + std::vector<LLScriptLibraryFunction> mFunctions; }; -extern LLScriptLibrary gScriptLibrary; + class LLScriptLibData { @@ -146,9 +139,9 @@ public: return FALSE; } - S32 getListLength() + S32 getListLength() const { - LLScriptLibData *data = this; + const LLScriptLibData *data = this; S32 retval = 0; while (data->mListp) { @@ -365,7 +358,7 @@ public: void print(std::ostream &s, BOOL b_prepend_comma); void print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep); - void setFromCSV(char *src) + void setFromCSV(const char *src) { mType = LST_STRING; mString = new char[strlen(src) + 1]; /* Flawfinder: ignore */ @@ -387,27 +380,10 @@ public: LLScriptLibData(const LLUUID &id) : mType(LST_KEY), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) { - mKey = new char[UUID_STR_LENGTH]; - id.toString(mKey); - } - - LLScriptLibData(char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) - { - if (!string) - { - mString = new char[1]; - mString[0] = 0; - } - else - { - mString = new char[strlen(string) + 1]; /* Flawfinder: ignore */ - if (mString == NULL) - { - llerrs << "Memory Allocation Failed" << llendl; - return; - } - strcpy(mString, string); /* Flawfinder: ignore */ - } + std::string idstr; + id.toString(idstr); + mKey = new char[idstr.length()+1]; + LLStringUtil::copy(mKey,idstr.c_str(),idstr.length()+1); } LLScriptLibData(const char *string) : mType(LST_STRING), mInteger(0), mFP(0.f), mKey(NULL), mString(NULL), mVec(), mQuat(), mListp(NULL) @@ -446,4 +422,6 @@ public: }; +extern LLScriptLibrary gScriptLibrary; + #endif diff --git a/indra/lscript/lscript_library/CMakeLists.txt b/indra/lscript/lscript_library/CMakeLists.txt new file mode 100644 index 0000000000..f6bc67a994 --- /dev/null +++ b/indra/lscript/lscript_library/CMakeLists.txt @@ -0,0 +1,32 @@ +# -*- cmake -*- + +include(00-Common) +include(LLCommon) +include(LLMath) +include(LScript) + +set(lscript_library_SOURCE_FILES + lscript_alloc.cpp + lscript_export.cpp + lscript_library.cpp + ) + +set(lscript_library_HEADER_FILES + CMakeLists.txt + + ../lscript_library.h + ../lscript_export.h + ) + +set_source_files_properties(${lscript_library_HEADER_FILES} + PROPERTIES HEADER_FILE_ONLY TRUE) + +list(APPEND lscript_library_SOURCE_FILES ${lscript_library_HEADER_FILES}) + +include_directories( + ${LLCOMMON_INCLUDE_DIRS} + ${LLMATH_INCLUDE_DIRS} + ${LSCRIPT_INCLUDE_DIRS} + ) + +add_library (lscript_library ${lscript_library_SOURCE_FILES}) diff --git a/indra/lscript/lscript_library/lscript_alloc.cpp b/indra/lscript/lscript_library/lscript_alloc.cpp index 519ef9fb8c..92b1ab70fb 100644 --- a/indra/lscript/lscript_library/lscript_alloc.cpp +++ b/indra/lscript/lscript_library/lscript_alloc.cpp @@ -2,30 +2,25 @@ * @file lscript_alloc.cpp * @brief general heap management for scripting system * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -851,7 +846,7 @@ void lsa_print_heap(U8 *buffer) printf("==========\n"); } -void lsa_fprint_heap(U8 *buffer, FILE *fp) +void lsa_fprint_heap(U8 *buffer, LLFILE *fp) { S32 offset = get_register(buffer, LREG_HR); S32 readoffset; diff --git a/indra/lscript/lscript_library/lscript_export.cpp b/indra/lscript/lscript_library/lscript_export.cpp index 26d1361f14..0ed85e3686 100644 --- a/indra/lscript/lscript_library/lscript_export.cpp +++ b/indra/lscript/lscript_library/lscript_export.cpp @@ -2,30 +2,25 @@ * @file lscript_export.cpp * @brief export interface class * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ diff --git a/indra/lscript/lscript_library/lscript_library.cpp b/indra/lscript/lscript_library/lscript_library.cpp index 47ea62b888..18c2028138 100644 --- a/indra/lscript/lscript_library/lscript_library.cpp +++ b/indra/lscript/lscript_library/lscript_library.cpp @@ -2,30 +2,25 @@ * @file lscript_library.cpp * @brief external library interface * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -48,20 +43,12 @@ #include "lscript_library.h" LLScriptLibrary::LLScriptLibrary() -: mNextNumber(0), mFunctions(NULL) { init(); } LLScriptLibrary::~LLScriptLibrary() { - S32 i; - for (i = 0; i < mNextNumber; i++) - { - delete mFunctions[i]; - mFunctions[i] = NULL; - } - delete [] mFunctions; } void dummy_func(LLScriptLibData *retval, LLScriptLibData *args, const LLUUID &id) @@ -74,372 +61,393 @@ void LLScriptLibrary::init() // Otherwise the bytecode numbers for each call will be wrong, and all // existing scripts will crash. - // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSin", "f", "f", "float llSin(float theta)\ntheta in radians")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCos", "f", "f", "float llCos(float theta)\ntheta in radians")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTan", "f", "f", "float llTan(float theta)\ntheta radians")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAtan2", "f", "ff", "float llAtan2(float y, float x)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSqrt", "f", "f", "float llSqrt(float val)\nreturns 0 and triggers a Math Error for imaginary results")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPow", "f", "ff", "float llPow(float base, float exponent)\nreturns 0 and triggers Math Error for imaginary results")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAbs", "i", "i", "integer llAbs(integer val)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llFabs", "f", "f", "float llFabs(float val)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llFrand", "f", "f", "float llFrand(float mag)\nreturns random number in range [0,mag)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llFloor", "i", "f", "integer llFloor(float val)\nreturns largest integer value <= val")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCeil", "i", "f", "integer llCeil(float val)\nreturns smallest integer value >= val")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRound", "i", "f", "integer llRound(float val)\nreturns val rounded to the nearest integer")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVecMag", "f", "v", "float llVecMag(vector v)\nreturns the magnitude of v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVecNorm", "v", "v", "vector llVecNorm(vector v)\nreturns the v normalized")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVecDist", "f", "vv", "float llVecDist(vector v1, vector v2)\nreturns the 3D distance between v1 and v2")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Euler", "v", "q", "vector llRot2Euler(rotation q)\nreturns the Euler representation (roll, pitch, yaw) of q")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEuler2Rot", "q", "v", "rotation llEuler2Rot(vector v)\nreturns the rotation representation of Euler Angles v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAxes2Rot", "q", "vvv", "rotation llAxes2Rot(vector fwd, vector left, vector up)\nreturns the rotation defined by the coordinate axes")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Fwd", "v", "q", "vector llRot2Fwd(rotation q)\nreturns the forward vector defined by q")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Left", "v", "q", "vector llRot2Left(rotation q)\nreturns the left vector defined by q")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Up", "v", "q", "vector llRot2Up(rotation q)\nreturns the up vector defined by q")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotBetween", "q", "vv", "rotation llRotBetween(vector v1, vector v2)\nreturns the rotation to rotate v1 to v2")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llWhisper", NULL, "is", "llWhisper(integer channel, string msg)\nwhispers msg on channel")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSay", NULL, "is", "llSay(integer channel, string msg)\nsays msg on channel")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llShout", NULL, "is", "llShout(integer channel, string msg)\nshouts msg on channel")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListen", "i", "isks", "integer llListen(integer channel, string name, key id, string msg)\nsets a callback for msg on channel from name and id (name, id, and/or msg can be empty) and returns an identifier that can be used to deactivate or remove the listen")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListenControl", NULL, "ii", "llListenControl(integer number, integer active)\nmakes a listen event callback active or inactive")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListenRemove", NULL, "i", "llListenRemove(integer number)\nremoves listen event callback number")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSensor", NULL, "skiff", "llSensor(string name, key id, integer type, float range, float arc)\nPerforms a single scan for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name, id, and/or keytype can be empty or 0)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSensorRepeat", NULL, "skifff", "llSensorRepeat(string name, key id, integer type, float range, float arc, float rate)\nsets a callback for name and id with type (AGENT, ACTIVE, PASSIVE, and/or SCRIPTED) within range meters and arc radians of forward vector (name, id, and/or keytype can be empty or 0) and repeats every rate seconds")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSensorRemove", NULL, NULL, "llSensorRemove()\nremoves sensor")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedName", "s", "i", "string llDetectedName(integer number)\nreturns the name of detected object number (returns empty string if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedKey", "k", "i", "key llDetectedKey(integer number)\nreturns the key of detected object number (returns empty key if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedOwner", "k", "i", "key llDetectedOwner(integer number)\nreturns the key of detected object's owner (returns empty key if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedType", "i", "i", "integer llDetectedType(integer number)\nreturns the type (AGENT, ACTIVE, PASSIVE, SCRIPTED) of detected object (returns 0 if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedPos", "v", "i", "vector llDetectedPos(integer number)\nreturns the position of detected object number (returns <0,0,0> if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedVel", "v", "i", "vector llDetectedVel(integer number)\nreturns the velocity of detected object number (returns <0,0,0> if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedGrab", "v", "i", "vector llDetectedGrab(integer number)\nreturns the grab offset of the user touching object (returns <0,0,0> if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedRot", "q", "i", "rotation llDetectedRot(integer number)\nreturns the rotation of detected object number (returns <0,0,0,1> if number is not valid sensed object)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedGroup", "i", "i", "integer llDetectedGroup(integer number)\nReturns TRUE if detected object is part of same group as owner")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedLinkNumber", "i", "i", "integer llDetectedLinkNumber(integer number)\nreturns the link position of the triggered event for touches and collisions only")); - addFunction(new LLScriptLibraryFunction(0.f, 0.f, dummy_func, "llDie", NULL, NULL, "llDie()\ndeletes the object")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGround", "f", "v", "float llGround(vector v)\nreturns the ground height below the object position + v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCloud", "f", "v", "float llCloud(vector v)\nreturns the cloud density at the object position + v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llWind", "v", "v", "vector llWind(vector v)\nreturns the wind velocity at the object position + v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetStatus", NULL, "ii", "llSetStatus(integer status, integer value)\nsets status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB,\nSTATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z) to value")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetStatus", "i", "i", "integer llGetStatus(integer status)\ngets value of status (STATUS_PHYSICS, STATUS_PHANTOM, STATUS_BLOCK_GRAB,\nSTATUS_ROTATE_X, STATUS_ROTATE_Y, and/or STATUS_ROTATE_Z)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetScale", NULL, "v", "llSetScale(vector scale)\nsets the scale")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetScale", "v", NULL, "vector llGetScale()\ngets the scale")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetColor", NULL, "vi", "llSetColor(vector color, integer face)\nsets the color")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAlpha", "f", "i", "float llGetAlpha(integer face)\ngets the alpha")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetAlpha", NULL, "fi", "llSetAlpha(float alpha, integer face)\nsets the alpha")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetColor", "v", "i", "vector llGetColor(integer face)\ngets the color")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetTexture", NULL, "si", "llSetTexture(string texture, integer face)\nsets the texture of face")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llScaleTexture", NULL, "ffi", "llScaleTexture(float scales, float scalet, integer face)\nsets the texture s, t scales for the chosen face")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llOffsetTexture", NULL, "ffi", "llOffsetTexture(float offsets, float offsett, integer face)\nsets the texture s, t offsets for the chosen face")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llRotateTexture", NULL, "fi", "llRotateTexture(float rotation, integer face)\nsets the texture rotation for the chosen face")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTexture", "s", "i", "string llGetTexture(integer face)\ngets the texture of face (if it's a texture in the object inventory, otherwise the key in a string)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetPos", NULL, "v", "llSetPos(vector pos)\nsets the position (if the script isn't physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPos", "v", NULL, "vector llGetPos()\ngets the position (if the script isn't physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLocalPos", "v", NULL, "vector llGetLocalPos()\ngets the position relative to the root (if the script isn't physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetRot", NULL, "q", "llSetRot(rotation rot)\nsets the rotation (if the script isn't physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRot", "q", NULL, "rotation llGetRot()\ngets the rotation (if the script isn't physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLocalRot", "q", NULL, "rotation llGetLocalRot()\ngets the rotation local to the root (if the script isn't physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForce", NULL, "vi", "llSetForce(vector force, integer local)\nsets force on object, in local coords if local == TRUE (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetForce", "v", NULL, "vector llGetForce()\ngets the force (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTarget", "i", "vf", "integer llTarget(vector position, float range)\nset positions within range of position as a target and return an ID for the target")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTargetRemove", NULL, "i", "llTargetRemove(integer number)\nremoves target number")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotTarget", "i", "qf", "integer llRotTarget(rotation rot, float error)\nset rotations with error of rot as a rotational target and return an ID for the rotational target")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotTargetRemove", NULL, "i", "llRotTargetRemove(integer number)\nremoves rotational target number")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMoveToTarget", NULL, "vf", "llMoveToTarget(vector target, float tau)\ncritically damp to target in tau seconds (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopMoveToTarget", NULL, NULL, "llStopMoveToTarget()\nStops critically damped motion")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llApplyImpulse", NULL, "vi", "llApplyImpulse(vector force, integer local)\napplies impulse to object, in local coords if local == TRUE (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llApplyRotationalImpulse", NULL, "vi", "llApplyRotationalImpulse(vector force, integer local)\napplies rotational impulse to object, in local coords if local == TRUE (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTorque", NULL, "vi", "llSetTorque(vector torque, integer local)\nsets the torque of object, in local coords if local == TRUE (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTorque", "v", NULL, "vector llGetTorque()\ngets the torque (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForceAndTorque", NULL, "vvi", "llSetForceAndTorque(vector force, vector torque, integer local)\nsets the force and torque of object, in local coords if local == TRUE (if the script is physical)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetVel", "v", NULL, "vector llGetVel()\ngets the velocity")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAccel", "v", NULL, "vector llGetAccel()\ngets the acceleration")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetOmega", "v", NULL, "vector llGetOmega()\ngets the omega")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTimeOfDay", "f", "", "float llGetTimeOfDay()\ngets the time in seconds since Second Life server midnight (or since server up-time; whichever is smaller)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetWallclock", "f", "", "float llGetWallclock()\ngets the time in seconds since midnight")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTime", "f", NULL, "float llGetTime()\ngets the time in seconds since creation")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llResetTime", NULL, NULL, "llResetTime()\nsets the time to zero")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAndResetTime", "f", NULL, "float llGetAndResetTime()\ngets the time in seconds since creation and sets the time to zero")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSound", NULL, "sfii", "llSound(string sound, float volume, integer queue, integer loop)\nplays sound at volume and whether it should loop or not")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPlaySound", NULL, "sf", "llPlaySound(string sound, float volume)\nplays attached sound once at volume (0.0 - 1.0)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLoopSound", NULL, "sf", "llLoopSound(string sound, float volume)\nplays attached sound looping indefinitely at volume (0.0 - 1.0)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLoopSoundMaster", NULL, "sf", "llLoopSoundMaster(string sound, float volume)\nplays attached sound looping at volume (0.0 - 1.0), declares it a sync master")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLoopSoundSlave", NULL, "sf", "llLoopSoundSlave(string sound, float volume)\nplays attached sound looping at volume (0.0 - 1.0), synced to most audible sync master")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPlaySoundSlave", NULL, "sf", "llPlaySoundSlave(string sound, float volume)\nplays attached sound once at volume (0.0 - 1.0), synced to next loop of most audible sync master")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTriggerSound", NULL, "sf", "llTriggerSound(string sound, float volume)\nplays sound at volume (0.0 - 1.0), centered at but not attached to object")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopSound", NULL, "", "llStopSound()\nStops currently attached sound")); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llPreloadSound", NULL, "s", "llPreloadSound(string sound)\npreloads a sound on viewers within range")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetSubString", "s", "sii", "string llGetSubString(string src, integer start, integer end)\nreturns the indicated substring")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDeleteSubString", "s", "sii", "string llDeleteSubString(string src, integer start, integer end)\nremoves the indicated substring and returns the result")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llInsertString", "s", "sis", "string llInsertString(string dst, integer position, string src)\ninserts src into dst at position and returns the result")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llToUpper", "s", "s", "string llToUpper(string src)\nconvert src to all upper case and returns the result")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llToLower", "s", "s", "string llToLower(string src)\nconvert src to all lower case and returns the result")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGiveMoney", "i", "ki", "llGiveMoney(key destination, integer amount)\ntransfer amount of money from script owner to destination")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeExplosion", NULL, "iffffsv", "llMakeExplosion(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake a round explosion of particles")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeFountain", NULL, "iffffisvf", "llMakeFountain(integer particles, float scale, float vel, float lifetime, float arc, integer bounce, string texture, vector offset, float bounce_offset)\nMake a fountain of particles")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeSmoke", NULL, "iffffsv", "llMakeSmoke(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake smoke like particles")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llMakeFire", NULL, "iffffsv", "llMakeFire(integer particles, float scale, float vel, float lifetime, float arc, string texture, vector offset)\nMake fire like particles")); - addFunction(new LLScriptLibraryFunction(200.f, 0.1f, dummy_func, "llRezObject", NULL, "svvqi", "llRezObject(string inventory, vector pos, vector vel, rotation rot, integer param)\nInstanciate owners inventory object at pos with velocity vel and rotation rot with start parameter param")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLookAt", NULL, "vff", "llLookAt(vector target, F32 strength, F32 damping)\nCause object name to point it's forward axis towards target")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopLookAt", NULL, NULL, "llStopLookAt()\nStop causing object name to point at a target")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTimerEvent", NULL, "f", "llSetTimerEvent(float sec)\nCause the timer event to be triggered every sec seconds")); - addFunction(new LLScriptLibraryFunction(0.f, 0.f, dummy_func, "llSleep", NULL, "f", "llSleep(float sec)\nPut script to sleep for sec seconds")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetMass", "f", NULL, "float llGetMass()\nGet the mass of task name that script is attached to")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCollisionFilter", NULL, "ski", "llCollisionFilter(string name, key id, integer accept)\nif accept == TRUE, only accept collisions with objects name and id (either is optional), otherwise with objects not name or id")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTakeControls", NULL, "iii", "llTakeControls(integer controls, integer accept, integer pass_on)\nTake controls from agent task has permissions for. If (accept == (controls & input)), send input to task. If pass_on send to agent also.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llReleaseControls", NULL, NULL, "llReleaseControls()\nStop taking inputs")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAttachToAvatar", NULL, "i", "llAttachToAvatar(integer attachment)\nAttach to avatar task has permissions for at point attachment")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetachFromAvatar", NULL, NULL, "llDetachFromAvatar()\nDrop off of avatar")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTakeCamera", NULL, "k", "llTakeCamera(key avatar)\nMove avatar's viewpoint to task")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llReleaseCamera", NULL, "k", "llReleaseCamera(key avatar)\nReturn camera to agent")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetOwner", "k", NULL, "key llGetOwner()\nReturns the owner of the task")); - addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llInstantMessage", NULL, "ks", "llInstantMessage(key user, string message)\nIMs message to the user")); - addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llEmail", NULL, "sss", "llEmail(string address, string subject, string message)\nSends email to address with subject and message")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetNextEmail", NULL, "ss", "llGetNextEmail(string address, string subject)\nGet the next waiting email with appropriate address and/or subject (if blank they are ignored)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetKey", "k", NULL, "key llGetKey()\nGet the key for the task the script is attached to")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetBuoyancy", NULL, "f", "llSetBuoyancy(float buoyancy)\nSet the tasks buoyancy (0 is none, < 1.0 sinks, 1.0 floats, > 1.0 rises)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetHoverHeight", NULL, "fif", "llSetHoverHeight(float height, integer water, float tau)\nCritically damps to a height (either above ground level or above the higher of land and water if water == TRUE)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopHover", NULL, NULL, "llStopHover()\nStop hovering to a height")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMinEventDelay", NULL, "f", "llMinEventDelay(float delay)\nSet the minimum time between events being handled")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSoundPreload", NULL, "s", "llSoundPreload(string sound)\npreloads a sound on viewers within range")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRotLookAt", NULL, "qff", "llRotLookAt(rotation target, F32 strength, F32 damping)\nCause object name to point it's forward axis towards target")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringLength", "i", "s", "integer llStringLength(string str)\nReturns the length of string")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStartAnimation", NULL, "s", "llStartAnimation(string anim)\nStart animation anim for agent that owns object")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopAnimation", NULL, "s", "llStopAnimation(string anim)\nStop animation anim for agent that owns object")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPointAt", NULL, "v", "llPointAt(vector pos)\nMake agent that owns object point at pos")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStopPointAt", NULL, NULL, "llStopPointAt()\nStop agent that owns object pointing")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTargetOmega", NULL, "vff", "llTargetOmega(vector axis, float spinrate, float gain)\nAttempt to spin at spinrate with strength gain")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetStartParameter", "i", NULL, "integer llGetStartParameter()\nGet's the start paramter passed to llRezObject")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGodLikeRezObject", NULL, "kv", "llGodLikeRezObject(key inventory, vector pos)\nrez directly off of a UUID if owner has dog-bit set", TRUE)); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRequestPermissions", NULL, "ki", "llRequestPermissions(key agent, integer perm)\nask agent to allow the script to do perm (NB: Debit, ownership, link, joint, and permission requests can only go to the task's owner)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPermissionsKey", "k", NULL, "key llGetPermissionsKey()\nReturn agent that permissions are enabled for. NULL_KEY if not enabled")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPermissions", "i", NULL, "integer llGetPermissions()\nreturn what permissions have been enabled")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLinkNumber", "i", NULL, "integer llGetLinkNumber()\nReturns what number in a link set the script is attached to (0 means no link, 1 the root, 2 for first child, &c)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetLinkColor", NULL, "ivi", "llSetLinkColor(integer linknumber, vector color, integer face)\nIf a task exists in the link chain at linknumber, set face to color")); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llCreateLink", NULL, "ki", "llCreateLink(key target, integer parent)\nAttempt to link task script is attached to and target (requires permission PERMISSION_CHANGE_LINKS be set). If parent == TRUE, task script is attached to is the root")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llBreakLink", NULL, "i", "llBreakLink(integer linknum)\nDelinks the task with the given link number (requires permission PERMISSION_CHANGE_LINKS be set)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llBreakAllLinks", NULL, NULL, "llBreakAllLinks()\nDelinks all tasks in the link set (requires permission PERMISSION_CHANGE_LINKS be set)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLinkKey", "k", "i", "key llGetLinkKey(integer linknum)\nGet the key of linknumber in link set")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLinkName", "s", "i", "string llGetLinkName(integer linknum)\nGet the name of linknumber in link set")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryNumber", "i", "i", "integer llGetInventoryNumber(integer type)\nGet the number of items of a given type in the task's inventory.\nValid types: INVENTORY_TEXTURE, INVENTORY_SOUND, INVENTORY_OBJECT, INVENTORY_SCRIPT, INVENTORY_CLOTHING, INVENTORY_BODYPART, INVENTORY_NOTECARD, INVENTORY_LANDMARK, INVENTORY_ALL")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryName", "s", "ii", "string llGetInventoryName(integer type, integer number)\nGet the name of the inventory item number of type")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetScriptState", NULL, "si", "llSetScriptState(string name, integer run)\nControl the state of a script name.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetEnergy", "f", NULL, "float llGetEnergy()\nReturns how much energy is in the object as a percentage of maximum")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGiveInventory", NULL, "ks", "llGiveInventory(key destination, string inventory)\nGive inventory to destination")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRemoveInventory", NULL, "s", "llRemoveInventory(string inventory)\nRemove the named inventory item")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetText", NULL, "svf", "llSetText(string text, vector color, float alpha)\nSet text floating over object")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llWater", "f", "v", "float llWater(vector v)\nreturns the water height below the object position + v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPassTouches", NULL, "i", "llPassTouches(integer pass)\nif pass == TRUE, touches are passed from children on to parents (default is FALSE)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llRequestAgentData", "k", "ki", "key llRequestAgentData(key id, integer data)\nRequests data about agent id. When data is available the dataserver event will be raised")); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llRequestInventoryData", "k", "s", "key llRequestInventoryData(string name)\nRequests data from object's inventory object. When data is available the dataserver event will be raised")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetDamage", NULL, "f", "llSetDamage(float damage)\nSets the amount of damage that will be done to an object that this task hits. Task will be killed.")); - addFunction(new LLScriptLibraryFunction(100.f, 5.f, dummy_func, "llTeleportAgentHome", NULL, "k", "llTeleportAgentHome(key id)\nTeleports agent on owner's land to agent's home location")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llModifyLand", NULL, "ii", "llModifyLand(integer action, integer size)\nModify land with action (LAND_LEVEL, LAND_RAISE, LAND_LOWER, LAND_SMOOTH, LAND_NOISE, LAND_REVERT)\non size (LAND_SMALL_BRUSH, LAND_MEDIUM_BRUSH, LAND_LARGE_BRUSH)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCollisionSound", NULL, "sf", "llCollisionSound(string impact_sound, float impact_volume)\nSuppress default collision sounds, replace default impact sounds with impact_sound (empty string to just suppress)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCollisionSprite", NULL, "s", "llCollisionSprite(string impact_sprite)\nSuppress default collision sprites, replace default impact sprite with impact_sprite (empty string to just suppress)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAnimation", "s", "k", "string llGetAnimation(key id)\nGet the currently playing locomotion animation for avatar id")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llResetScript", NULL, NULL, "llResetScript()\nResets the script")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMessageLinked", NULL, "iisk", "llMessageLinked(integer linknum, integer num, string str, key id)\nSends num, str, and id to members of the link set (LINK_ROOT sends to root task in a linked set,\nLINK_SET sends to all tasks,\nLINK_ALL_OTHERS to all other tasks,\nLINK_ALL_CHILDREN to all children,\nLINK_THIS to the task the script it is in)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPushObject", NULL, "kvvi", "llPushObject(key id, vector impulse, vector ang_impulse, integer local)\nApplies impulse and ang_impulse to object id")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llPassCollisions", NULL, "i", "llPassCollisions(integer pass)\nif pass == TRUE, collisions are passed from children on to parents (default is FALSE)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetScriptName", "s", NULL, "llGetScriptName()\nReturns the script name")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetNumberOfSides", "i", NULL, "integer llGetNumberOfSides()\nReturns the number of sides")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAxisAngle2Rot", "q", "vf", "rotation llAxisAngle2Rot(vector axis, float angle)\nReturns the rotation generated angle about axis")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Axis", "v", "q", "vector llRot2Axis(rotation rot)\nReturns the rotation axis represented by rot")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRot2Angle", "f", "q", "float llRot2Angle(rotation rot)\nReturns the rotation angle represented by rot")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAcos", "f", "f", "float llAcos(float val)\nReturns the arccosine in radians of val")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAsin", "f", "f", "float llAsin(float val)\nReturns the arcsine in radians of val")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAngleBetween", "f", "qq", "float llAngleBetween(rotation a, rotation b)\nReturns angle between rotation a and b")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryKey", "k", "s", "key llGetInventoryKey(string name)\nReturns the key of the inventory name")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAllowInventoryDrop", NULL, "i", "llAllowInventoryDrop(integer add)\nIf add == TRUE, users without permissions can still drop inventory items onto task")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetSunDirection", "v", NULL, "vector llGetSunDirection()\nReturns the sun direction on the simulator")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTextureOffset", "v", "i", "vector llGetTextureOffset(integer side)\nReturns the texture offset of side in the x and y components of a vector")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTextureScale", "v", "i", "vector llGetTextureScale(integer side)\nReturns the texture scale of side in the x and y components of a vector")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTextureRot", "f", "i", "float llGetTextureRot(integer side)\nReturns the texture rotation of side")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSubStringIndex", "i", "ss", "integer llSubStringIndex(string source, string pattern)\nFinds index in source where pattern first appears (returns -1 if not found)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetOwnerKey", "k", "k", "key llGetOwnerKey(key id)\nFind the owner of id")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCenterOfMass", "v", NULL, "vector llGetCenterOfMass()\nGet the object's center of mass")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListSort", "l", "lii", "list llListSort(list src, integer stride, integer ascending)\nSort the list into blocks of stride in ascending order if ascending == TRUE. Note that sort only works between same types.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetListLength", "i", "l", "integer llGetListLength(list src)\nGet the number of elements in the list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Integer", "i", "li", "integer llList2Integer(list src, integer index)\nCopy the integer at index in the list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Float", "f", "li", "float llList2Float(list src, integer index)\nCopy the float at index in the list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2String", "s", "li", "string llList2String(list src, integer index)\nCopy the string at index in the list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Key", "k", "li", "key llList2Key(list src, integer index)\nCopy the key at index in the list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Vector", "v", "li", "vector llList2Vector(list src, integer index)\nCopy the vector at index in the list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2Rot", "q", "li", "rotation llList2Rot(list src, integer index)\nCopy the rotation at index in the list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2List", "l", "lii", "list llList2List(list src, integer start, integer end)\nCopy the slice of the list from start to end")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDeleteSubList", "l", "lii", "list llDeleteSubList(list src, integer start, integer end)\nRemove the slice from the list and return the remainder")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetListEntryType", "i", "li", "integer llGetListEntryType(list src, integer index)\nReturns the type of the index entry in the list\n(TYPE_INTEGER, TYPE_FLOAT, TYPE_STRING, TYPE_KEY, TYPE_VECTOR, TYPE_ROTATION, or TYPE_INVALID if index is off list)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2CSV", "s", "l", "string llList2CSV(list src)\nCreate a string of comma separated values from list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llCSV2List", "l", "s", "list llCSV2List(string src)\nCreate a list from a string of comma separated values")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListRandomize", "l", "li", "list llListRandomize(list src, integer stride)\nReturns a randomized list of blocks of size stride")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llList2ListStrided", "l", "liii", "list llList2ListStrided(list src, integer start, integer end, integer stride)\nCopy the strided slice of the list from start to end")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionCorner", "v", NULL, "vector llGetRegionCorner()\nReturns a vector with the south west corner x,y position of the region the object is in")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListInsertList", "l", "lli", "list llListInsertList(list dest, list src, integer start)\nInserts src into dest at position start")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListFindList", "i", "ll", "integer llListFindList(list src, list test)\nReturns the start of the first instance of test in src, -1 if not found")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectName", "s", NULL, "string llGetObjectName()\nReturns the name of the object script is attached to")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetObjectName", NULL, "s", "llSetObjectName(string name)\nSets the objects name")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetDate", "s", NULL, "string llGetDate()\nGets the date as YYYY-MM-DD")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEdgeOfWorld", "i", "vv", "integer llEdgeOfWorld(vector pos, vector dir)\nChecks to see whether the border hit by dir from pos is the edge of the world (has no neighboring simulator)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAgentInfo", "i", "k", "integer llGetAgentInfo(key id)\nGets information about agent ID.\nReturns AGENT_FLYING, AGENT_ATTACHMENTS, AGENT_SCRIPTED, AGENT_SITTING, AGENT_ON_OBJECT, AGENT_MOUSELOOK, AGENT_AWAY, AGENT_BUSY, AGENT_TYPING, AGENT_CROUCHING, AGENT_ALWAYS_RUN, AGENT_WALKING and/or AGENT_IN_AIR.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llAdjustSoundVolume", NULL, "f", "llAdjustSoundVolume(float volume)\nadjusts volume of attached sound (0.0 - 1.0)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetSoundQueueing", NULL, "i", "llSetSoundQueueing(integer queue)\ndetermines whether attached sound calls wait for the current sound to finish (0 = no [default], nonzero = yes)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetSoundRadius", NULL, "f", "llSetSoundRadius(float radius)\nestablishes a hard cut-off radius for audibility of scripted sounds (both attached and triggered)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llKey2Name", "s", "k", "string llKey2Name(key id)\nReturns the name of the object key, iff the object is in the current simulator, otherwise the empty string")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTextureAnim", NULL, "iiiifff", "llSetTextureAnim(integer mode, integer face, integer sizex, integer sizey, float start, float length, float rate)\nAnimate the texture on the specified face/faces")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llTriggerSoundLimited", NULL, "sfvv", "llTriggerSoundLimited(string sound, float volume, vector tne, vector bsw)\nplays sound at volume (0.0 - 1.0), centered at but not attached to object, limited to AABB defined by vectors top-north-east and bottom-south-west")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEjectFromLand", NULL, "k", "llEjectFromLand(key pest)\nEjects pest from land that you own")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llParseString2List", "l", "sll", "list llParseString2List(string src, list separators, list spacers)\nBreaks src into a list, discarding separators, keeping spacers (separators and spacers must be lists of strings, maximum of 8 each)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llOverMyLand", "i", "k", "integer llOverMyLand(key id)\nReturns TRUE if id is over land owner of object owns, FALSE otherwise")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetLandOwnerAt", "k", "v", "key llGetLandOwnerAt(vector pos)\nReturns the key of the land owner, NULL_KEY if public")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llGetNotecardLine", "k", "si", "key llGetNotecardLine(string name, integer line)\nReturns line line of notecard name via the dataserver event")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAgentSize", "v", "k", "vector llGetAgentSize(key id)\nIf the agent is in the same sim as the object, returns the size of the avatar")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSameGroup", "i", "k", "integer llSameGroup(key id)\nReturns TRUE if ID is in the same sim and has the same active group, otherwise FALSE")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llUnSit", NULL, "k", "key llUnSit(key id)\nIf agent identified by id is sitting on the object the script is attached to or is over land owned by the objects owner, the agent is forced to stand up")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundSlope", "v", "v", "vector llGroundSlope(vector v)\nreturns the ground slope below the object position + v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundNormal", "v", "v", "vector llGroundNormal(vector v)\nreturns the ground normal below the object position + v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundContour", "v", "v", "vector llGroundCountour(vector v)\nreturns the ground contour below the object position + v")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAttached", "i", NULL, "integer llGetAttached()\nreturns the object attachment point or 0 if not attached")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetFreeMemory", "i", NULL, "integer llGetFreeMemory()\nreturns the available heap space for the current script")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionName", "s", NULL, "string llGetRegionName()\nreturns the current region name")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionTimeDilation", "f", NULL, "float llGetRegionTimeDilation()\nreturns the current time dilation as a float between 0 and 1")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionFPS", "f", NULL, "float llGetRegionFPS()\nreturns the mean region frames per second")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llParticleSystem", NULL, "l", "llParticleSystem(list rules)\nCreates a particle system based on rules. Empty list removes particle system from object.\nList format is [ rule1, data1, rule2, data2 . . . rulen, datan ]")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGroundRepel", NULL, "fif", "llGroundRepel(float height, integer water, float tau)\nCritically damps to height if within height*0.5 of level (either above ground level or above the higher of land and water if water == TRUE)")); - addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llGiveInventoryList", NULL, "ksl", "llGiveInventoryList(key destination, string category, list inventory)\nGive inventory to destination in a new category")); + // energy, sleep, dummy_func, name, return type, parameters, gods-only + addFunction(10.f, 0.f, dummy_func, "llSin", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llCos", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llTan", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llAtan2", "f", "ff"); + addFunction(10.f, 0.f, dummy_func, "llSqrt", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llPow", "f", "ff"); + addFunction(10.f, 0.f, dummy_func, "llAbs", "i", "i"); + addFunction(10.f, 0.f, dummy_func, "llFabs", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llFrand", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llFloor", "i", "f"); + addFunction(10.f, 0.f, dummy_func, "llCeil", "i", "f"); + addFunction(10.f, 0.f, dummy_func, "llRound", "i", "f"); + addFunction(10.f, 0.f, dummy_func, "llVecMag", "f", "v"); + addFunction(10.f, 0.f, dummy_func, "llVecNorm", "v", "v"); + addFunction(10.f, 0.f, dummy_func, "llVecDist", "f", "vv"); + addFunction(10.f, 0.f, dummy_func, "llRot2Euler", "v", "q"); + addFunction(10.f, 0.f, dummy_func, "llEuler2Rot", "q", "v"); + addFunction(10.f, 0.f, dummy_func, "llAxes2Rot", "q", "vvv"); + addFunction(10.f, 0.f, dummy_func, "llRot2Fwd", "v", "q"); + addFunction(10.f, 0.f, dummy_func, "llRot2Left", "v", "q"); + addFunction(10.f, 0.f, dummy_func, "llRot2Up", "v", "q"); + addFunction(10.f, 0.f, dummy_func, "llRotBetween", "q", "vv"); + addFunction(10.f, 0.f, dummy_func, "llWhisper", NULL, "is"); + addFunction(10.f, 0.f, dummy_func, "llSay", NULL, "is"); + addFunction(10.f, 0.f, dummy_func, "llShout", NULL, "is"); + addFunction(10.f, 0.f, dummy_func, "llListen", "i", "isks"); + addFunction(10.f, 0.f, dummy_func, "llListenControl", NULL, "ii"); + addFunction(10.f, 0.f, dummy_func, "llListenRemove", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llSensor", NULL, "skiff"); + addFunction(10.f, 0.f, dummy_func, "llSensorRepeat", NULL, "skifff"); + addFunction(10.f, 0.f, dummy_func, "llSensorRemove", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llDetectedName", "s", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedKey", "k", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedOwner", "k", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedType", "i", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedPos", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedVel", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedGrab", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedRot", "q", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedGroup", "i", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedLinkNumber", "i", "i"); + addFunction(0.f, 0.f, dummy_func, "llDie", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llGround", "f", "v"); + addFunction(10.f, 0.f, dummy_func, "llCloud", "f", "v"); + addFunction(10.f, 0.f, dummy_func, "llWind", "v", "v"); + addFunction(10.f, 0.f, dummy_func, "llSetStatus", NULL, "ii"); + addFunction(10.f, 0.f, dummy_func, "llGetStatus", "i", "i"); + addFunction(10.f, 0.f, dummy_func, "llSetScale", NULL, "v"); + addFunction(10.f, 0.f, dummy_func, "llGetScale", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetColor", NULL, "vi"); + addFunction(10.f, 0.f, dummy_func, "llGetAlpha", "f", "i"); + addFunction(10.f, 0.f, dummy_func, "llSetAlpha", NULL, "fi"); + addFunction(10.f, 0.f, dummy_func, "llGetColor", "v", "i"); + addFunction(10.f, 0.2f, dummy_func, "llSetTexture", NULL, "si"); + addFunction(10.f, 0.2f, dummy_func, "llScaleTexture", NULL, "ffi"); + addFunction(10.f, 0.2f, dummy_func, "llOffsetTexture", NULL, "ffi"); + addFunction(10.f, 0.2f, dummy_func, "llRotateTexture", NULL, "fi"); + addFunction(10.f, 0.f, dummy_func, "llGetTexture", "s", "i"); + addFunction(10.f, 0.2f, dummy_func, "llSetPos", NULL, "v"); + addFunction(10.f, 0.f, dummy_func, "llGetPos", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetLocalPos", "v", NULL); + addFunction(10.f, 0.2f, dummy_func, "llSetRot", NULL, "q"); + addFunction(10.f, 0.f, dummy_func, "llGetRot", "q", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetLocalRot", "q", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetForce", NULL, "vi"); + addFunction(10.f, 0.f, dummy_func, "llGetForce", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llTarget", "i", "vf"); + addFunction(10.f, 0.f, dummy_func, "llTargetRemove", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llRotTarget", "i", "qf"); + addFunction(10.f, 0.f, dummy_func, "llRotTargetRemove", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llMoveToTarget", NULL, "vf"); + addFunction(10.f, 0.f, dummy_func, "llStopMoveToTarget", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llApplyImpulse", NULL, "vi"); + addFunction(10.f, 0.f, dummy_func, "llApplyRotationalImpulse", NULL, "vi"); + addFunction(10.f, 0.f, dummy_func, "llSetTorque", NULL, "vi"); + addFunction(10.f, 0.f, dummy_func, "llGetTorque", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetForceAndTorque", NULL, "vvi"); + addFunction(10.f, 0.f, dummy_func, "llGetVel", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetAccel", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetOmega", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetTimeOfDay", "f", ""); + addFunction(10.f, 0.f, dummy_func, "llGetWallclock", "f", ""); + addFunction(10.f, 0.f, dummy_func, "llGetTime", "f", NULL); + addFunction(10.f, 0.f, dummy_func, "llResetTime", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llGetAndResetTime", "f", NULL); + addFunction(10.f, 0.f, dummy_func, "llSound", NULL, "sfii"); + addFunction(10.f, 0.f, dummy_func, "llPlaySound", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "llLoopSound", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "llLoopSoundMaster", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "llLoopSoundSlave", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "llPlaySoundSlave", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "llTriggerSound", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "llStopSound", NULL, ""); + addFunction(10.f, 1.f, dummy_func, "llPreloadSound", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llGetSubString", "s", "sii"); + addFunction(10.f, 0.f, dummy_func, "llDeleteSubString", "s", "sii"); + addFunction(10.f, 0.f, dummy_func, "llInsertString", "s", "sis"); + addFunction(10.f, 0.f, dummy_func, "llToUpper", "s", "s"); + addFunction(10.f, 0.f, dummy_func, "llToLower", "s", "s"); + addFunction(10.f, 0.f, dummy_func, "llGiveMoney", "i", "ki"); + addFunction(10.f, 0.1f, dummy_func, "llMakeExplosion", NULL, "iffffsv"); + addFunction(10.f, 0.1f, dummy_func, "llMakeFountain", NULL, "iffffisvf"); + addFunction(10.f, 0.1f, dummy_func, "llMakeSmoke", NULL, "iffffsv"); + addFunction(10.f, 0.1f, dummy_func, "llMakeFire", NULL, "iffffsv"); + addFunction(200.f, 0.1f, dummy_func, "llRezObject", NULL, "svvqi"); + addFunction(10.f, 0.f, dummy_func, "llLookAt", NULL, "vff"); + addFunction(10.f, 0.f, dummy_func, "llStopLookAt", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llSetTimerEvent", NULL, "f"); + addFunction(0.f, 0.f, dummy_func, "llSleep", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "llGetMass", "f", NULL); + addFunction(10.f, 0.f, dummy_func, "llCollisionFilter", NULL, "ski"); + addFunction(10.f, 0.f, dummy_func, "llTakeControls", NULL, "iii"); + addFunction(10.f, 0.f, dummy_func, "llReleaseControls", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llAttachToAvatar", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llDetachFromAvatar", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llTakeCamera", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "llReleaseCamera", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "llGetOwner", "k", NULL); + addFunction(10.f, 2.f, dummy_func, "llInstantMessage", NULL, "ks"); + addFunction(10.f, 20.f, dummy_func, "llEmail", NULL, "sss"); + addFunction(10.f, 0.f, dummy_func, "llGetNextEmail", NULL, "ss"); + addFunction(10.f, 0.f, dummy_func, "llGetKey", "k", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetBuoyancy", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "llSetHoverHeight", NULL, "fif"); + addFunction(10.f, 0.f, dummy_func, "llStopHover", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llMinEventDelay", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "llSoundPreload", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llRotLookAt", NULL, "qff"); + addFunction(10.f, 0.f, dummy_func, "llStringLength", "i", "s"); + addFunction(10.f, 0.f, dummy_func, "llStartAnimation", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llStopAnimation", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llPointAt", NULL, "v"); + addFunction(10.f, 0.f, dummy_func, "llStopPointAt", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llTargetOmega", NULL, "vff"); + addFunction(10.f, 0.f, dummy_func, "llGetStartParameter", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llGodLikeRezObject", NULL, "kv", TRUE); + addFunction(10.f, 0.f, dummy_func, "llRequestPermissions", NULL, "ki"); + addFunction(10.f, 0.f, dummy_func, "llGetPermissionsKey", "k", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetPermissions", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetLinkNumber", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetLinkColor", NULL, "ivi"); + addFunction(10.f, 1.f, dummy_func, "llCreateLink", NULL, "ki"); + addFunction(10.f, 0.f, dummy_func, "llBreakLink", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llBreakAllLinks", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llGetLinkKey", "k", "i"); + addFunction(10.f, 0.f, dummy_func, "llGetLinkName", "s", "i"); + addFunction(10.f, 0.f, dummy_func, "llGetInventoryNumber", "i", "i"); + addFunction(10.f, 0.f, dummy_func, "llGetInventoryName", "s", "ii"); + addFunction(10.f, 0.f, dummy_func, "llSetScriptState", NULL, "si"); + addFunction(10.f, 0.f, dummy_func, "llGetEnergy", "f", NULL); + addFunction(10.f, 0.f, dummy_func, "llGiveInventory", NULL, "ks"); + addFunction(10.f, 0.f, dummy_func, "llRemoveInventory", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llSetText", NULL, "svf"); + addFunction(10.f, 0.f, dummy_func, "llWater", "f", "v"); + addFunction(10.f, 0.f, dummy_func, "llPassTouches", NULL, "i"); + addFunction(10.f, 0.1f, dummy_func, "llRequestAgentData", "k", "ki"); + addFunction(10.f, 1.f, dummy_func, "llRequestInventoryData", "k", "s"); + addFunction(10.f, 0.f, dummy_func, "llSetDamage", NULL, "f"); + addFunction(100.f, 5.f, dummy_func, "llTeleportAgentHome", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "llModifyLand", NULL, "ii"); + addFunction(10.f, 0.f, dummy_func, "llCollisionSound", NULL, "sf"); + addFunction(10.f, 0.f, dummy_func, "llCollisionSprite", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llGetAnimation", "s", "k"); + addFunction(10.f, 0.f, dummy_func, "llResetScript", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llMessageLinked", NULL, "iisk"); + addFunction(10.f, 0.f, dummy_func, "llPushObject", NULL, "kvvi"); + addFunction(10.f, 0.f, dummy_func, "llPassCollisions", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llGetScriptName", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetNumberOfSides", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llAxisAngle2Rot", "q", "vf"); + addFunction(10.f, 0.f, dummy_func, "llRot2Axis", "v", "q"); + addFunction(10.f, 0.f, dummy_func, "llRot2Angle", "f", "q"); + addFunction(10.f, 0.f, dummy_func, "llAcos", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llAsin", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llAngleBetween", "f", "qq"); + addFunction(10.f, 0.f, dummy_func, "llGetInventoryKey", "k", "s"); + addFunction(10.f, 0.f, dummy_func, "llAllowInventoryDrop", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llGetSunDirection", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetTextureOffset", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llGetTextureScale", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llGetTextureRot", "f", "i"); + addFunction(10.f, 0.f, dummy_func, "llSubStringIndex", "i", "ss"); + addFunction(10.f, 0.f, dummy_func, "llGetOwnerKey", "k", "k"); + addFunction(10.f, 0.f, dummy_func, "llGetCenterOfMass", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llListSort", "l", "lii"); + addFunction(10.f, 0.f, dummy_func, "llGetListLength", "i", "l"); + addFunction(10.f, 0.f, dummy_func, "llList2Integer", "i", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2Float", "f", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2String", "s", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2Key", "k", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2Vector", "v", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2Rot", "q", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2List", "l", "lii"); + addFunction(10.f, 0.f, dummy_func, "llDeleteSubList", "l", "lii"); + addFunction(10.f, 0.f, dummy_func, "llGetListEntryType", "i", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2CSV", "s", "l"); + addFunction(10.f, 0.f, dummy_func, "llCSV2List", "l", "s"); + addFunction(10.f, 0.f, dummy_func, "llListRandomize", "l", "li"); + addFunction(10.f, 0.f, dummy_func, "llList2ListStrided", "l", "liii"); + addFunction(10.f, 0.f, dummy_func, "llGetRegionCorner", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llListInsertList", "l", "lli"); + addFunction(10.f, 0.f, dummy_func, "llListFindList", "i", "ll"); + addFunction(10.f, 0.f, dummy_func, "llGetObjectName", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetObjectName", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llGetDate", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "llEdgeOfWorld", "i", "vv"); + addFunction(10.f, 0.f, dummy_func, "llGetAgentInfo", "i", "k"); + addFunction(10.f, 0.1f, dummy_func, "llAdjustSoundVolume", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "llSetSoundQueueing", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llSetSoundRadius", NULL, "f"); + addFunction(10.f, 0.f, dummy_func, "llKey2Name", "s", "k"); + addFunction(10.f, 0.f, dummy_func, "llSetTextureAnim", NULL, "iiiifff"); + addFunction(10.f, 0.f, dummy_func, "llTriggerSoundLimited", NULL, "sfvv"); + addFunction(10.f, 0.f, dummy_func, "llEjectFromLand", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "llParseString2List", "l", "sll"); + addFunction(10.f, 0.f, dummy_func, "llOverMyLand", "i", "k"); + addFunction(10.f, 0.f, dummy_func, "llGetLandOwnerAt", "k", "v"); + addFunction(10.f, 0.1f, dummy_func, "llGetNotecardLine", "k", "si"); + addFunction(10.f, 0.f, dummy_func, "llGetAgentSize", "v", "k"); + addFunction(10.f, 0.f, dummy_func, "llSameGroup", "i", "k"); + addFunction(10.f, 0.f, dummy_func, "llUnSit", NULL, "k"); + addFunction(10.f, 0.f, dummy_func, "llGroundSlope", "v", "v"); + addFunction(10.f, 0.f, dummy_func, "llGroundNormal", "v", "v"); + addFunction(10.f, 0.f, dummy_func, "llGroundContour", "v", "v"); + addFunction(10.f, 0.f, dummy_func, "llGetAttached", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetFreeMemory", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetRegionName", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetRegionTimeDilation", "f", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetRegionFPS", "f", NULL); + + addFunction(10.f, 0.f, dummy_func, "llParticleSystem", NULL, "l"); + addFunction(10.f, 0.f, dummy_func, "llGroundRepel", NULL, "fif"); + addFunction(10.f, 3.f, dummy_func, "llGiveInventoryList", NULL, "ksl"); // script calls for vehicle action - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleType", NULL, "i", "llSetVehicleType(integer type)\nsets vehicle to one of the default types")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleFloatParam", NULL, "if", "llSetVehicleFloatParam(integer param, float value)\nsets the specified vehicle float parameter")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleVectorParam", NULL, "iv", "llSetVehicleVectorParam(integer param, vector vec)\nsets the specified vehicle vector parameter")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleRotationParam", NULL, "iq", "llSetVehicleVectorParam(integer param, rotation rot)\nsets the specified vehicle rotation parameter")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetVehicleFlags", NULL, "i", "llSetVehicleFlags(integer flags)\nsets the enabled bits in 'flags'")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRemoveVehicleFlags", NULL, "i", "llRemoveVehicleFlags(integer flags)\nremoves the enabled bits in 'flags'")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSitTarget", NULL, "vq", "llSitTarget(vector offset, rotation rot)\nSet the sit location for this object (if offset == <0,0,0> clear it)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llAvatarOnSitTarget", "k", NULL, "key llAvatarOnSitTarget()\nIf an avatar is sitting on the sit target, return the avatar's key, NULL_KEY otherwise")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llAddToLandPassList", NULL, "kf", "llAddToLandPassList(key avatar, float hours)\nAdd avatar to the land pass list for hours")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetTouchText", NULL, "s", "llSetTouchText(string text)\nDisplays text in pie menu that acts as a touch")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetSitText", NULL, "s", "llSetSitText(string text)\nDisplays text rather than sit in pie menu")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCameraEyeOffset", NULL, "v", "llSetCameraEyeOffset(vector offset)\nSets the camera eye offset used in this object if an avatar sits on it")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCameraAtOffset", NULL, "v", "llSetCameraAtOffset(vector offset)\nSets the camera at offset used in this object if an avatar sits on it")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDumpList2String", "s", "ls", "string llDumpList2String(list src, string separator)\nWrite the list out in a single string using separator between values")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llScriptDanger", "i", "v", "integer llScriptDanger(vector pos)\nReturns true if pos is over public land, sandbox land, land that doesn't allow everyone to edit and build, or land that doesn't allow outside scripts")); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llDialog", NULL, "ksli", "llDialog(key avatar, string message, list buttons, integer chat_channel\nShows a dialog box on the avatar's screen with the message.\nUp to 12 strings in the list form buttons.\nIf a button is clicked, the name is chatted on chat_channel.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llVolumeDetect", NULL, "i", "llVolumeDetect(integer detect)\nIf detect = TRUE, object becomes phantom but triggers collision_start and collision_end events\nwhen other objects start and stop interpenetrating.\nMust be applied to the root object.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llResetOtherScript", NULL, "s", "llResetOtherScript(string name)\nResets script name")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetScriptState", "i", "s", "integer llGetScriptState(string name)\nResets TRUE if script name is running")); - addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llRemoteLoadScript", NULL, "ksii", "Deprecated. Please use llRemoteLoadScriptPin instead.")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetRemoteScriptAccessPin", NULL, "i", "llSetRemoteScriptAccessPin(integer pin)\nIf pin is set to a non-zero number, the task will accept remote script\nloads via llRemoteLoadScriptPin if it passes in the correct pin.\nOthersise, llRemoteLoadScriptPin is ignored.")); - addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llRemoteLoadScriptPin", NULL, "ksiii", "llRemoteLoadScriptPin(key target, string name, integer pin, integer running, integer start_param)\nIf the owner of the object this script is attached can modify target,\nthey are in the same region,\nand the matching pin is used,\ncopy script name onto target,\nif running == TRUE, start the script with param.")); + addFunction(10.f, 0.f, dummy_func, "llSetVehicleType", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llSetVehicleFloatParam", NULL, "if"); + addFunction(10.f, 0.f, dummy_func, "llSetVehicleVectorParam", NULL, "iv"); + addFunction(10.f, 0.f, dummy_func, "llSetVehicleRotationParam", NULL, "iq"); + addFunction(10.f, 0.f, dummy_func, "llSetVehicleFlags", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llRemoveVehicleFlags", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llSitTarget", NULL, "vq"); + addFunction(10.f, 0.f, dummy_func, "llAvatarOnSitTarget", "k", NULL); + addFunction(10.f, 0.1f, dummy_func, "llAddToLandPassList", NULL, "kf"); + addFunction(10.f, 0.f, dummy_func, "llSetTouchText", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llSetSitText", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llSetCameraEyeOffset", NULL, "v"); + addFunction(10.f, 0.f, dummy_func, "llSetCameraAtOffset", NULL, "v"); + + addFunction(10.f, 0.f, dummy_func, "llDumpList2String", "s", "ls"); + addFunction(10.f, 0.f, dummy_func, "llScriptDanger", "i", "v"); + addFunction(10.f, 1.f, dummy_func, "llDialog", NULL, "ksli"); + addFunction(10.f, 0.f, dummy_func, "llVolumeDetect", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llResetOtherScript", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llGetScriptState", "i", "s"); + addFunction(10.f, 3.f, dummy_func, "llRemoteLoadScript", NULL, "ksii"); + + addFunction(10.f, 0.2f, dummy_func, "llSetRemoteScriptAccessPin", NULL, "i"); + addFunction(10.f, 3.f, dummy_func, "llRemoteLoadScriptPin", NULL, "ksiii"); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llOpenRemoteDataChannel", NULL, NULL, "llOpenRemoteDataChannel()\nCreates a channel to listen for XML-RPC calls. Will trigger a remote_data event with channel id once it is available.")); - addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llSendRemoteData", "k", "ksis", "key llSendRemoteData(key channel, string dest, integer idata, string sdata)\nSend an XML-RPC request to dest through channel with payload of channel (in a string), integer idata and string sdata.\nA message identifier key is returned.\nAn XML-RPC reply will trigger a remote_data event and reference the message id.\nThe message_id is returned.")); - addFunction(new LLScriptLibraryFunction(10.f, 3.f, dummy_func, "llRemoteDataReply", NULL, "kksi", "llRemoteDataReply(key channel, key message_id, string sdata, integer idata)\nSend an XML-RPC reply to message_id on channel with payload of string sdata and integer idata")); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llCloseRemoteDataChannel", NULL, "k", "llCloseRemoteDataChannel(key channel)\nCloses XML-RPC channel.")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llMD5String", "s", "si", "string llMD5String(string src, integer nonce)\nPerforms a RSA Data Security, Inc. MD5 Message-Digest Algorithm on string with nonce. Returns a 32 character hex string.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetPrimitiveParams", NULL, "l", "llSetPrimitiveParams(list rules)\nSet primitive parameters based on rules.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringToBase64", "s", "s", "string llStringToBase64(string str)\nConverts a string to the Base 64 representation of the string.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llBase64ToString", "s", "s", "string llBase64ToString(string str)\nConverts a Base 64 string to a conventional string. If the conversion creates any unprintable characters, they are converted to spaces.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.3f, dummy_func, "llXorBase64Strings", "s", "ss", "string llXorBase64Strings(string s1, string s2)\nDEPRECATED! Please use llXorBase64StringsCorrect instead!! Incorrectly performs an exclusive or on two Base 64 strings and returns a Base 64 string. s2 repeats if it is shorter than s1. Retained for backwards compatability.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRemoteDataSetRegion", NULL, NULL, "llRemoteDataSetRegion()\nIf an object using remote data channels changes regions, you must call this function to reregister the remote data channels.\nYou do not need to make this call if you don't change regions.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLog10", "f", "f", "float llLog10(float val)\nReturns the base 10 log of val if val > 0, otherwise returns 0.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llLog", "f", "f", "float llLog(float val)\nReturns the base e log of val if val > 0, otherwise returns 0.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetAnimationList", "l", "k", "list llGetAnimationList(key id)\nGets a list of all playing animations for avatar id")); - addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llSetParcelMusicURL", NULL, "s", "llSetParcelMusicURL(string url)\nSets the streaming audio URL for the parcel object is on")); + addFunction(10.f, 1.f, dummy_func, "llOpenRemoteDataChannel", NULL, NULL); + addFunction(10.f, 3.f, dummy_func, "llSendRemoteData", "k", "ksis"); + addFunction(10.f, 3.f, dummy_func, "llRemoteDataReply", NULL, "kksi"); + addFunction(10.f, 1.f, dummy_func, "llCloseRemoteDataChannel", NULL, "k"); + + addFunction(10.f, 0.f, dummy_func, "llMD5String", "s", "si"); + addFunction(10.f, 0.2f, dummy_func, "llSetPrimitiveParams", NULL, "l"); + addFunction(10.f, 0.f, dummy_func, "llStringToBase64", "s", "s"); + addFunction(10.f, 0.f, dummy_func, "llBase64ToString", "s", "s"); + addFunction(10.f, 0.3f, dummy_func, "llXorBase64Strings", "s", "ss"); + addFunction(10.f, 0.f, dummy_func, "llRemoteDataSetRegion", NULL, NULL); + addFunction(10.f, 0.f, dummy_func, "llLog10", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llLog", "f", "f"); + addFunction(10.f, 0.f, dummy_func, "llGetAnimationList", "l", "k"); + addFunction(10.f, 2.f, dummy_func, "llSetParcelMusicURL", NULL, "s"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRootPosition", "v", NULL, "vector llGetRootPosition()\nGets the global position of the root object of the object script is attached to")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRootRotation", "q", NULL, "rotation llGetRootRotation()\nGets the global rotation of the root object of the object script is attached to")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectDesc", "s", NULL, "string llGetObjectDesc()\nReturns the description of the object the script is attached to")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetObjectDesc", NULL, "s", "llSetObjectDesc(string name)\nSets the object's description")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCreator", "k", NULL, "key llGetCreator()\nReturns the creator of the object")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTimestamp", "s", NULL, "string llGetTimestamp()\nGets the timestamp in the format: YYYY-MM-DDThh:mm:ss.ff..fZ")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetLinkAlpha", NULL, "ifi", "llSetLinkAlpha(integer linknumber, float alpha, integer face)\nIf a prim exists in the link chain at linknumber, set face to alpha")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetNumberOfPrims", "i", NULL, "integer llGetNumberOfPrims()\nReturns the number of prims in a link set the script is attached to")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llGetNumberOfNotecardLines", "k", "s", "key llGetNumberOfNotecardLines(string name)\nReturns number of lines in notecard 'name' via the dataserver event (cast return value to integer)")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetBoundingBox", "l", "k", "list llGetBoundingBox(key object)\nReturns the bounding box around an object (including any linked prims) relative to the root prim, in a list: [ (vector) min_corner, (vector) max_corner ]")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetGeometricCenter", "v", NULL, "vector llGetGeometricCenter()\nReturns the geometric center of the linked set the script is attached to.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llGetPrimitiveParams", "l", "l", "list llGetPrimitiveParams(list params)\nGets primitive parameters specified in the params list.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.0f, dummy_func, "llIntegerToBase64", "s", "i", "string llIntegerToBase64(integer number)\nBig endian encode of of integer as a Base64 string.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.0f, dummy_func, "llBase64ToInteger", "i", "s", "integer llBase64ToInteger(string str)\nBig endian decode of a Base64 string into an integer.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetGMTclock", "f", "", "float llGetGMTclock()\nGets the time in seconds since midnight in GMT")); - addFunction(new LLScriptLibraryFunction(10.f, 10.f, dummy_func, "llGetSimulatorHostname", "s", "", "string llGetSimulatorHostname()\nGets the hostname of the machine script is running on (same as string in viewer Help dialog)")); + addFunction(10.f, 0.f, dummy_func, "llGetRootPosition", "v", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetRootRotation", "q", NULL); + + addFunction(10.f, 0.f, dummy_func, "llGetObjectDesc", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetObjectDesc", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llGetCreator", "k", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetTimestamp", "s", NULL); + addFunction(10.f, 0.f, dummy_func, "llSetLinkAlpha", NULL, "ifi"); + addFunction(10.f, 0.f, dummy_func, "llGetNumberOfPrims", "i", NULL); + addFunction(10.f, 0.1f, dummy_func, "llGetNumberOfNotecardLines", "k", "s"); + + addFunction(10.f, 0.f, dummy_func, "llGetBoundingBox", "l", "k"); + addFunction(10.f, 0.f, dummy_func, "llGetGeometricCenter", "v", NULL); + addFunction(10.f, 0.2f, dummy_func, "llGetPrimitiveParams", "l", "l"); + addFunction(10.f, 0.0f, dummy_func, "llIntegerToBase64", "s", "i"); + addFunction(10.f, 0.0f, dummy_func, "llBase64ToInteger", "i", "s"); + addFunction(10.f, 0.f, dummy_func, "llGetGMTclock", "f", ""); + addFunction(10.f, 10.f, dummy_func, "llGetSimulatorHostname", "s", ""); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLocalRot", NULL, "q", "llSetLocalRot(rotation rot)\nsets the rotation of a child prim relative to the root prim")); + addFunction(10.f, 0.2f, dummy_func, "llSetLocalRot", NULL, "q"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llParseStringKeepNulls", "l", "sll", "list llParseStringKeepNulls(string src, list separators, list spacers)\nBreaks src into a list, discarding separators, keeping spacers (separators and spacers must be lists of strings, maximum of 8 each), keeping any null values generated.")); - addFunction(new LLScriptLibraryFunction(200.f, 0.1f, dummy_func, "llRezAtRoot", NULL, "svvqi", "llRezAtRoot(string inventory, vector pos, vector vel, rotation rot, integer param)\nInstantiate owner's inventory object at pos with velocity vel and rotation rot with start parameter param.\nThe last selected root object's location will be set to pos")); + addFunction(10.f, 0.f, dummy_func, "llParseStringKeepNulls", "l", "sll"); + addFunction(200.f, 0.1f, dummy_func, "llRezAtRoot", NULL, "svvqi"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectPermMask", "i", "i", "integer llGetObjectPermMask(integer mask)\nReturns the requested permission mask for the root object the task is attached to.", FALSE)); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetObjectPermMask", NULL, "ii", "llSetObjectPermMask(integer mask, integer value)\nSets the given permission mask to the new value on the root object the task is attached to.", TRUE)); + addFunction(10.f, 0.f, dummy_func, "llGetObjectPermMask", "i", "i", FALSE); + addFunction(10.f, 0.f, dummy_func, "llSetObjectPermMask", NULL, "ii", TRUE); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryPermMask", "i", "si", "integer llGetInventoryPermMask(string item, integer mask)\nReturns the requested permission mask for the inventory item.", FALSE)); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetInventoryPermMask", NULL, "sii", "llSetInventoryPermMask(string item, integer mask, integer value)\nSets the given permission mask to the new value on the inventory item.", TRUE)); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryCreator", "k", "s", "key llGetInventoryCreator(string item)\nReturns the key for the creator of the inventory item.", FALSE)); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llOwnerSay", NULL, "s", "llOwnerSay(string msg)\nsays msg to owner only (if owner in sim)")); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llRequestSimulatorData", "k", "si", "key llRequestSimulatorData(string simulator, integer data)\nRequests data about simulator. When data is available the dataserver event will be raised")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llForceMouselook", NULL, "i", "llForceMouselook(integer mouselook)\nIf mouselook is TRUE any avatar that sits on this object is forced into mouselook mode")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectMass", "f", "k", "float llGetObjectMass(key id)\nGet the mass of the object with key id")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListReplaceList", "l", "llii", "list llListReplaceList(list dest, list src, integer start, integer end)\nReplaces start through end of dest with src.")); - addFunction(new LLScriptLibraryFunction(10.f, 10.f, dummy_func, "llLoadURL", NULL, "kss", "llLoadURL(key avatar_id, string message, string url)\nShows dialog to avatar avatar_id offering to load web page at URL. If user clicks yes, launches their web browser.")); + addFunction(10.f, 0.f, dummy_func, "llGetInventoryPermMask", "i", "si", FALSE); + addFunction(10.f, 0.f, dummy_func, "llSetInventoryPermMask", NULL, "sii", TRUE); + addFunction(10.f, 0.f, dummy_func, "llGetInventoryCreator", "k", "s", FALSE); + addFunction(10.f, 0.f, dummy_func, "llOwnerSay", NULL, "s"); + addFunction(10.f, 1.f, dummy_func, "llRequestSimulatorData", "k", "si"); + addFunction(10.f, 0.f, dummy_func, "llForceMouselook", NULL, "i"); + addFunction(10.f, 0.f, dummy_func, "llGetObjectMass", "f", "k"); + addFunction(10.f, 0.f, dummy_func, "llListReplaceList", "l", "llii"); + addFunction(10.f, 10.f, dummy_func, "llLoadURL", NULL, "kss"); - addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llParcelMediaCommandList", NULL, "l", "llParcelMediaCommandList(list command)\nSends a list of commands, some with arguments, to a parcel.")); - addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llParcelMediaQuery", "l", "l", "list llParcelMediaQuery(list query)\nSends a list of queries, returns a list of results.")); + addFunction(10.f, 2.f, dummy_func, "llParcelMediaCommandList", NULL, "l"); + addFunction(10.f, 2.f, dummy_func, "llParcelMediaQuery", "l", "l"); - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llModPow", "i", "iii", "integer llModPow(integer a, integer b, integer c)\nReturns a raised to the b power, mod c. ( (a**b)%c ). b is capped at 0xFFFF (16 bits).")); + addFunction(10.f, 1.f, dummy_func, "llModPow", "i", "iii"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetInventoryType", "i", "s", "integer llGetInventoryType(string name)\nReturns the type of the inventory name")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetPayPrice", NULL, "il", "llSetPayPrice(integer price, list quick_pay_buttons)\nSets the default amount when someone chooses to pay this object.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraPos", "v", "", "vector llGetCameraPos()\nGets current camera position for agent task has permissions for.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetCameraRot", "q", "", "rotation llGetCameraRot()\nGets current camera orientation for agent task has permissions for.")); + addFunction(10.f, 0.f, dummy_func, "llGetInventoryType", "i", "s"); + addFunction(10.f, 0.f, dummy_func, "llSetPayPrice", NULL, "il"); + addFunction(10.f, 0.f, dummy_func, "llGetCameraPos", "v", ""); + addFunction(10.f, 0.f, dummy_func, "llGetCameraRot", "q", ""); - addFunction(new LLScriptLibraryFunction(10.f, 2.f, dummy_func, "llSetPrimURL", NULL, "s", "llSetPrimURL(string url)\nUpdates the URL for the web page shown on the sides of the object.")); - addFunction(new LLScriptLibraryFunction(10.f, 20.f, dummy_func, "llRefreshPrimURL", NULL, "", "llRefreshPrimURL()\nReloads the web page shown on the sides of the object.")); + addFunction(10.f, 20.f, dummy_func, "llSetPrimURL", NULL, "s"); + addFunction(10.f, 20.f, dummy_func, "llRefreshPrimURL", NULL, ""); + addFunction(10.f, 0.f, dummy_func, "llEscapeURL", "s", "s"); + addFunction(10.f, 0.f, dummy_func, "llUnescapeURL", "s", "s"); + + addFunction(10.f, 1.f, dummy_func, "llMapDestination", NULL, "svv"); + addFunction(10.f, 0.1f, dummy_func, "llAddToLandBanList", NULL, "kf"); + addFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandPassList", NULL, "k"); + addFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandBanList", NULL, "k"); + + addFunction(10.f, 0.f, dummy_func, "llSetCameraParams", NULL, "l"); + addFunction(10.f, 0.f, dummy_func, "llClearCameraParams", NULL, NULL); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llEscapeURL", "s", "s", "string llEscapeURL(string url)\nReturns and escaped/encoded version of url, replacing spaces with %20 etc.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llUnescapeURL", "s", "s", "string llUnescapeURL(string url)\nReturns and unescaped/unencoded version of url, replacing %20 with spaces etc.")); - - addFunction(new LLScriptLibraryFunction(10.f, 1.f, dummy_func, "llMapDestination", NULL, "svv", "llMapDestination(string simname, vector pos, vector look_at)\nOpens world map centered on region with pos highlighted.\nOnly works for scripts attached to avatar, or during touch events.\n(NOTE: look_at currently does nothing)")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llAddToLandBanList", NULL, "kf", "llAddToLandBanList(key avatar, float hours)\nAdd avatar to the land ban list for hours")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandPassList", NULL, "k", "llRemoveFromLandPassList(key avatar)\nRemove avatar from the land pass list")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandBanList", NULL, "k", "llRemoveFromLandBanList(key avatar)\nRemove avatar from the land ban list")); + addFunction(10.f, 0.f, dummy_func, "llListStatistics", "f", "il"); + addFunction(10.f, 0.f, dummy_func, "llGetUnixTime", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llGetParcelFlags", "i", "v"); + addFunction(10.f, 0.f, dummy_func, "llGetRegionFlags", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llXorBase64StringsCorrect", "s", "ss"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCameraParams", NULL, "l", "llSetCameraParams(list rules)\nSets multiple camera parameters at once.\nList format is [ rule1, data1, rule2, data2 . . . rulen, datan ]")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llClearCameraParams", NULL, NULL, "llClearCameraParams()\nResets all camera parameters to default values and turns off scripted camera control.")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llListStatistics", "f", "il", "float llListStatistics(integer operation, list l)\nPerform statistical aggregate functions on list l using LIST_STAT_* operations.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetUnixTime", "i", NULL, "integer llGetUnixTime()\nGet the number of seconds elapsed since 00:00 hours, Jan 1, 1970 UTC from the system clock.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelFlags", "i", "v", "integer llGetParcelFlags(vector pos)\nGet the parcel flags (PARCEL_FLAG_*) for the parcel including the point pos.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetRegionFlags", "i", NULL, "integer llGetRegionFlags()\nGet the region flags (REGION_FLAG_*) for the region the object is in.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llXorBase64StringsCorrect", "s", "ss", "string llXorBase64StringsCorrect(string s1, string s2)\nCorrectly performs an exclusive or on two Base 64 strings and returns a Base 64 string. s2 repeats if it is shorter than s1.")); + addFunction(10.f, 0.f, dummy_func, "llHTTPRequest", "k", "sls"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llHTTPRequest", "k", "sls", "llHTTPRequest(string url, list parameters, string body)\nSend an HTTP request.")); + addFunction(10.f, 0.1f, dummy_func, "llResetLandBanList", NULL, NULL); + addFunction(10.f, 0.1f, dummy_func, "llResetLandPassList", NULL, NULL); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llResetLandBanList", NULL, NULL, "llResetLandBanList()\nRemoves all residents from the land ban list.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.1f, dummy_func, "llResetLandPassList", NULL, NULL, "llResetLandPassList()\nRemoves all residents from the land access/pass list.")); + addFunction(10.f, 0.f, dummy_func, "llGetObjectPrimCount", "i", "k"); + addFunction(10.f, 2.0f, dummy_func, "llGetParcelPrimOwners", "l", "v"); + addFunction(10.f, 0.f, dummy_func, "llGetParcelPrimCount", "i", "vii"); + addFunction(10.f, 0.f, dummy_func, "llGetParcelMaxPrims", "i", "vi"); + addFunction(10.f, 0.f, dummy_func, "llGetParcelDetails", "l", "vl"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectPrimCount", "i", "k", "integer llGetObjectPrimCount(key object_id)\nReturns the total number of prims for an object.")); - addFunction(new LLScriptLibraryFunction(10.f, 2.0f, dummy_func, "llGetParcelPrimOwners", "l", "v", "list llGetParcelPrimOwners(vector pos)\nReturns a list of all residents who own objects on the parcel and the number of objects they own.\nRequires owner-like permissions for the parcel.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelPrimCount", "i", "vii","integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide)\nGets the number of prims on the parcel of the given category.\nCategories: PARCEL_COUNT_TOTAL, _OWNER, _GROUP, _OTHER, _SELECTED, _TEMP.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelMaxPrims", "i", "vi","integer llGetParcelMaxPrims(vector pos, integer sim_wide)\nGets the maximum number of prims allowed on the parcel at pos.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelDetails", "l", "vl","list llGetParcelDetails(vector pos, list params)\nGets the parcel details specified in params for the parcel at pos.\nParams is one or more of: PARCEL_DETAILS_NAME, _DESC, _OWNER, _GROUP, _AREA")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkPrimitiveParams", NULL, "il", "llSetLinkPrimitiveParams(integer linknumber, list rules)\nSet primitive parameters for linknumber based on rules.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkTexture", NULL, "isi", "llSetLinkTexture(integer link_pos, string texture, integer face)\nSets the texture of face for link_pos")); + addFunction(10.f, 0.2f, dummy_func, "llSetLinkPrimitiveParams", NULL, "il"); + addFunction(10.f, 0.2f, dummy_func, "llSetLinkTexture", NULL, "isi"); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringTrim", "s", "si", "string llStringTrim(string src, integer trim_type)\nTrim leading and/or trailing spaces from a string.\nUses trim_type of STRING_TRIM, STRING_TRIM_HEAD or STRING_TRIM_TAIL.")); - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llRegionSay", NULL, "is", "llRegionSay(integer channel, string msg)\nbroadcasts msg to entire region on channel (not 0.)")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetObjectDetails", "l", "kl", "list llGetObjectDetails(key id, list params)\nGets the object details specified in params for the object with key id.\nDetails are OBJECT_NAME, _DESC, _POS, _ROT, _VELOCITY, _OWNER, _GROUP, _CREATOR.")); - - addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetClickAction", NULL, "i", "llSetClickAction(integer action)\nSets the action performed when a prim is clicked upon.")); + addFunction(10.f, 0.f, dummy_func, "llStringTrim", "s", "si"); + addFunction(10.f, 0.f, dummy_func, "llRegionSay", NULL, "is"); + addFunction(10.f, 0.f, dummy_func, "llGetObjectDetails", "l", "kl"); + addFunction(10.f, 0.f, dummy_func, "llSetClickAction", NULL, "i"); + + addFunction(10.f, 0.f, dummy_func, "llGetRegionAgentCount", "i", NULL); + addFunction(10.f, 1.f, dummy_func, "llTextBox", NULL, "ksi"); + addFunction(10.f, 0.f, dummy_func, "llGetAgentLanguage", "s", "k"); + addFunction(10.f, 0.f, dummy_func, "llDetectedTouchUV", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedTouchFace", "i", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedTouchPos", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedTouchNormal", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedTouchBinormal", "v", "i"); + addFunction(10.f, 0.f, dummy_func, "llDetectedTouchST", "v", "i"); + + addFunction(10.f, 0.f, dummy_func, "llSHA1String", "s", "s"); + + addFunction(10.f, 0.f, dummy_func, "llGetFreeURLs", "i", NULL); + addFunction(10.f, 0.f, dummy_func, "llRequestURL", "k", NULL); + addFunction(10.f, 0.f, dummy_func, "llRequestSecureURL", "k", NULL); + addFunction(10.f, 0.f, dummy_func, "llReleaseURL", NULL, "s"); + addFunction(10.f, 0.f, dummy_func, "llHTTPResponse", NULL, "kis"); + addFunction(10.f, 0.f, dummy_func, "llGetHTTPHeader", "s", "ks"); + + // Prim media (see lscript_prim_media.h) + addFunction(10.f, 1.0f, dummy_func, "llSetPrimMediaParams", "i", "il"); + addFunction(10.f, 1.0f, dummy_func, "llGetPrimMediaParams", "l", "il"); + addFunction(10.f, 1.0f, dummy_func, "llClearPrimMedia", "i", "i"); // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only @@ -448,75 +456,34 @@ void LLScriptLibrary::init() // existing scripts will crash. } - //Ventrella Follow Cam Script Stuff - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPitch", NULL, "f", "llSetCamPitch(-45 to 80)\n(Adjusts the angular amount that the camera aims straight ahead vs. straight down, maintaining the same distance. Analogous to 'incidence'.")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamVerticalOffset", NULL, "f", "llSetCamVerticalOffset(-2 to 2)\nAdjusts the vertical position of the camera focus position relative to the subject")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLag", NULL, "f", "llSetCamPositionLag(0 to 3) \nHow much the camera lags as it tries to move towards its 'ideal' position")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLag", NULL, "f", "llSetCamFocusLag(0 to 3)\nHow much the camera lags as it tries to aim towards the subject")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamDistance", NULL, "f", "llSetCamDistance(0.5 to 10)\nSets how far away the camera wants to be from its subject")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamBehindnessAngle", NULL, "f", "llSetCamBehindnessAngle(0 to 180)\nSets the angle in degrees within which the camera is not constrained by changes in subject rotation")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamBehindnessLag", NULL, "f", "llSetCamBehindnessLag(0 to 3)\nSets how strongly the camera is forced to stay behind the target if outside of behindness angle")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionThreshold", NULL, "f", "llSetCamPositionThreshold(0 to 4)\nSets the radius of a sphere around the camera's ideal position within which it is not affected by subject motion")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusThreshold", NULL, "f", "llSetCamFocusThreshold(0 to 4)\nSets the radius of a sphere around the camera's subject position within which its focus is not affected by subject motion")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamScriptControl", NULL, "i", "llSetCamScriptControl(TRUE or FALSE)\nTurns on or off scripted control of the camera")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPosition", NULL, "v", "llSetCamPosition(vector)\nSets the position of the camera")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocus", NULL, "v", "llSetCamFocus(vector focus)\nSets the focus (target position) of the camera")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLocked", NULL, "i", "llSetCamPositionLocked(TRUE or FALSE)\nLocks the camera position so it will not move")); - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLocked", NULL, "i", "llSetCamFocusLocked(TRUE or FALSE)\nLocks the camera focus so it will not move")); - - //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForSale", "i", "ii", "integer llSetForSale(integer selltype, integer price)\nSets this object for sale in mode selltype for price. Returns TRUE if successfully set for sale.")); - -LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only) +LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only) : mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only) { - mDesc = new char[512]; - if (mSleepTime) - { - snprintf( /* Flawfinder: ignore */ - mDesc, - 512, - "%s\nSleeps script for %.1f seconds.", - desc, - mSleepTime); - } - else - { - strncpy(mDesc, desc, 512); /* Flawfinder: ignore */ - mDesc[511] = '\0'; // just in case. - } } LLScriptLibraryFunction::~LLScriptLibraryFunction() { - delete [] mDesc; } -void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func) +void LLScriptLibrary::addFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only) { - LLScriptLibraryFunction **temp = new LLScriptLibraryFunction*[mNextNumber + 1]; - if (mNextNumber) - { - memcpy( /* Flawfinder: ignore */ - temp, - mFunctions, - sizeof(LLScriptLibraryFunction*)*mNextNumber); - delete [] mFunctions; - } - mFunctions = temp; - mFunctions[mNextNumber] = func; - mNextNumber++; + LLScriptLibraryFunction func(eu, st, exec_func, name, ret_type, args, god_only); + mFunctions.push_back(func); } -void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) +void LLScriptLibrary::assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &)) { - S32 i; - for (i = 0; i < mNextNumber; i++) + for (std::vector<LLScriptLibraryFunction>::iterator i = mFunctions.begin(); + i != mFunctions.end(); ++i) { - if (!strcmp(name, mFunctions[i]->mName)) + if (!strcmp(name, i->mName)) { - mFunctions[i]->mExecFunc = exec_func; + i->mExecFunc = exec_func; + return; } } + + llerrs << "Unknown LSL function in assignExec: " << name << llendl; } void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma) @@ -527,7 +494,7 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma) s << ", "; } switch (mType) - { + { case LST_INTEGER: s << mInteger; break; diff --git a/indra/lscript/lscript_rt_interface.h b/indra/lscript/lscript_rt_interface.h index 791c447d33..cdf2c5bbd7 100644 --- a/indra/lscript/lscript_rt_interface.h +++ b/indra/lscript/lscript_rt_interface.h @@ -2,40 +2,35 @@ * @file lscript_rt_interface.h * @brief Interface between compiler library and applications * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2007, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlife.com/developers/opensource/gplv2 + * Copyright (C) 2010, Linden Research, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at http://secondlife.com/developers/opensource/flossexception + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ #ifndef LL_LSCRIPT_RT_INTERFACE_H #define LL_LSCRIPT_RT_INTERFACE_H -BOOL lscript_compile(char *filename, BOOL is_god_like = FALSE); +BOOL lscript_compile(char *filename, BOOL compile_to_mono, BOOL is_god_like = FALSE); BOOL lscript_compile(const char* src_filename, const char* dst_filename, - const char* err_filename, BOOL is_god_like = FALSE); -void lscript_run(char *filename, BOOL b_debug); + const char* err_filename, BOOL compile_to_mono, const char* class_name, BOOL is_god_like = FALSE); +void lscript_run(const std::string& filename, BOOL b_debug); #endif |