summaryrefslogtreecommitdiff
path: root/indra/lscript/lscript_execute.h
diff options
context:
space:
mode:
Diffstat (limited to 'indra/lscript/lscript_execute.h')
-rwxr-xr-x[-rw-r--r--]indra/lscript/lscript_execute.h101
1 files changed, 47 insertions, 54 deletions
diff --git a/indra/lscript/lscript_execute.h b/indra/lscript/lscript_execute.h
index 96855abea0..576c2ca2b7 100644..100755
--- a/indra/lscript/lscript_execute.h
+++ b/indra/lscript/lscript_execute.h
@@ -2,40 +2,35 @@
* @file lscript_execute.h
* @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$
*/
#ifndef LL_LSCRIPT_EXECUTE_H
#define LL_LSCRIPT_EXECUTE_H
+#include "stdtypes.h"
#include "lscript_byteconvert.h"
-#include "linked_lists.h"
#include "lscript_library.h"
+#include "llstl.h"
class LLTimer;
@@ -268,7 +263,7 @@ public:
S32 i, number = bytestream2integer(src, offset);
for (i = 0; i < number; i++)
{
- mEventDataList.addData(new LLScriptDataCollection(src, offset));
+ mEventDataList.push_front(new LLScriptDataCollection(src, offset));
}
}
@@ -277,32 +272,32 @@ public:
S32 i, number = bytestream2integer(src, offset);
for (i = 0; i < number; i++)
{
- mEventDataList.addData(new LLScriptDataCollection(src, offset));
+ mEventDataList.push_front(new LLScriptDataCollection(src, offset));
}
}
~LLScriptEventData()
{
- mEventDataList.deleteAllData();
+ delete_and_clear(mEventDataList);
}
void addEventData(LLScriptDataCollection *data)
{
- if (mEventDataList.getLength() < MAX_EVENTS_IN_QUEUE)
- mEventDataList.addDataAtEnd(data);
+ if (mEventDataList.size() < MAX_EVENTS_IN_QUEUE)
+ mEventDataList.push_back(data);
else
delete data;
}
LLScriptDataCollection *getNextEvent(LSCRIPTStateEventType type)
{
- LLScriptDataCollection *temp;
- for (temp = mEventDataList.getFirstData();
- temp;
- temp = mEventDataList.getNextData())
+ for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+ it != end_it;
+ ++it)
{
+ LLScriptDataCollection* temp = *it;
if (temp->mType == type)
{
- mEventDataList.removeCurrentData();
+ mEventDataList.erase(it);
return temp;
}
}
@@ -311,24 +306,24 @@ public:
LLScriptDataCollection *getNextEvent()
{
LLScriptDataCollection *temp;
- temp = mEventDataList.getFirstData();
+ temp = mEventDataList.front();
if (temp)
{
- mEventDataList.removeCurrentData();
+ mEventDataList.pop_front();
return temp;
}
return NULL;
}
void removeEventType(LSCRIPTStateEventType type)
{
- LLScriptDataCollection *temp;
- for (temp = mEventDataList.getFirstData();
- temp;
- temp = mEventDataList.getNextData())
+ for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+ it != end_it;
+ ++it)
{
- if (temp->mType == type)
+ if ((*it)->mType == type)
{
- mEventDataList.deleteCurrentData();
+ delete *it;
+ mEventDataList.erase(it);
}
}
}
@@ -338,12 +333,11 @@ public:
S32 size = 0;
// number in linked list
size += 4;
- LLScriptDataCollection *temp;
- for (temp = mEventDataList.getFirstData();
- temp;
- temp = mEventDataList.getNextData())
+ for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+ it != end_it;
+ ++it)
{
- size += temp->getSavedSize();
+ size += (*it)->getSavedSize();
}
return size;
}
@@ -352,19 +346,18 @@ public:
{
S32 offset = 0;
// number in linked list
- S32 number = mEventDataList.getLength();
+ S32 number = mEventDataList.size();
integer2bytestream(dest, offset, number);
- LLScriptDataCollection *temp;
- for (temp = mEventDataList.getFirstData();
- temp;
- temp = mEventDataList.getNextData())
+ for (std::list<LLScriptDataCollection*>::iterator it = mEventDataList.begin(), end_it = mEventDataList.end();
+ it != end_it;
+ ++it)
{
- offset += temp->write2bytestream(dest + offset);
+ offset += (*it)->write2bytestream(dest + offset);
}
return offset;
}
- LLLinkedList<LLScriptDataCollection> mEventDataList;
+ std::list<LLScriptDataCollection*> mEventDataList;
};
class LLScriptExecute
@@ -480,9 +473,9 @@ public:
virtual ~LLScriptExecuteLSL2();
virtual S32 getVersion() const {return get_register(mBuffer, LREG_VN);}
- virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();}
+ virtual void deleteAllEvents() {delete_and_clear(mEventData.mEventDataList);}
virtual void addEvent(LLScriptDataCollection* event);
- virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();}
+ virtual U32 getEventCount() {return mEventData.mEventDataList.size();}
virtual void removeEventType(LSCRIPTStateEventType event_type);
virtual S32 getFaults() {return get_register(mBuffer, LREG_FR);}
virtual void setFault(LSCRIPTRunTimeFaults fault) {set_fault(mBuffer, fault);}