/* Chordata - .NET File Format Parser
 * Copyright (C) 2001-2002  Jay Freeman (saurik)
*/

/*
 *        Redistribution and use in source and binary
 * forms, with or without modification, are permitted
 * provided that the following conditions are met:
 * 
 * 1. Redistributions of source code must retain the
 *    above copyright notice, this list of conditions
 *    and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the
 *    above copyright notice, this list of conditions
 *    and the following disclaimer in the documentation
 *    and/or other materials provided with the
 *    distribution.
 * 3. The name of the author may not be used to endorse
 *    or promote products derived from this software
 *    without specific prior written permission.
 * 
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS''
 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING,
 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
 * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
 * TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

#include "stdafx.h"
#include "chordata/ParseData.h"

namespace Chordata {
namespace ParseData {

namespace CodedTokens {

namespace Codes {

uint32_t TypeDefOrRef[] = {
	0x02000000, 0x01000000, 0x1b000000
};

uint32_t HasConstant[] = {
	0x04000000, 0x08000000, 0x17000000
};

uint32_t HasCustomAttribute[] = {
	0x06000000, 0x04000000, 0x01000000, 0x02000000, 0x08000000, 0x09000000, 0x0a000000,
	0x00000000, 0x0e000000, 0x17000000, 0x14000000, 0x11000000, 0x1a000000, 0x1b000000,
	0x20000000, 0x23000000, 0x26000000, 0x27000000, 0x28000000 //XXX: , 0x29000000, 0x2a000000
};

uint32_t HasFieldMarshal[] = {
	0x04000000, 0x08000000
};

uint32_t HasDeclSecurity[] = {
	0x02000000, 0x06000000, 0x20000000
};

uint32_t MemberRefParent[] = {
    0x0, 0x02000000, 0x00000000, 0x06000000, 0x1b000000
};

uint32_t HasSemantic[] = {
	0x14000000, 0x17000000
};

uint32_t MethodDefOrRef[] = {
    0x06000000, 0x0a000000
};

uint32_t MemberForwarded[] = {
    0x04000000, 0x06000000
};

uint32_t Implementation[] = {
	0x26000000, 0x23000000, 0x27000000
};

uint32_t CustomAttributeType[] = {
	0x0, 0x0, 0x06000000, 0x0a000000, 0x0
};

uint32_t ResolutionScope[] = {
	0x00000000, 0x1a000000, 0x23000000, 0x01000000
};

}

Code TypeDefOrRef = {"TypeDefOrRef", 2, Codes::TypeDefOrRef};
Code HasConstant = {"HasConstant", 3, Codes::HasConstant};
Code HasCustomValue = {"HasCustomAttribute", 21, Codes::HasCustomAttribute};
Code HasFieldMarshal = {"HasFieldMarshal", 2, Codes::HasFieldMarshal};
Code HasDeclSecurity = {"HasDeclSecurity", 3, Codes::HasDeclSecurity};
Code MemberRefParent = {"MemberRefParent", 5, Codes::MemberRefParent};
Code HasSemantic = {"HasSemantic", 2, Codes::HasSemantic};
Code MethodDefOrRef = {"MethodDefOrRef", 2, Codes::MethodDefOrRef};
Code MemberForwarded = {"MemberForwarded", 2, Codes::MemberForwarded};
Code Implementation = {"Implementation", 3, Codes::Implementation};
Code CustomValueType = {"CustomAttributeType", 5, Codes::CustomAttributeType};
Code ResolutionScope = {"ResolutionScope", 4, Codes::ResolutionScope};

}

const Code *Coded[12] = {
	&CodedTokens::TypeDefOrRef,
	&CodedTokens::HasConstant,
	&CodedTokens::HasCustomValue,
	&CodedTokens::HasFieldMarshal,
	&CodedTokens::HasDeclSecurity,
	&CodedTokens::MemberRefParent,
	&CodedTokens::HasSemantic,
	&CodedTokens::MethodDefOrRef,
	&CodedTokens::MemberForwarded,
	&CodedTokens::Implementation,
	&CodedTokens::CustomValueType,
	&CodedTokens::ResolutionScope
};

} }