aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript/lscript_library/lscript_library.cpp
diff options
context:
space:
mode:
authorJacek Antonelli2008-08-15 23:44:50 -0500
committerJacek Antonelli2008-08-15 23:44:50 -0500
commit89fe5dab825a62a0e3fd8d248cbc91c65eb2a426 (patch)
treebcff14b7888d04a2fec799c59369f6095224bd08 /linden/indra/lscript/lscript_library/lscript_library.cpp
parentSecond Life viewer sources 1.13.3.2 (diff)
downloadmeta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.zip
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.gz
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.bz2
meta-impy-89fe5dab825a62a0e3fd8d248cbc91c65eb2a426.tar.xz
Second Life viewer sources 1.14.0.0
Diffstat (limited to 'linden/indra/lscript/lscript_library/lscript_library.cpp')
-rw-r--r--linden/indra/lscript/lscript_library/lscript_library.cpp44
1 files changed, 28 insertions, 16 deletions
diff --git a/linden/indra/lscript/lscript_library/lscript_library.cpp b/linden/indra/lscript/lscript_library/lscript_library.cpp
index 1b92608..7263ec3 100644
--- a/linden/indra/lscript/lscript_library/lscript_library.cpp
+++ b/linden/indra/lscript/lscript_library/lscript_library.cpp
@@ -119,7 +119,7 @@ void LLScriptLibrary::init()
119 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetTexture", NULL, "si", "llSetTexture(string texture, integer face)\nsets the texture of face")); 119 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetTexture", NULL, "si", "llSetTexture(string texture, integer face)\nsets the texture of face"));
120 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llScaleTexture", NULL, "ffi", "llScaleTexture(float scales, float scalet, integer face)\nsets the texture s, t scales for the chosen face")); 120 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llScaleTexture", NULL, "ffi", "llScaleTexture(float scales, float scalet, integer face)\nsets the texture s, t scales for the chosen face"));
121 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llOffsetTexture", NULL, "ffi", "llOffsetTexture(float offsets, float offsett, integer face)\nsets the texture s, t offsets for the chosen face")); 121 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llOffsetTexture", NULL, "ffi", "llOffsetTexture(float offsets, float offsett, integer face)\nsets the texture s, t offsets for the chosen face"));
122 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llRotateTexture", NULL, "fi", "llOffsetTexture(float rotation, integer face)\nsets the texture rotation for the chosen face")); 122 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llRotateTexture", NULL, "fi", "llRotateTexture(float rotation, integer face)\nsets the texture rotation for the chosen face"));
123 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTexture", "s", "i", "string llGetTexture(integer face)\ngets the texture of face (if it's a texture in the object inventory, otherwise the key in a string)")); 123 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetTexture", "s", "i", "string llGetTexture(integer face)\ngets the texture of face (if it's a texture in the object inventory, otherwise the key in a string)"));
124 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetPos", NULL, "v", "llSetPos(vector pos)\nsets the position (if the script isn't physical)")); 124 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetPos", NULL, "v", "llSetPos(vector pos)\nsets the position (if the script isn't physical)"));
125 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPos", "v", NULL, "vector llGetPos()\ngets the position (if the script isn't physical)")); 125 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetPos", "v", NULL, "vector llGetPos()\ngets the position (if the script isn't physical)"));
@@ -416,7 +416,14 @@ void LLScriptLibrary::init()
416 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelPrimCount", "i", "vii","integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide)\nGets the number of prims on the parcel of the given category.\nCategories: PARCEL_COUNT_TOTAL, _OWNER, _GROUP, _OTHER, _SELECTED, _TEMP.")); 416 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelPrimCount", "i", "vii","integer llGetParcelPrimCount(vector pos, integer category, integer sim_wide)\nGets the number of prims on the parcel of the given category.\nCategories: PARCEL_COUNT_TOTAL, _OWNER, _GROUP, _OTHER, _SELECTED, _TEMP."));
417 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelMaxPrims", "i", "vi","integer llGetParcelMaxPrims(vector pos, integer sim_wide)\nGets the maximum number of prims allowed on the parcel at pos.")); 417 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelMaxPrims", "i", "vi","integer llGetParcelMaxPrims(vector pos, integer sim_wide)\nGets the maximum number of prims allowed on the parcel at pos."));
418 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelDetails", "l", "vl","list llGetParcelDetails(vector pos, list params)\nGets the parcel details specified in params for the parcel at pos.\nParams is one or more of: PARCEL_DETAILS_NAME, _DESC, _OWNER, _GROUP, _AREA")); 418 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llGetParcelDetails", "l", "vl","list llGetParcelDetails(vector pos, list params)\nGets the parcel details specified in params for the parcel at pos.\nParams is one or more of: PARCEL_DETAILS_NAME, _DESC, _OWNER, _GROUP, _AREA"));
419
420
421 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkPrimitiveParams", NULL, "il", "llSetLinkPrimitiveParams(integer linknumber, list rules)\nSet primitive parameters for linknumber based on rules."));
422 addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkTexture", NULL, "isi", "llSetLinkTexture(integer link_pos, string texture, integer face)\nSets the texture of face for link_pos"));
423
419 424
425 addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llStringTrim", "s", "si", "string llStringTrim(string src, integer trim_type)\nTrim leading and/or trailing spaces from a string.\nUses trim_type of STRING_TRIM, STRING_TRIM_HEAD or STRING_TRIM_TAIL."));
426
420 // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only 427 // energy, sleep, dummy_func, name, return type, parameters, help text, gods-only
421 428
422 // IF YOU ADD NEW SCRIPT CALLS, YOU MUST PUT THEM AT THE END OF THIS LIST. 429 // IF YOU ADD NEW SCRIPT CALLS, YOU MUST PUT THEM AT THE END OF THIS LIST.
@@ -440,10 +447,6 @@ void LLScriptLibrary::init()
440 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLocked", NULL, "i", "llSetCamPositionLocked(TRUE or FALSE)\nLocks the camera position so it will not move")); 447 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamPositionLocked", NULL, "i", "llSetCamPositionLocked(TRUE or FALSE)\nLocks the camera position so it will not move"));
441 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLocked", NULL, "i", "llSetCamFocusLocked(TRUE or FALSE)\nLocks the camera focus so it will not move")); 448 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetCamFocusLocked", NULL, "i", "llSetCamFocusLocked(TRUE or FALSE)\nLocks the camera focus so it will not move"));
442 449
443// These functions are being put on hold until we think through how we want them handled (security issues). DK 02/16/05
444 //addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkPrimitiveParams", NULL, "il", "llSetLinkPrimitiveParams(integer linknumber, list rules)\nSet primitive parameters for linknumber based on rules."));
445 //addFunction(new LLScriptLibraryFunction(10.f, 0.2f, dummy_func, "llSetLinkTexture", NULL, "isi", "llSetLinkTexture(integer link_pos, string texture, integer face)\nSets the texture of face for link_pos"));
446
447 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForSale", "i", "ii", "integer llSetForSale(integer selltype, integer price)\nSets this object for sale in mode selltype for price. Returns TRUE if successfully set for sale.")); 450 //addFunction(new LLScriptLibraryFunction(10.f, 0.f, dummy_func, "llSetForSale", "i", "ii", "integer llSetForSale(integer selltype, integer price)\nSets this object for sale in mode selltype for price. Returns TRUE if successfully set for sale."));
448 451
449LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only) 452LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), char *name, char *ret_type, char *args, char *desc, BOOL god_only)
@@ -452,11 +455,17 @@ LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_fun
452 mDesc = new char[512]; 455 mDesc = new char[512];
453 if (mSleepTime) 456 if (mSleepTime)
454 { 457 {
455 sprintf(mDesc,"%s\nSleeps script for %.1f seconds.",desc,mSleepTime); 458 snprintf( /* Flawfinder: ignore */
459 mDesc,
460 512,
461 "%s\nSleeps script for %.1f seconds.",
462 desc,
463 mSleepTime);
456 } 464 }
457 else 465 else
458 { 466 {
459 strcpy(mDesc,desc); 467 strncpy(mDesc, desc, 512); /* Flawfinder: ignore */
468 mDesc[511] = '\0'; // just in case.
460 } 469 }
461} 470}
462 471
@@ -470,7 +479,10 @@ void LLScriptLibrary::addFunction(LLScriptLibraryFunction *func)
470 LLScriptLibraryFunction **temp = new LLScriptLibraryFunction*[mNextNumber + 1]; 479 LLScriptLibraryFunction **temp = new LLScriptLibraryFunction*[mNextNumber + 1];
471 if (mNextNumber) 480 if (mNextNumber)
472 { 481 {
473 memcpy(temp, mFunctions, sizeof(LLScriptLibraryFunction *)*mNextNumber); 482 memcpy( /* Flawfinder: ignore */
483 temp,
484 mFunctions,
485 sizeof(LLScriptLibraryFunction*)*mNextNumber);
474 delete [] mFunctions; 486 delete [] mFunctions;
475 } 487 }
476 mFunctions = temp; 488 mFunctions = temp;
@@ -492,7 +504,7 @@ void LLScriptLibrary::assignExec(char *name, void (*exec_func)(LLScriptLibData *
492 504
493void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma) 505void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
494{ 506{
495 char tmp[1024]; 507 char tmp[1024]; /*Flawfinder: ignore*/
496 if (b_prepend_comma) 508 if (b_prepend_comma)
497 { 509 {
498 s << ", "; 510 s << ", ";
@@ -503,7 +515,7 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
503 s << mInteger; 515 s << mInteger;
504 break; 516 break;
505 case LST_FLOATINGPOINT: 517 case LST_FLOATINGPOINT:
506 snprintf(tmp, 1024, "%f", mFP); 518 snprintf(tmp, 1024, "%f", mFP); /*Flawfinder: ignore*/
507 s << tmp; 519 s << tmp;
508 break; 520 break;
509 case LST_KEY: 521 case LST_KEY:
@@ -513,12 +525,12 @@ void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
513 s << mString; 525 s << mString;
514 break; 526 break;
515 case LST_VECTOR: 527 case LST_VECTOR:
516 snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], 528 snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
517 mVec.mV[VY], mVec.mV[VZ]); 529 mVec.mV[VY], mVec.mV[VZ]);
518 s << tmp; 530 s << tmp;
519 break; 531 break;
520 case LST_QUATERNION: 532 case LST_QUATERNION:
521 snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], 533 snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
522 mQuat.mQ[VZ], mQuat.mQ[VS]); 534 mQuat.mQ[VZ], mQuat.mQ[VS]);
523 s << tmp; 535 s << tmp;
524 break; 536 break;
@@ -536,7 +548,7 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
536 //print(ostr, FALSE); 548 //print(ostr, FALSE);
537 { 549 {
538 BOOL b_prepend_comma = FALSE; 550 BOOL b_prepend_comma = FALSE;
539 char tmp[1024]; 551 char tmp[1024]; /* Flawfinder: ignore */
540 if (b_prepend_comma) 552 if (b_prepend_comma)
541 { 553 {
542 ostr << ", "; 554 ostr << ", ";
@@ -547,7 +559,7 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
547 ostr << mInteger; 559 ostr << mInteger;
548 break; 560 break;
549 case LST_FLOATINGPOINT: 561 case LST_FLOATINGPOINT:
550 snprintf(tmp, 1024, "%f", mFP); 562 snprintf(tmp, 1024, "%f", mFP); /* Flawfinder: ignore */
551 ostr << tmp; 563 ostr << tmp;
552 break; 564 break;
553 case LST_KEY: 565 case LST_KEY:
@@ -557,12 +569,12 @@ void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, ch
557 ostr << mString; 569 ostr << mString;
558 break; 570 break;
559 case LST_VECTOR: 571 case LST_VECTOR:
560 snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], 572 snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
561 mVec.mV[VY], mVec.mV[VZ]); 573 mVec.mV[VY], mVec.mV[VZ]);
562 ostr << tmp; 574 ostr << tmp;
563 break; 575 break;
564 case LST_QUATERNION: 576 case LST_QUATERNION:
565 snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], 577 snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
566 mQuat.mQ[VZ], mQuat.mQ[VS]); 578 mQuat.mQ[VZ], mQuat.mQ[VS]);
567 ostr << tmp; 579 ostr << tmp;
568 break; 580 break;