using System; using System.Collections; //--------------------------------------------------------------------------- //SingSharp Library //--------------------------------------------------------------------------- namespace Microsoft.SingSharp { /// /// Marks methods that check should enforce context restrictions on /// [ AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = true)] public class ContextRestrictionAttribute : Attribute { } /// /// Context restriction that enforces that a method does not perform allocations and does not /// call methods that perform allocations. /// [ AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = true)] public class NoAllocateAttribute : ContextRestrictionAttribute { } /// /// Context restriction that enforces that a method does not block and does not call methods that /// might block. It's strictly more restrictive than NoAllocate, since allocation can cause blocking. /// [ AttributeUsage(AttributeTargets.Method | AttributeTargets.Delegate, AllowMultiple = true)] public class NoBlockingAttribute : NoAllocateAttribute { } /// /// Marks a struct as a message. /// public sealed class MessageAttribute : Attribute { public enum Direction { In, Out, Both } public MessageAttribute(Direction direction) { } } /// /// Marks a rep struct as not containing any pointers. /// public sealed class PointerFreeAttribute : Attribute { } /// /// Marks the protocolstate as a parallel (All) state /// public sealed class ProtocolParallelStateAttribute : Attribute { public ProtocolParallelStateAttribute() {} } /// /// Marks a the start state of a protocol. /// public sealed class ProtocolStartStateAttribute : Attribute { public ProtocolStartStateAttribute() {} } /// /// Send(tag) annotates a send method on Imp and Exp types, marking that the corresponding message /// is sent on the receiver endpoint /// public class SendAttribute : Attribute { public SendAttribute(int tag) {} } /// /// Receive(tag) annotates a receive method on Imp and Exp types, marking that the corresponding message /// is received. /// public class ReceiveAttribute : Attribute { public ReceiveAttribute(int tag) {} } /// /// Annotates an endpoint parameter of a method. Indicates that the endpoint is in the protocol /// state specified by the given type argument on entry to the method. /// public class PreStateAttribute : Attribute { public PreStateAttribute(System.Type @state) {} } /// /// Annotates an endpoint parameter of a method. Indicates that the endpoint is in the protocol /// state specified by the given type argument on exit of the method. /// public class PostStateAttribute : Attribute { public PostStateAttribute(System.Type @state) {} } #region Obsolete. Get rid of these and switch to ITracked and Claims tracking /// /// Annotates a method result or out parameter to indicate that the method transfers ownership of the /// endpoint to the caller. The bind is from the caller's perspective. The callee must view it as /// an unbind. /// public class BindEndpointAttribute : Attribute { public BindEndpointAttribute() {} } /// /// Annotates a method parameter to indicate that the caller transfers ownership of the /// endpoint to the callee. The unbind is from the caller's perspective. The callee must view it as /// a bind. /// public class UnbindEndpointAttribute : Attribute { public UnbindEndpointAttribute() {} } #endregion /// /// Marks static fields that hold select receive patterns. The argument /// is the actual int[][] pattern array used in the initializer. /// /// Each case row is a separate attribute. /// [ AttributeUsage(AttributeTargets.Field, AllowMultiple = true)] public class SelectReceivePatternAttribute : Attribute { public SelectReceivePatternAttribute(int row, int[] pattern) {} } [ AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true) ] public class LinkPortAttribute : Attribute { public LinkPortAttribute(System.Type importPort, System.Type exportPort) {} } // a dummy attribute used for compiling type extensions // (in case the real Bartok version is inaccessible) [ AttributeUsage(AttributeTargets.Class|AttributeTargets.Struct|AttributeTargets.Interface) ] public sealed class MixinAttribute : Attribute { internal Type option; public MixinAttribute(Type type) { this.option = type; } } // a dummy attribute used for compiling type extensions // (in case the real Bartok version is inaccessible) [ AttributeUsage(AttributeTargets.Method) ] public sealed class MixinExtendAttribute : Attribute { internal string name; public MixinExtendAttribute(string name) { this.name = name; } } } #if CCINamespace namespace Microsoft.Cci.TypeExtensions { #else namespace System.Compiler.TypeExtensions { #endif /// /// Marks a class as a process contract /// public interface IChannelContract { } /// /// Marks a struct as a rep struct /// public interface IRepStruct { } /// /// Marks a struct as a rep struct type parameter /// public interface IRepStructParameter { } /// /// Marks a struct as a message struct /// public interface IMessage { } /// /// Marks a protocol state as a protocol state /// public interface IProtocolState { } /// /// Marks a signature class as a signature /// public interface ISignature { } /// /// Marks a part class as an import port /// public interface IImportPort { } /// /// Marks a part class as an export port /// public interface IExportPort { } } namespace System.Compiler { /// /// Used to mark Template classes so Bartok can ignore them. /// If the name or namespace changes, we need to update bartok. /// public interface ITemplate { } }