[X86][IR] Reduce the number of full string comparisons in the code that autoupgrades masked shift intrinsics.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@286768 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/IR/AutoUpgrade.cpp
+++ lib/IR/AutoUpgrade.cpp
@@ -1355,162 +1355,179 @@
                                { CI->getArgOperand(0), CI->getArgOperand(1) });
       Rep = EmitX86Select(Builder, CI->getArgOperand(3), Rep,
                           CI->getArgOperand(2));
-    } else if (IsX86 && Name == "avx512.mask.psll.d.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psll_d);
-    } else if (IsX86 && Name == "avx512.mask.psll.d.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psll_d);
-    } else if (IsX86 && Name == "avx512.mask.psll.d") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psll_d_512);
-    } else if (IsX86 && Name == "avx512.mask.psll.q.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psll_q);
-    } else if (IsX86 && Name == "avx512.mask.psll.q.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psll_q);
-    } else if (IsX86 && Name == "avx512.mask.psll.q") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psll_q_512);
-    } else if (IsX86 && Name == "avx512.mask.psll.w.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psll_w);
-    } else if (IsX86 && Name == "avx512.mask.psll.w.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psll_w);
-    } else if (IsX86 && Name == "avx512.mask.psll.w.512") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psll_w_512);
-    } else if (IsX86 && Name == "avx512.mask.psra.d.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psra_d);
-    } else if (IsX86 && Name == "avx512.mask.psra.d.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psra_d);
-    } else if (IsX86 && Name == "avx512.mask.psra.d") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psra_d_512);
-    } else if (IsX86 && Name == "avx512.mask.psra.q.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psra_q_128);
-    } else if (IsX86 && Name == "avx512.mask.psra.q.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psra_q_256);
-    } else if (IsX86 && Name == "avx512.mask.psra.q") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psra_q_512);
-    } else if (IsX86 && Name == "avx512.mask.psra.w.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psra_w);
-    } else if (IsX86 && Name == "avx512.mask.psra.w.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psra_w);
-    } else if (IsX86 && Name == "avx512.mask.psra.w.512") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psra_w_512);
-    } else if (IsX86 && Name == "avx512.mask.psrl.d.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrl_d);
-    } else if (IsX86 && Name == "avx512.mask.psrl.d.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrl_d);
-    } else if (IsX86 && Name == "avx512.mask.psrl.d") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrl_d_512);
-    } else if (IsX86 && Name == "avx512.mask.psrl.q.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrl_q);
-    } else if (IsX86 && Name == "avx512.mask.psrl.q.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrl_q);
-    } else if (IsX86 && Name == "avx512.mask.psrl.q") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrl_q_512);
-    } else if (IsX86 && Name == "avx512.mask.psrl.w.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrl_w);
-    } else if (IsX86 && Name == "avx512.mask.psrl.w.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrl_w);
-    } else if (IsX86 && Name == "avx512.mask.psrl.w.512") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrl_w_512);
-    } else if (IsX86 && Name == "avx512.mask.psll.di.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_pslli_d);
-    } else if (IsX86 && Name == "avx512.mask.psll.di.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_pslli_d);
-    } else if (IsX86 && (Name == "avx512.mask.psll.di.512" ||
-                         Name == "avx512.mask.pslli.d")) {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_pslli_d_512);
-    } else if (IsX86 && Name == "avx512.mask.psll.qi.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_pslli_q);
-    } else if (IsX86 && Name == "avx512.mask.psll.qi.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_pslli_q);
-    } else if (IsX86 && (Name == "avx512.mask.psll.qi.512" ||
-                         Name == "avx512.mask.pslli.q")) {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_pslli_q_512);
-    } else if (IsX86 && Name == "avx512.mask.psll.wi.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_pslli_w);
-    } else if (IsX86 && Name == "avx512.mask.psll.wi.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_pslli_w);
-    } else if (IsX86 && Name == "avx512.mask.psll.wi.512") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_pslli_w_512);
-    } else if (IsX86 && Name == "avx512.mask.psra.di.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrai_d);
-    } else if (IsX86 && Name == "avx512.mask.psra.di.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrai_d);
-    } else if (IsX86 && (Name == "avx512.mask.psra.di.512" ||
-                         Name == "avx512.mask.psrai.d")) {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrai_d_512);
-    } else if (IsX86 && Name == "avx512.mask.psra.qi.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrai_q_128);
-    } else if (IsX86 && Name == "avx512.mask.psra.qi.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrai_q_256);
-    } else if (IsX86 && (Name == "avx512.mask.psra.qi.512" ||
-                         Name == "avx512.mask.psrai.q")) {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrai_q_512);
-    } else if (IsX86 && Name == "avx512.mask.psra.wi.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrai_w);
-    } else if (IsX86 && Name == "avx512.mask.psra.wi.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrai_w);
-    } else if (IsX86 && Name == "avx512.mask.psra.wi.512") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrai_w_512);
-    } else if (IsX86 && Name == "avx512.mask.psrl.di.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrli_d);
-    } else if (IsX86 && Name == "avx512.mask.psrl.di.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrli_d);
-    } else if (IsX86 && (Name == "avx512.mask.psrl.di.512" ||
-                         Name == "avx512.mask.psrli.d")) {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrli_d_512);
-    } else if (IsX86 && Name == "avx512.mask.psrl.qi.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrli_q);
-    } else if (IsX86 && Name == "avx512.mask.psrl.qi.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrli_q);
-    } else if (IsX86 && (Name == "avx512.mask.psrl.qi.512" ||
-                         Name == "avx512.mask.psrli.q")) {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrli_q_512);
-    } else if (IsX86 && Name == "avx512.mask.psrl.wi.128") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_sse2_psrli_w);
-    } else if (IsX86 && Name == "avx512.mask.psrl.wi.256") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrli_w);
-    } else if (IsX86 && Name == "avx512.mask.psrl.wi.512") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,
-                                  Intrinsic::x86_avx512_psrli_w_512);
-    } else if (IsX86 && Name == "avx512.mask.psllv2.di") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psllv_q);
-    } else if (IsX86 && Name == "avx512.mask.psllv4.di") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,Intrinsic::x86_avx2_psllv_q_256);
-    } else if (IsX86 && Name == "avx512.mask.psllv4.si") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psllv_d);
-    } else if (IsX86 && Name == "avx512.mask.psllv8.si") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,Intrinsic::x86_avx2_psllv_d_256);
-    } else if (IsX86 && Name == "avx512.mask.psrav4.si") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrav_d);
-    } else if (IsX86 && Name == "avx512.mask.psrav8.si") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,Intrinsic::x86_avx2_psrav_d_256);
-    } else if (IsX86 && Name == "avx512.mask.psrlv2.di") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrlv_q);
-    } else if (IsX86 && Name == "avx512.mask.psrlv4.di") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,Intrinsic::x86_avx2_psrlv_q_256);
-    } else if (IsX86 && Name == "avx512.mask.psrlv4.si") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI, Intrinsic::x86_avx2_psrlv_d);
-    } else if (IsX86 && Name == "avx512.mask.psrlv8.si") {
-      Rep = UpgradeX86MaskedShift(Builder, *CI,Intrinsic::x86_avx2_psrlv_d_256);
+    } else if (IsX86 && Name.startswith("avx512.mask.psll")) {
+      bool IsImmediate = Name[16] == 'i' ||
+                         (Name.size() > 18 && Name[18] == 'i');
+      bool IsVariable = Name[16] == 'v';
+      char Size = Name[16] == '.' ? Name[17] :
+                  Name[17] == '.' ? Name[18] :
+                                    Name[19];
+
+      Intrinsic::ID IID;
+      if (IsVariable) {
+        if (Size == 'd' && Name[17] == '2') // avx512.mask.psllv2.di
+          IID = Intrinsic::x86_avx2_psllv_q;
+        else if (Size == 'd' && Name[17] == '4') // avx512.mask.psllv4.di
+          IID = Intrinsic::x86_avx2_psllv_q_256;
+        else if (Size == 's' && Name[17] == '4') // avx512.mask.psllv4.si
+          IID = Intrinsic::x86_avx2_psllv_d;
+        else if (Size == 's' && Name[17] == '8') // avx512.mask.psllv8.si
+          IID = Intrinsic::x86_avx2_psllv_d_256;
+        else
+          llvm_unreachable("Unexpected size");
+      } else if (Name.endswith(".128")) {
+        if (Size == 'd') // avx512.mask.psll.d.128, avx512.mask.psll.di.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_pslli_d
+                            : Intrinsic::x86_sse2_psll_d;
+        else if (Size == 'q') // avx512.mask.psll.q.128, avx512.mask.psll.qi.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_pslli_q
+                            : Intrinsic::x86_sse2_psll_q;
+        else if (Size == 'w') // avx512.mask.psll.w.128, avx512.mask.psll.wi.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_pslli_w
+                            : Intrinsic::x86_sse2_psll_w;
+        else
+          llvm_unreachable("Unexpected size");
+      } else if (Name.endswith(".256")) {
+        if (Size == 'd') // avx512.mask.psll.d.256, avx512.mask.psll.di.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_pslli_d
+                            : Intrinsic::x86_avx2_psll_d;
+        else if (Size == 'q') // avx512.mask.psll.q.256, avx512.mask.psll.qi.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_pslli_q
+                            : Intrinsic::x86_avx2_psll_q;
+        else if (Size == 'w') // avx512.mask.psll.w.256, avx512.mask.psll.wi.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_pslli_w
+                            : Intrinsic::x86_avx2_psll_w;
+        else
+          llvm_unreachable("Unexpected size");
+      } else {
+        if (Size == 'd') // psll.di.512, pslli.d, psll.d
+          IID = IsImmediate ? Intrinsic::x86_avx512_pslli_d_512
+                            : Intrinsic::x86_avx512_psll_d_512;
+        else if (Size == 'q') // psll.qi.512, pslli.q, psll.q
+          IID = IsImmediate ? Intrinsic::x86_avx512_pslli_q_512
+                            : Intrinsic::x86_avx512_psll_q_512;
+        else if (Size == 'w') // psll.wi.512, pslli.w, psll.w
+          IID = IsImmediate ? Intrinsic::x86_avx512_pslli_w_512
+                            : Intrinsic::x86_avx512_psll_w_512;
+        else
+          llvm_unreachable("Unexpected size");
+      }
+
+      Rep = UpgradeX86MaskedShift(Builder, *CI, IID);
+    } else if (IsX86 && Name.startswith("avx512.mask.psrl")) {
+      bool IsImmediate = Name[16] == 'i' ||
+                         (Name.size() > 18 && Name[18] == 'i');
+      bool IsVariable = Name[16] == 'v';
+      char Size = Name[16] == '.' ? Name[17] :
+                  Name[17] == '.' ? Name[18] :
+                                    Name[19];
+
+      Intrinsic::ID IID;
+      if (IsVariable) {
+        if (Size == 'd' && Name[17] == '2') // avx512.mask.psrlv2.di
+          IID = Intrinsic::x86_avx2_psrlv_q;
+        else if (Size == 'd' && Name[17] == '4') // avx512.mask.psrlv4.di
+          IID = Intrinsic::x86_avx2_psrlv_q_256;
+        else if (Size == 's' && Name[17] == '4') // avx512.mask.psrlv4.si
+          IID = Intrinsic::x86_avx2_psrlv_d;
+        else if (Size == 's' && Name[17] == '8') // avx512.mask.psrlv8.si
+          IID = Intrinsic::x86_avx2_psrlv_d_256;
+        else
+          llvm_unreachable("Unexpected size");
+      } else if (Name.endswith(".128")) {
+        if (Size == 'd') // avx512.mask.psrl.d.128, avx512.mask.psrl.di.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_psrli_d
+                            : Intrinsic::x86_sse2_psrl_d;
+        else if (Size == 'q') // avx512.mask.psrl.q.128, avx512.mask.psrl.qi.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_psrli_q
+                            : Intrinsic::x86_sse2_psrl_q;
+        else if (Size == 'w') // avx512.mask.psrl.w.128, avx512.mask.psrl.wi.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_psrli_w
+                            : Intrinsic::x86_sse2_psrl_w;
+        else
+          llvm_unreachable("Unexpected size");
+      } else if (Name.endswith(".256")) {
+        if (Size == 'd') // avx512.mask.psrl.d.256, avx512.mask.psrl.di.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_psrli_d
+                            : Intrinsic::x86_avx2_psrl_d;
+        else if (Size == 'q') // avx512.mask.psrl.q.256, avx512.mask.psrl.qi.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_psrli_q
+                            : Intrinsic::x86_avx2_psrl_q;
+        else if (Size == 'w') // avx512.mask.psrl.w.256, avx512.mask.psrl.wi.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_psrli_w
+                            : Intrinsic::x86_avx2_psrl_w;
+        else
+          llvm_unreachable("Unexpected size");
+      } else {
+        if (Size == 'd') // psrl.di.512, psrli.d, psrl.d
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrli_d_512
+                            : Intrinsic::x86_avx512_psrl_d_512;
+        else if (Size == 'q') // psrl.qi.512, psrli.q, psrl.q
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrli_q_512
+                            : Intrinsic::x86_avx512_psrl_q_512;
+        else if (Size == 'w') // psrl.wi.512, psrli.w, psrl.w)
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrli_w_512
+                            : Intrinsic::x86_avx512_psrl_w_512;
+        else
+          llvm_unreachable("Unexpected size");
+      }
+
+      Rep = UpgradeX86MaskedShift(Builder, *CI, IID);
+    } else if (IsX86 && Name.startswith("avx512.mask.psra")) {
+      bool IsImmediate = Name[16] == 'i' ||
+                         (Name.size() > 18 && Name[18] == 'i');
+      bool IsVariable = Name[16] == 'v';
+      char Size = Name[16] == '.' ? Name[17] :
+                  Name[17] == '.' ? Name[18] :
+                                    Name[19];
+
+      Intrinsic::ID IID;
+      if (IsVariable) {
+        if (Size == 's' && Name[17] == '4') // avx512.mask.psrav4.si
+          IID = Intrinsic::x86_avx2_psrav_d;
+        else if (Size == 's' && Name[17] == '8') // avx512.mask.psrav8.si
+          IID = Intrinsic::x86_avx2_psrav_d_256;
+        else
+          llvm_unreachable("Unexpected size");
+      } else if (Name.endswith(".128")) {
+        if (Size == 'd') // avx512.mask.psra.d.128, avx512.mask.psra.di.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_psrai_d
+                            : Intrinsic::x86_sse2_psra_d;
+        else if (Size == 'q') // avx512.mask.psra.q.128, avx512.mask.psra.qi.128
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrai_q_128
+                            : Intrinsic::x86_avx512_psra_q_128;
+        else if (Size == 'w') // avx512.mask.psra.w.128, avx512.mask.psra.wi.128
+          IID = IsImmediate ? Intrinsic::x86_sse2_psrai_w
+                            : Intrinsic::x86_sse2_psra_w;
+        else
+          llvm_unreachable("Unexpected size");
+      } else if (Name.endswith(".256")) {
+        if (Size == 'd') // avx512.mask.psra.d.256, avx512.mask.psra.di.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_psrai_d
+                            : Intrinsic::x86_avx2_psra_d;
+        else if (Size == 'q') // avx512.mask.psra.q.256, avx512.mask.psra.qi.256
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrai_q_256
+                            : Intrinsic::x86_avx512_psra_q_256;
+        else if (Size == 'w') // avx512.mask.psra.w.256, avx512.mask.psra.wi.256
+          IID = IsImmediate ? Intrinsic::x86_avx2_psrai_w
+                            : Intrinsic::x86_avx2_psra_w;
+        else
+          llvm_unreachable("Unexpected size");
+      } else {
+        if (Size == 'd') // psra.di.512, psrai.d, psra.d
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrai_d_512
+                            : Intrinsic::x86_avx512_psra_d_512;
+        else if (Size == 'q') // psra.qi.512, psrai.q, psra.q
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrai_q_512
+                            : Intrinsic::x86_avx512_psra_q_512;
+        else if (Size == 'w') // psra.wi.512, psrai.w, psra.w
+          IID = IsImmediate ? Intrinsic::x86_avx512_psrai_w_512
+                            : Intrinsic::x86_avx512_psra_w_512;
+        else
+          llvm_unreachable("Unexpected size");
+      }
+
+      Rep = UpgradeX86MaskedShift(Builder, *CI, IID);
     } else {
       llvm_unreachable("Unknown function for CallInst upgrade.");
     }


IRGen: Fix protocol constraint fulfillments.
Witness table fulfillments for protocol types were being ignored because we didn't record them with the proper key--we were just dropping the protocol on the floor and recording null. Fixing this fixes <rdar://problem/12965934> and obviates r3904.

Swift SVN r3907

--- lib/IRGen/GenProto.cpp
+++ lib/IRGen/GenProto.cpp
@@ -2817,7 +2817,7 @@
     void addFulfillment(ArchetypeType *arg, ProtocolDecl *proto,
                         unsigned depth, unsigned index) {
       // Only add a fulfillment if it's not enough information otherwise.
-      auto key = FulfillmentKey(arg, nullptr);
+      auto key = FulfillmentKey(arg, proto);
       if (!Fulfillments.count(key))
         Fulfillments.insert(std::make_pair(key, Fulfillment(depth, index)));
     }


[Coverage] Update testing methods to support more than two files

Differential Revision: http://reviews.llvm.org/D18757

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@266289 91177308-0d34-0410-b5e6-96231b3b80d8
(cherry picked from commit 77eb420264fd04b8b5bd7f6bbf00a7917ffaf095)

--- unittests/ProfileData/CoverageMappingTest.cpp
+++ unittests/ProfileData/CoverageMappingTest.cpp
@@ -78,7 +78,6 @@

 struct CoverageMappingTest : ::testing::Test {
   StringMap<unsigned> Files;
-  unsigned NextFile;
   std::vector<CounterMappingRegion> InputCMRs;

   std::vector<StringRef> OutputFiles;
@@ -91,7 +90,6 @@
   std::unique_ptr<CoverageMapping> LoadedCoverage;

   void SetUp() override {
-    NextFile = 0;
     ProfileWriter.setOutputSparse(false);
   }

@@ -99,8 +97,9 @@
     auto R = Files.find(Name);
     if (R != Files.end())
       return R->second;
-    Files[Name] = NextFile;
-    return NextFile++;
+    unsigned Index = Files.size();
+    Files.emplace_second(Name, Index);
+    return Index;
   }

   void addCMR(Counter C, StringRef File, unsigned LS, unsigned CS, unsigned LE,
@@ -116,9 +115,9 @@
   }

   std::string writeCoverageRegions() {
-    SmallVector<unsigned, 8> FileIDs;
-    for (const auto &E : Files)
-      FileIDs.push_back(E.getValue());
+    SmallVector<unsigned, 8> FileIDs(Files.size());
+    for (unsigned I = 0; I < FileIDs.size(); ++I)
+      FileIDs[I] = I;
     std::string Coverage;
     llvm::raw_string_ostream OS(Coverage);
     CoverageMappingWriter(FileIDs, None, InputCMRs).write(OS);
@@ -126,9 +125,9 @@
   }

   void readCoverageRegions(std::string Coverage) {
-    SmallVector<StringRef, 8> Filenames;
+    SmallVector<StringRef, 8> Filenames(Files.size());
     for (const auto &E : Files)
-      Filenames.push_back(E.getKey());
+      Filenames[E.getValue()] = E.getKey();
     RawCoverageMappingReader Reader(Coverage, Filenames, OutputFiles,
                                     OutputExpressions, OutputCMRs);
     ASSERT_TRUE(NoError(Reader.read()));
@@ -147,9 +146,11 @@
     readCoverageRegions(Regions);

     SmallVector<StringRef, 8> Filenames;
-    if (EmitFilenames)
+    if (EmitFilenames) {
+      Filenames.resize(Files.size());
       for (const auto &E : Files)
-        Filenames.push_back(E.getKey());
+        Filenames[E.getValue()] = E.getKey();
+    }
     OneFunctionCoverageReader CovReader(FuncName, Hash, Filenames, OutputCMRs);
     auto CoverageOrErr = CoverageMapping::load(CovReader, *ProfileReader);
     ASSERT_TRUE(NoError(CoverageOrErr.getError()));
@@ -186,6 +187,52 @@
   }
 }

+TEST_P(MaybeSparseCoverageMappingTest,
+       correct_deserialize_for_more_than_two_files) {
+  const char *FileNames[] = {"bar", "baz", "foo"};
+  static const unsigned N = array_lengthof(FileNames);
+
+  for (unsigned I = 0; I < N; ++I)
+    // Use LineStart to hold the index of the file name
+    // in order to preserve that information during possible sorting of CMRs.
+    addCMR(Counter::getCounter(0), FileNames[I], I, 1, I, 1);
+
+  std::string Coverage = writeCoverageRegions();
+  readCoverageRegions(Coverage);
+
+  ASSERT_EQ(N, OutputCMRs.size());
+  ASSERT_EQ(N, OutputFiles.size());
+
+  for (unsigned I = 0; I < N; ++I) {
+    ASSERT_GT(N, OutputCMRs[I].FileID);
+    ASSERT_GT(N, OutputCMRs[I].LineStart);
+    EXPECT_EQ(FileNames[OutputCMRs[I].LineStart],
+              OutputFiles[OutputCMRs[I].FileID]);
+  }
+}
+
+TEST_P(MaybeSparseCoverageMappingTest, load_coverage_for_more_than_two_files) {
+  InstrProfRecord Record("func", 0x1234, {0});
+  ProfileWriter.addRecord(std::move(Record));
+  readProfCounts();
+
+  const char *FileNames[] = {"bar", "baz", "foo"};
+  static const unsigned N = array_lengthof(FileNames);
+
+  for (unsigned I = 0; I < N; ++I)
+    // Use LineStart to hold the index of the file name
+    // in order to preserve that information during possible sorting of CMRs.
+    addCMR(Counter::getCounter(0), FileNames[I], I, 1, I, 1);
+
+  loadCoverageMapping("func", 0x1234);
+
+  for (unsigned I = 0; I < N; ++I) {
+    CoverageData Data = LoadedCoverage->getCoverageForFile(FileNames[I]);
+    ASSERT_TRUE(!Data.empty());
+    EXPECT_EQ(I, Data.begin()->Line);
+  }
+}
+
 TEST_P(MaybeSparseCoverageMappingTest, expansion_gets_first_counter) {
   addCMR(Counter::getCounter(1), "foo", 10, 1, 10, 2);
   // This starts earlier in "foo", so the expansion should get its counter.


BUG: update example typo

BUG: update example typo

--- Examples/Projections/MapProjectionExample.cxx
+++ Examples/Projections/MapProjectionExample.cxx
@@ -131,7 +131,7 @@

   // Software Guide : BeginCodeSnippet
   // EPSG:2154 is the EPSG code for lambert 93
-  otb::SpatialReference lamb93SRS = otb::SpatialReference::FromDescription("EPSG:3154");
+  otb::SpatialReference lamb93SRS = otb::SpatialReference::FromDescription("EPSG:2154");
   MapProjectionType::Pointer lambertProjection = MapProjectionType::New();
   lambertProjection->SetWkt(lamb93SRS.ToWkt());


add benchmarking info back in in acat19 script (d'oh)

--- acat19.cpp
+++ acat19.cpp
@@ -16,6 +16,15 @@
 ////////////////////////////////////////////////////////////////////////////////////////////////////

 void acat19() {
+    RooMsgService::instance().deleteStream(0);
+    RooMsgService::instance().deleteStream(0);
+
+    RooMsgService::instance().addStream(RooFit::DEBUG, RooFit::Topic(RooFit::Benchmarking1));
+    RooMsgService::instance().addStream(RooFit::DEBUG, RooFit::Topic(RooFit::Benchmarking2));
+
+    std::size_t seed = 1;
+    RooRandom::randomGenerator()->SetSeed(seed);
+
     TFile *_file0 = TFile::Open("/user/pbos/data_atlas/carsten/comb-5xs-80ifb-v8.root");

     RooWorkspace* w = static_cast<RooWorkspace*>(gDirectory->Get("combWS"));


Add tests for bracket expressions

Add tests for bracket expressions

--- test/lofty/io/text/istream-scan.cxx
+++ test/lofty/io/text/istream-scan.cxx
@@ -40,6 +40,11 @@
    LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("x")).scan(LOFTY_SL("^x$")));
    //? LOFTY_TESTING_ASSERT_DOES_NOT_THROW(io::text::str_istream(LOFTY_SL("xx")).scan(LOFTY_SL("^x$")));
    LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("x")).scan(LOFTY_SL("^x+$")));
+   LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("a")).scan(LOFTY_SL("^[a]$")));
+   LOFTY_TESTING_ASSERT_FALSE(io::text::str_istream(LOFTY_SL("a")).scan(LOFTY_SL("^[b]$")));
+   LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("a")).scan(LOFTY_SL("^[^m]$")));
+   LOFTY_TESTING_ASSERT_FALSE(io::text::str_istream(LOFTY_SL("m")).scan(LOFTY_SL("^[^m]$")));
+   LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("z")).scan(LOFTY_SL("^[^m]$")));
 }

 }} //namespace lofty::test
@@ -65,6 +70,12 @@
    LOFTY_TESTING_ASSERT_EQUAL(captured1, LOFTY_SL("d"));
    LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("(e)")).scan(LOFTY_SL("^\\(()\\)$"), &captured1));
    LOFTY_TESTING_ASSERT_EQUAL(captured1, LOFTY_SL("e"));
+   LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("f")).scan(LOFTY_SL("^(f+)$"), &captured1));
+   LOFTY_TESTING_ASSERT_EQUAL(captured1, LOFTY_SL("f"));
+   LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("g")).scan(LOFTY_SL("^([a-z]+)$"), &captured1));
+   LOFTY_TESTING_ASSERT_EQUAL(captured1, LOFTY_SL("g"));
+   LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("h")).scan(LOFTY_SL("^([^ ]+)$"), &captured1));
+   LOFTY_TESTING_ASSERT_EQUAL(captured1, LOFTY_SL("h"));

    int captured2;
    LOFTY_TESTING_ASSERT_TRUE(io::text::str_istream(LOFTY_SL("31")).scan(LOFTY_SL("^()$"), &captured2));


improve error message in case wrong JSON is sent to the server

--- arangod/RestHandler/RestImportHandler.cpp
+++ arangod/RestHandler/RestImportHandler.cpp
@@ -476,9 +476,9 @@
     VPackSlice documents;
     try {
       documents = _request->payload();
-    } catch (VPackException const&) {
+    } catch (VPackException const& ex) {
       generateError(rest::ResponseCode::BAD, TRI_ERROR_HTTP_BAD_PARAMETER,
-                    "expecting a JSON array in the request");
+                    std::string("expecting a valid JSON array in the request. got: ") + ex.what());
       return false;
     }


#89377#: OpenMode ReadWrite now handled by UCP

--- unotools/source/ucbhelper/ucbstreamhelper.cxx
+++ unotools/source/ucbhelper/ucbstreamhelper.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: ucbstreamhelper.cxx,v $
  *
- *  $Revision: 1.10 $
- *
- *  last change: $Author: mba $ $Date: 2001-07-16 09:28:18 $
+ *  $Revision: 1.11 $
+ *
+ *  last change: $Author: mba $ $Date: 2001-07-16 11:57:22 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -131,7 +131,7 @@
                 {
                 }
             }
-
+/*
             try
             {
                 // make sure that the desired file exists before trying to open
@@ -155,6 +155,7 @@
             catch ( Exception& )
             {
             }
+ */
         }

         try


[Lex] Speed up updateConsecutiveMacroArgTokens (NFC)

SM.isWrittenInSameFile() calls getFileID(), which can be expensive.
Move this check behind some cheaper filters.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@274800 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Lex/TokenLexer.cpp
+++ lib/Lex/TokenLexer.cpp
@@ -787,9 +787,6 @@
     if (CurLoc.isFileID() != NextLoc.isFileID())
       break; // Token from different kind of FileID.

-    if (CurLoc.isMacroID() && !SM.isWrittenInSameFile(CurLoc, NextLoc))
-      break; // Token from a different macro.
-
     int RelOffs;
     if (!SM.isInSameSLocAddrSpace(CurLoc, NextLoc, &RelOffs))
       break; // Token from different local/loaded location.
@@ -797,6 +794,10 @@
     // "characters" away.
     if (RelOffs < 0 || RelOffs > 50)
       break;
+
+    if (CurLoc.isMacroID() && !SM.isWrittenInSameFile(CurLoc, NextLoc))
+      break; // Token from a different macro.
+
     CurLoc = NextLoc;
   }


Use early return to simplify code (NFC)

Use early return to simplify code (NFC)

Follow on to r258405.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@258407 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Linker/IRMover.cpp
+++ lib/Linker/IRMover.cpp
@@ -660,16 +660,15 @@
   // If this temporary metadata has a value id recorded during function
   // parsing, record that in the ValIDToTempMDMap if one was provided.
   auto I = MetadataToIDs.find(MD);
-  if (I != MetadataToIDs.end()) {
-    unsigned Idx = I->second;
-    MDNode *Node = cast<MDNode>(MD);
-    assert(Node->isTemporary());
-    // If we created a temp MD when importing a different function from
-    // this module, reuse the same temporary metadata.
-    auto IterBool = ValIDToTempMDMap->insert(std::make_pair(Idx, Node));
-    return IterBool.first->second;
-  }
-  return nullptr;
+  if (I == MetadataToIDs.end())
+    return nullptr;
+  unsigned Idx = I->second;
+  MDNode *Node = cast<MDNode>(MD);
+  assert(Node->isTemporary());
+  // If we created a temp MD when importing a different function from
+  // this module, reuse the same temporary metadata.
+  auto IterBool = ValIDToTempMDMap->insert(std::make_pair(Idx, Node));
+  return IterBool.first->second;
 }

 void IRLinker::replaceTemporaryMetadata(const Metadata *OrigMD,
@@ -685,18 +684,18 @@
   // metadata has a value id recorded during metadata parsing, replace
   // the temporary metadata with the final mapped metadata now.
   auto I = MetadataToIDs.find(OrigMD);
-  if (I != MetadataToIDs.end()) {
-    unsigned Idx = I->second;
-    auto VI = ValIDToTempMDMap->find(Idx);
-    // Nothing to do if we didn't need to create a temporary metadata during
-    // function importing.
-    if (VI == ValIDToTempMDMap->end())
-      return;
-    MDNode *TempMD = VI->second;
-    TempMD->replaceAllUsesWith(NewMD);
-    MDNode::deleteTemporary(TempMD);
-    ValIDToTempMDMap->erase(VI);
-  }
+  if (I == MetadataToIDs.end())
+    return;
+  unsigned Idx = I->second;
+  auto VI = ValIDToTempMDMap->find(Idx);
+  // Nothing to do if we didn't need to create a temporary metadata during
+  // function importing.
+  if (VI == ValIDToTempMDMap->end())
+    return;
+  MDNode *TempMD = VI->second;
+  TempMD->replaceAllUsesWith(NewMD);
+  MDNode::deleteTemporary(TempMD);
+  ValIDToTempMDMap->erase(VI);
 }

 bool IRLinker::isMetadataNeeded(Metadata *MD) {


Add bounding box of an elliptical arc and output the 'A' element

--- writerperfect/source/filter/OdgGenerator.cxx
+++ writerperfect/source/filter/OdgGenerator.cxx
@@ -40,6 +40,173 @@
 // remove this
 #define MULTIPAGE_WORKAROUND 1

+static inline double getAngle(double bx, double by)
+{
+    return fmod(2*M_PI + (by > 0.0 ? 1.0 : -1.0) * acos( bx / sqrt(bx * bx + by * by) ), 2*M_PI);
+}
+
+static void getEllipticalArcBBox(double x1, double y1,
+                                 double rx, double ry, double phi, bool largeArc, bool sweep, double x2, double y2,
+                                 double &xmin, double &ymin, double &xmax, double &ymax)
+{
+    if (rx < 0.0)
+        rx *= -1.0;
+    if (ry < 0.0)
+        ry *= -1.0;
+
+    if (rx == 0.0 || ry == 0.0)
+    {
+        xmin = (x1 < x2 ? x1 : x2);
+        xmax = (x1 > x2 ? x1 : x2);
+        ymin = (y1 < y2 ? y1 : y2);
+        ymax = (y1 > y2 ? y1 : y2);
+        return;
+    }
+
+    // F.6.5.1
+    const double x1prime = cos(phi)*(x1 - x2)/2 + sin(phi)*(y1 - y2)/2;
+    const double y1prime = -sin(phi)*(x1 - x2)/2 + cos(phi)*(y1 - y2)/2;
+
+    // F.6.5.2
+    double radicant = (rx*rx*ry*ry - rx*rx*y1prime*y1prime - ry*ry*x1prime*x1prime)/(rx*rx*y1prime*y1prime + ry*ry*x1prime*x1prime);
+    double cxprime = 0.0;
+    double cyprime = 0.0;
+    if (radicant < 0.0)
+    {
+        double ratio = rx/ry;
+        radicant = y1prime*y1prime + x1prime*x1prime/(ratio*ratio);
+        if (radicant < 0.0)
+        {
+            xmin = (x1 < x2 ? x1 : x2);
+            xmax = (x1 > x2 ? x1 : x2);
+            ymin = (y1 < y2 ? y1 : y2);
+            ymax = (y1 > y2 ? y1 : y2);
+            return;
+        }
+        ry=sqrt(radicant);
+        rx=ratio*ry;
+    }
+    else
+    {
+        double factor = (largeArc==sweep ? -1.0 : 1.0)*sqrt(radicant);
+
+        cxprime = factor*rx*y1prime/ry;
+        cyprime = -factor*ry*x1prime/rx;
+    }
+
+    // F.6.5.3
+    double cx = cxprime*cos(phi) - cyprime*sin(phi) + (x1 + x2)/2;
+    double cy = cxprime*sin(phi) + cyprime*cos(phi) + (y1 + y2)/2;
+
+    // now compute bounding box of the whole ellipse
+
+    // Parametrick equation of an ellipse:
+    // x(theta) = cx + rx*cos(theta)*cos(phi) - ry*sin(theta)*sin(phi)
+    // y(theta) = cy + rx*cos(theta)*sin(phi) + ry*sin(theta)*cos(phi)
+
+    // Compute local extrems
+    // 0 = -rx*sin(theta)*cos(phi) - ry*cos(theta)*sin(phi)
+    // 0 = -rx*sin(theta)*sin(phi) - ry*cos(theta)*cos(phi)
+
+    // Local extrems for X:
+    // theta = -atan(ry*tan(phi)/rx)
+    // and
+    // theta = M_PI -atan(ry*tan(phi)/rx)
+
+    // Local extrems for Y:
+    // theta = atan(ry/(tan(phi)*rx))
+    // and
+    // theta = M_PI + atan(ry/(tan(phi)*rx))
+
+    double txmin, txmax, tymin, tymax;
+
+    // First handle special cases
+    if (phi == 0 || phi == M_PI)
+    {
+        xmin = cx - rx;
+        txmin = getAngle(-rx, 0);
+        xmax = cx + rx;
+        txmax = getAngle(rx, 0);
+        ymin = cy - ry;
+        tymin = getAngle(0, -ry);
+        ymax = cy + ry;
+        tymax = getAngle(0, ry);
+    }
+    else if (phi == M_PI / 2.0 || phi == 3.0*M_PI/2.0)
+    {
+        xmin = cx - ry;
+        txmin = getAngle(-ry, 0);
+        xmax = cx + ry;
+        txmax = getAngle(ry, 0);
+        ymin = cy - rx;
+        tymin = getAngle(0, -rx);
+        ymax = cy + rx;
+        tymax = getAngle(0, rx);
+    }
+    else
+    {
+        txmin = -atan(ry*tan(phi)/rx);
+        txmax = M_PI - atan (ry*tan(phi)/rx);
+        xmin = cx + rx*cos(txmin)*cos(phi) - ry*sin(txmin)*sin(phi);
+        xmax = cx + rx*cos(txmax)*cos(phi) - ry*sin(txmax)*sin(phi);
+        if (xmin > xmax)
+        {
+            std::swap(xmin,xmax);
+            std::swap(txmin,txmax);
+        }
+        double tmpY = cy + rx*cos(txmin)*sin(phi) + ry*sin(txmin)*cos(phi);
+        txmin = getAngle(xmin - cx, tmpY - cy);
+        tmpY = cy + rx*cos(txmax)*sin(phi) + ry*sin(txmax)*cos(phi);
+        txmax = getAngle(xmax - cx, tmpY - cy);
+
+
+        tymin = atan(ry/(tan(phi)*rx));
+        tymax = atan(ry/(tan(phi)*rx))+M_PI;
+        ymin = cy + rx*cos(tymin)*sin(phi) + ry*sin(tymin)*cos(phi);
+        ymax = cy + rx*cos(tymax)*sin(phi) + ry*sin(tymax)*cos(phi);
+        if (ymin > ymax)
+        {
+            std::swap(ymin,ymax);
+            std::swap(tymin,tymax);
+        }
+        double tmpX = cx + rx*cos(tymin)*cos(phi) - ry*sin(tymin)*sin(phi);
+        tymin = getAngle(tmpX - cx, ymin - cy);
+        tmpX = cx + rx*cos(tymax)*cos(phi) - ry*sin(tymax)*sin(phi);
+        tymax = getAngle(tmpX - cx, ymax - cy);
+    }
+    double angle1 = getAngle(x1 - cx, y1 - cy);
+    double angle2 = getAngle(x2 - cx, y2 - cy);
+
+    // for sweep == 0 it is normal to have delta theta < 0
+    // but we don't care about the rotation direction for bounding box
+    if (!sweep)
+        std::swap(angle1, angle2);
+
+    // We cannot check directly for whether an angle is included in
+    // an interval of angles that cross the 360/0 degree boundary
+    // So here we will have to check for their absence in the complementary
+    // angle interval
+    bool otherArc = false;
+    if (angle1 > angle2)
+    {
+        std::swap(angle1, angle2);
+        otherArc = true;
+    }
+
+    // Check txmin
+    if ((!otherArc && (angle1 > txmin || angle2 < txmin)) || (otherArc && !(angle1 > txmin || angle2 < txmin)))
+        xmin = x1 < x2 ? x1 : x2;
+    // Check txmax
+    if ((!otherArc && (angle1 > txmax || angle2 < txmax)) || (otherArc && !(angle1 > txmax || angle2 < txmax)))
+        xmax = x1 > x2 ? x1 : x2;
+    // Check tymin
+    if ((!otherArc && (angle1 > tymin || angle2 < tymin)) || (otherArc && !(angle1 > tymin || angle2 < tymin)))
+        ymin = y1 < y2 ? y1 : y2;
+    // Check tymax
+    if ((!otherArc && (angle1 > tymax || angle2 < tymax)) || (otherArc && !(angle1 > tymax || angle2 < tymax)))
+        ymax = y1 > y2 ? y1 : y2;
+}
+
 static WPXString doubleToString(const double value)
 {
     WPXString tempString;
@@ -581,6 +748,8 @@
     double py = path[0]["svg:y"]->getDouble();
     double qx = path[0]["svg:x"]->getDouble();
     double qy = path[0]["svg:y"]->getDouble();
+    double lastX = path[0]["svg:x"]->getDouble();
+    double lastY = path[0]["svg:y"]->getDouble();
     for(unsigned k = 0; k < path.count(); k++)
     {
         if (!path[k]["svg:x"] || !path[k]["svg:y"])
@@ -600,15 +769,23 @@
             qx = (qx < path[k]["svg:x2"]->getDouble()) ? path[k]["svg:x2"]->getDouble() : qx;
             qy = (qy < path[k]["svg:y2"]->getDouble()) ? path[k]["svg:y2"]->getDouble() : qy;
         }
-#if 0
         if(path[k]["libwpg:path-action"]->getStr() == "A")
         {
-            px = (px > path[k]["svg:x"]->getDouble()-2*path[k]["svg:rx"]->getDouble()) ? path[k]["svg:x"]->getDouble()-2*path[k]["svg:rx"]->getDouble() : px;
-            py = (py > path[k]["svg:y"]->getDouble()-2*path[k]["svg:ry"]->getDouble()) ? path[k]["svg:y"]->getDouble()-2*path[k]["svg:ry"]->getDouble() : py;
-            qx = (qx < path[k]["svg:x"]->getDouble()+2*path[k]["svg:rx"]->getDouble()) ? path[k]["svg:x"]->getDouble()+2*path[k]["svg:rx"]->getDouble() : qx;
-            qy = (qy < path[k]["svg:y"]->getDouble()+2*path[k]["svg:ry"]->getDouble()) ? path[k]["svg:y"]->getDouble()+2*path[k]["svg:ry"]->getDouble() : qy;
-        }
-#endif
+            double xmin, xmax, ymin, ymax;
+
+            getEllipticalArcBBox(lastX, lastY, path[k]["svg:rx"]->getDouble(), path[k]["svg:ry"]->getDouble(),
+                                 2.0*M_PI*(path[k]["libwpg:rotate"] ? path[k]["libwpg:rotate"]->getDouble() : 0.0),
+                                 path[k]["libwpg:large-arc"] ? path[k]["libwpg:large-arc"]->getInt() : 1,
+                                 path[k]["libwpg:sweep"] ? path[k]["libwpg:sweep"]->getInt() : 1,
+                                 path[k]["svg:x"]->getDouble(), path[k]["svg:y"]->getDouble(), xmin, ymin, xmax, ymax);
+
+            px = (px > xmin ? xmin : px);
+            py = (py > ymin ? ymin : py);
+            qx = (qx < xmax ? xmax : qx);
+            qy = (qy < ymax ? ymax : qy);
+        }
+        lastX = path[k]["svg:x"]->getDouble();
+        lastY = path[k]["svg:y"]->getDouble();
     }
     double vw = qx - px;
     double vh = qy - py;
@@ -643,9 +820,7 @@
                 (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540));
             sValue.append(sElement);
         }
-        else if (path[i]["libwpg:path-action"]->getStr() == "L"
-        // approximate for the time being the elliptic arc by a line
-            || path[i]["libwpg:path-action"]->getStr() == "A")
+        else if (path[i]["libwpg:path-action"]->getStr() == "L")
         {
             sElement.sprintf("L%i %i", (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540),
                 (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540));
@@ -659,15 +834,15 @@
                 (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540));
             sValue.append(sElement);
         }
-#if 0
         else if (path[i]["libwpg:path-action"]->getStr() == "A")
         {
             sElement.sprintf("A%i %i %i %i %i %i %i", (unsigned)((path[i]["svg:rx"]->getDouble())*2540),
                 (int)((path[i]["svg:ry"]->getDouble())*2540), (path[i]["libwpg:rotate"] ? path[i]["libwpg:rotate"]->getInt() : 0),
-                0, 0, (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540));
+                (path[i]["libwpg:large-arc"] ? path[i]["libwpg:large-arc"]->getInt() : 1),
+                (path[i]["libwpg:sweep"] ? path[i]["libwpg:sweep"]->getInt() : 1),
+                (unsigned)((path[i]["svg:x"]->getDouble()-px)*2540), (unsigned)((path[i]["svg:y"]->getDouble()-py)*2540));
             sValue.append(sElement);
         }
-#endif
         else if (path[i]["libwpg:path-action"]->getStr() == "Z" && i >= (path.count() - 1))
             sValue.append(" Z");
     }


From Benjamin Wasty and David Guthrie, "currently, non-alpha-numeric keys are not recognized (except as modifiers) in osgQt, so I added the mapping code from my Qt integration to GraphicsWindowQt (which is based on Delta3D code from David Guthrie - he gave me permission to submit it under OSGPL)."

--- src/osgQt/GraphicsWindowQt.cpp
+++ src/osgQt/GraphicsWindowQt.cpp
@@ -16,6 +16,96 @@
 namespace osgQt
 {

+class QtKeyboardMap
+{
+
+public:
+    QtKeyboardMap()
+    {
+        mKeyMap[Qt::Key_Escape     ] = osgGA::GUIEventAdapter::KEY_Escape;
+        mKeyMap[Qt::Key_Delete   ] = osgGA::GUIEventAdapter::KEY_Delete;
+        mKeyMap[Qt::Key_Home       ] = osgGA::GUIEventAdapter::KEY_Home;
+        mKeyMap[Qt::Key_Enter      ] = osgGA::GUIEventAdapter::KEY_KP_Enter;
+        mKeyMap[Qt::Key_End        ] = osgGA::GUIEventAdapter::KEY_End;
+        mKeyMap[Qt::Key_Return     ] = osgGA::GUIEventAdapter::KEY_Return;
+        mKeyMap[Qt::Key_PageUp     ] = osgGA::GUIEventAdapter::KEY_Page_Up;
+        mKeyMap[Qt::Key_PageDown   ] = osgGA::GUIEventAdapter::KEY_Page_Down;
+        mKeyMap[Qt::Key_Left       ] = osgGA::GUIEventAdapter::KEY_Left;
+        mKeyMap[Qt::Key_Right      ] = osgGA::GUIEventAdapter::KEY_Right;
+        mKeyMap[Qt::Key_Up         ] = osgGA::GUIEventAdapter::KEY_Up;
+        mKeyMap[Qt::Key_Down       ] = osgGA::GUIEventAdapter::KEY_Down;
+        mKeyMap[Qt::Key_Backspace  ] = osgGA::GUIEventAdapter::KEY_BackSpace;
+        mKeyMap[Qt::Key_Tab        ] = osgGA::GUIEventAdapter::KEY_Tab;
+        mKeyMap[Qt::Key_Space      ] = osgGA::GUIEventAdapter::KEY_Space;
+        mKeyMap[Qt::Key_Delete     ] = osgGA::GUIEventAdapter::KEY_Delete;
+        mKeyMap[Qt::Key_Alt      ] = osgGA::GUIEventAdapter::KEY_Alt_L;
+        mKeyMap[Qt::Key_Shift    ] = osgGA::GUIEventAdapter::KEY_Shift_L;
+        mKeyMap[Qt::Key_Control  ] = osgGA::GUIEventAdapter::KEY_Control_L;
+        mKeyMap[Qt::Key_Meta     ] = osgGA::GUIEventAdapter::KEY_Meta_L;
+
+        mKeyMap[Qt::Key_F1             ] = osgGA::GUIEventAdapter::KEY_F1;
+        mKeyMap[Qt::Key_F2             ] = osgGA::GUIEventAdapter::KEY_F2;
+        mKeyMap[Qt::Key_F3             ] = osgGA::GUIEventAdapter::KEY_F3;
+        mKeyMap[Qt::Key_F4             ] = osgGA::GUIEventAdapter::KEY_F4;
+        mKeyMap[Qt::Key_F5             ] = osgGA::GUIEventAdapter::KEY_F5;
+        mKeyMap[Qt::Key_F6             ] = osgGA::GUIEventAdapter::KEY_F6;
+        mKeyMap[Qt::Key_F7             ] = osgGA::GUIEventAdapter::KEY_F7;
+        mKeyMap[Qt::Key_F8             ] = osgGA::GUIEventAdapter::KEY_F8;
+        mKeyMap[Qt::Key_F9             ] = osgGA::GUIEventAdapter::KEY_F9;
+        mKeyMap[Qt::Key_F10            ] = osgGA::GUIEventAdapter::KEY_F10;
+        mKeyMap[Qt::Key_F11            ] = osgGA::GUIEventAdapter::KEY_F11;
+        mKeyMap[Qt::Key_F12            ] = osgGA::GUIEventAdapter::KEY_F12;
+        mKeyMap[Qt::Key_F13            ] = osgGA::GUIEventAdapter::KEY_F13;
+        mKeyMap[Qt::Key_F14            ] = osgGA::GUIEventAdapter::KEY_F14;
+        mKeyMap[Qt::Key_F15            ] = osgGA::GUIEventAdapter::KEY_F15;
+        mKeyMap[Qt::Key_F16            ] = osgGA::GUIEventAdapter::KEY_F16;
+        mKeyMap[Qt::Key_F17            ] = osgGA::GUIEventAdapter::KEY_F17;
+        mKeyMap[Qt::Key_F18            ] = osgGA::GUIEventAdapter::KEY_F18;
+        mKeyMap[Qt::Key_F19            ] = osgGA::GUIEventAdapter::KEY_F19;
+        mKeyMap[Qt::Key_F20            ] = osgGA::GUIEventAdapter::KEY_F20;
+
+        mKeyMap[Qt::Key_hyphen         ] = '-';
+        mKeyMap[Qt::Key_Equal         ] = '=';
+
+        mKeyMap[Qt::Key_division      ] = osgGA::GUIEventAdapter::KEY_KP_Divide;
+        mKeyMap[Qt::Key_multiply      ] = osgGA::GUIEventAdapter::KEY_KP_Multiply;
+        mKeyMap[Qt::Key_Minus         ] = '-';
+        mKeyMap[Qt::Key_Plus          ] = '+';
+        //mKeyMap[Qt::Key_H              ] = osgGA::GUIEventAdapter::KEY_KP_Home;
+        //mKeyMap[Qt::Key_                    ] = osgGA::GUIEventAdapter::KEY_KP_Up;
+        //mKeyMap[92                    ] = osgGA::GUIEventAdapter::KEY_KP_Page_Up;
+        //mKeyMap[86                    ] = osgGA::GUIEventAdapter::KEY_KP_Left;
+        //mKeyMap[87                    ] = osgGA::GUIEventAdapter::KEY_KP_Begin;
+        //mKeyMap[88                    ] = osgGA::GUIEventAdapter::KEY_KP_Right;
+        //mKeyMap[83                    ] = osgGA::GUIEventAdapter::KEY_KP_End;
+        //mKeyMap[84                    ] = osgGA::GUIEventAdapter::KEY_KP_Down;
+        //mKeyMap[85                    ] = osgGA::GUIEventAdapter::KEY_KP_Page_Down;
+        mKeyMap[Qt::Key_Insert        ] = osgGA::GUIEventAdapter::KEY_KP_Insert;
+        //mKeyMap[Qt::Key_Delete        ] = osgGA::GUIEventAdapter::KEY_KP_Delete;
+    }
+
+    ~QtKeyboardMap()
+    {
+    }
+
+    int remapKey(QKeyEvent* event)
+    {
+        KeyMap::iterator itr = mKeyMap.find(event->key());
+        if (itr == mKeyMap.end())
+        {
+            return int(*(event->text().toAscii().data()));
+        }
+        else
+            return itr->second;
+    }
+
+    private:
+    typedef std::map<unsigned int, int> KeyMap;
+    KeyMap mKeyMap;
+};
+
+static QtKeyboardMap s_QtKeyboardMap;
+
 GraphWidget::GraphWidget( const QGLFormat& format, QWidget* parent, const QGLWidget* shareWidget, Qt::WindowFlags f )
 : QGLWidget(format, parent, shareWidget, f)
 {
@@ -43,13 +133,15 @@
 void GraphWidget::keyPressEvent( QKeyEvent* event )
 {
     setKeyboardModifiers( event );
-    _gw->getEventQueue()->keyPress( (osgGA::GUIEventAdapter::KeySymbol) *(event->text().toAscii().data()) );
+    int value = s_QtKeyboardMap.remapKey(event);
+    _gw->getEventQueue()->keyPress(value);
 }

 void GraphWidget::keyReleaseEvent( QKeyEvent* event )
 {
     setKeyboardModifiers( event );
-    _gw->getEventQueue()->keyRelease( (osgGA::GUIEventAdapter::KeySymbol) *(event->text().toAscii().data()) );
+    int value = s_QtKeyboardMap.remapKey(event);
+    _gw->getEventQueue()->keyRelease(value);
 }

 void GraphWidget::mousePressEvent( QMouseEvent* event )


Moving lines from element_group_settings.cpp to cmiss_graphic.cpp.  Partially fixes bug https://tracker.physiomeproject.org/show_bug.cgi?id=2609

git-svn-id: 4705079bc6b8aadf675e3696f5c015a6aa4916e3@7890 3c1deb5b-d424-0410-962d-aba41a686d42

--- source/graphics/cmiss_graphic.cpp
+++ source/graphics/cmiss_graphic.cpp
@@ -3231,6 +3231,32 @@
 								} break;
 								case CMISS_GRAPHIC_CYLINDERS:
 								case CMISS_GRAPHIC_LINES:
+#if defined(USE_OPENCASCADE)
+								{
+									// test here for domain of rc_coordinate_field
+									// if it is a cad_geometry do something about it
+									//if ( is_cad_geometry( settings_to_object_data->rc_coordinate_field->get_domain() ) )
+									struct LIST(Computed_field) *domain_field_list = CREATE_LIST(Computed_field)();
+									int return_code = Computed_field_get_domain( graphic_to_object_data->rc_coordinate_field, domain_field_list );
+									if ( return_code )
+									{
+										//printf( "got domain of rc_coordinate_field (%d)\n", NUMBER_IN_LIST(Computed_field)(domain_field_list) );
+										// so test for topology domain
+										struct Computed_field *cad_topology_field = FIRST_OBJECT_IN_LIST_THAT(Computed_field)
+											( Cmiss_field_is_type_cad_topology, (void *)NULL, domain_field_list );
+										if ( cad_topology_field )
+										{
+											//printf( "hurrah, we have a cad topology domain.\n" );
+											// if topology domain then draw item at location
+											return_code = Cad_shape_to_graphics_object( cad_topology_field, graphic_to_object_data );
+											DESTROY_LIST(Computed_field)(&domain_field_list);
+											break;
+										}
+									}
+									if ( domain_field_list )
+										DESTROY_LIST(Computed_field)(&domain_field_list);
+								}
+#endif /* defined(USE_OPENCASCADE) */
 								case CMISS_GRAPHIC_SURFACES:
 #if defined(USE_OPENCASCADE)
 								{


Renamed chanels to array to be consistent with the rest of the usage

--- src/osgUtil/MeshOptimizers.cpp
+++ src/osgUtil/MeshOptimizers.cpp
@@ -1183,21 +1183,21 @@
 {
     _deduplicateUvs.clear();

-    // look for all channels that are shared only *within* the geometry
+    // look for all arrays that are shared only *within* the geometry
     std::map<const osg::Array*, unsigned int> arrayPointerCounter;

     for(unsigned int id = 0 ; id < geometry.getNumTexCoordArrays() ; ++ id)
     {
-        const osg::Array* channel = geometry.getTexCoordArray(id);
-        if(channel && channel->getNumElements())
-        {
-            if(arrayPointerCounter.find(channel) == arrayPointerCounter.end())
+        const osg::Array* array = geometry.getTexCoordArray(id);
+        if(array && array->getNumElements())
+        {
+            if(arrayPointerCounter.find(array) == arrayPointerCounter.end())
             {
-                arrayPointerCounter[channel] = 1;
+                arrayPointerCounter[array] = 1;
             }
             else
             {
-                arrayPointerCounter[channel] += 1;
+                arrayPointerCounter[array] += 1;
             }
         }
     }
@@ -1206,14 +1206,14 @@

     for(unsigned int id = 0 ; id != geometry.getNumTexCoordArrays() ; ++ id)
     {
-        const osg::Array* channel = geometry.getTexCoordArray(id);
+        const osg::Array* array = geometry.getTexCoordArray(id);
         // test if array is shared inside the geometry
-        if(channel && arrayPointerCounter[channel] > 1)
-        {
-            std::map<const osg::Array*, unsigned int>::const_iterator reference = references.find(channel);
+        if(array && arrayPointerCounter[array] > 1)
+        {
+            std::map<const osg::Array*, unsigned int>::const_iterator reference = references.find(array);
             if(reference == references.end())
             {
-                references[channel] = id;
+                references[array] = id;
             }
             else
             {


(WindowImp::render) : Do not dump the render tree if there are remaining tasks with the view at the log level two

--- escort/src/WindowImp.cpp
+++ escort/src/WindowImp.cpp
@@ -339,7 +339,7 @@
             setWindowTitle(utfconv(title).c_str());
         }

-        if (2 <= getLogLevel() && backgroundTask.getState() == BackgroundTask::Done) {
+        if (2 <= getLogLevel() && backgroundTask.getState() == BackgroundTask::Done && !view->gatherFlags()) {
             std::cout << "\n## " << window->getDocument().getReadyState() << '\n';
             view->dump();
             std::cout << "##\n";


Remove globals more aggressively from graphs.
Fix a bug where we removed nodes that were marked U.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@7090 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Analysis/DataStructure/DataStructure.cpp
+++ lib/Analysis/DataStructure/DataStructure.cpp
@@ -69,6 +69,13 @@
           Ty == Type::VoidTy && (Size == 0 ||
                                  (NodeType & DSNode::Array))) &&
          "Node not OK!");
+
+  assert(ParentGraph && "Node has no parent?");
+  const DSGraph::ScalarMapTy &SM = ParentGraph->getScalarMap();
+  for (unsigned i = 0, e = Globals.size(); i != e; ++i) {
+    assert(SM.find(Globals[i]) != SM.end());
+    assert(SM.find(Globals[i])->second.getNode() == this);
+  }
 }

 /// forwardNode - Mark this node as being obsolete, and all references to it
@@ -1160,9 +1167,14 @@
 // marked as alive...
 //
 static bool CanReachAliveNodes(DSNode *N, hash_set<DSNode*> &Alive,
-                               hash_set<DSNode*> &Visited) {
+                               hash_set<DSNode*> &Visited,
+                               bool IgnoreGlobals) {
   if (N == 0) return false;
   assert(N->getForwardNode() == 0 && "Cannot mark a forwarded node!");
+
+  // If this is a global node, it will end up in the globals graph anyway, so we
+  // don't need to worry about it.
+  if (IgnoreGlobals && N->isGlobalNode()) return false;

   // If we know that this node is alive, return so!
   if (Alive.count(N)) return true;
@@ -1173,7 +1185,8 @@
   Visited.insert(N);   // No recursion, insert into Visited...

   for (unsigned i = 0, e = N->getSize(); i < e; i += DS::PointerSize)
-    if (CanReachAliveNodes(N->getLink(i).getNode(), Alive, Visited)) {
+    if (CanReachAliveNodes(N->getLink(i).getNode(), Alive, Visited,
+                           IgnoreGlobals)) {
       N->markReachableNodes(Alive);
       return true;
     }
@@ -1184,14 +1197,17 @@
 // alive nodes.
 //
 static bool CallSiteUsesAliveArgs(DSCallSite &CS, hash_set<DSNode*> &Alive,
-                                  hash_set<DSNode*> &Visited) {
-  if (CanReachAliveNodes(CS.getRetVal().getNode(), Alive, Visited))
+                                  hash_set<DSNode*> &Visited,
+                                  bool IgnoreGlobals) {
+  if (CanReachAliveNodes(CS.getRetVal().getNode(), Alive, Visited,
+                         IgnoreGlobals))
     return true;
   if (CS.isIndirectCall() &&
-      CanReachAliveNodes(CS.getCalleeNode(), Alive, Visited))
+      CanReachAliveNodes(CS.getCalleeNode(), Alive, Visited, IgnoreGlobals))
     return true;
   for (unsigned i = 0, e = CS.getNumPtrArgs(); i != e; ++i)
-    if (CanReachAliveNodes(CS.getPtrArg(i).getNode(), Alive, Visited))
+    if (CanReachAliveNodes(CS.getPtrArg(i).getNode(), Alive, Visited,
+                           IgnoreGlobals))
       return true;
   return false;
 }
@@ -1203,6 +1219,8 @@
 // inlining graphs.
 //
 void DSGraph::removeDeadNodes(unsigned Flags) {
+  DEBUG(AssertGraphOK(); GlobalsGraph->AssertGraphOK());
+
   // Reduce the amount of work we have to do... remove dummy nodes left over by
   // merging...
   removeTriviallyDeadNodes();
@@ -1231,7 +1249,7 @@
       // these, prune the scalar pointing to it.
       //
       DSNode *N = I->second.getNode();
-      if (N->isUnknownNode() && !isa<Argument>(I->first)) {
+      if (N->getNodeFlags() == DSNode::UnknownNode && !isa<Argument>(I->first)){
         ScalarMap.erase(I++);
       } else {
         I->second.getNode()->markReachableNodes(Alive);
@@ -1259,7 +1277,8 @@
     //
     Iterate = false;
     for (unsigned i = 0; i != GlobalNodes.size(); ++i)
-      if (CanReachAliveNodes(GlobalNodes[i].second, Alive, Visited)) {
+      if (CanReachAliveNodes(GlobalNodes[i].second, Alive, Visited,
+                             Flags & DSGraph::RemoveUnreachableGlobals)) {
         std::swap(GlobalNodes[i--], GlobalNodes.back()); // Move to end to erase
         GlobalNodes.pop_back();                          // Erase efficiently
         Iterate = true;
@@ -1267,7 +1286,8 @@

     for (unsigned i = 0, e = AuxFunctionCalls.size(); i != e; ++i)
       if (!AuxFCallsAlive[i] &&
-          CallSiteUsesAliveArgs(AuxFunctionCalls[i], Alive, Visited)) {
+          CallSiteUsesAliveArgs(AuxFunctionCalls[i], Alive, Visited,
+                                Flags & DSGraph::RemoveUnreachableGlobals)) {
         AuxFunctionCalls[i].markReachableNodes(Alive);
         AuxFCallsAlive[i] = true;
         Iterate = true;
@@ -1347,7 +1367,8 @@
     // If we are in the top-down pass, remove all unreachable globals from the
     // ScalarMap...
     for (unsigned i = 0, e = GlobalNodes.size(); i != e; ++i)
-      ScalarMap.erase(GlobalNodes[i].first);
+      if (!Alive.count(GlobalNodes[i].second))
+        ScalarMap.erase(GlobalNodes[i].first);
   }

   // Loop over all of the dead nodes now, deleting them since their referrer
@@ -1361,7 +1382,7 @@
 void DSGraph::AssertGraphOK() const {
   for (unsigned i = 0, e = Nodes.size(); i != e; ++i)
     Nodes[i]->assertOK();
-  return;  // FIXME: remove
+
   for (ScalarMapTy::const_iterator I = ScalarMap.begin(),
          E = ScalarMap.end(); I != E; ++I) {
     assert(I->second.getNode() && "Null node in scalarmap!");


From Jean-Sebastien Guay, "When the StatsHandler tries to find a context to add itself to, it will first look for a GraphicsWindow, and if none is found it will look for a GraphicsContext. This enables apps that do all their rendering to offscreen contexts (pbuffer) to still use the StatsHandler."

--- src/osgViewer/StatsHandler.cpp
+++ src/osgViewer/StatsHandler.cpp
@@ -260,21 +260,35 @@

 void StatsHandler::setUpHUDCamera(osgViewer::ViewerBase* viewer)
 {
-    osgViewer::GraphicsWindow* window = dynamic_cast<osgViewer::GraphicsWindow*>(_camera->getGraphicsContext());
-
-    if (!window)
+    // Try GraphicsWindow first so we're likely to get the main viewer window
+    osg::GraphicsContext* context = dynamic_cast<osgViewer::GraphicsWindow*>(_camera->getGraphicsContext());
+
+    if (!context)
     {
         osgViewer::Viewer::Windows windows;
         viewer->getWindows(windows);

-        if (windows.empty()) return;
-
-        window = windows.front();
-    }
-
-    _camera->setGraphicsContext(window);
-
-    _camera->setViewport(0, 0, window->getTraits()->width, window->getTraits()->height);
+        if (!windows.empty()) context = windows.front();
+        else
+        {
+            // No GraphicsWindows were found, so let's try to find a GraphicsContext
+            context = _camera->getGraphicsContext();
+
+            if (!context)
+            {
+                osgViewer::Viewer::Contexts contexts;
+                viewer->getContexts(contexts);
+
+                if (contexts.empty()) return;
+
+                context = contexts.front();
+            }
+        }
+    }
+
+    _camera->setGraphicsContext(context);
+
+    _camera->setViewport(0, 0, context->getTraits()->width, context->getTraits()->height);

     _camera->setRenderOrder(osg::Camera::POST_RENDER, 10);


(WindowImp::poll) : Fix a bug

(WindowImp::poll) : Fix a bug

--- escort/src/WindowImp.cpp
+++ escort/src/WindowImp.cpp
@@ -295,7 +295,7 @@
                         recordTime("%*strigger restyling", windowDepth * 2, "");
                         backgroundTask.wakeUp(BackgroundTask::Cascade);
                         view = 0;
-                    } else if (flags & (Box::NEED_STYLE_RECALCULATION | Box::NEED_EXPANSION | Box::NEED_REFLOW)) {
+                    } else if (flags & (Box::NEED_STYLE_RECALCULATION | Box::NEED_EXPANSION | Box::NEED_CHILD_LAYOUT | Box::NEED_REFLOW)) {
                         recordTime("%*strigger reflow", windowDepth * 2, "");
                         backgroundTask.wakeUp(BackgroundTask::Layout);
                         view = 0;


[gardening] Fix recently introduced typo: "fucntion" → "function"

--- lib/SILOptimizer/Analysis/CallerAnalysis.cpp
+++ lib/SILOptimizer/Analysis/CallerAnalysis.cpp
@@ -41,7 +41,7 @@
         SILFunction *CalleeFn = getCallee(Apply);
         if (!CalleeFn)
           continue;
-        // Update the callee information for this fucntion.
+        // Update the callee information for this function.
         CallerAnalysisFunctionInfo &CallerInfo
                              = CallInfo.FindAndConstruct(F).second;
         CallerInfo.Callees.push_back(CalleeFn);


PC-relative pseudo instructions are lowered and printed directly. Any encounter
with one in the generic printing code is an error.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@114242 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
+++ lib/Target/ARM/AsmPrinter/ARMInstPrinter.cpp
@@ -387,7 +387,7 @@
   // All instructions using addrmodepc are pseudos and should have been
   // handled explicitly in printInstructionThroughMCStreamer(). If one got
   // here, it wasn't, so something's wrong.
-  assert(0 && "Unhandled addrmodepc operand!");
+  llvm_unreachable("Unhandled PC-relative pseudo-instruction!");
 }

 void ARMInstPrinter::printBitfieldInvMaskImmOperand(const MCInst *MI,
@@ -522,8 +522,7 @@

 void ARMInstPrinter::printPCLabel(const MCInst *MI, unsigned OpNum,
                                   raw_ostream &O) {
-  // FIXME: remove this.
-  abort();
+  llvm_unreachable("Unhandled PC-relative pseudo-instruction!");
 }

 void ARMInstPrinter::printThumbS4ImmOperand(const MCInst *MI, unsigned OpNum,


Fix bug found by regtests

Fix bug found by regtests

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@5294 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Target/SparcV9/SparcV9InstrSelection.cpp
+++ lib/Target/SparcV9/SparcV9InstrSelection.cpp
@@ -1251,18 +1251,14 @@
         Instruction* returnReg = new TmpInstruction(returnInstr);
         MachineCodeForInstruction::get(returnInstr).addTemp(returnReg);

-        M = new MachineInstr(JMPLRET);
-        M->SetMachineOperandVal(0, MachineOperand::MO_VirtualRegister,
-                                returnReg);
-        M->SetMachineOperandConst(1,MachineOperand::MO_SignExtendedImmed,
-                                  (int64_t)8);
-        M->SetMachineOperandReg(2, target.getRegInfo().getZeroRegNum());
+        M = BuildMI(JMPLRET, 3).addReg(returnReg).addSImm(8)
+                       .addMReg(target.getRegInfo().getZeroRegNum(), MOTy::Def);

         if (returnInstr->getReturnValue() != NULL)
           M->addImplicitRef(returnInstr->getReturnValue());

         mvec.push_back(M);
-        mvec.push_back(new MachineInstr(NOP));
+        mvec.push_back(BuildMI(NOP, 0));

         break;
       }
@@ -1998,8 +1994,8 @@
         if (isa<Function>(callee))      // direct function call
           M = BuildMI(CALL, 1).addPCDisp(callee);
         else                            // indirect function call
-          M = BuildMI(JMPLCALL,
-                      3).addReg(callee).addSImm((int64_t)0).addReg(retAddrReg);
+          M = BuildMI(JMPLCALL, 3).addReg(callee).addSImm((int64_t)0)
+                                  .addRegDef(retAddrReg);
         mvec.push_back(M);

         const FunctionType* funcType =


comments

comments

--- mne_rt_server/connectors/BabyMEG/babymegclient.cpp
+++ mne_rt_server/connectors/BabyMEG/babymegclient.cpp
@@ -20,18 +20,18 @@
 *     * Neither the name of the Massachusetts General Hospital nor the names of its contributors may be used
 *       to endorse or promote products derived from this software without specific prior written permission.
 *
+* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
+* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
+* POSSIBILITY OF SUCH DAMAGE.
+*
+*
+* @brief     implementation of the BabyMEGClient Class.
+*
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL MASSACHUSETTS GENERAL HOSPITAL BE LIABLE FOR ANY DIRECT,
 * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
-* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
-* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
-* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-* POSSIBILITY OF SUCH DAMAGE.
-*
-*
-* @brief     implementation of the BabyMEGClient Class.
-*
 */

 //*************************************************************************************************************


Group methods in CMPTransaction

Group methods in CMPTransaction

--- src/omnicore/tx.cpp
+++ src/omnicore/tx.cpp
@@ -30,6 +30,9 @@

 using namespace mastercore;

+// --------------------- DEPRECHIATED ------------------------
+// Please use CMPTransaction::interpret_Transaction() instead.
+// -----------------------------------------------------------

 // initial packet interpret step
 int CMPTransaction::step1()
@@ -159,17 +162,6 @@
   return 0;
 }

-// overrun check, are we beyond the end of packet?
-bool CMPTransaction::isOverrun(const char *p, unsigned int line)
-{
-int now = (char *)p - (char *)&pkt;
-bool bRet = (now > pkt_size);
-
-    if (bRet) PrintToLog("%s(%sline=%u):now= %u, pkt_size= %u\n", __FUNCTION__, bRet ? "OVERRUN !!! ":"", line, now, pkt_size);
-
-    return bRet;
-}
-
 // extract Smart Property data
 // RETURNS: the pointer to the next piece to be parsed
 // ERROR is returns NULL and/or sets the error_code
@@ -343,7 +335,54 @@
   return 0;
 }

-/** Interpret transaction based on type */
+// -----------------------------------------------------------
+
+/** Checks whether a pointer to the payload is past it's last position. */
+bool CMPTransaction::isOverrun(const char *p, unsigned int line)
+{
+int now = (char *)p - (char *)&pkt;
+bool bRet = (now > pkt_size);
+
+    if (bRet) PrintToLog("%s(%sline=%u):now= %u, pkt_size= %u\n", __FUNCTION__, bRet ? "OVERRUN !!! ":"", line, now, pkt_size);
+
+    return bRet;
+}
+
+char *mastercore::c_strMasterProtocolTXType(int i)
+{
+  switch (i)
+  {
+    case MSC_TYPE_SIMPLE_SEND: return ((char *)"Simple Send");
+    case MSC_TYPE_RESTRICTED_SEND: return ((char *)"Restricted Send");
+    case MSC_TYPE_SEND_TO_OWNERS: return ((char *)"Send To Owners");
+    case MSC_TYPE_SAVINGS_MARK: return ((char *)"Savings");
+    case MSC_TYPE_SAVINGS_COMPROMISED: return ((char *)"Savings COMPROMISED");
+    case MSC_TYPE_RATELIMITED_MARK: return ((char *)"Rate-Limiting");
+    case MSC_TYPE_AUTOMATIC_DISPENSARY: return ((char *)"Automatic Dispensary");
+    case MSC_TYPE_TRADE_OFFER: return ((char *)"DEx Sell Offer");
+    case MSC_TYPE_METADEX_TRADE: return ((char *)"MetaDEx trade");
+    case MSC_TYPE_METADEX_CANCEL_PRICE: return ((char *)"MetaDEx cancel-price");
+    case MSC_TYPE_METADEX_CANCEL_PAIR: return ((char *)"MetaDEx cancel-pair");
+    case MSC_TYPE_METADEX_CANCEL_ECOSYSTEM: return ((char *)"MetaDEx cancel-ecosystem");
+    case MSC_TYPE_ACCEPT_OFFER_BTC: return ((char *)"DEx Accept Offer");
+    case MSC_TYPE_CREATE_PROPERTY_FIXED: return ((char *)"Create Property - Fixed");
+    case MSC_TYPE_CREATE_PROPERTY_VARIABLE: return ((char *)"Create Property - Variable");
+    case MSC_TYPE_PROMOTE_PROPERTY: return ((char *)"Promote Property");
+    case MSC_TYPE_CLOSE_CROWDSALE: return ((char *)"Close Crowdsale");
+    case MSC_TYPE_CREATE_PROPERTY_MANUAL: return ((char *)"Create Property - Manual");
+    case MSC_TYPE_GRANT_PROPERTY_TOKENS: return ((char *)"Grant Property Tokens");
+    case MSC_TYPE_REVOKE_PROPERTY_TOKENS: return ((char *)"Revoke Property Tokens");
+    case MSC_TYPE_CHANGE_ISSUER_ADDRESS: return ((char *)"Change Issuer Address");
+    case MSC_TYPE_NOTIFICATION: return ((char *)"Notification");
+    case OMNICORE_MESSAGE_TYPE_ALERT: return ((char *)"ALERT");
+
+    default: return ((char *)"* unknown type *");
+  }
+}
+
+// -------------------- PACKET PARSING -----------------------
+
+/** Parses the packet or payload. */
 bool CMPTransaction::interpret_Transaction()
 {
     if (!interpret_TransactionType()) {
@@ -404,6 +443,7 @@
     return false;
 }

+/** Helper to convert class number to string. */
 static std::string intToClass(int multi)
 {
     switch (multi) {
@@ -872,6 +912,9 @@
     return true;
 }

+// ---------------------- CORE LOGIC -------------------------
+
+/** Tx 3 */
 int CMPTransaction::logicMath_SendToOwners()
 {
     if (!IsTransactionTypeAllowed(block, property, type, version)) {
@@ -951,7 +994,7 @@
     return 0;
 }

-
+/** Tx 20 */
 int CMPTransaction::logicMath_TradeOffer(CMPOffer *obj_o)
 {
     if (MAX_INT_8_BYTES < nValue) {
@@ -1053,6 +1096,7 @@
     return rc;
 }

+/** Tx 22 */
 int CMPTransaction::logicMath_AcceptOffer_BTC()
 {
     if (MAX_INT_8_BYTES < nValue) {
@@ -1086,6 +1130,7 @@
     return rc;
 }

+/** Tx 25 */
 int CMPTransaction::logicMath_MetaDExTrade()
 {
     if (MAX_INT_8_BYTES < nValue) {
@@ -1122,6 +1167,7 @@
     return rc;
 }

+/** Tx 26 */
 int CMPTransaction::logicMath_MetaDExCancelPrice()
 {
     if (MAX_INT_8_BYTES < nValue) {
@@ -1151,6 +1197,7 @@
     return rc;
 }

+/** Tx 27 */
 int CMPTransaction::logicMath_MetaDExCancelPair()
 {
     int rc = PKT_ERROR_METADEX -100;
@@ -1171,6 +1218,7 @@
     return rc;
 }

+/** Tx 28 */
 int CMPTransaction::logicMath_MetaDExCancelEcosystem()
 {
     int rc = PKT_ERROR_METADEX -101;
@@ -1182,6 +1230,7 @@
     return rc;
 }

+/** Tx 50 */
 int CMPTransaction::logicMath_CreatePropertyFixed()
 {
     if (OMNI_PROPERTY_MSC != ecosystem && OMNI_PROPERTY_TMSC != ecosystem) {
@@ -1228,6 +1277,7 @@
     return rc;
 }

+/** Tx 51 */
 int CMPTransaction::logicMath_CreatePropertyVariable()
 {
     if (OMNI_PROPERTY_MSC != ecosystem && OMNI_PROPERTY_TMSC != ecosystem) {
@@ -1288,6 +1338,7 @@
     return rc;
 }

+/** Tx 53 */
 int CMPTransaction::logicMath_CloseCrowdsale()
 {
     int rc = -1;
@@ -1338,6 +1389,7 @@
     return rc;
 }

+/** Tx 54 */
 int CMPTransaction::logicMath_CreatePropertyMananged()
 {
     if (OMNI_PROPERTY_MSC != ecosystem && OMNI_PROPERTY_TMSC != ecosystem) {
@@ -1376,6 +1428,7 @@
     return rc;
 }

+/** Tx 55 */
 int CMPTransaction::logicMath_GrantTokens()
 {
     if (MAX_INT_8_BYTES < nValue) {
@@ -1445,6 +1498,7 @@
     return rc;
 }

+/** Tx 56 */
 int CMPTransaction::logicMath_RevokeTokens()
 {
     if (MAX_INT_8_BYTES < nValue) {
@@ -1496,6 +1550,7 @@
     return rc;
 }

+/** Tx 70 */
 int CMPTransaction::logicMath_ChangeIssuer()
 {
   int rc = PKT_ERROR_TOKENS - 1000;
@@ -1538,6 +1593,7 @@
   return rc;
 }

+/** Tx 65535 */
 int CMPTransaction::logicMath_Alert()
 {
     // check the packet version is also FF
@@ -1609,35 +1665,3 @@
   return rc;
 }

-char *mastercore::c_strMasterProtocolTXType(int i)
-{
-  switch (i)
-  {
-    case MSC_TYPE_SIMPLE_SEND: return ((char *)"Simple Send");
-    case MSC_TYPE_RESTRICTED_SEND: return ((char *)"Restricted Send");
-    case MSC_TYPE_SEND_TO_OWNERS: return ((char *)"Send To Owners");
-    case MSC_TYPE_SAVINGS_MARK: return ((char *)"Savings");
-    case MSC_TYPE_SAVINGS_COMPROMISED: return ((char *)"Savings COMPROMISED");
-    case MSC_TYPE_RATELIMITED_MARK: return ((char *)"Rate-Limiting");
-    case MSC_TYPE_AUTOMATIC_DISPENSARY: return ((char *)"Automatic Dispensary");
-    case MSC_TYPE_TRADE_OFFER: return ((char *)"DEx Sell Offer");
-    case MSC_TYPE_METADEX_TRADE: return ((char *)"MetaDEx trade");
-    case MSC_TYPE_METADEX_CANCEL_PRICE: return ((char *)"MetaDEx cancel-price");
-    case MSC_TYPE_METADEX_CANCEL_PAIR: return ((char *)"MetaDEx cancel-pair");
-    case MSC_TYPE_METADEX_CANCEL_ECOSYSTEM: return ((char *)"MetaDEx cancel-ecosystem");
-    case MSC_TYPE_ACCEPT_OFFER_BTC: return ((char *)"DEx Accept Offer");
-    case MSC_TYPE_CREATE_PROPERTY_FIXED: return ((char *)"Create Property - Fixed");
-    case MSC_TYPE_CREATE_PROPERTY_VARIABLE: return ((char *)"Create Property - Variable");
-    case MSC_TYPE_PROMOTE_PROPERTY: return ((char *)"Promote Property");
-    case MSC_TYPE_CLOSE_CROWDSALE: return ((char *)"Close Crowdsale");
-    case MSC_TYPE_CREATE_PROPERTY_MANUAL: return ((char *)"Create Property - Manual");
-    case MSC_TYPE_GRANT_PROPERTY_TOKENS: return ((char *)"Grant Property Tokens");
-    case MSC_TYPE_REVOKE_PROPERTY_TOKENS: return ((char *)"Revoke Property Tokens");
-    case MSC_TYPE_CHANGE_ISSUER_ADDRESS: return ((char *)"Change Issuer Address");
-    case MSC_TYPE_NOTIFICATION: return ((char *)"Notification");
-    case OMNICORE_MESSAGE_TYPE_ALERT: return ((char *)"ALERT");
-
-    default: return ((char *)"* unknown type *");
-  }
-}
-


draw background with some flat lighting.

--- src/opengl_core.cpp
+++ src/opengl_core.cpp
@@ -349,6 +349,8 @@
                                1.0f, 0.0f,
                                0.0f, 0.0f,
                                0.0f, 1.0f};
+
+
     DrawModeLevel(instance.window);

     glBindTexture(GL_TEXTURE_2D, background);
@@ -368,7 +370,12 @@
     glVertexAttribPointer(PHOTON_VERTEX_LOCATION_ATTRIBUTE, 2, GL_FLOAT, GL_FALSE, 0, verts);
     glVertexAttribPointer(PHOTON_VERTEX_UV_ATTRIBUTE,       2, GL_FLOAT, GL_FALSE, 0, uv);
     glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
-}
-
-}
-}
+
+    DrawModeFX(instance.window);
+    SetFacFX(0.4f);
+    opengl::SetModelMatrix(matrix);
+    glDrawArrays(GL_TRIANGLE_FAN, 0, 4);
+}
+
+}
+}


SIL: Don't crash when printing closure-local SILDeclRefs.

I don't know what we should print here to produce a parsable SILDeclRef, but this keeps tests from crashing in the meantime.

Swift SVN r8075

--- lib/SIL/SILPrinter.cpp
+++ lib/SIL/SILPrinter.cpp
@@ -120,10 +120,14 @@
     return;

   case DeclContextKind::CapturingExpr:
+    // FIXME
+    Buffer << "<anonymous function>";
+    return;
+
   case DeclContextKind::TopLevelCodeDecl:
   case DeclContextKind::ConstructorDecl:
   case DeclContextKind::DestructorDecl:
-    llvm_unreachable("unhandled context type in SILPrint!");
+    llvm_unreachable("unhandled context kind in SILPrint!");

   case DeclContextKind::ExtensionDecl: {
     Type Ty = cast<ExtensionDecl>(Context)->getExtendedType();
@@ -131,7 +135,7 @@
     const NominalTypeDecl *ExtNominal = 0;
     switch (Base->getKind()) {
       default:
-        llvm_unreachable("unhandled context type in SILPrint!");
+        llvm_unreachable("unhandled context kind in SILPrint!");
       case TypeKind::Union:
         ExtNominal = cast<UnionType>(Base)->getDecl();
         break;


now only runtime exception if configuration can't be instantiated

--- xmlhelp/source/cxxhelp/provider/provider.cxx
+++ xmlhelp/source/cxxhelp/provider/provider.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: provider.cxx,v $
  *
- *  $Revision: 1.5 $
- *
- *  last change: $Author: abi $ $Date: 2001-06-06 14:48:47 $
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: abi $ $Date: 2001-07-06 13:32:50 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -118,10 +118,10 @@
 //=========================================================================

 ContentProvider::ContentProvider( const Reference< XMultiServiceFactory >& rSMgr )
-    : ::ucb::ContentProviderImplHelper( rSMgr ),
-             isInitialized( false ),
-             m_aScheme( OUString::createFromAscii( MYUCP_URL_SCHEME ) ),
-             m_pDatabases( 0 )
+  : ::ucb::ContentProviderImplHelper( rSMgr ),
+                   isInitialized( false ),
+                   m_aScheme( OUString::createFromAscii( MYUCP_URL_SCHEME ) ),
+                   m_pDatabases( 0 )
 {
 }

@@ -182,89 +182,141 @@

 // virtual
 Reference< XContent > SAL_CALL ContentProvider::queryContent( const Reference< XContentIdentifier >& xCanonicId )
-    throw( IllegalIdentifierException, RuntimeException )
+  throw( IllegalIdentifierException, RuntimeException )
 {
-    if ( ! xCanonicId->getContentProviderScheme().equalsIgnoreAsciiCase( m_aScheme ) )
+  if ( ! xCanonicId->getContentProviderScheme().equalsIgnoreAsciiCase( m_aScheme ) )
     {   // Wrong URL-scheme
-        throw IllegalIdentifierException();
-    }
-
-    {
-        osl::MutexGuard aGuard( m_aMutex );
-        if( ! isInitialized )
-            init();
-    }
-
-    if( ! m_pDatabases )
-        throw RuntimeException();
-
-    // Check, if a content with given id already exists...
-    Reference< XContent > xContent
-        = queryExistingContent( xCanonicId ).getBodyPtr();
-    if ( xContent.is() )
-        return xContent;
-
-    xContent = new Content( m_xSMgr,this,xCanonicId,m_pDatabases );
-
-    // Further checks
-
-    if ( !xContent->getIdentifier().is() )
-        throw IllegalIdentifierException();
-
+      throw IllegalIdentifierException();
+    }
+
+  {
+    osl::MutexGuard aGuard( m_aMutex );
+    if( ! isInitialized )
+      init();
+  }
+
+  if( ! m_pDatabases )
+    throw RuntimeException();
+
+
+  // Check, if a content with given id already exists...
+  Reference< XContent > xContent
+    = queryExistingContent( xCanonicId ).getBodyPtr();
+  if ( xContent.is() )
     return xContent;
+
+  xContent = new Content( m_xSMgr,this,xCanonicId,m_pDatabases );
+
+  // Further checks
+
+  if ( !xContent->getIdentifier().is() )
+    throw IllegalIdentifierException();
+
+  return xContent;
 }

 void ContentProvider::init()
 {
-    rtl::OUString sProviderService =
-        rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" );
-
-    // New access to configuration
-    Any aAny;
-    aAny <<= rtl::OUString::createFromAscii( "plugin" );
-    PropertyValue aProp( rtl::OUString::createFromAscii( "servertype" ),
-                         -1,
-                         aAny,
-                         PropertyState_DIRECT_VALUE );
-
-    Sequence< Any > seq(1);
-    seq[0] <<= aProp;
-
-    Reference< XMultiServiceFactory >
-        sProvider(
-            m_xSMgr->createInstanceWithArguments( sProviderService,seq ),
-            UNO_QUERY );
-
-    rtl::OUString sReaderService =
-        rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" );
-
-    seq[0] <<= rtl::OUString::createFromAscii( "org.openoffice.Office.Common" );
-
-    Reference< XHierarchicalNameAccess > xHierAccess(
-        sProvider->createInstanceWithArguments( sReaderService,seq ),UNO_QUERY );
-
-    aAny =
-        xHierAccess->getByHierarchicalName( rtl::OUString::createFromAscii("Path/Current/Help") );
-
-    rtl::OUString instPath;
-    if( ! ( aAny >>= instPath ) )
-        ;
-    else
-        instPath = rtl::OUString::createFromAscii( "$(instpath)/help" );
-
-    Reference< XConfigManager > xCfgMgr(
-        m_xSMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ),
-        UNO_QUERY );
-
-    VOS_ENSURE( xCfgMgr.is(),
-                "HelpProvider::init - No Config Manager!" );
-
-    if( xCfgMgr.is() )
-        instPath = xCfgMgr->substituteVariables( instPath );
-
-
-    m_pDatabases = new Databases( instPath,m_xSMgr );
-    isInitialized = true;
+  isInitialized = true;
+
+  rtl::OUString sProviderService =
+    rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationProvider" );
+
+
+  Any aAny;
+  aAny <<= rtl::OUString::createFromAscii( "local" );
+  PropertyValue aProp( rtl::OUString::createFromAscii( "servertype" ),
+               -1,
+               aAny,
+               PropertyState_DIRECT_VALUE );
+
+  Sequence< Any > seq(1);
+  seq[0] <<= aProp;
+
+  Reference< XMultiServiceFactory > sProvider;
+  try
+    {
+      sProvider =
+    Reference< XMultiServiceFactory >(
+                      m_xSMgr->createInstanceWithArguments( sProviderService,seq ),
+                      UNO_QUERY );
+    }
+  catch( const com::sun::star::uno::Exception& e )
+    {
+      VOS_ENSHURE( sProvider.is()," cant instantiate the multiservicefactory " );
+    }
+
+
+  if( ! sProvider.is() )
+    {
+      return;
+    }
+
+  rtl::OUString sReaderService =
+    rtl::OUString::createFromAscii( "com.sun.star.configuration.ConfigurationAccess" );
+
+  seq[0] <<= rtl::OUString::createFromAscii( "org.openoffice.Office.Common" );
+
+
+  Reference< XHierarchicalNameAccess > xHierAccess;
+  try
+    {
+      xHierAccess =
+    Reference< XHierarchicalNameAccess >
+    ( sProvider->createInstanceWithArguments( sReaderService,seq ),
+      UNO_QUERY );
+    }
+  catch( const com::sun::star::uno::Exception& e )
+    {
+      VOS_ENSHURE( xHierAccess.is()," cant instantiate the reader service " );
+    }
+
+  if( ! xHierAccess.is() )
+    return;
+
+  try
+    {
+      aAny =
+    xHierAccess->getByHierarchicalName( rtl::OUString::createFromAscii("Path/Current/Help") );
+    }
+  catch( const com::sun::star::container::NoSuchElementException& e )
+    {
+      VOS_ENSHURE( false," path to help files could not be determined " );
+      return;
+    }
+
+
+  rtl::OUString instPath;
+  bool err = ! ( aAny >>= instPath );
+
+  if( err )
+    {
+      VOS_ENSHURE( false," path to help files could not be determined " );
+      return;
+    }
+
+  instPath = rtl::OUString::createFromAscii( "$(instpath)/help" );
+
+  Reference< XConfigManager >  xCfgMgr;
+  try
+    {
+      xCfgMgr =
+    Reference< XConfigManager >(
+                    m_xSMgr->createInstance( rtl::OUString::createFromAscii( "com.sun.star.config.SpecialConfigManager" ) ),
+                    UNO_QUERY );
+    }
+  catch( const com::sun::star::uno::Exception& e )
+    {
+      VOS_ENSHURE( xCfgMgr.is()," cant instantiate the special config manager " );
+    }
+
+
+  if( ! xCfgMgr.is() )
+    return;
+
+  instPath = xCfgMgr->substituteVariables( instPath );
+  m_pDatabases = new Databases( instPath,m_xSMgr );
+
 }


INTEGRATION: CWS impress67 (1.12.62); FILE MERGED 2005/08/29 07:29:51 cl 1.12.62.1: #i42959# fixed svg:stroke-opacity attribute

--- xmloff/source/transform/StyleOOoTContext.cxx
+++ xmloff/source/transform/StyleOOoTContext.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: StyleOOoTContext.cxx,v $
  *
- *  $Revision: 1.12 $
- *
- *  last change: $Author: rt $ $Date: 2005-05-18 09:45:40 $
+ *  $Revision: 1.13 $
+ *
+ *  last change: $Author: obo $ $Date: 2005-09-05 14:56:39 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -1000,6 +1000,24 @@
                 SvXMLUnitConverter::convertPercent( aOut, nValue );
                 OUString aAttrValue( aOut.makeStringAndClear() );
                 pContext->AddAttribute( sAttrName, aAttrValue );
+            }
+            break;
+        case XML_ATACTION_OPACITY_FIX:
+            {
+                sal_Int32 nValue;
+                if( sAttrValue.indexOf( sal_Unicode('%') ) != -1 )
+                {
+                    SvXMLUnitConverter::convertPercent( nValue, sAttrValue );
+                }
+                else
+                {
+                    nValue = sal_Int32( sAttrValue.toDouble() * 100.0 );
+                }
+                nValue = 100 - nValue;
+
+                rtl::OUStringBuffer aOut;
+                SvXMLUnitConverter::convertPercent( aOut, nValue );
+                pContext->AddAttribute( sAttrName, aOut.makeStringAndClear() );
             }
             break;
         default:


INTEGRATION: CWS residcleanup (1.27.36); FILE MERGED 2007/03/04 17:32:25 pl 1.27.36.1: #i73635# ResId cleanup

--- xmlsecurity/source/dialogs/macrosecurity.cxx
+++ xmlsecurity/source/dialogs/macrosecurity.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: macrosecurity.cxx,v $
  *
- *  $Revision: 1.28 $
- *
- *  last change: $Author: ihi $ $Date: 2007-04-17 10:16:19 $
+ *  $Revision: 1.29 $
+ *
+ *  last change: $Author: rt $ $Date: 2007-04-26 08:17:51 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -103,11 +103,11 @@

 MacroSecurity::MacroSecurity( Window* _pParent, const cssu::Reference< dcss::xml::crypto::XSecurityEnvironment >& _rxSecurityEnvironment )
     :TabDialog          ( _pParent, XMLSEC_RES( RID_XMLSECTP_MACROSEC ) )
-    ,maTabCtrl          ( this, ResId( 1 ) )
-    ,maOkBtn            ( this, ResId( BTN_OK ) )
-    ,maCancelBtn        ( this, ResId( BTN_CANCEL ) )
-    ,maHelpBtn          ( this, ResId( BTN_HELP ) )
-    ,maResetBtn         ( this, ResId( BTN_RESET ) )
+    ,maTabCtrl          ( this, XMLSEC_RES( 1 ) )
+    ,maOkBtn            ( this, XMLSEC_RES( BTN_OK ) )
+    ,maCancelBtn        ( this, XMLSEC_RES( BTN_CANCEL ) )
+    ,maHelpBtn          ( this, XMLSEC_RES( BTN_HELP ) )
+    ,maResetBtn         ( this, XMLSEC_RES( BTN_RESET ) )
 {
     FreeResource();

@@ -138,12 +138,12 @@

 MacroSecurityLevelTP::MacroSecurityLevelTP( Window* _pParent, MacroSecurity* _pDlg )
     :MacroSecurityTP    ( _pParent, XMLSEC_RES( RID_XMLSECTP_SECLEVEL ), _pDlg )
-    ,maSecLevelFL       ( this, ResId( FL_SECLEVEL ) )
-    ,maSecReadonlyFI    ( this, ResId( FI_SEC_READONLY ))
-    ,maVeryHighRB       ( this, ResId( RB_VERYHIGH ) )
-    ,maHighRB           ( this, ResId( RB_HIGH ) )
-    ,maMediumRB         ( this, ResId( RB_MEDIUM ) )
-    ,maLowRB            ( this, ResId( RB_LOW ) )
+    ,maSecLevelFL       ( this, XMLSEC_RES( FL_SECLEVEL ) )
+    ,maSecReadonlyFI    ( this, XMLSEC_RES( FI_SEC_READONLY ))
+    ,maVeryHighRB       ( this, XMLSEC_RES( RB_VERYHIGH ) )
+    ,maHighRB           ( this, XMLSEC_RES( RB_HIGH ) )
+    ,maMediumRB         ( this, XMLSEC_RES( RB_MEDIUM ) )
+    ,maLowRB            ( this, XMLSEC_RES( RB_LOW ) )
 {
     FreeResource();

@@ -360,22 +360,22 @@

 MacroSecurityTrustedSourcesTP::MacroSecurityTrustedSourcesTP( Window* _pParent, MacroSecurity* _pDlg )
     :MacroSecurityTP    ( _pParent, XMLSEC_RES( RID_XMLSECTP_TRUSTSOURCES ), _pDlg )
-    ,maTrustCertFL      ( this, ResId( FL_TRUSTCERT ) )
-    ,maTrustCertROFI    ( this, ResId( FI_TRUSTCERT_RO ) )
-    ,maTrustCertLB      ( this, ResId( LB_TRUSTCERT ) )
-    ,maAddCertPB        ( this, ResId( PB_ADD_TRUSTCERT ) )
-    ,maViewCertPB       ( this, ResId( PB_VIEW_TRUSTCERT ) )
-    ,maRemoveCertPB     ( this, ResId( PB_REMOVE_TRUSTCERT ) )
-    ,maTrustFileLocFL   ( this, ResId( FL_TRUSTFILELOC ) )
-    ,maTrustFileROFI    ( this, ResId( FI_TRUSTFILE_RO ) )
-    ,maTrustFileLocFI   ( this, ResId( FI_TRUSTFILELOC ) )
-    ,maTrustFileLocLB   ( this, ResId( LB_TRUSTFILELOC ) )
-    ,maAddLocPB         ( this, ResId( FL_ADD_TRUSTFILELOC ) )
-    ,maRemoveLocPB      ( this, ResId( FL_REMOVE_TRUSTFILELOC ) )
+    ,maTrustCertFL      ( this, XMLSEC_RES( FL_TRUSTCERT ) )
+    ,maTrustCertROFI    ( this, XMLSEC_RES( FI_TRUSTCERT_RO ) )
+    ,maTrustCertLB      ( this, XMLSEC_RES( LB_TRUSTCERT ) )
+    ,maAddCertPB        ( this, XMLSEC_RES( PB_ADD_TRUSTCERT ) )
+    ,maViewCertPB       ( this, XMLSEC_RES( PB_VIEW_TRUSTCERT ) )
+    ,maRemoveCertPB     ( this, XMLSEC_RES( PB_REMOVE_TRUSTCERT ) )
+    ,maTrustFileLocFL   ( this, XMLSEC_RES( FL_TRUSTFILELOC ) )
+    ,maTrustFileROFI    ( this, XMLSEC_RES( FI_TRUSTFILE_RO ) )
+    ,maTrustFileLocFI   ( this, XMLSEC_RES( FI_TRUSTFILELOC ) )
+    ,maTrustFileLocLB   ( this, XMLSEC_RES( LB_TRUSTFILELOC ) )
+    ,maAddLocPB         ( this, XMLSEC_RES( FL_ADD_TRUSTFILELOC ) )
+    ,maRemoveLocPB      ( this, XMLSEC_RES( FL_REMOVE_TRUSTFILELOC ) )
 {
     static long nTabs[] = { 3, 0, 35*CS_LB_WIDTH/100, 70*CS_LB_WIDTH/100 };
     maTrustCertLB.SetTabs( &nTabs[ 0 ] );
-    maTrustCertLB.InsertHeaderEntry( String( ResId( STR_HEADERBAR ) ) );
+    maTrustCertLB.InsertHeaderEntry( String( XMLSEC_RES( STR_HEADERBAR ) ) );

     FreeResource();


Don't return true on a function with a void return type.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@156484 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/Support/Triple.cpp
+++ lib/Support/Triple.cpp
@@ -609,7 +609,7 @@
     Major = 0;
     Minor = 0;
     Micro = 0;
-    return true;
+    break;
   case IOS:
     getOSVersion(Major, Minor, Micro);
     // Default to 0.0.


Review parsing of member access

Review parsing of member access

--- src/parser_x3/SpiritParser.cpp
+++ src/parser_x3/SpiritParser.cpp
@@ -174,6 +174,7 @@
     struct integer_suffix_literal_class;
     struct float_literal_class;
     struct string_literal_class;
+    struct identifier_literal_class;
     struct char_literal_class;
     struct value_class;
     struct primary_value_class;
@@ -244,6 +245,7 @@
     x3::rule<integer_suffix_literal_class, ast::IntegerSuffix> const integer_suffix_literal("integer_suffix_literal");
     x3::rule<float_literal_class, ast::Float> const float_literal("float_literal");
     x3::rule<string_literal_class, ast::Literal> const string_literal("string_literal");
+    x3::rule<identifier_literal_class, ast::Literal> const identifier_literal("identifier_literal");
     x3::rule<char_literal_class, ast::CharLiteral> const char_literal("char_literal");
     x3::rule<new_array_class, ast::NewArray> const new_array("new_array");
     x3::rule<new_class, ast::New> const new_("new_");
@@ -423,6 +425,9 @@
     auto const integer_literal_def =
         x3::int_;

+    auto const identifier_literal_def =
+        identifier;
+
     auto const integer_suffix_literal_def =
         x3::lexeme[
                 x3::int_
@@ -510,7 +515,7 @@
                 |
                          '.'
                      >>  x3::attr(ast::Operator::DOT)
-                     >>  variable_value
+                     >>  identifier_literal
                 |
                          postfix_op
                      >   x3::attr(ast::VariableValue())
@@ -591,6 +596,7 @@
         float_literal,
         char_literal,
         string_literal,
+        identifier_literal,
         variable_value,
         new_array,
         new_,


fix #14: read-line doesn't ever return eof-object from console input

--- src/io.cpp
+++ src/io.cpp
@@ -908,10 +908,14 @@
     FAlive ap(&port);
     FObject lst = EmptyListObject;
     FAlive al(&lst);
-    FCh ch = 0;
-
-    while (ReadCh(port, &ch))
-    {
+    FCh ch;
+    ulong_t ret;
+
+    for (;;)
+    {
+        ret = ReadCh(port, &ch);
+        if (ret == 0)
+            break;
         if (ch == 0x0A || ch == 0x0D)
             break;

@@ -935,7 +939,7 @@
         }
     }

-    if (ch == 0 && lst == EmptyListObject)
+    if (ret == 0 && lst == EmptyListObject)
         return(EndOfFileObject);

     return(ListToString(lst));


SWDEV-2 - Change OpenCL version number from  3475 to 3476

--- utils/versions.hpp
+++ utils/versions.hpp
@@ -28,7 +28,7 @@
 #endif  // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-#define AMD_PLATFORM_BUILD_NUMBER 3475
+#define AMD_PLATFORM_BUILD_NUMBER 3476
 #endif  // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


SWDEV-2 - Change OpenCL version number from  3477 to 3478

--- utils/versions.hpp
+++ utils/versions.hpp
@@ -28,7 +28,7 @@
 #endif  // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-#define AMD_PLATFORM_BUILD_NUMBER 3477
+#define AMD_PLATFORM_BUILD_NUMBER 3478
 #endif  // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


SWDEV-2 - Change OpenCL version number from  3501 to 3502

--- utils/versions.hpp
+++ utils/versions.hpp
@@ -28,7 +28,7 @@
 #endif  // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-#define AMD_PLATFORM_BUILD_NUMBER 3501
+#define AMD_PLATFORM_BUILD_NUMBER 3502
 #endif  // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


SWDEV-2 - Change OpenCL version number from  3166 to 3167

--- utils/versions.hpp
+++ utils/versions.hpp
@@ -28,7 +28,7 @@
 #endif  // AMD_PLATFORM_NAME

 #ifndef AMD_PLATFORM_BUILD_NUMBER
-#define AMD_PLATFORM_BUILD_NUMBER 3166
+#define AMD_PLATFORM_BUILD_NUMBER 3167
 #endif  // AMD_PLATFORM_BUILD_NUMBER

 #ifndef AMD_PLATFORM_REVISION_NUMBER


Check that replace "wrap" file hasnt been added multiple times to project.

--- source/projectGenerator_files.cpp
+++ source/projectGenerator_files.cpp
@@ -144,6 +144,15 @@
         uint uiCutPos = itIt->rfind('/') + 1;
         string sFilename = itIt->substr(uiCutPos, uiExtPos - uiCutPos);
         string sExtension = itIt->substr(uiExtPos);
+        string sOutFile = m_ConfigHelper.m_sSolutionDirectory + m_sProjectName + "/" + sFilename + "_wrap" + sExtension;
+        string sNewOutFile;
+        m_ConfigHelper.makeFileProjectRelative(sOutFile, sNewOutFile);
+        // Check hasnt already been included as a wrapped object
+        if (find(vExistingIncludes.begin(), vExistingIncludes.end(), sNewOutFile) != vExistingIncludes.end()) {
+            // skip this item
+            outputInfo(sNewOutFile);
+            continue;
+        }
         //Get the files dynamic config requirement
         string sIdents;
         for (StaticList::iterator itIdents = m_mReplaceIncludes[sFilename].begin(); itIdents < m_mReplaceIncludes[sFilename].end(); itIdents++) {
@@ -166,13 +175,11 @@
             outputError("Failed creating local " + m_sProjectName + " directory");
             return false;
         }
-        string sOutFile = m_ConfigHelper.m_sSolutionDirectory + m_sProjectName + "/" + sFilename + "_wrap" + sExtension;
         if (!writeToFile(sOutFile, sNewFile)) {
             return false;
         }
         //Add the new file to list of objects
-        m_ConfigHelper.makeFileProjectRelative(sOutFile, sOutFile);
-        vExistingIncludes.push_back(sOutFile);
+        vExistingIncludes.push_back(sNewOutFile);
     }
     return true;
 }


filestore: fix clone_range

filestore: fix clone_range

This was broken by the safe_write() switchover; the success return value
is now 0, not the number of bytes written.

Signed-off-by: Sage Weil <c5b6ff1fd4f0bde10db63d7a3e07166cf6c4229f@dreamhost.com>

--- src/os/FileStore.cc
+++ src/os/FileStore.cc
@@ -2353,7 +2353,7 @@
 	     << ", " << cpp_strerror(r) << dendl;
 	break;
       }
-      op += r2;
+      op += (r-op);
     }
     if (r < 0)
       break;


FileStore: check write_op_seq return code during sync_entry

Signed-off-by: Samuel Just <4c46b94684b338bae1ed5e7e1321718dd75401cc@dreamhost.com>

--- src/os/FileStore.cc
+++ src/os/FileStore.cc
@@ -2985,7 +2985,11 @@
       sync_epoch++;

       dout(15) << "sync_entry committing " << cp << " sync_epoch " << sync_epoch << dendl;
-      write_op_seq(op_fd, cp);
+      if (write_op_seq(op_fd, cp) < 0) {
+	derr << "Error: " << cpp_strerror(errno)
+	     << " during write_op_seq" << dendl;
+	assert(0);
+      }

       bool do_snap = btrfs && g_conf->filestore_btrfs_snap;


ha_innobase.cc	Changed the error code HA_ERR_KEY_NOT_FOUND to HA_ERR_END_OF_INDEX in index_first to eliminate an error message

--- sql/ha_innobase.cc
+++ sql/ha_innobase.cc
@@ -1868,7 +1868,7 @@
 int
 ha_innobase::index_first(
 /*=====================*/
-				/* out: 0, HA_ERR_KEY_NOT_FOUND,
+				/* out: 0, HA_ERR_END_OF_FILE,
 				or error code */
 	mysql_byte*	buf)	/* in/out: buffer for the row */
 {
@@ -1878,6 +1878,12 @@
   	statistic_increment(ha_read_first_count, &LOCK_status);

   	error = index_read(buf, NULL, 0, HA_READ_AFTER_KEY);
+
+        /* MySQL does not seem to allow this to return HA_ERR_KEY_NOT_FOUND */
+
+  	if (error == HA_ERR_KEY_NOT_FOUND) {
+  		error = HA_ERR_END_OF_FILE;
+  	}

   	DBUG_RETURN(error);
 }
@@ -1899,7 +1905,7 @@

   	error = index_read(buf, NULL, 0, HA_READ_BEFORE_KEY);

-  	/* MySQL does not seem to allow this to return HA_ERR_KEY_NOT_FOUND */
+        /* MySQL does not seem to allow this to return HA_ERR_KEY_NOT_FOUND */

   	if (error == HA_ERR_KEY_NOT_FOUND) {
   		error = HA_ERR_END_OF_FILE;