PageRenderTime 109ms CodeModel.GetById 12ms app.highlight 90ms RepoModel.GetById 1ms app.codeStats 0ms

/indra/lscript/lscript_library/lscript_library.cpp

https://bitbucket.org/lindenlab/viewer-beta/
C++ | 582 lines | 479 code | 54 blank | 49 comment | 7 complexity | b739e4d1e4fcd7fd6e94e2e67dd1b89e MD5 | raw file
  1/** 
  2 * @file lscript_library.cpp
  3 * @brief external library interface
  4 *
  5 * $LicenseInfo:firstyear=2002&license=viewerlgpl$
  6 * Second Life Viewer Source Code
  7 * Copyright (C) 2010, Linden Research, Inc.
  8 * 
  9 * This library is free software; you can redistribute it and/or
 10 * modify it under the terms of the GNU Lesser General Public
 11 * License as published by the Free Software Foundation;
 12 * version 2.1 of the License only.
 13 * 
 14 * This library is distributed in the hope that it will be useful,
 15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 17 * Lesser General Public License for more details.
 18 * 
 19 * You should have received a copy of the GNU Lesser General Public
 20 * License along with this library; if not, write to the Free Software
 21 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 22 * 
 23 * Linden Research, Inc., 945 Battery Street, San Francisco, CA  94111  USA
 24 * $/LicenseInfo$
 25 */
 26
 27
 28//  ##      ##    ###    ########  ##    ## #### ##    ##  ######   #### ####
 29//  ##  ##  ##   ## ##   ##     ## ###   ##  ##  ###   ## ##    ##  #### ####
 30//  ##  ##  ##  ##   ##  ##     ## ####  ##  ##  ####  ## ##        #### ####
 31//  ##  ##  ## ##     ## ########  ## ## ##  ##  ## ## ## ##   ####  ##   ##
 32//  ##  ##  ## ######### ##   ##   ##  ####  ##  ##  #### ##    ##
 33//  ##  ##  ## ##     ## ##    ##  ##   ###  ##  ##   ### ##    ##  #### ####
 34//   ###  ###  ##     ## ##     ## ##    ## #### ##    ##  ######   #### #### 
 35//
 36// When adding functions, they <b>MUST</b> be appended to the end of
 37// the init() method. The init() associates the name with a number,
 38// which is then serialized into the bytecode. Inserting a new
 39// function in the middle will lead to many sim crashes. Phoenix 2006-04-10.
 40
 41#include "linden_common.h"
 42
 43#include "lscript_library.h"
 44
 45LLScriptLibrary::LLScriptLibrary()
 46{
 47	init();
 48}
 49
 50LLScriptLibrary::~LLScriptLibrary()
 51{
 52}
 53
 54void dummy_func(LLScriptLibData *retval, LLScriptLibData *args, const LLUUID &id)
 55{
 56}
 57
 58void LLScriptLibrary::init()
 59{
 60	// IF YOU ADD NEW SCRIPT CALLS, YOU MUST PUT THEM AT THE END OF THIS LIST.
 61	// Otherwise the bytecode numbers for each call will be wrong, and all
 62	// existing scripts will crash.
 63
 64	// energy, sleep, dummy_func, name, return type, parameters, gods-only
 65	addFunction(10.f, 0.f, dummy_func, "llSin", "f", "f");
 66	addFunction(10.f, 0.f, dummy_func, "llCos", "f", "f");
 67	addFunction(10.f, 0.f, dummy_func, "llTan", "f", "f");
 68	addFunction(10.f, 0.f, dummy_func, "llAtan2", "f", "ff");
 69	addFunction(10.f, 0.f, dummy_func, "llSqrt", "f", "f");
 70	addFunction(10.f, 0.f, dummy_func, "llPow", "f", "ff");
 71	addFunction(10.f, 0.f, dummy_func, "llAbs", "i", "i");
 72	addFunction(10.f, 0.f, dummy_func, "llFabs", "f", "f");
 73	addFunction(10.f, 0.f, dummy_func, "llFrand", "f", "f");
 74	addFunction(10.f, 0.f, dummy_func, "llFloor", "i", "f");
 75	addFunction(10.f, 0.f, dummy_func, "llCeil", "i", "f");
 76	addFunction(10.f, 0.f, dummy_func, "llRound", "i", "f");
 77	addFunction(10.f, 0.f, dummy_func, "llVecMag", "f", "v");
 78	addFunction(10.f, 0.f, dummy_func, "llVecNorm", "v", "v");
 79	addFunction(10.f, 0.f, dummy_func, "llVecDist", "f", "vv");
 80	addFunction(10.f, 0.f, dummy_func, "llRot2Euler", "v", "q");
 81	addFunction(10.f, 0.f, dummy_func, "llEuler2Rot", "q", "v");
 82	addFunction(10.f, 0.f, dummy_func, "llAxes2Rot", "q", "vvv");
 83	addFunction(10.f, 0.f, dummy_func, "llRot2Fwd", "v", "q");
 84	addFunction(10.f, 0.f, dummy_func, "llRot2Left", "v", "q");
 85	addFunction(10.f, 0.f, dummy_func, "llRot2Up", "v", "q");
 86	addFunction(10.f, 0.f, dummy_func, "llRotBetween", "q", "vv");
 87	addFunction(10.f, 0.f, dummy_func, "llWhisper", NULL, "is");
 88	addFunction(10.f, 0.f, dummy_func, "llSay", NULL, "is");
 89	addFunction(10.f, 0.f, dummy_func, "llShout", NULL, "is");
 90	addFunction(10.f, 0.f, dummy_func, "llListen", "i", "isks");
 91	addFunction(10.f, 0.f, dummy_func, "llListenControl", NULL, "ii");
 92	addFunction(10.f, 0.f, dummy_func, "llListenRemove", NULL, "i");
 93	addFunction(10.f, 0.f, dummy_func, "llSensor", NULL, "skiff");
 94	addFunction(10.f, 0.f, dummy_func, "llSensorRepeat", NULL, "skifff");
 95	addFunction(10.f, 0.f, dummy_func, "llSensorRemove", NULL, NULL);
 96	addFunction(10.f, 0.f, dummy_func, "llDetectedName", "s", "i");
 97	addFunction(10.f, 0.f, dummy_func, "llDetectedKey", "k", "i");
 98	addFunction(10.f, 0.f, dummy_func, "llDetectedOwner", "k", "i");
 99	addFunction(10.f, 0.f, dummy_func, "llDetectedType", "i", "i");
100	addFunction(10.f, 0.f, dummy_func, "llDetectedPos", "v", "i");
101	addFunction(10.f, 0.f, dummy_func, "llDetectedVel", "v", "i");
102	addFunction(10.f, 0.f, dummy_func, "llDetectedGrab", "v", "i");
103	addFunction(10.f, 0.f, dummy_func, "llDetectedRot", "q", "i");
104	addFunction(10.f, 0.f, dummy_func, "llDetectedGroup", "i", "i");
105	addFunction(10.f, 0.f, dummy_func, "llDetectedLinkNumber", "i", "i");
106	addFunction(0.f, 0.f, dummy_func, "llDie", NULL, NULL);
107	addFunction(10.f, 0.f, dummy_func, "llGround", "f", "v");
108	addFunction(10.f, 0.f, dummy_func, "llCloud", "f", "v");
109	addFunction(10.f, 0.f, dummy_func, "llWind", "v", "v");
110	addFunction(10.f, 0.f, dummy_func, "llSetStatus", NULL, "ii");
111	addFunction(10.f, 0.f, dummy_func, "llGetStatus", "i", "i");
112	addFunction(10.f, 0.f, dummy_func, "llSetScale", NULL, "v");
113	addFunction(10.f, 0.f, dummy_func, "llGetScale", "v", NULL);
114	addFunction(10.f, 0.f, dummy_func, "llSetColor", NULL, "vi");
115	addFunction(10.f, 0.f, dummy_func, "llGetAlpha", "f", "i");
116	addFunction(10.f, 0.f, dummy_func, "llSetAlpha", NULL, "fi");
117	addFunction(10.f, 0.f, dummy_func, "llGetColor", "v", "i");
118	addFunction(10.f, 0.2f, dummy_func, "llSetTexture", NULL, "si");
119	addFunction(10.f, 0.2f, dummy_func, "llScaleTexture", NULL, "ffi");
120	addFunction(10.f, 0.2f, dummy_func, "llOffsetTexture", NULL, "ffi");
121	addFunction(10.f, 0.2f, dummy_func, "llRotateTexture", NULL, "fi");
122	addFunction(10.f, 0.f, dummy_func, "llGetTexture", "s", "i");
123	addFunction(10.f, 0.2f, dummy_func, "llSetPos", NULL, "v");
124	addFunction(10.f, 0.f, dummy_func, "llGetPos", "v", NULL);
125	addFunction(10.f, 0.f, dummy_func, "llGetLocalPos", "v", NULL);
126	addFunction(10.f, 0.2f, dummy_func, "llSetRot", NULL, "q");
127	addFunction(10.f, 0.f, dummy_func, "llGetRot", "q", NULL);
128	addFunction(10.f, 0.f, dummy_func, "llGetLocalRot", "q", NULL);
129	addFunction(10.f, 0.f, dummy_func, "llSetForce", NULL, "vi");
130	addFunction(10.f, 0.f, dummy_func, "llGetForce", "v", NULL);
131	addFunction(10.f, 0.f, dummy_func, "llTarget", "i", "vf");
132	addFunction(10.f, 0.f, dummy_func, "llTargetRemove", NULL, "i");
133	addFunction(10.f, 0.f, dummy_func, "llRotTarget", "i", "qf");
134	addFunction(10.f, 0.f, dummy_func, "llRotTargetRemove", NULL, "i");
135	addFunction(10.f, 0.f, dummy_func, "llMoveToTarget", NULL, "vf");
136	addFunction(10.f, 0.f, dummy_func, "llStopMoveToTarget", NULL, NULL);
137	addFunction(10.f, 0.f, dummy_func, "llApplyImpulse", NULL, "vi");
138	addFunction(10.f, 0.f, dummy_func, "llApplyRotationalImpulse", NULL, "vi");
139	addFunction(10.f, 0.f, dummy_func, "llSetTorque", NULL, "vi");
140	addFunction(10.f, 0.f, dummy_func, "llGetTorque", "v", NULL);
141	addFunction(10.f, 0.f, dummy_func, "llSetForceAndTorque", NULL, "vvi");
142	addFunction(10.f, 0.f, dummy_func, "llGetVel", "v", NULL);
143	addFunction(10.f, 0.f, dummy_func, "llGetAccel", "v", NULL);
144	addFunction(10.f, 0.f, dummy_func, "llGetOmega", "v", NULL);
145	addFunction(10.f, 0.f, dummy_func, "llGetTimeOfDay", "f", "");
146	addFunction(10.f, 0.f, dummy_func, "llGetWallclock", "f", "");
147	addFunction(10.f, 0.f, dummy_func, "llGetTime", "f", NULL);
148	addFunction(10.f, 0.f, dummy_func, "llResetTime", NULL, NULL);
149	addFunction(10.f, 0.f, dummy_func, "llGetAndResetTime", "f", NULL);
150	addFunction(10.f, 0.f, dummy_func, "llSound", NULL, "sfii");
151	addFunction(10.f, 0.f, dummy_func, "llPlaySound", NULL, "sf");
152	addFunction(10.f, 0.f, dummy_func, "llLoopSound", NULL, "sf");
153	addFunction(10.f, 0.f, dummy_func, "llLoopSoundMaster", NULL, "sf");
154	addFunction(10.f, 0.f, dummy_func, "llLoopSoundSlave", NULL, "sf");
155	addFunction(10.f, 0.f, dummy_func, "llPlaySoundSlave", NULL, "sf");
156	addFunction(10.f, 0.f, dummy_func, "llTriggerSound", NULL, "sf");
157	addFunction(10.f, 0.f, dummy_func, "llStopSound", NULL, "");
158	addFunction(10.f, 1.f, dummy_func, "llPreloadSound", NULL, "s");
159	addFunction(10.f, 0.f, dummy_func, "llGetSubString", "s", "sii");
160	addFunction(10.f, 0.f, dummy_func, "llDeleteSubString", "s", "sii");
161	addFunction(10.f, 0.f, dummy_func, "llInsertString", "s", "sis");
162	addFunction(10.f, 0.f, dummy_func, "llToUpper", "s", "s");
163	addFunction(10.f, 0.f, dummy_func, "llToLower", "s", "s");
164	addFunction(10.f, 0.f, dummy_func, "llGiveMoney", "i", "ki");
165	addFunction(10.f, 0.1f, dummy_func, "llMakeExplosion", NULL, "iffffsv");
166	addFunction(10.f, 0.1f, dummy_func, "llMakeFountain", NULL, "iffffisvf");
167	addFunction(10.f, 0.1f, dummy_func, "llMakeSmoke", NULL, "iffffsv");
168	addFunction(10.f, 0.1f, dummy_func, "llMakeFire", NULL, "iffffsv");
169	addFunction(200.f, 0.1f, dummy_func, "llRezObject", NULL, "svvqi");
170	addFunction(10.f, 0.f, dummy_func, "llLookAt", NULL, "vff");
171	addFunction(10.f, 0.f, dummy_func, "llStopLookAt", NULL, NULL);
172	addFunction(10.f, 0.f, dummy_func, "llSetTimerEvent", NULL, "f");
173	addFunction(0.f, 0.f, dummy_func, "llSleep", NULL, "f");
174	addFunction(10.f, 0.f, dummy_func, "llGetMass", "f", NULL);
175	addFunction(10.f, 0.f, dummy_func, "llCollisionFilter", NULL, "ski");
176	addFunction(10.f, 0.f, dummy_func, "llTakeControls", NULL, "iii");
177	addFunction(10.f, 0.f, dummy_func, "llReleaseControls", NULL, NULL);
178	addFunction(10.f, 0.f, dummy_func, "llAttachToAvatar", NULL, "i");
179	addFunction(10.f, 0.f, dummy_func, "llDetachFromAvatar", NULL, NULL);
180	addFunction(10.f, 0.f, dummy_func, "llTakeCamera", NULL, "k");
181	addFunction(10.f, 0.f, dummy_func, "llReleaseCamera", NULL, "k");
182	addFunction(10.f, 0.f, dummy_func, "llGetOwner", "k", NULL);
183	addFunction(10.f, 2.f, dummy_func, "llInstantMessage", NULL, "ks");
184	addFunction(10.f, 20.f, dummy_func, "llEmail", NULL, "sss");
185	addFunction(10.f, 0.f, dummy_func, "llGetNextEmail", NULL, "ss");
186	addFunction(10.f, 0.f, dummy_func, "llGetKey", "k", NULL);
187	addFunction(10.f, 0.f, dummy_func, "llSetBuoyancy", NULL, "f");
188	addFunction(10.f, 0.f, dummy_func, "llSetHoverHeight", NULL, "fif");
189	addFunction(10.f, 0.f, dummy_func, "llStopHover", NULL, NULL);
190	addFunction(10.f, 0.f, dummy_func, "llMinEventDelay", NULL, "f");
191	addFunction(10.f, 0.f, dummy_func, "llSoundPreload", NULL, "s");
192	addFunction(10.f, 0.f, dummy_func, "llRotLookAt", NULL, "qff");
193	addFunction(10.f, 0.f, dummy_func, "llStringLength", "i", "s");
194	addFunction(10.f, 0.f, dummy_func, "llStartAnimation", NULL, "s");
195	addFunction(10.f, 0.f, dummy_func, "llStopAnimation", NULL, "s");
196	addFunction(10.f, 0.f, dummy_func, "llPointAt", NULL, "v");
197	addFunction(10.f, 0.f, dummy_func, "llStopPointAt", NULL, NULL);
198	addFunction(10.f, 0.f, dummy_func, "llTargetOmega", NULL, "vff");
199	addFunction(10.f, 0.f, dummy_func, "llGetStartParameter", "i", NULL);
200	addFunction(10.f, 0.f, dummy_func, "llGodLikeRezObject", NULL, "kv", TRUE);
201	addFunction(10.f, 0.f, dummy_func, "llRequestPermissions", NULL, "ki");
202	addFunction(10.f, 0.f, dummy_func, "llGetPermissionsKey", "k", NULL);
203	addFunction(10.f, 0.f, dummy_func, "llGetPermissions", "i", NULL);
204	addFunction(10.f, 0.f, dummy_func, "llGetLinkNumber", "i", NULL);
205	addFunction(10.f, 0.f, dummy_func, "llSetLinkColor", NULL, "ivi");
206	addFunction(10.f, 1.f, dummy_func, "llCreateLink", NULL, "ki");
207	addFunction(10.f, 0.f, dummy_func, "llBreakLink", NULL, "i");
208	addFunction(10.f, 0.f, dummy_func, "llBreakAllLinks", NULL, NULL);
209	addFunction(10.f, 0.f, dummy_func, "llGetLinkKey", "k", "i");
210	addFunction(10.f, 0.f, dummy_func, "llGetLinkName", "s", "i");
211	addFunction(10.f, 0.f, dummy_func, "llGetInventoryNumber", "i", "i");
212	addFunction(10.f, 0.f, dummy_func, "llGetInventoryName", "s", "ii");
213	addFunction(10.f, 0.f, dummy_func, "llSetScriptState", NULL, "si");
214	addFunction(10.f, 0.f, dummy_func, "llGetEnergy", "f", NULL);
215	addFunction(10.f, 0.f, dummy_func, "llGiveInventory", NULL, "ks");
216	addFunction(10.f, 0.f, dummy_func, "llRemoveInventory", NULL, "s");
217	addFunction(10.f, 0.f, dummy_func, "llSetText", NULL, "svf");
218	addFunction(10.f, 0.f, dummy_func, "llWater", "f", "v");
219	addFunction(10.f, 0.f, dummy_func, "llPassTouches", NULL, "i");
220	addFunction(10.f, 0.1f, dummy_func, "llRequestAgentData", "k", "ki");
221	addFunction(10.f, 1.f, dummy_func, "llRequestInventoryData", "k", "s");
222	addFunction(10.f, 0.f, dummy_func, "llSetDamage", NULL, "f");
223	addFunction(100.f, 5.f, dummy_func, "llTeleportAgentHome", NULL, "k");
224	addFunction(10.f, 0.f, dummy_func, "llModifyLand", NULL, "ii");
225	addFunction(10.f, 0.f, dummy_func, "llCollisionSound", NULL, "sf");
226	addFunction(10.f, 0.f, dummy_func, "llCollisionSprite", NULL, "s");
227	addFunction(10.f, 0.f, dummy_func, "llGetAnimation", "s", "k");
228	addFunction(10.f, 0.f, dummy_func, "llResetScript", NULL, NULL);
229	addFunction(10.f, 0.f, dummy_func, "llMessageLinked", NULL, "iisk");
230	addFunction(10.f, 0.f, dummy_func, "llPushObject", NULL, "kvvi");
231	addFunction(10.f, 0.f, dummy_func, "llPassCollisions", NULL, "i");
232	addFunction(10.f, 0.f, dummy_func, "llGetScriptName", "s", NULL);
233	addFunction(10.f, 0.f, dummy_func, "llGetNumberOfSides", "i", NULL);
234	addFunction(10.f, 0.f, dummy_func, "llAxisAngle2Rot", "q", "vf");
235	addFunction(10.f, 0.f, dummy_func, "llRot2Axis", "v", "q");
236	addFunction(10.f, 0.f, dummy_func, "llRot2Angle", "f", "q");
237	addFunction(10.f, 0.f, dummy_func, "llAcos", "f", "f");
238	addFunction(10.f, 0.f, dummy_func, "llAsin", "f", "f");
239	addFunction(10.f, 0.f, dummy_func, "llAngleBetween", "f", "qq");
240	addFunction(10.f, 0.f, dummy_func, "llGetInventoryKey", "k", "s");
241	addFunction(10.f, 0.f, dummy_func, "llAllowInventoryDrop", NULL, "i");
242	addFunction(10.f, 0.f, dummy_func, "llGetSunDirection", "v", NULL);
243	addFunction(10.f, 0.f, dummy_func, "llGetTextureOffset", "v", "i");
244	addFunction(10.f, 0.f, dummy_func, "llGetTextureScale", "v", "i");
245	addFunction(10.f, 0.f, dummy_func, "llGetTextureRot", "f", "i");
246	addFunction(10.f, 0.f, dummy_func, "llSubStringIndex", "i", "ss");
247	addFunction(10.f, 0.f, dummy_func, "llGetOwnerKey", "k", "k");
248	addFunction(10.f, 0.f, dummy_func, "llGetCenterOfMass", "v", NULL);
249	addFunction(10.f, 0.f, dummy_func, "llListSort", "l", "lii");
250	addFunction(10.f, 0.f, dummy_func, "llGetListLength", "i", "l");
251	addFunction(10.f, 0.f, dummy_func, "llList2Integer", "i", "li");
252	addFunction(10.f, 0.f, dummy_func, "llList2Float", "f", "li");
253	addFunction(10.f, 0.f, dummy_func, "llList2String", "s", "li");
254	addFunction(10.f, 0.f, dummy_func, "llList2Key", "k", "li");
255	addFunction(10.f, 0.f, dummy_func, "llList2Vector", "v", "li");
256	addFunction(10.f, 0.f, dummy_func, "llList2Rot", "q", "li");
257	addFunction(10.f, 0.f, dummy_func, "llList2List", "l", "lii");
258	addFunction(10.f, 0.f, dummy_func, "llDeleteSubList", "l", "lii");
259	addFunction(10.f, 0.f, dummy_func, "llGetListEntryType", "i", "li");
260	addFunction(10.f, 0.f, dummy_func, "llList2CSV", "s", "l");
261	addFunction(10.f, 0.f, dummy_func, "llCSV2List", "l", "s");
262	addFunction(10.f, 0.f, dummy_func, "llListRandomize", "l", "li");
263	addFunction(10.f, 0.f, dummy_func, "llList2ListStrided", "l", "liii");
264	addFunction(10.f, 0.f, dummy_func, "llGetRegionCorner", "v", NULL);
265	addFunction(10.f, 0.f, dummy_func, "llListInsertList", "l", "lli");
266	addFunction(10.f, 0.f, dummy_func, "llListFindList", "i", "ll");
267	addFunction(10.f, 0.f, dummy_func, "llGetObjectName", "s", NULL);
268	addFunction(10.f, 0.f, dummy_func, "llSetObjectName", NULL, "s");
269	addFunction(10.f, 0.f, dummy_func, "llGetDate", "s", NULL);
270	addFunction(10.f, 0.f, dummy_func, "llEdgeOfWorld", "i", "vv");
271	addFunction(10.f, 0.f, dummy_func, "llGetAgentInfo", "i", "k");
272	addFunction(10.f, 0.1f, dummy_func, "llAdjustSoundVolume", NULL, "f");
273	addFunction(10.f, 0.f, dummy_func, "llSetSoundQueueing", NULL, "i");
274	addFunction(10.f, 0.f, dummy_func, "llSetSoundRadius", NULL, "f");
275	addFunction(10.f, 0.f, dummy_func, "llKey2Name", "s", "k");
276	addFunction(10.f, 0.f, dummy_func, "llSetTextureAnim", NULL, "iiiifff");
277	addFunction(10.f, 0.f, dummy_func, "llTriggerSoundLimited", NULL, "sfvv");
278	addFunction(10.f, 0.f, dummy_func, "llEjectFromLand", NULL, "k");
279	addFunction(10.f, 0.f, dummy_func, "llParseString2List", "l", "sll");
280	addFunction(10.f, 0.f, dummy_func, "llOverMyLand", "i", "k");
281	addFunction(10.f, 0.f, dummy_func, "llGetLandOwnerAt", "k", "v");
282	addFunction(10.f, 0.1f, dummy_func, "llGetNotecardLine", "k", "si");
283	addFunction(10.f, 0.f, dummy_func, "llGetAgentSize", "v", "k");
284	addFunction(10.f, 0.f, dummy_func, "llSameGroup", "i", "k");
285	addFunction(10.f, 0.f, dummy_func, "llUnSit", NULL, "k");
286	addFunction(10.f, 0.f, dummy_func, "llGroundSlope", "v", "v");
287	addFunction(10.f, 0.f, dummy_func, "llGroundNormal", "v", "v");
288	addFunction(10.f, 0.f, dummy_func, "llGroundContour", "v", "v");
289	addFunction(10.f, 0.f, dummy_func, "llGetAttached", "i", NULL);
290	addFunction(10.f, 0.f, dummy_func, "llGetFreeMemory", "i", NULL);
291	addFunction(10.f, 0.f, dummy_func, "llGetRegionName", "s", NULL);
292	addFunction(10.f, 0.f, dummy_func, "llGetRegionTimeDilation", "f", NULL);
293	addFunction(10.f, 0.f, dummy_func, "llGetRegionFPS", "f", NULL);
294
295	addFunction(10.f, 0.f, dummy_func, "llParticleSystem", NULL, "l");
296	addFunction(10.f, 0.f, dummy_func, "llGroundRepel", NULL, "fif");
297	addFunction(10.f, 3.f, dummy_func, "llGiveInventoryList", NULL, "ksl");
298
299// script calls for vehicle action
300	addFunction(10.f, 0.f, dummy_func, "llSetVehicleType", NULL, "i");
301	addFunction(10.f, 0.f, dummy_func, "llSetVehicleFloatParam", NULL, "if");
302	addFunction(10.f, 0.f, dummy_func, "llSetVehicleVectorParam", NULL, "iv");
303	addFunction(10.f, 0.f, dummy_func, "llSetVehicleRotationParam", NULL, "iq");
304	addFunction(10.f, 0.f, dummy_func, "llSetVehicleFlags", NULL, "i");
305	addFunction(10.f, 0.f, dummy_func, "llRemoveVehicleFlags", NULL, "i");
306	addFunction(10.f, 0.f, dummy_func, "llSitTarget", NULL, "vq");
307	addFunction(10.f, 0.f, dummy_func, "llAvatarOnSitTarget", "k", NULL);
308	addFunction(10.f, 0.1f, dummy_func, "llAddToLandPassList", NULL, "kf");
309	addFunction(10.f, 0.f, dummy_func, "llSetTouchText", NULL, "s");
310	addFunction(10.f, 0.f, dummy_func, "llSetSitText", NULL, "s");
311	addFunction(10.f, 0.f, dummy_func, "llSetCameraEyeOffset", NULL, "v");
312	addFunction(10.f, 0.f, dummy_func, "llSetCameraAtOffset", NULL, "v");
313
314	addFunction(10.f, 0.f, dummy_func, "llDumpList2String", "s", "ls");
315	addFunction(10.f, 0.f, dummy_func, "llScriptDanger", "i", "v");
316	addFunction(10.f, 1.f, dummy_func, "llDialog", NULL, "ksli");
317	addFunction(10.f, 0.f, dummy_func, "llVolumeDetect", NULL, "i");
318	addFunction(10.f, 0.f, dummy_func, "llResetOtherScript", NULL, "s");
319	addFunction(10.f, 0.f, dummy_func, "llGetScriptState", "i", "s");
320	addFunction(10.f, 3.f, dummy_func, "llRemoteLoadScript", NULL, "ksii");
321
322	addFunction(10.f, 0.2f, dummy_func, "llSetRemoteScriptAccessPin", NULL, "i");
323	addFunction(10.f, 3.f, dummy_func, "llRemoteLoadScriptPin", NULL, "ksiii");
324	
325	addFunction(10.f, 1.f, dummy_func, "llOpenRemoteDataChannel", NULL, NULL);
326	addFunction(10.f, 3.f, dummy_func, "llSendRemoteData", "k", "ksis");
327	addFunction(10.f, 3.f, dummy_func, "llRemoteDataReply", NULL, "kksi");
328	addFunction(10.f, 1.f, dummy_func, "llCloseRemoteDataChannel", NULL, "k");
329
330	addFunction(10.f, 0.f, dummy_func, "llMD5String", "s", "si");
331	addFunction(10.f, 0.2f, dummy_func, "llSetPrimitiveParams", NULL, "l");
332	addFunction(10.f, 0.f, dummy_func, "llStringToBase64", "s", "s");
333	addFunction(10.f, 0.f, dummy_func, "llBase64ToString", "s", "s");
334	addFunction(10.f, 0.3f, dummy_func, "llXorBase64Strings", "s", "ss");
335	addFunction(10.f, 0.f, dummy_func, "llRemoteDataSetRegion", NULL, NULL);
336	addFunction(10.f, 0.f, dummy_func, "llLog10", "f", "f");
337	addFunction(10.f, 0.f, dummy_func, "llLog", "f", "f");
338	addFunction(10.f, 0.f, dummy_func, "llGetAnimationList", "l", "k");
339	addFunction(10.f, 2.f, dummy_func, "llSetParcelMusicURL", NULL, "s");
340	
341	addFunction(10.f, 0.f, dummy_func, "llGetRootPosition", "v", NULL);
342	addFunction(10.f, 0.f, dummy_func, "llGetRootRotation", "q", NULL);
343
344	addFunction(10.f, 0.f, dummy_func, "llGetObjectDesc", "s", NULL);
345	addFunction(10.f, 0.f, dummy_func, "llSetObjectDesc", NULL, "s");
346	addFunction(10.f, 0.f, dummy_func, "llGetCreator", "k", NULL);
347	addFunction(10.f, 0.f, dummy_func, "llGetTimestamp", "s", NULL);
348	addFunction(10.f, 0.f, dummy_func, "llSetLinkAlpha", NULL, "ifi");
349	addFunction(10.f, 0.f, dummy_func, "llGetNumberOfPrims", "i", NULL);
350	addFunction(10.f, 0.1f, dummy_func, "llGetNumberOfNotecardLines", "k", "s");
351
352	addFunction(10.f, 0.f, dummy_func, "llGetBoundingBox", "l", "k");
353	addFunction(10.f, 0.f, dummy_func, "llGetGeometricCenter", "v", NULL);
354	addFunction(10.f, 0.2f, dummy_func, "llGetPrimitiveParams", "l", "l");
355	addFunction(10.f, 0.0f, dummy_func, "llIntegerToBase64", "s", "i");
356	addFunction(10.f, 0.0f, dummy_func, "llBase64ToInteger", "i", "s");
357	addFunction(10.f, 0.f, dummy_func, "llGetGMTclock", "f", "");
358	addFunction(10.f, 10.f, dummy_func, "llGetSimulatorHostname", "s", "");
359	
360	addFunction(10.f, 0.2f, dummy_func, "llSetLocalRot", NULL, "q");
361
362	addFunction(10.f, 0.f, dummy_func, "llParseStringKeepNulls", "l", "sll");
363	addFunction(200.f, 0.1f, dummy_func, "llRezAtRoot", NULL, "svvqi");
364
365	addFunction(10.f, 0.f, dummy_func, "llGetObjectPermMask", "i", "i", FALSE);
366	addFunction(10.f, 0.f, dummy_func, "llSetObjectPermMask", NULL, "ii", TRUE);
367
368	addFunction(10.f, 0.f, dummy_func, "llGetInventoryPermMask", "i", "si", FALSE);
369	addFunction(10.f, 0.f, dummy_func, "llSetInventoryPermMask", NULL, "sii", TRUE);
370	addFunction(10.f, 0.f, dummy_func, "llGetInventoryCreator", "k", "s", FALSE);
371	addFunction(10.f, 0.f, dummy_func, "llOwnerSay", NULL, "s");
372	addFunction(10.f, 1.f, dummy_func, "llRequestSimulatorData", "k", "si");
373	addFunction(10.f, 0.f, dummy_func, "llForceMouselook", NULL, "i");
374	addFunction(10.f, 0.f, dummy_func, "llGetObjectMass", "f", "k");
375	addFunction(10.f, 0.f, dummy_func, "llListReplaceList", "l", "llii");
376	addFunction(10.f, 10.f, dummy_func, "llLoadURL", NULL, "kss");
377
378	addFunction(10.f, 2.f, dummy_func, "llParcelMediaCommandList", NULL, "l");
379	addFunction(10.f, 2.f, dummy_func, "llParcelMediaQuery", "l", "l");
380
381	addFunction(10.f, 1.f, dummy_func, "llModPow", "i", "iii");
382	
383	addFunction(10.f, 0.f, dummy_func, "llGetInventoryType", "i", "s");
384	addFunction(10.f, 0.f, dummy_func, "llSetPayPrice", NULL, "il");
385	addFunction(10.f, 0.f, dummy_func, "llGetCameraPos", "v", "");
386	addFunction(10.f, 0.f, dummy_func, "llGetCameraRot", "q", "");
387	
388	addFunction(10.f, 20.f, dummy_func, "llSetPrimURL", NULL, "s");
389	addFunction(10.f, 20.f, dummy_func, "llRefreshPrimURL", NULL, "");
390	addFunction(10.f, 0.f, dummy_func, "llEscapeURL", "s", "s");
391	addFunction(10.f, 0.f, dummy_func, "llUnescapeURL", "s", "s");
392
393	addFunction(10.f, 1.f, dummy_func, "llMapDestination", NULL, "svv");
394	addFunction(10.f, 0.1f, dummy_func, "llAddToLandBanList", NULL, "kf");
395	addFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandPassList", NULL, "k");
396	addFunction(10.f, 0.1f, dummy_func, "llRemoveFromLandBanList", NULL, "k");
397
398	addFunction(10.f, 0.f, dummy_func, "llSetCameraParams", NULL, "l");
399	addFunction(10.f, 0.f, dummy_func, "llClearCameraParams", NULL, NULL);
400	
401	addFunction(10.f, 0.f, dummy_func, "llListStatistics", "f", "il");
402	addFunction(10.f, 0.f, dummy_func, "llGetUnixTime", "i", NULL);
403	addFunction(10.f, 0.f, dummy_func, "llGetParcelFlags", "i", "v");
404	addFunction(10.f, 0.f, dummy_func, "llGetRegionFlags", "i", NULL);
405	addFunction(10.f, 0.f, dummy_func, "llXorBase64StringsCorrect", "s", "ss");
406
407	addFunction(10.f, 0.f, dummy_func, "llHTTPRequest", "k", "sls");
408
409	addFunction(10.f, 0.1f, dummy_func, "llResetLandBanList", NULL, NULL);
410	addFunction(10.f, 0.1f, dummy_func, "llResetLandPassList", NULL, NULL);
411
412	addFunction(10.f, 0.f, dummy_func, "llGetObjectPrimCount", "i", "k");
413	addFunction(10.f, 2.0f, dummy_func, "llGetParcelPrimOwners", "l", "v");
414	addFunction(10.f, 0.f, dummy_func, "llGetParcelPrimCount", "i", "vii");
415	addFunction(10.f, 0.f, dummy_func, "llGetParcelMaxPrims", "i", "vi");
416	addFunction(10.f, 0.f, dummy_func, "llGetParcelDetails", "l", "vl");
417
418
419	addFunction(10.f, 0.2f, dummy_func, "llSetLinkPrimitiveParams", NULL, "il");
420	addFunction(10.f, 0.2f, dummy_func, "llSetLinkTexture", NULL, "isi");
421
422	
423	addFunction(10.f, 0.f, dummy_func, "llStringTrim", "s", "si");
424	addFunction(10.f, 0.f, dummy_func, "llRegionSay", NULL, "is");
425	addFunction(10.f, 0.f, dummy_func, "llGetObjectDetails", "l", "kl");
426	addFunction(10.f, 0.f, dummy_func, "llSetClickAction", NULL, "i");
427
428	addFunction(10.f, 0.f, dummy_func, "llGetRegionAgentCount", "i", NULL);
429	addFunction(10.f, 1.f, dummy_func, "llTextBox", NULL, "ksi");
430	addFunction(10.f, 0.f, dummy_func, "llGetAgentLanguage", "s", "k");
431	addFunction(10.f, 0.f, dummy_func, "llDetectedTouchUV", "v", "i");
432	addFunction(10.f, 0.f, dummy_func, "llDetectedTouchFace", "i", "i");
433	addFunction(10.f, 0.f, dummy_func, "llDetectedTouchPos", "v", "i");
434	addFunction(10.f, 0.f, dummy_func, "llDetectedTouchNormal", "v", "i");
435	addFunction(10.f, 0.f, dummy_func, "llDetectedTouchBinormal", "v", "i");
436	addFunction(10.f, 0.f, dummy_func, "llDetectedTouchST", "v", "i");
437
438	addFunction(10.f, 0.f, dummy_func, "llSHA1String", "s", "s");
439
440	addFunction(10.f, 0.f, dummy_func, "llGetFreeURLs", "i", NULL);
441	addFunction(10.f, 0.f, dummy_func, "llRequestURL", "k", NULL);
442	addFunction(10.f, 0.f, dummy_func, "llRequestSecureURL", "k", NULL);
443	addFunction(10.f, 0.f, dummy_func, "llReleaseURL", NULL, "s");
444	addFunction(10.f, 0.f, dummy_func, "llHTTPResponse", NULL, "kis");
445	addFunction(10.f, 0.f, dummy_func, "llGetHTTPHeader", "s", "ks");
446
447	// Prim media (see lscript_prim_media.h)
448	addFunction(10.f, 1.0f, dummy_func, "llSetPrimMediaParams", "i", "il");
449	addFunction(10.f, 1.0f, dummy_func, "llGetPrimMediaParams", "l", "il");
450	addFunction(10.f, 1.0f, dummy_func, "llClearPrimMedia", "i", "i");
451	addFunction(10.f, 0.f, dummy_func, "llSetLinkPrimitiveParamsFast", NULL, "il");
452	addFunction(10.f, 0.f, dummy_func, "llGetLinkPrimitiveParams", "l", "il");
453	addFunction(10.f, 0.f, dummy_func, "llLinkParticleSystem", NULL, "il");
454	addFunction(10.f, 0.f, dummy_func, "llSetLinkTextureAnim", NULL, "iiiiifff");
455	
456	addFunction(10.f, 0.f, dummy_func, "llGetLinkNumberOfSides", "i", "i");
457	
458	// IDEVO Name lookup calls, see lscript_avatar_names.h
459	addFunction(10.f, 0.f, dummy_func, "llGetUsername", "s", "k");
460	addFunction(10.f, 0.f, dummy_func, "llRequestUsername", "k", "k");
461	addFunction(10.f, 0.f, dummy_func, "llGetDisplayName", "s", "k");
462	addFunction(10.f, 0.f, dummy_func, "llRequestDisplayName", "k", "k");
463
464	addFunction(10.f, 0.f, dummy_func, "llGetEnv", "s", "s");
465	addFunction(10.f, 0.f, dummy_func, "llRegionSayTo", NULL, "kis");
466
467	// energy, sleep, dummy_func, name, return type, parameters, help text, gods-only
468
469	// IF YOU ADD NEW SCRIPT CALLS, YOU MUST PUT THEM AT THE END OF THIS LIST.
470	// Otherwise the bytecode numbers for each call will be wrong, and all
471	// existing scripts will crash.
472}
473
474LLScriptLibraryFunction::LLScriptLibraryFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only)
475		: mEnergyUse(eu), mSleepTime(st), mExecFunc(exec_func), mName(name), mReturnType(ret_type), mArgs(args), mGodOnly(god_only)
476{
477}
478
479LLScriptLibraryFunction::~LLScriptLibraryFunction()
480{
481}
482
483void LLScriptLibrary::addFunction(F32 eu, F32 st, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &), const char *name, const char *ret_type, const char *args, BOOL god_only)
484{
485	LLScriptLibraryFunction func(eu, st, exec_func, name, ret_type, args, god_only);
486	mFunctions.push_back(func);
487}
488
489void LLScriptLibrary::assignExec(const char *name, void (*exec_func)(LLScriptLibData *, LLScriptLibData *, const LLUUID &))
490{
491	for (std::vector<LLScriptLibraryFunction>::iterator i = mFunctions.begin(); 
492		 i != mFunctions.end(); ++i)
493	{
494		if (!strcmp(name, i->mName))
495		{
496			i->mExecFunc = exec_func;
497			return;
498		}
499	}
500	
501	llerrs << "Unknown LSL function in assignExec: " << name << llendl;
502}
503
504void LLScriptLibData::print(std::ostream &s, BOOL b_prepend_comma)
505{
506	char tmp[1024];	/*Flawfinder: ignore*/
507	if (b_prepend_comma)
508	{
509	        s << ", ";
510	}
511	switch (mType)
512    {
513	case LST_INTEGER:
514	     s << mInteger;
515	     break;
516	case LST_FLOATINGPOINT:
517	     snprintf(tmp, 1024, "%f", mFP);	/* Flawfinder: ignore */
518	     s << tmp;
519	     break;
520	case LST_KEY:
521	     s << mKey;
522	     break;
523	case LST_STRING:
524	     s << mString;
525	     break;
526	case LST_VECTOR:
527	     snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
528		      mVec.mV[VY], mVec.mV[VZ]);
529	     s << tmp;
530	     break;
531	case LST_QUATERNION:
532	     snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
533		      mQuat.mQ[VZ], mQuat.mQ[VS]);
534	     s << tmp;
535	     break;
536	default:
537	     break;
538	}
539}
540
541void LLScriptLibData::print_separator(std::ostream& ostr, BOOL b_prepend_sep, char* sep)
542{
543	if (b_prepend_sep)
544	{
545		ostr << sep;
546	}
547	//print(ostr, FALSE);
548	{
549		char tmp[1024];	/* Flawfinder: ignore */
550		switch (mType)
551		{
552		case LST_INTEGER:
553		     ostr << mInteger;
554		     break;
555		case LST_FLOATINGPOINT:
556		     snprintf(tmp, 1024, "%f", mFP);	/* Flawfinder: ignore */
557		     ostr << tmp;
558		     break;
559		case LST_KEY:
560		     ostr << mKey;
561		     break;
562		case LST_STRING:
563		     ostr << mString;
564		     break;
565		case LST_VECTOR:
566		     snprintf(tmp, 1024, "<%f, %f, %f>", mVec.mV[VX], /* Flawfinder: ignore */
567			      mVec.mV[VY], mVec.mV[VZ]);
568		     ostr << tmp;
569		     break;
570		case LST_QUATERNION:
571		     snprintf(tmp, 1024, "<%f, %f, %f, %f>", mQuat.mQ[VX], mQuat.mQ[VY], /* Flawfinder: ignore */
572			      mQuat.mQ[VZ], mQuat.mQ[VS]);
573		     ostr << tmp;
574		     break;
575		default:
576		     break;
577		}
578	}
579}
580
581
582LLScriptLibrary gScriptLibrary;