aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/lscript')
-rw-r--r--linden/indra/lscript/lscript_byteconvert.h20
-rw-r--r--linden/indra/lscript/lscript_byteformat.h1
-rw-r--r--linden/indra/lscript/lscript_compile/lscript_tree.cpp37
-rw-r--r--linden/indra/lscript/lscript_execute.h57
-rw-r--r--linden/indra/lscript/lscript_execute/lscript_execute.cpp84
-rw-r--r--linden/indra/lscript/lscript_library/lscript_library.cpp1
6 files changed, 129 insertions, 71 deletions
diff --git a/linden/indra/lscript/lscript_byteconvert.h b/linden/indra/lscript/lscript_byteconvert.h
index 9530b63..664a25e 100644
--- a/linden/indra/lscript/lscript_byteconvert.h
+++ b/linden/indra/lscript/lscript_byteconvert.h
@@ -250,7 +250,7 @@ inline void bytestream2vector(LLVector3 &vector, const U8 *stream, S32 &offset)
250 } 250 }
251} 251}
252 252
253inline void vector2bytestream(U8 *stream, S32 &offset, LLVector3 &vector) 253inline void vector2bytestream(U8 *stream, S32 &offset, const LLVector3 &vector)
254{ 254{
255 S32 value = *(S32 *)&vector.mV[VZ]; 255 S32 value = *(S32 *)&vector.mV[VZ];
256 integer2bytestream(stream, offset, value); 256 integer2bytestream(stream, offset, value);
@@ -292,7 +292,7 @@ inline void bytestream2quaternion(LLQuaternion &quat, const U8 *stream, S32 &off
292 } 292 }
293} 293}
294 294
295inline void quaternion2bytestream(U8 *stream, S32 &offset, LLQuaternion &quat) 295inline void quaternion2bytestream(U8 *stream, S32 &offset, const LLQuaternion &quat)
296{ 296{
297 S32 value = *(S32 *)&quat.mQ[VS]; 297 S32 value = *(S32 *)&quat.mQ[VS];
298 integer2bytestream(stream, offset, value); 298 integer2bytestream(stream, offset, value);
@@ -528,7 +528,7 @@ inline void lscript_push(U8 *stream, F32 value)
528 } 528 }
529} 529}
530 530
531inline void lscript_push(U8 *stream, LLVector3 &value) 531inline void lscript_push(U8 *stream, const LLVector3 &value)
532{ 532{
533 S32 sp = get_register(stream, LREG_SP); 533 S32 sp = get_register(stream, LREG_SP);
534 sp -= LSCRIPTDataSize[LST_VECTOR]; 534 sp -= LSCRIPTDataSize[LST_VECTOR];
@@ -539,7 +539,7 @@ inline void lscript_push(U8 *stream, LLVector3 &value)
539 } 539 }
540} 540}
541 541
542inline void lscript_push(U8 *stream, LLQuaternion &value) 542inline void lscript_push(U8 *stream, const LLQuaternion &value)
543{ 543{
544 S32 sp = get_register(stream, LREG_SP); 544 S32 sp = get_register(stream, LREG_SP);
545 sp -= LSCRIPTDataSize[LST_QUATERNION]; 545 sp -= LSCRIPTDataSize[LST_QUATERNION];
@@ -679,13 +679,13 @@ inline void lscript_local_store(U8 *stream, S32 address, F32 value)
679 float2bytestream(stream, address, value); 679 float2bytestream(stream, address, value);
680} 680}
681 681
682inline void lscript_local_store(U8 *stream, S32 address, LLVector3 value) 682inline void lscript_local_store(U8 *stream, S32 address, const LLVector3 value)
683{ 683{
684 if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_VECTOR])) 684 if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_VECTOR]))
685 vector2bytestream(stream, address, value); 685 vector2bytestream(stream, address, value);
686} 686}
687 687
688inline void lscript_local_store(U8 *stream, S32 address, LLQuaternion value) 688inline void lscript_local_store(U8 *stream, S32 address, const LLQuaternion value)
689{ 689{
690 if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_QUATERNION])) 690 if (lscript_check_local(stream, address, LSCRIPTDataSize[LST_QUATERNION]))
691 quaternion2bytestream(stream, address, value); 691 quaternion2bytestream(stream, address, value);
@@ -703,13 +703,13 @@ inline void lscript_global_store(U8 *stream, S32 address, F32 value)
703 float2bytestream(stream, address, value); 703 float2bytestream(stream, address, value);
704} 704}
705 705
706inline void lscript_global_store(U8 *stream, S32 address, LLVector3 value) 706inline void lscript_global_store(U8 *stream, S32 address, const LLVector3 value)
707{ 707{
708 if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_VECTOR])) 708 if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_VECTOR]))
709 vector2bytestream(stream, address, value); 709 vector2bytestream(stream, address, value);
710} 710}
711 711
712inline void lscript_global_store(U8 *stream, S32 address, LLQuaternion value) 712inline void lscript_global_store(U8 *stream, S32 address, const LLQuaternion value)
713{ 713{
714 if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_QUATERNION])) 714 if (lscript_check_global(stream, address, LSCRIPTDataSize[LST_QUATERNION]))
715 quaternion2bytestream(stream, address, value); 715 quaternion2bytestream(stream, address, value);
@@ -1125,7 +1125,7 @@ inline void safe_instruction_bytestream2vector(LLVector3 &value, U8 *stream, S32
1125 } 1125 }
1126} 1126}
1127 1127
1128inline void safe_instruction_vector2bytestream(U8 *stream, S32 &offset, LLVector3 &value) 1128inline void safe_instruction_vector2bytestream(U8 *stream, S32 &offset, const LLVector3 &value)
1129{ 1129{
1130 if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_VECTOR])) 1130 if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_VECTOR]))
1131 { 1131 {
@@ -1141,7 +1141,7 @@ inline void safe_instruction_bytestream2quaternion(LLQuaternion &value, U8 *stre
1141 } 1141 }
1142} 1142}
1143 1143
1144inline void safe_instruction_quaternion2bytestream(U8 *stream, S32 &offset, LLQuaternion &value) 1144inline void safe_instruction_quaternion2bytestream(U8 *stream, S32 &offset, const LLQuaternion &value)
1145{ 1145{
1146 if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_QUATERNION])) 1146 if (safe_instruction_check_address(stream, offset, LSCRIPTDataSize[LST_QUATERNION]))
1147 { 1147 {
diff --git a/linden/indra/lscript/lscript_byteformat.h b/linden/indra/lscript/lscript_byteformat.h
index 1f201d8..fa82e6b 100644
--- a/linden/indra/lscript/lscript_byteformat.h
+++ b/linden/indra/lscript/lscript_byteformat.h
@@ -470,6 +470,7 @@ const U8 LSCRIPTTypeHi4Bits[LST_EOF] =
470 LST_VECTOR << 4, 470 LST_VECTOR << 4,
471 LST_QUATERNION << 4, 471 LST_QUATERNION << 4,
472 LST_LIST << 4, 472 LST_LIST << 4,
473 LST_UNDEFINED << 4,
473}; 474};
474 475
475const char * const LSCRIPTTypeNames[LST_EOF] = /*Flawfinder: ignore*/ 476const char * const LSCRIPTTypeNames[LST_EOF] = /*Flawfinder: ignore*/
diff --git a/linden/indra/lscript/lscript_compile/lscript_tree.cpp b/linden/indra/lscript/lscript_compile/lscript_tree.cpp
index 71e7f19..f62b4e7 100644
--- a/linden/indra/lscript/lscript_compile/lscript_tree.cpp
+++ b/linden/indra/lscript/lscript_compile/lscript_tree.cpp
@@ -46,7 +46,8 @@
46 46
47static void print_cil_box(LLFILE* fp, LSCRIPTType type) 47static void print_cil_box(LLFILE* fp, LSCRIPTType type)
48{ 48{
49 switch(type) 49
50switch(type)
50 { 51 {
51 case LST_INTEGER: 52 case LST_INTEGER:
52 fprintf(fp, "box [mscorlib]System.Int32\n"); 53 fprintf(fp, "box [mscorlib]System.Int32\n");
@@ -1257,10 +1258,10 @@ static void print_cil_init_variable(LLFILE* fp, LSCRIPTType type)
1257 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n"); 1258 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Vector class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateVector'(float32, float32, float32)\n");
1258 break; 1259 break;
1259 case LST_QUATERNION: 1260 case LST_QUATERNION:
1260 fprintf(fp, "ldc.r8 1\n");
1261 fprintf(fp, "ldc.r8 0\n"); 1261 fprintf(fp, "ldc.r8 0\n");
1262 fprintf(fp, "ldc.r8 0\n"); 1262 fprintf(fp, "ldc.r8 0\n");
1263 fprintf(fp, "ldc.r8 0\n"); 1263 fprintf(fp, "ldc.r8 0\n");
1264 fprintf(fp, "ldc.r8 1\n");
1264 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n"); 1265 fprintf(fp, "call class [ScriptTypes]LindenLab.SecondLife.Quaternion class [LslUserScript]LindenLab.SecondLife.LslUserScript::'CreateQuaternion'(float32, float32, float32, float32)\n");
1265 break; 1266 break;
1266 case LST_LIST: 1267 case LST_LIST:
@@ -3517,7 +3518,7 @@ void LLScriptRezEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompile
3517 fprintf(fp, " )\n"); 3518 fprintf(fp, " )\n");
3518 break; 3519 break;
3519 case LSCP_SCOPE_PASS1: 3520 case LSCP_SCOPE_PASS1:
3520 checkForDuplicateHandler(fp, this, scope, "rez"); 3521 checkForDuplicateHandler(fp, this, scope, "on_rez");
3521 if (scope->checkEntry(mStartParam->mName)) 3522 if (scope->checkEntry(mStartParam->mName))
3522 { 3523 {
3523 gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME); 3524 gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME);
@@ -7885,10 +7886,10 @@ void LLScriptFunctionCall::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
7885 { 7886 {
7886 // Prefix function name with g to distinguish from 7887 // Prefix function name with g to distinguish from
7887 // event handlers. 7888 // event handlers.
7888 fprintf(fp, gScriptp->getClassName()); 7889 fprintf(fp, "%s", gScriptp->getClassName());
7889 fprintf(fp, "::'g"); 7890 fprintf(fp, "::'g");
7890 } 7891 }
7891 fprintf(fp, mIdentifier->mName); 7892 fprintf(fp, "%s", mIdentifier->mName);
7892 fprintf(fp, "'("); 7893 fprintf(fp, "'(");
7893 print_cil_arg_list(fp, mIdentifier->mScopeEntry->mFunctionArgs); 7894 print_cil_arg_list(fp, mIdentifier->mScopeEntry->mFunctionArgs);
7894 fprintf(fp, ")\n"); 7895 fprintf(fp, ")\n");
@@ -8689,8 +8690,12 @@ void LLScriptIf::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass p
8689 break; 8690 break;
8690 case LSCP_TYPE: 8691 case LSCP_TYPE:
8691 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8692 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8693 if (type == LST_NULL)
8694 {
8695 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8696 }
8692 mType = type; 8697 mType = type;
8693 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8698 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8694 break; 8699 break;
8695 case LSCP_EMIT_BYTE_CODE: 8700 case LSCP_EMIT_BYTE_CODE:
8696 { 8701 {
@@ -8770,6 +8775,10 @@ void LLScriptIfElse::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePa
8770 break; 8775 break;
8771 case LSCP_TYPE: 8776 case LSCP_TYPE:
8772 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8777 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8778 if (type == LST_NULL)
8779 {
8780 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8781 }
8773 mType = type; 8782 mType = type;
8774 mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8783 mStatement1->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8775 mStatement2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8784 mStatement2->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@@ -8869,6 +8878,10 @@ void LLScriptFor::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass
8869 if(mSequence) 8878 if(mSequence)
8870 mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8879 mSequence->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8871 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8880 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8881 if (type == LST_NULL)
8882 {
8883 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8884 }
8872 mType = type; 8885 mType = type;
8873 if(mExpressionList) 8886 if(mExpressionList)
8874 mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8887 mExpressionList->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@@ -8968,6 +8981,10 @@ void LLScriptDoWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompileP
8968 case LSCP_TYPE: 8981 case LSCP_TYPE:
8969 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8982 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8970 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 8983 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
8984 if (type == LST_NULL)
8985 {
8986 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
8987 }
8971 mType = type; 8988 mType = type;
8972 break; 8989 break;
8973 case LSCP_EMIT_BYTE_CODE: 8990 case LSCP_EMIT_BYTE_CODE:
@@ -9039,6 +9056,10 @@ void LLScriptWhile::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePas
9039 break; 9056 break;
9040 case LSCP_TYPE: 9057 case LSCP_TYPE:
9041 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 9058 mExpression->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
9059 if (type == LST_NULL)
9060 {
9061 gErrorToText.writeError(fp, mExpression, LSERROR_TYPE_MISMATCH);
9062 }
9042 mType = type; 9063 mType = type;
9043 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 9064 mStatement->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
9044 break; 9065 break;
@@ -9720,7 +9741,7 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
9720 // Allows state changing by finding handlers prefixed with new 9741 // Allows state changing by finding handlers prefixed with new
9721 // state name. Prefix disambiguates functions and event handlers. 9742 // state name. Prefix disambiguates functions and event handlers.
9722 fprintf(fp, "e"); 9743 fprintf(fp, "e");
9723 fprintf(fp, entry->mIdentifier); 9744 fprintf(fp, "%s", entry->mIdentifier);
9724 9745
9725 // Handler name and arguments. 9746 // Handler name and arguments.
9726 mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL); 9747 mEventp->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
@@ -10152,7 +10173,7 @@ void LLScriptGlobalFunctions::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPT
10152 fprintf(fp, ".method public hidebysig instance default "); 10173 fprintf(fp, ".method public hidebysig instance default ");
10153 print_cil_type(fp, mType ? mType->mType : LST_NULL); 10174 print_cil_type(fp, mType ? mType->mType : LST_NULL);
10154 fprintf(fp, " 'g"); 10175 fprintf(fp, " 'g");
10155 fprintf(fp, mIdentifier->mName); 10176 fprintf(fp, "%s", mIdentifier->mName);
10156 fprintf(fp, "'"); 10177 fprintf(fp, "'");
10157 if (mParameters) 10178 if (mParameters)
10158 { 10179 {
diff --git a/linden/indra/lscript/lscript_execute.h b/linden/indra/lscript/lscript_execute.h
index ac23ff3..77e9c21 100644
--- a/linden/indra/lscript/lscript_execute.h
+++ b/linden/indra/lscript/lscript_execute.h
@@ -370,7 +370,7 @@ public:
370 LLScriptExecute(); 370 LLScriptExecute();
371 virtual ~LLScriptExecute() {;} 371 virtual ~LLScriptExecute() {;}
372 372
373 virtual S32 getVersion() = 0; 373 virtual S32 getVersion() const = 0;
374 virtual void deleteAllEvents() = 0; 374 virtual void deleteAllEvents() = 0;
375 virtual void addEvent(LLScriptDataCollection* event) = 0; 375 virtual void addEvent(LLScriptDataCollection* event) = 0;
376 virtual U32 getEventCount() = 0; 376 virtual U32 getEventCount() = 0;
@@ -384,12 +384,12 @@ public:
384 virtual void setSleep(F32 value) = 0; 384 virtual void setSleep(F32 value) = 0;
385 virtual F32 getEnergy() const = 0; 385 virtual F32 getEnergy() const = 0;
386 virtual void setEnergy(F32 value) = 0; 386 virtual void setEnergy(F32 value) = 0;
387 virtual U64 getCurrentEvents(S32 version) = 0; 387 virtual U64 getCurrentEvents() = 0;
388 virtual void setCurrentEvents(U64 value, S32 version) = 0; 388 virtual void setCurrentEvents(U64 value) = 0;
389 virtual U64 getEventHandlers(S32 version) = 0; 389 virtual U64 getEventHandlers() = 0;
390 virtual void setEventHandlers(U64 value, S32 version) = 0; 390 virtual void setEventHandlers(U64 value) = 0;
391 virtual U64 getCurrentHandler(S32 version) = 0; 391 virtual U64 getCurrentHandler() = 0;
392 virtual void setCurrentHandler(U64 value, S32 version) = 0; 392 virtual void setCurrentHandler(U64 value) = 0;
393 virtual BOOL isFinished() const = 0; 393 virtual BOOL isFinished() const = 0;
394 virtual BOOL isStateChangePending() const = 0; 394 virtual BOOL isStateChangePending() const = 0;
395 virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size) = 0; // Allocate memory for header, state and footer return size of state. 395 virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size) = 0; // Allocate memory for header, state and footer return size of state.
@@ -409,17 +409,17 @@ public:
409 409
410 // Run handler for event for a maximum of time_slice seconds. 410 // Run handler for event for a maximum of time_slice seconds.
411 // Updates current handler and current events registers. 411 // Updates current handler and current events registers.
412 virtual void callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) = 0;; 412 virtual void callEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) = 0;;
413 413
414 // Run handler for next queued event for maximum of time_slice seconds. 414 // Run handler for next queued event for maximum of time_slice seconds.
415 // Updates current handler and current events registers. 415 // Updates current handler and current events registers.
416 // Removes processed event from queue. 416 // Removes processed event from queue.
417 virtual void callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice) = 0; 417 virtual void callNextQueuedEventHandler(U64 event_register, const LLUUID &id, F32 time_slice) = 0;
418 418
419 // Run handler for event for a maximum of time_slice seconds. 419 // Run handler for event for a maximum of time_slice seconds.
420 // Updates current handler and current events registers. 420 // Updates current handler and current events registers.
421 // Removes processed event from queue. 421 // Removes processed event from queue.
422 virtual void callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) = 0; 422 virtual void callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice) = 0;
423 423
424 // Switch to next state. 424 // Switch to next state.
425 // Returns new set of handled events. 425 // Returns new set of handled events.
@@ -428,14 +428,14 @@ public:
428 // Returns time taken. 428 // Returns time taken.
429 virtual F32 runQuanta(BOOL b_print, const LLUUID &id, 429 virtual F32 runQuanta(BOOL b_print, const LLUUID &id,
430 const char **errorstr, 430 const char **errorstr,
431 BOOL &state_transition, F32 quanta, 431 F32 quanta,
432 U32& events_processed, LLTimer& timer); 432 U32& events_processed, LLTimer& timer);
433 433
434 // Run smallest possible amount of code: an instruction for LSL2, a segment 434 // Run smallest possible amount of code: an instruction for LSL2, a segment
435 // between save tests for Mono 435 // between save tests for Mono
436 void runInstructions(BOOL b_print, const LLUUID &id, 436 void runInstructions(BOOL b_print, const LLUUID &id,
437 const char **errorstr, 437 const char **errorstr,
438 BOOL &state_transition, U32& events_processed, 438 U32& events_processed,
439 F32 quanta); 439 F32 quanta);
440 440
441 bool isYieldDue() const; 441 bool isYieldDue() const;
@@ -443,6 +443,12 @@ public:
443 void setReset(BOOL b) {mReset = b;} 443 void setReset(BOOL b) {mReset = b;}
444 BOOL getReset() const { return mReset; } 444 BOOL getReset() const { return mReset; }
445 445
446 // Called when the script is scheduled to be run from newsim/LLScriptData
447 virtual void startRunning() = 0;
448
449 // Called when the script is scheduled to be stopped from newsim/LLScriptData
450 virtual void stopRunning() = 0;
451
446private: 452private:
447 453
448 BOOL mReset; 454 BOOL mReset;
@@ -455,7 +461,7 @@ public:
455 LLScriptExecuteLSL2(const U8* bytecode, U32 bytecode_size); 461 LLScriptExecuteLSL2(const U8* bytecode, U32 bytecode_size);
456 virtual ~LLScriptExecuteLSL2(); 462 virtual ~LLScriptExecuteLSL2();
457 463
458 virtual S32 getVersion() {return get_register(mBuffer, LREG_VN);} 464 virtual S32 getVersion() const {return get_register(mBuffer, LREG_VN);}
459 virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();} 465 virtual void deleteAllEvents() {mEventData.mEventDataList.deleteAllData();}
460 virtual void addEvent(LLScriptDataCollection* event); 466 virtual void addEvent(LLScriptDataCollection* event);
461 virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();} 467 virtual U32 getEventCount() {return mEventData.mEventDataList.getLength();}
@@ -469,12 +475,12 @@ public:
469 virtual void setSleep(F32 value); 475 virtual void setSleep(F32 value);
470 virtual F32 getEnergy() const; 476 virtual F32 getEnergy() const;
471 virtual void setEnergy(F32 value); 477 virtual void setEnergy(F32 value);
472 virtual U64 getCurrentEvents(S32 version) {return get_event_register(mBuffer, LREG_CE, version);} 478 virtual U64 getCurrentEvents() {return get_event_register(mBuffer, LREG_CE, getMajorVersion());}
473 virtual void setCurrentEvents(U64 value, S32 version) {return set_event_register(mBuffer, LREG_CE, value, version);} 479 virtual void setCurrentEvents(U64 value) {return set_event_register(mBuffer, LREG_CE, value, getMajorVersion());}
474 virtual U64 getEventHandlers(S32 version) {return get_event_register(mBuffer, LREG_ER, version);} 480 virtual U64 getEventHandlers() {return get_event_register(mBuffer, LREG_ER, getMajorVersion());}
475 virtual void setEventHandlers(U64 value, S32 version) {set_event_register(mBuffer, LREG_ER, value, version);} 481 virtual void setEventHandlers(U64 value) {set_event_register(mBuffer, LREG_ER, value, getMajorVersion());}
476 virtual U64 getCurrentHandler(S32 version); 482 virtual U64 getCurrentHandler();
477 virtual void setCurrentHandler(U64 value, S32 version) {return set_event_register(mBuffer, LREG_IE, value, version);} 483 virtual void setCurrentHandler(U64 value) {return set_event_register(mBuffer, LREG_IE, value, getMajorVersion());}
478 virtual BOOL isFinished() const {return get_register(mBuffer, LREG_IP) == 0;} 484 virtual BOOL isFinished() const {return get_register(mBuffer, LREG_IP) == 0;}
479 virtual BOOL isStateChangePending() const {return get_register(mBuffer, LREG_CS) != get_register(mBuffer, LREG_NS);} 485 virtual BOOL isStateChangePending() const {return get_register(mBuffer, LREG_CS) != get_register(mBuffer, LREG_NS);}
480 virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size); // Not including Events. 486 virtual S32 writeState(U8 **dest, U32 header_size, U32 footer_size); // Not including Events.
@@ -494,17 +500,17 @@ public:
494 500
495 // Run handler for event for a maximum of time_slice seconds. 501 // Run handler for event for a maximum of time_slice seconds.
496 // Updates current handler and current events registers. 502 // Updates current handler and current events registers.
497 virtual void callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice); 503 virtual void callEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice);
498 504
499 // Run handler for next queued event for maximum of time_slice seconds. 505 // Run handler for next queued event for maximum of time_slice seconds.
500 // Updates current handler and current events registers. 506 // Updates current handler and current events registers.
501 // Removes processed event from queue. 507 // Removes processed event from queue.
502 virtual void callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice); 508 virtual void callNextQueuedEventHandler(U64 event_register, const LLUUID &id, F32 time_slice);
503 509
504 // Run handler for event for a maximum of time_slice seconds. 510 // Run handler for event for a maximum of time_slice seconds.
505 // Updates current handler and current events registers. 511 // Updates current handler and current events registers.
506 // Removes processed event from queue. 512 // Removes processed event from queue.
507 virtual void callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice); 513 virtual void callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice);
508 514
509 // Switch to next state. 515 // Switch to next state.
510 // Returns new set of handled events. 516 // Returns new set of handled events.
@@ -521,8 +527,15 @@ public:
521 U32 mBytecodeSize; 527 U32 mBytecodeSize;
522 528
523private: 529private:
530 S32 getMajorVersion() const;
524 void recordBoundaryError( const LLUUID &id ); 531 void recordBoundaryError( const LLUUID &id );
525 void setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id ); 532 void setStateEventOpcoodeStartSafely( S32 state, LSCRIPTStateEventType event, const LLUUID &id );
533
534 // Called when the script is scheduled to be run from newsim/LLScriptData
535 virtual void startRunning();
536
537 // Called when the script is scheduled to be stopped from newsim/LLScriptData
538 virtual void stopRunning();
526}; 539};
527 540
528#endif 541#endif
diff --git a/linden/indra/lscript/lscript_execute/lscript_execute.cpp b/linden/indra/lscript/lscript_execute/lscript_execute.cpp
index 3adfe32..2a6f7e3 100644
--- a/linden/indra/lscript/lscript_execute/lscript_execute.cpp
+++ b/linden/indra/lscript/lscript_execute/lscript_execute.cpp
@@ -60,6 +60,9 @@ const char* LSCRIPTRunTimeFaultStrings[LSRF_EOF] = /*Flawfinder: ignore*/
60 "CLI Exception" // LSRF_CLI 60 "CLI Exception" // LSRF_CLI
61}; 61};
62 62
63void LLScriptExecuteLSL2::startRunning() {}
64void LLScriptExecuteLSL2::stopRunning() {}
65
63LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp) 66LLScriptExecuteLSL2::LLScriptExecuteLSL2(LLFILE *fp)
64{ 67{
65 U8 sizearray[4]; 68 U8 sizearray[4];
@@ -327,8 +330,9 @@ void LLScriptExecuteLSL2::resumeEventHandler(BOOL b_print, const LLUUID &id, F32
327 // NOTE: Babbage: all mExecuteFuncs return false. 330 // NOTE: Babbage: all mExecuteFuncs return false.
328} 331}
329 332
330void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) 333void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice)
331{ 334{
335 S32 major_version = getMajorVersion();
332 // push a zero to be popped 336 // push a zero to be popped
333 lscript_push(mBuffer, 0); 337 lscript_push(mBuffer, 0);
334 // push sp as current bp 338 // push sp as current bp
@@ -403,8 +407,9 @@ void LLScriptExecuteLSL2::callEventHandler(LSCRIPTStateEventType event, S32 majo
403// set_ip(mBuffer, opcode_start); 407// set_ip(mBuffer, opcode_start);
404//} 408//}
405 409
406void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, S32 major_version, const LLUUID &id, F32 time_slice) 410void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, const LLUUID &id, F32 time_slice)
407{ 411{
412 S32 major_version = getMajorVersion();
408 LLScriptDataCollection* eventdata; 413 LLScriptDataCollection* eventdata;
409 414
410 for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData()) 415 for (eventdata = mEventData.mEventDataList.getFirstData(); eventdata; eventdata = mEventData.mEventDataList.getNextData())
@@ -452,8 +457,9 @@ void LLScriptExecuteLSL2::callQueuedEventHandler(LSCRIPTStateEventType event, S3
452 } 457 }
453} 458}
454 459
455void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, S32 major_version, const LLUUID &id, F32 time_slice) 460void LLScriptExecuteLSL2::callNextQueuedEventHandler(U64 event_register, const LLUUID &id, F32 time_slice)
456{ 461{
462 S32 major_version = getMajorVersion();
457 LLScriptDataCollection* eventdata = mEventData.getNextEvent(); 463 LLScriptDataCollection* eventdata = mEventData.getNextEvent();
458 if (eventdata) 464 if (eventdata)
459 { 465 {
@@ -541,9 +547,9 @@ void LLScriptExecuteLSL2::setSleep(F32 value)
541} 547}
542 548
543//virtual 549//virtual
544U64 LLScriptExecuteLSL2::getCurrentHandler(S32 version) 550U64 LLScriptExecuteLSL2::getCurrentHandler()
545{ 551{
546 return get_event_register(mBuffer, LREG_IE, version); 552 return get_event_register(mBuffer, LREG_IE, getMajorVersion());
547} 553}
548 554
549//virtual 555//virtual
@@ -724,6 +730,20 @@ void LLScriptExecuteLSL2::reset()
724 bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size); 730 bytestream2bytestream(mBuffer, dest_offset, src, src_offset, size);
725} 731}
726 732
733S32 LLScriptExecuteLSL2::getMajorVersion() const
734{
735 S32 version = getVersion();
736 S32 major_version = 0;
737 if (version == LSL2_VERSION1_END_NUMBER){
738 major_version = 1;
739 }
740 else if (version == LSL2_VERSION_NUMBER)
741 {
742 major_version = 2;
743 }
744 return major_version;
745}
746
727LLScriptExecute::LLScriptExecute() : 747LLScriptExecute::LLScriptExecute() :
728 mReset(FALSE) 748 mReset(FALSE)
729{ 749{
@@ -751,6 +771,10 @@ bool LLScriptExecute::isYieldDue() const
751 return true; 771 return true;
752 } 772 }
753 773
774 // State changes can occur within a single time slice,
775 // but LLScriptData's clean up is required. Yield here
776 // to allow LLScriptData to perform cleanup and then call
777 // runQuanta again.
754 if(isStateChangePending()) 778 if(isStateChangePending())
755 { 779 {
756 return true; 780 return true;
@@ -763,7 +787,6 @@ bool LLScriptExecute::isYieldDue() const
763// a single instruction for LSL2, a segment between save tests for Mono 787// a single instruction for LSL2, a segment between save tests for Mono
764void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id, 788void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id,
765 const char **errorstr, 789 const char **errorstr,
766 BOOL &state_transition,
767 U32& events_processed, 790 U32& events_processed,
768 F32 quanta) 791 F32 quanta)
769{ 792{
@@ -806,17 +829,15 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id,
806 else 829 else
807 { 830 {
808 // make sure that IE is zero 831 // make sure that IE is zero
809 setCurrentHandler(0, major_version); 832 setCurrentHandler(0);
810 833
811 // if no, we're in a state and waiting for an event 834 // if no, we're in a state and waiting for an event
812 U64 current_events = getCurrentEvents(major_version); 835 U64 current_events = getCurrentEvents();
813 U64 event_register = getEventHandlers(major_version); 836 U64 event_register = getEventHandlers();
814 837
815 // check NS to see if need to switch states (NS != CS) 838 // check NS to see if need to switch states (NS != CS)
816 if (isStateChangePending()) 839 if (isStateChangePending())
817 { 840 {
818 state_transition = TRUE;
819
820 // ok, blow away any pending events 841 // ok, blow away any pending events
821 deleteAllEvents(); 842 deleteAllEvents();
822 843
@@ -824,16 +845,16 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id,
824 if (current_events & LSCRIPTStateBitField[LSTT_STATE_EXIT]) 845 if (current_events & LSCRIPTStateBitField[LSTT_STATE_EXIT])
825 { 846 {
826 // if yes, clear state exit flag 847 // if yes, clear state exit flag
827 setCurrentHandler(LSCRIPTStateBitField[LSTT_STATE_EXIT], major_version); 848 setCurrentHandler(LSCRIPTStateBitField[LSTT_STATE_EXIT]);
828 current_events &= ~LSCRIPTStateBitField[LSTT_STATE_EXIT]; 849 current_events &= ~LSCRIPTStateBitField[LSTT_STATE_EXIT];
829 setCurrentEvents(current_events, major_version); 850 setCurrentEvents(current_events);
830 851
831 // check state exit event handler 852 // check state exit event handler
832 // if there is a handler, call it 853 // if there is a handler, call it
833 if (event_register & LSCRIPTStateBitField[LSTT_STATE_EXIT]) 854 if (event_register & LSCRIPTStateBitField[LSTT_STATE_EXIT])
834 { 855 {
835 ++events_processed; 856 ++events_processed;
836 callEventHandler(LSTT_STATE_EXIT, major_version, id, quanta); 857 callEventHandler(LSTT_STATE_EXIT, id, quanta);
837 return; 858 return;
838 } 859 }
839 } 860 }
@@ -841,32 +862,32 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id,
841 // if no handler or no state exit flag switch to new state 862 // if no handler or no state exit flag switch to new state
842 // set state entry flag and clear other CE flags 863 // set state entry flag and clear other CE flags
843 current_events = LSCRIPTStateBitField[LSTT_STATE_ENTRY]; 864 current_events = LSCRIPTStateBitField[LSTT_STATE_ENTRY];
844 setCurrentEvents(current_events, major_version); 865 setCurrentEvents(current_events);
845 866
846 U64 handled_events = nextState(); 867 U64 handled_events = nextState();
847 setEventHandlers(handled_events, major_version); 868 setEventHandlers(handled_events);
848 } 869 }
849 870
850 // try to get next event from stack 871 // try to get next event from stack
851 BOOL b_done = FALSE; 872 BOOL b_done = FALSE;
852 LSCRIPTStateEventType event = LSTT_NULL; 873 LSCRIPTStateEventType event = LSTT_NULL;
853 874
854 current_events = getCurrentEvents(major_version); 875 current_events = getCurrentEvents();
855 event_register = getEventHandlers(major_version); 876 event_register = getEventHandlers();
856 877
857 // first, check to see if state_entry or onrez are raised and handled 878 // first, check to see if state_entry or onrez are raised and handled
858 if ((current_events & LSCRIPTStateBitField[LSTT_STATE_ENTRY]) 879 if ((current_events & LSCRIPTStateBitField[LSTT_STATE_ENTRY])
859 &&(current_events & event_register)) 880 &&(current_events & event_register))
860 { 881 {
861 ++events_processed; 882 ++events_processed;
862 callEventHandler(LSTT_STATE_ENTRY, major_version, id, quanta); 883 callEventHandler(LSTT_STATE_ENTRY, id, quanta);
863 b_done = TRUE; 884 b_done = TRUE;
864 } 885 }
865 else if ((current_events & LSCRIPTStateBitField[LSTT_REZ]) 886 else if ((current_events & LSCRIPTStateBitField[LSTT_REZ])
866 &&(current_events & event_register)) 887 &&(current_events & event_register))
867 { 888 {
868 ++events_processed; 889 ++events_processed;
869 callQueuedEventHandler(LSTT_REZ, major_version, id, quanta); 890 callQueuedEventHandler(LSTT_REZ, id, quanta);
870 b_done = TRUE; 891 b_done = TRUE;
871 } 892 }
872 893
@@ -876,7 +897,7 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id,
876 if(getEventCount() > 0) 897 if(getEventCount() > 0)
877 { 898 {
878 ++events_processed; 899 ++events_processed;
879 callNextQueuedEventHandler(event_register, major_version, id, quanta); 900 callNextQueuedEventHandler(event_register, id, quanta);
880 b_done = TRUE; 901 b_done = TRUE;
881 } 902 }
882 else 903 else
@@ -887,7 +908,7 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id,
887 { 908 {
888 event = return_first_event((S32)handled_current); 909 event = return_first_event((S32)handled_current);
889 ++events_processed; 910 ++events_processed;
890 callEventHandler(event, major_version, id, quanta); 911 callEventHandler(event, id, quanta);
891 } 912 }
892 b_done = TRUE; 913 b_done = TRUE;
893 } 914 }
@@ -895,8 +916,8 @@ void LLScriptExecute::runInstructions(BOOL b_print, const LLUUID &id,
895 } 916 }
896} 917}
897 918
898// Run for a single timeslice, or until a yield is due 919// Run for a single timeslice, or until a yield or state transition is due
899F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **errorstr, BOOL &state_transition, F32 quanta, U32& events_processed, LLTimer& timer) 920F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **errorstr, F32 quanta, U32& events_processed, LLTimer& timer)
900{ 921{
901 U32 timer_checks = 0; 922 U32 timer_checks = 0;
902 F32 inloop = 0; 923 F32 inloop = 0;
@@ -907,7 +928,7 @@ F32 LLScriptExecute::runQuanta(BOOL b_print, const LLUUID &id, const char **erro
907 // on current execution speed. 928 // on current execution speed.
908 while(true) 929 while(true)
909 { 930 {
910 runInstructions(b_print, id, errorstr, state_transition, 931 runInstructions(b_print, id, errorstr,
911 events_processed, quanta); 932 events_processed, quanta);
912 933
913 static const S32 lsl_timer_check_skip = 4; 934 static const S32 lsl_timer_check_skip = 4;
@@ -3277,7 +3298,7 @@ BOOL run_state(U8 *buffer, S32 &offset, BOOL b_print, const LLUUID &id)
3277 { 3298 {
3278 major_version = 2; 3299 major_version = 2;
3279 } 3300 }
3280 3301
3281 S32 current_state = get_register(buffer, LREG_CS); 3302 S32 current_state = get_register(buffer, LREG_CS);
3282 if (state != current_state) 3303 if (state != current_state)
3283 { 3304 {
@@ -3985,7 +4006,6 @@ void lscript_run(const std::string& filename, BOOL b_debug)
3985 LLTimer timer; 4006 LLTimer timer;
3986 4007
3987 const char *error; 4008 const char *error;
3988 BOOL b_state;
3989 LLScriptExecuteLSL2 *execute = NULL; 4009 LLScriptExecuteLSL2 *execute = NULL;
3990 4010
3991 if (filename.empty()) 4011 if (filename.empty())
@@ -4009,7 +4029,7 @@ void lscript_run(const std::string& filename, BOOL b_debug)
4009 4029
4010 do { 4030 do {
4011 LLTimer timer2; 4031 LLTimer timer2;
4012 execute->runQuanta(b_debug, LLUUID::null, &error, b_state, 4032 execute->runQuanta(b_debug, LLUUID::null, &error,
4013 time_slice, events_processed, timer2); 4033 time_slice, events_processed, timer2);
4014 } while (!execute->isFinished()); 4034 } while (!execute->isFinished());
4015 4035
@@ -4044,7 +4064,8 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type)
4044 break; 4064 break;
4045 case 'k': 4065 case 'k':
4046 data->mType = LST_KEY; 4066 data->mType = LST_KEY;
4047 4067 data->mKey = NULL;
4068
4048 base_address = lscript_pop_int(buffer); 4069 base_address = lscript_pop_int(buffer);
4049 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization 4070 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
4050 // and function clean up of ref counts isn't based on scope (a mistake, I know) 4071 // and function clean up of ref counts isn't based on scope (a mistake, I know)
@@ -4063,7 +4084,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type)
4063 } 4084 }
4064 lsa_decrease_ref_count(buffer, base_address); 4085 lsa_decrease_ref_count(buffer, base_address);
4065 } 4086 }
4066 else 4087 if (data->mKey == NULL)
4067 { 4088 {
4068 data->mKey = new char[1]; 4089 data->mKey = new char[1];
4069 data->mKey[0] = 0; 4090 data->mKey[0] = 0;
@@ -4071,6 +4092,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type)
4071 break; 4092 break;
4072 case 's': 4093 case 's':
4073 data->mType = LST_STRING; 4094 data->mType = LST_STRING;
4095 data->mString = NULL;
4074 4096
4075 base_address = lscript_pop_int(buffer); 4097 base_address = lscript_pop_int(buffer);
4076 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization 4098 // this bit of nastiness is to get around that code paths to local variables can result in lack of initialization
@@ -4090,7 +4112,7 @@ void lscript_pop_variable(LLScriptLibData *data, U8 *buffer, char type)
4090 } 4112 }
4091 lsa_decrease_ref_count(buffer, base_address); 4113 lsa_decrease_ref_count(buffer, base_address);
4092 } 4114 }
4093 else 4115 if (data->mString == NULL)
4094 { 4116 {
4095 data->mString = new char[1]; 4117 data->mString = new char[1];
4096 data->mString[0] = 0; 4118 data->mString[0] = 0;
diff --git a/linden/indra/lscript/lscript_library/lscript_library.cpp b/linden/indra/lscript/lscript_library/lscript_library.cpp
index e7d8284..505b123 100644
--- a/linden/indra/lscript/lscript_library/lscript_library.cpp
+++ b/linden/indra/lscript/lscript_library/lscript_library.cpp
@@ -448,6 +448,7 @@ void LLScriptLibrary::init()
448 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchBinormal", "v", "i", "vector llDetectedTouchBinormal(integer number)\nreturns the surface binormal for a triggered touch event")); 448 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchBinormal", "v", "i", "vector llDetectedTouchBinormal(integer number)\nreturns the surface binormal for a triggered touch event"));
449 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchST", "v", "i", "vector llDetectedTouchST(integer number)\nreturns the s and t coordinates in the first two components of a vector, for a triggered touch event")); 449 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llDetectedTouchST", "v", "i", "vector llDetectedTouchST(integer number)\nreturns the s and t coordinates in the first two components of a vector, for a triggered touch event"));
450 450
451 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSHA1String", "s", "s", "string llSHA1String(string sr)\nPerforms a SHA1 security Hash. Returns a 40 character hex string."));
451 452
452 453
453 // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only 454 // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only