Index: /trunk/abdev/BasicCompiler_Common/include/ClassImpl.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/ClassImpl.h	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/include/ClassImpl.h	(revision 184)
@@ -0,0 +1,45 @@
+#pragma once
+
+#include <jenga/include/smoothie/Class.h>
+
+class ClassImpl: public CClass
+{
+public:
+	ClassImpl( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name )
+		: CClass( namespaceScopes, importedNamespaces, name )
+	{
+	}
+
+	//継承させる
+	virtual bool Inherits( const char *inheritNames, int nowLine );
+	virtual bool InheritsClass( const CClass &inheritsClass, int nowLine );
+	virtual bool InheritsInterface( const CClass &inheritsClass, int nowLine );
+
+	//メンバ、メソッドの追加
+	CMember *CreateMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
+	virtual void AddMember( Prototype::Accessibility accessibility, bool idConst, bool isRef, char *buffer, int nowLine );
+	virtual void AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine );
+
+	virtual void AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
+		bool isVirtual, bool isOverride, char *buffer, int nowLine);
+
+	virtual LONG_PTR GetVtblGlobalOffset(void) const;
+	virtual void ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection);
+};
+
+class ClassesImpl : public Classes
+{
+public:
+	virtual CClass *Create( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name);
+	virtual void CollectClassesForNameOnly( const BasicSource &source );
+
+	virtual void InitStaticMember();
+
+private:
+	bool MemberVar_LoopRefCheck(const CClass &objClass);
+public:
+	virtual void GetClass_recur(const char *lpszInheritsClass);
+	virtual void GetAllClassInfo();
+	virtual void Compile_System_InitializeUserTypes();
+
+};
Index: /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/include/CodeGenerator.h	(revision 184)
@@ -0,0 +1,15 @@
+#pragma once
+
+#include <DataTable.h>
+
+void ReallocNativeCodeBuffer();
+
+class NativeCode
+{
+	DataTable dataTable;
+public:
+	DataTable &GetDataTable()
+	{
+		return dataTable;
+	}
+};
Index: /trunk/abdev/BasicCompiler_Common/include/Compiler.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/Compiler.h	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/include/Compiler.h	(revision 184)
@@ -0,0 +1,12 @@
+#pragma once
+
+#include <CodeGenerator.h>
+class Compiler
+{
+	static NativeCode nativeCode;
+public:
+	static NativeCode &GetNativeCode()
+	{
+		return nativeCode;
+	}
+};
Index: /trunk/abdev/BasicCompiler_Common/include/DataTable.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/DataTable.h	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/include/DataTable.h	(revision 184)
@@ -0,0 +1,23 @@
+#pragma once
+
+//DataTable.cpp
+class DataTable{
+	void *pdata;
+	int size;
+
+public:
+	DataTable();
+	~DataTable();
+	void Init();
+
+	int AddBinary( const void *pdata, int size );
+	int Add( _int64 i64data );
+	int Add( int i32data );
+	int Add( double dbl );
+	int Add( float flt );
+	int AddString( const char *str, int length );
+	int AddString( const char *str );
+
+	const void *GetPtr() const;
+	int GetSize() const;
+};
Index: /trunk/abdev/BasicCompiler_Common/include/LexicalScopingImpl.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/LexicalScopingImpl.h	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/include/LexicalScopingImpl.h	(revision 184)
@@ -0,0 +1,35 @@
+#pragma once
+
+#include <jenga/include/smoothie/Smoothie.h>
+#include <jenga/include/smoothie/LexicalScoping.h>
+
+class ScopeImpl : public CScope
+{
+public:
+	ScopeImpl( int level, int addr, SCOPE_TYPE TypeOfStatement )
+		: CScope( level, addr, TypeOfStatement )
+	{
+	}
+	~ScopeImpl();
+
+	virtual void Break();
+	virtual void RunScheduleOfBreak();
+};
+
+class LexicalScopesImpl : public CLexicalScopes
+{
+	virtual CScope *CreateScope( int level, int addr, SCOPE_TYPE TypeOfStatement )
+	{
+		return new ScopeImpl( level, addr, TypeOfStatement );
+	}
+
+public:
+
+	//スコープ終了時のデストラクタ呼び出し
+	virtual void CallDestructorsOfScopeEnd();
+
+	//Returnステートメント用のデストラクタ呼び出し
+	virtual void CallDestructorsOfReturn( int BaseLevel = 0 );
+};
+
+LexicalScopesImpl &GetLexicalScopes();
Index: /trunk/abdev/BasicCompiler_Common/include/ProcedureImpl.h
===================================================================
--- /trunk/abdev/BasicCompiler_Common/include/ProcedureImpl.h	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/include/ProcedureImpl.h	(revision 184)
@@ -0,0 +1,78 @@
+#pragma once
+
+#include <jenga/include/smoothie/Procedure.h>
+
+
+class UserProcImpl : public UserProc
+{
+public:
+	UserProcImpl( const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport )
+		: UserProc( name, kind, isMacro, isCdecl, isExport )
+	{
+	}
+	virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine, bool isStatic );
+};
+
+class GlobalProc : public UserProcImpl
+{
+	const NamespaceScopes namespaceScopes;
+	const NamespaceScopesCollection importedNamespaces;
+public:
+	// ハッシュリスト用
+	GlobalProc *pNextData;
+
+	GlobalProc( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const string &name, Kind kind, bool isMacro, bool isCdecl, bool isExport ):
+	  UserProcImpl( name, kind, isMacro, isCdecl, isExport ),
+	  namespaceScopes( namespaceScopes ),
+	  importedNamespaces( importedNamespaces ),
+	  pNextData( NULL )
+	{}
+	~GlobalProc(){}
+
+	virtual const NamespaceScopes &GetNamespaceScopes() const;
+	virtual const NamespaceScopesCollection &GetImportedNamespaces() const
+	{
+		return importedNamespaces;
+	}
+
+	virtual bool IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const;
+	virtual bool IsEqualSymbol( const GlobalProc &globalProc ) const;
+	virtual bool IsEqualSymbol( const string &name ) const;
+};
+
+class DllProcImpl : public DllProc
+{
+public:
+	DllProcImpl( const NamespaceScopes &namespaceScopes, const string &name, Kind kind, bool isCdecl, const string &dllFileName, const string &alias )
+		: DllProc( namespaceScopes, name, kind, isCdecl, dllFileName, alias )
+	{
+	}
+
+	virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine );
+};
+
+class ProcPointerImpl : public ProcPointer
+{
+public:
+	ProcPointerImpl( Kind kind ):
+	  ProcPointer( kind )
+	{
+	}
+
+	virtual bool SetParamsAndReturnType( const char *sourceOfParams, int nowLine );
+};
+
+class ProcPointersImpl : public ProcPointers
+{
+public:
+	ProcPointersImpl()
+	{
+	}
+	~ProcPointersImpl()
+	{
+		Clear();
+	}
+
+	virtual int Add( const string &typeExpression );
+	virtual void Clear();
+};
Index: /trunk/abdev/BasicCompiler_Common/src/ClassImpl.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/ClassImpl.cpp	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/src/ClassImpl.cpp	(revision 184)
@@ -0,0 +1,1284 @@
+#include <jenga/include/smoothie/Smoothie.h>
+#include <jenga/include/smoothie/Class.h>
+#include <jenga/include/smoothie/Source.h>
+#include <jenga/include/smoothie/SmoothieException.h>
+#include <jenga/include/smoothie/LexicalAnalysis.h>
+
+#include <ClassImpl.h>
+#include <Compiler.h>
+
+#include "../common.h"
+#ifdef _AMD64_
+#include "../../BasicCompiler64/opcode.h"
+#else
+#include "../../BasicCompiler32/opcode.h"
+#endif
+
+
+
+
+class CLoopRefCheck{
+	char **names;
+	int num;
+	void init(){
+		int i;
+		for(i=0;i<num;i++){
+			free(names[i]);
+		}
+		free(names);
+	}
+public:
+	CLoopRefCheck()
+	{
+		names=(char **)malloc(1);
+		num=0;
+	}
+	~CLoopRefCheck()
+	{
+		init();
+	}
+	void add(const char *lpszInheritsClass)
+	{
+		names=(char **)realloc(names,(num+1)*sizeof(char *));
+		names[num]=(char *)malloc(lstrlen(lpszInheritsClass)+1);
+		lstrcpy(names[num],lpszInheritsClass);
+		num++;
+	}
+	void del(const char *lpszInheritsClass)
+	{
+		int i;
+		for(i=0;i<num;i++){
+			if(lstrcmp(names[i],lpszInheritsClass)==0){
+				free(names[i]);
+				break;
+			}
+		}
+		if(i!=num){
+			num--;
+			for(;i<num;i++){
+				names[i]=names[i+1];
+			}
+		}
+	}
+	BOOL check(const CClass &inheritsClass) const
+	{
+		//ループ継承チェック
+		int i;
+		for(i=0;i<num;i++){
+			if( inheritsClass.GetName() == names[i] ){
+				return 1;
+			}
+		}
+		return 0;
+	}
+};
+CLoopRefCheck *pobj_LoopRefCheck;
+
+
+bool ClassImpl::Inherits( const char *inheritNames, int nowLine ){
+	int i = 0;
+	bool isInheritsClass = false;
+	while( true ){
+
+		char temporary[VN_SIZE];
+		for( int i2=0;; i++, i2++ ){
+			if( inheritNames[i] == '\0' || inheritNames[i] == ',' ){
+				temporary[i2] = 0;
+				break;
+			}
+			temporary[i2] = inheritNames[i];
+		}
+
+		//継承元クラスを取得
+		const CClass *pInheritsClass = Smoothie::GetMeta().GetClasses().Find(temporary);
+		if( !pInheritsClass ){
+			throw SmoothieException(106,temporary,nowLine);
+			return false;
+		}
+
+		if( pInheritsClass->IsInterface() ){
+			// インターフェイスはあとで継承する
+		}
+		else if( pInheritsClass->IsClass() ){
+			// クラスを継承する
+			isInheritsClass = true;
+
+			if( !InheritsClass( *pInheritsClass, nowLine ) ){
+				return false;
+			}
+		}
+		else{
+			throw SmoothieException(135,NULL,nowLine);
+			return false;
+		}
+
+		if( inheritNames[i] == '\0' ){
+			break;
+		}
+		i++;
+	}
+
+	if( !isInheritsClass ){
+		// クラスを一つも継承していないとき
+		const CClass *pObjectClass = Smoothie::GetMeta().GetClasses().Find("Object");
+		if( !pObjectClass ){
+			throw SmoothieException(106,"Object",i);
+			return false;
+		}
+
+		if( !InheritsClass( *pObjectClass, nowLine ) ){
+			return false;
+		}
+	}
+
+	i=0;
+	while( true ){
+
+		char temporary[VN_SIZE];
+		for( int i2=0;; i++, i2++ ){
+			if( inheritNames[i] == '\0' || inheritNames[i] == ',' ){
+				temporary[i2] = 0;
+				break;
+			}
+			temporary[i2] = inheritNames[i];
+		}
+
+		//継承元クラスを取得
+		const CClass *pInheritsClass = Smoothie::GetMeta().GetClasses().Find(temporary);
+		if( !pInheritsClass ){
+			throw SmoothieException(106,temporary,nowLine);
+			return false;
+		}
+
+		if( pInheritsClass->IsInterface() ){
+			// インターフェイスを継承する
+			if( !InheritsInterface( *pInheritsClass, nowLine ) ){
+				return false;
+			}
+		}
+		else if( pInheritsClass->IsClass() ){
+			// クラスはさっき継承した
+		}
+		else{
+			throw SmoothieException(135,NULL,nowLine);
+			return false;
+		}
+
+		if( inheritNames[i] == '\0' ){
+			break;
+		}
+		i++;
+	}
+
+	return true;
+}
+bool ClassImpl::InheritsClass( const CClass &inheritsClass, int nowLine ){
+
+	//ループ継承でないかをチェック
+	if(pobj_LoopRefCheck->check(inheritsClass)){
+		throw SmoothieException(123,inheritsClass.GetName(),nowLine);
+		return false;
+	}
+
+	if( !inheritsClass.IsReady() ){
+		//継承先が読み取られていないとき
+		pobj_LoopRefCheck->add(this->GetName().c_str());
+		Smoothie::GetMeta().GetClasses().GetClass_recur(inheritsClass.GetName().c_str());
+		pobj_LoopRefCheck->del(this->GetName().c_str());
+	}
+
+	//メンバをコピー
+	BOOST_FOREACH( CMember *inheritsClassDynamicMember, inheritsClass.GetDynamicMembers() ){
+		CMember *pMember = new CMember( *inheritsClassDynamicMember );
+
+		// アクセシビリティ
+		if( inheritsClassDynamicMember->IsPrivate() ){
+			pMember->SetAccessibility( Prototype::None );
+		}
+		else{
+			pMember->SetAccessibility( inheritsClassDynamicMember->GetAccessibility() );
+		}
+
+		dynamicMembers.push_back( pMember );
+	}
+
+	//メソッドをコピー
+	BOOST_FOREACH( const CMethod *pBaseMethod, inheritsClass.GetMethods() ){
+		CMethod *pMethod = new DynamicMethod( *pBaseMethod );
+
+		// アクセシビリティ
+		if(pBaseMethod->GetAccessibility() == Prototype::Private){
+			pMethod->SetAccessibility( Prototype::None );
+		}
+		else{
+			pMethod->SetAccessibility( pBaseMethod->GetAccessibility() );
+		}
+
+		//pobj_Inherits
+		// ※継承元のClassIndexをセット（入れ子継承を考慮する）
+		if(pBaseMethod->GetInheritsClassPtr()==0){
+			pMethod->SetInheritsClassPtr( &inheritsClass );
+		}
+		else{
+			pMethod->SetInheritsClassPtr( pBaseMethod->GetInheritsClassPtr() );
+		}
+
+		methods.push_back( pMethod );
+	}
+
+	//仮想関数の数
+	AddVtblNum( inheritsClass.GetVtblNum() );
+
+	//継承先のクラスをメンバとして保持する
+	pobj_InheritsClass = &inheritsClass;
+
+	return true;
+}
+bool ClassImpl::InheritsInterface( const CClass &inheritsInterface, int nowLine ){
+
+	//ループ継承でないかをチェック
+	if(pobj_LoopRefCheck->check(inheritsInterface)){
+		throw SmoothieException(123,inheritsInterface.GetName(),nowLine);
+		return false;
+	}
+
+	if( !inheritsInterface.IsReady() ){
+		//継承先が読み取られていないとき
+		pobj_LoopRefCheck->add(this->GetName().c_str());
+		Smoothie::GetMeta().GetClasses().GetClass_recur(inheritsInterface.GetName().c_str());
+		pobj_LoopRefCheck->del(this->GetName().c_str());
+	}
+
+	//メソッドをコピー
+	BOOST_FOREACH( const CMethod *pBaseMethod, inheritsInterface.GetMethods() ){
+		CMethod *pMethod = new DynamicMethod( *pBaseMethod );
+
+		// アクセシビリティ
+		if(pBaseMethod->GetAccessibility() == Prototype::Private){
+			pMethod->SetAccessibility( Prototype::None );
+		}
+		else{
+			pMethod->SetAccessibility( pBaseMethod->GetAccessibility() );
+		}
+
+		//pobj_Inherits
+		// ※継承元のClassIndexをセット（入れ子継承を考慮する）
+		if(pBaseMethod->GetInheritsClassPtr()==0){
+			pMethod->SetInheritsClassPtr( &inheritsInterface );
+		}
+		else{
+			pMethod->SetInheritsClassPtr( pBaseMethod->GetInheritsClassPtr() );
+		}
+
+		methods.push_back( pMethod );
+	}
+
+	interfaces.push_back( InheritedInterface( const_cast<CClass *>(&inheritsInterface), vtblNum ) );
+
+	//仮想関数の数
+	AddVtblNum( inheritsInterface.GetVtblNum() );
+
+	return true;
+}
+CMember *ClassImpl::CreateMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine )
+{
+	extern int cp;
+
+	//構文を解析
+	char VarName[VN_SIZE];
+	char initBuffer[VN_SIZE];
+	char lpszConstructParameter[VN_SIZE];
+	int SubScripts[MAX_ARRAYDIM];
+	Type type;
+	GetDimentionFormat(buffer,VarName,SubScripts,type,initBuffer,lpszConstructParameter);
+
+	//重複チェック
+	if(this->DupliCheckAll(VarName)){
+		SetError(15,VarName,cp);
+	}
+
+	CMember *pMember = new CMember( accessibility, VarName, type, isConst, initBuffer, lpszConstructParameter );
+	pMember->source_code_address = nowLine;
+	memcpy( pMember->SubScripts, SubScripts, MAX_ARRAYDIM * sizeof(int) );
+	return pMember;
+}
+void ClassImpl::AddMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){
+	dynamicMembers.push_back(
+		CreateMember( accessibility, isConst, isRef, buffer, nowLine )
+	);
+}
+void ClassImpl::AddStaticMember( Prototype::Accessibility accessibility, bool isConst, bool isRef, char *buffer, int nowLine ){
+	staticMembers.push_back(
+		CreateMember( accessibility, isConst, isRef, buffer, nowLine )
+	);
+}
+
+void ClassImpl::AddMethod(CClass *pobj_c, Prototype::Accessibility accessibility, BOOL bStatic, bool isConst, bool isAbstract,
+						 bool isVirtual, bool isOverride, char *buffer, int nowLine){
+	int i,i2;
+	char temporary[VN_SIZE];
+
+	i=2;
+	for(i2=0;;i++,i2++){
+		if(buffer[i]=='('||buffer[i]=='\0'){
+			temporary[i2]=0;
+			break;
+		}
+		temporary[i2]=buffer[i];
+	}
+
+
+	//関数ハッシュへ登録
+	GlobalProc *pUserProc;
+	pUserProc=AddSubData( NamespaceScopes(), NamespaceScopesCollection(), buffer,nowLine,isVirtual,pobj_c, (bStatic!=0) );
+	if(!pUserProc) return;
+
+
+	////////////////////////////////////////////////////////////
+	// コンストラクタ、デストラクタの場合の処理
+	////////////////////////////////////////////////////////////
+	BOOL fConstructor=0,bDestructor=0;
+
+	if(lstrcmp(temporary,pobj_c->GetName().c_str())==0){
+		//コンストラクタの場合
+
+		//標準コンストラクタ（引数なし）
+		if(pUserProc->Params().size()==0) fConstructor=1;
+
+		//強制的にConst修飾子をつける
+		isConst = true;
+	}
+	else if(temporary[0]=='~'){
+		//デストラクタの場合はその名前が正しいかチェックを行う
+		if(lstrcmp(temporary+1,pobj_c->GetName().c_str())!=0)
+			SetError(117,NULL,nowLine);
+		else
+			bDestructor=1;
+	}
+	if(fConstructor||bDestructor){
+		// コンストラクタ、デストラクタのアクセシビリティをチェック
+
+		//強制的にConst修飾子をつける
+		isConst = true;
+	}
+
+	if( fConstructor == 1 )
+		pobj_c->SetConstructorMemberSubIndex( (int)pobj_c->GetMethods().size() );
+	else if( bDestructor )
+		pobj_c->SetDestructorMemberSubIndex( (int)pobj_c->GetMethods().size() );
+
+
+
+	//////////////////
+	// 重複チェック
+	//////////////////
+
+	if(pobj_c->DupliCheckMember(temporary)){
+		SetError(15,temporary,nowLine);
+		return;
+	}
+
+	//メソッド
+	BOOST_FOREACH( const CMethod *pMethod, pobj_c->GetMethods() ){
+		//基底クラスと重複する場合はオーバーライドを行う
+		if( pMethod->GetInheritsClassPtr() ) continue;
+
+		if( pMethod->pUserProc->GetName() == temporary ){
+			if( pMethod->pUserProc->Params().Equals( pUserProc->Params() ) ){
+				//関数名、パラメータ属性が合致したとき
+				SetError(15,pUserProc->GetName().c_str(),nowLine);
+				return;
+			}
+		}
+	}
+
+	//仮想関数の場合
+	if( isAbstract ) pUserProc->CompleteCompile();
+
+	//メソッドのオーバーライド
+	BOOST_FOREACH( CMethod *pMethod, pobj_c->GetMethods() ){
+		if( pMethod->pUserProc->GetName() == temporary ){
+			if( pMethod->pUserProc->Params().Equals( pUserProc->Params() ) ){
+
+				if(pMethod->IsVirtual()){
+					//メンバ関数を上書き
+					pMethod->pUserProc=pUserProc;
+					pMethod->Override();
+
+					if( !isOverride ){
+						SetError(127,NULL,nowLine);
+					}
+					if(pMethod->GetAccessibility() != accessibility ){
+						SetError(128,NULL,nowLine);
+					}
+
+					pUserProc->SetMethod( pMethod );
+					return;
+				}
+			}
+		}
+	}
+
+	if( isVirtual ){
+		pobj_c->AddVtblNum( 1 );
+	}
+
+	if( isOverride ){
+		SetError(12,"Override",nowLine);
+	}
+
+	if(bStatic){
+		pobj_c->GetStaticMethods().AddStatic( pUserProc, accessibility );
+	}
+	else{
+		pobj_c->GetMethods().Add(pUserProc, accessibility, isConst, isAbstract, isVirtual);
+	}
+}
+
+LONG_PTR ClassImpl::GetVtblGlobalOffset(void) const
+{
+
+	//既に存在する場合はそれを返す
+	if(vtbl_offset!=-1) return vtbl_offset;
+
+
+
+	//////////////////////////////////////
+	// 存在しないときは新たに生成する
+	//////////////////////////////////////
+
+	UserProc **ppsi;
+	ppsi=(UserProc **)malloc(GetVtblNum()*sizeof(UserProc *));
+
+	//関数テーブルに値をセット
+	int i2 = 0;
+	BOOST_FOREACH( const CMethod *pMethod, methods ){
+		if(pMethod->IsVirtual()){
+			pMethod->pUserProc->Using();
+
+			if(pMethod->IsAbstract()){
+				extern int cp;
+				throw SmoothieException(300,NULL,cp);
+
+				ppsi[i2]=0;
+			}
+			else{
+				ppsi[i2]=pMethod->pUserProc;
+			}
+			i2++;
+		}
+	}
+
+	vtbl_offset=Compiler::GetNativeCode().GetDataTable().AddBinary((void *)ppsi,GetVtblNum()*sizeof(LONG_PTR));
+
+	for( int i=0; i < GetVtblNum(); i++ ){
+		pobj_Reloc->AddSchedule_DataSection(vtbl_offset+i*sizeof(LONG_PTR));
+	}
+
+	free(ppsi);
+
+	return vtbl_offset;
+}
+void ClassImpl::ActionVtblSchedule(LONG_PTR ImageBase, LONG_PTR MemPos_CodeSection){
+	if(vtbl_offset==-1) return;
+
+	LONG_PTR *pVtbl;
+	pVtbl=(LONG_PTR *)((char *)Compiler::GetNativeCode().GetDataTable().GetPtr()+vtbl_offset);
+
+	int i;
+	for(i=0;i<GetVtblNum();i++){
+		UserProc *pUserProc;
+		pUserProc=(UserProc *)pVtbl[i];
+		if(!pUserProc) continue;
+		pVtbl[i]=pUserProc->beginOpAddress+ImageBase+MemPos_CodeSection;
+	}
+}
+
+CClass *ClassesImpl::Create( const NamespaceScopes &namespaceScopes, const NamespaceScopesCollection &importedNamespaces, const char *name){
+	return new ClassImpl(namespaceScopes, importedNamespaces, name);
+}
+
+void ClassesImpl::CollectClassesForNameOnly( const BasicSource &source )
+{
+	int i, i2;
+	char temporary[VN_SIZE];
+
+	// Blittable型管理オブジェクトを初期化
+	Smoothie::GetMeta().blittableTypes.clear();
+
+	// 名前空間管理
+	NamespaceScopes &namespaceScopes = Smoothie::Temp::liveingNamespaceScopes;
+	namespaceScopes.clear();
+
+	// Importsされた名前空間の管理
+	NamespaceScopesCollection &importedNamespaces = Smoothie::Temp::importedNamespaces;
+	importedNamespaces.clear();
+
+	for(i=0;;i++){
+		if(source[i]=='\0') break;
+
+		if( source[i] == 1 && source[i+1] == ESC_NAMESPACE ){
+			for(i+=2,i2=0;;i2++,i++){
+				if( IsCommandDelimitation( source[i] ) ){
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=source[i];
+			}
+			namespaceScopes.push_back( temporary );
+
+			continue;
+		}
+		else if( source[i] == 1 && source[i+1] == ESC_ENDNAMESPACE ){
+			if( namespaceScopes.size() <= 0 ){
+				throw SmoothieException(12, "End Namespace", i );
+			}
+			else{
+				namespaceScopes.pop_back();
+			}
+
+			i += 2;
+			continue;
+		}
+		else if( source[i] == 1 && source[i+1] == ESC_IMPORTS ){
+			for(i+=2,i2=0;;i2++,i++){
+				if( IsCommandDelimitation( source[i] ) ){
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=source[i];
+			}
+			if( !importedNamespaces.Imports( temporary ) )
+			{
+				throw SmoothieException(64,temporary,i );
+			}
+
+			continue;
+		}
+		else if( source[i] == 1 && source[i+1] == ESC_CLEARNAMESPACEIMPORTED ){
+			importedNamespaces.clear();
+			continue;
+		}
+
+		if(source[i]==1&&(
+			source[i+1]==ESC_CLASS||
+			source[i+1]==ESC_TYPE||
+			source[i+1]==ESC_INTERFACE
+			)){
+				int nowLine;
+				nowLine=i;
+
+				i+=2;
+				Type blittableType;
+				if(memicmp(source.GetBuffer()+i,"Align(",6)==0){
+					//アラインメント修飾子
+					i+=6;
+					i=JumpStringInPare(source.GetBuffer(),i)+1;
+				}
+				else if( memicmp( source.GetBuffer() + i, "Blittable(", 10 ) == 0 ){
+					// Blittable修飾子
+					i+=10;
+					i+=GetStringInPare_RemovePare(temporary,source.GetBuffer()+i)+1;
+					Type::StringToType( temporary, blittableType );
+				}
+
+				bool isEnum = false;
+				if( source[i] == 1 && source[i+1] == ESC_ENUM ){
+					// 列挙型の場合
+					isEnum = true;
+
+					i+=2;
+				}
+
+				int i2;
+				char temporary[VN_SIZE];
+				for(i2=0;;i++,i2++){
+					if(!IsVariableChar(source[i])){
+						temporary[i2]=0;
+						break;
+					}
+					temporary[i2]=source[i];
+				}
+
+				//クラスを追加
+				CClass *pClass = this->Add(namespaceScopes, importedNamespaces, temporary,nowLine);
+				if( pClass ){
+					if( source[nowLine+1] == ESC_CLASS ){
+						if( isEnum ){
+							pClass->SetClassType( CClass::Enum );
+						}
+						else{
+							pClass->SetClassType( CClass::Class );
+						}
+					}
+					else if( source[nowLine+1] == ESC_INTERFACE ){
+						pClass->SetClassType( CClass::Interface );
+					}
+					else{
+						pClass->SetClassType( CClass::Structure );
+					}
+				}
+
+				// Blittable型の場合
+				if( !blittableType.IsNull() ){
+					pClass->SetBlittableType( blittableType );
+
+					// Blittable型として登録
+					Smoothie::GetMeta().blittableTypes.push_back( BlittableType( blittableType, pClass ) );
+				}
+		}
+	}
+}
+
+void ClassesImpl::InitStaticMember(){
+	//静的メンバをグローバル領域に作成
+
+	//イテレータをリセット
+	this->Iterator_Reset();
+
+	extern int cp;
+	int back_cp=cp;
+
+	while(this->Iterator_HasNext()){
+		CClass &objClass = *this->Iterator_GetNext();
+
+		// 名前空間をセット
+		Smoothie::Temp::liveingNamespaceScopes = objClass.GetNamespaceScopes();
+
+		int i=0;
+		BOOST_FOREACH( CMember *member, objClass.GetStaticMembers() ){
+			char temporary[VN_SIZE];
+			sprintf(temporary,"%s.%s",objClass.GetName().c_str(),member->GetName().c_str());
+			dim(
+				temporary,
+				member->SubScripts,
+				member->GetType(),
+				member->GetInitializeExpression().c_str(),
+				member->GetConstructParameter().c_str(),
+				0);
+
+			//ネイティブコードバッファの再確保
+			ReallocNativeCodeBuffer();
+
+			i++;
+		}
+	}
+
+	Smoothie::Temp::liveingNamespaceScopes.clear();
+
+	cp=back_cp;
+}
+bool ClassesImpl::MemberVar_LoopRefCheck(const CClass &objClass){
+	bool result = true;
+	BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
+		if(pMember->GetType().IsStruct()){
+			//循環参照でないかをチェック
+			if(pobj_LoopRefCheck->check(pMember->GetType().GetClass())){
+				extern int cp;
+				SetError(124,pMember->GetType().GetClass().GetName(),cp);
+				return false;
+			}
+
+			pobj_LoopRefCheck->add(objClass.GetName().c_str());
+
+			bool tempResult = MemberVar_LoopRefCheck(pMember->GetType().GetClass());
+			if( result )
+			{
+				result = tempResult;
+			}
+
+			pobj_LoopRefCheck->del(objClass.GetName().c_str());
+		}
+	}
+
+	return result;
+}
+void ClassesImpl::GetClass_recur(const char *lpszInheritsClass){
+	extern char *basbuf;
+	int i,i2,i3,sub_address,top_pos;
+	char temporary[8192];
+
+	// 名前空間管理
+	NamespaceScopes backupNamespaceScopes = Smoothie::Temp::liveingNamespaceScopes;
+	NamespaceScopes &namespaceScopes = Smoothie::Temp::liveingNamespaceScopes;
+	namespaceScopes.clear();
+
+	for(i=0;;i++){
+		if(basbuf[i]=='\0') break;
+
+
+		// 名前空間
+		if( basbuf[i] == 1 && basbuf[i+1] == ESC_NAMESPACE ){
+			for(i+=2,i2=0;;i2++,i++){
+				if( IsCommandDelimitation( basbuf[i] ) ){
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=basbuf[i];
+			}
+			namespaceScopes.push_back( temporary );
+
+			continue;
+		}
+		else if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENDNAMESPACE ){
+			if( namespaceScopes.size() <= 0 ){
+				SetError(12, "End Namespace", i );
+			}
+			else{
+				namespaceScopes.pop_back();
+			}
+
+			i += 2;
+			continue;
+		}
+
+
+
+		if(basbuf[i]==1&&basbuf[i+1]==ESC_INTERFACE){
+			//////////////////////////
+			// インターフェイス
+			//////////////////////////
+
+			top_pos=i;
+
+			i+=2;
+
+			//インターフェイス名を取得
+			GetIdentifierToken( temporary, basbuf, i );
+
+			CClass *pobj_c = const_cast<CClass *>( this->Find(namespaceScopes, temporary) );
+			if(!pobj_c) continue;
+
+			if(lpszInheritsClass){
+				if(lstrcmp(lpszInheritsClass,pobj_c->GetName().c_str())!=0){
+					//継承先先読み用
+					continue;
+				}
+			}
+
+			if(pobj_c->IsReady()){
+				//既に先読みされているとき
+				continue;
+			}
+
+			pobj_c->Readed();
+
+			pobj_c->SetConstructorMemberSubIndex( -1 );
+			pobj_c->SetDestructorMemberSubIndex( -1 );
+
+			if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS){
+				//継承を行う場合
+				for(i+=3,i2=0;;i++,i2++){
+					if(IsCommandDelimitation(basbuf[i])){
+						temporary[i2]=0;
+						break;
+					}
+					temporary[i2]=basbuf[i];
+				}
+
+				if(lstrcmpi(temporary,pobj_c->GetName().c_str())==0){
+					SetError(105,temporary,i);
+					goto Interface_InheritsError;
+				}
+
+				//継承元クラスを取得
+				const CClass *pInheritsClass = Find(temporary);
+				if( !pInheritsClass ){
+					SetError(106,temporary,i);
+					goto Interface_InheritsError;
+				}
+
+				//継承させる
+				if( !pobj_c->InheritsClass( *pInheritsClass, i ) ){
+					goto Interface_InheritsError;
+				}
+			}
+			else{
+				//継承無し
+				pobj_c->pobj_InheritsClass=0;
+
+				//仮想関数の数を初期化
+				pobj_c->SetVtblNum( 0 );
+			}
+Interface_InheritsError:
+
+			//メンバ変数、関数を取得
+			while(1){
+				i++;
+
+				//エラー
+				if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE||basbuf[i+1]==ESC_INTERFACE)){
+					SetError(22,"Interface",i);
+					i--;
+					break;
+				}
+
+				if(basbuf[i]==1&&basbuf[i+1]==ESC_INHERITS){
+					SetError(111,NULL,i);
+					break;
+				}
+
+				sub_address=i;
+
+				for(i2=0;;i++,i2++){
+					if(IsCommandDelimitation(basbuf[i])){
+						temporary[i2]=0;
+						break;
+					}
+					temporary[i2]=basbuf[i];
+				}
+				if(temporary[0]=='\0'){
+					if(basbuf[i]=='\0'){
+						i--;
+						SetError(22,"Interface",top_pos);
+						break;
+					}
+					continue;
+				}
+
+				//End Interface記述の場合
+				if(temporary[0]==1&&temporary[1]==ESC_ENDINTERFACE) break;
+
+				if(!(temporary[0]==1&&(
+					temporary[1]==ESC_SUB||temporary[1]==ESC_FUNCTION
+					))){
+					SetError(1,NULL,i);
+					break;
+				}
+
+				//メンバ関数を追加
+				pobj_c->AddMethod(pobj_c,
+					Prototype::Public,	//Publicアクセス権
+					0,					//Static指定なし
+					false,				//Constではない
+					1,					//Abstract
+					1,					//Virtual
+					0,
+					temporary,
+					sub_address
+					);
+			}
+		}
+
+		if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE)){
+			//////////////////////////
+			// クラス
+			//////////////////////////
+
+			top_pos=i;
+
+			const DWORD dwClassType=basbuf[i+1];
+
+			i+=2;
+
+			int iAlign=0;
+			if(memicmp(basbuf+i,"Align(",6)==0){
+				//アラインメント修飾子
+				i+=6;
+				i+=GetStringInPare_RemovePare(temporary,basbuf+i)+1;
+				iAlign=atoi(temporary);
+
+				if(!(iAlign==1||iAlign==2||iAlign==4||iAlign==8||iAlign==16))
+					SetError(51,NULL,i);
+			}
+			else if( memicmp( basbuf + i, "Blittable(", 10 ) == 0 ){
+				// Blittable修飾子
+				i+=10;
+				i=JumpStringInPare(basbuf,i)+1;
+			}
+
+			if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM ){
+				// 列挙型の場合
+				i+=2;
+			}
+
+			//クラス名を取得
+			GetIdentifierToken( temporary, basbuf, i );
+
+			CClass *pobj_c =  const_cast<CClass *>( this->Find(namespaceScopes, temporary) );
+			if(!pobj_c) continue;
+
+			if(lpszInheritsClass){
+				if( pobj_c->GetName() != lpszInheritsClass ){
+					//継承先先読み用
+					continue;
+				}
+			}
+
+			if(pobj_c->IsReady()){
+				//既に先読みされているとき
+				continue;
+			}
+
+			pobj_c->iAlign=iAlign;
+
+			pobj_c->Readed();
+
+			pobj_c->SetConstructorMemberSubIndex( -1 );
+			pobj_c->SetDestructorMemberSubIndex( -1 );
+
+			//アクセス制限の初期値をセット
+			Prototype::Accessibility accessibility;
+			if(dwClassType==ESC_CLASS){
+				accessibility = Prototype::Private;
+			}
+			else{
+				accessibility = Prototype::Public;
+			}
+
+			if( pobj_c->GetName() == "Object" || dwClassType == ESC_TYPE ){
+				// 継承無し
+				pobj_c->pobj_InheritsClass = NULL;
+
+				// 仮想関数の数を初期化
+				pobj_c->SetVtblNum( 0 );
+			}
+			else{
+				bool isInherits = false;
+				if(basbuf[i+1]==1&&basbuf[i+2]==ESC_INHERITS){
+					//継承を行う場合
+					isInherits = true;
+
+					for(i+=3,i2=0;;i++,i2++){
+						if(IsCommandDelimitation(basbuf[i])){
+							temporary[i2]=0;
+							break;
+						}
+						temporary[i2]=basbuf[i];
+					}
+
+					if(lstrcmpi(temporary,pobj_c->GetName().c_str())==0){
+						SetError(105,temporary,i);
+						goto InheritsError;
+					}
+				}
+
+				if( !isInherits ){
+					//Objectを継承する
+					lstrcpy( temporary, "Object" );
+				}
+
+				pobj_c->Inherits( temporary, i );
+			}
+InheritsError:
+
+			//メンバとメソッドを取得
+			while(1){
+				i++;
+
+				//エラー
+				if(basbuf[i]==1&&(basbuf[i+1]==ESC_CLASS||basbuf[i+1]==ESC_TYPE)){
+					SetError(22,"Class",i);
+					i--;
+					break;
+				}
+
+				if(basbuf[i]==1&&basbuf[i+1]==ESC_INHERITS){
+					SetError(111,NULL,i);
+					break;
+				}
+
+				//Static修飾子
+				BOOL bStatic;
+				if(basbuf[i]==1&&basbuf[i+1]==ESC_STATIC){
+					bStatic=1;
+					i+=2;
+				}
+				else bStatic=0;
+
+				//Const修飾子
+				bool isConst = false;
+				if( basbuf[i] == 1 && basbuf[i + 1] == ESC_CONST ){
+					isConst = true;
+					i += 2;
+				}
+
+				if(basbuf[i]==1&&(
+					basbuf[i+1]==ESC_ABSTRACT||basbuf[i+1]==ESC_VIRTUAL||basbuf[i+1]==ESC_OVERRIDE||
+					basbuf[i+1]==ESC_SUB||basbuf[i+1]==ESC_FUNCTION
+					)){
+					i3=basbuf[i+1];
+					sub_address=i;
+				}
+				else i3=0;
+
+				bool isVirtual = false, isAbstract = false, isOverride = false;
+				if(i3==ESC_ABSTRACT){
+					isAbstract=1;
+					isVirtual=1;
+					i+=2;
+
+					i3=basbuf[i+1];
+				}
+				else if(i3==ESC_VIRTUAL){
+					isAbstract=0;
+					isVirtual=1;
+					i+=2;
+
+					i3=basbuf[i+1];
+				}
+				else if(i3==ESC_OVERRIDE){
+					isOverride=1;
+					isVirtual=1;
+
+					i+=2;
+
+					i3=basbuf[i+1];
+				}
+
+				for(i2=0;;i++,i2++){
+					if(IsCommandDelimitation(basbuf[i])){
+						temporary[i2]=0;
+						break;
+					}
+					temporary[i2]=basbuf[i];
+				}
+				if(temporary[0]=='\0'){
+					if(basbuf[i]=='\0'){
+
+						if(dwClassType==ESC_CLASS)
+							SetError(22,"Class",top_pos);
+						else
+							SetError(22,"Type",top_pos);
+
+						i--;
+						break;
+					}
+					continue;
+				}
+
+				//End Class記述の場合
+				if(temporary[0]==1&&temporary[1]==ESC_ENDCLASS&&dwClassType==ESC_CLASS) break;
+				if(temporary[0]==1&&temporary[1]==ESC_ENDTYPE&&dwClassType==ESC_TYPE) break;
+
+				//アクセスを変更
+				if(lstrcmpi(temporary,"Private")==0){
+					accessibility = Prototype::Private;
+					continue;
+				}
+				if(lstrcmpi(temporary,"Public")==0){
+					accessibility = Prototype::Public;
+					continue;
+				}
+				if(lstrcmpi(temporary,"Protected")==0){
+					accessibility = Prototype::Protected;
+					continue;
+				}
+
+				extern int cp;
+				if(i3==0){
+					if(bStatic){
+						//静的メンバを追加
+						cp=i;	//エラー用
+						pobj_c->AddStaticMember( accessibility, isConst, false, temporary, i);
+					}
+					else{
+						//メンバを追加
+						cp=i;	//エラー用
+						pobj_c->AddMember( accessibility, isConst, false, temporary, i );
+
+
+						if(pobj_c->GetDynamicMembers()[pobj_c->GetDynamicMembers().size()-1]->GetType().IsStruct()){
+							if( !pobj_c->GetDynamicMembers()[pobj_c->GetDynamicMembers().size()-1]->GetType().GetClass().IsReady() ){
+								//参照先が読み取られていないとき
+								GetClass_recur(pobj_c->GetDynamicMembers()[pobj_c->GetDynamicMembers().size()-1]->GetType().GetClass().GetName().c_str());
+							}
+						}
+
+
+						if(pobj_c->GetDynamicMembers()[pobj_c->GetDynamicMembers().size()-1]->GetType().IsStruct()){
+							//循環参照のチェック
+							pobj_LoopRefCheck->add(pobj_c->GetName().c_str());
+							if(!MemberVar_LoopRefCheck(pobj_c->GetDynamicMembers()[pobj_c->GetDynamicMembers().size()-1]->GetType().GetClass())){
+								//エラー回避
+								pobj_c->GetDynamicMembers()[pobj_c->GetDynamicMembers().size()-1]->GetType().SetBasicType( DEF_PTR_VOID );
+							}
+							pobj_LoopRefCheck->del(pobj_c->GetName().c_str());
+						}
+					}
+				}
+				else{
+					//メソッドを追加
+					cp=i;	//エラー用
+					pobj_c->AddMethod(pobj_c,
+						accessibility,
+						bStatic,
+						isConst,
+						isAbstract,
+						isVirtual,
+						isOverride,
+						temporary,
+						sub_address);
+
+					if( isAbstract ) continue;
+
+					for(;;i++){
+						if(basbuf[i]=='\0'){
+							i--;
+							break;
+						}
+						if(basbuf[i-1]!='*'&&
+							basbuf[i]==1&&(
+							basbuf[i+1]==ESC_SUB||
+							basbuf[i+1]==ESC_FUNCTION||
+							basbuf[i+1]==ESC_MACRO||
+							basbuf[i+1]==ESC_TYPE||
+							basbuf[i+1]==ESC_CLASS||
+							basbuf[i+1]==ESC_INTERFACE||
+							basbuf[i+1]==ESC_ENUM)){
+							GetDefaultNameFromES(i3,temporary);
+							SetError(22,temporary,i);
+						}
+						if(basbuf[i]==1&&basbuf[i+1]==GetEndXXXCommand((char)i3)){
+							i+=2;
+							break;
+						}
+					}
+				}
+			}
+		}
+	}
+
+
+	// 名前空間を元に戻す
+	Smoothie::Temp::liveingNamespaceScopes = backupNamespaceScopes;
+}
+void ClassesImpl::GetAllClassInfo(void){
+	//ループ継承チェック用のクラス
+	pobj_LoopRefCheck=new CLoopRefCheck();
+
+	//クラスを取得
+	GetClass_recur(0);
+
+	delete pobj_LoopRefCheck;
+	pobj_LoopRefCheck=0;
+
+	// イテレータ用のデータを作る
+	this->Iterator_Init();
+}
+void ClassesImpl::Compile_System_InitializeUserTypes(){
+	char temporary[VN_SIZE];
+
+	////////////////////////////////////////////////////////////////////
+	// クラス登録
+	////////////////////////////////////////////////////////////////////
+
+	// イテレータをリセット
+	Iterator_Reset();
+
+	while( Iterator_HasNext() ){
+		const CClass &objClass = *Iterator_GetNext();
+
+		if( !objClass.IsUsing() ){
+			// 未使用のクラスは無視する
+			continue;
+		}
+
+		char referenceOffsetsBuffer[1024] = "";
+		int numOfReference = 0;
+		BOOST_FOREACH( CMember *pMember, objClass.GetDynamicMembers() ){
+			if( pMember->GetType().IsObject() || pMember->GetType().IsPointer() ){
+				if( referenceOffsetsBuffer[0] ){
+					lstrcat( referenceOffsetsBuffer, "," );
+				}
+
+				sprintf( referenceOffsetsBuffer + lstrlen( referenceOffsetsBuffer ),
+					"%d",
+					objClass.GetMemberOffset( pMember->GetName().c_str() ) );
+
+				numOfReference++;
+			}
+		}
+
+		sprintf( temporary
+			, "Add(%c%c_System_TypeForClass(\"%s\",\"%s\",[%s],%d))"
+			, 1
+			, ESC_NEW
+			, ""							// 名前空間 (TODO: 実装)
+			, objClass.GetName().c_str()	// クラス名
+			, referenceOffsetsBuffer		// 参照メンバオフセット配列
+			, numOfReference				// 参照メンバの個数
+			);
+
+		// コンパイル
+		ChangeOpcode( temporary );
+
+		// ネイティブコードバッファの再確保
+		ReallocNativeCodeBuffer();
+	}
+
+
+	////////////////////////////////////////////////////////////////////
+	// 基底クラスを登録
+	////////////////////////////////////////////////////////////////////
+
+	sprintf(temporary, "%c%ctempType=Nothing%c%cTypeBaseImpl"
+		, HIBYTE( COM_DIM )
+		, LOBYTE( COM_DIM )
+		, 1
+		, ESC_AS
+		);
+	ChangeOpcode( temporary );
+
+	// イテレータをリセット
+	Iterator_Reset();
+
+	while( Iterator_HasNext() ){
+		const CClass &objClass = *Iterator_GetNext();
+
+		if( !objClass.IsUsing() ){
+			// 未使用のクラスは無視する
+			continue;
+		}
+
+		if( objClass.pobj_InheritsClass ){
+			sprintf( temporary
+				, "tempType=Search(\"%s\",\"%s\")"
+				, ""							// 名前空間 (TODO: 実装)
+				, objClass.GetName().c_str()	// クラス名
+				);
+
+			// コンパイル
+			ChangeOpcode( temporary );
+
+			sprintf( temporary
+				, "tempType.SetBaseType(Search(\"%s\",\"%s\"))"
+				, ""								// 名前空間 (TODO: 実装)
+				, objClass.pobj_InheritsClass->GetName().c_str()	// 基底クラス名
+				);
+
+			// コンパイル
+			ChangeOpcode( temporary );
+		}
+
+		// ネイティブコードバッファの再確保
+		ReallocNativeCodeBuffer();
+	}
+
+
+
+	////////////////////////////////////////////////////////////////////
+	// 継承関係登録
+	////////////////////////////////////////////////////////////////////
+	// TODO: 未完成
+	/*
+
+	// イテレータをリセット
+	Iterator_Reset();
+
+	while( Iterator_HasNext() ){
+		CClass *pClass = Iterator_GetNext();
+
+		sprintf( genBuffer + length
+			, "obj.Search( \"%s\" ).SetBaseType( Search( \"%s\" ) ):"
+			, ""				// クラス名
+			, pClass->name		// クラス名
+			);
+		length += lstrlen( genBuffer + length );
+
+		while( length + 8192 > max ){
+			max += 8192;
+			genBuffer = (char *)realloc( genBuffer, max );
+		}
+	}*/
+}
Index: /trunk/abdev/BasicCompiler_Common/src/CodeGenerator.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/CodeGenerator.cpp	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/src/CodeGenerator.cpp	(revision 184)
@@ -0,0 +1,12 @@
+#include <windows.h>
+#include <stdlib.h>
+
+int obp,obp_AllocSize;
+int GlobalOpBufferSize;
+char *OpBuffer;
+void ReallocNativeCodeBuffer(){
+	if(obp_AllocSize<obp+8192){
+		obp_AllocSize+=8192;
+		OpBuffer=(char *)realloc(OpBuffer,obp_AllocSize); //matea
+	}
+}
Index: /trunk/abdev/BasicCompiler_Common/src/Compiler.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/src/Compiler.cpp	(revision 184)
@@ -0,0 +1,3 @@
+#include <Compiler.h>
+
+NativeCode Compiler::nativeCode;
Index: /trunk/abdev/BasicCompiler_Common/src/DataTable.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/DataTable.cpp	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/src/DataTable.cpp	(revision 184)
@@ -0,0 +1,94 @@
+#include <jenga/include/smoothie/Smoothie.h>
+
+#include <DataTable.h>
+
+#include <memory.h>
+#include <stdlib.h>
+
+DataTable::DataTable(){
+	pdata = malloc( 1 );
+	size = 0;
+}
+DataTable::~DataTable(){
+	free( pdata );
+}
+
+void DataTable::Init(){
+	free( pdata );
+
+	pdata = malloc( 1 );
+	size = 0;
+}
+
+int DataTable::AddBinary( const void *pdata, int size ){
+	int retSize = this->size;
+
+	this->pdata = realloc( this->pdata, this->size + size );
+	memcpy( (char *)this->pdata + this->size, pdata, size );
+	this->size += size;
+
+	return retSize;
+}
+int DataTable::Add( _int64 i64data ){
+	int retSize = size;
+	AddBinary( &i64data, sizeof( _int64 ) );
+	return retSize;
+}
+int DataTable::Add( int i32data ){
+	int retSize = size;
+	AddBinary( &i32data, sizeof( int ) );
+	return retSize;
+}
+int DataTable::Add( double dbl ){
+	int retSize = size;
+	AddBinary( &dbl, sizeof( double ) );
+	return retSize;
+}
+int DataTable::Add( float flt ){
+	int retSize = size;
+	AddBinary( &flt, sizeof( float ) );
+	return retSize;
+}
+int DataTable::AddString( const char *str, int length ){
+	int retSize = size;
+
+	if( Smoothie::IsUnicode() ){
+		//Shift-JIS → Unicode
+		int size = MultiByteToWideChar(
+			CP_ACP,
+			0,
+			str, length + 1,
+			NULL, 0 ) * 2;
+
+		LPWSTR pwstr = (LPWSTR)malloc( size );
+
+		MultiByteToWideChar(
+			CP_ACP,
+			0,
+			str, length + 1,
+			pwstr, length + 1 );
+
+		AddBinary( pwstr, size );
+
+		free( pwstr );
+	}
+	else{
+		AddBinary( str, length + 1 );
+	}
+
+	return retSize;
+}
+int DataTable::AddString( const char *str ){
+	int retSize = size;
+	AddString( str, lstrlen( str ) );
+	return retSize;
+}
+
+const void *DataTable::GetPtr() const
+{
+	return pdata;
+}
+int DataTable::GetSize() const
+{
+	return size;
+}
Index: /trunk/abdev/BasicCompiler_Common/src/LexicalScopingImpl.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/LexicalScopingImpl.cpp	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/src/LexicalScopingImpl.cpp	(revision 184)
@@ -0,0 +1,128 @@
+#include <LexicalScopingImpl.h>
+
+#include "../common.h"
+
+#ifdef _AMD64_
+#include "../../BasicCompiler64/opcode.h"
+#else
+#include "../../BasicCompiler32/opcode.h"
+#endif
+
+
+void ScopeImpl::Break(){
+	//未解放のローカルオブジェクトを解放する
+	GetLexicalScopes().CallDestructorsOfReturn( level );
+
+	//jmp ...(Next addr)
+	OpBuffer[obp++]=(char)0xE9;
+
+	pBreakSchedule=(DWORD *)realloc( pBreakSchedule, ( nBreakSchedule + 1 ) * sizeof(DWORD) );
+	pBreakSchedule[nBreakSchedule]=obp;
+	nBreakSchedule++;
+
+	obp+=sizeof(long);
+}
+void ScopeImpl::RunScheduleOfBreak(){
+	for(int i=0;i<nBreakSchedule;i++){
+		*((long *)(OpBuffer+pBreakSchedule[i]))=obp-(pBreakSchedule[i]+sizeof(long));
+	}
+}
+
+// スコープ終了時のデストラクタ呼び出し
+void LexicalScopesImpl::CallDestructorsOfScopeEnd(){
+
+	Variables &vars = UserProc::IsGlobalAreaCompiling()?
+		globalVars :
+		UserProc::CompilingUserProc().localVars;
+
+
+	int i3;
+	int indexSystemGC=-1;
+	for( i3 = (int)vars.size() - 1; i3 >= 0; i3-- ){		//確保したのと逆順序で解放するため、バックサーチにする
+
+		Variable *pVar = vars[i3];
+
+		if( UserProc::IsGlobalAreaCompiling() && GetNowLevel() == 0 ){
+			if( pVar->GetName() == "_System_GC" ){
+				indexSystemGC=i3;
+				continue;
+			}
+		}
+
+		//同一レベルのレキシカルスコープのみを検知
+		if(!pVar->bLiving) continue;
+		if( pVar->ScopeLevel != GetNowLevel() ) continue;
+
+		if( pVar->IsStruct() && pVar->IsParameter() ){
+			//構造体パラメータを持つとき
+
+			//メモリを解放する
+
+#ifdef _AMD64_
+			//x64ビットコード
+
+			//mov rcx,qword ptr[rsp+offset]
+			op_mov_RM(sizeof(_int64),REG_RCX,REG_RSP,
+				-pVar->offset,
+				MOD_BASE_DISP32);
+			obp-=sizeof(long);
+			AddLocalVarAddrSchedule();
+			obp+=sizeof(long);
+#else
+			//x86コード
+
+			//mov ecx,dword ptr[ebp+offset]
+			op_mov_RM(sizeof(long),REG_ECX,REG_EBP,-pVar->offset,MOD_BASE_DISP32);
+			obp-=sizeof(long);
+			AddLocalVarAddrSchedule();
+			obp+=sizeof(long);
+
+			//push ecx
+			op_push(REG_ECX);
+#endif
+
+			//call free
+			extern UserProc *pSub_free;
+			op_call(pSub_free);
+
+
+			if( UserProc::IsGlobalAreaCompiling() ){
+				//ここには来ないハズ
+				SetError(300,NULL,cp);
+			}
+		}
+	}
+
+	if(indexSystemGC!=-1){
+		//_System_GCオブジェクトのデストラクタの呼び出し処理
+		const CMethod *method = vars[indexSystemGC]->GetClass().GetDestructorMethod();
+		if( method ){
+			Opcode_CallProc("",method->pUserProc,0,vars[indexSystemGC]->GetName().c_str(),DEF_OBJECT);
+		}
+	}
+}
+
+// Returnステートメントで発行されるデストラクタを生成
+void LexicalScopesImpl::CallDestructorsOfReturn( int BaseLevel ){
+	//現在のスコープレベルを退避
+	int backupScopeLevel = GetNowLevel();
+
+	for( int i = GetNowLevel(); i >= BaseLevel; i-- ){
+		SetNowLevel( i );
+
+		CallDestructorsOfScopeEnd();
+	}
+
+	//現在のスコープレベルを復元
+	SetNowLevel( backupScopeLevel );
+}
+
+LexicalScopesImpl &GetLexicalScopes()
+{
+	static LexicalScopesImpl *pTemp = NULL;
+	if( !pTemp )
+	{
+		pTemp = (LexicalScopesImpl *)Smoothie::Temp::pLexicalScopes;
+	}
+	return *pTemp;
+}
Index: /trunk/abdev/BasicCompiler_Common/src/ProcedureImpl.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/ProcedureImpl.cpp	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/src/ProcedureImpl.cpp	(revision 184)
@@ -0,0 +1,792 @@
+#include <jenga/include/smoothie/SmoothieException.h>
+#include <jenga/include/smoothie/LexicalAnalysis.h>
+
+#include <ProcedureImpl.h>
+
+#include "../common.h"
+#ifdef _AMD64_
+#include "../../BasicCompiler64/opcode.h"
+#else
+#include "../../BasicCompiler32/opcode.h"
+#endif
+
+bool UserProcImpl::SetParamsAndReturnType( const char *sourceOfParams, int nowLine, bool isStatic ){
+	int i = 0;
+	int i2,i3,sw;
+	char temporary[8192],temp2[VN_SIZE];
+
+	//ソースコードの位置
+	this->codePos = nowLine;
+
+	//パラメータ
+	if(sourceOfParams[i]!='('){
+		throw SmoothieException(1,NULL,nowLine);
+		return 0;
+	}
+	i++;
+	if(sourceOfParams[i]!=')'&& this->pParentClass ){
+		//クラスのメンバ関数の場合のみ、デストラクタにパラメータがある場合にエラーをだす
+		if(this->GetName()[0]=='~'){
+			throw SmoothieException(114,NULL,nowLine);
+			i=JumpStringInPare(sourceOfParams,i);
+		}
+	}
+	while(1){
+		if(sourceOfParams[i]==')') break;
+
+		//ByRef
+		bool isRef;
+		if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){
+			isRef = false;
+			i+=2;
+		}
+		else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){
+			isRef = true;
+			i+=2;
+		}
+		else isRef = false;
+
+		//パラメータ名
+		bool isArray = false;
+		int subScripts[MAX_ARRAYDIM];
+		char name[VN_SIZE];
+		sw=0;
+		for(i2=0;;i++,i2++){
+			if(sourceOfParams[i]=='('){
+				if(!sw) sw=1;
+
+				i3=GetStringInPare(name+i2,sourceOfParams+i);
+				i2+=i3-1;
+				i+=i3-1;
+				continue;
+			}
+			if(sourceOfParams[i]=='['){
+				if(!sw) sw=1;
+
+				i3=GetStringInBracket(name+i2,sourceOfParams+i);
+				i2+=i3-1;
+				i+=i3-1;
+				continue;
+			}
+			if(!IsVariableChar(sourceOfParams[i])){
+				name[i2]=0;
+				break;
+			}
+			name[i2]=sourceOfParams[i];
+		}
+		if(sw){
+			//配列パラメータ
+			if( isRef == false ) throw SmoothieException(29,NULL,nowLine);
+			isArray = true;
+
+			if((name[i2-2]=='('&&name[i2-1]==')')||
+				(name[i2-2]=='['&&name[i2-1]==']')){
+				subScripts[0]=LONG_MAX;
+				subScripts[1]=-1;
+
+				name[i2-2]=0;
+			}
+			else{
+				GetArrange(name,temp2,subScripts);
+				lstrcpy(name,temp2);
+			}
+
+			i2=lstrlen(name);
+		}
+
+		Type type( DEF_NON );
+		char initValue[8192] = "";
+		if( sourceOfParams[i] == '=' ){
+			i++;
+			i = GetOneParameter( sourceOfParams, i, initValue );
+
+			// TODO: エラー用 fix me!!!
+			//cp = nowLine;
+
+			NumOpe_GetType( initValue, Type::String(), type );
+		}
+		else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
+			// As指定
+			i+=2;
+
+			i2=0;
+			while(sourceOfParams[i]=='*'){
+				temporary[i2]=sourceOfParams[i];
+				i++;
+				i2++;
+			}
+			for(;;i++,i2++){
+				if(!IsVariableChar(sourceOfParams[i])){
+					if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){
+						temporary[i2++]=sourceOfParams[i++];
+						temporary[i2]=sourceOfParams[i];
+						continue;
+					}
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=sourceOfParams[i];
+			}
+
+			Type::StringToType( temporary, type );
+
+			if( type.IsNull() ){
+				throw SmoothieException(3,temporary,nowLine);
+				type.SetBasicType( DEF_PTR_VOID );
+			}
+
+			if( type.IsObject() ){
+				if( type.GetClass().IsBlittableType() ){
+					// Blittable型のときは基本型として扱う
+					type = type.GetClass().GetBlittableType();
+				}
+			}
+		}
+		else{
+			type.SetBasicType( Type::GetBasicTypeFromSimpleName(temporary) );
+			throw SmoothieException(-103,temporary,nowLine);
+		}
+
+		Parameter *pParam = new Parameter( name, type, isRef, initValue );
+		if( isArray ){
+			pParam->SetArray( subScripts );
+		}
+
+		//パラメータを追加
+		this->params.push_back( pParam );
+
+		if(sourceOfParams[i]==','){
+			i++;
+			continue;
+		}
+		else if(sourceOfParams[i]==')') continue;
+		else{
+			throw SmoothieException(1,NULL,nowLine);
+			break;
+		}
+	}
+	this->secondParmNum = (int)this->params.size();
+	i++;
+	if(sourceOfParams[i]=='('){
+		i++;
+		while(1){
+			if(sourceOfParams[i]==')') break;
+
+			//ByRef
+			bool isRef;
+			if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){
+				isRef = false;
+				i+=2;
+			}
+			else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){
+				isRef = true;
+				i+=2;
+			}
+			else isRef = false;
+
+			//パラメータ名
+			bool isArray = false;
+			int subScripts[MAX_ARRAYDIM];
+			char name[VN_SIZE];
+			sw=0;
+			for(i2=0;;i++,i2++){
+				if(sourceOfParams[i]=='('){
+					if(!sw) sw=1;
+
+					i3=GetStringInPare(name+i2,sourceOfParams+i);
+					i2+=i3-1;
+					i+=i3-1;
+					continue;
+				}
+				if(sourceOfParams[i]=='['){
+					if(!sw) sw=1;
+
+					i3=GetStringInBracket(name+i2,sourceOfParams+i);
+					i2+=i3-1;
+					i+=i3-1;
+					continue;
+				}
+				if(!IsVariableChar(sourceOfParams[i])){
+					name[i2]=0;
+					break;
+				}
+				name[i2]=sourceOfParams[i];
+			}
+			if(sw){
+				//配列パラメータ
+				if( isRef == false ) throw SmoothieException(29,NULL,nowLine);
+				isArray = true;
+
+				if((name[i2-2]=='('&&name[i2-1]==')')||
+					(name[i2-2]=='['&&name[i2-1]==']')){
+					subScripts[0]=LONG_MAX;
+					subScripts[1]=-1;
+
+					name[i2-2]=0;
+				}
+				else{
+					GetArrange(name,temp2,subScripts);
+					lstrcpy(name,temp2);
+				}
+
+				i2=lstrlen(name);
+			}
+
+			//型
+			Type type( DEF_NON );
+			if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
+				i+=2;
+
+				i2=0;
+				while(sourceOfParams[i]=='*'){
+					temporary[i2]=sourceOfParams[i];
+					i++;
+					i2++;
+				}
+				for(;;i++,i2++){
+					if(!IsVariableChar(sourceOfParams[i])){
+						if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){
+							temporary[i2++]=sourceOfParams[i++];
+							temporary[i2]=sourceOfParams[i];
+							continue;
+						}
+						temporary[i2]=0;
+						break;
+					}
+					temporary[i2]=sourceOfParams[i];
+				}
+
+				Type::StringToType( temporary, type );
+
+				if( type.IsNull() ){
+					throw SmoothieException(3,temporary,nowLine);
+					type.SetBasicType( DEF_PTR_VOID );
+				}
+			}
+			else{
+				type.SetBasicType( Type::GetBasicTypeFromSimpleName(temporary) );
+				throw SmoothieException(-103,temporary,nowLine);
+			}
+
+			Parameter *pParam = new Parameter( name, type, isRef );
+			if( isArray ){
+				pParam->SetArray( subScripts );
+			}
+
+			//パラメータを追加
+			this->params.push_back( pParam );
+
+			if(sourceOfParams[i]==','){
+				i++;
+				continue;
+			}
+			else if(sourceOfParams[i]==')') continue;
+			else{
+				throw SmoothieException(1,NULL,nowLine);
+				break;
+			}
+		}
+		i++;
+	}
+
+	if(sourceOfParams[i]){
+		///////////////////
+		// 戻り値を取得
+		///////////////////
+
+		if( !this->IsFunction() ){
+			// Sub/Macroの場合
+			throw SmoothieException(38,this->GetName(),nowLine);
+		}
+
+		if( this->pParentClass ){
+			if( this->GetName() == this->pParentClass->GetName() ||
+				this->GetName()[0]=='~'){
+				//クラスのコンストラクタ、デストラクタがFunction定義の場合はエラーをだす
+				throw SmoothieException(115,NULL,nowLine);
+			}
+		}
+
+
+		i2=lstrlen(sourceOfParams)-2;
+
+		int sw_as=0;
+		for(;i2>0;i2--){
+			if(sourceOfParams[i2]==')') break;
+
+			if(sourceOfParams[i2]==1&&sourceOfParams[i2+1]==ESC_AS){
+				i2+=2;
+				i3=0;
+				while(sourceOfParams[i2]=='*') temporary[i3++]=sourceOfParams[i2++];
+				for(;;i2++,i3++){
+					if(!IsVariableChar(sourceOfParams[i2])){
+						temporary[i3]=0;
+						break;
+					}
+					temporary[i3]=sourceOfParams[i2];
+				}
+				Type::StringToType( temporary, this->returnType );
+				if( this->returnType.IsNull() ) throw SmoothieException(3,temporary,nowLine);
+
+				sw_as=1;
+				break;
+			}
+		}
+
+		if(!sw_as){
+			throw SmoothieException(-104,this->GetName().c_str(),nowLine);
+
+			this->returnType.SetBasicType( DEF_DOUBLE );
+		}
+	}
+	else{
+		//戻り値なしのSub定義
+		this->returnType.SetNull();
+	}
+
+	//リアルパラメータ領域を取得（_System_LocalThisを考慮して2つだけ多く確保する場合がある）
+
+	if( this->pParentClass && isStatic == false ){
+		//オブジェクトメンバの場合は、第一パラメータを_System_LocalThis引き渡し用として利用
+		string name = "_System_LocalThis";
+		Type type( DEF_PTR_VOID );
+		this->realParams.push_back( new Parameter( name, type ) );
+	}
+
+	if( this->returnType.IsStruct() ){
+		//構造体を戻り値として持つ場合
+		//※第一パラメータ（Thisポインタありの場合は第二パラメータ）を戻り値用の参照宣言にする
+
+		string name = this->GetName();
+		if(name[0]==1&&name[1]==ESC_OPERATOR){
+			name="_System_ReturnValue";
+		}
+		Type type( DEF_STRUCT, this->returnType.GetIndex() );
+		this->realParams.push_back( new Parameter( name, type, true ) );
+	}
+
+	//パラメータをコピー
+	BOOST_FOREACH( Parameter *pParam, params ){
+		this->realParams.push_back( new Parameter( *pParam ) );
+	}
+
+	return true;
+}
+
+const NamespaceScopes &GlobalProc::GetNamespaceScopes() const
+{
+	if( HasParentClass() ){
+		return GetParentClassPtr()->GetNamespaceScopes();
+	}
+	return namespaceScopes;
+}
+bool GlobalProc::IsEqualSymbol( const NamespaceScopes &namespaceScopes, const string &name ) const
+{
+	if( GetName() != name ){
+		return false;
+	}
+
+	return NamespaceScopes::IsSameArea( GetNamespaceScopes(), namespaceScopes );
+}
+bool GlobalProc::IsEqualSymbol( const GlobalProc &globalProc ) const
+{
+	return IsEqualSymbol( globalProc.GetNamespaceScopes(), globalProc.GetName() );
+}
+bool GlobalProc::IsEqualSymbol( const string &fullName ) const
+{
+	char AreaName[VN_SIZE] = "";		//オブジェクト変数
+	char NestName[VN_SIZE] = "";		//入れ子メンバ
+	bool isNest = CClass::SplitName( fullName.c_str(), AreaName, NestName );
+
+	return IsEqualSymbol( NamespaceScopes( AreaName ), NestName );
+}
+
+bool DllProcImpl::SetParamsAndReturnType( const char *sourceOfParams, int nowLine ){
+	int i = 0;
+	int i2,i3,sw;
+	char temporary[8192],temp2[VN_SIZE];
+
+	//ソースコードの位置
+	this->codePos = nowLine;
+
+	//パラメータ
+	if(sourceOfParams[i]!='('){
+		throw SmoothieException(1,NULL,nowLine);
+		return 0;
+	}
+	i++;
+
+	while(1){
+		if(sourceOfParams[i]==')') break;
+
+		//ByRef
+		bool isRef;
+		if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){
+			isRef = false;
+			i+=2;
+		}
+		else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){
+			isRef = true;
+			i+=2;
+		}
+		else isRef = false;
+
+		//パラメータ名
+		bool isArray = false;
+		int subScripts[MAX_ARRAYDIM];
+		char name[VN_SIZE];
+		sw=0;
+		for(i2=0;;i++,i2++){
+			if(sourceOfParams[i]=='('){
+				if(!sw) sw=1;
+
+				i3=GetStringInPare(name+i2,sourceOfParams+i);
+				i2+=i3-1;
+				i+=i3-1;
+				continue;
+			}
+			if(sourceOfParams[i]=='['){
+				if(!sw) sw=1;
+
+				i3=GetStringInBracket(name+i2,sourceOfParams+i);
+				i2+=i3-1;
+				i+=i3-1;
+				continue;
+			}
+			if(!IsVariableChar(sourceOfParams[i])){
+				name[i2]=0;
+				break;
+			}
+			name[i2]=sourceOfParams[i];
+		}
+		if(sw){
+			//配列パラメータ
+			if( isRef == false ) throw SmoothieException(29,NULL,nowLine);
+			isArray = true;
+
+			if((name[i2-2]=='('&&name[i2-1]==')')||
+				(name[i2-2]=='['&&name[i2-1]==']')){
+				subScripts[0]=LONG_MAX;
+				subScripts[1]=-1;
+
+				name[i2-2]=0;
+			}
+			else{
+				GetArrange(name,temp2,subScripts);
+				lstrcpy(name,temp2);
+			}
+
+			i2=lstrlen(name);
+		}
+
+		//型
+		Type type( DEF_NON );
+		if(lstrcmp(name,"...")==0) type.SetBasicType( DEF_ELLIPSE );
+		else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
+			i+=2;
+
+			i2=0;
+			while(sourceOfParams[i]=='*'){
+				temporary[i2]=sourceOfParams[i];
+				i++;
+				i2++;
+			}
+			for(;;i++,i2++){
+				if(!IsVariableChar(sourceOfParams[i])){
+					if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){
+						temporary[i2++]=sourceOfParams[i++];
+						temporary[i2]=sourceOfParams[i];
+						continue;
+					}
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=sourceOfParams[i];
+			}
+
+			Type::StringToType( temporary, type );
+
+			if( type.IsNull() ){
+				throw SmoothieException(3,temporary,nowLine);
+				type.SetBasicType( DEF_PTR_VOID );
+			}
+		}
+		else{
+			type.SetBasicType( Type::GetBasicTypeFromSimpleName(temporary) );
+			throw SmoothieException(-103,temporary,nowLine);
+		}
+
+		Parameter *pParam = new Parameter( name, type, isRef );
+		if( isArray ){
+			pParam->SetArray( subScripts );
+		}
+
+		//パラメータを追加
+		this->params.push_back( pParam );
+
+		if(sourceOfParams[i]==','){
+			i++;
+			continue;
+		}
+		else if(sourceOfParams[i]==')') continue;
+		else{
+			throw SmoothieException(1,NULL,nowLine);
+			break;
+		}
+	}
+	i++;
+
+	if(sourceOfParams[i]){
+		///////////////////
+		// 戻り値を取得
+		///////////////////
+
+		i2=lstrlen(sourceOfParams)-2;
+
+		int sw_as=0;
+		for(;i2>0;i2--){
+			if(sourceOfParams[i2]==')') break;
+
+			if(sourceOfParams[i2]==1&&sourceOfParams[i2+1]==ESC_AS){
+				i2+=2;
+				i3=0;
+				while(sourceOfParams[i2]=='*') temporary[i3++]=sourceOfParams[i2++];
+				for(;;i2++,i3++){
+					if(!IsVariableChar(sourceOfParams[i2])){
+						temporary[i3]=0;
+						break;
+					}
+					temporary[i3]=sourceOfParams[i2];
+				}
+				Type::StringToType( temporary, this->returnType );
+				if( this->returnType.IsNull() ) throw SmoothieException(3,temporary,nowLine);
+
+				sw_as=1;
+				break;
+			}
+		}
+	}
+	else{
+		//戻り値なしのSub定義
+		this->returnType.SetNull();
+	}
+
+	return true;
+}
+
+bool ProcPointerImpl::SetParamsAndReturnType( const char *sourceOfParams, int nowLine ){
+	int i = 0;
+	int i2,i3,sw;
+	char temporary[8192],temp2[VN_SIZE];
+
+	//ソースコードの位置
+	this->codePos = nowLine;
+
+	//パラメータ
+	if(sourceOfParams[i]!='('){
+		throw SmoothieException(1,NULL,nowLine);
+		return 0;
+	}
+	i++;
+	while(1){
+		if(sourceOfParams[i]==')') break;
+
+		//ByRef
+		bool isRef;
+		if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYVAL){
+			isRef = false;
+			i+=2;
+		}
+		else if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_BYREF){
+			isRef = true;
+			i+=2;
+		}
+		else isRef = false;
+
+		//パラメータ名
+		bool isArray = false;
+		int subScripts[MAX_ARRAYDIM];
+		char name[VN_SIZE];
+		sw=0;
+		for(i2=0;;i++,i2++){
+			if(sourceOfParams[i]=='('){
+				if(!sw) sw=1;
+
+				i3=GetStringInPare(name+i2,sourceOfParams+i);
+				i2+=i3-1;
+				i+=i3-1;
+				continue;
+			}
+			if(sourceOfParams[i]=='['){
+				if(!sw) sw=1;
+
+				i3=GetStringInBracket(name+i2,sourceOfParams+i);
+				i2+=i3-1;
+				i+=i3-1;
+				continue;
+			}
+			if(!IsVariableChar(sourceOfParams[i])){
+				name[i2]=0;
+				break;
+			}
+			name[i2]=sourceOfParams[i];
+		}
+		if(sw){
+			//配列パラメータ
+			if( isRef == false ) throw SmoothieException(29,NULL,nowLine);
+			isArray = true;
+
+			if((name[i2-2]=='('&&name[i2-1]==')')||
+				(name[i2-2]=='['&&name[i2-1]==']')){
+				subScripts[0]=LONG_MAX;
+				subScripts[1]=-1;
+
+				name[i2-2]=0;
+			}
+			else{
+				GetArrange(name,temp2,subScripts);
+				lstrcpy(name,temp2);
+			}
+
+			i2=lstrlen(name);
+		}
+
+		//型
+		Type type( DEF_NON );
+		if(sourceOfParams[i]==1&&sourceOfParams[i+1]==ESC_AS){
+			i+=2;
+
+			i2=0;
+			while(sourceOfParams[i]=='*'){
+				temporary[i2]=sourceOfParams[i];
+				i++;
+				i2++;
+			}
+			for(;;i++,i2++){
+				if(!IsVariableChar(sourceOfParams[i])){
+					if(sourceOfParams[i]==1&&(sourceOfParams[i+1]==ESC_FUNCTION||sourceOfParams[i+1]==ESC_SUB)){
+						temporary[i2++]=sourceOfParams[i++];
+						temporary[i2]=sourceOfParams[i];
+						continue;
+					}
+					temporary[i2]=0;
+					break;
+				}
+				temporary[i2]=sourceOfParams[i];
+			}
+
+			Type::StringToType( temporary, type );
+
+			if( type.IsNull() ){
+				throw SmoothieException(3,temporary,nowLine);
+				type.SetBasicType( DEF_PTR_VOID );
+			}
+		}
+		else{
+			type.SetBasicType( Type::GetBasicTypeFromSimpleName(temporary) );
+			throw SmoothieException(-103,temporary,nowLine);
+		}
+
+		Parameter *pParam = new Parameter( name, type, isRef );
+		if( isArray ){
+			pParam->SetArray( subScripts );
+		}
+
+		//パラメータを追加
+		this->params.push_back( pParam );
+
+		if(sourceOfParams[i]==','){
+			i++;
+			continue;
+		}
+		else if(sourceOfParams[i]==')') continue;
+		else{
+			throw SmoothieException(1,NULL,nowLine);
+			break;
+		}
+	}
+	i++;
+
+	if(sourceOfParams[i]){
+		///////////////////
+		// 戻り値を取得
+		///////////////////
+
+		i2=lstrlen(sourceOfParams)-2;
+
+		int sw_as=0;
+		for(;i2>0;i2--){
+			if(sourceOfParams[i2]==')') break;
+
+			if(sourceOfParams[i2]==1&&sourceOfParams[i2+1]==ESC_AS){
+				i2+=2;
+				i3=0;
+				while(sourceOfParams[i2]=='*') temporary[i3++]=sourceOfParams[i2++];
+				for(;;i2++,i3++){
+					if(!IsVariableChar(sourceOfParams[i2])){
+						temporary[i3]=0;
+						break;
+					}
+					temporary[i3]=sourceOfParams[i2];
+				}
+				Type::StringToType( temporary, this->returnType );
+				if( this->returnType.IsNull() ) throw SmoothieException(3,temporary,nowLine);
+
+				sw_as=1;
+				break;
+			}
+		}
+	}
+	else{
+		//戻り値なしのSub定義
+		this->returnType.SetNull();
+	}
+
+	//戻り値のエラーチェック
+	if( IsFunction() ){
+		// Function定義
+
+		if( this->ReturnType().IsNull() ){
+			// 戻り値がない
+			throw SmoothieException(26,this->GetName(),nowLine);
+		}
+	}
+	else{
+		if( !this->ReturnType().IsNull() ){
+			// Sub定義なのに、戻り値がある
+			throw SmoothieException(38,this->GetName(),nowLine);
+		}
+	}
+
+	return true;
+}
+
+int ProcPointersImpl::Add( const string &typeExpression )
+{
+	DWORD dwProcType = (DWORD)typeExpression[2];
+	const string &paramStr = typeExpression.substr( 3 );
+
+	Procedure::Kind kind = Procedure::Sub;
+	if( dwProcType == ESC_FUNCTION ){
+		kind = Procedure::Function;
+	}
+
+	ProcPointer *pProcPointer = new ProcPointerImpl( kind );
+
+	//buffer[0]は'('となっている
+	extern int cp;
+	pProcPointer->SetParamsAndReturnType( paramStr.c_str(), cp );
+
+	this->push_back( pProcPointer );
+
+	return (int)this->size()-1;
+}
+
+void ProcPointersImpl::Clear()
+{
+	ProcPointersImpl &procPointers = *this;
+	BOOST_FOREACH( ProcPointer *pProcPointer, procPointers ){
+		delete pProcPointer;
+	}
+	this->clear();
+}
Index: /trunk/abdev/BasicCompiler_Common/src/SmoothieImpl.cpp
===================================================================
--- /trunk/abdev/BasicCompiler_Common/src/SmoothieImpl.cpp	(revision 184)
+++ /trunk/abdev/BasicCompiler_Common/src/SmoothieImpl.cpp	(revision 184)
@@ -0,0 +1,12 @@
+#include <jenga/include/smoothie/Smoothie.h>
+
+#include <ClassImpl.h>
+#include <ProcedureImpl.h>
+#include <LexicalScopingImpl.h>
+
+Meta Smoothie::meta(
+				new ClassesImpl(),
+				new ProcPointersImpl()
+				);
+
+CLexicalScopes *Smoothie::Temp::pLexicalScopes = new LexicalScopesImpl();
