aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/linden/indra/lscript/lscript_execute.h
diff options
context:
space:
mode:
authorJacek Antonelli2008-12-01 17:39:58 -0600
committerJacek Antonelli2008-12-01 17:40:06 -0600
commit7abecb48babe6a6f09bf6692ba55076546cfced9 (patch)
tree8d18a88513fb97adf32c10aae78f4be1984942db /linden/indra/lscript/lscript_execute.h
parentSecond Life viewer sources 1.21.6 (diff)
downloadmeta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.zip
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.gz
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.bz2
meta-impy-7abecb48babe6a6f09bf6692ba55076546cfced9.tar.xz
Second Life viewer sources 1.22.0-RC
Diffstat (limited to 'linden/indra/lscript/lscript_execute.h')
-rw-r--r--linden/indra/lscript/lscript_execute.h57
1 files changed, 35 insertions, 22 deletions
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