text:
function [params, names] = polyKernExtractParam(kern)

% POLYKERNEXTRACTPARAM Extract parameters from the POLY kernel structure.
%
%	Description:
%
%	PARAM = POLYKERNEXTRACTPARAM(KERN) Extract parameters from the
%	polynomial kernel structure into a vector of parameters for
%	optimisation.
%	 Returns:
%	  PARAM - vector of parameters extracted from the kernel. If the
%	   field 'transforms' is not empty in the kernel matrix, the
%	   parameters will be transformed before optimisation (for example
%	   positive only parameters could be logged before being returned).
%	 Arguments:
%	  KERN - the kernel structure containing the parameters to be
%	   extracted.
%
%	[PARAM, NAMES] = POLYKERNEXTRACTPARAM(KERN) Extract parameters and
%	their names from the polynomial kernel structure.
%	 Returns:
%	  PARAM - vector of parameters extracted from the kernel. If the
%	   field 'transforms' is not empty in the kernel matrix, the
%	   parameters will be transformed before optimisation (for example
%	   positive only parameters could be logged before being returned).
%	  NAMES - cell array of strings containing parameter names.
%	 Arguments:
%	  KERN - the kernel structure containing the parameters to be
%	   extracted.
%
%
%
%	See also
%	% SEEALSO POLYKERNPARAMINIT, POLYKERNEXPANDPARAM, KERNEXTRACTPARAM, SCG, CONJGRAD

%	Copyright (c) 2005, 2006 Neil D. Lawrence

params = [kern.weightVariance kern.biasVariance kern.variance];
if nargout > 1
  names = {'weight variance', 'bias variance', 'variance'};
end


text:
COMPILE_ASSERT(catClassMembers == 0x000017fc);
//COMPILE_ASSERT(catAll == 0x00001fff);

// CorAttributeTargets in corhdr.h is missing this enum value.  Add it here for
// now, remove it when the header gets fixed.
const CorAttributeTargets catReturnValue = (CorAttributeTargets) 0x2000;

const int MaxConstructors = 12;  // Maximum number of overloaded constructors
const int MaxSignatureLength = 11; // Arbitrary number

// Microsoft.VisualBasic Attributes
#define VB_NAMESPACE L"Microsoft.VisualBasic."
#define COMCLASSATTRIBUTE_CLASSNAME L"ComClassAttribute"
#define COMCLASSATTRIBUTE (VB_NAMESPACE COMCLASSATTRIBUTE_CLASSNAME)
#define MYGROUPCOLLECTIONATTRIBUTE (VB_NAMESPACE L"MyGroupCollectionAttribute")
#define HIDEMOUDLENAMEATTRIBUTE (VB_NAMESPACE L"HideModuleNameAttribute")
#define EMBEDDEDATTRIBUTE (VB_NAMESPACE L"Embedded")

// Microsoft.VisualBasic.CompilerServices Attributes
#define VBCOMPILERSERVICES_NAMESPACE L"Microsoft.VisualBasic.CompilerServices"
#define DESIGNERGENERATEDATTRIBUTE ( VBCOMPILERSERVICES_NAMESPACE L".DesignerGeneratedAttribute")
#define OPTIONCOMPAREATTRIBUTE (VBCOMPILERSERVICES_NAMESPACE L".OptionCompareAttribute")
#define OPTIONTEXTATTRIBUTE (VBCOMPILERSERVICES_NAMESPACE  L".OptionTextAttribute")
#define STANDARDMODULEATTRIBUTE ( VBCOMPILERSERVICES_NAMESPACE L".StandardModuleAttribute")

// System.Runtime.CompilerServices Attributes
#define ACCESSEDTHROUGHPROPERTYATTRIBUTE (L"System.Runtime.CompilerServices.AccessedThroughPropertyAttribute")
#define COMPILATIONRELAXATIONATTRIBUTE (L"System.Runtime.CompilerServices.CompilationRelaxationsAttribute")
#define METHODIMPLATTRIBUTE (L"System.Runtime.CompilerServices.MethodImplAttribute")
#define DECIMALCONSTANTATTRIBUTE (L"System.Runtime.CompilerServices.DecimalConstantAttribute")
#define DATETIMECONSTANTATTRIBUTE (L"System.Runtime.CompilerServices.DateTimeConstantAttribute")
#define CALLERLINENUMBERATTRIBUTE (L"System.Runtime.CompilerServices.CallerLineNumberAttribute")
#define CALLERFILEPATHATTRIBUTE (L"System.Runtime.CompilerServices.CallerFilePathAttribute")
#define CALLERMEMBERNAMEATTRIBUTE (L"System.Runtime.CompilerServices.CallerMemberNameAttribute")

#define EXTENSIONATTRIBUTE ( L"System.Runtime.CompilerServices.ExtensionAttribute")

#define IDISPATCHCONSTANTATTRIBUTE (L"System.Runtime.CompilerServices.IDispatchConstantAttribute")
#define INTERNALSVISIBLETOATTRIBUTE (L"System.Runtime.CompilerServices.InternalsVisibleToAttribute")
#define IUNKNOWNCONSTANTATTRIBUTE (L"System.Runtime.CompilerServices.IUnknownConstantAttribute")
#define RUNTIMECOMPATIBILITYATTRIBUTE (L"System.Runtime.CompilerServices.RuntimeCompatibilityAttribute")

// System.ComponentModel Attributes
#define CATEGORYATTRIBUTE (L"System.ComponentModel.CategoryAttribute")
#define EXPORTATTRIBUTE (L"System.ComponentModel.Composition.ExportAttribute")
#define EXPORTMETADATAATTRIBUTE (L"System.ComponentModel.Composition.ExportMetadataAttribute")
#define IMPORTATTRIBUTE (L"System.ComponentModel.Composition.ImportAttribute")
#define IMPORTMANYATTRIBUTE (L"System.ComponentModel.Composition.ImportManyAttribute")
#define PARTEXPORTSINHERITEDATTRIBUTE (L"System.ComponentModel.Composition.PartExportsInheritedAttribute")
#define DEFAULTEVENTATTRIBUTE (L"System.ComponentModel.DefaultEventAttribute")
#define DEFAULTVALUEATTRIBUTE (L"System.ComponentModel.DefaultValueAttribute")
#define DESIGNERCATEGORYATTRIBUTE (L"System.ComponentModel.DesignerCategoryAttribute")
#define DESIGNERSERIALIZATIONVISIBILITYATTRIBUTE (L"System.ComponentModel.DesignerSerializationVisibilityAttribute")
#define EDITORBROWSABLEATTRIBUTE (L"System.ComponentModel.EditorBrowsableAttribute")

// System.ComponentModel.Design Attributes
#define HELPKEYWORDATTRIBUTE (L"System.ComponentModel.Design.HelpKeywordAttribute")

// System.Diagnostics Attributes
#define CONDITIONALATTRIBUTE (L"System.Diagnostics.ConditionalAttribute")
#define DEBUGGABLEATTRIBUTE (L"System.Diagnostics.DebuggableAttribute")
#define DEBUGGERBROWSABLEATTRIBUTE (L"System.Diagnostics.DebuggerBrowsableAttribute")
#define DEBUGGERDISPLAYATTRIBUTE (L"System.Diagnostics.DebuggerDisplayAttribute")
#define DEBUGGERHIDDENATTRIBUTE (L"System.Diagnostics.DebuggerHiddenAttribute")

// System.Reflection Attributes
#define DEFAULTMEMBERATTRIBUTE INTEROP_DEFAULTMEMBER_TYPE_W
#define ASSEMBLYKEYFILEATTRIBUTE (L"System.Reflection.AssemblyKeyFileAttribute")
#define ASSEMBLYKEYNAMEATTRIBUTE (L"System.Reflection.AssemblyKeyNameAttribute")
#define ASSEMBLYVERSIONATTRIBUTE (L"System.Reflection.AssemblyVersionAttribute")
#define ASSEMBLYDELAYSIGNATTRIBUTE (L"System.Reflection.AssemblyDelaySignAttribute")
#define ASSEMBLYFLAGSATTRIBUTE (L"System.Reflection.AssemblyFlagsAttribute")

// System.Runtime.InteropServices Attributes
#define BESTFITMAPPINGATTRIBUTE (L"System.Runtime.InteropServices.BestFitMappingAttribute")
#define CLASSINTERFACEATTRIBUTE INTEROP_CLASSINTERFACE_TYPE_W
#define COCLASSATTRIBUTE (L"System.Runtime.InteropServices.CoClassAttribute")

#define COMIMPORT_RAW L"ComImport"
#define COMIMPORTATTRIBUTE (L"System.Runtime.InteropServices." COMIMPORT_RAW L"Attribute")
#define COMIMPORTATTRIBUTE_NAME (COMIMPORT_RAW)

#define COMSOURCEINTERFACES (L"System.Runtime.InteropServices.ComSourceInterfacesAttribute")
#define COMEVENTINTERFACEATTRIBUTE (L"System.Runtime.InteropServices.ComEventInterfaceAttribute")
#define COMVISIBLEATTRIBUTE INTEROP_COMVISIBLE_TYPE_W
#define DISPIDATTRIBUTE (L"System.Runtime.InteropServices.DispIdAttribute")
#define DLLIMPORTATTRIBUTE (L"System.Runtime.InteropServices.DllImportAttribute")
#define FIELDOFFSETATTRIBUTE (L"System.Runtime.InteropServices.FieldOffsetAttribute")

#define GUID_RAW L"Guid"
#define GUIDATTRIBUTE (L"System.Runtime.InteropServices." GUID_RAW L"Attribute")
#define GUIDATTRIBUTE_NAME (GUID_RAW)

#define IMPORTEDFROMTYLELIB_RAW L"ImportedFromTypeLib"
#define IMPORTEDFROMTYPELIBATTRIBUTE (L"System.Runtime.InteropServices." IMPORTEDFROMTYLELIB_RAW L"Attribute")
#define IMPORTEDFROMTYPELIBATTRIBUTE_NAME (IMPORTEDFROMTYLELIB_RAW)

#define INATTRIBUTE (L"System.Runtime.InteropServices.InAttribute")
#define TYPEIDENTIFIERATTRIBUTE (L"System.Runtime.InteropServices.TypeIdentifierAttribute")
#define INTERFACETYPEATTRIBUTE INTEROP_INTERFACETYPE_TYPE_W
#define LCIDCONVERSIONATTRIBUTE (L"System.Runtime.InteropServices.LCIDConversionAttribute")
#define MARSHALASATTRIBUTE (L"System.Runtime.InteropServices.MarshalAsAttribute")
#define OUTATTRIBUTE (L"System.Runtime.InteropServices.OutAttribute")

#define PRIMARYINTEROPASSEMBLY_RAW L"PrimaryInteropAssembly"
#define PRIMARYINTEROPASSEMBLYATTRIBUTE (L"System.Runtime.InteropServices." PRIMARYINTEROPASSEMBLY_RAW L"Attribute")
#define PRIMARYINTEROPASSEMBLYATTRIBUTE_NAME (PRIMARYINTEROPASSEMBLY_RAW)

#define STRUCT_LAYOUT_ATTRIBUTE (L"System.Runtime.InteropServices.StructLayoutAttribute")
#define TYPELIBFUNCATTRIBUTE INTEROP_TYPELIBFUNC_TYPE_W
#define TYPELIBTYPEATTRIBUTE INTEROP_TYPELIBTYPE_TYPE_W
#define TYPELIBVARATTRIBUTE (L"System.Runtime.InteropServices.TypeLibVarAttribute")
#define UNMANAGEDFUNCTIONPOINTERATTRIBUTE (L"System.Runtime.InteropServices.UnmanagedFunctionPointerAttribute")
#define PRESERVESIGATTRIBUTE (L"System.Runtime.InteropServices.PreserveSigAttribute")
#define DEFAULTPARAMETERVALUEATTRIBUTE (L"System.Runtime.InteropServices.DefaultParameterValueAttribute")
#define OPTIONALATTRIBUTE (L"System.Runtime.InteropServices.OptionalAttribute")

//System.Web.Services Attributes
#define WEBMETHODATTRIBUTE (L"System.Web.Services.WebMethodAttribute")
#define WEBSERVICEATTRIBUTE (L"System.Web.Services.WebServiceAttribute")

// System Attributes
#define ATTRIBUTEUSAGEATTRIBUTE (L"System.AttributeUsageAttribute")
#define CLSCOMPLIANTATTRIBUTE (L"System.CLSCompliantAttribute")
#define MTATHREADATTRIBUTE (L"System.MTAThreadAttribute")
#define NONSERIALIZEDATTRIBUTE (L"System.NonSerializedAttribute")
#define OBSOLETEATTRIBUTE  (L"System.ObsoleteAttribute")
#define DEPRECATEDATTRIBUTE  (L"Windows.Foundation.Metadata.DeprecatedAttribute")
#define PARAMARRAYATTRIBUTE INTEROP_PARAMARRAY_TYPE_W
#define SERIALIZABLEATTRIBUTE (L"System.SerializableAttribute")
#define STATHREADATTRIBUTE (L"System.STAThreadAttribute")
#define FLAGSATTRIBUTE (L"System.FlagsAttribute")

// System.Sercurity.SecurityCritical Attribute
#define SECURITYCRITICALATTRIBUTE (L"System.Security.SecurityCriticalAttribute")

// System.Sercurity.SecuritySafeCritical Attribute
#define SECURITYSAFECRITICALATTRIBUTE (L"System.Security.SecuritySafeCriticalAttribute")

//
// ConditionalString holds one element in a list of ConditionalAttribute strings.
//
struct ConditionalString
{
    STRING *m_pstrConditional;
    struct ConditionalString *m_pConditionalStringNext;
};

DECLARE_ENUM(DebuggerBrowsableState)
    Never = 0,
    Collapsed = 2,
    RootHidden = 3
END_ENUM(DebuggerBrowsableState)

//============================================================================
// AttrKind enumerates all of the well-known custom attributes.
//
// The enum member names encode the attribute name ("Obsolete"),
// the types of the constructor's positional params ("_Void" or
// "_String_Bool") and if there are optional named properties
// that can follow the positional parameters ("_NamedProps").
//
// *** This is only used to keep track of the names. ***
//============================================================================
enum AttrKind
{
    // Microsoft.VisualBasic Attributes
    attrkindComClass_Void,
    attrkindComClass_String,
    attrkindComClass_String_String,
    attrkindComClass_String_String_String,
    attrkindMyGroupCollection_String_String_String_String,
    attrkindHideModuleName_Void,
    attrkindEmbedded_Void,

    // Microsoft.VisualBasic.CompilerServices Attributes
    attrkindDesignerGenerated_Void,
    attrkindOptionCompare_Void,
    attrkindStandardModule_Void,

    // System Attributes
    attrkindAttributeUsage_AttributeTargets_NamedProps,
    attrkindCLSCompliant_Bool,
    attrkindFlags_Void,

    // System.ComponentModel Attributes
    attrkindCategory_Void,
    attrkindCategory_String,
    attrkindDefaultEvent_String,
    attrkindDefaultValue_Bool,
    attrkindDefaultValue_Byte,
    attrkindDefaultValue_Char,
    attrkindDefaultValue_Double,
    attrkindDefaultValue_Int16,
    attrkindDefaultValue_Int32,
    attrkindDefaultValue_Int64,
    attrkindDefaultValue_Object,
    attrkindDefaultValue_Single,
    attrkindDefaultValue_String,
    attrkindDefaultValue_Type_String,
    attrkindDesignerCategory_Void,
    attrkindDesignerCategory_String,
    attrkindDesignerSerializationVisibilityAttribute_DesignerSerializationVisibilityType,
    attrkindEditorBrowsable_Void,
    attrkindEditorBrowsable_EditorBrowsableState,

    // System.ComponentModel.Design Attributes
    attrkindHelpKeyword_Void,
    attrkindHelpKeyword_String,
    attrkindHelpKeyword_Type,

    //System.Diagnostics
    attrkindConditional_String,
    attrkindDebuggable_DebuggingModes,
    attrkindDebuggable_Bool_Bool,
    attrkindDebuggerBrowsable_BrowsableState,
    attrkindDebuggerDisplay_String,
    attrkindDebuggerHidden_Void,

    // System Attributes
    attrkindMTAThread_Void,
    attrkindNonSerialized_Void,

    // Insert Here

    attrkindObsolete_Void,
    attrkindObsolete_String,
    attrkindObsolete_String_Bool,

    attrkindDeprecated_String_DeprType_UInt,
    attrkindDeprecated_String_DeprType_UInt_Platform,

    attrkindParamArray_Void,

    // System.Reflection
    attrkindAssemblyKeyFile_String,
    attrkindAssemblyKeyName_String,
    attrkindAssemblyDelaySign_Bool,
    attrkindAssemblyVersion_String,
    attrkindDefaultMember_String,
    attrkindAssemblyFlags_Int,
    attrkindAssemblyFlags_UInt,
    attrkindAssemblyFlags_AssemblyNameFlags,

    // System.Runtime.CompilerServices
    attrkindAccessedThroughProperty_String,
    attrkindCompilationRelaxations_Int32,
    attrkindCompilationRelaxations_Enum,
    attrkindDateTimeConstant_Int64,
    attrkindDecimalConstant_Decimal,
    attrkindDecimalConstant_DecimalInt,
    attrkindExtension_Void,
    attrkindIDispatchConstant_void,
    attrkindInternalsVisibleTo_String,
    attrkindIUnknownConstant_void,
    attrkindRuntimeCompatibility_Void,
    attrkindCallerLineNumber_Void,
    attrkindCallerFilePath_Void,
    attrkindCallerMemberName_Void,

    // System.Runtime.InteropServices
    attrkindBestFitMapping_Bool,
    attrkindClassInterface_Int16,
    attrkindClassInterface_ClassInterfaceType,
    attrkindCoClass_Type,
    attrkindComEventInterface_Type_Type,
    attrkindComImport_Void,
    attrkindComSourceInterfaces_String,
    attrkindComSourceInterfaces_Type,
    attrkindComSourceInterfaces_Type_Type,
    attrkindComSourceInterfaces_Type_Type_Type,
    attrkindComSourceInterfaces_Type_Type_Type_Type,
    attrkindCOMVisible_Bool,
    attrkindDefaultParameterValue_Object,
    attrkindDispId_Int32,
    attrkindDllImport_String,
    attrkindFieldOffset_Int32,
    attrkindGuid_String,
    attrkindImportedFromTypeLib_String,
    attrkindIn_void,
    attrkindInterfaceType_Int16,
    attrkindInterfaceType_ComInterfaceType,
    attrkindLCIDConversion_Int32,
    attrkindMarshalAs_UnmanagedType,
    attrkindMarshalAs_Int16,
    attrkindOptional_void,
    attrkindOut_void,
    attrkindPreserveSig_void,
    attrkindPrimaryInteropAssembly_Int32_Int32,
    attrkindStructLayout_Int16,
    attrkindStructLayout_LayoutKind,
    attrkindMethodImpl_Int16,
    attrkindMethodImpl_MethodImplOptions,
    attrkindTypeIdentifier_void,
    attrkindTypeIdentifier_String_String,
    attrkindTypeLibFunc_Int16,
    attrkindTypeLibFunc_TypeLibFuncFlags,
    attrkindTypeLibType_Int16,
    attrkindTypeLibType_TypeLibTypeFlags,
    attrkindTypeLibVar_Int16,
    attrkindTypeLibVar_TypeLibVarFlags,
    attrkindUnmanagedFunctionPointer_CallingConvention,

    // System Attributes
    attrkindSerializable_Void,
    attrkindSTAThread_Void,

    // System.Web.Services Attributes
    attrkindWebMethod_Void_NamedProps,
    attrkindWebMethod_Boolean_NamedProps,
    attrkindWebMethod_Boolean_Transaction_NamedProps,
    attrkindWebMethod_Boolean_Transaction_Int32_NamedProps,
    attrkindWebMethod_Boolean_Transaction_Int32_Boolean_NamedProps,
    attrkindWebService_Void_NamedProps,

    // System.Security.SecurityCritical
    attrkindSecurityCritical_Void,
    attrkindSecurityCritical_Scope,

    // System.Security.SecuritySafeCritical
    attrkindSecuritySafeCritical_Void,

    // Insert Here

    // Some special identifiers that don't map to attributes (i.e.,
    // there are no entries in g_rgAttrIdentity for these enums).
    attrkindMax,
    attrkindFirst = 0,
    attrkindNil = -1
};

//============================================================================
// Table of well-known custom attributes, identified by name and ctor sig.
//============================================================================
struct AttrIdentity
{
    AttrKind      m_attrkind;   // Which attribute is this?
    WCHAR        *m_pwszName;   // Fully-qualified name of attribute
    ULONG         m_cbSig;      // Actual size of m_sig, in bytes
    COR_SIGNATURE m_sig[MaxSignatureLength];     // Increase if necessary....
};

//============================================================================
// Structure to represent an attribute in the array of well known attributes.
//
// It contains the fully qualified name of the attribute and a pointer to an
// array of constructors.  The last element is denoted by containing
// attrkindNil for the AttrKind field..
//============================================================================
struct AttrIndex
{
    const WCHAR *wszName;

    unsigned char fCopyForNoPiaEmbeddedSymbols:1;

    // Debug only fields to verify that we have the correct information.
#if DEBUG
    bool IsAllowMultiple : 1;
    bool IsInheritable : 1;
#endif

    AttrIdentity Attributes[MaxConstructors];
};

AttrIndex g_rgAttributes[];

const AttrIndex *FindAttributeIndexByName
(
    _In_z_ const WCHAR *wszName   // IN: Attribute's fully-qualified name
);

const AttrIdentity *FindAttributeByID
(
    _In_z_ const WCHAR *wszName,   // IN: Attribute's fully-qualified name
    AttrKind AttributeID // IN: The Id of the specific constructor.
);

const AttrIdentity *FindAttributeBySignature
(
    const AttrIndex *pAttributeIndex, // IN: Pointer to the attribute index to search signatures in.
    ULONG cbSignature,    // IN: Length of signature in bytes
    PCCOR_SIGNATURE pSignature     // IN: CTOR signature to use to drive arg parsing
);

const AttrIdentity *FindAttributeBySignature
(
    _In_z_ const WCHAR *wszName,  // IN: Attribute's fully-qualified name. It can't be NULL
    ULONG cbSignature,    // IN: Length of signature in bytes
    PCCOR_SIGNATURE pSignature     // IN: CTOR signature to use to drive arg parsing
);

//============================================================================
// AttrVals is used to collect the settings of the various "well-known
// custom attributes."  (A custom attribute is considered "well-known"
// if the compiler needs to recognize and decode he attribute to produce
// correct results.)
//
// Any target that can have an attribute applied to it (e.g., BCSYM_Class)
// should allocate an AttrVals whenever an applied attribute is detected.
//
// AttrVals is also used at parse time to store a list of parsed attributes
// that have been applied to a given target.  That list is examined for
// well-known custom attributes (and the results of cracking those are stored
// directly in the AttrVals).  The list is also used to store all of the
// applied attributes (including non-well-known attributes) so they can be
// emitted and attached to the target's metadata.
//============================================================================
class WellKnownAttrVals
{

public:
    WellKnownAttrVals(NorlsAllocator* pAllocator);

    //============================================================================
    // Public getters.
    //============================================================================

    //
    // Because of the way AttrVals is used, all of the Getters below
    // handle the case where this == NULL.  I usually ----, ----, ----
    // this trick, but it really makes the callers' lives simpler.
    //
    // Getters all return false (and clear their OUT params) if
    // the given property is not present.
    //

    // Public getter for AttributeUsage attribute data
    bool GetAttributeUsageData(CorAttributeTargets *pattrtargetsValidOn, bool *pfAllowMultiple, bool *pfInherited);
    void SetAttributeUsageData(CorAttributeTargets targetsValidOn, bool fAllowMultiple, bool fInherited);

    // Public getter for Obsolete attribute data
    bool GetObsoleteData(_Deref_out_opt_z_ WCHAR **ppwszMessage, bool *pfError);
    void SetObsoleteData(_In_z_ WCHAR* pwszMessage, bool fError);

    // Public getter for Conditional attribute data
    bool GetConditionalData(ConditionalString **ppConditionalStringFirst);
    void AddConditionalData(_In_z_ WCHAR* pwszConditional);

    // Public getter for CLSCompliant attribute data
    bool GetCLSCompliantData(bool *pfCompliant, bool *pfIsInherited = NULL);
    void SetCLSCompliantData(bool fCompliant, bool fIsInherited);

    // Public getter for Flags attribute data
    bool GetFlagsData();
    void SetFlagsData();

    // Public getter and setter for PersistContents attribute data
    bool GetPersistContentsData(bool *pfPersistContents);
    void SetPersistContentsData(bool fPersistsContents);

    // Public getter for DefaultMember attribute data
    bool GetDefaultMemberData(_Deref_out_opt_z_ WCHAR **ppwszDefaultMember);
    void SetDefaultMemberData(_In_z_ WCHAR* pwszDefaultMember);

    // Public getter and setter for SecurityCritical attribute data
    bool GetSecurityCriticalData();
    void SetSecurityCriticalData();

    // Public getter and setter for SecuritySafeCritical attribute data
    bool GetSecuritySafeCriticalData();
    void SetSecuritySafeCriticalData();

    // Public getter and setter for DesignerCategory attribute data
    bool GetDesignerCategoryData(_Deref_out_opt_z_ WCHAR **ppwszCategory);
    void SetDesignerCategoryData(_In_z_ WCHAR* pwszDesignerCategory);

    // Public getter and setter for AccessedThroughProperty attribute data
    bool GetAccessedThroughPropertyData(_Deref_out_opt_z_ WCHAR **ppwszProperty);
    void SetAccessedThroughPropertyData(_In_z_ WCHAR* pwszProperty);

    // Public getter and setter for CompilationRelaxations attribute data
    bool GetCompilationRelaxationsData();
    void SetCompilationRelaxationsData();

    // Public getter for CompilationRelaxations attribute data
    bool GetRuntimeCompatibilityData();
    void SetRuntimeCompatibilityData();

    // Public getter and setter for CompilationRelaxations attribute data
    bool GetDebuggableData();
    void SetDebuggableData();

    // Public getter and setter for the DebuggerHidden attribute
    bool GetDebuggerHiddenData();
    void SetDebuggerHiddenData();

    // Public getter for and setter the DebuggerBrowsable attribute
    bool GetDebuggerBrowsableData(_Out_ DebuggerBrowsableStateEnum* pData);
    void SetDebuggerBrowsableData(DebuggerBrowsableStateEnum data);

    bool GetDebuggerDisplayData();
    void SetDebuggerDisplayData();

    // Public getter for MYGROUPCOLLECTIONATTRIBUTE
    struct MyGroupCollectionBase
    {
        STRING* m_GroupName;
        STRING* m_CreateMethod;
        STRING* m_DisposeMethod;
        STRING* m_DefaultInstance;

        MyGroupCollectionBase()
        {
            m_GroupName = NULL;
            m_CreateMethod = NULL;
            m_DisposeMethod = NULL;
            m_DefaultInstance = NULL;
        }
    };
    typedef DynamicArray<MyGroupCollectionBase> MyGroupCollectionData;
    bool GetMyGroupCollectionData(MyGroupCollectionData **ppMyGroupCollectionData);
    void SetMyGroupCollectionData(MyGroupCollectionData* pMyGroupCollectionData);
    bool HasMyGroupCollectionData() { return ( this != NULL && m_fMyGroupCollection ); };
    void ResetMyGroupCollectionData();

    // Public getter and setter for HideModuleName attribute data
    bool GetHideModuleNameData();
    void SetHideModuleNameData();

    // Public getter and setter for DesgignerGenerated attribute data
    bool GetDesignerGeneratedData();
    void SetDesignerGeneratedData();

    // Public getter and setter for StandardModule attribute data
    bool GetStandardModuleData();
    void SetStandardModuleData();

    // Public getter and setter for Extension attribute data
    bool GetExtensionData();
    void SetExtensionData();

    // Public getter and setter for OptionCompare attribute data
    bool GetOptionCompareData();
    void SetOptionCompareData();

    // Public getter and setter for EditorBrowsable data
    bool GetEditorBrowsableData(long *pEditorBrowsableState);
    void SetEditorBrowsableData(long editorBrowsableState);

    // Public getter and setter for DllImport data
    bool GetDllImportData();
    void SetDllImportData();

    // Public getter and setter for STAThread data
    bool GetSTAThreadData();
    void SetSTAThreadData();

    // Public getter and setter for MTAThread data
    bool GetMTAThreadData();
    void SetMTAThreadData();

    // Public getter and setter for InterfaceType data
    bool GetInterfaceTypeData(long *pInterfaceType);
    void SetInterfaceTypeData(long interfaceType);

    // Public getter for TypeLibType data
    bool GetTypeLibTypeData(short *pTypeLibType);
    void SetTypeLibTypeData(short typeLibType);

    // Public getter for TypeLibFunc data
    bool GetTypeLibFuncData(short *pTypeLibFunc);
    void SetTypeLibFuncData(short typeLibFunc);

    bool GetTypeLibVarData(short *pTypeLibVar);
    void SetTypeLibVarData(short typeLibVar);

    // Public getter and setter for ClassInterface
    bool GetClassInterfaceData(short *pClassInterfaceType);
    void SetClassInterfaceData(short classInterfaceType);

    // Public getter and setter for COMVisible
    bool GetCOMVisibleData(bool *pCOMVisible);
    void SetCOMVisibleData(bool visible);

    // Public getter and setter for ParamArray
    bool GetParamArrayData();
    void SetParamArrayData();

    // Public getter and setter for DecimalConstant
    bool GetDecimalConstantData(DECIMAL *Value);
    void SetDecimalConstantData(DECIMAL value);

    // Public getter for DecimalConstant
    bool GetDateTimeConstantData(__int64 *Value);
    void SetDateTimeConstantData(__int64 value);

    // Public getter and setter for IDispatchConstant
    bool GetIDispatchConstantData();
    void SetIDispatchConstantData();

    // Public getter and setter for IUnknownConstant
    bool GetIUnknownConstantData();
    void SetIUnknownConstantData();

    // Public getter for MarshalAs:
    bool GetMarshalAsData(void)
    {
        return this ? m_fMarshalAs : false;
    }
    void SetMarshalAsData();
    bool GetMarshalAsData(PCCOR_SIGNATURE *ppSig, ULONG *pSigBytes);
    void SetMarshalAsData(PCCOR_SIGNATURE pSig, ULONG sigBytes);

    bool GetImportedFromTypeLibData(_Deref_out_opt_z_ WCHAR **ppTlbFile);
    void SetImportedFromTypeLibData(_In_z_ WCHAR* pTlbFile);

    // Public getter and setter for Guid
    bool GetGuidData(_Deref_out_opt_z_ WCHAR **ppwszGuid);
    void SetGuidData(_In_z_ WCHAR* pwszGuid);

    bool GetPrimaryInteropAssemblyData();
    void SetPrimaryInteropAssemblyData();

    bool GetTypeIdentifierData();
    void SetTypeIdentifierData();
    bool GetTypeIdentifierData(_Deref_out_opt_z_ WCHAR **pGuid,_Deref_out_opt_z_ WCHAR **pName);
    void SetTypeIdentifierData(_In_z_ WCHAR* pwszGuid, _In_z_ WCHAR* pwszName);
    void SetStructLayoutDataByLayoutKind(int pLayoutKind);
    void SetStructLayoutData(__int16 pLayoutKind);
    bool GetStructLayoutData(__int16 *pLayoutKind);
    void SetMethodImplOptionData(__int16 pMethodImplOptions);
    bool GetMethodImplOptionSynchronizedData();
    void SetCharSet(CorTypeAttr charSet);
    bool GetCharSet(CorTypeAttr &charSet);
    void SetPackClassSize(DWORD dwPackSize, ULONG ulClassSize);
    bool GetPackClassSize(DWORD & dwPackSize, ULONG & ulClassSize);

    // Public getter for ComClass
    struct ComClassData
    {
        const WCHAR* m_ClassId;
        const WCHAR* m_InterfaceId;
        const WCHAR* m_EventId;
        bool m_fShadows;
        BCSYM_Class *m_PartialClassOnWhichApplied;

        ComClassData()
        {
            m_ClassId = NULL;
            m_InterfaceId = NULL;
            m_EventId = NULL;
            m_fShadows = false;
            m_PartialClassOnWhichApplied = NULL;
        }
    };

    bool GetComClassData(ComClassData *pComClassData);
    void SetComClassData(ComClassData comClassData);

    struct ComEventInterfaceData
    {
        WCHAR *m_SourceInterface;
        WCHAR *m_EventProvider;

        ComEventInterfaceData()
        {
            m_SourceInterface = NULL;
            m_EventProvider = NULL;
        }
    };

    bool GetComEventInterfaceData(ComEventInterfaceData *pComEventInterfaceData);
    void SetComEventInterfaceData(ComEventInterfaceData comEventInterfaceData);

    // Public getter and setter for ComImport
    bool GetComImportData();
    void SetComImportData();

    // Public getter and setter for WindowsRuntimeImport
    bool GetWindowsRuntimeImportData();
    void SetWindowsRuntimeImportData();

    // Public getter and setter for ComSourceInterfaces
    bool GetComSourceInterfacesData();
    void SetComSourceInterfacesData();

    // Public getter and setter  for DispId
    bool GetDispIdData(long *pDispId);
    void SetDispIdData(long dispId);

    bool GetBestFitMappingData(bool *pMapping, bool *pThrow);
    void SetBestFitMappingData(bool fMapping, bool fThrow);

    bool GetFieldOffsetData(int *pOffset);
    void SetFieldOffsetData(int offset);

    bool GetLCIDConversionData(int *pData);
    void SetLCIDConversionData(int data);

    bool GetInData();
    void SetInData()
    {
        m_fIn = true;
    }

    bool GetOutData();
    void SetOutData()
    {
        m_fOut = true;
    }

    bool GetUnmanagedFunctionPointerData(long *pData);
    void SetUnmanagedFunctionPointerData(long data);

    // Public getter and setter for CoClass
    bool GetCoClassData(_Deref_out_opt_z_ WCHAR **ppwszTypeName);
    void SetCoClassData(_In_z_ WCHAR* pwszTypeName);

    // Public getter and setter for Category
    bool GetCategoryData(_Deref_out_opt_z_ WCHAR **ppwszCategoryName);
    void SetCategoryData(_In_z_ WCHAR* pwszCategoryName);

    // Public getter and setter for DefaultEvent
    bool GetDefaultEventData(_Deref_out_z_ WCHAR **ppwszProperty, _Deref_out_opt_ BCSYM_Class** ppPartialClassOnWhichApplied);
    void SetDefaultEventData(_In_z_ WCHAR* pwszProperty, BCSYM_Class* pPartialClassOnWhichApplied);

    // Public getter and setter for DefaultValue
    bool GetDefaultValueData(ConstantValue* pDefaultValue, bool* pfIsNotHandled);
    void SetDefaultValueData(ConstantValue defaultValue, bool fIsNotHandled);

    // Public getter and setter for HelpKeyword
    bool GetHelpKeywordData(_Deref_out_opt_z_ WCHAR **ppwszHelpKeyword);
    void SetHelpKeywordData(_In_z_ WCHAR* pwszHelpKeyword);

    // Public getter and setter for NonSerialized
    bool GetNonSerializedData();
    void SetNonSerializedData();

    // Public getter for Serializable
    bool GetSerializableData();
    void SetSerializableData();

    // Public getter for WebMethod attribute data
    bool GetWebMethodData(AttrKind *pAttrId, bool *pfEnableSession, short *pTransactionOption, int *pCacheDuration, bool *pBufferResponse, _Deref_out_opt_z_ WCHAR **pwszDescription);
    void SetWebMethodData(AttrKind attrId, bool fEnableSession, short transactionOption, int cacheDuration, bool fBufferResponse, _In_z_ WCHAR* pwszDescription);

    // Public getter for DefaultParameterValue data
    bool GetDefaultParamValueData(BYTE*& argBlob, ULONG &cbArgBlob);
    void SetDefaultParamValueData(BYTE* argBlob, ULONG cbArgBlob);

    // Public getter and setter for WebService data
    bool GetWebServiceData(_Deref_out_z_ WCHAR** ppwszNamespace, _Deref_out_z_ WCHAR** ppwszDescription, _Deref_out_z_ WCHAR** ppwszName);
    void SetWebServiceData(_In_z_ WCHAR* pwszNamespace, _In_z_ WCHAR* pwszDescription, _In_z_ WCHAR* pwszName);

    bool GetEmbeddedData();
    void SetEmbeddedData()
    {
        m_fEmbedded = true;
    }

    //Public getter and setter for CallerLineNumber data
    bool GetCallerLineNumberData();
    void SetCallerLineNumberData();

    //Public getter and setter for CallerFilePath data
    bool GetCallerFilePathData();
    void SetCallerFilePathData();

    //Public getter and setter for CallerMemberName data
    bool GetCallerMemberNameData();
    void SetCallerMemberNameData();

    // Inherits well-known custom attributes settings.  Copies settings
    // out of psymBase and into 'this'.
    void InheritFromSymbol(BCSYM *psymBase);

    // Clears the result of the previous attribute ---- cached
    // in this AttrVals.
    void Clear----Results();

private:

    // The presence of well-known attribute FooAttribute is indicated
    // if m_fFoo is true.
#define DEF_ATTR_TYPE(attributeName) bool m_f ## attributeName : 1;
#include "AttributeTypes.h"
#undef DEF_ATTR_TYPE

#if _WIN64
    enum WellKnownAttrKindKeys : __int64
#else
    enum WellKnownAttrKindKeys
#endif
    {
#define DEF_ATTR_TYPE(attributeName) attributeName ## _Key,
#include "AttributeTypes.h"
#undef DEF_ATTR_TYPE
    };

    struct AttributeUsageData
    {
        CorAttributeTargets m_attrtargetsValidOn;
        bool                m_fAllowMultiple;
        bool                m_fInherited;
    };

    struct DecimalConstantData
    {
        DECIMAL     m_Value;
    };

    struct DateTimeConstantData
    {
        __int64     m_Value;
    };

    // IDispatchConstantData: No data stored -- presence of attribute is all we need to know

    // IUnknownConstantData: No data stored -- presence of attribute is all we need to know

    struct ObsoleteData
    {
        //
        WCHAR      *m_pwszMessage;
        bool        m_fError;       // If false, it's just a warning
    };

    struct CLSCompliantData
    {
        bool m_fCompliant;
        bool m_fIsInherited;
    };

    struct PersistContentsData
    {
        bool m_fPersistContents;
    };

    struct DefaultMemberData
    {
        WCHAR *m_pwszDefaultMember;
    };

    struct DesignerCategoryData
    {
        WCHAR *m_pwszCategory;  // Optional -- can be NULL
    };

    struct DebuggerBrowsableData
    {
        long m_value;
    };

    struct AccessedThroughPropertyData
    {
        WCHAR *m_pwszProperty;
    };

    MyGroupCollectionData* m_daMyGroupAttrData;

    // HideModuleName: No data stored -- presence of attribute is all we need to know

    // StandardModuleData: No data stored -- presence of attribute is all we need to know

    // Flags: No data stored -- presence of attribute is all we need to know

    struct EditorBrowsableData
    {
        long m_EditorBrowsableState;
    };

    // DllImportData: No data stored -- presence of attribute is all we need to know

    // STAThreadData: No data stored -- presence of attribute is all we need to know

    // MTAThreadData: No data stored -- presence of attribute is all we need to know

    struct BestFitMappingData
    {
        bool m_BestFitMappingData;
        bool m_BestFitMappingThrowOnUnmappableChar;
    };

    struct COM2InteropData
    {
        // The InterfaceType
        long m_InterfaceType;

        // The typelib flags
        short m_TypeLibType;

        // The typelib func flags
        short m_TypeLibFunc;

        short m_TypeLibVar;

        // The class interface type (formerly HasDefaultInterface)
        short m_ClassInterfaceType;

        // COM2 Visibility
        bool m_fCOMVisible;

        // DispId
        long m_DispId;

        // CoClass
        WCHAR *m_pwszCoClassTypeName;
    };

    struct MarshalAsData
    {
        PCCOR_SIGNATURE pNativeType;
        ULONG cbNativeType;
    };

    // GuidData
    struct GuidData
    {
        WCHAR *m_pwszGuid;
    };

    struct TypeIdentifierData
    {
        WCHAR *m_pGuid;
        WCHAR *m_pName;
    };

    struct PackAndClassSizeData
    {
        DWORD m_dwPackSize;
        ULONG m_ulClassSize;
    };

    struct DefaultEventData
    {
        WCHAR *m_pwszDefaultEvent;
        BCSYM_Class *m_PartialClassOnWhichApplied;
    };

    struct DefaultValueData
    {
        ConstantValue m_DefaultValue;
        bool m_fIsNotHandled;
    };

    struct HelpKeywordData
    {
        WCHAR *m_pwszHelpKeyword;
    };

    // Flags : No data stored -- presence of attribute is all we need to know
    // NonSerialized : No data stored -- presence of attribute is all we need to know
    // Serializable : No data stored -- presence of attribute is all we need to know

    struct WebMethodData
    {
        AttrKind m_attrId;
        bool m_fEnableSession;
        short m_TransactionOption;
        int m_CacheDuration;
        bool m_fBufferResponse;
        WCHAR *m_pwszDescription;
    };

    // WebService :
    struct WebServiceData
    {
        AttrKind m_attrId;
        WCHAR *m_pwszName;
        WCHAR *m_pwszNamespace;
        WCHAR *m_pwszDescription;
    };

    struct DefaultParamValueObjectData
    {
        ULONG m_cbArgBlob;
        BYTE* m_argBlob;
    };

    NorlsAllocator* m_pAllocator;
    DynamicHashTable<WellKnownAttrKindKeys, void*, NorlsAllocWrapper> m_dataTable;
};

// Non----edData is where we hide some implementation details.
// All of the other data in AttrVals is just a cache for attribute
// ---- results.  Non----edData is where we store our other
// bookkeeping data.  We store these all together so Clear----Results
// doesn't need to be constantly updated.
struct Non----edData
{
    // During parsing, we need a place to hold a linked list of
    // attributes that have been parsed, but not examined yet.
    // That list starts here.
    BCSYM_ApplAttr *m_psymApplAttrHead;

    // During compilation, we need to know which symbols in a SourceFile
    // have attached AttrVals.  We root that list in SourceFile and thread
    // it through here.
    BCSYM *m_psymNextWithAttr;

    // We record the context of parameters here.  We need this so that we
    // can later re-parse the parameter and its attributes in the context
    // of the function to which the parameter belongs.
    BCSYM_NamedRoot *m_psymParamContext;

};

class AttrVals
{
public:
    //============================================================================
    // Implementation.
    //============================================================================

    // Returns head of the list of BCSYM_ApplAttr nodes
    BCSYM_ApplAttr *GetPsymApplAttrHead()
    {
        return m_Non----edData.m_psymApplAttrHead;
    }

    // Returns head of the list of BCSYM_ApplAttr nodes
    BCSYM *GetPsymNextSymbolWithApplAttr()
    {
        return m_Non----edData.m_psymNextWithAttr;
    }

    BCSYM_NamedRoot *GetPsymContextOfParamWithApplAttr()
    {
        return m_Non----edData.m_psymParamContext;
    }

    WellKnownAttrVals *GetPWellKnownAttrVals()
    {
        if (!this)
        {
            return NULL;
        }

        return m_pWellKnownAttrVals;
    }

    void SetPWellKnownAttrVals(WellKnownAttrVals *pWellKnownAttrVals)
    {
        m_pWellKnownAttrVals->ResetMyGroupCollectionData();
        m_pWellKnownAttrVals = pWellKnownAttrVals;
    }

    Non----edData* GetPNon----edData()
    {
        return &m_Non----edData;
    }

private:

    Non----edData m_Non----edData;

    WellKnownAttrVals *m_pWellKnownAttrVals;

};

//============================================================================
// This method is used to obtain the bound trees for the parameters of an
// attribute.
//============================================================================
ILTree::Expression *GetBoundTreesForAttribute(BCSYM_Hash      *Lookup,
                                  BCSYM_NamedRoot *pnamedContextOfApplAttr,
                                  BCSYM_ApplAttr  *AttributeSymbol,
                                  ErrorTable      *Errors,
                                  NorlsAllocator  *BoundTreeStorage,
                                  CompilerHost    *pCompilerHost);

// NamedProps is used to parse named properties used at a custom
// attribute application site.
struct NamedProps
{
    // Maximum number of named props recognized by any well-known custom attribute
    const static int m_cPropsMax = 3;

    int    m_cProps;                        // Number of named props
    const WCHAR *m_rgwszPropName[m_cPropsMax];    // List of prop names
    void  *m_rgpvPropVal[m_cPropsMax];      // Where to store decoded prop values
};

//============================================================================
// The Attribute class is used to handle many operations on custom attributes.
// Many of these methods used to belong to MetaImport and MetaEmit, but it
// makes more sense to gather all of that functionality together in one class.
//
// Clients should (obviously) call only the public entry points of this class.
// What's not so obvious is that these methods are static -- they take
// all the params they need to call the (private) Attribute constructor, and
// then perform the requested operation using that class instance.  The net
// result is that the caller never needs to declare an instance of the
// Attribute class.
//============================================================================
class Attribute
{
    // MetaEmit needs access to ----String and some other private stuff.
    friend class MetaEmit;

public:

    static void
    ReportError
    (
        ErrorTable * pErrorTable,
        ERRID errid,
        BCSYM * pSym
    );

    // Public, static entry-point.  This function constructs an instance
    // of the Attribute class and calls _----AllAttributesOnToken,
    // which does all of the real work.
    static void ----AllAttributesOnToken(mdToken mdtoken, IMetaDataImport *pimdImport,
                        NorlsAllocator *pnra, Compiler *pcompiler, CompilerProject *pCompilerProject, MetaDataFile *pMetaDataFile,
                        BCSYM *psym);

    // Public, static entry-point.  This ----s all of the attributes
    // applied to psym and accumulates the well-known
    // attribute bits into ppattrval, which is allocated on demand.
    static void ----AllAttributesOnSymbol(BCSYM *psym, NorlsAllocator *pnra,
                        Compiler *pcompiler, CompilerHost *pcompilerhost, ErrorTable *perrortable,
                        SourceFile *psourcefile);

    // Public, static entry-point.  Taked the BCSYM_ApplAttr (which is attached to
    // the given BCSYM) and returns a bound tree representing the applied attribute.
    static ILTree::Expression *GetBoundTreeFromApplAttr(BCSYM_ApplAttr *psymApplAttr, BCSYM *psym,
                        ErrorTable *perrortable, NorlsAllocator *pnra, CompilerHost *pcompilerHost);

    // Public, static entry-point.  This function constructs an instance
    // of the Attribute class and calls _EncodeBoundTree, which does the real work.
    static void EncodeBoundTree(ILTree::AttributeApplicationExpression *ptreeApplAttr, MetaEmit *pMetaemit, NorlsAllocator *pnra,
                        Compiler *pcompiler, CompilerProject *pcompilerproj,
                        bool fWellKnownAttr, _Deref_out_z_ STRING **ppstrAttrName,
                        BCSYM_Class **ppsymAttrClass, BCSYM_Proc **ppsymAttrCtor,
                        BYTE **ppbArgBlob,  ULONG *pcbArgBlob, ULONG *pcPosParams,
                        COR_SIGNATURE **ppSignature, ULONG *pcbSignature,
                        bool *pfError, ErrorTable * pErrorTable = NULL);

    // Parses the serialized data (arg blob) in pbArgBlob accoring to the
    // attribute's signature (pbSignature) and possible named properties (pnamedprops).
    static void ----AttributeData(NamedProps *pnamedprops, NorlsAllocator  *pnra,
                               PCCOR_SIGNATURE psignatureOrig, BYTE *pbArgBlob, ...);

    // Check for incorrect uses of attributes (e.g., using
    // both STAThread and MTAThread on the same method)
    static void VerifyAttributeUsage(BCSYM *psymCheck, ErrorTable *pErrorTable, CompilerHost * pCompilerHost);
    static void VerifyComClassAttributeUsage(BCSYM_Class *ClassSym, ErrorTable *pErrorTable);
    static void VerifyDefaultEventAttributeUsage(BCSYM_Class *ClassSym, ErrorTable *pErrorTable);
    static void VerifyExtensionAttributeUsage(BCSYM_Class *ClassSym, ErrorTable *pErrorTable);

    //Verifies the usage of the extension attribute on procedure symbols.
    //If the provided pErrorTable is non null, then errors will be reported for
    //validation failures.
    //If the validation succeeds, then the "callable as extension method" flag
    //will be set on the the procedure symbol, and the "contains extension method flag"
    //will be set on the procedure's containing type.
    //This method is suitable for use checkings procedures defined both in source and
    //in meta-data, and properly understands the different validation rules needed for both.
    //Also, the method may be called on any procedure, not just those decorated with the extension
    //attribute, and will properly skip all processing in the even that the
    //attribute is missing.
    static bool VerifyExtensionAttributeUsage(BCSYM_Proc *ProcSym, ErrorTable *pErrorTable, CompilerHost * pCompilerHost);
    static void VerifyWebMethodAttributeUsage(BCSYM_Proc *ProcSym, ErrorTable *pErrorTable);
    static void VerifyNonSerializedAttributeUsage(BCSYM_NamedRoot *ProcField, ErrorTable *pErrorTable);
    static BCSYM_ApplAttr * GetAppliedAttribute(Symbol * pSymbolToSearch, Type * pAttributeType, bool SearchThisSymbolOnly = true);

    // Check Guid attribute format
    static bool VerifyGuidAttribute(const WCHAR* guid, bool AllowBlank);

    static BCSYM_NamedRoot *BindDefaultEvent(BCSYM_Class *ClassSym, _In_z_ STRING *strName);

    // Static function that converts the given bound tree into the
    // appropriate bits in an AttrVals struct.  If the bound tree represents
    // something other than a well-known custom attribute, this function is a nop.
    // Returns an AttrIndex for the attribute in g_rgAttributes array or NULL if it is not a well-known attribute.
    static const AttrIndex * ----BoundTree(ILTree::AttributeApplicationExpression *ptreeApplAttr, NorlsAllocator *pnra,
                                  Compiler *pcompiler, SourceFile *psourcefile,
                                  bool *pfError, BCSYM *psym,
                                  bool isAssembly);

    // See if the member represented by Token is annotated with the specified attribute
    static TriState<bool> HasAttribute(MetaDataFile *pMetaDataFile, mdToken Token, AttrKind SpecifiedAttribute);

private:
    static bool
    ValidateExtensionAttributeMetaDataConditions
    (
        Procedure * pProc,
        Container * pContainer
    );

    static bool
    ValidateGenericConstraitnsOnExtensionMethodDefinition
    (
        Procedure * pProc,
        ErrorTable * pErrorTable
    );
    static bool
    ValidateTypeDoesNotDependOnPartialyOpenParameter
    (
        GenericParameter * pParameter,
        ISet<GenericParameter *> * pCloseableParameters,
        ISet<Type *> * pProcessedTypes,
        Procedure * pProc,
        ErrorTable * pErrorTable
    );

    static void
    PushTypeIfNotAlreadySeen
    (
        Type * pType,
        IStackOrQueue<Type *> * pStack,
        ISet<Type *> * pProcessedTypes
    );

    //============================================================================
    // Constructor.
    //============================================================================

    // Ctor is private -- it can only be called from public, static methods
    Attribute
    (
        IMetaDataImport *pimdImport,
        MetaEmit         *pMetaemit,
        NorlsAllocator   *pnra,
        Compiler         *pcompiler,
        CompilerProject  *pcompilerproj,
        MetaDataFile     *pMetaDataFile,
        ErrorTable * pErrorTable = NULL
    )
        : m_pimdImport(pimdImport)  // Cached copy -- no AddRef
        , m_pMetaemit(pMetaemit)
        , m_pnra(pnra)
        , m_pcompiler(pcompiler)
        , m_pcompilerhost(pcompilerproj->GetCompilerHost())
        , m_pcompilerproj(pcompilerproj)
        , m_pMetaDataFile(pMetaDataFile)
        , m_pstrAttrName(NULL)
        , m_psymAttrCtor(NULL)
        , m_psymAttrClass(NULL)
        , m_pbArgBlob(NULL)
        , m_cbArgBlob(0)
        , m_cPosParams(0)
        , m_cNamedProps(0)
        , m_fError(false)
        , m_pErrorTable(pErrorTable)
    {
    }

    //============================================================================
    // Simple cracking (decoding) functions
    //============================================================================

    // Decodes a COM+ boolean as serialized in a custom attribute arg blob.
    static bool ----Bool(BYTE **ppbArgBlob);

    // Decodes a COM+ I1 as serialized in a custom attribute arg blob.
    static __int8 ----I1(BYTE **ppbArgBlob);

    // Decodes a COM+ I2 as serialized in a custom attribute arg blob.
    static __int16 ----I2(BYTE **ppbArgBlob);

    // Decodes a COM+ I4 as serialized in a custom attribute arg blob.
    static __int32 ----I4(BYTE **ppbArgBlob);

    // Decodes a COM+ I8 as serialized in a custom attribute arg blob.
    static __int64 ----I8(BYTE **ppbArgBlob);

    // Decodes a COM+ R4 as serialized in a custom attribute arg blob.
    static float ----R4(BYTE **ppbArgBlob);

    // Decodes a COM+ R8 as serialized in a custom attribute arg blob.
    static double ----R8(BYTE **ppbArgBlob);

    // Decodes a COM+ String as serialized in a custom attribute arg blob.
    static WCHAR *----String(BYTE **ppbArgBlob, NorlsAllocator *pnra);

    // Returns a string that represents the given serialized System.Type
    // expressed as a fully-qualified type name.
    WCHAR *ConvertSerializedSystemTypeToTypeName(_In_opt_z_ WCHAR *pwszSystemType, NorlsAllocator *pnra);

    //============================================================================
    // Top-level cracking functions
    //============================================================================

    // ----s all well-known custom attributes attached to mdtoken and
    // returns their settings through psym.  Clients should call the static,
    // public, non-underscore version of this function.
    void _----AllAttributesOnToken(mdToken mdtoken, BCSYM *psym);

    // Returns the name and signature of the custom attribute named by tokenAttr.
    //
    // Can return S_FALSE if everything went okay but tokenAttr just wasn't
    // an attribute, or if the signature was bogus.  OUT params are not
    // set in this case.
    bool GetNameAndSigFromToken(mdToken tokenAttr,
                                _Out_cap_(cchAttrName) WCHAR *wszAttrName,
                                ULONG cchAttrName,
                                PCCOR_SIGNATURE *ppsignature,
                                ULONG *pcbSignature);

    // Processes one custom attribute (and its constructor's args and
    // named properties) and returns the result (if any) through psym.
    // Note that ppattrvals is allocated if one is needed and none is passed in.
    AttrIdentity *----OneAttribute(mdToken tokenAttr, BYTE *pbArgBlob, ULONG cbArgBlob, BCSYM *psym, bool ----ArgBlob = true);

    // Processes the given arg blob and returns the result (if any)
    // through psym.
    void ----ArgBlob(
            _In_count_(cbArgBlob) BYTE *pbArgBlob,
            ULONG cbArgBlob,
            const AttrIdentity *pAttribute,
            _Inout_ BCSYM *psym, bool isAssembly,
            _In_opt_ SourceFile *pSourceFile,
            _In_opt_ Location* pLoc = NULL);

    // Processes the named properties/fields found in the arg blob.
    static void ----NamedProperties(int cNamedProps, NamedProps *pnamedprops, NorlsAllocator *pnra, BYTE **ppbArgBlob);

    // worker function for HasAttribute
    bool _HasAttribute(mdToken Token, AttrKind SpecifiedAttribute);

    //============================================================================
    // Emitting functions
    //============================================================================

    // Encodes the given bound tree (which represents an applied attribute).
    // Non-static version of EncodeBoundTree (no underscore).
    void _EncodeBoundTree(ILTree::AttributeApplicationExpression *ptreeApplAttr, bool fWellKnownAttr);

    // Returns the fully-qualified name, BCSYM_Class and ctor of the given applied attribute.
    void GetEmittedNameAndSymbol(ILTree::AttributeApplicationExpression *ptreeApplAttr, _Deref_out_z_ STRING **ppstrAttrName,
                             BCSYM_Proc **ppsymCtor, BCSYM_Class **ppsymClass);

    // Encodes the positional parameters passed to the attribute specified
    // by the given bound tree.  This encoding is appended to the CTOR arg blob.
    void EncodeAllPositionalParams(ILTree::AttributeApplicationExpression *ptreeApplAttr);

    // Encodes the given length-counted Unicode string and appends to the arg blob.
    void EncodeString(_In_opt_count_(cch) const WCHAR *pwsz, ULONG cch);

    // Encodes a tree that represents a constant value, and appends it to the arg blob.
    void EncodeConstant(ILTree::ILNode *ptree);

    // Encodes the COR type into the signature.
    void EncodeParameterCORType(COR_SIGNATURE ParameterType);

    // Encodes the parameter type into the signature
    void EncodeSignatureParameter(BCSYM *pParameterType);

    // Encodes a tree that represents a constant type, as in "GetType(TypeName)".
    // The symbol passed in represents TypeName, and can be an array, class, or interface.
    STRING *EncodeConstantType(BCSYM *psymType, Location & referencingLocation);

    // Extends the arg blob and appends cbData bytes of pvData.
    void ExtendArgBlob(void *pvData, ULONG cbData);

    // Encodes the given type and appends it to the arg blob.  This
    // encoding is specific to attribute named properties.
    void EncodeNamedPropType(BCSYM *psymType, Location & referencingLocation);

    // Encodes one property/field assignment.
    void EncodeOneNamedProp(ILTree::SymbolReferenceExpression *ptreeSym, ILTree::ILNode *ptreeVal);

    // Encodes an applied attribute's named properties (and fields) and appends
    // the encoding to the arg blob.
    void EncodeAllNamedProps(ILTree::AttributeApplicationExpression *ptreeApplAttr);

    //============================================================================
    // Data members
    //============================================================================

    // This data member is used to emit AssemblyRefs when EncodeConstantType of MetaType literal
    MetaEmit         *m_pMetaemit;      // Use to encode AssemblyRefs (NULL if not encoding)
    ErrorTable * m_pErrorTable;  // Use to report errors for type encoding

    // This data members are used when importing an attribute:
    IMetaDataImport *m_pimdImport;      // Where we're importing from (NULL if encoding)

    // These data members are used both when importing and encoding:
    NorlsAllocator  *m_pnra;            // Where to alloc from when necessary
    Compiler        *m_pcompiler;       // The compiler that's running us
    CompilerHost    *m_pcompilerhost;   // The compilerhost
    CompilerProject *m_pcompilerproj;   // Project being built
    MetaDataFile    *m_pMetaDataFile;   // The metadata file containing the symbol we're cracking

    // These data members are used when encoding an attribute:
    STRING          *m_pstrAttrName;    // Name of attribute
    BCSYM_Proc      *m_psymAttrCtor;    // Attribute constructor being used
    BCSYM_Class     *m_psymAttrClass;   // Class symbol for attribute
    BYTE            *m_pbArgBlob;       // The custom attribute's CTOR arg blob
    ULONG            m_cbArgBlob;       // Blob's size in bytes
    ULONG            m_cPosParams;      // Count of positional params in this arg blob
    USHORT           m_cNamedProps;     // Count of named props in this arg blob (USHORT to match COM+)
    bool             m_fError;          // Did a recoverable error occur?

    //[....] For performance reasons, do not allocate a buffer
    //for this array with every Attribute instance. It is often not needed.
    //Allocate it only when preparing to perform operations
    //that will need it.
    DynamicArray< COR_SIGNATURE > m_Signatures;
};

// Helps encode constant types when emitting applied attributes
// Helps decode constant types when importing applied attributes
class CLRTypeConstantEncoderDecoder
{
public:

    CLRTypeConstantEncoderDecoder(Compiler *CompilerInstance)
    : m_Compiler(CompilerInstance)
    , m_CompilerHost(NULL)
    , m_CurrentProjectContext(NULL)
    , m_Metaemit(NULL)
    , m_TypeNameBuilder(nullptr)
    , m_UseStringVersion(false)
    , m_pErrorTable(NULL)
    {
        m_Location.Invalidate();
    }

    ~CLRTypeConstantEncoderDecoder()
    {
        if (m_TypeNameBuilder != nullptr)
        {
            delete m_TypeNameBuilder;
            m_TypeNameBuilder = nullptr;
        }
    }

    // Encode the VB type as an equivalent clr type name
    STRING *TypeToCLRName(BCSYM *Type, CompilerProject *ProjectContext, MetaEmit *MetaEmit, bool IncludeAssemblySpec = true, ErrorTable * pErrorTable = NULL, Location * pLocation = NULL);

    // Decode the clr type name to the equivalent VB typename.
    //
    WCHAR *CLRNameToVBName(_In_opt_z_ WCHAR *CLRTypeName, NorlsAllocator *Allocator, CompilerProject *ProjectContext, MetaEmit *MetaEmit);

private:

    // Encoding routines

    void EncodeType(BCSYM *Type, bool IncludeAssemblySpec = true);
    void EncodeTypeName(BCSYM_Container *Container);
    void EncodeAssemblyName(BCSYM_Container *Container);
    void EncodeGenericTypeArguments(BCSYM *Type);
    void EncodeTypeArgumentsInOrder(BCSYM_GenericTypeBinding *Binding);
    void EncodeArray(BCSYM *Type);

    void InitCurrentContext(CompilerProject *ProjectContext, MetaEmit *MetaEmit, ErrorTable * pErrorTable = NULL, Location * pLocation = NULL)
    {
        m_CurrentProjectContext = ProjectContext;
        m_Metaemit = MetaEmit;
        m_pErrorTable = pErrorTable;

        if (pLocation != NULL)
        {
            m_Location = *pLocation;
        }
        else
        {
            m_Location.Invalidate();
        }
    }

    void ClearCurrentContext()
    {
        m_CurrentProjectContext = NULL;
        m_Metaemit = NULL;
        m_pErrorTable = NULL;
        m_Location.Invalidate();
    }

    void InitTypeNameBuilder();

    Compiler *m_Compiler;
    CompilerHost *m_CompilerHost;

    CompilerProject *m_CurrentProjectContext;
    MetaEmit *m_Metaemit;
    ErrorTable * m_pErrorTable;  // Use to report errors for type encoding
    Location m_Location;  // Use to report errors for type encoding

    TypeNameBuilder *m_TypeNameBuilder;

    StringBuffer m_sbTypeNameBuilder;
    bool m_UseStringVersion;
};

redpajama_set_name: RedPajamaGithub


text:
layout: post
title: X-Art - Play Me - Connie Carter
titleinfo: pornvd
desc: Watch X-Art - Play Me - Connie Carter. Pornhub is the ultimate xxx porn and sex site.
---

X-Art - Play Me - Connie Carter

Watch X-Art - Play Me - Connie Carter. Pornhub is the ultimate xxx porn and sex site.


text:
package org.hoteia.qalingo.core.service.openid;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.StringReader;
import java.io.UnsupportedEncodingException;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap;

import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import javax.servlet.http.HttpServletRequest;

import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 *
 */
@Service("openIdService")
public class OpenIdService {

    private static final String HMAC_SHA1_ALGORITHM = "HmacSHA1";

    public static final String OPEN_ID_PROVIDER_ALIAS_SUFIX = ".alias";

    @Autowired
    private Properties openIdProperties;

    private Map<String, Endpoint> endpointCache = new ConcurrentHashMap<String, Endpoint>();
    private Map<Endpoint, Association> associationCache = new ConcurrentHashMap<Endpoint, Association>();

    private Map<String, String> urlMap = new HashMap<String, String>();
    private Map<String, String> aliasMap = new HashMap<String, String>();

    private int timeOut = 5000; // 5 seconds
    private String assocQuery = null;
    private String authQuery = null;
    private String returnTo = null;
    private String returnToUrlEncode = null;
    private String realm = null;

    /**
     * Set returning address after authentication.
     *
     * @param returnTo URL that should redirect to.
     */
    public void setReturnTo(String returnTo) {
        try {
            this.returnToUrlEncode = Utils.urlEncode(returnTo);

        } catch(UnsupportedEncodingException e) {
            throw new OpenIdException(e);
        }
        this.returnTo = returnTo;
    }

    /**
     * Set realm. For example, "http://*.example.com".
     *
     * @param realm Realm of RP.
     */
    public void setRealm(String realm) {
        try {
            this.realm = Utils.urlEncode(realm);
        }
        catch(UnsupportedEncodingException e) {
            throw new OpenIdException(e);
        }
    }

    /**
     * Set timeout in milliseconds.
     */
    public void setTimeOut(int timeOutInMilliseconds) {
        this.timeOut = timeOutInMilliseconds;
    }

    /**
     * Get authentication information from HTTP request, key.and alias
     */
    public OpenIdAuthentication getAuthentication(HttpServletRequest request, byte[] key, String alias) {
    	// verify:
        String identity = request.getParameter("openid.identity");
        if (identity == null)
            throw new OpenIdException("Missing 'openid.identity'.");
        if (request.getParameter("openid.invalidate_handle")!=null)
            throw new OpenIdException("Invalidate handle.");
        String sig = request.getParameter("openid.sig");
        if (sig == null)
            throw new OpenIdException("Missing 'openid.sig'.");
        String signed = request.getParameter("openid.signed");
        if (signed == null)
            throw new OpenIdException("Missing 'openid.signed'.");
        if (!returnTo.equals(request.getParameter("openid.return_to")))
            throw new OpenIdException("Bad 'openid.return_to'.");
        // check sig:
        String[] params = signed.split("[\\,]+");
        StringBuilder sb = new StringBuilder(1024);
        for (String param : params) {
            sb.append(param)
              .append(':');
            String value = request.getParameter("openid." + param);
            if (value!=null)
                sb.append(value);
            sb.append('\n');
        }
        String hmac = getHmacSha1(sb.toString(), key);
        if (!safeEquals(sig, hmac)){
            throw new OpenIdException("Verify signature failed.");
        }
        // set auth:
        OpenIdAuthentication auth = new OpenIdAuthentication();
        auth.setIdentity(identity);
        auth.setEmail(request.getParameter("openid." + alias + ".value.email"));
        auth.setLanguage(request.getParameter("openid." + alias + ".value.language"));
        auth.setGender(request.getParameter("openid." + alias + ".value.gender"));
        auth.setFullname(getFullname(request, alias));
        auth.setFirstname(getFirstname(request, alias));
        auth.setLastname(getLastname(request, alias));
        return auth;
    }

    boolean safeEquals(String s1, String s2) {
        if (s1.length()!=s2.length()){
            return false;
        }
        int result = 0;
        for (int i=0; i<s1.length(); i++) {
            int c1 = s1.charAt(i);
            int c2 = s2.charAt(i);
            result |= (c1 ^c2);
        }
        return result==0;
    }

    String getLastname (HttpServletRequest request, String axa) {
    	String name = request.getParameter("openid." + axa + ".value.lastname");
    	// If lastname is not supported try to get it from the fullname
    	if (name == null) {
    		name = request.getParameter("openid." + axa + ".value.fullname");
    		if (name != null) {
    		    int n = name.lastIndexOf(' ');
    		    if (n!=(-1)){
    		        name = name.substring(n + 1);
    		    }
    		}
    	}
    	return name;
    }

    String getFirstname(HttpServletRequest request, String axa) {
    	String name = request.getParameter("openid." + axa + ".value.firstname");
    	//If firstname is not supported try to get it from the fullname
    	if (name == null) {
    		name = request.getParameter("openid." + axa + ".value.fullname");
    		if (name != null) {
    		    int n = name.indexOf(' ');
                if (n!=(-1)){
                    name = name.substring(0, n);
                }
    		}
    	}
    	return name;
    }

    String getFullname(HttpServletRequest request, String axa) {
    	// If fullname is not supported then get combined first and last name
    	String fname = request.getParameter("openid."+axa+".value.fullname");
    	if (fname == null) {
    		fname = request.getParameter("openid."+axa+".value.firstname");
    		if (fname != null) {
    			fname += " ";
    		}
    		fname += request.getParameter("openid."+axa+".value.lastname");
    	}
    	return fname;
    }

    String getHmacSha1(String data, byte[] key) {
        SecretKeySpec signingKey = new SecretKeySpec(key, HMAC_SHA1_ALGORITHM);
        Mac mac = null;
        try {
            mac = Mac.getInstance(HMAC_SHA1_ALGORITHM);
            mac.init(signingKey);
        }
        catch(NoSuchAlgorithmException e) {
            throw new OpenIdException(e);
        }
        catch(InvalidKeyException e) {
            throw new OpenIdException(e);
        }
        try {
            byte[] rawHmac = mac.doFinal(data.getBytes("UTF-8"));
            return Base64.encodeBytes(rawHmac);
        }
        catch(IllegalStateException e) {
            throw new OpenIdException(e);
        }
        catch(UnsupportedEncodingException e) {
            throw new OpenIdException(e);
        }
    }

    /**
     * Lookup end point by name or full URL.
     */
    public Endpoint lookupEndpoint(String nameOrUrl) {
        String url = null;
        String alias = null;
        if (nameOrUrl.startsWith("http://")
        		|| nameOrUrl.startsWith("https://")){
            url = nameOrUrl;
        } else {
            url = lookupUrlByName(nameOrUrl);
            if (url == null){
                throw new OpenIdException("Cannot find OP URL by name: " + nameOrUrl);
            }
            alias = lookupAliasByName(nameOrUrl);
        }
        Endpoint endpoint = endpointCache.get(url);
        if (endpoint != null
        		&& !endpoint.isExpired()){
            return endpoint;
        }
        endpoint = requestEndpoint(url, alias==null ? Endpoint.DEFAULT_ALIAS : alias);
        endpointCache.put(url, endpoint);
        return endpoint;
    }

    public Association lookupAssociation(Endpoint endpoint) {
        Association assoc = associationCache.get(endpoint);
        if (assoc != null
        		&& !assoc.isExpired()){
            return assoc;
        }
        assoc = requestAssociation(endpoint);
        associationCache.put(endpoint, assoc);
        return assoc;
    }

    public String getAuthenticationUrl(Endpoint endpoint, Association association) {
        StringBuilder sb = new StringBuilder(1024);
        sb.append(endpoint.getUrl())
          .append(endpoint.getUrl().contains("?") ? '&' : '?')
          .append(getAuthQuery(endpoint.getAlias()))
          .append("&openid.return_to=")
          .append(returnToUrlEncode)
          .append("&openid.assoc_handle=")
          .append(association.getAssociationHandle());
        if (realm != null){
            sb.append("&openid.realm=").append(realm);
        }
        return sb.toString();
    }

    Endpoint requestEndpoint(String url, String alias) {
        Map<String, Object> map = Utils.httpRequest(url, "GET", "application/xrds+xml", null, timeOut);
        try {
            String content = Utils.getContent(map);
            return new Endpoint(Utils.mid(content, "<URI>", "</URI>"), alias, Utils.getMaxAge(map));
        }
        catch(UnsupportedEncodingException e) {
            throw new OpenIdException(e);
        }
    }

    Association requestAssociation(Endpoint endpoint) {
        Map<String, Object> map = Utils.httpRequest(endpoint.getUrl(), "POST", "*/*", getAssocQuery(), timeOut);
        String content = null;
        try {
            content = Utils.getContent(map);
        }
        catch(UnsupportedEncodingException e) {
            throw new OpenIdException(e);
        }
        Association assoc = new Association();
        try {
            BufferedReader r = new BufferedReader(new StringReader(content));
            for (;;) {
                String line = r.readLine();
                if (line == null){
                    break;
                }
                line = line.trim();
                int pos = line.indexOf(':');
                if (pos!=(-1)) {
                    String key = line.substring(0, pos);
                    String value = line.substring(pos + 1);
                    if ("session_type".equals(key))
                        assoc.setSessionType(value);
                    else if ("assoc_type".equals(key))
                        assoc.setAssociationType(value);
                    else if ("assoc_handle".equals(key))
                        assoc.setAssociationHandle(value);
                    else if ("mac_key".equals(key))
                        assoc.setMacKey(value);
                    else if ("expires_in".equals(key)) {
                        long maxAge = Long.parseLong(value);
                        assoc.setMaxAge(maxAge * 900L); // 90%
                    }
                }
            }
        }
        catch(IOException e) {
            throw new RuntimeException("Association is impossible!", e);
        }
        return assoc;
    }

    private String getAuthQuery(String axa) {
        if (authQuery != null){
            return authQuery;
        }
        List<String> list = new ArrayList<String>();
        list.add("openid.ns=http://specs.openid.net/auth/2.0");
        list.add("openid.claimed_id=http://specs.openid.net/auth/2.0/identifier_select");
        list.add("openid.identity=http://specs.openid.net/auth/2.0/identifier_select");
        list.add("openid.mode=checkid_setup");
        list.add("openid.ns." + axa + "=http://openid.net/srv/ax/1.0");
        list.add("openid." + axa + ".mode=fetch_request");
        list.add("openid." + axa + ".type.email=http://axschema.org/contact/email");
        list.add("openid." + axa + ".type.fullname=http://axschema.org/namePerson");
        list.add("openid." + axa + ".type.language=http://axschema.org/pref/language");
        list.add("openid." + axa + ".type.firstname=http://axschema.org/namePerson/first");
        list.add("openid." + axa + ".type.lastname=http://axschema.org/namePerson/last");
        list.add("openid." + axa + ".type.gender=http://axschema.org/person/gender");
        list.add("openid." + axa + ".required=email,fullname,language,firstname,lastname,gender");
        String query = Utils.buildQuery(list);
        authQuery = query;
        return query;
    }

	private String getAssocQuery() {
        if (assocQuery != null){
            return assocQuery;
        }

        List<String> list = new ArrayList<String>();
        list.add("openid.ns=http://specs.openid.net/auth/2.0");
        list.add("openid.mode=associate");
        list.add("openid.session_type=" + Association.SESSION_TYPE_NO_ENCRYPTION);
        list.add("openid.assoc_type=" + Association.ASSOC_TYPE_HMAC_SHA1);
        String query = Utils.buildQuery(list);
        assocQuery = query;
        return query;
    }

    private String lookupUrlByName(String name) {
    	checkMap();
    	if(StringUtils.isNotEmpty(name)){
        	String provider = name.toLowerCase();
        	if(provider.contains("-") || provider.contains("_")){
        		provider = provider.replace("-", ".");
        		provider = provider.replace("_", ".");
        	}
    		if(urlMap.get(provider) != null){
    			return urlMap.get(provider);
    		} else {
    			provider = provider.replaceAll("[_]", ".");
    			if(urlMap.get(provider) != null){
        			return urlMap.get(provider);
        		}
    		}
    	}
        return null;
    }

    private String lookupAliasByName(String name) {
    	checkMap();
        String alias = aliasMap.get(name);
        return alias==null ? Endpoint.DEFAULT_ALIAS : alias;
    }

    private void checkMap() {
        if(urlMap.size() == 0){
        	loadMap();
        }
        if(aliasMap.size() == 0){
        	loadMap();
        }
    }

    private void loadMap() {
        for (Object k : openIdProperties.keySet()) {
            String key = (String) k;
            String value = openIdProperties.getProperty(key);
            if (key.endsWith(OPEN_ID_PROVIDER_ALIAS_SUFIX)) {
                aliasMap.put(key.substring(0, key.length()-6), value);
            }
            else {
                urlMap.put(key, value);
            }
        }
    }

}


text:
// -*-  Mode:ObjC; c-basic-offset:4; tab-width:8; indent-tabs-mode:nil -*-

#import "EditTagsViewController.h"
#import "DataModel.h"

@implementation EditTagsViewController

@synthesize delegate, tableView, canAddTags;

- (instancetype)initWithTags:(NSString *)a_tags delegate:(id<EditTagsViewDelegate>)a_delegate;
{
    self = [super initWithNibName:nil bundle:nil];
    if (self) {
        delegate = a_delegate;
        canAddTags = YES;

        if (a_tags == nil) {
            tags = [[NSMutableArray alloc] init];
        } else {
            tags = [a_tags splitWithDelimiter:@","];
        }
        allTags = [[DataModel sharedDataModel] allTags];

        for (NSString *tag in tags) {
            if ([allTags findString:tag] < 0) {
                [allTags addObject:tag];
            }
        }
        [allTags sortByString];
    }
    return self;
}

- (void)dealloc
{
    self.view = nil;
}

- (void)loadView
{
    self.tableView = [[UITableView alloc]
                          initWithFrame:[UIScreen mainScreen].applicationFrame
                          style:UITableViewStyleGrouped];
    tableView.delegate = self;
    tableView.dataSource = self;
    tableView.autoresizingMask = (UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight);
    tableView.autoresizesSubviews = YES;

    self.view = tableView;

    self.title = NSLocalizedString(@"Tags", @"");

    self.navigationItem.rightBarButtonItem =
        [[UIBarButtonItem alloc]
             initWithBarButtonSystemItem:UIBarButtonSystemItemDone
             target:self
             action:@selector(_doneAction:)];

    [tableView reloadData];
}

- (NSString *)tags
{
    NSMutableString *a_tags = nil;

    for (NSString *tag in tags) {
        if (a_tags == nil) {
            a_tags = [[NSMutableString alloc] init];
            [a_tags setString:tag];
        }
        else {
            [a_tags appendString:@","];
            [a_tags appendString:tag];
        }
    }

    if (a_tags == nil) {
        [a_tags setString:@""];
    }
    return a_tags;
}

- (void)_doneAction:(id)sender
{
    [delegate editTagsViewChanged:self];
    [self.navigationController popViewControllerAnimated:YES];
}

/**
   @name Table view delegate / data source
*/
//@{
- (NSInteger)numberOfSectionsInTableView:(UITableView*)tableView {
    if (canAddTags) {
        return 2;
    }
    return 1;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    if (canAddTags && section == 0) {
        return 1;
    } else {
        return allTags.count;
    }
}

// 行の内容
- (UITableViewCell *)tableView:(UITableView *)a_tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *MyIdentifier = @"editTagsViewCells";

    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:MyIdentifier];
    if (cell == nil) {
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:MyIdentifier];
    }

    cell.accessoryType = UITableViewCellAccessoryNone;
    cell.selectionStyle = UITableViewCellSelectionStyleNone;

    if (canAddTags && indexPath.section == 0) {
        cell.textLabel.text = NSLocalizedString(@"New tag", @"");
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    else {
        cell.textLabel.text = allTags[indexPath.row];
        if ([tags findString:cell.textLabel.text] >= 0) {
            cell.accessoryType = UITableViewCellAccessoryCheckmark;
        }
    }

    return cell;
}

- (void)tableView:(UITableView *)a_tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (canAddTags && indexPath.section == 0) {
        // add new tag
        GenEditTextViewController *vc =
            [GenEditTextViewController genEditTextViewController:self
                                       title:NSLocalizedString(@"Tags", @"")];
        [self.navigationController pushViewController:vc animated:YES];
    }
    else {
        NSString *tag = allTags[indexPath.row];
        NSInteger n = [tags findString:tag];
        if (n < 0) {
            // add tag
            [tags addObject:tag];
            [tags sortByString];
        } else {
            // delete tag
            [tags removeObjectAtIndex:n];
        }
        [a_tableView reloadData];
    }
}

- (void)genEditTextViewChanged:(GenEditTextViewController *)vc
{
    if (vc.text.length > 0 && [allTags findString:vc.text] < 0) {
        [allTags addObject:vc.text];
        [allTags sortByString];

        [tags addObject:vc.text];
        [tags sortByString];
    }
    [self.tableView reloadData];
}

//@}

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
    return [Common isSupportedOrientation:interfaceOrientation];
}

@end


text:
//
//  SampleCubicModel.hpp
//  Spektr
//
//  Created by Christian J Howard on 7/23/16.
//
//  The MIT License (MIT)
//    Copyright © 2016 Christian Howard. All rights reserved.
//
//  Permission is hereby granted, free of charge, to any person obtaining a copy
//  of this software and associated documentation files (the "Software"), to deal
//  in the Software without restriction, including without limitation the rights
//  to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
//  copies of the Software, and to permit persons to whom the Software is
//  furnished to do so, subject to the following conditions:
//
//  The above copyright notice and this permission notice shall be included in all
//  copies or substantial portions of the Software.
//
//  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
//  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
//  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
//  AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
//  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
//  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
//  SOFTWARE.
//
//

#ifndef SampleCubicModel_h
#define SampleCubicModel_h

template<class DataSet, class Sets>
class CubicModel {
public:
    CubicModel(const DataSet & ds_, const Sets & sets_):ds(ds_),sets(sets_){
        coefs[0] = coefs[1] = coefs[2] = coefs[3] = 0.0;
    }

    void train( int hold_out_set ){
        double eps = 1e-3;
        grad[0] = grad[1] = grad[2] = grad[3] = 0.0;

        for(int iter = 0; iter < 1000; ++iter ){
            N = 0.0;
            for(int set = 0; set < sets.numSets(); ++set ){
                if( set != hold_out_set ){
                    for(int j = 0; j < sets.setSize(set); ++j ){
                        int index = sets(set,j);
                        typename DataSet::Pair p = ds[index];

                        x  = p.x;
                        y  = p.y;
                        N  += 1.0;

                        double e = coefs[0] + (coefs[1] + coefs[2]*x)*x - y;
                        grad[0] += e;
                        grad[1] += e*x;
                        grad[2] += e*x*x;
                        grad[3] += e*x*x*x;
                    }
                }
            }

            for(int i = 0; i < 4; ++i){
                grad[i] *= (2.0/N);
                coefs[i] -= eps*grad[i];
            }
        }

    }

    double testError( int test_set ){
        double error = 0.0;
        double inv_n = 1.0 / static_cast<double>(sets.setSize(test_set));
        for(int j = 0; j < sets.setSize(test_set); ++j ){
            typename DataSet::Pair p = ds[sets(test_set,j)];
            double e = p.y - coefs[0] - ((coefs[2] + coefs[3]*p.x)*p.x + coefs[1])*p.x;
            error += e*e;
        }
        error *= inv_n;
        return error;
    }

private:
    const DataSet & ds;
    const Sets & sets;
    double coefs[4];
    double x,x2,xy,y,N;
    double grad[4];

};

#endif /* SampleCubicModel_h */


text:
package ginkgo

import (
	"github.com/onsi/ginkgo/config"
	"github.com/onsi/ginkgo/reporters"
	"github.com/onsi/ginkgo/types"
	. "github.com/onsi/gomega"
	"math/rand"
	"time"
)

func init() {
	Describe("Suite", func() {
		var (
			specSuite *suite
			fakeT     *fakeTestingT
			fakeR     *reporters.FakeReporter
			writer    *fakeGinkgoWriter
		)

		BeforeEach(func() {
			writer = &fakeGinkgoWriter{}
			fakeT = &fakeTestingT{}
			fakeR = reporters.NewFakeReporter()
			specSuite = newSuite()
		})

		Describe("running a suite", func() {
			var (
				runOrder          []string
				randomizeAllSpecs bool
				randomSeed        int64
				focusString       string
				parallelNode      int
				parallelTotal     int
				runResult         bool
			)

			var f = func(runText string) func() {
				return func() {
					runOrder = append(runOrder, runText)
				}
			}

			BeforeEach(func() {
				randomizeAllSpecs = false
				randomSeed = 11
				parallelNode = 1
				parallelTotal = 1
				focusString = ""

				runOrder = make([]string, 0)
				specSuite.pushBeforeEachNode(f("top BE"), types.GenerateCodeLocation(0), 0)
				specSuite.pushJustBeforeEachNode(f("top JBE"), types.GenerateCodeLocation(0), 0)
				specSuite.pushAfterEachNode(f("top AE"), types.GenerateCodeLocation(0), 0)

				specSuite.pushContainerNode("container", func() {
					specSuite.pushBeforeEachNode(f("BE"), types.GenerateCodeLocation(0), 0)
					specSuite.pushJustBeforeEachNode(f("JBE"), types.GenerateCodeLocation(0), 0)
					specSuite.pushAfterEachNode(f("AE"), types.GenerateCodeLocation(0), 0)
					specSuite.pushItNode("it", f("IT"), flagTypeNone, types.GenerateCodeLocation(0), 0)

					specSuite.pushContainerNode("inner container", func() {
						specSuite.pushItNode("inner it", f("inner IT"), flagTypeNone, types.GenerateCodeLocation(0), 0)
					}, flagTypeNone, types.GenerateCodeLocation(0))
				}, flagTypeNone, types.GenerateCodeLocation(0))

				specSuite.pushContainerNode("container 2", func() {
					specSuite.pushBeforeEachNode(f("BE 2"), types.GenerateCodeLocation(0), 0)
					specSuite.pushItNode("it 2", f("IT 2"), flagTypeNone, types.GenerateCodeLocation(0), 0)
				}, flagTypeNone, types.GenerateCodeLocation(0))

				specSuite.pushItNode("top level it", f("top IT"), flagTypeNone, types.GenerateCodeLocation(0), 0)
			})

			JustBeforeEach(func() {
				runResult = specSuite.run(fakeT, "suite description", []Reporter{fakeR}, writer, config.GinkgoConfigType{
					RandomSeed:        randomSeed,
					RandomizeAllSpecs: randomizeAllSpecs,
					FocusString:       focusString,
					ParallelNode:      parallelNode,
					ParallelTotal:     parallelTotal,
				})
			})

			It("provides the config and suite description to the reporter", func() {
				Ω(fakeR.Config.RandomSeed).Should(Equal(int64(randomSeed)))
				Ω(fakeR.Config.RandomizeAllSpecs).Should(Equal(randomizeAllSpecs))
				Ω(fakeR.BeginSummary.SuiteDescription).Should(Equal("suite description"))
			})

			It("provides information about the current test", func() {
				description := CurrentGinkgoTestDescription()
				Ω(description.ComponentTexts).Should(Equal([]string{"Suite", "running a suite", "provides information about the current test"}))
				Ω(description.FullTestText).Should(Equal("Suite running a suite provides information about the current test"))
				Ω(description.TestText).Should(Equal("provides information about the current test"))
				Ω(description.IsMeasurement).Should(BeFalse())
				Ω(description.FileName).Should(ContainSubstring("suite_test.go"))
				Ω(description.LineNumber).Should(BeNumerically(">", 50))
				Ω(description.LineNumber).Should(BeNumerically("<", 150))
			})

			Measure("should run measurements", func(b Benchmarker) {
				r := rand.New(rand.NewSource(time.Now().UnixNano()))

				runtime := b.Time("sleeping", func() {
					sleepTime := time.Duration(r.Float64() * 0.01 * float64(time.Second))
					time.Sleep(sleepTime)
				})
				Ω(runtime.Seconds()).Should(BeNumerically("<=", 0.012))
				Ω(runtime.Seconds()).Should(BeNumerically(">=", 0))

				randomValue := r.Float64() * 10.0
				b.RecordValue("random value", randomValue)
				Ω(randomValue).Should(BeNumerically("<=", 10.0))
				Ω(randomValue).Should(BeNumerically(">=", 0.0))
			}, 10)

			It("creates a node hierarchy, converts it to an example collection, and runs it", func() {
				Ω(runOrder).Should(Equal([]string{
					"top BE", "BE", "top JBE", "JBE", "IT", "AE", "top AE",
					"top BE", "BE", "top JBE", "JBE", "inner IT", "AE", "top AE",
					"top BE", "BE 2", "top JBE", "IT 2", "top AE",
					"top BE", "top JBE", "top IT", "top AE",
				}))
			})

			Context("when told to randomize all examples", func() {
				BeforeEach(func() {
					randomizeAllSpecs = true
				})

				It("does", func() {
					Ω(runOrder).Should(Equal([]string{
						"top BE", "top JBE", "top IT", "top AE",
						"top BE", "BE", "top JBE", "JBE", "inner IT", "AE", "top AE",
						"top BE", "BE", "top JBE", "JBE", "IT", "AE", "top AE",
						"top BE", "BE 2", "top JBE", "IT 2", "top AE",
					}))
				})
			})

			Describe("with ginkgo.parallel.total > 1", func() {
				BeforeEach(func() {
					parallelTotal = 2
					randomizeAllSpecs = true
				})

				Context("for one worker", func() {
					BeforeEach(func() {
						parallelNode = 1
					})

					It("should run a subset of tests", func() {
						Ω(runOrder).Should(Equal([]string{
							"top BE", "top JBE", "top IT", "top AE",
							"top BE", "BE", "top JBE", "JBE", "inner IT", "AE", "top AE",
						}))
					})
				})

				Context("for another worker", func() {
					BeforeEach(func() {
						parallelNode = 2
					})

					It("should run a (different) subset of tests", func() {
						Ω(runOrder).Should(Equal([]string{
							"top BE", "BE", "top JBE", "JBE", "IT", "AE", "top AE",
							"top BE", "BE 2", "top JBE", "IT 2", "top AE",
						}))
					})
				})
			})

			Context("when provided with a filter", func() {
				BeforeEach(func() {
					focusString = `inner|\d`
				})

				It("converts the filter to a regular expression and uses it to filter the running examples", func() {
					Ω(runOrder).Should(Equal([]string{
						"top BE", "BE", "top JBE", "JBE", "inner IT", "AE", "top AE",
						"top BE", "BE 2", "top JBE", "IT 2", "top AE",
					}))
				})
			})

			Context("when the specs pass", func() {
				It("doesn't report a failure", func() {
					Ω(fakeT.didFail).Should(BeFalse())
				})

				It("should return true", func() {
					Ω(runResult).Should(BeTrue())
				})
			})

			Context("when a spec fails", func() {
				var location types.CodeLocation
				BeforeEach(func() {
					specSuite.pushItNode("top level it", func() {
						location = types.GenerateCodeLocation(0)
						func() { specSuite.fail("oops!", 0) }()
					}, flagTypeNone, types.GenerateCodeLocation(0), 0)
				})

				It("should return false", func() {
					Ω(runResult).Should(BeFalse())
				})

				It("reports a failure", func() {
					Ω(fakeT.didFail).Should(BeTrue())
				})

				It("generates the correct failure data", func() {
					Ω(fakeR.ExampleSummaries[0].Failure.Message).Should(Equal("oops!"))
					Ω(fakeR.ExampleSummaries[0].Failure.Location.FileName).Should(Equal(location.FileName))
					Ω(fakeR.ExampleSummaries[0].Failure.Location.LineNumber).Should(Equal(location.LineNumber + 1))
				})
			})
		})
	})
}


text:
// Package k8sutil for Kubernetes helpers.
package k8sutil

import (
	"testing"
	"time"

	"github.com/stretchr/testify/assert"
	corev1 "k8s.io/api/core/v1"
	metav1 "k8s.io/apimachinery/pkg/apis/meta/v1"
	"k8s.io/client-go/tools/record"
)

func getEventsOccurences(channel chan string) map[string]int {

	foundEvents := make(map[string]int)

	for len(channel) > 0 {
		e := <-channel
		foundEvents[e]++
	}

	return foundEvents
}

func TestReportIfNotPresent(t *testing.T) {
	pod1 := &corev1.Pod{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "test-pod1",
			Namespace: "rook-ceph",
		},
	}

	pod2 := &corev1.Pod{
		ObjectMeta: metav1.ObjectMeta{
			Name:      "test-pod2",
			Namespace: "rook-ceph",
		},
	}

	testCases := []struct {
		eventReported                 int
		changeTime                    bool
		ReportAnotherEvent            bool
		ReportEventForDifferentObject bool
	}{
		{
			// verify ReportIfNotPresent is called once and event is reported once
			eventReported: 1,
		},
		{
			// verify ReportIfNotPresent is called twice and event is reported once
			eventReported: 2,
		},
		{
			// verify ReportIfNotPresent report same event again when event is not present on cluster
			eventReported: 1,
			changeTime:    true,
		},
		{
			// verify ReportIfNotPresent report same event again when event is not present on cluster
			eventReported: 2,
			changeTime:    true,
		},
		{
			// verify it report event "a" both the times if events came like "a", "b", "a"
			eventReported:      1,
			ReportAnotherEvent: true,
		},
		{
			// verify it report event "a" both the times if events came like "a", "b", "a"
			eventReported:      2,
			ReportAnotherEvent: true,
		},
		{
			// verify it does not report the same event for same objects if multiple objects come into the picture
			eventReported:                 1,
			ReportEventForDifferentObject: true,
		},
		{
			// verify it does not report the same event for same objects if multiple objects come into the picture
			eventReported:                 2,
			ReportEventForDifferentObject: true,
		},
	}

	for _, tc := range testCases {
		eventType, eventReason, eventMsg := corev1.EventTypeNormal, "Created", "Pod has been created"

		frecorder := record.NewFakeRecorder(1024)
		reporter := NewEventReporter(frecorder)

		for i := 0; i < tc.eventReported; i++ {
			reporter.ReportIfNotPresent(pod1, eventType, eventReason, eventMsg)
		}

		foundEvents := getEventsOccurences(frecorder.Events)
		assert.Equal(t, 1, foundEvents[eventType+" "+eventReason+" "+eventMsg])

		if tc.changeTime {
			nameSpacedName, err := getNameSpacedName(pod1)
			assert.NoError(t, err)
			ftime := reporter.lastReportedEventTime[nameSpacedName].Add(time.Minute * -60)
			reporter.lastReportedEventTime[nameSpacedName] = ftime

			reporter.ReportIfNotPresent(pod1, eventType, eventReason, eventMsg)
			foundEvents := getEventsOccurences(frecorder.Events)
			assert.Equal(t, 1, foundEvents[eventType+" "+eventReason+" "+eventMsg])
		}

		if tc.ReportAnotherEvent {
			reporter.ReportIfNotPresent(pod1, corev1.EventTypeWarning, eventReason, eventMsg)
			foundEvents := getEventsOccurences(frecorder.Events)
			assert.Equal(t, 1, foundEvents[corev1.EventTypeWarning+" "+eventReason+" "+eventMsg])

			reporter.ReportIfNotPresent(pod1, eventType, eventReason, eventMsg)
			foundEvents = getEventsOccurences(frecorder.Events)
			assert.Equal(t, 1, foundEvents[eventType+" "+eventReason+" "+eventMsg])
		}

		if tc.ReportEventForDifferentObject {
			reporter.ReportIfNotPresent(pod2, eventType, eventReason, eventMsg)
			foundEvents := getEventsOccurences(frecorder.Events)
			assert.Equal(t, 1, foundEvents[eventType+" "+eventReason+" "+eventMsg])

			reporter.ReportIfNotPresent(pod1, eventType, eventReason, eventMsg)
			foundEvents = getEventsOccurences(frecorder.Events)
			assert.Equal(t, 0, foundEvents[eventType+" "+eventReason+" "+eventMsg])
		}
	}
}


text:
class GuiScriptNotifyCtrl : public GuiControl
{
private:
   typedef GuiControl Parent;
public:

    /// @name Event Callbacks
    /// @{
   bool mOnChildAdded;         ///< Script Notify : onAddObject(%object)
   bool mOnChildRemoved;       ///< Script Notify : onRemoveObject(%object)
   bool mOnResize;             ///< Script Notify : onResize()
   bool mOnChildResized;       ///< Script Notify : onChildResized(%child)
   bool mOnParentResized;      ///< Script Notify : onParentResized()
   bool mOnLoseFirstResponder; ///< Script Notify : onLoseFirstResponder()
   bool mOnGainFirstResponder; ///< Script Notify : onGainFirstResponder()
    /// @}

public:
    /// @name Initialization
    /// @{
    DECLARE_CONOBJECT(GuiScriptNotifyCtrl);
    DECLARE_CATEGORY( "Gui Other Script" );
    DECLARE_DESCRIPTION( "A control that implements various script callbacks for\n"
                         "certain GUI events." );

    GuiScriptNotifyCtrl();
    virtual ~GuiScriptNotifyCtrl();
    static void initPersistFields();

    virtual bool resize(const Point2I &newPosition, const Point2I &newExtent);
    virtual void childResized(GuiScriptNotifyCtrl *child);
    virtual void parentResized(const RectI &oldParentRect, const RectI &newParentRect);
    virtual void onChildRemoved( GuiControl *child );
    virtual void onChildAdded( GuiControl *child );

	DECLARE_CALLBACK(void, onResize, (SimObjectId ID) );
	DECLARE_CALLBACK(void, onChildAdded, (SimObjectId ID, SimObjectId childID));
	DECLARE_CALLBACK(void, onChildRemoved, (SimObjectId ID, SimObjectId childID));
	DECLARE_CALLBACK(void, onChildResized, (SimObjectId ID, SimObjectId childID));
	DECLARE_CALLBACK(void, onParentResized, (SimObjectId ID));
	DECLARE_CALLBACK(void, onLoseFirstResponder, (SimObjectId ID));
	DECLARE_CALLBACK(void, onGainFirstResponder, (SimObjectId ID));

    //virtual void onMouseUp(const GuiEvent &event);
    //virtual void onMouseDown(const GuiEvent &event);
    //virtual void onMouseMove(const GuiEvent &event);
    //virtual void onMouseDragged(const GuiEvent &event);
    //virtual void onMouseEnter(const GuiEvent &event);
    //virtual void onMouseLeave(const GuiEvent &event);

    //virtual bool onMouseWheelUp(const GuiEvent &event);
    //virtual bool onMouseWheelDown(const GuiEvent &event);

    //virtual void onRightMouseDown(const GuiEvent &event);
    //virtual void onRightMouseUp(const GuiEvent &event);
    //virtual void onRightMouseDragged(const GuiEvent &event);

    //virtual void onMiddleMouseDown(const GuiEvent &event);
    //virtual void onMiddleMouseUp(const GuiEvent &event);
    //virtual void onMiddleMouseDragged(const GuiEvent &event);

    //virtual void onMouseDownEditor(const GuiEvent &event, Point2I offset);
    //virtual void onRightMouseDownEditor(const GuiEvent &event, Point2I offset);

    virtual void setFirstResponder(GuiControl *firstResponder);
    virtual void setFirstResponder();
    void clearFirstResponder();
    virtual void onLoseFirstResponder();

    //virtual void acceleratorKeyPress(U32 index);
    //virtual void acceleratorKeyRelease(U32 index);
    //virtual bool onKeyDown(const GuiEvent &event);
    //virtual bool onKeyUp(const GuiEvent &event);
    //virtual bool onKeyRepeat(const GuiEvent &event);

    virtual void onMessage(GuiScriptNotifyCtrl *sender, S32 msg);    ///< Receive a message from another control

    virtual void onDialogPush();
    virtual void onDialogPop();

};

#endif


text:
module TwitterBootstrapBuilder
  module Helpers
    module ButtonsHelper

      def link_button_to(*args, &block)
        Builders::LinkButtonBuilder.new(self, args: args, &block).html_safe
      end

      TwitterBootstrapMarkup::ButtonBase::TYPES.each do |type|
        define_method "link_button_#{type}_to" do |*args, &block|
          Builders::LinkButtonBuilder.new(self, args: args, type: type, &block).html_safe
        end

        TwitterBootstrapMarkup::ButtonBase::SIZES.each do |size|
          define_method "link_button_#{type}_#{size}_to" do |*args, &block|
            Builders::LinkButtonBuilder.new(self, args: args, type: type, size: size, &block).html_safe
          end
        end
      end

      TwitterBootstrapMarkup::ButtonBase::SIZES.each do |size|
        define_method "link_button_#{size}_to" do |*args, &block|
          Builders::LinkButtonBuilder.new(self, args: args, size: size, &block).html_safe
        end
      end

      def submit_button(*args, &block)
        Builders::SubmitButtonBuilder.new(self, args: args, &block).html_safe
      end

      TwitterBootstrapMarkup::ButtonBase::TYPES.each do |type|
        define_method "submit_button_#{type}" do |*args, &block|
          Builders::SubmitButtonBuilder.new(self, args: args, type: type, &block).html_safe
        end

        TwitterBootstrapMarkup::ButtonBase::SIZES.each do |size|
          define_method "submit_button_#{type}_#{size}" do |*args, &block|
            Builders::SubmitButtonBuilder.new(self, args: args, type: type, size: size, &block).html_safe
          end
        end
      end

      TwitterBootstrapMarkup::ButtonBase::SIZES.each do |size|
        define_method "submit_button_#{size}" do |*args, &block|
          Builders::SubmitButtonBuilder.new(self, args: args, size: size, &block).html_safe
        end
      end

    end
  end
end


text:
.borderonright {
  border-right: 1px solid grey;
}


text:
@implementation FSTParagonCookingStage

- (id) initWithCoder:(NSCoder *)aDecoder {

    if (self = [super init]) {
        _targetTemperature = [aDecoder decodeObjectForKey:@"target_temp"];
        _cookTimeMinimum = [aDecoder decodeObjectForKey:@"min_time"];
        _cookTimeMaximum = [aDecoder decodeObjectForKey:@"max_time"];
        _cookingLabel = [aDecoder decodeObjectForKey:@"cook_label"];
        _cookingPrepLabel = [aDecoder decodeObjectForKey:@"cook_prep_label"];
        _maxPowerLevel =[aDecoder decodeObjectForKey:@"power_level"];
        _automaticTransition = [aDecoder decodeObjectForKey:@"automatic_transition"];
    }

    return self;
}
- (instancetype)init
{
    self = [super init];
    if (self) {
        _targetTemperature = @0;
        _cookTimeMinimum = @0;
        _cookTimeMaximum = @0;
        _maxPowerLevel = @10;
        _cookingLabel = @"";
        _cookingPrepLabel = @"";
        _automaticTransition = @2;
    }
    return self;
}

-(void) encodeWithCoder:(NSCoder *)aCoder {
    [aCoder encodeObject:_targetTemperature forKey:@"target_temp"];
    [aCoder encodeObject:_cookTimeMinimum  forKey:@"min_time"];
    [aCoder encodeObject:_cookTimeMaximum  forKey:@"max_time"];
    [aCoder encodeObject:_cookingLabel forKey:@"cook_label"];
    [aCoder encodeObject:_cookingPrepLabel forKey:@"cook_prep_label"];
    [aCoder encodeObject:_maxPowerLevel forKey:@"power_level"];
    [aCoder encodeObject:_automaticTransition forKey:@"automatic_transition"];
}
@end