aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--OpenSim/Region/ScriptEngine/Common/LSL_Types.cs645
1 files changed, 318 insertions, 327 deletions
diff --git a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
index 5d3fcf1..b008acb 100644
--- a/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
+++ b/OpenSim/Region/ScriptEngine/Common/LSL_Types.cs
@@ -442,351 +442,342 @@ namespace OpenSim.Region.ScriptEngine.Common
442 442
443 } 443 }
444 444
445 }
445 446
447 //
448 // BELOW IS WORK IN PROGRESS... IT WILL CHANGE, SO DON'T USE YET! :)
449 //
446 450
451 public struct StringTest
452 {
453 // Our own little string
454 internal string actualString;
455 public static implicit operator bool(StringTest mString)
456 {
457 if (mString.actualString.Length == 0)
458 return true;
459 return false;
460 }
461 public override string ToString()
462 {
463 return actualString;
464 }
447 465
448 // 466 }
449 // BELOW IS WORK IN PROGRESS... IT WILL CHANGE, SO DON'T USE YET! :)
450 //
451 467
452 //Temp commented out 468 [Serializable]
453 //[15:26:57] <justincc> [csc] Compiling 5 files to '/home/caseyj/jc/it/v/virtual-worlds/second-life/servers/opensim/src/opensim-svn-nematode/OpenSim/Region/ScriptEngine/Common/bin/Debug/OpenSim.Region.ScriptEngine.Common.dll'. 469 public struct key
454 //[15:26:57] <justincc> [csc] error CS0121: The call is ambiguous between the following methods or properties: `OpenSim.Region.ScriptEngine.Common.LSL_Types.list.LSLString.operator /(OpenSim.Region.ScriptEngine.Common.LSL_Types.list.LSLString, OpenSim.Region.ScriptEngine.Common.LSL_Types.list.LSLString)' and `string.operator /(string, string)' 470 {
471 public string value;
455 472
473 #region Constructors
474 public key(string s)
475 {
476 value = s;
477 }
456 478
479 #endregion
457 480
458 //public struct StringTest 481 #region Methods
459 //{
460 // // Our own little string
461 // internal string actualString;
462 // public static implicit operator bool(StringTest mString)
463 // {
464 // if (mString.actualString.Length == 0)
465 // return true;
466 // return false;
467 // }
468 // public override string ToString()
469 // {
470 // return actualString;
471 // }
472 482
473 //} 483 static public bool Parse2Key(string s)
484 {
485 Regex isuuid = new Regex(@"^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$", RegexOptions.Compiled);
486 if (isuuid.IsMatch(s))
487 {
488 return true;
489 }
490 else
491 {
492 return false;
493 }
494 }
474 495
475 //[Serializable] 496 #endregion
476 //public struct key
477 //{
478 // public string value;
479
480 // #region Constructors
481 // public key(string s)
482 // {
483 // value = s;
484 // }
485
486 // #endregion
487
488 // #region Methods
489
490 // static public bool Parse2Key(string s)
491 // {
492 // Regex isuuid = new Regex(@"^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$", RegexOptions.Compiled);
493 // if (isuuid.IsMatch(s))
494 // {
495 // return true;
496 // }
497 // else
498 // {
499 // return false;
500 // }
501 // }
502
503 // #endregion
504
505 // #region Operators
506
507 // static public implicit operator System.Boolean(key k)
508 // {
509 // if (k.value.Length == 0)
510 // {
511 // return false;
512 // }
513
514 // if (k.value == "00000000-0000-0000-0000-000000000000")
515 // {
516 // return false;
517 // }
518 // Regex isuuid = new Regex(@"^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$", RegexOptions.Compiled);
519 // if (isuuid.IsMatch(k.value))
520 // {
521 // return true;
522 // }
523 // else
524 // {
525 // return false;
526 // }
527 // }
528
529 // static public implicit operator key(string s)
530 // {
531 // return new key(s);
532 // }
533
534 // static public implicit operator System.String(key k)
535 // {
536 // return k.value;
537 // }
538
539 // public static bool operator ==(key k1, key k2)
540 // {
541 // return k1.value == k2.value;
542 // }
543 // public static bool operator !=(key k1, key k2)
544 // {
545 // return k1.value != k2.value;
546 // }
547
548 // #endregion
549
550 // #region Overriders
551
552 // public override bool Equals(object o)
553 // {
554 // if (o is String)
555 // {
556 // string s = (string)o;
557 // return s == this.value;
558 // }
559 // if (o is key)
560 // {
561 // key k = (key)o;
562 // return this.value == k.value;
563 // }
564 // return false;
565 // }
566
567 // public override int GetHashCode()
568 // {
569 // return value.GetHashCode();
570 // }
571
572 // #endregion
573 //}
574 497
575 //[Serializable] 498 #region Operators
576 //public struct LSLString 499
577 //{ 500 static public implicit operator System.Boolean(key k)
578 // public string m_string; 501 {
579 // #region Constructors 502 if (k.value.Length == 0)
580 // public LSLString(string s) 503 {
581 // { 504 return false;
582 // m_string = s; 505 }
583 // } 506
584 // #endregion 507 if (k.value == "00000000-0000-0000-0000-000000000000")
585 508 {
586 // #region Operators 509 return false;
587 // static public implicit operator System.Boolean(LSLString s) 510 }
588 // { 511 Regex isuuid = new Regex(@"^[0-9a-fA-F]{8}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{4}\-[0-9a-fA-F]{12}$", RegexOptions.Compiled);
589 // if (s.m_string.Length == 0) 512 if (isuuid.IsMatch(k.value))
590 // { 513 {
591 // return false; 514 return true;
592 // } 515 }
593 // else 516 else
594 // { 517 {
595 // return true; 518 return false;
596 // } 519 }
597 // } 520 }
598 521
599 // static public implicit operator System.String(LSLString s) 522 static public implicit operator key(string s)
600 // { 523 {
601 // return s.m_string; 524 return new key(s);
602 // } 525 }
603 526
604 // static public implicit operator LSLString(string s) 527 static public implicit operator System.String(key k)
605 // { 528 {
606 // return new LSLString(s); 529 return k.value;
607 // } 530 }
608 531
609 // public static bool operator ==(LSLString s1, LSLString s2) 532 public static bool operator ==(key k1, key k2)
610 // { 533 {
611 // return s1.m_string == s2.m_string; 534 return k1.value == k2.value;
612 // } 535 }
613 // public static bool operator !=(LSLString s1, LSLString s2) 536 public static bool operator !=(key k1, key k2)
614 // { 537 {
615 // return s1.m_string != s2.m_string; 538 return k1.value != k2.value;
616 // } 539 }
617 // #endregion 540
618 541 #endregion
619 // #region Overriders 542
620 // public override bool Equals(object o) 543 #region Overriders
621 // { 544
622 // if (o is String) 545 public override bool Equals(object o)
623 // { 546 {
624 // string s = (string)o; 547 if (o is String)
625 // return s == this.m_string; 548 {
626 // } 549 string s = (string)o;
627 // if (o is key) 550 return s == this.value;
628 // { 551 }
629 // key k = (key)o; 552 if (o is key)
630 // return this.m_string == k.value; 553 {
631 // } 554 key k = (key)o;
632 // if (o is LSLString) 555 return this.value == k.value;
633 // { 556 }
634 // LSLString s = (string)o; 557 return false;
635 // return this.m_string == s; 558 }
636 // } 559
637 // return false; 560 public override int GetHashCode()
638 // } 561 {
639 562 return value.GetHashCode();
640 // public override int GetHashCode() 563 }
641 // { 564
642 // return m_string.GetHashCode(); 565 #endregion
643 // } 566 }
644 567
645 // #endregion 568 [Serializable]
646 569 public struct LSLString
647 // #region " Standard string functions " 570 {
648 // //Clone,CompareTo,Contains 571 public string m_string;
649 // //CopyTo,EndsWith,Equals,GetEnumerator,GetHashCode,GetType,GetTypeCode 572 #region Constructors
650 // //IndexOf,IndexOfAny,Insert,IsNormalized,LastIndexOf,LastIndexOfAny 573 public LSLString(string s)
651 // //Length,Normalize,PadLeft,PadRight,Remove,Replace,Split,StartsWith,Substring,ToCharArray,ToLowerInvariant 574 {
652 // //ToString,ToUpper,ToUpperInvariant,Trim,TrimEnd,TrimStart 575 m_string = s;
653 // public bool Contains(string value) { return m_string.Contains(value); } 576 }
654 // public int IndexOf(string value) { return m_string.IndexOf(value); } 577 #endregion
655 // public int Length { get { return m_string.Length; } } 578
656 579 #region Operators
657 580 static public implicit operator System.Boolean(LSLString s)
658 // #endregion 581 {
659 //} 582 if (s.m_string.Length == 0)
583 {
584 return false;
585 }
586 else
587 {
588 return true;
589 }
590 }
591
592 static public implicit operator System.String(LSLString s)
593 {
594 return s.m_string;
595 }
596
597 static public implicit operator LSLString(string s)
598 {
599 return new LSLString(s);
600 }
601
602 public static bool operator ==(LSLString s1, LSLString s2)
603 {
604 return s1.m_string == s2.m_string;
605 }
606 public static bool operator !=(LSLString s1, LSLString s2)
607 {
608 return s1.m_string != s2.m_string;
609 }
610 #endregion
611
612 #region Overriders
613 public override bool Equals(object o)
614 {
615 if (o is String)
616 {
617 string s = (string)o;
618 return s == this.m_string;
619 }
620 if (o is key)
621 {
622 key k = (key)o;
623 return this.m_string == k.value;
624 }
625 if (o is LSLString)
626 {
627 LSLString s = (string)o;
628 return this.m_string == s;
629 }
630 return false;
631 }
632
633 public override int GetHashCode()
634 {
635 return m_string.GetHashCode();
636 }
637
638 #endregion
639
640 #region " Standard string functions "
641 //Clone,CompareTo,Contains
642 //CopyTo,EndsWith,Equals,GetEnumerator,GetHashCode,GetType,GetTypeCode
643 //IndexOf,IndexOfAny,Insert,IsNormalized,LastIndexOf,LastIndexOfAny
644 //Length,Normalize,PadLeft,PadRight,Remove,Replace,Split,StartsWith,Substring,ToCharArray,ToLowerInvariant
645 //ToString,ToUpper,ToUpperInvariant,Trim,TrimEnd,TrimStart
646 public bool Contains(string value) { return m_string.Contains(value); }
647 public int IndexOf(string value) { return m_string.IndexOf(value); }
648 public int Length { get { return m_string.Length; } }
649
650
651 #endregion
652 }
653
654 [Serializable]
655 public struct LSLInteger
656 {
657 public int value;
658
659 #region Constructors
660 public LSLInteger(int i)
661 {
662 value = i;
663 }
660 664
661 //[Serializable] 665 public LSLInteger(double d)
662 //public struct LSLInteger 666 {
667 value = (int)d;
668 }
669
670 #endregion
671 static public implicit operator System.Int32(LSLInteger i)
672 {
673 return i.value;
674 }
675
676 static public implicit operator System.Boolean(LSLInteger i)
677 {
678 if (i.value == 0)
679 {
680 return false;
681 }
682 else
683 {
684 return true;
685 }
686 }
687
688 static public implicit operator LSLInteger(int i)
689 {
690 return new LSLInteger(i);
691 }
692
693 static public implicit operator LSLInteger(double d)
694 {
695 return new LSLInteger(d);
696 }
697
698 static public LSLInteger operator &(LSLInteger i1, LSLInteger i2)
699 {
700 int ret = i1.value & i2.value;
701 return ret;
702 }
703
704
705 //static public implicit operator System.Double(LSLInteger i)
663 //{ 706 //{
664 // public int value; 707 // return (double)i.value;
665
666 // #region Constructors
667 // public LSLInteger(int i)
668 // {
669 // value = i;
670 // }
671
672 // public LSLInteger(double d)
673 // {
674 // value = (int)d;
675 // }
676
677 // #endregion
678 // static public implicit operator System.Int32(LSLInteger i)
679 // {
680 // return i.value;
681 // }
682
683 // static public implicit operator System.Boolean(LSLInteger i)
684 // {
685 // if (i.value == 0)
686 // {
687 // return false;
688 // }
689 // else
690 // {
691 // return true;
692 // }
693 // }
694
695 // static public implicit operator LSLInteger(int i)
696 // {
697 // return new LSLInteger(i);
698 // }
699
700 // static public implicit operator LSLInteger(double d)
701 // {
702 // return new LSLInteger(d);
703 // }
704
705 // static public LSLInteger operator &(LSLInteger i1, LSLInteger i2)
706 // {
707 // int ret = i1.value & i2.value;
708 // return ret;
709 // }
710
711
712 // //static public implicit operator System.Double(LSLInteger i)
713 // //{
714 // // return (double)i.value;
715 // //}
716
717 // #region Overriders
718
719 // public override string ToString()
720 // {
721 // return this.value.ToString();
722 // }
723
724 // #endregion
725 //} 708 //}
726 709
727 //[Serializable] 710 #region Overriders
728 //public struct LSLFloat 711
712 public override string ToString()
713 {
714 return this.value.ToString();
715 }
716
717 #endregion
718 }
719
720 [Serializable]
721 public struct LSLFloat
722 {
723 public double value;
724
725 #region Constructors
726 public LSLFloat(int i)
727 {
728 this.value = (double)i;
729 }
730
731 public LSLFloat(double d)
732 {
733 this.value = d;
734 }
735
736 #endregion
737
738 #region Operators
739
740 static public implicit operator System.Double(LSLFloat f)
741 {
742 return f.value;
743 }
744
745 //static public implicit operator System.Int32(LSLFloat f)
729 //{ 746 //{
730 // public double value; 747 // return (int)f.value;
731
732 // #region Constructors
733 // public LSLFloat(int i)
734 // {
735 // this.value = (double)i;
736 // }
737
738 // public LSLFloat(double d)
739 // {
740 // this.value = d;
741 // }
742
743 // #endregion
744
745 // #region Operators
746
747 // static public implicit operator System.Double(LSLFloat f)
748 // {
749 // return f.value;
750 // }
751
752 // //static public implicit operator System.Int32(LSLFloat f)
753 // //{
754 // // return (int)f.value;
755 // //}
756
757
758 // static public implicit operator System.Boolean(LSLFloat f)
759 // {
760 // if (f.value == 0)
761 // {
762 // return false;
763 // }
764 // else
765 // {
766 // return true;
767 // }
768 // }
769
770 // static public implicit operator LSLFloat(int i)
771 // {
772 // return new LSLFloat(i);
773 // }
774
775 // static public implicit operator LSLFloat(double d)
776 // {
777 // return new LSLFloat(d);
778 // }
779 // #endregion
780
781 // #region Overriders
782 // public override string ToString()
783 // {
784 // return this.value.ToString();
785 // }
786 // #endregion
787 //} 748 //}
788 749
789 750
751 static public implicit operator System.Boolean(LSLFloat f)
752 {
753 if (f.value == 0)
754 {
755 return false;
756 }
757 else
758 {
759 return true;
760 }
761 }
762
763 static public implicit operator LSLFloat(int i)
764 {
765 return new LSLFloat(i);
766 }
767
768 static public implicit operator LSLFloat(double d)
769 {
770 return new LSLFloat(d);
771 }
772 #endregion
773
774 #region Overriders
775 public override string ToString()
776 {
777 return this.value.ToString();
778 }
779 #endregion
790 } 780 }
781
791 } 782 }
792} 783}