/* 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.
*/

#ifndef CHORDATA_TOKENS_H
#define CHORDATA_TOKENS_H

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "menes-com/String.h"

namespace Chordata {

//     Note to self:  If you get a really
// strange error here, you included <corhdr.h>.

static const cstr_t		COR_CTOR_METHOD_NAME	= ".ctor";
static const wcstr_t	COR_CTOR_METHOD_NAME_W	= L".ctor";
static const cstr_t		COR_CCTOR_METHOD_NAME	= ".cctor";
static const wcstr_t	COR_CCTOR_METHOD_NAME_W	= L".cctor";
	
typedef uint32_t Token;

namespace Tokens {

static const Token NilToken = 0;

typedef Token mdToken;

typedef Token mdAssembly;
typedef Token mdAssemblyRef;
typedef Token mdCPToken;
typedef Token mdCustomAttribute;
typedef Token mdEvent;
typedef Token mdExportedType;
typedef Token mdFieldDef;
typedef Token mdFile;
typedef Token mdInterfaceImpl;
typedef Token mdManifestResource;
typedef Token mdMemberRef;
typedef Token mdMethodDef;
typedef Token mdModule;
typedef Token mdModuleRef;
typedef Token mdParamDef;
typedef Token mdPermission;
typedef Token mdProperty;
typedef Token mdSignature;
typedef Token mdString;
typedef Token mdToken;
typedef Token mdTypeDef;
typedef Token mdTypeRef;
typedef Token mdTypeSpec;

enum CorTokenType {
    mdtModule               = 0x00000000,
    mdtTypeRef              = 0x01000000,
    mdtTypeDef              = 0x02000000,
    mdtFieldDef             = 0x04000000,
    mdtMethodDef            = 0x06000000,
    mdtParamDef             = 0x08000000,
    mdtInterfaceImpl        = 0x09000000,
    mdtMemberRef            = 0x0a000000,
    mdtCustomAttribute      = 0x0c000000,
    mdtPermission           = 0x0e000000,
    mdtSignature            = 0x11000000,
    mdtEvent                = 0x14000000,
    mdtProperty             = 0x17000000,
    mdtModuleRef            = 0x1a000000,
    mdtTypeSpec             = 0x1b000000,
    mdtAssembly             = 0x20000000,
    mdtAssemblyRef          = 0x23000000,
    mdtFile                 = 0x26000000,
    mdtExportedType         = 0x27000000,
    mdtManifestResource     = 0x28000000,

    mdtString               = 0x70000000,
    mdtName                 = 0x71000000,
    mdtBaseType             = 0x72000000

	/* // Extraneous...
	mdtFieldPtr				= 0x03000000,
	mdtMethodPtr			= 0x05000000,
	mdtParamPtr				= 0x07000000,
	mdtConstant				= 0x0b000000,
	mdtFieldMarshal			= 0x0d000000,
	mdtPermission			= 0x0e000000,
	mdtClassLayout			= 0x0f000000,
	mdtFieldLayout			= 0x10000000,
	mdtEventMap				= 0x12000000,
	mdtEventPtr				= 0x13000000,
	mdtPropertyMap			= 0x15000000,
	mdtPropertyPtr			= 0x16000000,
	mdtMethodSemantics		= 0x18000000,
	mdtMethodImpl			= 0x19000000,
	mdtImplMap				= 0x1c000000,
	mdtFieldRVA				= 0x1d000000,
	mdtENCLog				= 0x1e000000,
	mdtENCMap				= 0x1f000000,
	mdtAssemblyProcessor	= 0x21000000,
	mdtAssemblyOS			= 0x22000000,
	mdtAssemblyRefProcessor	= 0x24000000,
	mdtAssemblyRefOS		= 0x25000000,
	mdtExecutionLocation	= 0x29000000,
	mdtSourceFile			= 0x2a000000,
	mdtBlock				= 0x2b000000,
	mdtLocalVarScope		= 0x2c000000,
	mdtLocalVar				= 0x2d000000,
	mdtNestedClass			= 0x2e000000,*/
};

} }

#endif//CHORDATA_TOKENS_H