Another iby fix! Also added --raw option to pubsub and multiply command to var.
authorTom Sutcliffe <thomas.sutcliffe@accenture.com>
Wed, 01 Sep 2010 15:17:20 +0100
changeset 51 3ad902ef5222
parent 50 db96d73779bc
child 52 e07366cad0b2
Another iby fix! Also added --raw option to pubsub and multiply command to var.
build/common/fshell.iby
commands/pubsub/pubsub.cif
commands/pubsub/pubsub.cpp
core/builtins/var.cif
core/src/commands.cpp
core/src/commands.h
core/tsrc/fshell-basic-test.script
--- a/build/common/fshell.iby	Wed Sep 01 11:12:38 2010 +0100
+++ b/build/common/fshell.iby	Wed Sep 01 15:17:20 2010 +0100
@@ -44,6 +44,9 @@
 #include <defcons.iby>
 #include <consoleproxy.iby>
 FSHELL_EXECUTABLE_FILE(consoleextensions.dll) // TODO move this to the new fshell_consoles.iby
+
+#ifdef FSHELL_TRACECORE_SUPPORT
 FSHELL_EXECUTABLE_FILE(terminalkeyboardcons.dll) // TODO move this to the new fshell_consoles.iby
+#endif
 
 #endif // FSHELL_IBY
--- a/commands/pubsub/pubsub.cif	Wed Sep 01 11:12:38 2010 +0100
+++ b/commands/pubsub/pubsub.cif	Wed Sep 01 15:17:20 2010 +0100
@@ -68,6 +68,10 @@
 
 When specified in conjunction with the C<notify> command, uses C<CBtracePubSub> to get the notifications instead of using C<RProperty::Subscribe> or C<memoryaccess>.
 
+==option bool r raw
+
+When specified in conjunction with the C<get> command, print out just the value, rather than the usual more verbose format that shows the category, key, type and value.
+
 ==copyright
 
 Copyright (c) 2008-2010 Accenture. All rights reserved.
--- a/commands/pubsub/pubsub.cpp	Wed Sep 01 11:12:38 2010 +0100
+++ b/commands/pubsub/pubsub.cpp	Wed Sep 01 15:17:20 2010 +0100
@@ -68,6 +68,7 @@
 	HBufC* iStringVal;
 	TInt iIntVal;
 	TBool iForce;
+	TBool iRaw;
 
 	TBool iNotify;
 	TBool iDefine;
@@ -342,15 +343,29 @@
 		switch (type)
 			{
 			case EInt:
-				Printf(_L("0x%08x 0x%08x TInt: %d (0x%x)\r\n"), aCategory, aKey, valInt, valInt);
+				if (iRaw)
+					{
+					Printf(_L("%d"), valInt);
+					}
+				else
+					{
+					Printf(_L("0x%08x 0x%08x TInt: %d (0x%x)\r\n"), aCategory, aKey, valInt, valInt);
+					}
 				break;
 			case EDes:
 				{
-				TPtrC8 des(valDes);
-				if (!aFull) des.Set(valDes.Left(32)); // Don't print the whole thing, only 2 lines max
-				Printf(_L("0x%08x 0x%08x TDesC8 hex dump:\r\n"), aCategory, aKey);
-				LtkUtils::HexDumpToOutput(des, Stdout());
-				if (des.Length() < valDes.Length()) Write(_L("...\r\n"));
+				if (iRaw)
+					{
+					Printf(_L8("%S"), &valDes);
+					}
+				else
+					{
+					TPtrC8 des(valDes);
+					if (!aFull) des.Set(valDes.Left(32)); // Don't print the whole thing, only 2 lines max
+					Printf(_L("0x%08x 0x%08x TDesC8 hex dump:\r\n"), aCategory, aKey);
+					LtkUtils::HexDumpToOutput(des, Stdout());
+					if (des.Length() < valDes.Length()) Write(_L("...\r\n"));
+					}
 				break;
 				}
 			default:
@@ -376,6 +391,7 @@
 #ifdef FSHELL_TRACE_SUPPORT
 	aOptions.AppendBoolL(iUseBtrace, _L("btrace"));
 #endif
+	aOptions.AppendBoolL(iRaw, _L("raw"));
 	//aOptions.AppendStringL(iStringVal, '8', _L("set-data"), _L("Sets the specified key to this 8-bit value"));
 	//aOptions.AppendBoolL(iDelete, 'l', _L("delete"), _L("Deletes the specified property"));
 	}
--- a/core/builtins/var.cif	Wed Sep 01 11:12:38 2010 +0100
+++ b/core/builtins/var.cif	Wed Sep 01 15:17:20 2010 +0100
@@ -64,6 +64,10 @@
 
 Subtracts the given value from the environment variable. Semantics as per add.
 
+==enum-value multiply
+
+Multiply the specified environment variable by the given value.
+
 ==argument string argument optional
 
 The argument to the operation.
--- a/core/src/commands.cpp	Wed Sep 01 11:12:38 2010 +0100
+++ b/core/src/commands.cpp	Wed Sep 01 15:17:20 2010 +0100
@@ -3428,16 +3428,19 @@
 			break;
 		case EAdd:
 		case ESubtract:
+		case EMultiply:
 			{
-			if (iArg == NULL) LeaveIfErr(KErrArgument, _L("Argument must be specified for add and subtract operations"));
+			if (iArg == NULL) LeaveIfErr(KErrArgument, _L("Argument must be specified for add, subtract and multiply operations"));
 			TLex lex(*iArg);
 			TInt operand;
 			TInt err = lex.Val(operand);
 			LeaveIfErr(err, _L("Couldn't parse an integer from argument '%S'"), iArg);
-			if (iOperation == ESubtract) operand = -operand;
-			TInt current = 0;
-			TRAP_IGNORE(current = env.GetAsIntL(*iVar1)); // If it doesn't yet exist or isn't an int, we'll treat it as if it was zero
-			env.SetL(*iVar1, current + operand);
+			TInt value = 0;
+			TRAP_IGNORE(value = env.GetAsIntL(*iVar1)); // If it doesn't yet exist or isn't an int, we'll treat it as if it was zero
+			if (iOperation == ESubtract) value = value - operand;
+			else if (iOperation == EMultiply) value = value * operand;
+			else value = value + operand;
+			env.SetL(*iVar1, value);
 			break;
 			}
 		default:
--- a/core/src/commands.h	Wed Sep 01 11:12:38 2010 +0100
+++ b/core/src/commands.h	Wed Sep 01 15:17:20 2010 +0100
@@ -729,6 +729,7 @@
 		ENotEqual,
 		EAdd,
 		ESubtract,
+		EMultiply,
 		} iOperation;
 	HBufC* iVar1;
 	HBufC* iArg;
--- a/core/tsrc/fshell-basic-test.script	Wed Sep 01 11:12:38 2010 +0100
+++ b/core/tsrc/fshell-basic-test.script	Wed Sep 01 15:17:20 2010 +0100
@@ -154,6 +154,11 @@
 #TODO with $A defined this no longer works - is this reasonable? I'm guessing the string is expanded left-to-right.
 #echo $A$INNER | export -s RESULT # I'd like this to expand to $ANEST then to "correct" but it expands to aaaNEST
 
+# Check what characters are allowed in an environment variable name - I'm assuming |&$^#;"' aren't a good idea
+export AWKWARD-!£%*()_+=/\[]{}:@ "really awkward thing"
+echo -n "Evil $AWKWARD-!£%*()_+=/\[]{}:@." | export -s RESULT
+var RESULT == "Evil really awkward thing." || $Error
+
 # Test that errors reported from scripts are reported with correct line numbers
 export EXPECTED_ERR "Error: Aborted ^"$SCRIPT_PATHprinterror.script^" at line 17 : KErrNotFound (-1)^r^n"