diff options
Diffstat (limited to 'indra/lscript/lscript_execute/lscript_execute.cpp')
-rwxr-xr-x[-rw-r--r--] | indra/lscript/lscript_execute/lscript_execute.cpp | 80 |
1 files changed, 34 insertions, 46 deletions
diff --git a/indra/lscript/lscript_execute/lscript_execute.cpp b/indra/lscript/lscript_execute/lscript_execute.cpp index e849fa9a6e..5eb7ffc5a9 100644..100755 --- a/indra/lscript/lscript_execute/lscript_execute.cpp +++ b/indra/lscript/lscript_execute/lscript_execute.cpp @@ -2,31 +2,25 @@ * @file lscript_execute.cpp * @brief classes to execute bytecode * - * $LicenseInfo:firstyear=2002&license=viewergpl$ - * - * Copyright (c) 2002-2009, Linden Research, Inc. - * + * $LicenseInfo:firstyear=2002&license=viewerlgpl$ * Second Life Viewer Source Code - * The source code in this file ("Source Code") is provided by Linden Lab - * to you under the terms of the GNU General Public License, version 2.0 - * ("GPL"), unless you have obtained a separate licensing agreement - * ("Other License"), formally executed by you and Linden Lab. Terms of - * the GPL can be found in doc/GPL-license.txt in this distribution, or - * online at http://secondlifegrid.net/programs/open_source/licensing/gplv2 + * Copyright (C) 2010, Linden Research, Inc. * - * There are special exceptions to the terms and conditions of the GPL as - * it is applied to this Source Code. View the full text of the exception - * in the file doc/FLOSS-exception.txt in this software distribution, or - * online at - * http://secondlifegrid.net/programs/open_source/licensing/flossexception + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; + * version 2.1 of the License only. * - * By copying, modifying or distributing this software, you acknowledge - * that you have read and understood your obligations described above, - * and agree to abide by those obligations. + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. * - * ALL LINDEN LAB SOURCE CODE IS PROVIDED "AS IS." LINDEN LAB MAKES NO - * WARRANTIES, EXPRESS, IMPLIED OR OTHERWISE, REGARDING ITS ACCURACY, - * COMPLETENESS OR PERFORMANCE. + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + * + * Linden Research, Inc., 945 Battery Street, San Francisco, CA 94111 USA * $/LicenseInfo$ */ @@ -41,7 +35,6 @@ #include "lscript_library.h" #include "lscript_heapruntime.h" #include "lscript_alloc.h" -#include "llstat.h" // Static @@ -83,7 +76,7 @@ LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) S32 pos = 0; if (fread(&sizearray, 1, 4, fp) != 4) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; filesize = 0; } else { filesize = bytestream2integer(sizearray, pos); @@ -92,7 +85,7 @@ LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) fseek(fp, 0, SEEK_SET); if (fread(mBuffer, 1, filesize, fp) != filesize) { - llwarns << "Short read" << llendl; + LL_WARNS() << "Short read" << LL_ENDL; } fclose(fp); @@ -296,7 +289,7 @@ void LLScriptExecuteLSL2::init() void LLScriptExecuteLSL2::recordBoundaryError( const LLUUID &id ) { set_fault(mBuffer, LSRF_BOUND_CHECK_ERROR); - llwarns << "Script boundary error for ID " << id << llendl; + LL_WARNS() << "Script boundary error for ID " << id << LL_ENDL; } @@ -424,10 +417,13 @@ void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, const LL void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) { S32 major_version = getMajorVersion(); - LLScriptDataCollection* eventdata; - for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) + for (std::list<LLScriptDataCollection*>::iterator it = mEventData.mEventDataList.begin(), end_it = mEventData.mEventDataList.end(); + it != end_it; + ++it) { + LLScriptDataCollection* eventdata = *it; + if (eventdata->mType == event) { // push a zero to be popped @@ -465,7 +461,8 @@ void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, co S32 opcode_start = get_state_event_opcoode_start(mBuffer, current_state, event); set_ip(mBuffer, opcode_start); - mEventData.mEventDataList.deleteCurrentData(); + delete *it; + mEventData.mEventDataList.erase(it); break; } } @@ -520,7 +517,7 @@ void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, const L } else { - llwarns << "Shit, somehow got an event that we're not registered for!" << llendl; + LL_WARNS() << "Somehow got an event that we're not registered for!" << LL_ENDL; } delete eventdata; } @@ -628,7 +625,7 @@ S32 LLScriptExecuteLSL2::writeState(U8 **dest, U32 header_size, U32 footer_size) // registers integer2bytestream(*dest, dest_offset, registers_size); - // llinfos << "Writing CE: " << getCurrentEvents() << llendl; + // LL_INFOS() << "Writing CE: " << getCurrentEvents() << LL_ENDL; bytestream2bytestream(*dest, dest_offset, mBuffer, src_offset, registers_size); // heap @@ -680,11 +677,11 @@ S32 LLScriptExecuteLSL2::readState(U8 *src) // copy data into register area bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); -// llinfos << "Read CE: " << getCurrentEvents() << llendl; +// LL_INFOS() << "Read CE: " << getCurrentEvents() << LL_ENDL; if (get_register(mBuffer, LREG_TM) != TOP_OF_MEMORY) { - llwarns << "Invalid state. Top of memory register does not match" - << " constant." << llendl; + LL_WARNS() << "Invalid state. Top of memory register does not match" + << " constant." << LL_ENDL; reset_hp_to_safe_spot(mBuffer); return -1; } @@ -812,16 +809,7 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, // is there a fault? // if yes, print out message and exit S32 value = getVersion(); - S32 major_version = 0; - if (value == LSL2_VERSION1_END_NUMBER) - { - major_version = 1; - } - else if (value == LSL2_VERSION_NUMBER) - { - major_version = 2; - } - else + if ( (value != LSL2_VERSION1_END_NUMBER) && (value != LSL2_VERSION_NUMBER) ) { setFault(LSRF_VERSION_MISMATCH); } @@ -4036,7 +4024,7 @@ void lscript_run(const std::string& filename, BOOL b_debug) if (filename.empty()) { - llerrs << "filename is NULL" << llendl; + LL_ERRS() << "filename is NULL" << LL_ENDL; // Just reporting error is likely not enough. Need // to check how to abort or error out gracefully // from this function. XXXTBD @@ -4061,8 +4049,8 @@ void lscript_run(const std::string& filename, BOOL b_debug) F32 time = timer.getElapsedTimeF32(); F32 ips = execute->mInstructionCount / time; - llinfos << execute->mInstructionCount << " instructions in " << time << " seconds" << llendl; - llinfos << ips/1000 << "K instructions per second" << llendl; + LL_INFOS() << execute->mInstructionCount << " instructions in " << time << " seconds" << LL_ENDL; + LL_INFOS() << ips/1000 << "K instructions per second" << LL_ENDL; printf("ip: 0x%X\n", get_register(execute->mBuffer, LREG_IP)); printf("sp: 0x%X\n", get_register(execute->mBuffer, LREG_SP)); printf("bp: 0x%X\n", get_register(execute->mBuffer, LREG_BP)); |