aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs333
1 files changed, 136 insertions, 197 deletions
diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
index a0bb3e0..b3ff765 100644
--- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
+++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstAbstract.cs
@@ -473,10 +473,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine
473 { 473 {
474 ScriptEventHandler seh; 474 ScriptEventHandler seh;
475 475
476 /* 476 // CallMode_NORMAL: run event handler from the beginning normally
477 * CallMode_NORMAL: run event handler from the beginning normally 477 // CallMode_RESTORE: restore event handler stack from stackFrames
478 * CallMode_RESTORE: restore event handler stack from stackFrames
479 */
480 callMode = (stackFrames == null) ? XMRInstAbstract.CallMode_NORMAL : 478 callMode = (stackFrames == null) ? XMRInstAbstract.CallMode_NORMAL :
481 XMRInstAbstract.CallMode_RESTORE; 479 XMRInstAbstract.CallMode_RESTORE;
482 480
@@ -723,25 +721,19 @@ namespace OpenSim.Region.ScriptEngine.Yengine
723 if(o is LSL_Vector) 721 if(o is LSL_Vector)
724 return "vector"; 722 return "vector";
725 723
726 /* 724 // A script-defined interface is represented as an array of delegates.
727 * A script-defined interface is represented as an array of delegates. 725 // If that is the case, convert it to the object of the script-defined
728 * If that is the case, convert it to the object of the script-defined 726 // class that is implementing the interface. This should let the next
729 * class that is implementing the interface. This should let the next 727 // step get the script-defined type name of the object.
730 * step get the script-defined type name of the object.
731 */
732 if(o is Delegate[]) 728 if(o is Delegate[])
733 o = ((Delegate[])o)[0].Target; 729 o = ((Delegate[])o)[0].Target;
734 730
735 /* 731 // If script-defined class instance, get the script-defined
736 * If script-defined class instance, get the script-defined 732 // type name.
737 * type name.
738 */
739 if(o is XMRSDTypeClObj) 733 if(o is XMRSDTypeClObj)
740 return ((XMRSDTypeClObj)o).sdtcClass.longName.val; 734 return ((XMRSDTypeClObj)o).sdtcClass.longName.val;
741 735
742 /* 736 // If it's a delegate, maybe we can look up its script-defined type name.
743 * If it's a delegate, maybe we can look up its script-defined type name.
744 */
745 Type ot = o.GetType(); 737 Type ot = o.GetType();
746 if(o is Delegate) 738 if(o is Delegate)
747 { 739 {
@@ -750,9 +742,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
750 return os; 742 return os;
751 } 743 }
752 744
753 /* 745 // Don't know what it is, get the C#-level type name.
754 * Don't know what it is, get the C#-level type name.
755 */
756 return ot.ToString(); 746 return ot.ToString();
757 } 747 }
758 748
@@ -964,17 +954,13 @@ namespace OpenSim.Region.ScriptEngine.Yengine
964 { 954 {
965 TokenDeclSDType sdType = inst.m_ObjCode.sdObjTypesIndx[sdtypeindex]; 955 TokenDeclSDType sdType = inst.m_ObjCode.sdObjTypesIndx[sdtypeindex];
966 956
967 /* 957 // If it is a script-defined interface object, convert to the original XMRSDTypeClObj.
968 * If it is a script-defined interface object, convert to the original XMRSDTypeClObj.
969 */
970 if(thrown is Delegate[]) 958 if(thrown is Delegate[])
971 { 959 {
972 thrown = ((Delegate[])thrown)[0].Target; 960 thrown = ((Delegate[])thrown)[0].Target;
973 } 961 }
974 962
975 /* 963 // If it is a script-defined delegate object, make sure it is an instance of the expected type.
976 * If it is a script-defined delegate object, make sure it is an instance of the expected type.
977 */
978 if(thrown is Delegate) 964 if(thrown is Delegate)
979 { 965 {
980 Type ot = thrown.GetType(); 966 Type ot = thrown.GetType();
@@ -982,17 +968,12 @@ namespace OpenSim.Region.ScriptEngine.Yengine
982 return (ot == tt) ? thrown : null; 968 return (ot == tt) ? thrown : null;
983 } 969 }
984 970
985 /* 971 // If it is a script-defined class object, make sure it is an instance of the expected class.
986 * If it is a script-defined class object, make sure it is an instance of the expected class.
987 */
988 if(thrown is XMRSDTypeClObj) 972 if(thrown is XMRSDTypeClObj)
989 { 973 {
990 974 // Step from the object's actual class rootward.
991 /* 975 // If we find the requested class along the way, the cast is valid.
992 * Step from the object's actual class rootward. 976 // If we run off the end of the root, the cast is not valid.
993 * If we find the requested class along the way, the cast is valid.
994 * If we run off the end of the root, the cast is not valid.
995 */
996 for(TokenDeclSDTypeClass ac = ((XMRSDTypeClObj)thrown).sdtcClass; ac != null; ac = ac.extends) 977 for(TokenDeclSDTypeClass ac = ((XMRSDTypeClObj)thrown).sdtcClass; ac != null; ac = ac.extends)
997 { 978 {
998 if(ac == sdType) 979 if(ac == sdType)
@@ -1000,9 +981,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1000 } 981 }
1001 } 982 }
1002 983
1003 /* 984 // Don't know what it is, assume it is not what caller wants.
1004 * Don't know what it is, assume it is not what caller wants.
1005 */
1006 return null; 985 return null;
1007 } 986 }
1008 987
@@ -1070,24 +1049,18 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1070 */ 1049 */
1071 public static void xmrArrayCopy(object srcobj, int srcstart, object dstobj, int dststart, int count) 1050 public static void xmrArrayCopy(object srcobj, int srcstart, object dstobj, int dststart, int count)
1072 { 1051 {
1073 /* 1052 // The script writer should only pass us script-defined class objects.
1074 * The script writer should only pass us script-defined class objects. 1053 // Throw exception otherwise.
1075 * Throw exception otherwise.
1076 */
1077 XMRSDTypeClObj srcsdt = (XMRSDTypeClObj)srcobj; 1054 XMRSDTypeClObj srcsdt = (XMRSDTypeClObj)srcobj;
1078 XMRSDTypeClObj dstsdt = (XMRSDTypeClObj)dstobj; 1055 XMRSDTypeClObj dstsdt = (XMRSDTypeClObj)dstobj;
1079 1056
1080 /* 1057 // Get the script-visible type name of the arrays, brackets and all.
1081 * Get the script-visible type name of the arrays, brackets and all.
1082 */
1083 string srctypename = srcsdt.sdtcClass.longName.val; 1058 string srctypename = srcsdt.sdtcClass.longName.val;
1084 string dsttypename = dstsdt.sdtcClass.longName.val; 1059 string dsttypename = dstsdt.sdtcClass.longName.val;
1085 1060
1086 /* 1061 // The part before the first '[' of each should match exactly,
1087 * The part before the first '[' of each should match exactly, 1062 // meaning the basic data type (eg, float, List<string>) is the same.
1088 * meaning the basic data type (eg, float, List<string>) is the same. 1063 // And there must be a '[' in each meaning that it is a script-defined array type.
1089 * And there must be a '[' in each meaning that it is a script-defined array type.
1090 */
1091 int i = srctypename.IndexOf('['); 1064 int i = srctypename.IndexOf('[');
1092 int j = dsttypename.IndexOf('['); 1065 int j = dsttypename.IndexOf('[');
1093 if((i < 0) || (j < 0)) 1066 if((i < 0) || (j < 0))
@@ -1095,12 +1068,10 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1095 if((i != j) || !srctypename.StartsWith(dsttypename.Substring(0, j))) 1068 if((i != j) || !srctypename.StartsWith(dsttypename.Substring(0, j)))
1096 throw new ArrayTypeMismatchException(srctypename + " vs " + dsttypename); 1069 throw new ArrayTypeMismatchException(srctypename + " vs " + dsttypename);
1097 1070
1098 /* 1071 // The number of brackets must match exactly.
1099 * The number of brackets must match exactly. 1072 // This permits copying from something like a float[,][] to something like a float[][].
1100 * This permits copying from something like a float[,][] to something like a float[][]. 1073 // But you cannot copy from a float[][] to a float[] or wisa wersa.
1101 * But you cannot copy from a float[][] to a float[] or wisa wersa. 1074 // Counting either '[' or ']' would work equally well.
1102 * Counting either '[' or ']' would work equally well.
1103 */
1104 int srclen = srctypename.Length; 1075 int srclen = srctypename.Length;
1105 int dstlen = dsttypename.Length; 1076 int dstlen = dsttypename.Length;
1106 int srcjags = 0; 1077 int srcjags = 0;
@@ -1114,9 +1085,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1114 if(dstjags != srcjags) 1085 if(dstjags != srcjags)
1115 throw new ArrayTypeMismatchException(srctypename + " vs " + dsttypename); 1086 throw new ArrayTypeMismatchException(srctypename + " vs " + dsttypename);
1116 1087
1117 /* 1088 // Perform the copy.
1118 * Perform the copy.
1119 */
1120 Array srcarray = (Array)srcsdt.instVars.iarObjects[0]; 1089 Array srcarray = (Array)srcsdt.instVars.iarObjects[0];
1121 Array dstarray = (Array)dstsdt.instVars.iarObjects[0]; 1090 Array dstarray = (Array)dstsdt.instVars.iarObjects[0];
1122 Array.Copy(srcarray, srcstart, dstarray, dststart, count); 1091 Array.Copy(srcarray, srcstart, dstarray, dststart, count);
@@ -1131,19 +1100,15 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1131 */ 1100 */
1132 public static LSL_List xmrArray2List(object srcar, int start, int count) 1101 public static LSL_List xmrArray2List(object srcar, int start, int count)
1133 { 1102 {
1134 /* 1103 // Get the script-visible type of the array.
1135 * Get the script-visible type of the array. 1104 // We only do arrays.
1136 * We only do arrays.
1137 */
1138 XMRSDTypeClObj array = (XMRSDTypeClObj)srcar; 1105 XMRSDTypeClObj array = (XMRSDTypeClObj)srcar;
1139 TokenDeclSDTypeClass sdtClass = array.sdtcClass; 1106 TokenDeclSDTypeClass sdtClass = array.sdtcClass;
1140 if(sdtClass.arrayOfRank == 0) 1107 if(sdtClass.arrayOfRank == 0)
1141 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val); 1108 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val);
1142 1109
1143 /* 1110 // Validate objects they want to put in the list.
1144 * Validate objects they want to put in the list. 1111 // We can't allow anything funky that OpenSim runtime doesn't expect.
1145 * We can't allow anything funky that OpenSim runtime doesn't expect.
1146 */
1147 Array srcarray = (Array)array.instVars.iarObjects[0]; 1112 Array srcarray = (Array)array.instVars.iarObjects[0];
1148 object[] output = new object[count]; 1113 object[] output = new object[count];
1149 for(int i = 0; i < count; i++) 1114 for(int i = 0; i < count; i++)
@@ -1179,9 +1144,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1179 throw new InvalidCastException("invalid element " + i + " type " + src.GetType().Name); 1144 throw new InvalidCastException("invalid element " + i + " type " + src.GetType().Name);
1180 } 1145 }
1181 1146
1182 /* 1147 // Make a list out of that now immutable array.
1183 * Make a list out of that now immutable array.
1184 */
1185 return new LSL_List(output); 1148 return new LSL_List(output);
1186 } 1149 }
1187 1150
@@ -1195,19 +1158,15 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1195 */ 1158 */
1196 public static void xmrList2Array(LSL_List srclist, int srcstart, object dstobj, int dststart, int count) 1159 public static void xmrList2Array(LSL_List srclist, int srcstart, object dstobj, int dststart, int count)
1197 { 1160 {
1198 /* 1161 // Get the script-visible type of the destination.
1199 * Get the script-visible type of the destination. 1162 // We only do arrays.
1200 * We only do arrays.
1201 */
1202 XMRSDTypeClObj dstarray = (XMRSDTypeClObj)dstobj; 1163 XMRSDTypeClObj dstarray = (XMRSDTypeClObj)dstobj;
1203 TokenDeclSDTypeClass sdtClass = dstarray.sdtcClass; 1164 TokenDeclSDTypeClass sdtClass = dstarray.sdtcClass;
1204 if(sdtClass.arrayOfType == null) 1165 if(sdtClass.arrayOfType == null)
1205 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val); 1166 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val);
1206 1167
1207 /* 1168 // Copy from the immutable array to the mutable array.
1208 * Copy from the immutable array to the mutable array. 1169 // Strip off any LSL wrappers as the script code doesn't expect any.
1209 * Strip off any LSL wrappers as the script code doesn't expect any.
1210 */
1211 object[] srcarr = srclist.Data; 1170 object[] srcarr = srclist.Data;
1212 Array dstarr = (Array)dstarray.instVars.iarObjects[0]; 1171 Array dstarr = (Array)dstarray.instVars.iarObjects[0];
1213 1172
@@ -1233,18 +1192,14 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1233 */ 1192 */
1234 public static string xmrChars2String(object srcar, int start, int count) 1193 public static string xmrChars2String(object srcar, int start, int count)
1235 { 1194 {
1236 /* 1195 // Make sure they gave us a script-defined array object.
1237 * Make sure they gave us a script-defined array object.
1238 */
1239 XMRSDTypeClObj array = (XMRSDTypeClObj)srcar; 1196 XMRSDTypeClObj array = (XMRSDTypeClObj)srcar;
1240 TokenDeclSDTypeClass sdtClass = array.sdtcClass; 1197 TokenDeclSDTypeClass sdtClass = array.sdtcClass;
1241 if(sdtClass.arrayOfRank == 0) 1198 if(sdtClass.arrayOfRank == 0)
1242 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val); 1199 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val);
1243 1200
1244 /* 1201 // We get a type cast error from mono if they didn't give us a character array.
1245 * We get a type cast error from mono if they didn't give us a character array. 1202 // But if it is ok, create a string from the requested characters.
1246 * But if it is ok, create a string from the requested characters.
1247 */
1248 char[] srcarray = (char[])array.instVars.iarObjects[0]; 1203 char[] srcarray = (char[])array.instVars.iarObjects[0];
1249 return new string(srcarray, start, count); 1204 return new string(srcarray, start, count);
1250 } 1205 }
@@ -1259,18 +1214,14 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1259 */ 1214 */
1260 public static void xmrString2Chars(string srcstr, int srcstart, object dstobj, int dststart, int count) 1215 public static void xmrString2Chars(string srcstr, int srcstart, object dstobj, int dststart, int count)
1261 { 1216 {
1262 /* 1217 // Make sure they gave us a script-defined array object.
1263 * Make sure they gave us a script-defined array object.
1264 */
1265 XMRSDTypeClObj dstarray = (XMRSDTypeClObj)dstobj; 1218 XMRSDTypeClObj dstarray = (XMRSDTypeClObj)dstobj;
1266 TokenDeclSDTypeClass sdtClass = dstarray.sdtcClass; 1219 TokenDeclSDTypeClass sdtClass = dstarray.sdtcClass;
1267 if(sdtClass.arrayOfType == null) 1220 if(sdtClass.arrayOfType == null)
1268 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val); 1221 throw new InvalidCastException("only do arrays not " + sdtClass.longName.val);
1269 1222
1270 /* 1223 // We get a type cast error from mono if they didn't give us a character array.
1271 * We get a type cast error from mono if they didn't give us a character array. 1224 // But if it is ok, copy from the string to the character array.
1272 * But if it is ok, copy from the string to the character array.
1273 */
1274 char[] dstarr = (char[])dstarray.instVars.iarObjects[0]; 1225 char[] dstarr = (char[])dstarray.instVars.iarObjects[0];
1275 for(int i = 0; i < count; i++) 1226 for(int i = 0; i < count; i++)
1276 dstarr[i + dststart] = srcstr[i + srcstart]; 1227 dstarr[i + dststart] = srcstr[i + srcstart];
@@ -1343,12 +1294,12 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1343 1294
1344 // '"'<string>'"' 1295 // '"'<string>'"'
1345 case '"': 1296 case '"':
1346 { 1297 {
1347 --idx; 1298 --idx;
1348 string val = ParseJSONString(json, ref idx); 1299 string val = ParseJSONString(json, ref idx);
1349 dict.SetByKey(keys, val); 1300 dict.SetByKey(keys, val);
1350 break; 1301 break;
1351 } 1302 }
1352 // true false null 1303 // true false null
1353 case 't': 1304 case 't':
1354 if(json.Substring(idx, 3) != "rue") 1305 if(json.Substring(idx, 3) != "rue")
@@ -1373,12 +1324,12 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1373 1324
1374 // otherwise assume it's a number 1325 // otherwise assume it's a number
1375 default: 1326 default:
1376 { 1327 {
1377 --idx; 1328 --idx;
1378 object val = ParseJSONNumber(json, ref idx); 1329 object val = ParseJSONNumber(json, ref idx);
1379 dict.SetByKey(keys, val); 1330 dict.SetByKey(keys, val);
1380 break; 1331 break;
1381 } 1332 }
1382 } 1333 }
1383 return idx; 1334 return idx;
1384 } 1335 }
@@ -1805,9 +1756,7 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1805 { 1756 {
1806 BinaryWriter mow = this.migrateOutWriter; 1757 BinaryWriter mow = this.migrateOutWriter;
1807 1758
1808 /* 1759 // Value types (including nulls) are always output directly.
1809 * Value types (including nulls) are always output directly.
1810 */
1811 if(graph == null) 1760 if(graph == null)
1812 { 1761 {
1813 mow.Write((byte)Ser.NULL); 1762 mow.Write((byte)Ser.NULL);
@@ -1893,20 +1842,16 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1893 return; 1842 return;
1894 } 1843 }
1895 1844
1896 /* 1845 // Script instance pointer is always just that.
1897 * Script instance pointer is always just that.
1898 */
1899 if(graph == this) 1846 if(graph == this)
1900 { 1847 {
1901 mow.Write((byte)Ser.XMRINST); 1848 mow.Write((byte)Ser.XMRINST);
1902 return; 1849 return;
1903 } 1850 }
1904 1851
1905 /* 1852 // Convert lists to object type.
1906 * Convert lists to object type. 1853 // This is compatible with old migration data and also
1907 * This is compatible with old migration data and also 1854 // two vars pointing to same list won't duplicate it.
1908 * two vars pointing to same list won't duplicate it.
1909 */
1910 if(graph is LSL_List) 1855 if(graph is LSL_List)
1911 { 1856 {
1912 object[] data = ((LSL_List)graph).Data; 1857 object[] data = ((LSL_List)graph).Data;
@@ -1920,14 +1865,12 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1920 graph = oll; 1865 graph = oll;
1921 } 1866 }
1922 1867
1923 /* 1868 // If this same exact object was already serialized,
1924 * If this same exact object was already serialized, 1869 // just output an index telling the receiver to use
1925 * just output an index telling the receiver to use 1870 // that same old object, rather than creating a whole
1926 * that same old object, rather than creating a whole 1871 // new object with the same values. Also this prevents
1927 * new object with the same values. Also this prevents 1872 // self-referencing objects (like arrays) from causing
1928 * self-referencing objects (like arrays) from causing 1873 // an infinite loop.
1929 * an infinite loop.
1930 */
1931 int ident; 1874 int ident;
1932 if(this.migrateOutObjects.TryGetValue(graph, out ident)) 1875 if(this.migrateOutObjects.TryGetValue(graph, out ident))
1933 { 1876 {
@@ -1936,20 +1879,16 @@ namespace OpenSim.Region.ScriptEngine.Yengine
1936 return; 1879 return;
1937 } 1880 }
1938 1881
1939 /* 1882 // Object not seen before, save its address with an unique
1940 * Object not seen before, save its address with an unique 1883 // ident number that the receiver can easily regenerate.
1941 * ident number that the receiver can easily regenerate.
1942 */
1943 ident = this.migrateOutObjects.Count; 1884 ident = this.migrateOutObjects.Count;
1944 this.migrateOutObjects.Add(graph, ident); 1885 this.migrateOutObjects.Add(graph, ident);
1945 1886
1946 /* 1887 // Now output the object's value(s).
1947 * Now output the object's value(s). 1888 // If the object self-references, the object is alreay entered
1948 * If the object self-references, the object is alreay entered 1889 // in the dictionary and so the self-reference will just emit
1949 * in the dictionary and so the self-reference will just emit 1890 // a DUPREF tag instead of trying to output the whole object
1950 * a DUPREF tag instead of trying to output the whole object 1891 // again.
1951 * again.
1952 */
1953 if(graph is ObjLslList) 1892 if(graph is ObjLslList)
1954 { 1893 {
1955 mow.Write((byte)Ser.LSLLIST); 1894 mow.Write((byte)Ser.LSLLIST);
@@ -2182,43 +2121,43 @@ namespace OpenSim.Region.ScriptEngine.Yengine
2182 return new LSL_Key((string)RecvObjValue()); 2121 return new LSL_Key((string)RecvObjValue());
2183 2122
2184 case Ser.LSLLIST: 2123 case Ser.LSLLIST:
2185 { 2124 {
2186 this.migrateInObjects.Add(ident, null); // placeholder 2125 this.migrateInObjects.Add(ident, null); // placeholder
2187 object[] data = (object[])RecvObjValue(); // read data, maybe using another index 2126 object[] data = (object[])RecvObjValue(); // read data, maybe using another index
2188 LSL_List list = new LSL_List(data); // make LSL-level list 2127 LSL_List list = new LSL_List(data); // make LSL-level list
2189 this.migrateInObjects[ident] = list; // fill in slot 2128 this.migrateInObjects[ident] = list; // fill in slot
2190 return list; 2129 return list;
2191 } 2130 }
2192 2131
2193 case Ser.LSLROT: 2132 case Ser.LSLROT:
2194 { 2133 {
2195 double x = mir.ReadDouble(); 2134 double x = mir.ReadDouble();
2196 double y = mir.ReadDouble(); 2135 double y = mir.ReadDouble();
2197 double z = mir.ReadDouble(); 2136 double z = mir.ReadDouble();
2198 double w = mir.ReadDouble(); 2137 double w = mir.ReadDouble();
2199 return new LSL_Rotation(x, y, z, w); 2138 return new LSL_Rotation(x, y, z, w);
2200 } 2139 }
2201 case Ser.LSLSTR: 2140 case Ser.LSLSTR:
2202 return new LSL_String((string)RecvObjValue()); 2141 return new LSL_String((string)RecvObjValue());
2203 2142
2204 case Ser.LSLVEC: 2143 case Ser.LSLVEC:
2205 { 2144 {
2206 double x = mir.ReadDouble(); 2145 double x = mir.ReadDouble();
2207 double y = mir.ReadDouble(); 2146 double y = mir.ReadDouble();
2208 double z = mir.ReadDouble(); 2147 double z = mir.ReadDouble();
2209 return new LSL_Vector(x, y, z); 2148 return new LSL_Vector(x, y, z);
2210 } 2149 }
2211 2150
2212 case Ser.SYSARRAY: 2151 case Ser.SYSARRAY:
2213 { 2152 {
2214 Type eletype = String2SysType(mir.ReadString()); 2153 Type eletype = String2SysType(mir.ReadString());
2215 int length = mir.ReadInt32(); 2154 int length = mir.ReadInt32();
2216 Array array = Array.CreateInstance(eletype, length); 2155 Array array = Array.CreateInstance(eletype, length);
2217 this.migrateInObjects.Add(ident, array); 2156 this.migrateInObjects.Add(ident, array);
2218 for(int i = 0; i < length; i++) 2157 for(int i = 0; i < length; i++)
2219 array.SetValue(RecvObjValue(), i); 2158 array.SetValue(RecvObjValue(), i);
2220 return array; 2159 return array;
2221 } 2160 }
2222 2161
2223 case Ser.SYSBOOL: 2162 case Ser.SYSBOOL:
2224 return mir.ReadBoolean(); 2163 return mir.ReadBoolean();
@@ -2241,21 +2180,21 @@ namespace OpenSim.Region.ScriptEngine.Yengine
2241 return s; 2180 return s;
2242 2181
2243 case Ser.XMRARRAY: 2182 case Ser.XMRARRAY:
2244 { 2183 {
2245 XMR_Array array = new XMR_Array(this); 2184 XMR_Array array = new XMR_Array(this);
2246 this.migrateInObjects.Add(ident, array); 2185 this.migrateInObjects.Add(ident, array);
2247 array.RecvArrayObj(this.RecvObjValue); 2186 array.RecvArrayObj(this.RecvObjValue);
2248 return array; 2187 return array;
2249 } 2188 }
2250 2189
2251 case Ser.DUPREF: 2190 case Ser.DUPREF:
2252 { 2191 {
2253 ident = mir.ReadInt32(); 2192 ident = mir.ReadInt32();
2254 object obj = this.migrateInObjects[ident]; 2193 object obj = this.migrateInObjects[ident];
2255 if(obj is ObjLslList) 2194 if(obj is ObjLslList)
2256 obj = new LSL_List(((ObjLslList)obj).objarray); 2195 obj = new LSL_List(((ObjLslList)obj).objarray);
2257 return obj; 2196 return obj;
2258 } 2197 }
2259 2198
2260 case Ser.XMRINST: 2199 case Ser.XMRINST:
2261 return this; 2200 return this;
@@ -2276,29 +2215,29 @@ namespace OpenSim.Region.ScriptEngine.Yengine
2276 return clobj; 2215 return clobj;
2277 2216
2278 case Ser.SYSERIAL: 2217 case Ser.SYSERIAL:
2279 { 2218 {
2280 int rawLength = mir.ReadInt32(); 2219 int rawLength = mir.ReadInt32();
2281 byte[] rawBytes = mir.ReadBytes(rawLength); 2220 byte[] rawBytes = mir.ReadBytes(rawLength);
2282 MemoryStream memoryStream = new MemoryStream(rawBytes); 2221 MemoryStream memoryStream = new MemoryStream(rawBytes);
2283 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bformatter = 2222 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bformatter =
2284 new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); 2223 new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
2285 object graph = bformatter.Deserialize(memoryStream); 2224 object graph = bformatter.Deserialize(memoryStream);
2286 this.migrateInObjects.Add(ident, graph); 2225 this.migrateInObjects.Add(ident, graph);
2287 return graph; 2226 return graph;
2288 } 2227 }
2289 2228
2290 case Ser.THROWNEX: 2229 case Ser.THROWNEX:
2291 { 2230 {
2292 int rawLength = mir.ReadInt32(); 2231 int rawLength = mir.ReadInt32();
2293 byte[] rawBytes = mir.ReadBytes(rawLength); 2232 byte[] rawBytes = mir.ReadBytes(rawLength);
2294 MemoryStream memoryStream = new MemoryStream(rawBytes); 2233 MemoryStream memoryStream = new MemoryStream(rawBytes);
2295 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bformatter = 2234 System.Runtime.Serialization.Formatters.Binary.BinaryFormatter bformatter =
2296 new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter(); 2235 new System.Runtime.Serialization.Formatters.Binary.BinaryFormatter();
2297 object graph = bformatter.Deserialize(memoryStream); 2236 object graph = bformatter.Deserialize(memoryStream);
2298 this.migrateInObjects.Add(ident, graph); 2237 this.migrateInObjects.Add(ident, graph);
2299 ((ScriptThrownException)graph).thrown = RecvObjValue(); 2238 ((ScriptThrownException)graph).thrown = RecvObjValue();
2300 return graph; 2239 return graph;
2301 } 2240 }
2302 2241
2303 default: 2242 default:
2304 throw new Exception("bad stream code " + code.ToString()); 2243 throw new Exception("bad stream code " + code.ToString());