text:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using Microsoft.CodeAnalysis.CSharp.Test.Utilities;
using Microsoft.CodeAnalysis.Test.Utilities;
using Roslyn.Test.Utilities;
using Xunit;

namespace Microsoft.CodeAnalysis.CSharp.UnitTests
{
    [CompilerTrait(CompilerFeature.ReadOnlyReferences)]
    public class CodeGenRefReadOnlyReturnTests : CompilingTestBase
    {
        [Fact]
        public void RefReadonlyLocalToField()
        {
            var source = @"
struct S
{
    public int X;
    public S(int x) => X = x;

    public void AddOne() => this.X++;
}

readonly struct S2
{
    public readonly int X;
    public S2(int x) => X = x;

    public void AddOne() { }
}

class C
{
    static S s1 = new S(0);
    readonly static S s2 = new S(0);

    static S2 s3 = new S2(0);
    readonly S2 s4 = new S2(0);

    ref readonly S M()
    {
        ref readonly S rs1 = ref s1;
        rs1.AddOne();
        ref readonly S rs2 = ref s2;
        rs2.AddOne();

        ref readonly S2 rs3 = ref s3;
        rs3.AddOne();
        ref readonly S2 rs4 = ref s4;
        rs4.AddOne();

        return ref rs1;
    }
}";

            // WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref assignments
            var comp = CompileAndVerify(source, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: Verification.Fails);
            comp.VerifyIL("C.M", @"
{
  // Code size       59 (0x3b)
  .maxstack  2
  .locals init (S V_0)
  IL_0000:  ldsflda    ""S C.s1""
  IL_0005:  dup
  IL_0006:  ldobj      ""S""
  IL_000b:  stloc.0
  IL_000c:  ldloca.s   V_0
  IL_000e:  call       ""void S.AddOne()""
  IL_0013:  ldsflda    ""S C.s2""
  IL_0018:  ldobj      ""S""
  IL_001d:  stloc.0
  IL_001e:  ldloca.s   V_0
  IL_0020:  call       ""void S.AddOne()""
  IL_0025:  ldsflda    ""S2 C.s3""
  IL_002a:  call       ""void S2.AddOne()""
  IL_002f:  ldarg.0
  IL_0030:  ldflda     ""S2 C.s4""
  IL_0035:  call       ""void S2.AddOne()""
  IL_003a:  ret
}");

            comp = CompileAndVerify(source, verify: Verification.Fails);
            comp.VerifyIL("C.M", @"
{
  // Code size       59 (0x3b)
  .maxstack  2
  .locals init (S V_0)
  IL_0000:  ldsflda    ""S C.s1""
  IL_0005:  dup
  IL_0006:  ldobj      ""S""
  IL_000b:  stloc.0
  IL_000c:  ldloca.s   V_0
  IL_000e:  call       ""void S.AddOne()""
  IL_0013:  ldsflda    ""S C.s2""
  IL_0018:  ldobj      ""S""
  IL_001d:  stloc.0
  IL_001e:  ldloca.s   V_0
  IL_0020:  call       ""void S.AddOne()""
  IL_0025:  ldsflda    ""S2 C.s3""
  IL_002a:  call       ""void S2.AddOne()""
  IL_002f:  ldarg.0
  IL_0030:  ldflda     ""S2 C.s4""
  IL_0035:  call       ""void S2.AddOne()""
  IL_003a:  ret
}");
        }

        [Fact]
        public void CallsOnRefReadonlyCopyReceiver()
        {
            var comp = CompileAndVerify(@"
using System;

struct S
{
    public int X;
    public S(int x) => X = x;

    public void AddOne() => this.X++;
}

class C
{
    public static void Main()
    {
        S s = new S(0);
        ref readonly S rs = ref s;
        Console.WriteLine(rs.X);
        rs.AddOne();
        Console.WriteLine(rs.X);
        rs.AddOne();
        rs.AddOne();
        rs.AddOne();
    }
}", expectedOutput: @"0
0");
            comp.VerifyIL("C.Main", @"
{
  // Code size       88 (0x58)
  .maxstack  2
  .locals init (S V_0, //s
                S V_1)
  IL_0000:  ldloca.s   V_0
  IL_0002:  ldc.i4.0
  IL_0003:  call       ""S..ctor(int)""
  IL_0008:  ldloca.s   V_0
  IL_000a:  dup
  IL_000b:  ldfld      ""int S.X""
  IL_0010:  call       ""void System.Console.WriteLine(int)""
  IL_0015:  dup
  IL_0016:  ldobj      ""S""
  IL_001b:  stloc.1
  IL_001c:  ldloca.s   V_1
  IL_001e:  call       ""void S.AddOne()""
  IL_0023:  dup
  IL_0024:  ldfld      ""int S.X""
  IL_0029:  call       ""void System.Console.WriteLine(int)""
  IL_002e:  dup
  IL_002f:  ldobj      ""S""
  IL_0034:  stloc.1
  IL_0035:  ldloca.s   V_1
  IL_0037:  call       ""void S.AddOne()""
  IL_003c:  dup
  IL_003d:  ldobj      ""S""
  IL_0042:  stloc.1
  IL_0043:  ldloca.s   V_1
  IL_0045:  call       ""void S.AddOne()""
  IL_004a:  ldobj      ""S""
  IL_004f:  stloc.1
  IL_0050:  ldloca.s   V_1
  IL_0052:  call       ""void S.AddOne()""
  IL_0057:  ret
}");
            // This should generate similar IL to the previous
            comp = CompileAndVerify(@"
using System;

struct S
{
    public int X;
    public S(int x) => X = x;

    public void AddOne() => this.X++;
}

class C
{
    public static void Main()
    {
        S s = new S(0);
        ref S sr = ref s;
        var temp = sr;
        temp.AddOne();
        Console.WriteLine(temp.X);
        temp = sr;
        temp.AddOne();
        Console.WriteLine(temp.X);
    }
}", expectedOutput: @"1
1");
            comp.VerifyIL("C.Main", @"
{
  // Code size       60 (0x3c)
  .maxstack  2
  .locals init (S V_0, //s
                S V_1) //temp
  IL_0000:  ldloca.s   V_0
  IL_0002:  ldc.i4.0
  IL_0003:  call       ""S..ctor(int)""
  IL_0008:  ldloca.s   V_0
  IL_000a:  dup
  IL_000b:  ldobj      ""S""
  IL_0010:  stloc.1
  IL_0011:  ldloca.s   V_1
  IL_0013:  call       ""void S.AddOne()""
  IL_0018:  ldloc.1
  IL_0019:  ldfld      ""int S.X""
  IL_001e:  call       ""void System.Console.WriteLine(int)""
  IL_0023:  ldobj      ""S""
  IL_0028:  stloc.1
  IL_0029:  ldloca.s   V_1
  IL_002b:  call       ""void S.AddOne()""
  IL_0030:  ldloc.1
  IL_0031:  ldfld      ""int S.X""
  IL_0036:  call       ""void System.Console.WriteLine(int)""
  IL_003b:  ret
}");
        }

        [Fact]
        public void RefReadOnlyParamCopyReceiver()
        {
            var comp = CompileAndVerify(@"
using System;

struct S
{
    public int X;
    public S(int x) => X = x;

    public void AddOne() => this.X++;
}

class C
{
    public static void Main()
    {
        M(new S(0));
    }
    static void M(in S rs)
    {
        Console.WriteLine(rs.X);
        rs.AddOne();
        Console.WriteLine(rs.X);
    }
}", expectedOutput: @"0
0");
            comp.VerifyIL(@"C.M", @"
{
  // Code size       37 (0x25)
  .maxstack  1
  .locals init (S V_0)
  IL_0000:  ldarg.0
  IL_0001:  ldfld      ""int S.X""
  IL_0006:  call       ""void System.Console.WriteLine(int)""
  IL_000b:  ldarg.0
  IL_000c:  ldobj      ""S""
  IL_0011:  stloc.0
  IL_0012:  ldloca.s   V_0
  IL_0014:  call       ""void S.AddOne()""
  IL_0019:  ldarg.0
  IL_001a:  ldfld      ""int S.X""
  IL_001f:  call       ""void System.Console.WriteLine(int)""
  IL_0024:  ret
}");
        }

        [Fact]
        public void CarryThroughLifetime()
        {
            var comp = CompileAndVerify(@"
class C
{
    static ref readonly int M(ref int p)
    {
        ref readonly int rp = ref p;
        return ref rp;
    }
}", verify: Verification.Fails);
            comp.VerifyIL("C.M", @"
{
  // Code size        2 (0x2)
  .maxstack  1
  IL_0000:  ldarg.0
  IL_0001:  ret
}");
        }

        [Fact]
        public void TempForReadonly()
        {
            var comp = CompileAndVerify(@"
using System;
class C
{
    public static void Main()
    {
        void L(in int p)
        {
            Console.WriteLine(p);
        }
        for (int i = 0; i < 3; i++)
        {
            L(10);
            L(i);
        }
    }
}", expectedOutput: @"10
0
10
1
10
2");
            comp.VerifyIL("C.Main()", @"
{
  // Code size       30 (0x1e)
  .maxstack  2
  .locals init (int V_0, //i
                int V_1)
  IL_0000:  ldc.i4.0
  IL_0001:  stloc.0
  IL_0002:  br.s       IL_0019
  IL_0004:  ldc.i4.s   10
  IL_0006:  stloc.1
  IL_0007:  ldloca.s   V_1
  IL_0009:  call       ""void C.<Main>g__L|0_0(in int)""
  IL_000e:  ldloca.s   V_0
  IL_0010:  call       ""void C.<Main>g__L|0_0(in int)""
  IL_0015:  ldloc.0
  IL_0016:  ldc.i4.1
  IL_0017:  add
  IL_0018:  stloc.0
  IL_0019:  ldloc.0
  IL_001a:  ldc.i4.3
  IL_001b:  blt.s      IL_0004
  IL_001d:  ret
}");
        }

        [Fact]
        public void RefReturnAssign()
        {
            var verifier = CompileAndVerify(@"
class C
{
    static void M()
    {
        ref readonly int x = ref Helper();
        int y = x + 1;
    }

    static ref readonly int Helper()
        => ref (new int[1])[0];
}");
            verifier.VerifyIL("C.M()", @"
{
  // Code size        7 (0x7)
  .maxstack  1
  IL_0000:  call       ""ref readonly int C.Helper()""
  IL_0005:  pop
  IL_0006:  ret
}");
        }

        [Fact]
        public void RefReturnAssign2()
        {
            var verifier = CompileAndVerify(@"
class C
{
    static void M()
    {
        ref readonly int x = ref Helper();
        int y = x + 1;
    }

    static ref int Helper()
        => ref (new int[1])[0];
}");
            verifier.VerifyIL("C.M()", @"
{
  // Code size        7 (0x7)
  .maxstack  1
  IL_0000:  call       ""ref int C.Helper()""
  IL_0005:  pop
  IL_0006:  ret
}");
        }

        [Fact]
        public void RefReturnArrayAccess()
        {
            var text = @"
class Program
{
    static ref readonly int M()
    {
        return ref (new int[1])[0];
    }
}
";

            var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular);

            comp.VerifyIL("Program.M()", @"
{
  // Code size       13 (0xd)
  .maxstack  2
  IL_0000:  ldc.i4.1
  IL_0001:  newarr     ""int""
  IL_0006:  ldc.i4.0
  IL_0007:  ldelema    ""int""
  IL_000c:  ret
}");
        }

        [Fact]
        public void BindingInvalidRefRoCombination()
        {
            var text = @"
class Program
{
    // should be a syntax error
    // just make sure binder is ok with this
    static ref readonly ref int M(int x)
    {
        return ref M(x);
    }

    // should be a syntax error
    // just make sure binder is ok with this
    static readonly int M1(int x)
    {
        return ref M(x);
    }
}
";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,25): error CS1031: Type expected
                //     static ref readonly ref int M(int x)
                Diagnostic(ErrorCode.ERR_TypeExpected, "ref").WithLocation(6, 25),
                // (13,25): error CS0106: The modifier 'readonly' is not valid for this item
                //     static readonly int M1(int x)
                Diagnostic(ErrorCode.ERR_BadMemberFlag, "M1").WithArguments("readonly").WithLocation(13, 25),
                // (15,20): error CS0120: An object reference is required for the non-static field, method, or property 'Program.M(int)'
                //         return ref M(x);
                Diagnostic(ErrorCode.ERR_ObjectRequired, "M").WithArguments("Program.M(int)").WithLocation(15, 20),
                // (15,9): error CS8149: By-reference returns may only be used in methods that return by reference
                //         return ref M(x);
                Diagnostic(ErrorCode.ERR_MustNotHaveRefReturn, "return").WithLocation(15, 9)
            );
        }

        [Fact]
        public void ReadonlyReturnCannotAssign()
        {
            var text = @"
class Program
{
    static void Test()
    {
        M() = 1;
        M1().Alice = 2;

        M() ++;
        M1().Alice --;

        M() += 1;
        M1().Alice -= 2;
    }

    static ref readonly int M() => throw null;
    static ref readonly (int Alice, int Bob) M1() => throw null;
}
";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
                //         M() = 1;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 9),
                // (7,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
                //         M1().Alice = 2;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(7, 9),
                // (9,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
                //         M() ++;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(9, 9),
                // (10,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
                //         M1().Alice --;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(10, 9),
                // (12,9): error CS8331: Cannot assign to method 'Program.M()' because it is a readonly variable
                //         M() += 1;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 9),
                // (13,9): error CS8332: Cannot assign to a member of method 'Program.M1()' because it is a readonly variable
                //         M1().Alice -= 2;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(13, 9)
            );
        }

        [Fact]
        public void ReadonlyReturnCannotAssign1()
        {
            var text = @"
class Program
{
    static void Test()
    {
        P = 1;
        P1.Alice = 2;

        P ++;
        P1.Alice --;

        P += 1;
        P1.Alice -= 2;
    }

    static ref readonly int P => throw null;
    static ref readonly (int Alice, int Bob) P1 => throw null;
}
";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
                //         P = 1;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(6, 9),
                // (7,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
                //         P1.Alice = 2;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(7, 9),
                // (9,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
                //         P ++;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(9, 9),
                // (10,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
                //         P1.Alice --;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(10, 9),
                // (12,9): error CS8331: Cannot assign to property 'Program.P' because it is a readonly variable
                //         P += 1;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(12, 9),
                // (13,9): error CS8332: Cannot assign to a member of property 'Program.P1' because it is a readonly variable
                //         P1.Alice -= 2;
                Diagnostic(ErrorCode.ERR_AssignReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(13, 9)
            );
        }

        [Fact]
        public void ReadonlyReturnCannotAssignByref()
        {
            var text = @"
class Program
{
    static void Test()
    {
        ref var y = ref M();
        ref int a = ref M1.Alice;
        ref var y1 = ref P;
        ref int a1 = ref P1.Alice;
    }

    static ref readonly int M() => throw null;
    static ref readonly (int Alice, int Bob) M1() => throw null;
    static ref readonly int P => throw null;
    static ref readonly (int Alice, int Bob) P1 => throw null;
}
";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,25): error CS8329: Cannot use method 'Program.M()' as a ref or out value because it is a readonly variable
                //         ref var y = ref M();
                Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(6, 25),
                // (7,25): error CS0119: 'Program.M1()' is a method, which is not valid in the given context
                //         ref int a = ref M1.Alice;
                Diagnostic(ErrorCode.ERR_BadSKunknown, "M1").WithArguments("Program.M1()", "method").WithLocation(7, 25),
                // (8,26): error CS8329: Cannot use property 'Program.P' as a ref or out value because it is a readonly variable
                //         ref var y1 = ref P;
                Diagnostic(ErrorCode.ERR_RefReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(8, 26),
                // (9,26): error CS8330: Members of property 'Program.P1' cannot be used as a ref or out value because it is a readonly variable
                //         ref int a1 = ref P1.Alice;
                Diagnostic(ErrorCode.ERR_RefReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(9, 26)
            );
        }

        [Fact]
        public void ReadonlyReturnCannotTakePtr()
        {
            var text = @"
class Program
{
    unsafe static void Test()
    {
        int* a = & M();
        int* b = & M1().Alice;

        int* a1 = & P;
        int* b2 = & P1.Alice;

        fixed(int* c = & M())
        {
        }

        fixed(int* d = & M1().Alice)
        {
        }

        fixed(int* c = & P)
        {
        }

        fixed(int* d = & P1.Alice)
        {
        }
    }

    static ref readonly int M() => throw null;
    static ref readonly (int Alice, int Bob) M1() => throw null;
    static ref readonly int P => throw null;
    static ref readonly (int Alice, int Bob) P1 => throw null;

}
";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, options: TestOptions.UnsafeReleaseDll);
            comp.VerifyDiagnostics(
                // (6,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
                //         int* a = & M();
                Diagnostic(ErrorCode.ERR_FixedNeeded, "& M()").WithLocation(6, 18),
                // (7,18): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
                //         int* b = & M1().Alice;
                Diagnostic(ErrorCode.ERR_FixedNeeded, "& M1().Alice").WithLocation(7, 18),
                // (9,19): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
                //         int* a1 = & P;
                Diagnostic(ErrorCode.ERR_FixedNeeded, "& P").WithLocation(9, 19),
                // (10,19): error CS0212: You can only take the address of an unfixed expression inside of a fixed statement initializer
                //         int* b2 = & P1.Alice;
                Diagnostic(ErrorCode.ERR_FixedNeeded, "& P1.Alice").WithLocation(10, 19)
            );
        }

        [Fact]
        public void ReadonlyReturnCannotReturnByOrdinaryRef()
        {
            var text = @"
class Program
{
    static ref int Test()
    {
        bool b = true;

        if (b)
        {
            if (b)
            {
                return ref M();
            }
            else
            {
                return ref M1().Alice;
            }
        }
        else
        {
            if (b)
            {
                return ref P;
            }
            else
            {
                return ref P1.Alice;
            }
        }
    }

    static ref readonly int M() => throw null;
    static ref readonly (int Alice, int Bob) M1() => throw null;
    static ref readonly int P => throw null;
    static ref readonly (int Alice, int Bob) P1 => throw null;
}
";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (12,28): error CS8333: Cannot return method 'Program.M()' by writable reference because it is a readonly variable
                //                 return ref M();
                Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField, "M()").WithArguments("method", "Program.M()").WithLocation(12, 28),
                // (16,28): error CS8334: Members of method 'Program.M1()' cannot be returned by writable reference because it is a readonly variable
                //                 return ref M1().Alice;
                Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField2, "M1().Alice").WithArguments("method", "Program.M1()").WithLocation(16, 28),
                // (23,28): error CS8333: Cannot return property 'Program.P' by writable reference because it is a readonly variable
                //                 return ref P;
                Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField, "P").WithArguments("property", "Program.P").WithLocation(23, 28),
                // (27,28): error CS8334: Members of property 'Program.P1' cannot be returned by writable reference because it is a readonly variable
                //                 return ref P1.Alice;
                Diagnostic(ErrorCode.ERR_RefReturnReadonlyNotField2, "P1.Alice").WithArguments("property", "Program.P1").WithLocation(27, 28)
            );
        }

        [Fact]
        public void ReadonlyReturnCanReturnByRefReadonly()
        {
            var text = @"
class Program
{
    static ref readonly int Test()
    {
        bool b = true;

        if (b)
        {
            if (b)
            {
                return ref M();
            }
            else
            {
                return ref M1().Alice;
            }
        }
        else
        {
            if (b)
            {
                return ref P;
            }
            else
            {
                return ref P1.Alice;
            }
        }
    }

    static ref readonly int M() => throw null;
    static ref readonly (int Alice, int Bob) M1() => throw null;
    static ref readonly int P => throw null;
    static ref readonly (int Alice, int Bob) P1 => throw null;
}

";

            var comp = CompileAndVerifyWithMscorlib40(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular, verify: Verification.Passes);

            comp.VerifyIL("Program.Test", @"
{
  // Code size       45 (0x2d)
  .maxstack  1
  .locals init (bool V_0) //b
  IL_0000:  ldc.i4.1
  IL_0001:  stloc.0
  IL_0002:  ldloc.0
  IL_0003:  brfalse.s  IL_0019
  IL_0005:  ldloc.0
  IL_0006:  brfalse.s  IL_000e
  IL_0008:  call       ""ref readonly int Program.M()""
  IL_000d:  ret
  IL_000e:  call       ""ref readonly System.ValueTuple<int, int> Program.M1()""
  IL_0013:  ldflda     ""int System.ValueTuple<int, int>.Item1""
  IL_0018:  ret
  IL_0019:  ldloc.0
  IL_001a:  brfalse.s  IL_0022
  IL_001c:  call       ""ref readonly int Program.P.get""
  IL_0021:  ret
  IL_0022:  call       ""ref readonly System.ValueTuple<int, int> Program.P1.get""
  IL_0027:  ldflda     ""int System.ValueTuple<int, int>.Item1""
  IL_002c:  ret
}");
        }

        [Fact]
        [CompilerTrait(CompilerFeature.PEVerifyCompat)]
        public void ReadonlyFieldCanReturnByRefReadonly()
        {
            var text = @"
class Program
{
    ref readonly int Test()
    {
        bool b = true;

        if (b)
        {
            if (b)
            {
                return ref F;
            }
            else
            {
                return ref F1.Alice;
            }
        }
        else
        {
            if (b)
            {
                return ref S1.F;
            }
            else
            {
                return ref S2.F1.Alice;
            }
        }
    }

    readonly int F = 1;
    static readonly (int Alice, int Bob) F1 = (2,3);

    readonly S S1 = new S();
    static readonly S S2 = new S();

    struct S
    {
        public readonly int F;
        public readonly (int Alice, int Bob) F1;
    }
}

";

            var comp = CompileAndVerifyWithMscorlib40(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular, verify: Verification.Fails);

            comp.VerifyIL("Program.Test", @"
{
  // Code size       57 (0x39)
  .maxstack  1
  .locals init (bool V_0) //b
  IL_0000:  ldc.i4.1
  IL_0001:  stloc.0
  IL_0002:  ldloc.0
  IL_0003:  brfalse.s  IL_001a
  IL_0005:  ldloc.0
  IL_0006:  brfalse.s  IL_000f
  IL_0008:  ldarg.0
  IL_0009:  ldflda     ""int Program.F""
  IL_000e:  ret
  IL_000f:  ldsflda    ""System.ValueTuple<int, int> Program.F1""
  IL_0014:  ldflda     ""int System.ValueTuple<int, int>.Item1""
  IL_0019:  ret
  IL_001a:  ldloc.0
  IL_001b:  brfalse.s  IL_0029
  IL_001d:  ldarg.0
  IL_001e:  ldflda     ""Program.S Program.S1""
  IL_0023:  ldflda     ""int Program.S.F""
  IL_0028:  ret
  IL_0029:  ldsflda    ""Program.S Program.S2""
  IL_002e:  ldflda     ""System.ValueTuple<int, int> Program.S.F1""
  IL_0033:  ldflda     ""int System.ValueTuple<int, int>.Item1""
  IL_0038:  ret
}");

            // WithPEVerifyCompatFeature should not cause us to get a ref of a temp in ref returns
            comp = CompileAndVerify(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef }, parseOptions: TestOptions.Regular.WithPEVerifyCompatFeature(), verify: Verification.Fails, targetFramework: TargetFramework.Mscorlib40);
            comp.VerifyIL("Program.Test", @"
{
  // Code size       57 (0x39)
  .maxstack  1
  .locals init (bool V_0) //b
  IL_0000:  ldc.i4.1
  IL_0001:  stloc.0
  IL_0002:  ldloc.0
  IL_0003:  brfalse.s  IL_001a
  IL_0005:  ldloc.0
  IL_0006:  brfalse.s  IL_000f
  IL_0008:  ldarg.0
  IL_0009:  ldflda     ""int Program.F""
  IL_000e:  ret
  IL_000f:  ldsflda    ""System.ValueTuple<int, int> Program.F1""
  IL_0014:  ldflda     ""int System.ValueTuple<int, int>.Item1""
  IL_0019:  ret
  IL_001a:  ldloc.0
  IL_001b:  brfalse.s  IL_0029
  IL_001d:  ldarg.0
  IL_001e:  ldflda     ""Program.S Program.S1""
  IL_0023:  ldflda     ""int Program.S.F""
  IL_0028:  ret
  IL_0029:  ldsflda    ""Program.S Program.S2""
  IL_002e:  ldflda     ""System.ValueTuple<int, int> Program.S.F1""
  IL_0033:  ldflda     ""int System.ValueTuple<int, int>.Item1""
  IL_0038:  ret
}");
        }

        [Fact]
        public void ReadonlyReturnByRefReadonlyLocalSafety()
        {
            var text = @"
class Program
{
    ref readonly int Test()
    {
        bool b = true;
        int local = 42;

        if (b)
        {
            return ref M(ref local);
        }
        else
        {
            return ref M1(out local).Alice;
        }
    }

    static ref readonly int M(ref int x) => throw null;
    static ref readonly (int Alice, int Bob) M1(out int x) => throw null;
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (11,30): error CS8168: Cannot return local 'local' by reference because it is not a ref local
                //             return ref M(ref local);
                Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(11, 30),
                // (11,24): error CS8347: Cannot use a result of 'Program.M(ref int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
                //             return ref M(ref local);
                Diagnostic(ErrorCode.ERR_EscapeCall, "M(ref local)").WithArguments("Program.M(ref int)", "x").WithLocation(11, 24),
                // (15,31): error CS8168: Cannot return local 'local' by reference because it is not a ref local
                //             return ref M1(out local).Alice;
                Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(15, 31),
                // (15,24): error CS8348: Cannot use a member of result of 'Program.M1(out int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
                //             return ref M1(out local).Alice;
                Diagnostic(ErrorCode.ERR_EscapeCall2, "M1(out local)").WithArguments("Program.M1(out int)", "x").WithLocation(15, 24)
            );
        }

        [Fact]
        public void ReadonlyReturnByRefReadonlyLocalSafety1()
        {
            var text = @"
class Program
{
    ref readonly int Test()
    {
        int local = 42;

        return ref this[local];
    }

    ref readonly int this[in int x] => ref x;
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (8,25): error CS8168: Cannot return local 'local' by reference because it is not a ref local
                //         return ref this[local];
                Diagnostic(ErrorCode.ERR_RefReturnLocal, "local").WithArguments("local").WithLocation(8, 25),
                // (8,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
                //         return ref this[local];
                Diagnostic(ErrorCode.ERR_EscapeCall, "this[local]").WithArguments("Program.this[in int]", "x").WithLocation(8, 20)
            );
        }

        [Fact]
        public void ReadonlyReturnByRefReadonlyLiteralSafety1()
        {
            var text = @"
class Program
{
    ref readonly int Test()
    {
        return ref this[42];
    }

    ref readonly int this[in int x] => ref x;
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,25): error CS8156: An expression cannot be used in this context because it may not be returned by reference
                //         return ref this[42];
                Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 25),
                // (6,20): error CS8521: Cannot use a result of 'Program.this[in int]' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
                //         return ref this[42];
                Diagnostic(ErrorCode.ERR_EscapeCall, "this[42]").WithArguments("Program.this[in int]", "x").WithLocation(6, 20)
            );
        }

        [WorkItem(19930, "https://github.com/dotnet/roslyn/issues/19930")]
        [Fact]
        public void ReadonlyReturnByRefInStruct()
        {
            var text = @"
struct S1
{
    readonly int x;

    ref readonly S1 Test()
    {
        return ref this;
    }

    ref readonly int this[in int i] => ref x;
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (8,20): error CS8170: Struct members cannot return 'this' or other instance members by reference
                //         return ref this;
                Diagnostic(ErrorCode.ERR_RefReturnStructThis, "this").WithArguments("this").WithLocation(8, 20),
                // (11,44): error CS8170: Struct members cannot return 'this' or other instance members by reference
                //     in int this[in int i] => ref x;
                Diagnostic(ErrorCode.ERR_RefReturnStructThis, "x").WithArguments("this").WithLocation(11, 44)
            );
        }

        [WorkItem(19930, "https://github.com/dotnet/roslyn/issues/19930")]
        [Fact]
        public void ReadonlyReturnByRefRValue()
        {
            var text = @"
struct S1
{
    ref readonly int Test()
    {
        return ref 42;
    }
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,20): error CS8156: An expression cannot be used in this context because it may not be returned by reference
                //         return ref 42;
                Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 20)
            );
        }

        [Fact]
        public void ReadonlyReturnByRefReadonlyLiteralSafety2()
        {
            var text = @"
class Program
{
    ref readonly int Test()
    {
        return ref M(42);
    }

    ref readonly int M(in int x) => ref x;
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
                //         return ref M(42);
                Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "42").WithLocation(6, 22),
                // (6,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
                //         return ref M(42);
                Diagnostic(ErrorCode.ERR_EscapeCall, "M(42)").WithArguments("Program.M(in int)", "x").WithLocation(6, 20)
            );
        }

        [Fact]
        public void ReadonlyReturnByRefReadonlyOptSafety()
        {
            var text = @"
class Program
{
    ref readonly int Test()
    {
        return ref M();
    }

    ref readonly int M(in int x = 42) => ref x;
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (6,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
                //         return ref M();
                Diagnostic(ErrorCode.ERR_EscapeCall, "M()").WithArguments("Program.M(in int)", "x").WithLocation(6, 20)
            );
        }

        [Fact]
        public void ReadonlyReturnByRefReadonlyConvSafety()
        {
            var text = @"
class Program
{
    ref readonly int Test()
    {
        byte b = 42;
        return ref M(b);
    }

    ref readonly int M(in int x) => ref x;
}

";

            var comp = CreateCompilationWithMscorlib45(text, new[] { ValueTupleRef, SystemRuntimeFacadeRef });
            comp.VerifyDiagnostics(
                // (7,22): error CS8156: An expression cannot be used in this context because it may not be returned by reference
                //         return ref M(b);
                Diagnostic(ErrorCode.ERR_RefReturnLvalueExpected, "b").WithLocation(7, 22),
                // (7,20): error CS8521: Cannot use a result of 'Program.M(in int)' in this context because it may expose variables referenced by parameter 'x' outside of their declaration scope
                //         return ref M(b);
                Diagnostic(ErrorCode.ERR_EscapeCall, "M(b)").WithArguments("Program.M(in int)", "x").WithLocation(7, 20)
            );
        }

        [Fact]
        public void RefReturnThrow()
        {
            var text = @"
class Program
{
    static ref readonly int M1() => throw null;
    static ref int M2() => throw null;
}
";

            var comp = CompileAndVerify(text, parseOptions: TestOptions.Regular);

            comp.VerifyIL("Program.M1()", @"
{
  // Code size        2 (0x2)
  .maxstack  1
  IL_0000:  ldnull
  IL_0001:  throw
}");

            comp.VerifyIL("Program.M2()", @"
{
  // Code size        2 (0x2)
  .maxstack  1
  IL_0000:  ldnull
  IL_0001:  throw
}");
        }

        [Fact]
        public void RefExtensionMethod_PassThrough_LocalNoCopying()
        {
            CompileAndVerify(@"
public static class Ext
{
    public static ref int M(ref this int p) => ref p;
}
class Test
{
    void M()
    {
        int x = 5;
        x.M();
    }
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
  // Code size       11 (0xb)
  .maxstack  1
  .locals init (int V_0) //x
  IL_0000:  ldc.i4.5
  IL_0001:  stloc.0
  IL_0002:  ldloca.s   V_0
  IL_0004:  call       ""ref int Ext.M(ref int)""
  IL_0009:  pop
  IL_000a:  ret
}");
        }

        [Fact]
        public void RefExtensionMethod_PassThrough_FieldNoCopying()
        {
            CompileAndVerify(@"
public static class Ext
{
    public static ref int M(ref this int p) => ref p;
}
class Test
{
    private int x = 5;
    void M()
    {
        x.M();
    }
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
  // Code size       13 (0xd)
  .maxstack  1
  IL_0000:  ldarg.0
  IL_0001:  ldflda     ""int Test.x""
  IL_0006:  call       ""ref int Ext.M(ref int)""
  IL_000b:  pop
  IL_000c:  ret
}");
        }

        [Fact]
        public void RefExtensionMethod_PassThrough_ChainNoCopying()
        {
            CompileAndVerify(@"
public static class Ext
{
    public static ref int M(ref this int p) => ref p;
}
class Test
{
    private int x = 5;
    void M()
    {
        x.M().M().M();
    }
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
  // Code size       23 (0x17)
  .maxstack  1
  IL_0000:  ldarg.0
  IL_0001:  ldflda     ""int Test.x""
  IL_0006:  call       ""ref int Ext.M(ref int)""
  IL_000b:  call       ""ref int Ext.M(ref int)""
  IL_0010:  call       ""ref int Ext.M(ref int)""
  IL_0015:  pop
  IL_0016:  ret
}");
        }

        [Fact]
        public void RefReadOnlyExtensionMethod_PassThrough_TempCopying()
        {
            CompileAndVerify(@"
public static class Ext
{
    public static ref readonly int M(in this int p) => ref p;
}
class Test
{
    void M()
    {
        5.M();
    }
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
  // Code size       11 (0xb)
  .maxstack  1
  .locals init (int V_0)
  IL_0000:  ldc.i4.5
  IL_0001:  stloc.0
  IL_0002:  ldloca.s   V_0
  IL_0004:  call       ""ref readonly int Ext.M(in int)""
  IL_0009:  pop
  IL_000a:  ret
}");
        }

        [Fact]
        public void RefReadOnlyExtensionMethod_PassThrough_LocalNoCopying()
        {
            CompileAndVerify(@"
public static class Ext
{
    public static ref readonly int M(in this int p) => ref p;
}
class Test
{
    void M()
    {
        int x = 5;
        x.M();
    }
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
  // Code size       11 (0xb)
  .maxstack  1
  .locals init (int V_0) //x
  IL_0000:  ldc.i4.5
  IL_0001:  stloc.0
  IL_0002:  ldloca.s   V_0
  IL_0004:  call       ""ref readonly int Ext.M(in int)""
  IL_0009:  pop
  IL_000a:  ret
}");
        }

        [Fact]
        public void RefReadOnlyExtensionMethod_PassThrough_FieldNoCopying()
        {
            CompileAndVerify(@"
public static class Ext
{
    public static ref readonly int M(in this int p) => ref p;
}
class Test
{
    private int x = 5;
    void M()
    {
        x.M();
    }
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
  // Code size       13 (0xd)
  .maxstack  1
  IL_0000:  ldarg.0
  IL_0001:  ldflda     ""int Test.x""
  IL_0006:  call       ""ref readonly int Ext.M(in int)""
  IL_000b:  pop
  IL_000c:  ret
}");
        }

        [Fact]
        public void RefReadOnlyExtensionMethod_PassThrough_ChainNoCopying()
        {
            CompileAndVerify(@"
public static class Ext
{
    public static ref readonly int M(in this int p) => ref p;
}
class Test
{
    private int x = 5;
    void M()
    {
        x.M().M().M();
    }
}", verify: Verification.Fails).VerifyIL("Test.M", @"
{
  // Code size       23 (0x17)
  .maxstack  1
  IL_0000:  ldarg.0
  IL_0001:  ldflda     ""int Test.x""
  IL_0006:  call       ""ref readonly int Ext.M(in int)""
  IL_000b:  call       ""ref readonly int Ext.M(in int)""
  IL_0010:  call       ""ref readonly int Ext.M(in int)""
  IL_0015:  pop
  IL_0016:  ret
}");
        }

        [Fact]
        public void RefReadOnlyReturnOptionalValue()
        {
            CompileAndVerify(@"
class Program
{
    static ref readonly string M(in string s = ""optional"") => ref s;

    static void Main()
    {
        System.Console.Write(M());
        System.Console.Write(""-"");
        System.Console.Write(M(""provided""));
    }
}", verify: Verification.Fails, expectedOutput: "optional-provided");
        }
    }
}

redpajama_set_name: RedPajamaGithub


text:
Quiznos To Renegotiate Franchisee Leases
…Quiznos has negotiated more than 40 leases thus far, with an average reduction of 15-20 percent in lease payments. The store leases in consideration include leases that are expired as well as those that have high rent given current property values. This program will be beneficial to both franchise owners and lessors, lowering the leasing cost while extending the lease.
Chain Leader
Restaurant franchisor Quiznos establishes teams to renegotiate lower lease costs, reducing largest expense for franchise owners.
PRESS RELEASE: DENVER — (BUSINESS WIRE) — Quiznos, one of the nation's premier quick service restaurant chains and pioneer of the toasted sandwich, today announced an initiative to renegotiate franchisee leases, effectively reducing the single largest expense franchise owners incur. Quiznos has established three teams to renegotiate store leases into accordance with current market values, at no cost to franchise owners.
"Even a down economy can be an opportunity and the current market for retail rent is an example of that," said Rick Schaden, Quiznos founder and CEO. "Through innovative and strategic techniques, we are working toward mitigating the impact of the economic situation and ensuring our franchise owners' success. My primary goal as CEO is for franchise owners to say in one year from now they are better off than they are today."
Since the teams have been in operation, Quiznos has negotiated more than 40 leases thus far, with an average reduction of 15-20 percent in lease payments.
The store leases in consideration include leases that are expired as well as those that have high rent given current property values. This program will be beneficial to both franchise owners and lessors, lowering the leasing cost while extending the lease.
Thomas Mihailovich, a franchise owner in Rochester Hills, MI, participated in the lease renegotiation program in late February. Quiznos and a third-party team worked with Mihailovich and his lessor to arrange a reduction in rent of more than 20 percent, a cost savings of $50,000 over the term of the lease.
"I began the process and within one week I was saving nearly $500 per month on my rent," said Mihailovich. "You really can't complain about saving that kind of money. The whole process was so simple and they answered all my questions along the way. They delivered exactly what they said they could deliver."
Schaden is focusing Quiznos' 2009 business plan around maximizing profitability for franchise owners in non-traditional ways, such as the lease renegotiation initiative.
"Rick started with Quiznos as a franchise owner before growing the Quiznos brand into what it is today," said Greg Brenneman, executive chairman for Quiznos. "He knows what it takes to make franchisees profitable and personally understands those costs that affect the bottom line."
About Quiznos
Celebrating its 27th anniversary, Denver-based Quiznos is a national chain designed for today's busy consumers who are looking for a tasty, freshly prepared alternative to traditional fast food restaurants. Using only premium quality ingredients, Quiznos restaurants offer creative, chef-inspired recipes for sandwiches, soups and salads. With more than 5,000 franchise restaurants, Quiznos is one of the fastest growing quick service restaurant chains. In December, the Quiznos management team was named the "Best New Class" by QSR Magazine.
In October 2007, Quiznos was recognized for leading the QSR industry in wait time performance by the Mystery Shopping Providers Association's (MSPA) 2007 Wait Time Study. In May 2007, Zagat's consumer surveys listed Quiznos in the top 5 for Top Food, Top Facilities, Top Service and Top Overall, ahead of its direct competitors. In June 2006, Nation's Restaurant News ranked Quiznos in its Top 100 Restaurant Chains as the #1 restaurant chain in growth in number of units—five years in a row. Entrepreneur magazine in January, 2006 ranked Quiznos in its annual Top Franchise 500 as the #2 Best Overall Franchise and QSR magazine ranked the chain in its Top 50 Chains in August, 2005 as #3 by change in system-wide sales.
For further information, please visit www.quiznos.com
http://www.chainleader.com/article/CA6644681.html?nid=3965
Risks: Eviction cheaper and faster than termination, Franchisee gets cents, franchisor many $, Franchisor was once a franchisee, Head lease advantage, Infamous trademark system, Landlord accepts much less now or franchisor pushes franchisee and he gets 0%, Lease controlled by franchisor, Lease margins are an important source of franchisor revenue, Shills, Sincerity, Sticking the knife in 6 inches and pulling it out 2 is not much help, System is collapsing, Why franchisors sublease to franchisees, United States, 20090317 Quiznos to

redpajama_set_name: RedPajamaCommonCrawl


text:
Unsuccessful Tu-141 attack on a Russian base of nuclear bombers
By Boyko Nikolov On Dec 26, 2022
MOSCOW ($1=68.37 Russian Rubles) — The Russian Defense Ministry says that on the morning of December 26th, air defenses at the Engels air base shot down a Ukrainian drone. According to the press release, the target was the base itself and the Russian nuclear bombers that had landed there. BulgarianMilitary.com recalls that the Engels base is home to Russian T-95 and Tu-160 bombers, which can carry nuclear weapons.
Photo credit: Twitter
24/7 BulgarianMilitary.com – all you need to know about Ukrainian – Russian war
According to sources, three Russian servicemen have died as a result of falling debris from the Ukrainian drone. The governor of the Saratov region, Roman Busargin, confirmed the death of the three Russian soldiers.
Ukraine denies the attack. Kyiv has never openly claimed responsibility for attacks in Russia but calls them "karma" for Russia's invasion. Some social media accounts claim that there is a destroyed bomber, but these claims remain unproven.
According to some analysts, the drone that was shot down near the Russian Engels air base was a Tu-141 model – the same one that carried out the first attack on December 5 at the same base.
About Tu-141
Tu-143, Photo credit: Wikimag
Tu-141 is a reconnaissance drone. Its first flight was in 1974 and it entered service in 1979. The reconnaissance drone is equipped with cameras for video surveillance and photography. There is no exact information on what exactly this equipment was, but it is assumed that in the 1970s it was most likely equipped with old filmstrips or some other type of infrared camera.
The drone was designed to penetrate deep into the enemy's airspace, carry out its reconnaissance activity and return to land on a specially selected runway after deploying its parachute, which would drastically reduce the speed of wintering. The range, according to some military experts, of this drone was just under 1,000 km or 620 miles.
On 21 February 2022, the Russian government claimed that Ukrainian shelling had destroyed an FSB border facility on the Russia Ukraine border, and claimed that it had killed 5 Ukrainian soldiers who tried to cross into Russian territory. Ukraine denied being involved in both incidents and called them a false flag.
On the same day, the Russian government formally recognized the self-proclaimed DPR and LPR as independent states, according to Putin not only in their de-facto controlled areas, but the Ukrainian regions as a whole, and Putin ordered Russian troops, including tanks, to enter the regions.
Tu-141, Photo credit: mil.in.ua
On 24 February 2022, Russian President Vladimir Putin ordered an invasion of Ukraine by Russian Armed Forces previously concentrated along the border. The invasion followed by targeted airstrikes of military buildings in the country, as well as tanks entering via the Belarus border.
Russia has so far not recognized the invasion of Ukraine as a "war", although that is exactly what it is, claiming that it is a "special military operation". According to the UN, in which Russia has its permanent representation, for military action to be defined as a "special military operation", it must have a resolution issued by the UN. There is no such resolution, which automatically defines the military actions of the Russians as an invasion and war against the citizens of Ukraine.
Follow us everywhere and at any time. BulgarianMilitary.com has responsive design and you can open the page from any computer, mobile devices or web browsers. For more up-to-date news, follow our Google News, YouTube, Reddit, LinkedIn, Twitter and Facebook pages. Subscribe to our Newsletter and read our stories in News360App in AppStore or GooglePlay or in FeedlyApp in AppStore or GooglePlay. Our standards: Manifesto & ethical princliples.


text:
Q: How to instantiate Microsoft GraphClient with signed-in user's AccessToken? My Startup.Auth.cs looks like this:
public partial class Startup
{
    private static string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
    private static string appKey = ConfigurationManager.AppSettings["ida:ClientSecret"];
    private static string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];
    private static string tenantId = ConfigurationManager.AppSettings["ida:TenantId"];
    private static string postLogoutRedirectUri = ConfigurationManager.AppSettings["ida:PostLogoutRedirectUri"];

    public static readonly string Authority = aadInstance + tenantId;

    // This is the resource ID of the AAD Graph API.  We'll need this to request a token to call the Graph API.
    string graphResourceId = "https://graph.microsoft.com";

    public void ConfigureAuth(IAppBuilder app)
    {
        ApplicationDbContext db = new ApplicationDbContext();

        app.SetDefaultSignInAsAuthenticationType(CookieAuthenticationDefaults.AuthenticationType);

        app.UseCookieAuthentication(new CookieAuthenticationOptions());

        app.UseOpenIdConnectAuthentication(
            new OpenIdConnectAuthenticationOptions
            {
                ClientId = clientId,
                Authority = Authority,
                PostLogoutRedirectUri = postLogoutRedirectUri,

                Notifications = new OpenIdConnectAuthenticationNotifications()
                {
                    // If there is a code in the OpenID Connect response, redeem it for an access token and refresh token, and store those away.
                   AuthorizationCodeReceived = (context) =>
                   {
                       var code = context.Code;
                       ClientCredential credential = new ClientCredential(clientId, appKey);
                       string signedInUserID = context.AuthenticationTicket.Identity.FindFirst(ClaimTypes.NameIdentifier).Value;

                       TokenCache userTokenCache = new ADALTokenCache(signedInUserID);

                       AuthenticationContext authContext = new AuthenticationContext(Authority, userTokenCache);
                       AuthenticationResult result = authContext.AcquireTokenByAuthorizationCode(
                       code, new Uri(HttpContext.Current.Request.Url.GetLeftPart(UriPartial.Path)), credential, graphResourceId);

                       string token = result.AccessToken;

                       return Task.FromResult(0);
                   }
                }
            });
    }
}

The second-to-last line of code above (the string variable "token") correctly contains the currently signed-in user's AccessToken. Later, my web application project attempts to instantiate a Microsoft GraphClient object, like so:
GraphServiceClient graphClient = new GraphServiceClient(new AuthenticationController());

When the above code is called, then a new AuthenticationController is created, like so:
public class AuthenticationController : IAuthenticationProvider
{
    private string clientId = ConfigurationManager.AppSettings["ida:ClientId"];
    private string appKey = ConfigurationManager.AppSettings["ida:ClientSecret"];
    private string aadInstance = ConfigurationManager.AppSettings["ida:AADInstance"];

    public async Task AuthenticateRequestAsync(HttpRequestMessage request)
    {

        string signedInUserID = ClaimsPrincipal.Current.FindFirst(ClaimTypes.NameIdentifier).Value;
        string tenantID = ClaimsPrincipal.Current.FindFirst("http://schemas.microsoft.com/identity/claims/tenantid").Value;

        // get a token for the Graph without triggering any user interaction (from the cache, via multi-resource refresh token, etc)
        ClientCredential creds = new ClientCredential(clientId, appKey);

        TokenCache tokenCache = new ADALTokenCache(signedInUserID);
        // initialize AuthenticationContext with the token cache of the currently signed in user, as kept in the app's database
        AuthenticationContext authenticationContext = new AuthenticationContext(aadInstance + tenantID, tokenCache);
        AuthenticationResult authResult = await authenticationContext.AcquireTokenAsync("https://graph.microsoft.com/", creds);

        request.Headers.Add("Authorization", "Bearer " + authResult.AccessToken);
    }
}

My issue is that the AuthenticationController code above retrieves the AccessToken associated with the web application, not the currently signed-in user. I need to instantiate a GraphClient with the AccessToken of the currently signed-in user instead of the web application. Specifically, I would like the variable authResult.AccessToken in last line of code to contain the AccessToken of the currently signed-in user. Is there any way that I can securely save the currently signed-in user's token cache in Startup.Auth.cs and then later retrieve it the AuthenticationController class?

A: If you already have a token, you call tell GraphServiceClient to simply use that token rather than attempting to fetch one all over again. This is done using the DelegateAuthenticationProvider class:
var graphserviceClient = new GraphServiceClient(
    new DelegateAuthenticationProvider(
        (requestMessage) =>
        {
            requestMessage.Headers.Authorization = new AuthenticationHeaderValue("bearer", accessToken);

            return Task.FromResult(0);
        }));

Where you store that token depends on the type of app and your architecture. For web apps you can store it in the Session or a Cookie, for native apps in memory. Tokens are short-lived so any temporary store is generally acceptable.

redpajama_set_name: RedPajamaStackExchange


SAN FRANCISCO — The National Biodiesel Board is hosting the 2009 Biodiesel Conference and Expo in the Moscone Center West Convention Center in San Francisco, regarding acceptance and use of biodiesel. The conference theme this year will be Leading Change Now, looking to the future of energy in the United States and examining the role biodiesel will play as part of the nation's energy plan. The 2008 Conference and Expo had a record number of biodiesel marketers, feedstock growers, fuel distributors, government leaders and biodiesel users in attendance.
Again in 2009, the National Biodiesel Board is planning a rich educational program featuring presentations and discussions from the industry's most influential leaders. The conference will include an array of networking and social events in this dynamic city, along with our always popular and exciting Expo with more than 400 booths showcasing the latest in biodiesel products and services.
For more information about this event, please visit: www.biodieselconference.org.


Our classic Christmas centerpiece could be one of yours! Beautifully arranged using fresh, crisp blooms in the signature colors of the season—white lilies, red roses and more—our original display is accented with a fragrant mix of evergreens and pinecones. And for a finishing touch, our florists add a red taper candle, creating a warm and festive glow for all your celebrations!


I need help in driving high-quality local targeted audience to my client's website. We are looking to rank on first page of Google in Weston, Florida, USA (and s...Florida Hollywood, Florida Please provide a quote to do off page SEO and link building as well as checking to make sure all those are optimized in our on page seo. We use a wordpress site.
Home page... 1. the whole site should be black wtih the gold accents as you have now. 2. Upload button should be on top corner right like y...admin area at [login to view URL] and login details are audiofrica and audiofrica$2015# is the password. this is the admin area for us the owners so its simiar to wordpress. Anything else I will send.
I've had a website designed over a year ago for my small company. I current...website designed over a year ago for my small company. I currently try to update it change things etc but I am pressed for time to keep researching the different apps etc on wordpress. Initially I would like someone to edit it but with the option of continuing maintenance.


text:
Articles & Case Studies by Industry
Master Class Replay: Advice on Ecosystem Development & Co-Creation
Andy Michuda of Sopheon, Shannon Lucas of Ericsson, and Michael Britt of Southern company explore best practices for ecosystem development. Other topics of discussion included: the benefits of co-creation, challenges when co-creating at a large organization, and building successful start-up relationships.
Inside Baker Hughes' Energy Innovation Center in Oklahoma City
Four years ago, Baker Hughes opened up its Oil & Gas Technology Center in Oklahoma City— a place they call the "Silicon Valley of the Shale Revolution." This July, the company reinvented the facility, unveiling the Energy Innovation Center (EIC).
GE VP: 'The Way We Sold in the Past Isn't Going to Work in the Future'
When most large companies use the word "innovation," they're talking about new products, services, technologies, or business models. Changing how they sell is often the last thing they mean. GE Vice President Cate Gutowski thinks that's a big mistake. She explains inside…
Video Lab Tour: Shell's TechWorks Innovation Lab Encourages Fast Prototyping and Feedback
Julie Ferland, General Manager of the Shell TechWorks innovation lab, offers an inside look at how the space is designed; the types of projects it works on; and the team Shell has assembled from outside the oil and gas industry.
How GE Fuse is Prototyping New Solutions, with Help from an Online Community
"The concept [of Fuse] is around sourcing different problems from GE customers and then working with an online community to solve those problems," says Amelia Gandara, the Community Leader for GE Fuse. Here's how they do it…
Creating an environment for innovators at India's $43 billion Reliance Industries
"Some organizations think that putting processes of innovation in place will ensure a culture of innovation," says Sushil Borde, VP of Innovation at Reliance. "But they don't focus on creating the environment or fostering innovative talent, and that's where they fail." We spoke with Borde to learn more about how the company is working to institutionalize innovation, the innovation programs he's helped to create, and the five tenets that guide innovation at Reliance.
How NRG Energy's portable power kiosks made it from concept to the Super Bowl
NRG Go's automated kiosks rent out fully-charged battery packs at places like nightclubs, concert venues, and shopping malls so that people can recharge their phones and tablets — without hunting for an outlet and plopping down next to it for an hour or so. Senior Manager Stacey Butler discusses how the kiosks went from concept to launch in less than 18 months.
How ExxonMobil IT started a grassroots innovation program that's changing company culture
Christopher Bailey, #innovation catalyst and IT leader at ExxonMobil, discusses the challenges of operationally-focused innovation and details how ExxonMobil has promoted innovation from the ground up through the #innovation initiative and their Grassroots Innovation Forum. Includes 30 minutes of audio.
Audio: Shell and Thales execs on setting up innovation outposts, gauging impact
Executives from Shell TechWorks and the Thales xPlor initiative joined Innovation Leader editor Scott Kirsner earlier this year to talk about what they hope to accomplish with the innovation labs they've set up in the Boston area, and how they're being measured. Here's the audio and slides.
Treating projects like startups and keeping senior leaders in the loop at Johnson Controls
New projects at the company pass through three stage-gates: pursuit, realization, and commercialization. Johnson Controls' Chief Marketing Officer and Vice President for Global Innovation explain how projects are funded, and how they work with senior leadership to make decisions about their fate.
At Shell's fast-growing TechWorks lab, it's 'all about deploying'
We talk to the director of Shell TechWorks about the lab's projects, its funding, and its mission — finding cheaper, faster, and safer ways to drill for oil and gas, and to take advantage of future energy sources.
Ten lessons from ExxonMobil on spurring operationally-focused innovation
The innovation team at ExxonMobil provides a first-ever look at their Grassroots Innovation Forum, focused on sourcing and testing operational innovations, including missteps they encountered and lessons your company might want to consider. Includes internal screenshots and presentation.
How Elon Musk builds organizations that can achieve anything
We talk to Ashlee Vance, author of a new book about Musk, about how the founder of SpaceX, Tesla, and SolarCity hires people, battles bureaucracy, and dispatches problems fast.
AECOM shares an innovation video it uses with new hires
How do you get new hires to contribute to a culture of innovation from Day One? Warwick Absolon of industrial giant AECOM shares a video the $8.2 billion company produced as part of orientation for new employees in its Australia and New Zealand division.
VC the GE way; lessons from the firm's upgraded strategy
GE chief executive Jeff Immelt called a meeting in 2012 to rethink the company's investing strategy. The result was the creation of a new GE Ventures team headquartered in Silicon Valley that builds on past experiences — and mistakes. Managing director Noah Lewis explains what changed.
Lessons from Reliant on setting goals, tracking progress
Director of Innovation Scott Burns takes us inside the annual goal-setting process at Reliant Energy, part of the $8.4 billion electricity giant NRG Energy Inc. According to Burns, setting goals is only half the equation: tracking progress is actually more critical. "Innovation teams often get a reputation for being 'free thinkers' that are in a lab trying to invent things in a vacuum and will bring these products to market eventually," he says. Details inside.
Monitoring power usage with a countertop display
Ambient Devices' Energy Joule frees information from the PC or the mobile device, and puts it in a prominent new place. Its goal is to change the way you use electricity — and potentially also your relationship with the utility that provides it.


text:
[email protected] |
LOGIN/LOGOUT |
CHANGING THE GUARD WALKING TOUR
ALONGSIDE THE QUEEN'S FOOT SOLDIER IN LONDON
Expert Local Guide
1,5 Hrs
See the pomp and circumstance of the Changing of the Guard
March in step with the Queen's foot soldiers as they walk to Buckingham Palace
Watch the inspection of the guards at St. James's Palace
Listen to a ceremonial band as it accompanies the guards
Marvel at the pageantry of the Changing of the Guard ceremony on a walking tour alongside the Queen's foot soldiers in London. March in step with the soldiers and learn the history of the guards, royals and their palaces.
Meet your guide at Piccadilly Circus and get an introduction to the background of the Changing of the Guard ceremony. Hear what you will be doing for the next 1 hour and 45 minutes. Then proceed as a group toward The Mall. Pass by Pall Mall and Waterloo Place. Here you will learn more about the British Army and its greatest general, the Duke of Wellington.
Once on The Mall, see the extraordinary monuments to royals and generals. Get a view of St. James's Park. Admire the most beautiful of the royal parks and look at the majestic open space of Horse Guards Parade. Continue toward St. James's Palace. On the way, you might see the Household Cavalry en route from their barracks in Hyde Park. The main focus, however, will be to watch the foot soldiers emerge from St. James's Palace ready for their uniform inspection. They will then march to Buckingham Palace, sometimes accompanied by a band. If you're lucky, they may even play a song!
One of the highlights of your tour will be to march in step with the guards as they leave St. James's Palace. Then watch as the New Guard emerges from Wellington Barracks. He will often be accompanied by a full ceremonial band. Take a photo of Buckingham Palace from a raised platform. The tour ends with a flourish as the band plays in the palace courtyard. Marvel as the cavalry and guardsmen march past. Your guide will then help you get to your next port of call.
English on Monday, Wednesday and Friday at 9:40am and on Sunday at 9:15am;
The meeting point is in London, outside the Criterion Theatre next to the Statue of Eros at Piccadilly Circus;
Please be sure to get there at least 15 minutes prior to tour starting time, this is very important.
Please bring comfortable shoes and a bottle of water with you. The tour can be quite fast paced at times. It is also very crowded near Buckingham Palace, particularly in summer months;
This tour is super popular, and as we limit the number of people per group to 25, it can often sell out days or weeks in advance, so book early to avoid disappointment!
Disclaimer: The British Army can alter the date of the Guard Change Ceremony, and can change or cancel it at their discretion. No matter how bad the weather, the walk will still go ahead, as the final notification of ceremony cancellation will not be made by the British Army and police until after 10.30am. Although unlikely, the ceremony has been known to proceed in the rain before! If the ceremony is cancelled, you will see the Wet Change (guards marching without music);
No refund will be accepted for no shows or late arrivals
You can present either a paper or an electronic voucher for this activity
Local operator information
Complete Operator information, including local telephone numbers at your destination, are included on your Confirmation Voucher. Our Product Managers select only the most experienced and reliable operators in each destination, removing the guesswork for you, and ensuring your peace of mind
If you cancel at least 7 day(s) in advance of the scheduled departure, there is no cancellation fee. If you cancel between 3 and 6 day(s) in advance of the scheduled departure, there is a 50 percent cancellation fee. If you cancel within 2 day(s) of the scheduled departure, there is a 100 percent cancellation fee
Schedule and Pricing
Available in English on Monday, Wednesday and Friday at 9:40am and on Sunday at 9:15am;
On Monday, Wednesday and Friday:
Adult (18-99) € 21,00
Child (0-17) € 18,00
On Sunday:
Our pricing is constantly updated to ensure you always receive the lowest price possible – we 100% guarantee it –
PLEASE, SELECT TOUR OPTION:
Changing the Guard Sundays -ENG-
€0.000 View availability (0 customer reviews)
Changing the Guard weekdays -ENG-
PLEASE, SELECT TOUR OPTION
© GetOurTour Services LTD - 1B Lambton Road - SW20 0LW LONDON - UNITED KINGDOM
About Us - Contacts - The Get Our Tour Privacy Policy - Copyright Complaint Policy


text:
Q: semantic error in code I've written a shell that has some basic features. It shall have an process list in which every executed process is listed. I write these informations in a struct called Pstatus. Pstatus will be written into a global list.
If I try to read from this list in getStatus() the Informations don't work. I get some symbols but not the informations. If I do exact the same process in the function where I write the informations into this global list, I get the right informations. I don't know whats wrong with my list.
http://pastebin.com/XGVZcSB4
Informations are written into aufruf() line 203 into the table (proctable).
In getStatus() line 311 I want to have the Information
I've got the struct
typedef struct {
int pid;        /* Prozess ID */
char* name;     /* Prozess Name (Programm) */
char* status;   /* Status des Programms */
int check;      /* bereits abgerufen? 1 - abgerufen, 0 - nicht abgerufen */
} Pstatus;

Listen:
typedef struct liste {
  void *kopf;
  struct liste *rest;
} *Liste;

listeKopf:
void* listeKopf(Liste l) {
  if(l==NULL)
    abbruch("listeKopf(listeLeer) undefiniert");
  return l->kopf;
}

listeAnfuegen:
Liste listeAnfuegen(Liste l, void* element){
  Liste neu=reserviere(sizeof (struct liste));
  neu->kopf = element;
  neu->rest = l;
  return neu;
}

Anybody able to help me?
edit!
code:
            #include <unistd.h>
            #include <stdlib.h>
            #include <stdio.h>
            #include <string.h>
            #include <unistd.h>
            #include <sys/types.h>
            #include <sys/wait.h>
            #include <fcntl.h>
            #include <errno.h>

            #include "utils.h"
            #include "listen.h"
            #include "wortspeicher.h"
            #include "kommandos.h"
            #include "frontend.h"
            #include "parser.h"
            #include "variablen.h"

            int interpretiere(Kommando k, int forkexec);
            int interpretiere_einfach(Kommando k, int forkexec);
            int getStatus();

            Liste procTable;

            void do_execvp(int argc, char **args){
              execvp(*args, args);
              perror("exec-Fehler");
              fprintf(stderr, "bei Aufruf von \"%s\"\n", *args);
              exit(1);
            }

            int interpretiere_pipeline(Kommando k){
              /* NOT IMPLEMENTED */

                int fd1[] = { -1, -1 };
                int fd2[] = { -1, -1 };
                int i = 0;
                int status = 0;
                int pid = -2;
                Liste l = k->u.sequenz.liste;
                Kommando ko;
                Pstatus pDesk;
                int laenge = k->u.sequenz.laenge;

                printf("Länge: %i!\n", laenge);

                for (i = 0; i < laenge; i++) {
                    ko = (Kommando) listeKopf(l);
                    fd2[0] = fd1[0];
                    fd2[1] = fd1[1];

                    if (i > 0) {
                        close(fd2[1]);
                    }

                    if (pipe(fd1) < 0) {
                        perror("Pipe-Fehler");
                        exit(1);
                    }
                    pid = fork();

                    switch (pid) {
                    case -1:
                        perror("Fehler bei fork");
                        return (-1);
                    case 0:
                        /*1. Prozess? Dann den Lesestrom von FD2 nicht umlegen.:*/
                        if (fd2[0] != -1) {
                            dup2(fd2[0], STDIN_FILENO);
                        }

                        /*Letzter Prozess? Dann den Schreibstrom von FD1 nicht umlegen:*/
                        if (i < laenge - 1) {
                            dup2(fd1[1], STDOUT_FILENO);
                        }
                        interpretiere_einfach(ko, 0);
                        exit(1);
                        break;
                    default:
                        /*pDesk = erzeugeProzess (pid, k->u.einfach.worte[0], "RUNNING");
                        procTable = listeAnfuegen(procTable, &pDesk); */
                        pDesk = erzeugeProzess( pid, "test", "RUNNING");
                        procTable = listeAnfuegen(procTable, &pDesk);

                        sleep(1);
                        break;
                    }
                    l = listeRest(l);
                }
                return status;
            }

            int umlenkungen(Kommando k){
                Umlenkung *u;       /* Objekt vom Typ Umlenkung (kommandos.h) */
                Modus modus;        /* Objekt vom Typ Modus (kommandos.h) */
                Liste neueListe;    /* Objekt vom Typ Liste (listen.h) */
                FILE *f;            /* File zum erstellen einer eventuellen Datei */
                /*int fd;           Filedescriptor zum Überprüfen der Datei*/
                char *pfad;         /* Pfad und Dateiname der Datei */

                /**
                typedef     struct {
                    int         filedeskriptor;  beliebige Deskriptoren können umgelenkt werden
                    Modus       modus;           Umlenkungsart
                    char *      pfad;            Datei von der / in die umgelenkt wird
                } Umlenkung;
                * */
                /*
                 *  Wenn Umlenkungen vorhanden sind, hole die Umleitungen aus der Liste
                 *  und wandle sie um in ein struct Umleitungen
                 **/
                if(k->u.einfach.umlenkungen != NULL){
                    fprintf(stdout, "Es sind Umleitungen vorhanden\n");
                    neueListe = k->u.einfach.umlenkungen;

                    u = (Umlenkung *) neueListe->kopf;
                    modus = u->modus;   /* Modi: read, write, append*/
                    pfad = u->pfad;     /* Pfad zur Datei*/

                    /* Modi definiert in kommandos.h */
                    switch(modus) {
                    case READ: /* stellt die Standarteingabe auf die angegeben Datei 'pfad'*/
                        fprintf(stdout, "Modus Read\n");
                        if(freopen(pfad, "r", stdin) == NULL){
                            fprintf(stderr, "Fehler beim Lesen der Datei. \nErrno: %d \n", errno);
                            return 1;
                        }
                        break;

                    case WRITE: /* Standartausgabe wird auf die Datei Pfad gestellt. Existiert die Datei noch nicht, wird sie erstellt. */
                        fprintf(stdout, "Modus Write\n");
                        /*fd = open(pfad, O_RDWR | O_CREAT | O_TRUNC, S_IWGRP | S_IRGRP | S_IXGRP);
                            if(fd == -1) {
                                fprintf(stdout, "Fehler beim Erstellen der Datei.\n Errno: %d", errno);
                            exit(1);
                        }*/
                        if ((f = fopen(pfad, "w+")) == NULL) {
                            fprintf(stderr, "Fehler beim Erstellen der Datei. \nErrno: %d \n", errno);
                            return 1;
                        }
                        if(freopen(pfad, "w", stdout) == NULL){
                            fprintf(stderr, "Fehler beim Erstellen der Datei. \nErrno: %d \n", errno);
                            return 1;
                        }
                        break;

                    case APPEND:
                        fprintf(stdout, "Modus Append\n");
                        /*fd = open(pfad, O_RDWR | O_CREAT | O_APPEND, S_IWGRP | S_IRGRP | S_IXGRP | S_IWUSR | S_IRUSR | S_IXUSR | S_IWOTH | S_IROTH | S_IXOTH);
                            if(fd == -1) {
                                fprintf(stdout, "Fehler beim Erstellen der Datei");
                            exit(1);
                        }*/
                        if ((f = fopen(pfad, "a+")) == NULL) {
                            fprintf(stderr, "Fehler beim Erstellen der Datei. \nErrno: %d \n", errno);
                            return 1;
                        }
                        if(freopen(pfad, "a", stdout) == NULL){
                            fprintf(stderr, "Fehler beim Erstellen der Datei. \nErrno: %d \n", errno);
                            return 1;
                        }
                        break;

                    default:
                        fprintf(stderr, "Modus default.\n No Options defined for default.\n");
                        fprintf(stdout, "Modus default nicht verfuegbar.\n");
                        break;
                    }

                }
              return 0;
            }

            int aufruf(Kommando k, int forkexec){

                Pstatus p;
                Pstatus *test;
                int kind_status, i;

              /* Programmaufruf im aktuellen Prozess (forkexec==0)
                 oder Subprozess (forkexec==1)
              */

              if(forkexec){
                int pid=fork();

                switch (pid){
                case -1:
                  perror("Fehler bei fork");
                  return(-1);
                case 0:
                  if(umlenkungen(k))
                exit(1);
                  do_execvp(k->u.einfach.wortanzahl, k->u.einfach.worte);
                  abbruch("interner Fehler 001"); /* sollte nie ausgeführt werden */
                default:
                  if(k->endeabwarten) {
                      /* So einfach geht das hier nicht! */

                      /* schreibt die PID, den Namen und den Status in die Tabelle */
                      p = erzeugeProzess (pid, k->u.einfach.worte[0], "RUNNING"); /*k->u.einfach.worte[0] */
                      /* Debug: print
                      printf("\npid: %d\tstatus: %s\n", p.pid, p.status);
                      */
                      i = listeLaenge(procTable);
                      procTable = listeAnfuegen(procTable, &p);
                      if(listeLaenge(procTable) <= i) {
                        fprintf(stderr, "Fehler beim Schreiben in die Liste!");
                      }

                      /* Debug printf: Bis hierhin wird alles ordentlich in die Liste geschrieben!
                      test = listeKopf(procTable);
                      printf("\npid: %d\tstatus: %s\n", test->pid, test->status);
                      */

                      waitpid(pid, &kind_status, 0);
                        if(WIFEXITED(kind_status)){
                            printf("Kind mit der PID %d wurde beendet\n",pid);
                        }
                        else if(WIFSIGNALED(kind_status)){
                            printf("Kind mit der PID %d wurde durch Signal abgebrochen. Signalnummer: %d\n",pid, WTERMSIG(kind_status));
                        }
                  }
                  else {
                    fprintf(stderr, "Programm nicht beendet\n");
                    fprintf(stdout, "PID: %i\n", pid);
                  }
                  return 0;
                }
              }

              /* nur exec, kein fork */
              if(umlenkungen(k))
                exit(1);
              do_execvp(k->u.einfach.wortanzahl, k->u.einfach.worte);
              abbruch("interner Fehler 001"); /* sollte nie ausgeführt werden */
              exit(1);
            }

            int interpretiere_einfach(Kommando k, int forkexec){

              char **worte = k->u.einfach.worte;
              int anzahl=k->u.einfach.wortanzahl;

              if (strcmp(worte[0], "exit")==0) {
                switch(anzahl){
                case 1:
                  exit(0);
                case 2:
                  exit(atoi(worte[1]));
                  printf("Dies ist ein test");
                default:
                  fputs( "Aufruf: exit [ ZAHL ]\n", stderr);
                  return -1;
                }
              }

              if (strcmp(worte[0], "cd")==0) {
                switch(anzahl){
                case 1:
                  return chdir(getenv("HOME"));
                case 2:
                  return chdir(worte[1]);
                default:
                  fputs("Aufruf: cd [ PFAD ]\n", stderr);
                  return -1;
                }
              }

              /* gibt den Status der Subprozesse zurück */
              if (strcmp(worte[0], "status")==0){

                  /* NYI */
                getStatus();

              }

              return aufruf(k, forkexec);
            }

            int getStatus() {

                Pstatus *p;
                Liste temp;

                fprintf(stdout, "---------------------\n----Statustabelle----\n---------------------\n");

                temp = procTable;

                printf("laenge der liste: %d\n",listeLaenge(temp));

                /*fprintf(stdout, "Pid: %d", p->pid);*/

                if(listeLaenge(temp) < 1) {
                    fprintf(stdout, "Liste ist leer.\n");
                    return 0;
                }

                while(temp != NULL){

                    /*fprintf(stdout, "%s", listeKopf(temp));  */
                    p = listeKopf(temp);

                    /*if(p->check < 1) {*/
                    fprintf(stdout,"PID: %d, Programm: %s, Status: %s\n",p->pid, p->name, p->status);
                    /*} */

                    /* wenn status != running -> p.checked() */

                    temp = listeRest(temp);
                  }
                return 0;
            }

            int interpretiere(Kommando k, int forkexec){
              int status;

              switch(k->typ){
              case K_LEER:
                return 0;
              case K_EINFACH:
                return interpretiere_einfach(k, forkexec);
              case K_SEQUENZ:
                {
                  Liste l = k->u.sequenz.liste;
                  while(!listeIstleer(l)){
                    status=interpretiere ((Kommando)listeKopf(l), forkexec);
                    l=listeRest(l);
                  }
                }
                return status;
              /*
               * Status wird auf 0 gesetzt. While Schleife arbeitet Befehle
               * ab solange der return Wert (status) 0 ist.
               * Erreicht der status den Wert ungleich 0, wird die Funktion mit
               * return 1 abgebrochen.
               **/
              case K_UND:
               {
                  Liste l = k->u.sequenz.liste;
                  status = 0;
                  while(!listeIstleer(l) && status == 0){
                    status=interpretiere ((Kommando)listeKopf(l), forkexec);
                    l=listeRest(l);
                    if(status != 0) {
                        return 1;
                    }
                  }
                   /*printf("UND noch nicht implementiert");*/
               }
               return 0;
              /*
               * Status wird auf 1 gesetzt. While Schleife arbeitet Befehle
               * ab solange der return Wert (status) nicht 0 ist.
               * Erreicht der status den Wert 0, wird die Funktion mit return 1
               * abgebrochen.
               **/
              case K_ODER:
               {
                  Liste l = k->u.sequenz.liste;
                  status = 1;
                  while(!listeIstleer(l) && status != 0){
                    status=interpretiere ((Kommando)listeKopf(l), forkexec);
                    l=listeRest(l);
                    if(status == 0) {
                        return 1;
                    }
                  }
                   /*printf("ODER noch nicht implementiert");*/
               }
               return 0;
              /*
               * UND Befehl. Noch nicht implementiert!
               * return Wert überarbeiten!
               **/
              case K_PIPE:
               {
                   /*printf("Pipeline noch nicht implementiert");*/
                   return interpretiere_pipeline(k);
               }
               return 0;
              default:
                fputs("unbekannter Kommandotyp, Bearbeitung nicht implementiert\n", stderr);
                break;
              }
              return 0;
            }

A: It seems that you are adding a local variable to your global procTable list. This happens in your interpretiere_pipeline function at line 83. pDesk is a local variable, and the C compiler puts those in the stack. When the current function returns, that memory frame will get deallocated and occupied by whatever happens to be called next.
A solution to your problem is to have pDesk allocated on the heap. This way, in your list will store and address that you know is always valid.
Hope this helps,
-Caius


text:
Talk Governance Not Caste, Religion: AAP challenges BJP in Gujarat
High pitched battle between AAP and BJP in Gujarat
|1 Sep 2022 6:22 AM GMT
Politics is a game of perception and a high pitched battle on this front is on in poll bound Gujarat. Although the formal election campaign is likely to pick up only after the festival season, with the polls likely to be conducted in December, the political battlefield has already started sounding.
Gujarat remains stronghold of the Bharatiya Janata Party with both Prime Minister Narendra Modi and Home Minister Amit Shah having their roots here, but the elections this time are going to be quite different. They will have ramifications leading to the 2024 parliamentary polls, amidst a paradigm shift taking place in terms of political goalposts.
The entry of a rookie Aam Aadmi Party continues to create ripples in the stagnant waters of the state, often described as the laboratory of Hindutva. The Congress will have some out of the box thinking to do if it wants to remain relevant in the state, where it has been out of power for almost three decades now.
The situation emerging on the ground as of now is pretty interesting with AAP having managed to rattle the BJP on the turf of perception. "One needs to understand that AAP is playing on its own pitch unlike the Congress that has been playing according to the BJP's game plan for several years now. And it is coming out hitting hard in a well calculated manner.
"AAP is taking on the BJP on the issues of governance and not the emotive issues of caste, religion and region that have been the mainstay of state politics for quite some time. This very well gets explained by the manner in which it maintained a stoic silence on the issue of release of the convicts in the infamous Bilkis Bano case," claimed an Ahmedabad based political observer.
As expected both Modi and Shah are fast moving in to take matters in their own hands and deliver the state once again to the saffron fold. "Not that the governments in the state after their departure have been anything more than puppets, but yes, they are the ones getting ready to lead the assault on their political adversaries. It is expected that Modi will be leading the attacks on the opponents while Shah will assume the role of the manager and strategist," the observer added.
Sources on the ground say another tactic the AAP has adopted is to draw in the segment of voters that have been among the floating lot, but have voted for the BJP till now, even if reluctantly. This includes categories like small traders and certain communities like Maldharis and even the de-notified tribes so called.
Sources add that AAP's media management is also effective as it continues to get ample space in newspapers and local television channels. Very often it is their leaders setting the agenda with the BJP responding. By contrast the Congress hardly gets any coverage at the local level.
"AAP has cleverly crafted a roadmap raking up issues like education, health and employment. This is drawing the common man having nothing to do with political ideology towards it. It is a sort of a semifinal that the rookie force is playing at the moment, and if it maintains the momentum, it has the potential to emerge as a strong pole in Gujarat politics ahead of the 2024 elections. The recent landslide victory in Punjab has boosted its image quite a lot," said another observer.
AAP's strong point remains the presence of activists with wide reach in its fold. For instance, Sagar Rabari is a well known name in rural Gujarat. Similarly, the roping in of well known social activist Praful Vasava earlier this week is another boost for the party. Well known for his work among Indigenous people as a leader of Kevadiya Bachao Andolan, Vasava is also leader of the National Tribal Tiger Sena.
"We are talking about the definition of development. Is it development that a good bridge has been built in Ahmedabad or it is development that there are no roads for pregnant women to reach the hospital? Even today women have to walk three kilometers with a pot on their heads to fetch water. But no government talks about the people of the backward villages of Gujarat. Schedule V of the Constitution is a provision that has never been implemented," said Vasava after joining AAP.
The BJP on the other hand has chosen to attack AAP by taking the Medha Patkar route. There have been reports of BJP leaders alleging that the social activist who is often vilified among sections of Gujarat for her role in the Narmada Bachao Andolan will be the AAP's chief ministerial face in Gujarat.
During Modi's recent visit to Kutch where he launched several public projects, it was Gujarat Chief Minister Bhupendra Patel who launched an attack on Patkar, reportedly calling her an "urban Naxal".
"On this occasion, when Narmada water has reached Kutch, we should also remember who were those people who had deprived Kutch of getting this water for nearly five decades. We all know who those urban naxals who had opposed the Narmada dam project were… One of those urban naxals was Medha Patkar. We all know which political party these people were associated with," said Patel.
Moving ahead with its campaign, AAP is set to launch a major public outreach programme through a 'Guarantee Registration Campaign' starting this week. According to state president Gopal Italia, "Kejriwal has announced various guarantees sector-wise in the past few days including electricity guarantee, guarantees to women, tribal society, businessmen, and employment guarantee to youth, education and health guarantee. Under the campaign our workers will go to every house with a form bearing the registration number, name of the person, village or ward number, mobile numbers and the assembly segment. The people will be given a guarantee card."
Meanwhile Modi during his recent visit to the state visited the BJP office in Gandhinagar and took two meetings of the state leadership taking stock of organizational matters.
The BJP is emphasizing big development in the state. It is also trying to address the hyper local issues that have pushed it to the back foot as in recent days. One of them is the poor condition of roads in the cities after the recent rains – Bhupendra Patel is learnt to have ordered the immediate restoration of roads damaged during the rains.
But it is the other raging issue of stray cattle menace that is of main concern to the BJP ahead of the polls. The Gujarat High Court recently pulled up the state government for failing to tackle the menace that is rampant across the state's eight cities with municipal corporations and the over 150 run by municipalities.
The Court has also reportedly sought details about the action taken against those accused of assaults on personnel of cattle nuisance control department and the police when they try to impound stray cattle.
These cows have caused several fatal accidents. Their 'owners' are known to leave their cattle on the roads to be fed by people who purchase fodder from roadside vendors and also offer leftover food to the cows. The Court has reportedly sought action against those selling fodder in public.
Modi, the party's top campaigner is increasing his presence in his home state attending programmes and making public appearances. Last week saw him addressing a public rally in Kutch, making an impromptu visit to the newly opened Atal Bridge on Sabarmati River, spinning a charkha and participating in a Khadi Mahotsav on the riverfront. He is expected back in Science City in Ahmedabad on September 10 to inaugurate a science conclave. Wily politician that he is, Modi is expected to raise the ante against his opponents every time he visits his home turf.


text:
Emory Hosts Two Sports for NCAA Round 1
By Samantha Bleiweis November 16, 2013 No Comments3 Mins Read
Emory Sports Information
Every year when the tournament rolls around, Emory University hopes to be able to host a round. Luckily for Emory this year, they were given a bonus–and they get to host not one, but two first rounds.
Both the Emory Women's Soccer Team and the Emory Volleyball Team will be seeing action this weekend on the court and on the field at the Woodruff PE Center.
On the soccer side, there will be two games on Saturday, with Emory v. Piedmont at 11 AM, and Lynchburg v. Centre at 1:30 PM. The winners of each respective match will advance to Sunday's round of 32 game at 1:30 PM. The winner of that game will advance to next weekend's round of 16.
This will mark the 15th NCAA appearance for the Emory Women's Soccer program, and it's fourth straight year qualifying as well–which is the longest streak in the program's history–matching that from 1995-1998. The Eagles are eager to make their mark in this year's tournament again, after falling in the National Championship last year in San Antonio, to powerhouse Messiah. Senior captain Kelly Costopoulos, who was recently named to the All-UAA First Team, says that the squad is itching to play, especially coming off last year's championship loss.
"I'm very excited about playing in the tournament this year, especially after ending last year with unfinished business. We learned a lot last year and this season we have grown from that experience, so I feel confident that we are ready to compete at the highest level. The only way to get back there is to take it one game at a time from here on out, and play every game like it could be our last," says Costopoulos.
Emory enters the tournament in a great position, after winning 12 of their last 13 games. The last meeting between the Eagles and the Piedmont Lions was in 2011, when they were tied after a scoreless first half, but in the second half the Eagles put three in the net to win the game, outshooting the Lions 31-1.
For volleyball, the Emory squad will host an eight-team regional, with play being held today through Sunday (Nov. 17). Four matches will be held today, and Emory will face Agnes Scott College in an 8 PM start this evening. The winners of the four matches will advance to Saturday's regional semifinals, played at 1:30 PM and 4:00 PM. The regional championship is also set for 2:00 PM on Sunday.
Friday, Nov. 15
Match 1 – Claremont-Mudd-Scripps vs. Thomas More (12:30 p.m.)
Match 2 – Colorado College vs. Maryville (3:00 p.m.)
Match 3 – Berry College vs. Washington & Lee (5:30 p.m.)
Match 4 – Emory vs. Agnes Scott vs. (8:00 p.m.)
Match 5 – Match 1 winner vs. Match 2 winner (1:30 p.m.)
Sunday, Nov. 17
Atlanta Regional Championship (2:00 p.m.)
It's an exciting weekend for Emory Athletics, as well as two highly ranked Emory teams, with Volleyball sitting at No. 7, and Women's Soccer at No. 8. We will bring you an update at the end of the weekend with results.
Samantha Bleiweis
I am a senior majoring in History/Journalism at Emory University. As a four year member of the women's soccer team at Emory, I understand and love the world of college athletics. After graduating this spring, I plan to pursue broadcast sports journalism.


Ornamental Mouse Pad Artwork Print Klimt Tree Of Lifestyles Upload a personalized effect contact to any laptop room. Non-slip rubber backing. Fabric floor works with any form of mouse, together with optical or ball sort. Rubber backing creates rubber odor out of bundle, dissipates after commencing. measures 9 1/four inches x 7 three/four inches x 1/four inches thick.
Thickest Pad to be had at 1/four Inch Thick.


text:
Rainbow Support Group SC
Research Study Request
RSG Events
Pride Dates 2022
Our Resource Partners
Operation Elf DEC 24-JAN 21
Together We Can Change The World, one person at a time..
Join The Rainbow Support Group SC as we extend our love to the homeless population in the Upstate of South Carolina.
The world has become so uncertain for so many in the last year. For the homeless, it is so very challenging. The Pandemic has also caused an increase in the amount of homeless families around the Upstate as well as around the world.
December 24th-January 21 : collection of donations
January 30, 2021 - EVENT !! We hit the road to provide our supplies to the community.
*ALL DONATIONS WILL BE USED FOR THIS OPERATION*
Here at Rainbow Support Group SC we fully understand that racism not only affects but completely undermines the mental health and well-being of not only individuals, but also that of entire communities and societies. We are fully committed to anti-racism in everything that we do. This means that we vow to fight against racism in all its many forms, including, individual, interpersonal, and institutionalized racism. We will never give up the fight for equal rights and we will never abandon members of our community by virtue of their race, creed, religion, nationality, gender identity, sexual orientation, or any other status protected by law.
Copyright © 2020. All Rights Reserved. Rainbow Support Group SC.


Demaich bimetal snap action components are economical, consistent, simple, fast acting, and well suited for a wide variety of applications, plus they can withstand wide temperature ranges and harsh environments. Often, they are more appropriate than electronic devices. As a result, bimetals are widely used today in appliances, thermostats, switches and circuit breakers, HVAC controls, motors, furnaces, thermal valves and safety devices, to name only a few of their thousands of applications.
Manufactured precisely by Demaich in innumerable shapes and sizes, and assembled using a variety of manufacturing processes, Bimetals operate in temperature ranges of –100°F to 1000°F. Snap action bimetals perform in the ranges of -50°F to 800°F, with circuit breaker elements responding from 1/4 amp to 200 amps.
Bimetals can generate forces from grams to pounds, depending on the temperature changes and material selections. For design assistance, contact Demaich or view our design tools.
Demaich's streamlined operations can rapidly accommodate production quantities from several thousand up to millions. Here at Demaich, we pride ourselves on our ability to coordinate our capabilities with our customer's needs. Because of this coordination, outsourcing to Demaich means your capital outlay, labor costs, manufacturing overhead and inventory costs are greatly reduced. Furthermore, our strict adherence to customer's scheduling requirements will minimize your supplier concerns.