From 929363876526640062ed87096662baf3533b8726 Mon Sep 17 00:00:00 2001 From: Unknown Date: Thu, 21 Jul 2011 09:36:47 -0700 Subject: unified URI format across translations --- BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs | 8 +++++++- BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs | 2 +- BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py | 1 - 3 files changed, 8 insertions(+), 3 deletions(-) (limited to 'BCT') diff --git a/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs b/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs index 235cdc79..ff6f3298 100644 --- a/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs +++ b/BCT/BytecodeTranslator/Phone/PhoneCodeHelper.cs @@ -194,7 +194,13 @@ namespace BytecodeTranslator.Phone { public static string getURIBase(string uri) { // I need to build an absolute URI just to call getComponents() ... Uri mockBaseUri = new Uri("mock://mock/", UriKind.RelativeOrAbsolute); - Uri realUri = new Uri(mockBaseUri, uri); + Uri realUri; + try { + realUri = new Uri(uri, UriKind.Absolute); + } catch (UriFormatException) { + // uri string is relative + realUri = new Uri(mockBaseUri, uri); + } string str= realUri.GetComponents(UriComponents.Path|UriComponents.StrongAuthority|UriComponents.Scheme, UriFormat.UriEscaped); Uri mockStrippedUri = new Uri(str); diff --git a/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs b/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs index ebbf9222..b0387221 100644 --- a/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs +++ b/BCT/BytecodeTranslator/Phone/PhoneNavigationTraverser.cs @@ -40,7 +40,7 @@ namespace BytecodeTranslator.Phone { Assignment uriInitAssign = new Assignment() { Source = new CompileTimeConstant() { Type = host.PlatformType.SystemString, - Value = mainPageUri, + Value = PhoneCodeHelper.getURIBase(mainPageUri), }, Type = host.PlatformType.SystemString, Target = new TargetExpression() { diff --git a/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py b/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py index 5c9da941..c9a63c92 100644 --- a/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py +++ b/BCT/PhoneControlsExtractor/PhoneBoogieCodeGenerator.py @@ -56,7 +56,6 @@ def outputMainProcedure(file): file.write("\tvar $isEnabled: bool;\n") file.write("\tvar $control: Ref;\n\n") - file.write("\t$Exception := null;\n") for i in range(0,len(boogiePageVars)): file.write("\tcall " + boogiePageClasses[i] + ".#ctor(" + boogiePageVars[i] + ");\n") -- cgit v1.2.3