aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript/lscript_compile/lscript_tree.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'linden/indra/lscript/lscript_compile/lscript_tree.cpp')
-rw-r--r--linden/indra/lscript/lscript_compile/lscript_tree.cpp116
1 files changed, 114 insertions, 2 deletions
diff --git a/linden/indra/lscript/lscript_compile/lscript_tree.cpp b/linden/indra/lscript/lscript_compile/lscript_tree.cpp
index 2a41d91..e291d4c 100644
--- a/linden/indra/lscript/lscript_compile/lscript_tree.cpp
+++ b/linden/indra/lscript/lscript_compile/lscript_tree.cpp
@@ -17,7 +17,8 @@
17 * There are special exceptions to the terms and conditions of the GPL as 17 * There are special exceptions to the terms and conditions of the GPL as
18 * it is applied to this Source Code. View the full text of the exception 18 * it is applied to this Source Code. View the full text of the exception
19 * in the file doc/FLOSS-exception.txt in this software distribution, or 19 * in the file doc/FLOSS-exception.txt in this software distribution, or
20 * online at http://secondlifegrid.net/programs/open_source/licensing/flossexception 20 * online at
21 * http://secondlifegrid.net/programs/open_source/licensing/flossexception
21 * 22 *
22 * By copying, modifying or distributing this software, you acknowledge 23 * By copying, modifying or distributing this software, you acknowledge
23 * that you have read and understood your obligations described above, 24 * that you have read and understood your obligations described above,
@@ -630,7 +631,9 @@ static void print_cil_cast(LLFILE* fp, LSCRIPTType srcType, LSCRIPTType targetTy
630 switch(targetType) 631 switch(targetType)
631 { 632 {
632 case LST_INTEGER: 633 case LST_INTEGER:
633 fprintf(fp, "conv.i4\n"); 634 //fprintf(fp, "call int32 [LslLibrary]LindenLab.SecondLife.LslRunTime::ToInteger(float32)\n");
635 fprintf(fp, "conv.i4\n"); // TODO replace this line with the above
636 // we the entire grid is > 1.25.1
634 break; 637 break;
635 case LST_STRING: 638 case LST_STRING:
636 fprintf(fp, "call string [LslLibrary]LindenLab.SecondLife.LslRunTime::ToString(float32)\n"); 639 fprintf(fp, "call string [LslLibrary]LindenLab.SecondLife.LslRunTime::ToString(float32)\n");
@@ -3288,6 +3291,110 @@ S32 LLScriptHTTPResponseEvent::getSize()
3288 return 16; 3291 return 16;
3289} 3292}
3290 3293
3294void LLScriptHTTPRequestEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata)
3295{
3296 if (gErrorToText.getErrors())
3297 {
3298 return;
3299 }
3300 switch(pass)
3301 {
3302 case LSCP_PRETTY_PRINT:
3303 case LSCP_EMIT_ASSEMBLY:
3304 fdotabs(fp, tabs, tabsize);
3305 fprintf(fp, "http_request( key ");
3306 mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3307 fprintf(fp, ", string ");
3308 mMethod->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3309 fprintf(fp, ", string ");
3310 mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3311 fprintf(fp, " )\n");
3312 break;
3313
3314 case LSCP_SCOPE_PASS1:
3315 checkForDuplicateHandler(fp, this, scope, "http_request");
3316 if (scope->checkEntry(mRequestId->mName))
3317 {
3318 gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME);
3319 }
3320 else
3321 {
3322 mRequestId->mScopeEntry = scope->addEntry(mRequestId->mName, LIT_VARIABLE, LST_KEY);
3323 }
3324
3325 if (scope->checkEntry(mMethod->mName))
3326 {
3327 gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME);
3328 }
3329 else
3330 {
3331 mMethod->mScopeEntry = scope->addEntry(mMethod->mName, LIT_VARIABLE, LST_STRING);
3332 }
3333
3334 if (scope->checkEntry(mBody->mName))
3335 {
3336 gErrorToText.writeError(fp, this, LSERROR_DUPLICATE_NAME);
3337 }
3338 else
3339 {
3340 mBody->mScopeEntry = scope->addEntry(mBody->mName, LIT_VARIABLE, LST_STRING);
3341 }
3342 break;
3343
3344 case LSCP_RESOURCE:
3345 {
3346 // we're just tryng to determine how much space the variable needs
3347 if (mRequestId->mScopeEntry)
3348 {
3349 mRequestId->mScopeEntry->mOffset = (S32)count;
3350 mRequestId->mScopeEntry->mSize = 4;
3351 count += mRequestId->mScopeEntry->mSize;
3352
3353 mMethod->mScopeEntry->mOffset = (S32)count;
3354 mMethod->mScopeEntry->mSize = 4;
3355 count += mMethod->mScopeEntry->mSize;
3356
3357 mBody->mScopeEntry->mOffset = (S32)count;
3358 mBody->mScopeEntry->mSize = 4;
3359 count += mBody->mScopeEntry->mSize;
3360 }
3361 }
3362 break;
3363
3364 case LSCP_EMIT_BYTE_CODE:
3365 {
3366#ifdef LSL_INCLUDE_DEBUG_INFO
3367 char name[] = "http_request";
3368 chunk->addBytes(name, strlen(name) + 1); /*Flawfinder: ignore*/
3369 chunk->addBytes(mRequestId->mName, strlen(mRequestId->mName) + 1); /*Flawfinder: ignore*/
3370 chunk->addBytes(mMethod->mName, strlen(mMethod->mName) + 1); /*Flawfinder: ignore*/
3371 chunk->addBytes(mBody->mName, strlen(mBody->mName) + 1); /*Flawfinder: ignore*/
3372#endif
3373 }
3374 break;
3375 case LSCP_EMIT_CIL_ASSEMBLY:
3376 fdotabs(fp, tabs, tabsize);
3377 fprintf(fp, "http_request( valuetype [ScriptTypes]LindenLab.SecondLife.Key ");
3378 mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3379 fprintf(fp, ", string ");
3380 mMethod->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3381 fprintf(fp, ", string ");
3382 mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3383 fprintf(fp, " )\n");
3384 break;
3385 default:
3386 mRequestId->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3387 mMethod->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3388 mBody->recurse(fp, tabs, tabsize, pass, ptype, prunearg, scope, type, basetype, count, chunk, heap, stacksize, entry, entrycount, NULL);
3389 break;
3390 }
3391}
3392
3393S32 LLScriptHTTPRequestEvent::getSize()
3394{
3395 // key + string + string = 12
3396 return 12;
3397}
3291 3398
3292void LLScriptMoneyEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata) 3399void LLScriptMoneyEvent::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCompilePass pass, LSCRIPTPruneType ptype, BOOL &prunearg, LLScriptScope *scope, LSCRIPTType &type, LSCRIPTType basetype, U64 &count, LLScriptByteCodeChunk *chunk, LLScriptByteCodeChunk *heap, S32 stacksize, LLScriptScopeEntry *entry, S32 entrycount, LLScriptLibData **ldata)
3293{ 3400{
@@ -9655,6 +9762,11 @@ void LLScriptEventHandler::recurse(LLFILE *fp, S32 tabs, S32 tabsize, LSCRIPTCom
9655 mScopeEntry->mFunctionArgs.addType(LST_LIST); 9762 mScopeEntry->mFunctionArgs.addType(LST_LIST);
9656 mScopeEntry->mFunctionArgs.addType(LST_STRING); 9763 mScopeEntry->mFunctionArgs.addType(LST_STRING);
9657 break; 9764 break;
9765 case LSTT_HTTP_REQUEST:
9766 mScopeEntry->mFunctionArgs.addType(LST_KEY);
9767 mScopeEntry->mFunctionArgs.addType(LST_STRING);
9768 mScopeEntry->mFunctionArgs.addType(LST_STRING);
9769 break;
9658 9770
9659 default: 9771 default:
9660 break; 9772 break;