From ca08bd5aba5e69fce3b0f5b4f861ffec9fe4d2e5 Mon Sep 17 00:00:00 2001 From: Cinder Date: Sun, 8 Feb 2015 12:53:39 -0700 Subject: OPEN-292 - Remove lscript from project, Remove legacy udp script upload methods, Refactor script runtime perms from three arrays to one struct array so we don't have to juggle array order anymore. --- indra/CMakeLists.txt | 2 - indra/cmake/CMakeLists.txt | 1 - indra/cmake/LScript.cmake | 16 - indra/lscript/CMakeLists.txt | 21 - indra/lscript/llscriptresource.h | 69 - indra/lscript/llscriptresourceconsumer.h | 61 - indra/lscript/llscriptresourcepool.h | 51 - indra/lscript/lscript_alloc.h | 293 - indra/lscript/lscript_byteconvert.h | 1170 -- indra/lscript/lscript_byteformat.h | 566 - indra/lscript/lscript_compile/CMakeLists.txt | 157 - indra/lscript/lscript_compile/bison.bat | 12 - indra/lscript/lscript_compile/indra.l | 1013 -- indra/lscript/lscript_compile/indra.y | 1791 --- indra/lscript/lscript_compile/lscript_alloc.cpp | 26 - indra/lscript/lscript_compile/lscript_bytecode.cpp | 317 - indra/lscript/lscript_compile/lscript_bytecode.h | 90 - indra/lscript/lscript_compile/lscript_error.cpp | 103 - indra/lscript/lscript_compile/lscript_error.h | 152 - indra/lscript/lscript_compile/lscript_heap.cpp | 67 - indra/lscript/lscript_compile/lscript_heap.h | 58 - indra/lscript/lscript_compile/lscript_resource.cpp | 36 - indra/lscript/lscript_compile/lscript_resource.h | 37 - indra/lscript/lscript_compile/lscript_scope.cpp | 31 - indra/lscript/lscript_compile/lscript_scope.h | 401 - indra/lscript/lscript_compile/lscript_tree.cpp | 10895 ------------------- indra/lscript/lscript_compile/lscript_tree.h | 2325 ---- .../lscript/lscript_compile/lscript_typecheck.cpp | 586 - indra/lscript/lscript_compile/lscript_typecheck.h | 118 - indra/lscript/lscript_compile/windows/unistd.h | 24 - indra/lscript/lscript_execute.h | 552 - indra/lscript/lscript_execute/CMakeLists.txt | 43 - indra/lscript/lscript_execute/llscriptresource.cpp | 93 - .../lscript_execute/llscriptresourceconsumer.cpp | 106 - .../lscript_execute/llscriptresourcepool.cpp | 44 - indra/lscript/lscript_execute/lscript_execute.cpp | 4318 -------- .../lscript_execute/lscript_heapruntime.cpp | 519 - .../lscript/lscript_execute/lscript_heapruntime.h | 40 - indra/lscript/lscript_execute/lscript_readlso.cpp | 1585 --- indra/lscript/lscript_execute/lscript_readlso.h | 164 - indra/lscript/lscript_export.h | 34 - indra/lscript/lscript_http.h | 45 - indra/lscript/lscript_library.h | 427 - indra/lscript/lscript_library/CMakeLists.txt | 35 - indra/lscript/lscript_library/lscript_alloc.cpp | 1136 -- indra/lscript/lscript_library/lscript_export.cpp | 26 - indra/lscript/lscript_library/lscript_library.cpp | 582 - indra/lscript/lscript_rt_interface.h | 36 - indra/newview/CMakeLists.txt | 5 +- indra/newview/llagent.cpp | 2 +- indra/newview/llpreviewscript.cpp | 193 - indra/newview/llpreviewscript.h | 7 - indra/newview/llscriptruntimeperms.h | 60 + indra/newview/llviewermessage.cpp | 69 +- indra/test/CMakeLists.txt | 2 - indra/test/llscriptresource_tut.cpp | 198 - 56 files changed, 77 insertions(+), 30733 deletions(-) delete mode 100755 indra/cmake/LScript.cmake delete mode 100755 indra/lscript/CMakeLists.txt delete mode 100755 indra/lscript/llscriptresource.h delete mode 100755 indra/lscript/llscriptresourceconsumer.h delete mode 100755 indra/lscript/llscriptresourcepool.h delete mode 100755 indra/lscript/lscript_alloc.h delete mode 100755 indra/lscript/lscript_byteconvert.h delete mode 100755 indra/lscript/lscript_byteformat.h delete mode 100755 indra/lscript/lscript_compile/CMakeLists.txt delete mode 100644 indra/lscript/lscript_compile/bison.bat delete mode 100755 indra/lscript/lscript_compile/indra.l delete mode 100755 indra/lscript/lscript_compile/indra.y delete mode 100755 indra/lscript/lscript_compile/lscript_alloc.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_bytecode.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_bytecode.h delete mode 100755 indra/lscript/lscript_compile/lscript_error.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_error.h delete mode 100755 indra/lscript/lscript_compile/lscript_heap.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_heap.h delete mode 100755 indra/lscript/lscript_compile/lscript_resource.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_resource.h delete mode 100755 indra/lscript/lscript_compile/lscript_scope.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_scope.h delete mode 100755 indra/lscript/lscript_compile/lscript_tree.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_tree.h delete mode 100755 indra/lscript/lscript_compile/lscript_typecheck.cpp delete mode 100755 indra/lscript/lscript_compile/lscript_typecheck.h delete mode 100755 indra/lscript/lscript_compile/windows/unistd.h delete mode 100755 indra/lscript/lscript_execute.h delete mode 100755 indra/lscript/lscript_execute/CMakeLists.txt delete mode 100755 indra/lscript/lscript_execute/llscriptresource.cpp delete mode 100755 indra/lscript/lscript_execute/llscriptresourceconsumer.cpp delete mode 100755 indra/lscript/lscript_execute/llscriptresourcepool.cpp delete mode 100755 indra/lscript/lscript_execute/lscript_execute.cpp delete mode 100755 indra/lscript/lscript_execute/lscript_heapruntime.cpp delete mode 100755 indra/lscript/lscript_execute/lscript_heapruntime.h delete mode 100755 indra/lscript/lscript_execute/lscript_readlso.cpp delete mode 100755 indra/lscript/lscript_execute/lscript_readlso.h delete mode 100755 indra/lscript/lscript_export.h delete mode 100755 indra/lscript/lscript_http.h delete mode 100755 indra/lscript/lscript_library.h delete mode 100755 indra/lscript/lscript_library/CMakeLists.txt delete mode 100755 indra/lscript/lscript_library/lscript_alloc.cpp delete mode 100755 indra/lscript/lscript_library/lscript_export.cpp delete mode 100755 indra/lscript/lscript_library/lscript_library.cpp delete mode 100755 indra/lscript/lscript_rt_interface.h create mode 100644 indra/newview/llscriptruntimeperms.h delete mode 100755 indra/test/llscriptresource_tut.cpp (limited to 'indra') diff --git a/indra/CMakeLists.txt b/indra/CMakeLists.txt index 10692402a5..b0dbe62a0c 100755 --- a/indra/CMakeLists.txt +++ b/indra/CMakeLists.txt @@ -39,8 +39,6 @@ add_subdirectory(${LIBS_OPEN_PREFIX}llvfs) add_subdirectory(${LIBS_OPEN_PREFIX}llwindow) add_subdirectory(${LIBS_OPEN_PREFIX}llxml) -add_subdirectory(${LIBS_OPEN_PREFIX}lscript) - if (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) add_subdirectory(${LIBS_CLOSED_PREFIX}copy_win_scripts) endif (WINDOWS AND EXISTS ${LIBS_CLOSED_DIR}copy_win_scripts) diff --git a/indra/cmake/CMakeLists.txt b/indra/cmake/CMakeLists.txt index 4d98e73092..5bf3bbc61d 100755 --- a/indra/cmake/CMakeLists.txt +++ b/indra/cmake/CMakeLists.txt @@ -79,7 +79,6 @@ set(cmake_SOURCE_FILES LLVFS.cmake LLWindow.cmake LLXML.cmake - LScript.cmake Linking.cmake ## MediaPluginBase.cmake NDOF.cmake diff --git a/indra/cmake/LScript.cmake b/indra/cmake/LScript.cmake deleted file mode 100755 index 21e78fc2c0..0000000000 --- a/indra/cmake/LScript.cmake +++ /dev/null @@ -1,16 +0,0 @@ -# -*- cmake -*- - -set(LSCRIPT_INCLUDE_DIRS - ${LIBS_OPEN_DIR}/lscript - ${LIBS_OPEN_DIR}/lscript/lscript_compile - ${LIBS_OPEN_DIR}/lscript/lscript_execute - ${LIBS_OPEN_DIR}/lscript/lscript_execute_mono - ) - -set(LSCRIPT_LIBRARIES - lscript_compile - lscript_execute - lscript_library - ) - -set(LSCRIPT_EXECUTE_MONO_LIBRARIES lscript_execute_mono) diff --git a/indra/lscript/CMakeLists.txt b/indra/lscript/CMakeLists.txt deleted file mode 100755 index 937e2ec0dc..0000000000 --- a/indra/lscript/CMakeLists.txt +++ /dev/null @@ -1,21 +0,0 @@ -# -*- 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 deleted file mode 100755 index 9dab9ff7ce..0000000000 --- a/indra/lscript/llscriptresource.h +++ /dev/null @@ -1,69 +0,0 @@ -/** - * @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 deleted file mode 100755 index 82a490d28f..0000000000 --- a/indra/lscript/llscriptresourceconsumer.h +++ /dev/null @@ -1,61 +0,0 @@ -/** - * @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 deleted file mode 100755 index 4ea2556e0f..0000000000 --- a/indra/lscript/llscriptresourcepool.h +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @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 deleted file mode 100755 index f8a4e298d2..0000000000 --- a/indra/lscript/lscript_alloc.h +++ /dev/null @@ -1,293 +0,0 @@ -/** - * @file lscript_alloc.h - * @brief General heap management for scripting system - * - * $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$ - */ - -#ifndef LL_LSCRIPT_ALLOC_H -#define LL_LSCRIPT_ALLOC_H -// #define at top of file accelerates gcc compiles -// Under gcc 2.9, the manual is unclear if comments can appear above #ifndef -// Under gcc 3, the manual explicitly states comments can appear above the #ifndef - -#include "lscript_byteconvert.h" -#include "lscript_library.h" - -void reset_hp_to_safe_spot(const U8 *buffer); - - -// supported data types - -// basic types -// integer 4 bytes of integer data -// float 4 bytes of float data -// string data null terminated 1 byte string -// key data null terminated 1 byte string -// vector data 12 bytes of 3 floats -// quaternion data 16 bytes of 4 floats - -// list type -// list data 4 bytes of number of entries followed by followed by pointer - -// string pointer 4 bytes of address of string data on the heap (only used in list data) -// key pointer 4 bytes of address of key data on the heap (only used in list data) - -// heap format -// -// 4 byte offset to next block (in bytes) -// 1 byte of type of variable or empty -// 2 bytes of reference count -// nn bytes of data - -const S32 MAX_HEAP_SIZE = TOP_OF_MEMORY; - -class LLScriptAllocEntry -{ -public: - LLScriptAllocEntry() : mSize(0), mType(LST_NULL), mReferenceCount(0) {} - LLScriptAllocEntry(S32 offset, U8 type) : mSize(offset), mType(type), mReferenceCount(1) {} - friend std::ostream& operator<<(std::ostream& s, const LLScriptAllocEntry &a) - { - s << "Size: " << a.mSize << " Type: " << LSCRIPTTypeNames[a.mType] << " Count: " << a.mReferenceCount; - return s; - } - - S32 mSize; - U8 mType; - S16 mReferenceCount; -}; - -// this is only OK because we only load/save via accessors below -const S32 SIZEOF_SCRIPT_ALLOC_ENTRY = 7; - -inline void alloc_entry2bytestream(U8 *buffer, S32 &offset, const LLScriptAllocEntry &entry) -{ - if ( (offset < 0) - ||(offset > MAX_HEAP_SIZE)) - { - set_fault(buffer, LSRF_BOUND_CHECK_ERROR); - } - else - { - integer2bytestream(buffer, offset, entry.mSize); - byte2bytestream(buffer, offset, entry.mType); - s162bytestream(buffer, offset, entry.mReferenceCount); - } -} - -inline void bytestream2alloc_entry(LLScriptAllocEntry &entry, U8 *buffer, S32 &offset) -{ - if ( (offset < 0) - ||(offset > MAX_HEAP_SIZE)) - { - set_fault(buffer, LSRF_BOUND_CHECK_ERROR); - reset_hp_to_safe_spot(buffer); - } - else - { - entry.mSize = bytestream2integer(buffer, offset); - entry.mType = bytestream2byte(buffer, offset); - entry.mReferenceCount = bytestream2s16(buffer, offset); - } -} - -// create a heap from the HR to TM -BOOL lsa_create_heap(U8 *heap_start, S32 size); -void lsa_fprint_heap(U8 *buffer, LLFILE *fp); - -void lsa_print_heap(U8 *buffer); - -// adding to heap -// if block is empty -// if block is at least block size + 4 larger than data -// split block -// insert data into first part -// return address -// else -// insert data into block -// return address -// else -// if next block is >= SP -// set Stack-Heap collision -// return NULL -// if next block is empty -// merge next block with current block -// go to start of algorithm -// else -// move to next block -// go to start of algorithm - -S32 lsa_heap_add_data(U8 *buffer, LLScriptLibData *data, S32 heapsize, BOOL b_delete); - -S32 lsa_heap_top(U8 *heap_start, S32 maxsize); - -// split block -// set offset to point to new block -// set offset of new block to point to original offset - block size - data size -// set new block to empty -// set new block reference count to 0 -void lsa_split_block(U8 *buffer, S32 &offset, S32 size, LLScriptAllocEntry &entry); - -// insert data -// if data is non-list type -// set type to basic type, set reference count to 1, copy data, return address -// else -// set type to list data type, set reference count to 1 -// for each list entry -// insert data -// return address - -void lsa_insert_data(U8 *buffer, S32 &offset, LLScriptLibData *data, LLScriptAllocEntry &entry, S32 heapsize); - -S32 lsa_create_data_block(U8 **buffer, LLScriptLibData *data, S32 base_offset); - -// increase reference count -// increase reference count by 1 - -void lsa_increase_ref_count(U8 *buffer, S32 offset); - -// decrease reference count -// decrease reference count by 1 -// if reference count == 0 -// set type to empty - -void lsa_decrease_ref_count(U8 *buffer, S32 offset); - -inline S32 get_max_heap_size(U8 *buffer) -{ - return get_register(buffer, LREG_SP) - get_register(buffer, LREG_HR); -} - - -LLScriptLibData *lsa_get_data(U8 *buffer, S32 &offset, BOOL b_dec_ref); -LLScriptLibData *lsa_get_list_ptr(U8 *buffer, S32 &offset, BOOL b_dec_ref); - -S32 lsa_cat_strings(U8 *buffer, S32 offset1, S32 offset2, S32 heapsize); -S32 lsa_cmp_strings(U8 *buffer, S32 offset1, S32 offset2); - -S32 lsa_cat_lists(U8 *buffer, S32 offset1, S32 offset2, S32 heapsize); -S32 lsa_cmp_lists(U8 *buffer, S32 offset1, S32 offset2); -S32 lsa_preadd_lists(U8 *buffer, LLScriptLibData *data, S32 offset2, S32 heapsize); -S32 lsa_postadd_lists(U8 *buffer, S32 offset1, LLScriptLibData *data, S32 heapsize); - -// modifying a list -// insert new list that is modified -// store returned address in original list's variable -// decrease reference count on old list - -// list l1 = [10]; -// list l2 = l1; -// l1 = [11]; - -// we want l2 == [10]; - -// more complicated example: -// list l1 = [10, 11]; -// list l2 = l1; -// l1[0] = 12 - -// I think that we want l2 = [10, 11]; - -// one option would be to use syntax like: -// l1 = llSetList(l1, 0, 12); -// but this would require variable argument list matching -// which maybe is ok, but would be work -// the other option would be changes to lists that have multiple references causes a copy to occur - -// popl @l1, 0, integer, 12 -// -// would cause l1 to be copied, 12 to replace the 0th entry, and the address of the new list to be saved in l1 -// - -inline LLScriptLibData *lsa_bubble_sort(LLScriptLibData *src, S32 stride, S32 ascending) -{ - S32 number = src->getListLength(); - - if (number <= 0) - { - return NULL; - } - - if (stride <= 0) - { - stride = 1; - } - - S32 i = 0; - - if (number % stride) - { - LLScriptLibData *retval = src->mListp; - src->mListp = NULL; - return retval; - } - - LLScriptLibData **sortarray = new LLScriptLibData*[number]; - - LLScriptLibData *temp = src->mListp; - while (temp) - { - sortarray[i] = temp; - i++; - temp = temp->mListp; - } - - S32 j, s; - - for (i = 0; i < number; i += stride) - { - for (j = i; j < number; j += stride) - { - if ( ((*sortarray[i]) <= (*sortarray[j])) - != (ascending == TRUE)) - { - for (s = 0; s < stride; s++) - { - temp = sortarray[i + s]; - sortarray[i + s] = sortarray[j + s]; - sortarray[j + s] = temp; - } - } - } - } - - i = 1; - temp = sortarray[0]; - while (i < number) - { - temp->mListp = sortarray[i++]; - temp = temp->mListp; - } - temp->mListp = NULL; - - src->mListp = NULL; - - temp = sortarray[0]; - delete[] sortarray; - return temp; -} - - -LLScriptLibData* lsa_randomize(LLScriptLibData* src, S32 stride); - -#endif diff --git a/indra/lscript/lscript_byteconvert.h b/indra/lscript/lscript_byteconvert.h deleted file mode 100755 index 5b08481d7d..0000000000 --- a/indra/lscript/lscript_byteconvert.h +++ /dev/null @@ -1,1170 +0,0 @@ -/** - * @file lscript_byteconvert.h - * @brief Shared code for compiler and assembler for LSL - * - * $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$ - */ - -// data shared between compiler/assembler -// used to convert data between byte stream and outside data types - -#ifndef LL_LSCRIPT_BYTECONVERT_H -#define LL_LSCRIPT_BYTECONVERT_H - -#include "stdtypes.h" -#include "v3math.h" -#include "llquaternion.h" -#include "lscript_byteformat.h" -#include "lluuid.h" - -void reset_hp_to_safe_spot(const U8 *buffer); - -// remember that LScript byte stream is BigEndian -void set_fault(const U8 *stream, LSCRIPTRunTimeFaults fault); - -inline S32 bytestream2integer(const U8 *stream, S32 &offset) -{ - stream += offset; - offset += 4; - return (*stream<<24) | (*(stream + 1)<<16) | (*(stream + 2)<<8) | *(stream + 3); -} - -inline U32 bytestream2unsigned_integer(const U8 *stream, S32 &offset) -{ - stream += offset; - offset += 4; - return (*stream<<24) | (*(stream + 1)<<16) | (*(stream + 2)<<8) | *(stream + 3); -} - -inline U64 bytestream2u64(const U8 *stream, S32 &offset) -{ - stream += offset; - offset += 8; - return ((U64)(*stream)<<56)| ((U64)(*(stream + 1))<<48) | ((U64)(*(stream + 2))<<40) | ((U64)(*(stream + 3))<<32) | - ((U64)(*(stream + 4))<<24) | ((U64)(*(stream + 5))<<16) | ((U64)(*(stream + 6))<<8) | (U64)(*(stream + 7)); -} - -inline void integer2bytestream(U8 *stream, S32 &offset, S32 integer) -{ - stream += offset; - offset += 4; - *(stream) = (integer >> 24); - *(stream + 1) = (integer >> 16) & 0xff; - *(stream + 2) = (integer >> 8) & 0xff; - *(stream + 3) = (integer) & 0xff; -} - -inline void unsigned_integer2bytestream(U8 *stream, S32 &offset, U32 integer) -{ - stream += offset; - offset += 4; - *(stream) = (integer >> 24); - *(stream + 1) = (integer >> 16) & 0xff; - *(stream + 2) = (integer >> 8) & 0xff; - *(stream + 3) = (integer) & 0xff; -} -inline void u642bytestream(U8 *stream, S32 &offset, U64 integer) -{ - stream += offset; - offset += 8; - *(stream) = (U8)(integer >> 56); - *(stream + 1) = (U8)((integer >> 48) & 0xff); - *(stream + 2) = (U8)((integer >> 40) & 0xff); - *(stream + 3) = (U8)((integer >> 32) & 0xff); - *(stream + 4) = (U8)((integer >> 24) & 0xff); - *(stream + 5) = (U8)((integer >> 16) & 0xff); - *(stream + 6) = (U8)((integer >> 8) & 0xff); - *(stream + 7) = (U8)((integer) & 0xff); -} - -inline S16 bytestream2s16(const U8 *stream, S32 &offset) -{ - stream += offset; - offset += 2; - return (*stream<<8) | *(stream + 1); -} - -inline void s162bytestream(U8 *stream, S32 &offset, S16 integer) -{ - stream += offset; - offset += 2; - *(stream) = (integer >> 8); - *(stream + 1) = (integer) & 0xff; -} - -inline U16 bytestream2u16(const U8 *stream, S32 &offset) -{ - stream += offset; - offset += 2; - return (*stream<<8) | *(stream + 1); -} - -inline void u162bytestream(U8 *stream, S32 &offset, U16 integer) -{ - stream += offset; - offset += 2; - *(stream) = (integer >> 8); - *(stream + 1) = (integer) & 0xff; -} - -inline F32 bytestream2float(const U8 *stream, S32 &offset) -{ - S32 value = bytestream2integer(stream, offset); - F32 fpvalue = *(F32 *)&value; - if (!llfinite(fpvalue)) - { - fpvalue = 0; - set_fault(stream, LSRF_MATH); - } - return fpvalue; -} - -inline void float2bytestream(U8 *stream, S32 &offset, F32 floatingpoint) -{ - S32 value = *(S32 *)&floatingpoint; - integer2bytestream(stream, offset, value); -} - -inline void bytestream_int2float(U8 *stream, S32 &offset) -{ - S32 value = bytestream2integer(stream, offset); - offset -= 4; - F32 fpvalue = (F32)value; - if (!llfinite(fpvalue)) - { - fpvalue = 0; - set_fault(stream, LSRF_MATH); - } - float2bytestream(stream, offset, fpvalue); -} - -// Returns true on success, return false and clip copy on buffer overflow -inline bool bytestream2char(char *buffer, const U8 *stream, S32 &offset, S32 buffsize) -{ - S32 source_len = strlen( (const char *)stream+offset ); - S32 copy_len = buffsize - 1; - if( copy_len > source_len ) - { - copy_len = source_len; - } - - // strncpy without \0 padding overhead - memcpy( buffer, stream+offset, copy_len ); - buffer[copy_len] = 0; - - offset += source_len + 1; // advance past source string, include terminating '\0' - - return source_len < buffsize; -} - -inline void char2bytestream(U8 *stream, S32 &offset, const char *buffer) -{ - while ((*(stream + offset++) = *buffer++)) - ; -} - -inline U8 bytestream2byte(const U8 *stream, S32 &offset) -{ - return *(stream + offset++); -} - -inline void byte2bytestream(U8 *stream, S32 &offset, U8 byte) -{ - *(stream + offset++) = byte; -} - -inline void bytestream2bytestream(U8 *dest, S32 &dest_offset, const U8 *src, S32 &src_offset, S32 count) -{ - while (count) - { - (*(dest + dest_offset++)) = (*(src + src_offset++)); - count--; - } -} - -inline void uuid2bytestream(U8 *stream, S32 &offset, const LLUUID &uuid) -{ - S32 i; - for (i = 0; i < UUID_BYTES; i++) - { - *(stream + offset++) = uuid.mData[i]; - } -} - -inline void bytestream2uuid(U8 *stream, S32 &offset, LLUUID &uuid) -{ - S32 i; - for (i = 0; i < UUID_BYTES; i++) - { - uuid.mData[i] = *(stream + offset++); - } -} - -// vectors and quaternions and encoded in backwards order to match the way in which they are stored on the stack -inline void bytestream2vector(LLVector3 &vector, const U8 *stream, S32 &offset) -{ - S32 value = bytestream2integer(stream, offset); - vector.mV[VZ] = *(F32 *)&value; - if (!llfinite(vector.mV[VZ])) - { - vector.mV[VZ] = 0; - set_fault(stream, LSRF_MATH); - } - value = bytestream2integer(stream, offset); - vector.mV[VY] = *(F32 *)&value; - if (!llfinite(vector.mV[VY])) - { - vector.mV[VY] = 0; - set_fault(stream, LSRF_MATH); - } - value = bytestream2integer(stream, offset); - vector.mV[VX] = *(F32 *)&value; - if (!llfinite(vector.mV[VX])) - { - vector.mV[VX] = 0; - set_fault(stream, LSRF_MATH); - } -} - -inline void vector2bytestream(U8 *stream, S32 &offset, const LLVector3 &vector) -{ - S32 value = *(S32 *)&vector.mV[VZ]; - integer2bytestream(stream, offset, value); - value = *(S32 *)&vector.mV[VY]; - integer2bytestream(stream, offset, value); - value = *(S32 *)&vector.mV[VX]; - integer2bytestream(stream, offset, value); -} - -inline void bytestream2quaternion(LLQuaternion &quat, const U8 *stream, S32 &offset) -{ - S32 value = bytestream2integer(stream, offset); - quat.mQ[VS] = *(F32 *)&value; - if (!llfinite(quat.mQ[VS])) - { - quat.mQ[VS] = 0; - set_fault(stream, LSRF_MATH); - } - value = bytestream2integer(stream, offset); - quat.mQ[VZ] = *(F32 *)&value; - if (!llfinite(quat.mQ[VZ])) - { - quat.mQ[VZ] = 0; - set_fault(stream, LSRF_MATH); - } - value = bytestream2integer(stream, offset); - quat.mQ[VY] = *(F32 *)&value; - if (!llfinite(quat.mQ[VY])) - { - quat.mQ[VY] = 0; - set_fault(stream, LSRF_MATH); - } - value = bytestream2integer(stream, offset); - quat.mQ[VX] = *(F32 *)&value; - if (!llfinite(quat.mQ[VX])) - { - quat.mQ[VX] = 0; - set_fault(stream, LSRF_MATH); - } -} - -inline void quaternion2bytestream(U8 *stream, S32 &offset, const LLQuaternion &quat) -{ - S32 value = *(S32 *)&quat.mQ[VS]; - integer2bytestream(stream, offset, value); - value = *(S32 *)&quat.mQ[VZ]; - integer2bytestream(stream, offset, value); - value = *(S32 *)&quat.mQ[VY]; - integer2bytestream(stream, offset, value); - value = *(S32 *)&quat.mQ[VX]; - integer2bytestream(stream, offset, value); -} - -inline S32 get_register(const U8 *stream, LSCRIPTRegisters reg) -{ - S32 offset = gLSCRIPTRegisterAddresses[reg]; - return bytestream2integer(stream, offset); -} - -inline F32 get_register_fp(U8 *stream, LSCRIPTRegisters reg) -{ - S32 offset = gLSCRIPTRegisterAddresses[reg]; - F32 value = bytestream2float(stream, offset); - if (!llfinite(value)) - { - value = 0; - set_fault(stream, LSRF_MATH); - } - return value; -} -inline U64 get_register_u64(U8 *stream, LSCRIPTRegisters reg) -{ - S32 offset = gLSCRIPTRegisterAddresses[reg]; - return bytestream2u64(stream, offset); -} - -inline U64 get_event_register(U8 *stream, LSCRIPTRegisters reg, S32 major_version) -{ - if (major_version == 1) - { - S32 offset = gLSCRIPTRegisterAddresses[reg]; - return (U64)bytestream2integer(stream, offset); - } - else if (major_version == 2) - { - S32 offset = gLSCRIPTRegisterAddresses[reg + (LREG_NCE - LREG_CE)]; - return bytestream2u64(stream, offset); - } - else - { - S32 offset = gLSCRIPTRegisterAddresses[reg]; - return (U64)bytestream2integer(stream, offset); - } -} - -inline void set_register(U8 *stream, LSCRIPTRegisters reg, S32 value) -{ - S32 offset = gLSCRIPTRegisterAddresses[reg]; - integer2bytestream(stream, offset, value); -} - -inline void set_register_fp(U8 *stream, LSCRIPTRegisters reg, F32 value) -{ - S32 offset = gLSCRIPTRegisterAddresses[reg]; - float2bytestream(stream, offset, value); -} - -inline void set_register_u64(U8 *stream, LSCRIPTRegisters reg, U64 value) -{ - S32 offset = gLSCRIPTRegisterAddresses[reg]; - u642bytestream(stream, offset, value); -} - -inline void set_event_register(U8 *stream, LSCRIPTRegisters reg, U64 value, S32 major_version) -{ - if (major_version == 1) - { - S32 offset = gLSCRIPTRegisterAddresses[reg]; - integer2bytestream(stream, offset, (S32)value); - } - else if (major_version == 2) - { - S32 offset = gLSCRIPTRegisterAddresses[reg + (LREG_NCE - LREG_CE)]; - u642bytestream(stream, offset, value); - } - else - { - S32 offset = gLSCRIPTRegisterAddresses[reg]; - integer2bytestream(stream, offset, (S32)value); - } -} - - -inline F32 add_register_fp(U8 *stream, LSCRIPTRegisters reg, F32 value) -{ - S32 offset = gLSCRIPTRegisterAddresses[reg]; - F32 newvalue = bytestream2float(stream, offset); - newvalue += value; - if (!llfinite(newvalue)) - { - newvalue = 0; - set_fault(stream, LSRF_MATH); - } - offset = gLSCRIPTRegisterAddresses[reg]; - float2bytestream(stream, offset, newvalue); - return newvalue; -} - -void lsa_print_heap(U8 *buffer); - - -inline void set_fault(const U8 *stream, LSCRIPTRunTimeFaults fault) -{ - S32 fr = get_register(stream, LREG_FR); - // record the first error - if (!fr) - { - if ( (fault == LSRF_HEAP_ERROR) - ||(fault == LSRF_STACK_HEAP_COLLISION) - ||(fault == LSRF_BOUND_CHECK_ERROR)) - { - reset_hp_to_safe_spot(stream); -// lsa_print_heap((U8 *)stream); - } - fr = fault; - set_register((U8 *)stream, LREG_FR, fr); - } -} - -inline BOOL set_ip(U8 *stream, S32 ip) -{ - // Verify that the Instruction Pointer is in a valid - // code area (between the Global Function Register - // and Heap Register). - S32 gfr = get_register(stream, LREG_GFR); - if (ip == 0) - { - set_register(stream, LREG_IP, ip); - return TRUE; - } - if (ip < gfr) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - S32 hr = get_register(stream, LREG_HR); - if (ip >= hr) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - set_register(stream, LREG_IP, ip); - return TRUE; -} - -inline BOOL set_bp(U8 *stream, S32 bp) -{ - // Verify that the Base Pointer is in a valid - // data area (between the Heap Pointer and - // the Top of Memory, and below the - // Stack Pointer). - S32 hp = get_register(stream, LREG_HP); - if (bp <= hp) - { - set_fault(stream, LSRF_STACK_HEAP_COLLISION); - return FALSE; - } - S32 tm = get_register(stream, LREG_TM); - if (bp >= tm) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - S32 sp = get_register(stream, LREG_SP); - if (bp < sp) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - set_register(stream, LREG_BP, bp); - return TRUE; -} - -inline BOOL set_sp(U8 *stream, S32 sp) -{ - // Verify that the Stack Pointer is in a valid - // data area (between the Heap Pointer and - // the Top of Memory). - S32 hp = get_register(stream, LREG_HP); - if (sp <= hp) - { - set_fault(stream, LSRF_STACK_HEAP_COLLISION); - return FALSE; - } - S32 tm = get_register(stream, LREG_TM); - if (sp >= tm) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - set_register(stream, LREG_SP, sp); - return TRUE; -} - -inline void lscript_push(U8 *stream, U8 value) -{ - S32 sp = get_register(stream, LREG_SP); - sp -= 1; - - if (set_sp(stream, sp)) - { - *(stream + sp) = value; - } -} - -inline void lscript_push(U8 *stream, S32 value) -{ - S32 sp = get_register(stream, LREG_SP); - sp -= LSCRIPTDataSize[LST_INTEGER]; - - if (set_sp(stream, sp)) - { - integer2bytestream(stream, sp, value); - } -} - -inline void lscript_push(U8 *stream, F32 value) -{ - S32 sp = get_register(stream, LREG_SP); - sp -= LSCRIPTDataSize[LST_FLOATINGPOINT]; - - if (set_sp(stream, sp)) - { - float2bytestream(stream, sp, value); - } -} - -inline void lscript_push(U8 *stream, const LLVector3 &value) -{ - S32 sp = get_register(stream, LREG_SP); - sp -= LSCRIPTDataSize[LST_VECTOR]; - - if (set_sp(stream, sp)) - { - vector2bytestream(stream, sp, value); - } -} - -inline void lscript_push(U8 *stream, const LLQuaternion &value) -{ - S32 sp = get_register(stream, LREG_SP); - sp -= LSCRIPTDataSize[LST_QUATERNION]; - - if (set_sp(stream, sp)) - { - quaternion2bytestream(stream, sp, value); - } -} - -inline void lscript_pusharg(U8 *stream, S32 arg) -{ - S32 sp = get_register(stream, LREG_SP); - sp -= arg; - - set_sp(stream, sp); -} - -inline void lscript_poparg(U8 *stream, S32 arg) -{ - S32 sp = get_register(stream, LREG_SP); - sp += arg; - - set_sp(stream, sp); -} - -inline U8 lscript_pop_char(U8 *stream) -{ - S32 sp = get_register(stream, LREG_SP); - U8 value = *(stream + sp++); - set_sp(stream, sp); - return value; -} - -inline S32 lscript_pop_int(U8 *stream) -{ - S32 sp = get_register(stream, LREG_SP); - S32 value = bytestream2integer(stream, sp); - set_sp(stream, sp); - return value; -} - -inline F32 lscript_pop_float(U8 *stream) -{ - S32 sp = get_register(stream, LREG_SP); - F32 value = bytestream2float(stream, sp); - if (!llfinite(value)) - { - value = 0; - set_fault(stream, LSRF_MATH); - } - set_sp(stream, sp); - return value; -} - -inline void lscript_pop_vector(U8 *stream, LLVector3 &value) -{ - S32 sp = get_register(stream, LREG_SP); - bytestream2vector(value, stream, sp); - set_sp(stream, sp); -} - -inline void lscript_pop_quaternion(U8 *stream, LLQuaternion &value) -{ - S32 sp = get_register(stream, LREG_SP); - bytestream2quaternion(value, stream, sp); - set_sp(stream, sp); -} - -inline void lscript_pusharge(U8 *stream, S32 value) -{ - S32 sp = get_register(stream, LREG_SP); - sp -= value; - if (set_sp(stream, sp)) - { - S32 i; - for (i = 0; i < value; i++) - { - *(stream + sp++) = 0; - } - } -} - -inline BOOL lscript_check_local(U8 *stream, S32 &address, S32 size) -{ - S32 sp = get_register(stream, LREG_SP); - S32 bp = get_register(stream, LREG_BP); - - address += size; - address = bp - address; - - if (address < sp - size) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - S32 tm = get_register(stream, LREG_TM); - if (address + size > tm) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - return TRUE; -} - -inline BOOL lscript_check_global(U8 *stream, S32 &address, S32 size) -{ - S32 gvr = get_register(stream, LREG_GVR); - - // Possibility of overwriting registers? -- DK 09/07/04 - if (address < 0) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - - address += gvr; - S32 gfr = get_register(stream, LREG_GFR); - - if (address + size > gfr) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - return TRUE; -} - -inline void lscript_local_store(U8 *stream, S32 address, S32 value) -{ - if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_INTEGER])) - integer2bytestream(stream, address, value); -} - -inline void lscript_local_store(U8 *stream, S32 address, F32 value) -{ - if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT])) - float2bytestream(stream, address, 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, const LLQuaternion value) -{ - if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_QUATERNION])) - quaternion2bytestream(stream, address, value); -} - -inline void lscript_global_store(U8 *stream, S32 address, S32 value) -{ - if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_INTEGER])) - integer2bytestream(stream, address, value); -} - -inline void lscript_global_store(U8 *stream, S32 address, F32 value) -{ - if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT])) - float2bytestream(stream, address, 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, const LLQuaternion value) -{ - if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_QUATERNION])) - quaternion2bytestream(stream, address, value); -} - -inline S32 lscript_local_get(U8 *stream, S32 address) -{ - if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_INTEGER])) - return bytestream2integer(stream, address); - return 0; -} - -inline void lscript_local_get(U8 *stream, S32 address, F32 &value) -{ - if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT])) - value = bytestream2float(stream, address); - if (!llfinite(value)) - { - value = 0; - set_fault(stream, LSRF_MATH); - } -} - -inline void lscript_local_get(U8 *stream, S32 address, LLVector3 &value) -{ - if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_VECTOR])) - bytestream2vector(value, stream, address); -} - -inline void lscript_local_get(U8 *stream, S32 address, LLQuaternion &value) -{ - if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_QUATERNION])) - bytestream2quaternion(value, stream, address); -} - -inline S32 lscript_global_get(U8 *stream, S32 address) -{ - if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_INTEGER])) - return bytestream2integer(stream, address); - return 0; -} - -inline void lscript_global_get(U8 *stream, S32 address, F32 &value) -{ - if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_FLOATINGPOINT])) - value = bytestream2float(stream, address); - if (!llfinite(value)) - { - value = 0; - set_fault(stream, LSRF_MATH); - } -} - -inline void lscript_global_get(U8 *stream, S32 address, LLVector3 &value) -{ - if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_VECTOR])) - bytestream2vector(value, stream, address); -} - -inline void lscript_global_get(U8 *stream, S32 address, LLQuaternion &value) -{ - if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_QUATERNION])) - bytestream2quaternion(value, stream, address); -} - - - -inline S32 get_state_event_opcoode_start(U8 *stream, S32 state, LSCRIPTStateEventType event) -{ - // get the start of the state table - S32 sr = get_register(stream, LREG_SR); - - // get the position of the jump to the desired state - S32 value = get_register(stream, LREG_VN); - - S32 state_offset_offset = 0; - S32 major_version = 0; - if (value == LSL2_VERSION1_END_NUMBER) - { - major_version = LSL2_MAJOR_VERSION_ONE; - state_offset_offset = sr + LSCRIPTDataSize[LST_INTEGER] + LSCRIPTDataSize[LST_INTEGER]*2*state; - } - else if (value == LSL2_VERSION_NUMBER) - { - major_version = LSL2_MAJOR_VERSION_TWO; - state_offset_offset = sr + LSCRIPTDataSize[LST_INTEGER] + LSCRIPTDataSize[LST_INTEGER]*3*state; - } - if ( state_offset_offset < 0 || state_offset_offset > TOP_OF_MEMORY ) - { - return -1; - } - - // get the actual position in memory of the desired state - S32 state_offset = sr + bytestream2integer(stream, state_offset_offset); - if ( state_offset < 0 || state_offset > TOP_OF_MEMORY ) - { - return -1; - } - - // save that value - S32 state_offset_base = state_offset; - - // jump past the state name - S32 event_jump_offset = state_offset_base + bytestream2integer(stream, state_offset); - - // get the location of the event offset - S32 event_offset = event_jump_offset + LSCRIPTDataSize[LST_INTEGER]*2*get_event_handler_jump_position(get_event_register(stream, LREG_ER, major_version), event); - if ( event_offset < 0 || event_offset > TOP_OF_MEMORY ) - { - return -1; - } - - // now, jump to the event - S32 event_start = bytestream2integer(stream, event_offset); - if ( event_start < 0 || event_start > TOP_OF_MEMORY ) - { - return -1; - } - event_start += event_jump_offset; - - S32 event_start_original = event_start; - - // now skip past the parameters - S32 opcode_offset = bytestream2integer(stream, event_start); - if ( opcode_offset < 0 || opcode_offset > TOP_OF_MEMORY ) - { - return -1; - } - - return opcode_offset + event_start_original; -} - - -inline U64 get_handled_events(U8 *stream, S32 state) -{ - U64 retvalue = 0; - // get the start of the state table - S32 sr = get_register(stream, LREG_SR); - - // get the position of the jump to the desired state - S32 value = get_register(stream, LREG_VN); - S32 state_handled_offset = 0; - if (value == LSL2_VERSION1_END_NUMBER) - { - state_handled_offset = sr + LSCRIPTDataSize[LST_INTEGER]*2*state + 2*LSCRIPTDataSize[LST_INTEGER]; - retvalue = bytestream2integer(stream, state_handled_offset); - } - else if (value == LSL2_VERSION_NUMBER) - { - state_handled_offset = sr + LSCRIPTDataSize[LST_INTEGER]*3*state + 2*LSCRIPTDataSize[LST_INTEGER]; - retvalue = bytestream2u64(stream, state_handled_offset); - } - - // get the handled events - return retvalue; -} - -// Returns -1 on error -inline S32 get_event_stack_size(U8 *stream, S32 state, LSCRIPTStateEventType event) -{ - // get the start of the state table - S32 sr = get_register(stream, LREG_SR); - - // get state offset - S32 value = get_register(stream, LREG_VN); - S32 state_offset_offset = 0; - S32 major_version = 0; - if (value == LSL2_VERSION1_END_NUMBER) - { - major_version = LSL2_MAJOR_VERSION_ONE; - state_offset_offset = sr + LSCRIPTDataSize[LST_INTEGER] + LSCRIPTDataSize[LST_INTEGER]*2*state; - } - else if (value == LSL2_VERSION_NUMBER) - { - major_version = LSL2_MAJOR_VERSION_TWO; - state_offset_offset = sr + LSCRIPTDataSize[LST_INTEGER] + LSCRIPTDataSize[LST_INTEGER]*3*state; - } - - if ( state_offset_offset < 0 || state_offset_offset > TOP_OF_MEMORY ) - { - return -1; - } - - S32 state_offset = bytestream2integer(stream, state_offset_offset); - state_offset += sr; - - state_offset_offset = state_offset; - if ( state_offset_offset < 0 || state_offset_offset > TOP_OF_MEMORY ) - { - return -1; - } - - // skip to jump table - S32 jump_table = bytestream2integer(stream, state_offset_offset); - - jump_table += state_offset; - if ( jump_table < 0 || jump_table > TOP_OF_MEMORY ) - { - return -1; - } - - // get the position of the jump to the desired state - S32 stack_size_offset = jump_table + LSCRIPTDataSize[LST_INTEGER]*2*get_event_handler_jump_position(get_event_register(stream, LREG_ER, major_version), event) + LSCRIPTDataSize[LST_INTEGER]; - - // get the handled events - S32 stack_size = bytestream2integer(stream, stack_size_offset); - if ( stack_size < 0 || stack_size > TOP_OF_MEMORY ) - { - return -1; - } - - return stack_size; -} - -inline LSCRIPTStateEventType return_first_event(S32 event) -{ - S32 count = 1; - while (count < LSTT_EOF) - { - if (event & 0x1) - { - return (LSCRIPTStateEventType) count; - } - else - { - event >>= 1; - count++; - } - } - return LSTT_NULL; -} - - -// the safe instruction versions of these commands will only work if offset is between -// GFR and HR, meaning that it is an instruction (more or less) in global functions or event handlers - -inline BOOL safe_instruction_check_address(U8 *stream, S32 offset, S32 size) -{ - S32 gfr = get_register(stream, LREG_GFR); - if (offset < gfr) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - else - { - S32 hr = get_register(stream, LREG_HR); - if (offset + size > hr) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - else - { - return TRUE; - } - } -} - -inline BOOL safe_heap_check_address(U8 *stream, S32 offset, S32 size) -{ - S32 hr = get_register(stream, LREG_HR); - if (offset < hr) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - else - { - S32 hp = get_register(stream, LREG_HP); - if (offset + size > hp) - { - set_fault(stream, LSRF_BOUND_CHECK_ERROR); - return FALSE; - } - else - { - return TRUE; - } - } -} - -inline U8 safe_instruction_bytestream2byte(U8 *stream, S32 &offset) -{ - if (safe_instruction_check_address(stream, offset, 1)) - { - return *(stream + offset++); - } - else - { - return 0; - } -} - -inline void safe_instruction_byte2bytestream(U8 *stream, S32 &offset, U8 byte) -{ - if (safe_instruction_check_address(stream, offset, 1)) - { - *(stream + offset++) = byte; - } -} - -inline S32 safe_instruction_bytestream2integer(U8 *stream, S32 &offset) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_INTEGER])) - { - return (bytestream2integer(stream, offset)); - } - else - { - return 0; - } -} - -inline void safe_instruction_integer2bytestream(U8 *stream, S32 &offset, S32 value) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_INTEGER])) - { - integer2bytestream(stream, offset, value); - } -} - -inline U16 safe_instruction_bytestream2u16(U8 *stream, S32 &offset) -{ - if (safe_instruction_check_address(stream, offset, 2)) - { - return (bytestream2u16(stream, offset)); - } - else - { - return 0; - } -} - -inline void safe_instruction_u162bytestream(U8 *stream, S32 &offset, U16 value) -{ - if (safe_instruction_check_address(stream, offset, 2)) - { - u162bytestream(stream, offset, value); - } -} - -inline F32 safe_instruction_bytestream2float(U8 *stream, S32 &offset) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_INTEGER])) - { - F32 value = bytestream2float(stream, offset); - if (!llfinite(value)) - { - value = 0; - set_fault(stream, LSRF_MATH); - } - return value; - } - else - { - return 0; - } -} - -inline void safe_instruction_float2bytestream(U8 *stream, S32 &offset, F32 value) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_FLOATINGPOINT])) - { - float2bytestream(stream, offset, value); - } -} - -inline void safe_instruction_bytestream2char(char *buffer, U8 *stream, S32 &offset, S32 buffsize) -{ - // This varies from the old method. Previously, we would copy up until we got an error, - // then halt the script via safe_isntruction_check_address. Now we don't bother - // copying a thing if there's an error. - - if( safe_instruction_check_address(stream, offset, strlen( (const char *)stream + offset ) + 1 ) ) - { - // Takes the same parms as this function. Won't overread, per above check. - bytestream2char( buffer, stream, offset, buffsize ); - } - else - { - // Truncate - no point in copying - *buffer = 0; - } -} - -inline void safe_instruction_bytestream_count_char(U8 *stream, S32 &offset) -{ - while ( (safe_instruction_check_address(stream, offset, 1)) - &&(*(stream + offset++))) - ; -} - -inline void safe_heap_bytestream_count_char(U8 *stream, S32 &offset) -{ - while ( (safe_heap_check_address(stream, offset, 1)) - &&(*(stream + offset++))) - ; -} - -inline void safe_instruction_char2bytestream(U8 *stream, S32 &offset, const char* buffer) -{ - while ( (safe_instruction_check_address(stream, offset, 1)) - &&(*(stream + offset++) = *buffer++)) - ; -} - -inline void safe_instruction_bytestream2vector(LLVector3 &value, U8 *stream, S32 &offset) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_VECTOR])) - { - bytestream2vector(value, stream, offset); - } -} - -inline void safe_instruction_vector2bytestream(U8 *stream, S32 &offset, const LLVector3 &value) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_VECTOR])) - { - vector2bytestream(stream, offset, value); - } -} - -inline void safe_instruction_bytestream2quaternion(LLQuaternion &value, U8 *stream, S32 &offset) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_QUATERNION])) - { - bytestream2quaternion(value, stream, offset); - } -} - -inline void safe_instruction_quaternion2bytestream(U8 *stream, S32 &offset, const LLQuaternion &value) -{ - if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_QUATERNION])) - { - quaternion2bytestream(stream, offset, value); - } -} - -static inline LSCRIPTType char2type(char type) -{ - switch(type) - { - case 'i': - return LST_INTEGER; - case 'f': - return LST_FLOATINGPOINT; - case 's': - return LST_STRING; - case 'k': - return LST_KEY; - case 'v': - return LST_VECTOR; - case 'q': - return LST_QUATERNION; - case 'l': - return LST_LIST; - default: - return LST_NULL; - } -} - -#endif diff --git a/indra/lscript/lscript_byteformat.h b/indra/lscript/lscript_byteformat.h deleted file mode 100755 index 54031aaf05..0000000000 --- a/indra/lscript/lscript_byteformat.h +++ /dev/null @@ -1,566 +0,0 @@ -/** - * @file lscript_byteformat.h - * @brief Shared code between compiler and assembler and LSL - * - * $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$ - */ - -#ifndef LL_LSCRIPT_BYTEFORMAT_H -#define LL_LSCRIPT_BYTEFORMAT_H - -// Data shared between compiler/assembler and lscript execution code - -#include "stdtypes.h" - -const S32 LSL2_VERSION_NUMBER = 0x0200; -const S32 LSL2_VERSION1_END_NUMBER = 0x0101; -const S32 LSL2_VERSION2_START_NUMBER = 0x0200; - -const S32 LSL2_MAJOR_VERSION_ONE = 1; -const S32 LSL2_MAJOR_VERSION_TWO = 2; -const S32 LSL2_CURRENT_MAJOR_VERSION = LSL2_MAJOR_VERSION_TWO; - -const S32 TOP_OF_MEMORY = 16384; - -typedef enum e_lscript_registers -{ - LREG_INVALID, - LREG_IP, // instruction pointer - LREG_VN, // version number - LREG_BP, // base pointer - what local variables are referenced from - LREG_SP, // stack pointer - where the top of the stack is - LREG_HR, // heap register - where in memory does the heap start - LREG_HP, // heap pointer - where is the top of the heap? - LREG_CS, // current state - what state are we currently in? - LREG_NS, // next state - what state are we currently in? - LREG_CE, // current events - what events are waiting to be handled? - LREG_IE, // in event - which event handler are we currently in? - LREG_ER, // event register - what events do we have active handlers for? - LREG_FR, // fault register - which errors are currently active? - LREG_SLR, // sleep register - are we sleeping? - LREG_GVR, // global variable register - where do global variables start - LREG_GFR, // global function register - where do global functions start - LREG_SR, // state register - where do states start - LREG_TM, // top of memory - where is the top of memory - LREG_PR, // parameter register - data passed to script from launcher - LREG_ESR, // energy supply register - how much energy do we have on board? - LREG_NCE, // 64 bit current envents - what events are waiting to be handled? - LREG_NIE, // 64 bit in event - which event handler are we currently in? - LREG_NER, // 64 bit event register - what events do we have active handlers for? - LREG_EOF -} LSCRIPTRegisters; - -const S32 gLSCRIPTRegisterAddresses[LREG_EOF] = /* Flawfinder: ignore */ -{ - 0, // LREG_INVALID - 4, // LREG_IP - 8, // LREG_VN - 12, // LREG_BP - 16, // LREG_SP - 20, // LREG_HR - 24, // LREG_HP - 28, // LREG_CS - 32, // LREG_NS - 36, // LREG_CE - 40, // LREG_IE - 44, // LREG_ER - 48, // LREG_FR - 52, // LREG_SLR - 56, // LREG_GVR - 60, // LREG_GFR - 72, // LREG_SR - 0, // LREG_TM - 64, // LREG_PR - 68, // LREG_ESR - 76, // LREG_NCE - 84, // LREG_NIE - 92, // LREG_NER -}; - -const char * const gLSCRIPTRegisterNames[LREG_EOF] = -{ - "INVALID", // LREG_INVALID - "IP", // LREG_IP - "VN", // LREG_VN - "BP", // LREG_BP - "SP", // LREG_SP - "HR", // LREG_HR - "HP", // LREG_HP - "CS", // LREG_CS - "NS", // LREG_NS - "CE", // LREG_CE - "IE", // LREG_IE - "ER", // LREG_ER - "FR", // LREG_FR - "SLR", // LREG_SLR - "GVR", // LREG_GVR - "GFR", // LREG_GFR - "SR", // LREG_SR - "TM", // LREG_TM - "PR", // LREG_PR - "ESR", // LREG_ESR - "NCE", // LREG_NCE - "NIE", // LREG_NIE - "NER", // LREG_NER -}; - -typedef enum e_lscript_op_codes -{ - LOPC_INVALID, - LOPC_NOOP, - LOPC_POP, - LOPC_POPS, - LOPC_POPL, - LOPC_POPV, - LOPC_POPQ, - LOPC_POPARG, - LOPC_POPIP, - LOPC_POPBP, - LOPC_POPSP, - LOPC_POPSLR, - LOPC_DUP, - LOPC_DUPS, - LOPC_DUPL, - LOPC_DUPV, - LOPC_DUPQ, - LOPC_STORE, - LOPC_STORES, - LOPC_STOREL, - LOPC_STOREV, - LOPC_STOREQ, - LOPC_STOREG, - LOPC_STOREGS, - LOPC_STOREGL, - LOPC_STOREGV, - LOPC_STOREGQ, - LOPC_LOADP, - LOPC_LOADSP, - LOPC_LOADLP, - LOPC_LOADVP, - LOPC_LOADQP, - LOPC_LOADGP, - LOPC_LOADGLP, - LOPC_LOADGSP, - LOPC_LOADGVP, - LOPC_LOADGQP, - LOPC_PUSH, - LOPC_PUSHS, - LOPC_PUSHL, - LOPC_PUSHV, - LOPC_PUSHQ, - LOPC_PUSHG, - LOPC_PUSHGS, - LOPC_PUSHGL, - LOPC_PUSHGV, - LOPC_PUSHGQ, - LOPC_PUSHIP, - LOPC_PUSHBP, - LOPC_PUSHSP, - LOPC_PUSHARGB, - LOPC_PUSHARGI, - LOPC_PUSHARGF, - LOPC_PUSHARGS, - LOPC_PUSHARGV, - LOPC_PUSHARGQ, - LOPC_PUSHE, - LOPC_PUSHEV, - LOPC_PUSHEQ, - LOPC_PUSHARGE, - LOPC_ADD, - LOPC_SUB, - LOPC_MUL, - LOPC_DIV, - LOPC_MOD, - LOPC_EQ, - LOPC_NEQ, - LOPC_LEQ, - LOPC_GEQ, - LOPC_LESS, - LOPC_GREATER, - LOPC_BITAND, - LOPC_BITOR, - LOPC_BITXOR, - LOPC_BOOLAND, - LOPC_BOOLOR, - LOPC_NEG, - LOPC_BITNOT, - LOPC_BOOLNOT, - LOPC_JUMP, - LOPC_JUMPIF, - LOPC_JUMPNIF, - LOPC_STATE, - LOPC_CALL, - LOPC_RETURN, - LOPC_CAST, - LOPC_STACKTOS, - LOPC_STACKTOL, - LOPC_PRINT, - LOPC_CALLLIB, - LOPC_CALLLIB_TWO_BYTE, - LOPC_SHL, - LOPC_SHR, - LOPC_EOF -} LSCRIPTOpCodesEnum; - -const U8 LSCRIPTOpCodes[LOPC_EOF] = -{ - 0x00, // LOPC_INVALID - 0x00, // LOPC_NOOP - 0x01, // LOPC_POP - 0x02, // LOPC_POPS - 0x03, // LOPC_POPL - 0x04, // LOPC_POPV - 0x05, // LOPC_POPQ - 0x06, // LOPC_POPARG - 0x07, // LOPC_POPIP - 0x08, // LOPC_POPBP - 0x09, // LOPC_POPSP - 0x0a, // LOPC_POPSLR - 0x20, // LOPC_DUP - 0x21, // LOPC_DUPS - 0x22, // LOPC_DUPL - 0x23, // LOPC_DUPV - 0x24, // LOPC_DUPQ - 0x30, // LOPC_STORE - 0x31, // LOPC_STORES - 0x32, // LOPC_STOREL - 0x33, // LOPC_STOREV - 0x34, // LOPC_STOREQ - 0x35, // LOPC_STOREG - 0x36, // LOPC_STOREGS - 0x37, // LOPC_STOREGL - 0x38, // LOPC_STOREGV - 0x39, // LOPC_STOREGQ - 0x3a, // LOPC_LOADP - 0x3b, // LOPC_LOADSP - 0x3c, // LOPC_LOADLP - 0x3d, // LOPC_LOADVP - 0x3e, // LOPC_LOADQP - 0x3f, // LOPC_LOADGP - 0x40, // LOPC_LOADGSP - 0x41, // LOPC_LOADGLP - 0x42, // LOPC_LOADGVP - 0x43, // LOPC_LOADGQP - 0x50, // LOPC_PUSH - 0x51, // LOPC_PUSHS - 0x52, // LOPC_PUSHL - 0x53, // LOPC_PUSHV - 0x54, // LOPC_PUSHQ - 0x55, // LOPC_PUSHG - 0x56, // LOPC_PUSHGS - 0x57, // LOPC_PUSHGL - 0x58, // LOPC_PUSHGV - 0x59, // LOPC_PUSHGQ - 0x5a, // LOPC_PUSHIP - 0x5b, // LOPC_PUSHBP - 0x5c, // LOPC_PUSHSP - 0x5d, // LOPC_PUSHARGB - 0x5e, // LOPC_PUSHARGI - 0x5f, // LOPC_PUSHARGF - 0x60, // LOPC_PUSHARGS - 0x61, // LOPC_PUSHARGV - 0x62, // LOPC_PUSHARGQ - 0x63, // LOPC_PUSHE - 0x64, // LOPC_PUSHEV - 0x65, // LOPC_PUSHEQ - 0x66, // LOPC_PUSHARGE - 0x70, // LOPC_ADD - 0x71, // LOPC_SUB - 0x72, // LOPC_MUL - 0x73, // LOPC_DIV - 0x74, // LOPC_MOD - 0x75, // LOPC_EQ - 0x76, // LOPC_NEQ - 0x77, // LOPC_LEQ - 0x78, // LOPC_GEQ - 0x79, // LOPC_LESS - 0x7a, // LOPC_GREATER - 0x7b, // LOPC_BITAND - 0x7c, // LOPC_BITOR - 0x7d, // LOPC_BITXOR - 0x7e, // LOPC_BOOLAND - 0x7f, // LOPC_BOOLOR - 0x80, // LOPC_NEG - 0x81, // LOPC_BITNOT - 0x82, // LOPC_BOOLNOT - 0x90, // LOPC_JUMP - 0x91, // LOPC_JUMPIF - 0x92, // LOPC_JUMPNIF - 0x93, // LOPC_STATE - 0x94, // LOPC_CALL - 0x95, // LOPC_RETURN - 0xa0, // LOPC_CAST - 0xb0, // LOPC_STACKTOS - 0xb1, // LOPC_STACKTOL - 0xc0, // LOPC_PRINT - 0xd0, // LOPC_CALLLIB - 0xd1, // LOPC_CALLLIB_TWO_BYTE - 0xe0, // LOPC_SHL - 0xe1 // LOPC_SHR -}; - -typedef enum e_lscript_state_event_type -{ - LSTT_NULL, - LSTT_STATE_ENTRY, - LSTT_STATE_EXIT, - LSTT_TOUCH_START, - LSTT_TOUCH, - LSTT_TOUCH_END, - LSTT_COLLISION_START, - LSTT_COLLISION, - LSTT_COLLISION_END, - LSTT_LAND_COLLISION_START, - LSTT_LAND_COLLISION, - LSTT_LAND_COLLISION_END, - LSTT_TIMER, - LSTT_CHAT, - LSTT_REZ, - LSTT_SENSOR, - LSTT_NO_SENSOR, - LSTT_CONTROL, - LSTT_MONEY, - LSTT_EMAIL, - LSTT_AT_TARGET, - LSTT_NOT_AT_TARGET, - LSTT_AT_ROT_TARGET, - LSTT_NOT_AT_ROT_TARGET, - LSTT_RTPERMISSIONS, - LSTT_INVENTORY, - LSTT_ATTACH, - LSTT_DATASERVER, - LSTT_LINK_MESSAGE, - LSTT_MOVING_START, - LSTT_MOVING_END, - LSTT_OBJECT_REZ, - LSTT_REMOTE_DATA, - LSTT_HTTP_RESPONSE, - LSTT_HTTP_REQUEST, - LSTT_EOF, - - LSTT_STATE_BEGIN = LSTT_STATE_ENTRY, - LSTT_STATE_END = LSTT_EOF -} LSCRIPTStateEventType; - -const U64 LSCRIPTStateBitField[LSTT_EOF] = -{ - 0x0000000000000000, // LSTT_NULL - 0x0000000000000001, // LSTT_STATE_ENTRY - 0x0000000000000002, // LSTT_STATE_EXIT - 0x0000000000000004, // LSTT_TOUCH_START - 0x0000000000000008, // LSTT_TOUCH - 0x0000000000000010, // LSTT_TOUCH_END - 0x0000000000000020, // LSTT_COLLISION_START - 0x0000000000000040, // LSTT_COLLISION - 0x0000000000000080, // LSTT_COLLISION_END - 0x0000000000000100, // LSTT_LAND_COLLISION_START - 0x0000000000000200, // LSTT_LAND_COLLISION - 0x0000000000000400, // LSTT_LAND_COLLISION_END - 0x0000000000000800, // LSTT_TIMER - 0x0000000000001000, // LSTT_CHAT - 0x0000000000002000, // LSTT_REZ - 0x0000000000004000, // LSTT_SENSOR - 0x0000000000008000, // LSTT_NO_SENSOR - 0x0000000000010000, // LSTT_CONTROL - 0x0000000000020000, // LSTT_MONEY - 0x0000000000040000, // LSTT_EMAIL - 0x0000000000080000, // LSTT_AT_TARGET - 0x0000000000100000, // LSTT_NOT_AT_TARGET - 0x0000000000200000, // LSTT_AT_ROT_TARGET - 0x0000000000400000, // LSTT_NOT_AT_ROT_TARGET - 0x0000000000800000, // LSTT_RTPERMISSIONS - 0x0000000001000000, // LSTT_INVENTORY - 0x0000000002000000, // LSTT_ATTACH - 0x0000000004000000, // LSTT_DATASERVER - 0x0000000008000000, // LSTT_LINK_MESSAGE - 0x0000000010000000, // LSTT_MOVING_START - 0x0000000020000000, // LSTT_MOVING_END - 0x0000000040000000, // LSTT_OBJECT_REZ - 0x0000000080000000, // LSTT_REMOTE_DATA - 0x0000000100000000LL, // LSTT_HTTP_RESPOSE - 0x0000000200000000LL // LSTT_HTTP_REQUEST -}; - -inline S32 get_event_handler_jump_position(U64 bit_field, LSCRIPTStateEventType type) -{ - S32 count = 0, position = LSTT_STATE_ENTRY; - while (position < type) - { - if (bit_field & 0x1) - { - count++; - } - bit_field >>= 1; - position++; - } - return count; -} - -inline S32 get_number_of_event_handlers(U64 bit_field) -{ - S32 count = 0, position = 0; - while (position < LSTT_EOF) - { - if (bit_field & 0x1) - { - count++; - } - bit_field >>= 1; - position++; - } - return count; -} - -typedef enum e_lscript_types -{ - LST_NULL, - LST_INTEGER, - LST_FLOATINGPOINT, - LST_STRING, - LST_KEY, - LST_VECTOR, - LST_QUATERNION, - LST_LIST, - LST_UNDEFINED, - LST_EOF -} LSCRIPTType; - -const U8 LSCRIPTTypeByte[LST_EOF] = -{ - LST_NULL, - LST_INTEGER, - LST_FLOATINGPOINT, - LST_STRING, - LST_KEY, - LST_VECTOR, - LST_QUATERNION, - LST_LIST, - LST_NULL, -}; - -const U8 LSCRIPTTypeHi4Bits[LST_EOF] = -{ - LST_NULL, - LST_INTEGER << 4, - LST_FLOATINGPOINT << 4, - LST_STRING << 4, - LST_KEY << 4, - LST_VECTOR << 4, - LST_QUATERNION << 4, - LST_LIST << 4, - LST_UNDEFINED << 4, -}; - -const char * const LSCRIPTTypeNames[LST_EOF] = /*Flawfinder: ignore*/ -{ - "VOID", - "integer", - "float", - "string", - "key", - "vector", - "quaternion", - "list", - "invalid" -}; - -const S32 LSCRIPTDataSize[LST_EOF] = -{ - 0, // VOID - 4, // integer - 4, // float - 4, // string - 4, // key - 12, // vector - 16, // quaternion - 4, // list - 0 // invalid -}; - - -typedef enum e_lscript_runtime_faults -{ - LSRF_INVALID, - LSRF_MATH, - LSRF_STACK_HEAP_COLLISION, - LSRF_BOUND_CHECK_ERROR, - LSRF_HEAP_ERROR, - LSRF_VERSION_MISMATCH, - LSRF_MISSING_INVENTORY, - LSRF_SANDBOX, - LSRF_CHAT_OVERRUN, - LSRF_TOO_MANY_LISTENS, - LSRF_NESTING_LISTS, - LSRF_CLI, - LSRF_EOF -} LSCRIPTRunTimeFaults; - -extern const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF]; /*Flawfinder: ignore*/ - -typedef enum e_lscript_runtime_permissions -{ - SCRIPT_PERMISSION_DEBIT, - SCRIPT_PERMISSION_TAKE_CONTROLS, - SCRIPT_PERMISSION_REMAP_CONTROLS, - SCRIPT_PERMISSION_TRIGGER_ANIMATION, - SCRIPT_PERMISSION_ATTACH, - SCRIPT_PERMISSION_RELEASE_OWNERSHIP, - SCRIPT_PERMISSION_CHANGE_LINKS, - SCRIPT_PERMISSION_CHANGE_JOINTS, - SCRIPT_PERMISSION_CHANGE_PERMISSIONS, - SCRIPT_PERMISSION_TRACK_CAMERA, - SCRIPT_PERMISSION_CONTROL_CAMERA, - SCRIPT_PERMISSION_TELEPORT, - SCRIPT_PERMISSION_EXPERIENCE, - SCRIPT_PERMISSION_SILENT_ESTATE_MANAGEMENT, - SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS, - SCRIPT_PERMISSION_RETURN_OBJECTS, - SCRIPT_PERMISSION_EOF -} LSCRIPTRunTimePermissions; - -const U32 LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_EOF] = -{ - (0x1 << 1), // SCRIPT_PERMISSION_DEBIT, - (0x1 << 2), // SCRIPT_PERMISSION_TAKE_CONTROLS, - (0x1 << 3), // SCRIPT_PERMISSION_REMAP_CONTROLS, - (0x1 << 4), // SCRIPT_PERMISSION_TRIGGER_ANIMATION, - (0x1 << 5), // SCRIPT_PERMISSION_ATTACH, - (0x1 << 6), // SCRIPT_PERMISSION_RELEASE_OWNERSHIP, - (0x1 << 7), // SCRIPT_PERMISSION_CHANGE_LINKS, - (0x1 << 8), // SCRIPT_PERMISSION_CHANGE_JOINTS, - (0x1 << 9), // SCRIPT_PERMISSION_CHANGE_PERMISSIONS - (0x1 << 10),// SCRIPT_PERMISSION_TRACK_CAMERA - (0x1 << 11),// SCRIPT_PERMISSION_CONTROL_CAMERA - (0x1 << 12),// SCRIPT_PERMISSION_TELEPORT - (0x1 << 13),// SCRIPT_PERMISSION_EXPERIENCE, - (0x1 << 14),// SCRIPT_PERMISSION_SILENT_ESTATE_MANAGEMENT, - (0x1 << 15),// SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS, - (0x1 << 16),// SCRIPT_PERMISSION_RETURN_OBJECTS, -}; - -// 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 deleted file mode 100755 index 07662005b9..0000000000 --- a/indra/lscript/lscript_compile/CMakeLists.txt +++ /dev/null @@ -1,157 +0,0 @@ -# -*- 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} - ) -include_directories(SYSTEM - ${LLCOMMON_SYSTEM_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 - -P indra_ - -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 - ARGS - ${BISON} ${M4_PATH} - -p indra_ - -d -o ${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 - -p indra_ - -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 deleted file mode 100644 index d40997225e..0000000000 --- a/indra/lscript/lscript_compile/bison.bat +++ /dev/null @@ -1,12 +0,0 @@ -@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 -shift -set M4PATH=%1 -shift -set M4= - -set PATH=%M4PATH%;%PATH% -@REM %* does not work with shift... -%bison% %1 %2 %3 %4 %5 %6 %7 %8 %9 diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l deleted file mode 100755 index 7772c95609..0000000000 --- a/indra/lscript/lscript_compile/indra.l +++ /dev/null @@ -1,1013 +0,0 @@ - -N [0-9] -L [a-zA-Z_] -H [a-fA-F0-9] -E [Ee][+-]?{N}+ -FS (f|F) -%e 10000 -%n 4000 -%p 5000 - -%top { - #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" -#include "indra.y.hpp" -#include "lltimer.h" -#include "indra_constants.h" -#include "lllslconstants.h" -#include "lluuid.h" -#include "llassetstorage.h" -#include "llpartdata.h" -#include "llvehicleparams.h" -#include "llpermissionsflags.h" -#include "llfollowcamparams.h" -#include "llparcelflags.h" -#include "llregionflags.h" -#include "lscript_http.h" -#include "llclickaction.h" -#include "llmediaentry.h" - -void count(); -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 - -#define ECHO do { } while (0) - -#define yyparse indra_parse -#define yyerror indra_error -#define yylval indra_lval -#define yy_create_buffer indra__create_buffer -#define yy_delete_buffer indra__delete_buffer -#define yy_flex_debug indra__flex_debug -#define yy_init_buffer indra__init_buffer -#define yy_flush_buffer indra__flush_buffer -#define yy_load_buffer_state indra__load_buffer_state -#define yy_switch_to_buffer indra__switch_to_buffer -#define yyin indra_in -#define yyleng indra_leng -#define yylex indra_lex -#define yylineno indra_lineno -#define yyout indra_out -#define yyrestart indra_restart -#define yytext indra_text -#define yywrap indra_wrap -#define yyalloc indra_alloc -#define yyrealloc indra_realloc -#define yyfree indra_free - - -int yyparse( void ); -int yylex( void ); -int yyerror(const char *fmt, ...); - -%} - -%% -"//" { gInternalLine++; gInternalColumn = 0; line_comment(); } -"/*" { block_comment(); } - -"integer" { count(); return(INTEGER); } -"float" { count(); return(FLOAT_TYPE); } -"string" { count(); return(STRING); } -"key" { count(); return(LLKEY); } -"vector" { count(); return(VECTOR); } -"quaternion" { count(); return(QUATERNION); } -"rotation" { count(); return(QUATERNION); } -"list" { count(); return(LIST); } - -"default" { count(); yylval.sval = new char[strlen(yytext) + 1]; strcpy(yylval.sval, yytext); return(STATE_DEFAULT); } -"state" { count(); return(STATE); } -"event" { count(); return(EVENT); } -"jump" { count(); return(JUMP); } -"return" { count(); return(RETURN); } -"if" { count(); return(IF); } -"else" { count(); return(ELSE); } -"for" { count(); return(FOR); } -"do" { count(); return(DO); } -"while" { count(); return(WHILE); } - -"state_entry" { count(); return(STATE_ENTRY); } -"state_exit" { count(); return(STATE_EXIT); } -"touch_start" { count(); return(TOUCH_START); } -"touch" { count(); return(TOUCH); } -"touch_end" { count(); return(TOUCH_END); } -"collision_start" { count(); return(COLLISION_START); } -"collision" { count(); return(COLLISION); } -"collision_end" { count(); return(COLLISION_END); } -"land_collision_start" { count(); return(LAND_COLLISION_START); } -"land_collision" { count(); return(LAND_COLLISION); } -"land_collision_end" { count(); return(LAND_COLLISION_END); } -"timer" { count(); return(TIMER); } -"listen" { count(); return(CHAT); } -"sensor" { count(); return(SENSOR); } -"no_sensor" { count(); return(NO_SENSOR); } -"control" { count(); return(CONTROL); } -"print" { count(); return(PRINT); } -"at_target" { count(); return(AT_TARGET); } -"not_at_target" { count(); return(NOT_AT_TARGET); } -"at_rot_target" { count(); return(AT_ROT_TARGET); } -"not_at_rot_target" { count(); return(NOT_AT_ROT_TARGET); } -"money" { count(); return(MONEY); } -"email" { count(); return(EMAIL); } -"run_time_permissions" { count(); return(RUN_TIME_PERMISSIONS); } -"changed" { count(); return(INVENTORY); } -"attach" { count(); return(ATTACH); } -"dataserver" { count(); return(DATASERVER); } -"moving_start" { count(); return(MOVING_START); } -"moving_end" { count(); return(MOVING_END); } -"link_message" { count(); return(LINK_MESSAGE); } -"on_rez" { count(); return(REZ); } -"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); } - - -0[xX]{H}+ { count(); yylval.ival = strtoul(yytext, NULL, 0); return(INTEGER_CONSTANT); } -{N}+ { count(); yylval.ival = strtoul(yytext, NULL, 10); return(INTEGER_CONSTANT); } -"TRUE" { count(); yylval.ival = 1; return(INTEGER_TRUE); } -"FALSE" { count(); yylval.ival = 0; return(INTEGER_FALSE); } -"STATUS_PHYSICS" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); } -"STATUS_ROTATE_X" { count(); yylval.ival = 0x2; return(INTEGER_CONSTANT); } -"STATUS_ROTATE_Y" { count(); yylval.ival = 0x4; return(INTEGER_CONSTANT); } -"STATUS_ROTATE_Z" { count(); yylval.ival = 0x8; return(INTEGER_CONSTANT); } -"STATUS_PHANTOM" { count(); yylval.ival = 0x10; return(INTEGER_CONSTANT); } -"STATUS_SANDBOX" { count(); yylval.ival = 0x20; return(INTEGER_CONSTANT); } -"STATUS_BLOCK_GRAB" { count(); yylval.ival = 0x40; return(INTEGER_CONSTANT); } -"STATUS_DIE_AT_EDGE" { count(); yylval.ival = 0x80; return(INTEGER_CONSTANT); } -"STATUS_RETURN_AT_EDGE" { count(); yylval.ival = 0x100; return(INTEGER_CONSTANT); } -"STATUS_CAST_SHADOWS" { count(); yylval.ival = 0x200; return(INTEGER_CONSTANT); } -"STATUS_BLOCK_GRAB_OBJECT" { count(); yylval.ival = 0x400; return(INTEGER_CONSTANT); } - -"AGENT_FLYING" { count(); yylval.ival = AGENT_FLYING; return(INTEGER_CONSTANT); } -"AGENT_ATTACHMENTS" { count(); yylval.ival = AGENT_ATTACHMENTS; return(INTEGER_CONSTANT); } -"AGENT_SCRIPTED" { count(); yylval.ival = AGENT_SCRIPTED; return(INTEGER_CONSTANT); } -"AGENT_MOUSELOOK" { count(); yylval.ival = AGENT_MOUSELOOK; return(INTEGER_CONSTANT); } -"AGENT_SITTING" { count(); yylval.ival = AGENT_SITTING; return(INTEGER_CONSTANT); } -"AGENT_ON_OBJECT" { count(); yylval.ival = AGENT_ON_OBJECT; return(INTEGER_CONSTANT); } -"AGENT_AWAY" { count(); yylval.ival = AGENT_AWAY; return(INTEGER_CONSTANT); } -"AGENT_WALKING" { count(); yylval.ival = AGENT_WALKING; return(INTEGER_CONSTANT); } -"AGENT_IN_AIR" { count(); yylval.ival = AGENT_IN_AIR; return(INTEGER_CONSTANT); } -"AGENT_TYPING" { count(); yylval.ival = AGENT_TYPING; return(INTEGER_CONSTANT); } -"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); } -"CAMERA_POSITION_LAG" { count(); yylval.ival = FOLLOWCAM_POSITION_LAG; return (INTEGER_CONSTANT); } -"CAMERA_FOCUS_LAG" { count(); yylval.ival = FOLLOWCAM_FOCUS_LAG; return (INTEGER_CONSTANT); } -"CAMERA_DISTANCE" { count(); yylval.ival = FOLLOWCAM_DISTANCE; return (INTEGER_CONSTANT); } -"CAMERA_BEHINDNESS_ANGLE" { count(); yylval.ival = FOLLOWCAM_BEHINDNESS_ANGLE; return (INTEGER_CONSTANT); } -"CAMERA_BEHINDNESS_LAG" { count(); yylval.ival = FOLLOWCAM_BEHINDNESS_LAG; return (INTEGER_CONSTANT); } -"CAMERA_POSITION_THRESHOLD" { count(); yylval.ival = FOLLOWCAM_POSITION_THRESHOLD; return (INTEGER_CONSTANT); } -"CAMERA_FOCUS_THRESHOLD" { count(); yylval.ival = FOLLOWCAM_FOCUS_THRESHOLD; return (INTEGER_CONSTANT); } -"CAMERA_ACTIVE" { count(); yylval.ival = FOLLOWCAM_ACTIVE; return (INTEGER_CONSTANT); } -"CAMERA_POSITION" { count(); yylval.ival = FOLLOWCAM_POSITION; return (INTEGER_CONSTANT); } -"CAMERA_FOCUS" { count(); yylval.ival = FOLLOWCAM_FOCUS; return (INTEGER_CONSTANT); } -"CAMERA_POSITION_LOCKED" { count(); yylval.ival = FOLLOWCAM_POSITION_LOCKED; return (INTEGER_CONSTANT); } -"CAMERA_FOCUS_LOCKED" { count(); yylval.ival = FOLLOWCAM_FOCUS_LOCKED; return (INTEGER_CONSTANT); } - -"ANIM_ON" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); } -"LOOP" { count(); yylval.ival = 0x2; return(INTEGER_CONSTANT); } -"REVERSE" { count(); yylval.ival = 0x4; return(INTEGER_CONSTANT); } -"PING_PONG" { count(); yylval.ival = 0x8; return(INTEGER_CONSTANT); } -"SMOOTH" { count(); yylval.ival = 0x10; return(INTEGER_CONSTANT); } -"ROTATE" { count(); yylval.ival = 0x20; return(INTEGER_CONSTANT); } -"SCALE" { count(); yylval.ival = 0x40; return(INTEGER_CONSTANT); } - -"ALL_SIDES" { count(); yylval.ival = LSL_ALL_SIDES; return(INTEGER_CONSTANT); } -"LINK_ROOT" { count(); yylval.ival = LSL_LINK_ROOT; return(INTEGER_CONSTANT); } -"LINK_SET" { count(); yylval.ival = LSL_LINK_SET; return(INTEGER_CONSTANT); } -"LINK_ALL_OTHERS" { count(); yylval.ival = LSL_LINK_ALL_OTHERS; return(INTEGER_CONSTANT); } -"LINK_ALL_CHILDREN" { count(); yylval.ival = LSL_LINK_ALL_CHILDREN; return(INTEGER_CONSTANT); } -"LINK_THIS" { count(); yylval.ival = LSL_LINK_THIS; return(INTEGER_CONSTANT); } - -"AGENT" { count(); yylval.ival = 0x1; return(INTEGER_CONSTANT); } -"ACTIVE" { count(); yylval.ival = 0x2; return(INTEGER_CONSTANT); } -"PASSIVE" { count(); yylval.ival = 0x4; return(INTEGER_CONSTANT); } -"SCRIPTED" { count(); yylval.ival = 0x8; return(INTEGER_CONSTANT); } - -"CONTROL_FWD" { count(); yylval.ival = AGENT_CONTROL_AT_POS; return(INTEGER_CONSTANT); } -"CONTROL_BACK" { count(); yylval.ival = AGENT_CONTROL_AT_NEG; return(INTEGER_CONSTANT); } -"CONTROL_LEFT" { count(); yylval.ival = AGENT_CONTROL_LEFT_POS; return(INTEGER_CONSTANT); } -"CONTROL_RIGHT" { count(); yylval.ival = AGENT_CONTROL_LEFT_NEG; return(INTEGER_CONSTANT); } -"CONTROL_ROT_LEFT" { count(); yylval.ival = AGENT_CONTROL_YAW_POS; return(INTEGER_CONSTANT); } -"CONTROL_ROT_RIGHT" { count(); yylval.ival = AGENT_CONTROL_YAW_NEG; return(INTEGER_CONSTANT); } -"CONTROL_UP" { count(); yylval.ival = AGENT_CONTROL_UP_POS; return(INTEGER_CONSTANT); } -"CONTROL_DOWN" { count(); yylval.ival = AGENT_CONTROL_UP_NEG; return(INTEGER_CONSTANT); } -"CONTROL_LBUTTON" { count(); yylval.ival = AGENT_CONTROL_LBUTTON_DOWN; return(INTEGER_CONSTANT); } -"CONTROL_ML_LBUTTON" { count(); yylval.ival = AGENT_CONTROL_ML_LBUTTON_DOWN; return(INTEGER_CONSTANT); } - -"PERMISSION_DEBIT" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_DEBIT]; return(INTEGER_CONSTANT); } -"PERMISSION_TAKE_CONTROLS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TAKE_CONTROLS]; return(INTEGER_CONSTANT); } -"PERMISSION_REMAP_CONTROLS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_REMAP_CONTROLS]; return(INTEGER_CONSTANT); } -"PERMISSION_TRIGGER_ANIMATION" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRIGGER_ANIMATION]; return(INTEGER_CONSTANT); } -"PERMISSION_ATTACH" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_ATTACH]; return(INTEGER_CONSTANT); } -"PERMISSION_RELEASE_OWNERSHIP" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_RELEASE_OWNERSHIP]; return(INTEGER_CONSTANT); } -"PERMISSION_CHANGE_LINKS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_LINKS]; return(INTEGER_CONSTANT); } -"PERMISSION_CHANGE_JOINTS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_JOINTS]; return(INTEGER_CONSTANT); } -"PERMISSION_CHANGE_PERMISSIONS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CHANGE_PERMISSIONS]; return(INTEGER_CONSTANT); } -"PERMISSION_TRACK_CAMERA" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TRACK_CAMERA]; return(INTEGER_CONSTANT); } -"PERMISSION_CONTROL_CAMERA" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_CONTROL_CAMERA]; return(INTEGER_CONSTANT); } -"PERMISSION_TELEPORT" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_TELEPORT]; return(INTEGER_CONSTANT); } -"PERMISSION_SILENT_ESTATE_MANAGEMENT" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_SILENT_ESTATE_MANAGEMENT]; return(INTEGER_CONSTANT); } -"PERMISSION_OVERRIDE_ANIMATIONS" { count(); yylval.ival = LSCRIPTRunTimePermissionBits[SCRIPT_PERMISSION_OVERRIDE_ANIMATIONS]; return(INTEGER_CONSTANT); } - -"INVENTORY_TEXTURE" { count(); yylval.ival = LLAssetType::AT_TEXTURE; return(INTEGER_CONSTANT); } -"INVENTORY_SOUND" { count(); yylval.ival = LLAssetType::AT_SOUND; return(INTEGER_CONSTANT); } -"INVENTORY_OBJECT" { count(); yylval.ival = LLAssetType::AT_OBJECT; return(INTEGER_CONSTANT); } -"INVENTORY_SCRIPT" { count(); yylval.ival = LLAssetType::AT_LSL_TEXT; return(INTEGER_CONSTANT); } -"INVENTORY_LANDMARK" { count(); yylval.ival = LLAssetType::AT_LANDMARK; return(INTEGER_CONSTANT); } -"INVENTORY_CLOTHING" { count(); yylval.ival = LLAssetType::AT_CLOTHING; return(INTEGER_CONSTANT); } -"INVENTORY_NOTECARD" { count(); yylval.ival = LLAssetType::AT_NOTECARD; return(INTEGER_CONSTANT); } -"INVENTORY_BODYPART" { count(); yylval.ival = LLAssetType::AT_BODYPART; return(INTEGER_CONSTANT); } -"INVENTORY_ANIMATION" { count(); yylval.ival = LLAssetType::AT_ANIMATION; return(INTEGER_CONSTANT); } -"INVENTORY_GESTURE" { count(); yylval.ival = LLAssetType::AT_GESTURE; return(INTEGER_CONSTANT); } -"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 = 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); } -"OBJECT_DESC" { count(); yylval.ival = OBJECT_DESC; return(INTEGER_CONSTANT); } -"OBJECT_POS" { count(); yylval.ival = OBJECT_POS; return(INTEGER_CONSTANT); } -"OBJECT_ROT" { count(); yylval.ival = OBJECT_ROT; return(INTEGER_CONSTANT); } -"OBJECT_VELOCITY" { count(); yylval.ival = OBJECT_VELOCITY; return(INTEGER_CONSTANT); } -"OBJECT_OWNER" { count(); yylval.ival = OBJECT_OWNER; return(INTEGER_CONSTANT); } -"OBJECT_GROUP" { count(); yylval.ival = OBJECT_GROUP; return(INTEGER_CONSTANT); } -"OBJECT_CREATOR" { count(); yylval.ival = OBJECT_CREATOR; return(INTEGER_CONSTANT); } -"OBJECT_RUNNING_SCRIPT_COUNT" { count(); yylval.ival = OBJECT_RUNNING_SCRIPT_COUNT; return(INTEGER_CONSTANT); } -"OBJECT_TOTAL_SCRIPT_COUNT" { count(); yylval.ival = OBJECT_TOTAL_SCRIPT_COUNT; return(INTEGER_CONSTANT); } -"OBJECT_SCRIPT_MEMORY" { count(); yylval.ival = OBJECT_SCRIPT_MEMORY; return(INTEGER_CONSTANT); } -"OBJECT_SCRIPT_TIME" { count(); yylval.ival = OBJECT_SCRIPT_TIME; return(INTEGER_CONSTANT); } -"OBJECT_PRIM_EQUIVALENCE" { count(); yylval.ival = OBJECT_PRIM_EQUIVALENCE; return(INTEGER_CONSTANT); } -"OBJECT_SERVER_COST" { count(); yylval.ival = OBJECT_SERVER_COST; return(INTEGER_CONSTANT); } -"OBJECT_STREAMING_COST" { count(); yylval.ival = OBJECT_STREAMING_COST; return(INTEGER_CONSTANT); } -"OBJECT_PHYSICS_COST" { count(); yylval.ival = OBJECT_PHYSICS_COST; return(INTEGER_CONSTANT); } -"OBJECT_CHARACTER_TIME" { count(); yylval.ival = OBJECT_CHARACTER_TIME; return(INTEGER_CONSTANT); } -"OBJECT_ROOT" { count(); yylval.ival = OBJECT_ROOT; return(INTEGER_CONSTANT); } -"OBJECT_ATTACHED_POINT" { count(); yylval.ival = OBJECT_ATTACHED_POINT; return(INTEGER_CONSTANT); } -"OBJECT_PATHFINDING_TYPE" { count(); yylval.ival = OBJECT_PATHFINDING_TYPE; return(INTEGER_CONSTANT); } -"OBJECT_PHYSICS" { count(); yylval.ival = OBJECT_PHYSICS; return(INTEGER_CONSTANT); } -"OBJECT_PHANTOM" { count(); yylval.ival = OBJECT_PHANTOM; return(INTEGER_CONSTANT); } -"OBJECT_TEMP_ON_REZ" { count(); yylval.ival = OBJECT_TEMP_ON_REZ; return(INTEGER_CONSTANT); } -"OBJECT_RENDER_WEIGHT" { count(); yylval.ival = OBJECT_RENDER_WEIGHT; return(INTEGER_CONSTANT); } - -"TYPE_INTEGER" { count(); yylval.ival = LST_INTEGER; return(INTEGER_CONSTANT); } -"TYPE_FLOAT" { count(); yylval.ival = LST_FLOATINGPOINT; return(INTEGER_CONSTANT); } -"TYPE_STRING" { count(); yylval.ival = LST_STRING; return(INTEGER_CONSTANT); } -"TYPE_KEY" { count(); yylval.ival = LST_KEY; return(INTEGER_CONSTANT); } -"TYPE_VECTOR" { count(); yylval.ival = LST_VECTOR; return(INTEGER_CONSTANT); } -"TYPE_ROTATION" { count(); yylval.ival = LST_QUATERNION; return(INTEGER_CONSTANT); } -"TYPE_INVALID" { count(); yylval.ival = LST_NULL; return(INTEGER_CONSTANT); } - -"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); } -"PI_BY_TWO" { count(); yylval.fval = F_PI_BY_TWO; return(FP_CONSTANT); } -"DEG_TO_RAD" { count(); yylval.fval = DEG_TO_RAD; return(FP_CONSTANT); } -"RAD_TO_DEG" { count(); yylval.fval = RAD_TO_DEG; return(FP_CONSTANT); } -"SQRT2" { count(); yylval.fval = F_SQRT2; return(FP_CONSTANT); } - -"DEBUG_CHANNEL" { count(); yylval.ival = CHAT_CHANNEL_DEBUG; return(INTEGER_CONSTANT); } -"PUBLIC_CHANNEL" { count(); yylval.ival = 0; return(INTEGER_CONSTANT); } - -"ZERO_VECTOR" { count(); return(ZERO_VECTOR); } -"ZERO_ROTATION" { count(); return(ZERO_ROTATION); } - -"ATTACH_CHEST" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } -"ATTACH_HEAD" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); } -"ATTACH_LSHOULDER" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); } -"ATTACH_RSHOULDER" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); } -"ATTACH_LHAND" { count(); yylval.ival = 5; return(INTEGER_CONSTANT); } -"ATTACH_RHAND" { count(); yylval.ival = 6; return(INTEGER_CONSTANT); } -"ATTACH_LFOOT" { count(); yylval.ival = 7; return(INTEGER_CONSTANT); } -"ATTACH_RFOOT" { count(); yylval.ival = 8; return(INTEGER_CONSTANT); } -"ATTACH_BACK" { count(); yylval.ival = 9; return(INTEGER_CONSTANT); } -"ATTACH_PELVIS" { count(); yylval.ival = 10; return(INTEGER_CONSTANT); } -"ATTACH_MOUTH" { count(); yylval.ival = 11; return(INTEGER_CONSTANT); } -"ATTACH_CHIN" { count(); yylval.ival = 12; return(INTEGER_CONSTANT); } -"ATTACH_LEAR" { count(); yylval.ival = 13; return(INTEGER_CONSTANT); } -"ATTACH_REAR" { count(); yylval.ival = 14; return(INTEGER_CONSTANT); } -"ATTACH_LEYE" { count(); yylval.ival = 15; return(INTEGER_CONSTANT); } -"ATTACH_REYE" { count(); yylval.ival = 16; return(INTEGER_CONSTANT); } -"ATTACH_NOSE" { count(); yylval.ival = 17; return(INTEGER_CONSTANT); } -"ATTACH_RUARM" { count(); yylval.ival = 18; return(INTEGER_CONSTANT); } -"ATTACH_RLARM" { count(); yylval.ival = 19; return(INTEGER_CONSTANT); } -"ATTACH_LUARM" { count(); yylval.ival = 20; return(INTEGER_CONSTANT); } -"ATTACH_LLARM" { count(); yylval.ival = 21; return(INTEGER_CONSTANT); } -"ATTACH_RHIP" { count(); yylval.ival = 22; return(INTEGER_CONSTANT); } -"ATTACH_RULEG" { count(); yylval.ival = 23; return(INTEGER_CONSTANT); } -"ATTACH_RLLEG" { count(); yylval.ival = 24; return(INTEGER_CONSTANT); } -"ATTACH_LHIP" { count(); yylval.ival = 25; return(INTEGER_CONSTANT); } -"ATTACH_LULEG" { count(); yylval.ival = 26; return(INTEGER_CONSTANT); } -"ATTACH_LLLEG" { count(); yylval.ival = 27; return(INTEGER_CONSTANT); } -"ATTACH_BELLY" { count(); yylval.ival = 28; return(INTEGER_CONSTANT); } -"ATTACH_RPEC" { count(); yylval.ival = 29; return(INTEGER_CONSTANT); } -"ATTACH_LPEC" { count(); yylval.ival = 30; return(INTEGER_CONSTANT); } -"ATTACH_HUD_CENTER_2" { count(); yylval.ival = 31; return(INTEGER_CONSTANT); } -"ATTACH_HUD_TOP_RIGHT" { count(); yylval.ival = 32; return(INTEGER_CONSTANT); } -"ATTACH_HUD_TOP_CENTER" { count(); yylval.ival = 33; return(INTEGER_CONSTANT); } -"ATTACH_HUD_TOP_LEFT" { count(); yylval.ival = 34; return(INTEGER_CONSTANT); } -"ATTACH_HUD_CENTER_1" { count(); yylval.ival = 35; return(INTEGER_CONSTANT); } -"ATTACH_HUD_BOTTOM_LEFT" { count(); yylval.ival = 36; return(INTEGER_CONSTANT); } -"ATTACH_HUD_BOTTOM" { count(); yylval.ival = 37; return(INTEGER_CONSTANT); } -"ATTACH_HUD_BOTTOM_RIGHT" { count(); yylval.ival = 38; return(INTEGER_CONSTANT); } -"ATTACH_NECK" { count(); yylval.ival = 39; return(INTEGER_CONSTANT); } -"ATTACH_AVATAR_CENTER" { count(); yylval.ival = 40; return(INTEGER_CONSTANT); } - -"LAND_LEVEL" { count(); yylval.ival = E_LANDBRUSH_LEVEL; return(INTEGER_CONSTANT); } -"LAND_RAISE" { count(); yylval.ival = E_LANDBRUSH_RAISE; return(INTEGER_CONSTANT); } -"LAND_LOWER" { count(); yylval.ival = E_LANDBRUSH_LOWER; return(INTEGER_CONSTANT); } -"LAND_SMOOTH" { count(); yylval.ival = E_LANDBRUSH_SMOOTH; return(INTEGER_CONSTANT); } -"LAND_NOISE" { count(); yylval.ival = E_LANDBRUSH_NOISE; return(INTEGER_CONSTANT); } -"LAND_REVERT" { count(); yylval.ival = E_LANDBRUSH_REVERT; return(INTEGER_CONSTANT); } - -"LAND_SMALL_BRUSH" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } -"LAND_MEDIUM_BRUSH" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); } -"LAND_LARGE_BRUSH" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); } - -"DATA_ONLINE" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } -"DATA_NAME" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); } -"DATA_BORN" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); } -"DATA_RATING" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); } -"DATA_SIM_POS" { count(); yylval.ival = 5; return(INTEGER_CONSTANT); } -"DATA_SIM_STATUS" { count(); yylval.ival = 6; return(INTEGER_CONSTANT); } -"DATA_SIM_RATING" { count(); yylval.ival = 7; return(INTEGER_CONSTANT); } -"DATA_PAYINFO" { count(); yylval.ival = 8; return(INTEGER_CONSTANT); } - -"PAYMENT_INFO_ON_FILE" { count(); yylval.ival = 1; return(INTEGER_CONSTANT); } -"PAYMENT_INFO_USED" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); } - -"REMOTE_DATA_CHANNEL" { count(); yylval.ival = LSL_REMOTE_DATA_CHANNEL; return(INTEGER_CONSTANT); } -"REMOTE_DATA_REQUEST" { count(); yylval.ival = LSL_REMOTE_DATA_REQUEST; return(INTEGER_CONSTANT); } -"REMOTE_DATA_REPLY" { count(); yylval.ival = LSL_REMOTE_DATA_REPLY; return(INTEGER_CONSTANT); } - - -"PSYS_PART_FLAGS" { count(); yylval.ival = LLPS_PART_FLAGS; return(INTEGER_CONSTANT); } -"PSYS_PART_START_COLOR" { count(); yylval.ival = LLPS_PART_START_COLOR; return (INTEGER_CONSTANT); } -"PSYS_PART_START_ALPHA" { count(); yylval.ival = LLPS_PART_START_ALPHA; return (INTEGER_CONSTANT); } -"PSYS_PART_START_SCALE" { count(); yylval.ival = LLPS_PART_START_SCALE; return (INTEGER_CONSTANT); } -"PSYS_PART_END_COLOR" { count(); yylval.ival = LLPS_PART_END_COLOR; return (INTEGER_CONSTANT); } -"PSYS_PART_END_ALPHA" { count(); yylval.ival = LLPS_PART_END_ALPHA; return (INTEGER_CONSTANT); } -"PSYS_PART_END_SCALE" { count(); yylval.ival = LLPS_PART_END_SCALE; return (INTEGER_CONSTANT); } -"PSYS_PART_MAX_AGE" { count(); yylval.ival = LLPS_PART_MAX_AGE; return (INTEGER_CONSTANT); } - -"PSYS_PART_BLEND_FUNC_SOURCE" { count(); yylval.ival = LLPS_PART_BLEND_FUNC_SOURCE; return (INTEGER_CONSTANT); } -"PSYS_PART_BLEND_FUNC_DEST" { count(); yylval.ival = LLPS_PART_BLEND_FUNC_DEST; return (INTEGER_CONSTANT); } -"PSYS_PART_START_GLOW" { count(); yylval.ival = LLPS_PART_START_GLOW; return (INTEGER_CONSTANT); } -"PSYS_PART_END_GLOW" { count(); yylval.ival = LLPS_PART_END_GLOW; return (INTEGER_CONSTANT); } - -"PSYS_PART_WIND_MASK" { count(); yylval.ival = LLPartData::LL_PART_WIND_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_INTERP_COLOR_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_COLOR_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_INTERP_SCALE_MASK" { count(); yylval.ival = LLPartData::LL_PART_INTERP_SCALE_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_BOUNCE_MASK" { count(); yylval.ival = LLPartData::LL_PART_BOUNCE_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_FOLLOW_SRC_MASK" { count(); yylval.ival = LLPartData::LL_PART_FOLLOW_SRC_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_FOLLOW_VELOCITY_MASK" { count(); yylval.ival = LLPartData::LL_PART_FOLLOW_VELOCITY_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_TARGET_POS_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_POS_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_EMISSIVE_MASK" { count(); yylval.ival = LLPartData::LL_PART_EMISSIVE_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_TARGET_LINEAR_MASK" { count(); yylval.ival = LLPartData::LL_PART_TARGET_LINEAR_MASK; return(INTEGER_CONSTANT); } -"PSYS_PART_RIBBON_MASK" { count(); yylval.ival = LLPartData::LL_PART_RIBBON_MASK; return(INTEGER_CONSTANT); } - -"PSYS_PART_BF_ONE" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE; return(INTEGER_CONSTANT); } -"PSYS_PART_BF_ZERO" { count(); yylval.ival = LLPartData::LL_PART_BF_ZERO; return(INTEGER_CONSTANT); } -"PSYS_PART_BF_DEST_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_DEST_COLOR; return(INTEGER_CONSTANT); } -"PSYS_PART_BF_SOURCE_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_SOURCE_COLOR; return(INTEGER_CONSTANT); } -"PSYS_PART_BF_ONE_MINUS_DEST_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE_MINUS_DEST_COLOR; return(INTEGER_CONSTANT); } -"PSYS_PART_BF_ONE_MINUS_SOURCE_COLOR" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_COLOR; return(INTEGER_CONSTANT); } -"PSYS_PART_BF_SOURCE_ALPHA" { count(); yylval.ival = LLPartData::LL_PART_BF_SOURCE_ALPHA; return(INTEGER_CONSTANT); } -"PSYS_PART_BF_ONE_MINUS_SOURCE_ALPHA" { count(); yylval.ival = LLPartData::LL_PART_BF_ONE_MINUS_SOURCE_ALPHA; return(INTEGER_CONSTANT); } - - -"PSYS_SRC_MAX_AGE" { count(); yylval.ival = LLPS_SRC_MAX_AGE; return(INTEGER_CONSTANT); } -"PSYS_SRC_PATTERN" { count(); yylval.ival = LLPS_SRC_PATTERN; return(INTEGER_CONSTANT); } -"PSYS_SRC_INNERANGLE" { count(); yylval.ival = LLPS_SRC_INNERANGLE; return(INTEGER_CONSTANT); } -"PSYS_SRC_OUTERANGLE" { count(); yylval.ival = LLPS_SRC_OUTERANGLE; return(INTEGER_CONSTANT); } -"PSYS_SRC_ANGLE_BEGIN" { count(); yylval.ival = LLPS_SRC_ANGLE_BEGIN; return(INTEGER_CONSTANT); } -"PSYS_SRC_ANGLE_END" { count(); yylval.ival = LLPS_SRC_ANGLE_END; return(INTEGER_CONSTANT); } -"PSYS_SRC_BURST_RATE" { count(); yylval.ival = LLPS_SRC_BURST_RATE; return(INTEGER_CONSTANT); } -"PSYS_SRC_BURST_PART_COUNT" { count(); yylval.ival = LLPS_SRC_BURST_PART_COUNT; return(INTEGER_CONSTANT); } -"PSYS_SRC_BURST_RADIUS" { count(); yylval.ival = LLPS_SRC_BURST_RADIUS; return(INTEGER_CONSTANT); } -"PSYS_SRC_BURST_SPEED_MIN" { count(); yylval.ival = LLPS_SRC_BURST_SPEED_MIN; return(INTEGER_CONSTANT); } -"PSYS_SRC_BURST_SPEED_MAX" { count(); yylval.ival = LLPS_SRC_BURST_SPEED_MAX; return(INTEGER_CONSTANT); } -"PSYS_SRC_ACCEL" { count(); yylval.ival = LLPS_SRC_ACCEL; return(INTEGER_CONSTANT); } -"PSYS_SRC_TEXTURE" { count(); yylval.ival = LLPS_SRC_TEXTURE; return(INTEGER_CONSTANT); } -"PSYS_SRC_TARGET_KEY" { count(); yylval.ival = LLPS_SRC_TARGET_UUID; return(INTEGER_CONSTANT); } -"PSYS_SRC_OMEGA" { count(); yylval.ival = LLPS_SRC_OMEGA; return(INTEGER_CONSTANT); } - -"PSYS_SRC_OBJ_REL_MASK" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_OBJ_REL_MASK; return(INTEGER_CONSTANT); } - -"PSYS_SRC_PATTERN_DROP" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_DROP; return(INTEGER_CONSTANT); } -"PSYS_SRC_PATTERN_EXPLODE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_EXPLODE; return(INTEGER_CONSTANT); } -"PSYS_SRC_PATTERN_ANGLE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE; return(INTEGER_CONSTANT); } -"PSYS_SRC_PATTERN_ANGLE_CONE" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE; return(INTEGER_CONSTANT); } -"PSYS_SRC_PATTERN_ANGLE_CONE_EMPTY" { count(); yylval.ival = LLPartSysData::LL_PART_SRC_PATTERN_ANGLE_CONE_EMPTY; return(INTEGER_CONSTANT); } - - -"VEHICLE_TYPE_NONE" { count(); yylval.ival = VEHICLE_TYPE_NONE; return(INTEGER_CONSTANT); } -"VEHICLE_TYPE_SLED" { count(); yylval.ival = VEHICLE_TYPE_SLED; return(INTEGER_CONSTANT); } -"VEHICLE_TYPE_CAR" { count(); yylval.ival = VEHICLE_TYPE_CAR; return(INTEGER_CONSTANT); } -"VEHICLE_TYPE_BOAT" { count(); yylval.ival = VEHICLE_TYPE_BOAT; return(INTEGER_CONSTANT); } -"VEHICLE_TYPE_AIRPLANE" { count(); yylval.ival = VEHICLE_TYPE_AIRPLANE; return(INTEGER_CONSTANT); } -"VEHICLE_TYPE_BALLOON" { count(); yylval.ival = VEHICLE_TYPE_BALLOON; return(INTEGER_CONSTANT); } - -"VEHICLE_REFERENCE_FRAME" { count(); yylval.ival = VEHICLE_REFERENCE_FRAME; return(INTEGER_CONSTANT); } -"VEHICLE_LINEAR_FRICTION_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_FRICTION_TIMESCALE; return(INTEGER_CONSTANT); } -"VEHICLE_ANGULAR_FRICTION_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_FRICTION_TIMESCALE; return(INTEGER_CONSTANT); } -"VEHICLE_LINEAR_MOTOR_DIRECTION" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_DIRECTION; return(INTEGER_CONSTANT); } -"VEHICLE_ANGULAR_MOTOR_DIRECTION" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_DIRECTION; return(INTEGER_CONSTANT); } -"VEHICLE_LINEAR_MOTOR_OFFSET" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_OFFSET; return(INTEGER_CONSTANT); } - - - -"VEHICLE_HOVER_HEIGHT" { count(); yylval.ival = VEHICLE_HOVER_HEIGHT; return(INTEGER_CONSTANT); } -"VEHICLE_HOVER_EFFICIENCY" { count(); yylval.ival = VEHICLE_HOVER_EFFICIENCY; return(INTEGER_CONSTANT); } -"VEHICLE_HOVER_TIMESCALE" { count(); yylval.ival = VEHICLE_HOVER_TIMESCALE; return(INTEGER_CONSTANT); } -"VEHICLE_BUOYANCY" { count(); yylval.ival = VEHICLE_BUOYANCY; return(INTEGER_CONSTANT); } - -"VEHICLE_LINEAR_DEFLECTION_EFFICIENCY" { count(); yylval.ival = VEHICLE_LINEAR_DEFLECTION_EFFICIENCY; return(INTEGER_CONSTANT); } -"VEHICLE_LINEAR_DEFLECTION_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_DEFLECTION_TIMESCALE; return(INTEGER_CONSTANT); } -"VEHICLE_LINEAR_MOTOR_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_TIMESCALE; return(INTEGER_CONSTANT); } -"VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE" { count(); yylval.ival = VEHICLE_LINEAR_MOTOR_DECAY_TIMESCALE; return(INTEGER_CONSTANT); } - -"VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY" { count(); yylval.ival = VEHICLE_ANGULAR_DEFLECTION_EFFICIENCY; return(INTEGER_CONSTANT); } -"VEHICLE_ANGULAR_DEFLECTION_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_DEFLECTION_TIMESCALE; return(INTEGER_CONSTANT); } -"VEHICLE_ANGULAR_MOTOR_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_TIMESCALE; return(INTEGER_CONSTANT); } -"VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE" { count(); yylval.ival = VEHICLE_ANGULAR_MOTOR_DECAY_TIMESCALE; return(INTEGER_CONSTANT); } - -"VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY" { count(); yylval.ival = VEHICLE_VERTICAL_ATTRACTION_EFFICIENCY; return(INTEGER_CONSTANT); } -"VEHICLE_VERTICAL_ATTRACTION_TIMESCALE" { count(); yylval.ival = VEHICLE_VERTICAL_ATTRACTION_TIMESCALE; return(INTEGER_CONSTANT); } - -"VEHICLE_BANKING_EFFICIENCY" { count(); yylval.ival = VEHICLE_BANKING_EFFICIENCY; return(INTEGER_CONSTANT); } -"VEHICLE_BANKING_MIX" { count(); yylval.ival = VEHICLE_BANKING_MIX; return(INTEGER_CONSTANT); } -"VEHICLE_BANKING_TIMESCALE" { count(); yylval.ival = VEHICLE_BANKING_TIMESCALE; return(INTEGER_CONSTANT); } - -"VEHICLE_FLAG_NO_FLY_UP" { count(); yylval.ival = VEHICLE_FLAG_NO_DEFLECTION_UP; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_NO_DEFLECTION_UP" { count(); yylval.ival = VEHICLE_FLAG_NO_DEFLECTION_UP; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_LIMIT_ROLL_ONLY" { count(); yylval.ival = VEHICLE_FLAG_LIMIT_ROLL_ONLY; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_HOVER_WATER_ONLY" { count(); yylval.ival = VEHICLE_FLAG_HOVER_WATER_ONLY; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_HOVER_TERRAIN_ONLY" { count(); yylval.ival = VEHICLE_FLAG_HOVER_TERRAIN_ONLY; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT" { count(); yylval.ival = VEHICLE_FLAG_HOVER_GLOBAL_HEIGHT; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_HOVER_UP_ONLY" { count(); yylval.ival = VEHICLE_FLAG_HOVER_UP_ONLY; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_LIMIT_MOTOR_UP" { count(); yylval.ival = VEHICLE_FLAG_LIMIT_MOTOR_UP; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_MOUSELOOK_STEER" { count(); yylval.ival = VEHICLE_FLAG_MOUSELOOK_STEER; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_MOUSELOOK_BANK" { count(); yylval.ival = VEHICLE_FLAG_MOUSELOOK_BANK; return(INTEGER_CONSTANT); } -"VEHICLE_FLAG_CAMERA_DECOUPLED" { count(); yylval.ival = VEHICLE_FLAG_CAMERA_DECOUPLED; return(INTEGER_CONSTANT); } - - - -"PRIM_TYPE" { count(); yylval.ival = LSL_PRIM_TYPE; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL" { count(); yylval.ival = LSL_PRIM_MATERIAL; return(INTEGER_CONSTANT); } -"PRIM_PHYSICS" { count(); yylval.ival = LSL_PRIM_PHYSICS; return(INTEGER_CONSTANT); } -"PRIM_FLEXIBLE" { count(); yylval.ival = LSL_PRIM_FLEXIBLE; return(INTEGER_CONSTANT); } -"PRIM_POINT_LIGHT" { count(); yylval.ival = LSL_PRIM_POINT_LIGHT; return(INTEGER_CONSTANT); } -"PRIM_TEMP_ON_REZ" { count(); yylval.ival = LSL_PRIM_TEMP_ON_REZ; return(INTEGER_CONSTANT); } -"PRIM_PHANTOM" { count(); yylval.ival = LSL_PRIM_PHANTOM; return(INTEGER_CONSTANT); } -"PRIM_CAST_SHADOWS" { count(); yylval.ival = LSL_PRIM_CAST_SHADOWS; return(INTEGER_CONSTANT); } -"PRIM_POSITION" { count(); yylval.ival = LSL_PRIM_POSITION; return(INTEGER_CONSTANT); } -"PRIM_SIZE" { count(); yylval.ival = LSL_PRIM_SIZE; return(INTEGER_CONSTANT); } -"PRIM_ROTATION" { count(); yylval.ival = LSL_PRIM_ROTATION; return(INTEGER_CONSTANT); } -"PRIM_TEXTURE" { count(); yylval.ival = LSL_PRIM_TEXTURE; return(INTEGER_CONSTANT); } -"PRIM_COLOR" { count(); yylval.ival = LSL_PRIM_COLOR; return(INTEGER_CONSTANT); } -"PRIM_BUMP_SHINY" { count(); yylval.ival = LSL_PRIM_BUMP_SHINY; return(INTEGER_CONSTANT); } -"PRIM_FULLBRIGHT" { count(); yylval.ival = LSL_PRIM_FULLBRIGHT; return(INTEGER_CONSTANT); } -"PRIM_TEXGEN" { count(); yylval.ival = LSL_PRIM_TEXGEN; return(INTEGER_CONSTANT); } -"PRIM_GLOW" { count(); yylval.ival = LSL_PRIM_GLOW; return(INTEGER_CONSTANT); } -"PRIM_TEXT" { count(); yylval.ival = LSL_PRIM_TEXT; return(INTEGER_CONSTANT); } -"PRIM_NAME" { count(); yylval.ival = LSL_PRIM_NAME; return(INTEGER_CONSTANT); } -"PRIM_DESC" { count(); yylval.ival = LSL_PRIM_DESC; return(INTEGER_CONSTANT); } -"PRIM_OMEGA" { count(); yylval.ival = LSL_PRIM_OMEGA; return(INTEGER_CONSTANT); } -"PRIM_LINK_TARGET" { count(); yylval.ival = LSL_PRIM_LINK_TARGET; return(INTEGER_CONSTANT); } -"PRIM_SLICE" { count(); yylval.ival = LSL_PRIM_SLICE; return(INTEGER_CONSTANT); } - -"PRIM_PHYSICS_SHAPE_PRIM" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_PRIM; return(INTEGER_CONSTANT); } -"PRIM_PHYSICS_SHAPE_NONE" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_NONE; return(INTEGER_CONSTANT); } -"PRIM_PHYSICS_SHAPE_CONVEX" { count(); yylval.ival = LSL_PRIM_PHYSICS_SHAPE_CONVEX; return(INTEGER_CONSTANT); } - -"PRIM_TYPE_BOX" { count(); yylval.ival = LSL_PRIM_TYPE_BOX; return(INTEGER_CONSTANT); } -"PRIM_TYPE_CYLINDER" { count(); yylval.ival = LSL_PRIM_TYPE_CYLINDER; return(INTEGER_CONSTANT); } -"PRIM_TYPE_PRISM" { count(); yylval.ival = LSL_PRIM_TYPE_PRISM; return(INTEGER_CONSTANT); } -"PRIM_TYPE_SPHERE" { count(); yylval.ival = LSL_PRIM_TYPE_SPHERE; return(INTEGER_CONSTANT); } -"PRIM_TYPE_TORUS" { count(); yylval.ival = LSL_PRIM_TYPE_TORUS; return(INTEGER_CONSTANT); } -"PRIM_TYPE_TUBE" { count(); yylval.ival = LSL_PRIM_TYPE_TUBE; return(INTEGER_CONSTANT); } -"PRIM_TYPE_RING" { count(); yylval.ival = LSL_PRIM_TYPE_RING; return(INTEGER_CONSTANT); } -"PRIM_TYPE_SCULPT" { count(); yylval.ival = LSL_PRIM_TYPE_SCULPT; return(INTEGER_CONSTANT); } - -"PRIM_HOLE_DEFAULT" { count(); yylval.ival = LSL_PRIM_HOLE_DEFAULT; return(INTEGER_CONSTANT); } -"PRIM_HOLE_CIRCLE" { count(); yylval.ival = LSL_PRIM_HOLE_CIRCLE; return(INTEGER_CONSTANT); } -"PRIM_HOLE_SQUARE" { count(); yylval.ival = LSL_PRIM_HOLE_SQUARE; return(INTEGER_CONSTANT); } -"PRIM_HOLE_TRIANGLE" { count(); yylval.ival = LSL_PRIM_HOLE_TRIANGLE; return(INTEGER_CONSTANT); } - -"PRIM_MATERIAL_STONE" { count(); yylval.ival = LSL_PRIM_MATERIAL_STONE; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL_METAL" { count(); yylval.ival = LSL_PRIM_MATERIAL_METAL; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL_GLASS" { count(); yylval.ival = LSL_PRIM_MATERIAL_GLASS; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL_WOOD" { count(); yylval.ival = LSL_PRIM_MATERIAL_WOOD; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL_FLESH" { count(); yylval.ival = LSL_PRIM_MATERIAL_FLESH; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL_PLASTIC" { count(); yylval.ival = LSL_PRIM_MATERIAL_PLASTIC; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL_RUBBER" { count(); yylval.ival = LSL_PRIM_MATERIAL_RUBBER; return(INTEGER_CONSTANT); } -"PRIM_MATERIAL_LIGHT" { count(); yylval.ival = LSL_PRIM_MATERIAL_LIGHT; return(INTEGER_CONSTANT); } - -"PRIM_SHINY_NONE" { count(); yylval.ival = LSL_PRIM_SHINY_NONE; return(INTEGER_CONSTANT); } -"PRIM_SHINY_LOW" { count(); yylval.ival = LSL_PRIM_SHINY_LOW; return(INTEGER_CONSTANT); } -"PRIM_SHINY_MEDIUM" { count(); yylval.ival = LSL_PRIM_SHINY_MEDIUM; return(INTEGER_CONSTANT); } -"PRIM_SHINY_HIGH" { count(); yylval.ival = LSL_PRIM_SHINY_HIGH; return(INTEGER_CONSTANT); } - -"PRIM_BUMP_NONE" { count(); yylval.ival = LSL_PRIM_BUMP_NONE; return(INTEGER_CONSTANT); } -"PRIM_BUMP_BRIGHT" { count(); yylval.ival = LSL_PRIM_BUMP_BRIGHT; return(INTEGER_CONSTANT); } -"PRIM_BUMP_DARK" { count(); yylval.ival = LSL_PRIM_BUMP_DARK; return(INTEGER_CONSTANT); } -"PRIM_BUMP_WOOD" { count(); yylval.ival = LSL_PRIM_BUMP_WOOD; return(INTEGER_CONSTANT); } -"PRIM_BUMP_BARK" { count(); yylval.ival = LSL_PRIM_BUMP_BARK; return(INTEGER_CONSTANT); } -"PRIM_BUMP_BRICKS" { count(); yylval.ival = LSL_PRIM_BUMP_BRICKS; return(INTEGER_CONSTANT); } -"PRIM_BUMP_CHECKER" { count(); yylval.ival = LSL_PRIM_BUMP_CHECKER; return(INTEGER_CONSTANT); } -"PRIM_BUMP_CONCRETE" { count(); yylval.ival = LSL_PRIM_BUMP_CONCRETE; return(INTEGER_CONSTANT); } -"PRIM_BUMP_TILE" { count(); yylval.ival = LSL_PRIM_BUMP_TILE; return(INTEGER_CONSTANT); } -"PRIM_BUMP_STONE" { count(); yylval.ival = LSL_PRIM_BUMP_STONE; return(INTEGER_CONSTANT); } -"PRIM_BUMP_DISKS" { count(); yylval.ival = LSL_PRIM_BUMP_DISKS; return(INTEGER_CONSTANT); } -"PRIM_BUMP_GRAVEL" { count(); yylval.ival = LSL_PRIM_BUMP_GRAVEL; return(INTEGER_CONSTANT); } -"PRIM_BUMP_BLOBS" { count(); yylval.ival = LSL_PRIM_BUMP_BLOBS; return(INTEGER_CONSTANT); } -"PRIM_BUMP_SIDING" { count(); yylval.ival = LSL_PRIM_BUMP_SIDING; return(INTEGER_CONSTANT); } -"PRIM_BUMP_LARGETILE" { count(); yylval.ival = LSL_PRIM_BUMP_LARGETILE; return(INTEGER_CONSTANT); } -"PRIM_BUMP_STUCCO" { count(); yylval.ival = LSL_PRIM_BUMP_STUCCO; return(INTEGER_CONSTANT); } -"PRIM_BUMP_SUCTION" { count(); yylval.ival = LSL_PRIM_BUMP_SUCTION; return(INTEGER_CONSTANT); } -"PRIM_BUMP_WEAVE" { count(); yylval.ival = LSL_PRIM_BUMP_WEAVE; return(INTEGER_CONSTANT); } - -"PRIM_TEXGEN_DEFAULT" { count(); yylval.ival = LSL_PRIM_TEXGEN_DEFAULT; return(INTEGER_CONSTANT); } -"PRIM_TEXGEN_PLANAR" { count(); yylval.ival = LSL_PRIM_TEXGEN_PLANAR; return(INTEGER_CONSTANT); } - -"PRIM_SCULPT_TYPE_SPHERE" { count(); yylval.ival = LSL_PRIM_SCULPT_TYPE_SPHERE; return(INTEGER_CONSTANT); } -"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); } -"MASK_GROUP" { count(); yylval.ival = 2; return(INTEGER_CONSTANT); } -"MASK_EVERYONE" { count(); yylval.ival = 3; return(INTEGER_CONSTANT); } -"MASK_NEXT" { count(); yylval.ival = 4; return(INTEGER_CONSTANT); } - -"PERM_TRANSFER" { count(); yylval.ival = PERM_TRANSFER; return(INTEGER_CONSTANT); } -"PERM_MODIFY" { count(); yylval.ival = PERM_MODIFY; return(INTEGER_CONSTANT); } -"PERM_COPY" { count(); yylval.ival = PERM_COPY; return(INTEGER_CONSTANT); } -"PERM_MOVE" { count(); yylval.ival = PERM_MOVE; return(INTEGER_CONSTANT); } -"PERM_ALL" { count(); yylval.ival = PERM_ALL; return(INTEGER_CONSTANT); } - -"PARCEL_MEDIA_COMMAND_STOP" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_STOP; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_PAUSE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_PAUSE; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_PLAY" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_PLAY; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_LOOP" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_LOOP; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_TEXTURE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_TEXTURE; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_URL" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_URL; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_TIME" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_TIME; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_AGENT" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_AGENT; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_UNLOAD" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_UNLOAD; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_AUTO_ALIGN" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_AUTO_ALIGN; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_TYPE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_TYPE; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_SIZE" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_SIZE; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_DESC" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_DESC; return(INTEGER_CONSTANT); } -"PARCEL_MEDIA_COMMAND_LOOP_SET" { count(); yylval.ival = PARCEL_MEDIA_COMMAND_LOOP_SET; return(INTEGER_CONSTANT); } - -"LIST_STAT_MAX" { count(); yylval.ival = LIST_STAT_MAX; return(INTEGER_CONSTANT); } -"LIST_STAT_MIN" { count(); yylval.ival = LIST_STAT_MIN; return(INTEGER_CONSTANT); } -"LIST_STAT_MEAN" { count(); yylval.ival = LIST_STAT_MEAN; return(INTEGER_CONSTANT); } -"LIST_STAT_MEDIAN" { count(); yylval.ival = LIST_STAT_MEDIAN; return(INTEGER_CONSTANT); } -"LIST_STAT_STD_DEV" { count(); yylval.ival = LIST_STAT_STD_DEV; return(INTEGER_CONSTANT); } -"LIST_STAT_SUM" { count(); yylval.ival = LIST_STAT_SUM; return(INTEGER_CONSTANT); } -"LIST_STAT_SUM_SQUARES" { count(); yylval.ival = LIST_STAT_SUM_SQUARES; return(INTEGER_CONSTANT); } -"LIST_STAT_NUM_COUNT" { count(); yylval.ival = LIST_STAT_NUM_COUNT; return(INTEGER_CONSTANT); } -"LIST_STAT_GEOMETRIC_MEAN" { count(); yylval.ival = LIST_STAT_GEO_MEAN; return(INTEGER_CONSTANT); } -"LIST_STAT_RANGE" { count(); yylval.ival = LIST_STAT_RANGE; return(INTEGER_CONSTANT); } - -"PAY_HIDE" { count(); yylval.ival = PAY_PRICE_HIDE; return(INTEGER_CONSTANT); } -"PAY_DEFAULT" { count(); yylval.ival = PAY_PRICE_DEFAULT; return(INTEGER_CONSTANT); } - -"PARCEL_FLAG_ALLOW_FLY" { count(); yylval.ival = PF_ALLOW_FLY; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_GROUP_SCRIPTS" { count(); yylval.ival = PF_ALLOW_GROUP_SCRIPTS; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_SCRIPTS" { count(); yylval.ival = PF_ALLOW_OTHER_SCRIPTS; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_LANDMARK" { count(); yylval.ival = PF_ALLOW_LANDMARK; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_TERRAFORM" { count(); yylval.ival = PF_ALLOW_TERRAFORM; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_DAMAGE" { count(); yylval.ival = PF_ALLOW_DAMAGE; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_CREATE_OBJECTS" { count(); yylval.ival = PF_CREATE_OBJECTS; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_CREATE_GROUP_OBJECTS" { count(); yylval.ival = PF_CREATE_GROUP_OBJECTS; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_USE_ACCESS_GROUP" { count(); yylval.ival = PF_USE_ACCESS_GROUP; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_USE_ACCESS_LIST" { count(); yylval.ival = PF_USE_ACCESS_LIST; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_USE_BAN_LIST" { count(); yylval.ival = PF_USE_BAN_LIST; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_USE_LAND_PASS_LIST" { count(); yylval.ival = PF_USE_PASS_LIST; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_LOCAL_SOUND_ONLY" { count(); yylval.ival = PF_SOUND_LOCAL; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_RESTRICT_PUSHOBJECT" { count(); yylval.ival = PF_RESTRICT_PUSHOBJECT; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_GROUP_OBJECT_ENTRY" { count(); yylval.ival = PF_ALLOW_GROUP_OBJECT_ENTRY; return(INTEGER_CONSTANT); } -"PARCEL_FLAG_ALLOW_ALL_OBJECT_ENTRY" { count(); yylval.ival = PF_ALLOW_ALL_OBJECT_ENTRY; return(INTEGER_CONSTANT); } - -"REGION_FLAG_ALLOW_DAMAGE" { count(); yylval.ival = REGION_FLAGS_ALLOW_DAMAGE; return(INTEGER_CONSTANT); } -"REGION_FLAG_FIXED_SUN" { count(); yylval.ival = REGION_FLAGS_SUN_FIXED; return(INTEGER_CONSTANT); } -"REGION_FLAG_BLOCK_TERRAFORM" { count(); yylval.ival = REGION_FLAGS_BLOCK_TERRAFORM; return(INTEGER_CONSTANT); } -"REGION_FLAG_SANDBOX" { count(); yylval.ival = REGION_FLAGS_SANDBOX; return(INTEGER_CONSTANT); } -"REGION_FLAG_DISABLE_COLLISIONS" { count(); yylval.ival = REGION_FLAGS_SKIP_COLLISIONS; return(INTEGER_CONSTANT); } -"REGION_FLAG_DISABLE_PHYSICS" { count(); yylval.ival = REGION_FLAGS_SKIP_PHYSICS; return(INTEGER_CONSTANT); } -"REGION_FLAG_BLOCK_FLY" { count(); yylval.ival = REGION_FLAGS_BLOCK_FLY; return(INTEGER_CONSTANT); } -"REGION_FLAG_BLOCK_FLYOVER" { count(); yylval.ival = REGION_FLAGS_BLOCK_FLYOVER; return(INTEGER_CONSTANT); } -"REGION_FLAG_ALLOW_DIRECT_TELEPORT" { count(); yylval.ival = REGION_FLAGS_ALLOW_DIRECT_TELEPORT; return(INTEGER_CONSTANT); } -"REGION_FLAG_RESTRICT_PUSHOBJECT" { count(); yylval.ival = REGION_FLAGS_RESTRICT_PUSHOBJECT; return(INTEGER_CONSTANT); } - -"HTTP_METHOD" { count(); yylval.ival = HTTP_METHOD; return(INTEGER_CONSTANT); } -"HTTP_MIMETYPE" { count(); yylval.ival = HTTP_MIMETYPE; return(INTEGER_CONSTANT); } -"HTTP_BODY_MAXLENGTH" { count(); yylval.ival = HTTP_BODY_MAXLENGTH; return(INTEGER_CONSTANT); } -"HTTP_BODY_TRUNCATED" { count(); yylval.ival = HTTP_BODY_TRUNCATED; return(INTEGER_CONSTANT); } -"HTTP_VERIFY_CERT" { count(); yylval.ival = HTTP_VERIFY_CERT; return(INTEGER_CONSTANT); } - -"PARCEL_COUNT_TOTAL" { count(); yylval.ival = OC_TOTAL; return(INTEGER_CONSTANT); } -"PARCEL_COUNT_OWNER" { count(); yylval.ival = OC_OWNER; return(INTEGER_CONSTANT); } -"PARCEL_COUNT_GROUP" { count(); yylval.ival = OC_GROUP; return(INTEGER_CONSTANT); } -"PARCEL_COUNT_OTHER" { count(); yylval.ival = OC_OTHER; return(INTEGER_CONSTANT); } -"PARCEL_COUNT_SELECTED" { count(); yylval.ival = OC_SELECTED; return(INTEGER_CONSTANT); } -"PARCEL_COUNT_TEMP" { count(); yylval.ival = OC_TEMP; return(INTEGER_CONSTANT); } - -"PARCEL_DETAILS_NAME" { count(); yylval.ival = PARCEL_DETAILS_NAME; return(INTEGER_CONSTANT); } -"PARCEL_DETAILS_DESC" { count(); yylval.ival = PARCEL_DETAILS_DESC; return(INTEGER_CONSTANT); } -"PARCEL_DETAILS_OWNER" { count(); yylval.ival = PARCEL_DETAILS_OWNER; return(INTEGER_CONSTANT); } -"PARCEL_DETAILS_GROUP" { count(); yylval.ival = PARCEL_DETAILS_GROUP; return(INTEGER_CONSTANT); } -"PARCEL_DETAILS_AREA" { count(); yylval.ival = PARCEL_DETAILS_AREA; return(INTEGER_CONSTANT); } -"PARCEL_DETAILS_ID" { count(); yylval.ival = PARCEL_DETAILS_ID; return(INTEGER_CONSTANT); } -"PARCEL_DETAILS_SEE_AVATARS" { count(); yylval.ival = PARCEL_DETAILS_SEE_AVATARS; return(INTEGER_CONSTANT); } - -"STRING_TRIM_HEAD" { count(); yylval.ival = STRING_TRIM_HEAD; return(INTEGER_CONSTANT); } -"STRING_TRIM_TAIL" { count(); yylval.ival = STRING_TRIM_TAIL; return(INTEGER_CONSTANT); } -"STRING_TRIM" { count(); yylval.ival = STRING_TRIM; return(INTEGER_CONSTANT); } - -"CLICK_ACTION_NONE" { count(); yylval.ival = CLICK_ACTION_NONE; return(INTEGER_CONSTANT); } -"CLICK_ACTION_TOUCH" { count(); yylval.ival = CLICK_ACTION_TOUCH; return(INTEGER_CONSTANT); } -"CLICK_ACTION_SIT" { count(); yylval.ival = CLICK_ACTION_SIT; return(INTEGER_CONSTANT); } -"CLICK_ACTION_BUY" { count(); yylval.ival = CLICK_ACTION_BUY; return(INTEGER_CONSTANT); } -"CLICK_ACTION_PAY" { count(); yylval.ival = CLICK_ACTION_PAY; return(INTEGER_CONSTANT); } -"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); } - -{N}+{E} { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } -{N}*"."{N}+({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } -{N}+"."{N}*({E})?{FS}? { count(); yylval.fval = (F32)atof(yytext); return(FP_CONSTANT); } - -L?\"(\\.|[^\\"])*\" { parse_string(); count(); return(STRING_CONSTANT); } - -"++" { count(); return(INC_OP); } -"--" { count(); return(DEC_OP); } -"+=" { count(); return(ADD_ASSIGN); } -"-=" { count(); return(SUB_ASSIGN); } -"*=" { count(); return(MUL_ASSIGN); } -"/=" { count(); return(DIV_ASSIGN); } -"%=" { count(); return(MOD_ASSIGN); } -";" { count(); return(';'); } -"{" { count(); return('{'); } -"}" { count(); return('}'); } -"," { count(); return(','); } -"=" { count(); return('='); } -"(" { count(); return('('); } -")" { count(); return(')'); } -"-" { count(); return('-'); } -"+" { count(); return('+'); } -"*" { count(); return('*'); } -"/" { count(); return('/'); } -"%" { count(); return('%'); } -"@" { count(); return('@'); } -":" { count(); return(':'); } -">" { count(); return('>'); } -"<" { count(); return('<'); } -"]" { count(); return(']'); } -"[" { count(); return('['); } -"==" { count(); return(EQ); } -"!=" { count(); return(NEQ); } -">=" { count(); return(GEQ); } -"<=" { count(); return(LEQ); } -"&" { count(); return('&'); } -"|" { count(); return('|'); } -"^" { count(); return('^'); } -"~" { count(); return('~'); } -"!" { count(); return('!'); } -"&&" { count(); return(BOOLEAN_AND); } -"||" { count(); return(BOOLEAN_OR); } -"<<" { count(); return(SHIFT_LEFT); } -">>" { count(); return(SHIFT_RIGHT); } - -[ \t\v\n\f] { count(); } -. { /* ignore bad characters */ } - -%% - -LLScriptAllocationManager *gAllocationManager; -LLScriptScript *gScriptp; - -// Prototype for the yacc parser entry point -int yyparse(void); - -int yyerror(const char *fmt, ...) -{ - gErrorToText.writeError(yyout, gLine, gColumn, LSERROR_SYNTAX_ERROR); - return 0; -} - -//#define EMERGENCY_DEBUG_PRINTOUTS -//#define EMIT_CIL_ASSEMBLER - -BOOL lscript_compile(const char* src_filename, const char* dst_filename, - 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; - U64 b_dummy_count = FALSE; - LSCRIPTType type = LST_NULL; - - gInternalColumn = 0; - gInternalLine = 0; - gScriptp = NULL; - - gErrorToText.init(); - init_supported_expressions(); - init_temp_jumps(); - gAllocationManager = new LLScriptAllocationManager(); - - yyin = LLFile::fopen(std::string(src_filename), "r"); - if (yyin) - { - yyout = LLFile::fopen(std::string(err_filename), "w"); - - // Reset the lexer's internal buffering. - - yyrestart(yyin); - - b_parse_ok = !yyparse(); - - if (b_parse_ok) - { -#ifdef EMERGENCY_DEBUG_PRINTOUTS - char compiled[256]; - sprintf(compiled, "%s.o", src_filename); - LLFILE* compfile; - compfile = LLFile::fopen(compiled, "w"); -#endif - - if(dst_filename) - { - gScriptp->setBytecodeDest(dst_filename); - } - - gScriptp->mGodLike = is_god_like; - - gScriptp->setClassName(class_name); - - gScopeStringTable = new LLStringTable(16384); -#ifdef EMERGENCY_DEBUG_PRINTOUTS - gScriptp->recurse(compfile, 0, 4, LSCP_PRETTY_PRINT, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); -#endif - gScriptp->recurse(yyout, 0, 0, LSCP_PRUNE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); - gScriptp->recurse(yyout, 0, 0, LSCP_SCOPE_PASS1, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); - gScriptp->recurse(yyout, 0, 0, LSCP_SCOPE_PASS2, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); - gScriptp->recurse(yyout, 0, 0, LSCP_TYPE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); - if (!gErrorToText.getErrors()) - { - gScriptp->recurse(yyout, 0, 0, LSCP_RESOURCE, LSPRUNE_INVALID, b_dummy, NULL, type, type, b_dummy_count, NULL, NULL, 0, NULL, 0, NULL); -#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 - if(TRUE == compile_to_mono) - { - 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(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; -#ifdef EMERGENCY_DEBUG_PRINTOUTS - fclose(compfile); -#endif - } - fclose(yyout); - fclose(yyin); - } - - delete gAllocationManager; - delete gScopeStringTable; - - return b_parse_ok && !gErrorToText.getErrors(); -} - - -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); - 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); -} - - -S32 yywrap() -{ -#if defined(FLEX_SCANNER) && !defined(LL_WINDOWS) - // get gcc to stop complaining about lack of use of yyunput - (void) yyunput; -#endif - return(1); -} - -void line_comment() -{ - char c; - - while ((c = yyinput()) != '\n' && c != 0 && c != EOF) - ; -} - -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; - - gColumn = gInternalColumn; - gLine = gInternalLine; - - for (i = 0; yytext[i] != '\0'; i++) - if (yytext[i] == '\n') - { - gInternalLine++; - gInternalColumn = 0; - } - else if (yytext[i] == '\t') - gInternalColumn += 4 - (gInternalColumn % 8); - else - gInternalColumn++; -} - -void parse_string() -{ - S32 length = (S32)strlen(yytext); - length = length - 2; - char *temp = yytext + 1; - - S32 i; - S32 escapes = 0; - S32 tabs = 0; - for (i = 0; i < length; i++) - { - if (temp[i] == '\\') - { - escapes++; - i++; - if (temp[i] == 't') - tabs++; - } - } - - S32 newlength = length - escapes + tabs*3; - yylval.sval = new char[newlength + 1]; - - char *dest = yylval.sval; - - for (i = 0; i < length; i++) - { - if (temp[i] == '\\') - { - i++; - // linefeed - if (temp[i] == 'n') - { - *dest++ = 10; - } - else if (temp[i] == 't') - { - *dest++ = ' '; - *dest++ = ' '; - *dest++ = ' '; - *dest++ = ' '; - } - else - { - *dest++ = temp[i]; - } - } - else - { - *dest++ = temp[i]; - } - } - yylval.sval[newlength] = 0; -} diff --git a/indra/lscript/lscript_compile/indra.y b/indra/lscript/lscript_compile/indra.y deleted file mode 100755 index a0a034d21c..0000000000 --- a/indra/lscript/lscript_compile/indra.y +++ /dev/null @@ -1,1791 +0,0 @@ -%{ - #include "linden_common.h" - #include "lscript_tree.h" - - int yylex(void); - int yyparse( void ); - int yyerror(const char *fmt, ...); - - #if LL_LINUX - // broken yacc codegen... --ryan. - #define getenv getenv_workaround - #endif - - #ifdef LL_WINDOWS - #pragma warning (disable : 4702) // warning C4702: unreachable code - #pragma warning( disable : 4065 ) // warning: switch statement contains 'default' but no 'case' labels - #endif - -%} - -%union -{ - S32 ival; - F32 fval; - char *sval; - class LLScriptType *type; - class LLScriptConstant *constant; - class LLScriptIdentifier *identifier; - class LLScriptSimpleAssignable *assignable; - class LLScriptGlobalVariable *global; - class LLScriptEvent *event; - class LLScriptEventHandler *handler; - class LLScriptExpression *expression; - class LLScriptStatement *statement; - class LLScriptGlobalFunctions *global_funcs; - class LLScriptFunctionDec *global_decl; - class LLScriptState *state; - class LLScritpGlobalStorage *global_store; - class LLScriptScript *script; -}; - -%token INTEGER -%token FLOAT_TYPE -%token STRING -%token LLKEY -%token VECTOR -%token QUATERNION -%token LIST - -%token STATE -%token EVENT -%token JUMP -%token RETURN - -%token STATE_ENTRY -%token STATE_EXIT -%token TOUCH_START -%token TOUCH -%token TOUCH_END -%token COLLISION_START -%token COLLISION -%token COLLISION_END -%token LAND_COLLISION_START -%token LAND_COLLISION -%token LAND_COLLISION_END -%token TIMER -%token CHAT -%token SENSOR -%token NO_SENSOR -%token CONTROL -%token AT_TARGET -%token NOT_AT_TARGET -%token AT_ROT_TARGET -%token NOT_AT_ROT_TARGET -%token MONEY -%token EMAIL -%token RUN_TIME_PERMISSIONS -%token INVENTORY -%token ATTACH -%token DATASERVER -%token MOVING_START -%token MOVING_END -%token REZ -%token OBJECT_REZ -%token LINK_MESSAGE -%token REMOTE_DATA -%token HTTP_RESPONSE -%token HTTP_REQUEST - -%token IDENTIFIER -%token STATE_DEFAULT - -%token INTEGER_CONSTANT -%token INTEGER_TRUE -%token INTEGER_FALSE - -%token FP_CONSTANT - -%token STRING_CONSTANT - -%token INC_OP -%token DEC_OP -%token ADD_ASSIGN -%token SUB_ASSIGN -%token MUL_ASSIGN -%token DIV_ASSIGN -%token MOD_ASSIGN - -%token EQ -%token NEQ -%token GEQ -%token LEQ - -%token BOOLEAN_AND -%token BOOLEAN_OR - -%token SHIFT_LEFT -%token SHIFT_RIGHT - -%token IF -%token ELSE -%token FOR -%token DO -%token WHILE - -%token PRINT - -%token PERIOD - -%token ZERO_VECTOR -%token ZERO_ROTATION - -%token TOUCH_INVALID_VECTOR -%token TOUCH_INVALID_TEXCOORD - -%nonassoc LOWER_THAN_ELSE -%nonassoc ELSE - - -%type