Esempio n. 1
0
 /// <summary>
 /// String constructor.
 /// Given result stores both type and idenfitierexpression whose Value is used as content
 /// </summary>
 public ArrayValue(ArrayType stringLiteralResult, IdentifierExpression stringLiteral=null)
     : base(ExpressionValueType.Array, stringLiteralResult, stringLiteral)
 {
     if (stringLiteralResult.DeclarationOrExpressionBase is IdentifierExpression)
         StringValue = ((IdentifierExpression)stringLiteralResult.DeclarationOrExpressionBase).Value as string;
     else
         StringValue = stringLiteral.Value as string;
 }
Esempio n. 2
0
 /// <summary>
 /// String constructor.
 /// Given result stores both type and idenfitierexpression whose Value is used as content
 /// </summary>
 public ArrayValue(ArrayType stringLiteralResult, IdentifierExpression stringLiteral = null)
     : base(stringLiteralResult)
 {
     StringFormat = LiteralSubformat.Utf8;
     if (stringLiteralResult.DeclarationOrExpressionBase is IdentifierExpression)
     {
         StringFormat = ((IdentifierExpression)stringLiteralResult.DeclarationOrExpressionBase).Subformat;
         StringValue = ((IdentifierExpression)stringLiteralResult.DeclarationOrExpressionBase).StringValue;
     }
     else
         StringValue = stringLiteral.StringValue;
 }
Esempio n. 3
0
 public ArrayValue(ArrayType resolvedArrayType, params ISymbolValue[] elements)
     : base(resolvedArrayType)
 {
     Elements = elements;
 }
Esempio n. 4
0
 /// <summary>
 /// String constructor.
 /// Used for generating string results 'internally'.
 /// </summary>
 public ArrayValue(ArrayType stringTypeResult, string content)
     : base(stringTypeResult)
 {
     StringFormat = LiteralSubformat.Utf8;
     StringValue = content;
 }
 public void VisitArrayType(ArrayType at)
 {
     VisitAssocArrayType(at);
 }
		ObjectValue EvaluateArray (int arrayLength, ulong firstItemPointer, ArrayType t, ObjectValueFlags flags, ObjectPath path)
		{
			if (firstItemPointer < 1)
				return ObjectValue.CreateNullObject (ValueSource, path, t.ToCode (), flags | ObjectValueFlags.Array);

			var elementType = t.ValueType;
			var elementTypeToken = elementType is PrimitiveType ? (elementType as PrimitiveType).TypeToken : DTokens.INVALID;

			var ov = ObjectValue.CreateArray (ValueSource, path, t.ToCode (), (int)arrayLength, flags, null);

			// Strings
			if (DGdbTools.IsCharType (elementTypeToken)) {
				var elementsToDisplay = (int)Math.Min (arrayLength, MaximumDisplayCount);
				byte[] rawArrayContent;
				Memory.Read (firstItemPointer.ToString (), DGdbTools.SizeOf(elementTypeToken) * elementsToDisplay, out rawArrayContent);

				var str = DGdbTools.GetStringValue (rawArrayContent, elementTypeToken);

				ov.DisplayValue = arrayLength.ToString () + "´\"" + str + "\"";

				/* Return as an atomic value only
				return ObjectValue.CreatePrimitive (ValueSource, path, t.ToString (), 
				                                    new EvaluationResult (str, arrayLength.ToString () + "´\"" + str + "\""), 
				                                    flags | ObjectValueFlags.Array);
				*/
			}

			return ov;
		}
		ObjectValue EvaluateArray (byte[] rawBytes, int start, ArrayType t, ObjectValueFlags flags, ObjectPath path)
		{
			int arrayLength;
			ulong firstItem;
			ExamArrayInfo (rawBytes, start, out arrayLength, out firstItem);

			return EvaluateArray (arrayLength, firstItem, t, flags, path);
		}
		ObjectValue EvaluateArray (string exp, ArrayType t, ObjectValueFlags flags, ObjectPath path)
		{
			var header = Memory.ReadDArrayHeader (exp);
			return EvaluateArray (header.Length, header.FirstItem.ToUInt64 (), t, flags, path);
		}
Esempio n. 9
0
		public void VisitArrayType(ArrayType t)
		{
			AcceptType(t.Base);
			sb.Append(t.IsStaticArray && t.FixedLength >= 0 ? string.Format("[{0}]", t.FixedLength) : "[]");
		}
Esempio n. 10
0
 public ArrayValue(ArrayType resolvedArrayType, params ISymbolValue[] elements)
     : base(ExpressionValueType.Array, resolvedArrayType)
 {
     Elements = elements;
 }
Esempio n. 11
0
 /// <summary>
 /// String constructor.
 /// Used for generating string results 'internally'.
 /// </summary>
 public ArrayValue(ArrayType stringTypeResult, IExpression baseExpression, string content)
     : base(ExpressionValueType.Array, stringTypeResult, baseExpression)
 {
     StringValue = content;
 }