Changeset 107 in dev


Ignore:
Timestamp:
May 6, 2007, 3:17:56 PM (17 years ago)
Author:
dai_9181
Message:

Importsステートメントを導入した。実装は作り途中。

Files:
16 edited

Legend:

Unmodified
Added
Removed
  • BasicCompiler32/BasicCompiler.vcproj

    r101 r107  
    152152                RuntimeLibrary="0"
    153153                EnableFunctionLevelLinking="true"
     154                RuntimeTypeInfo="true"
    154155                PrecompiledHeaderFile=".\Release/BasicCompiler.pch"
    155156                AssemblerListingLocation=".\Release/"
     
    174175            <Tool
    175176                Name="VCLinkerTool"
    176                 AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib"
     177                AdditionalDependencies="comctl32.lib psapi.lib"
    177178                OutputFile="../ActiveBasic/BasicCompiler32.exe"
    178179                LinkIncremental="1"
  • BasicCompiler64/BasicCompiler.vcproj

    r101 r107  
    7979                Name="VCLinkerTool"
    8080                AdditionalOptions="/MACHINE:AMD64"
    81                 AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib bufferoverflowu.lib"
     81                AdditionalDependencies="comctl32.lib psapi.lib bufferoverflowu.lib"
    8282                OutputFile="../ActiveBasic/BasicCompiler64.exe"
    8383                LinkIncremental="2"
     
    351351                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;JPN;_AMD64_;_WIN64"
    352352                MinimalRebuild="false"
     353                ExceptionHandling="1"
    353354                BasicRuntimeChecks="0"
    354                 RuntimeLibrary="0"
     355                RuntimeLibrary="2"
     356                RuntimeTypeInfo="true"
    355357                UsePrecompiledHeader="0"
    356358                PrecompiledHeaderFile=".\Release/BasicCompiler.pch"
     
    379381                Name="VCLinkerTool"
    380382                AdditionalOptions="/MACHINE:AMD64"
    381                 AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib user32.lib gdi32.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib bufferoverflowu.lib"
     383                AdditionalDependencies="comctl32.lib psapi.lib bufferoverflowu.lib"
    382384                OutputFile="../ActiveBasic/BasicCompiler64.exe"
    383                 LinkIncremental="2"
    384                 SuppressStartupBanner="true"
    385                 IgnoreDefaultLibraryNames="libcpmtd"
     385                LinkIncremental="1"
     386                SuppressStartupBanner="true"
     387                IgnoreDefaultLibraryNames="libcpmtd.lib"
    386388                GenerateDebugInformation="false"
    387389                ProgramDatabaseFile=".\Release/BasicCompiler64.pdb"
  • BasicCompiler64/Compile_Var.cpp

    r106 r107  
    380380bool GetVarOffset(bool isErrorEnabled,bool isWriteAccess,const char *NameBuffer,RELATIVE_VAR *pRelativeVar,Type &resultType,int *pss){
    381381    int i;
    382     char variable[VN_SIZE],member[VN_SIZE],VarName[VN_SIZE],array[VN_SIZE],lpPtrOffset[VN_SIZE];
     382    char variable[VN_SIZE];
    383383
    384384    if(NameBuffer[0]=='.'){
  • BasicCompiler_Common/BasicFixed.h

    r99 r107  
    178178#define ESC_NAMESPACE       'o'     // Namespace
    179179#define ESC_ENDNAMESPACE    'p'     // End Namespace
     180#define ESC_IMPORTS         'q'     // Imports
     181#define ESC_CLEARNAMESPACEIMPORTED 'r'  // _ClearNamespaceImported
    180182//EXEファイル用制御エスケープシーケンス
    181 #define ESC_USING           'q'     // Print命令語のUsing
    182 #define ESC_FOR             'r'     // Open命令語のFor
    183 #define ESC_LINENUM         's'     // 行番号を示す
     183#define ESC_USING           's'     // Print命令語のUsing
     184#define ESC_FOR             't'     // Open命令語のFor
     185#define ESC_LINENUM         'u'     // 行番号を示す
    184186
    185187//オブジェクト指向エスケープシーケンス
  • BasicCompiler_Common/Compile.cpp

    r103 r107  
    229229                }
    230230                Smoothie::Lexical::liveingNamespaceScopes.pop_back();
     231                break;
     232            case ESC_IMPORTS:
     233                Smoothie::Meta::importedNamespaces.Imports( Command + 2 );
     234                break;
     235            case ESC_CLEARNAMESPACEIMPORTED:
     236                Smoothie::Meta::importedNamespaces.clear();
    231237                break;
    232238
  • BasicCompiler_Common/Intermediate_Step1.cpp

    r99 r107  
    447447
    448448            switch(temporary[i3]){
     449                case '_':
     450                    if(lstrcmpi(temporary+i3,"_ClearNamespaceImported")==0){
     451                        i2=i3;
     452                        temporary[i2++]=1;
     453                        temporary[i2]=ESC_CLEARNAMESPACEIMPORTED;
     454                    }
     455                    break;
    449456                case 'a':
    450457                case 'A':
     
    755762                        temporary[i2++]=1;
    756763                        temporary[i2]=ESC_IF;
     764                    }
     765                    else if(lstrcmpi(temporary+i3,"Imports")==0){
     766                        i2=i3;
     767                        temporary[i2++]=1;
     768                        temporary[i2]=ESC_IMPORTS;
    757769                    }
    758770                    else if(lstrcmpi(temporary+i3,"Inherits")==0){
  • BasicCompiler_Common/Intermediate_Step2.cpp

    r103 r107  
    462462            case ESC_STATIC:
    463463            case ESC_NAMESPACE:
     464            case ESC_IMPORTS:
    464465                KillStringSpaces(Command+2);
    465466                break;
  • BasicCompiler_Common/common.h

    r100 r107  
    4747
    4848#ifdef _AMD64_
    49 #define VER_INFO        "(x64) β rev.217"
     49#define VER_INFO        "(x64) β rev.228"
    5050#else
    51 #define VER_INFO        "β rev.217"
     51#define VER_INFO        "β rev.228"
    5252#endif
    5353
     
    6161
    6262
    63 #pragma comment(lib, "psapi.lib")
    64 
    65 
    6663#define PTR_SIZE        sizeof(LONG_PTR)
    6764
     
    8481
    8582//未定義の定数情報
    86 #define IMAGE_FILE_MACHINE_AMD64 0x8664
    87 
     83#ifndef IMAGE_FILE_MACHINE_AMD64
     84    #define IMAGE_FILE_MACHINE_AMD64 0x8664
     85#endif
     86
     87#ifdef _AMD64_
     88    #ifndef IMAGE_SIZEOF_NT_OPTIONAL64_HEADER
     89        #define IMAGE_SIZEOF_NT_OPTIONAL64_HEADER    240
     90    #endif
     91#else
     92    #ifndef IMAGE_SIZEOF_NT_OPTIONAL32_HEADER
     93        #define IMAGE_SIZEOF_NT_OPTIONAL32_HEADER    224
     94    #endif
     95#endif
    8896
    8997
  • BasicCompiler_Common/error.cpp

    r103 r107  
    152152    if(num==62) sprintf(msg,"グローバル領域でのReturnは禁止されています。",tempKeyWord);
    153153    if(num==63) lstrcpy(msg,"名前空間が正しく閉じられていません。");
     154    if(num==64) sprintf(msg,"\"%s\" 無効な名前空間です。",tempKeyWord);
    154155
    155156
  • BasicCompiler_Common/include/Namespace.h

    r105 r107  
    7070    }
    7171
    72     bool IsUsing() const
    73     {
    74         // TODO: 実装
    75         return false;
    76     }
     72    bool IsImported() const;
    7773
    7874    bool IsLiving() const;
     
    9894            if( baseNamespaceScopes.size() ){
    9995                // 名前空間の判断が必要なとき
    100                 if( baseNamespaceScopes.IsUsing()
     96                if( baseNamespaceScopes.IsImported()
    10197                    || baseNamespaceScopes.IsLiving() ){
    10298                    // Using指定があるとき
     
    134130    void SplitNamespace( const char *fullName, char *namespaceStr, char *simpleName ) const;
    135131
     132    void Imports( const string &namespaceStr );
     133
    136134    static bool CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection );
    137135};
  • BasicCompiler_Common/include/Smoothie.h

    r105 r107  
    1919#endif
    2020        }
    21         static void Put( const string &text ){
    22 #ifdef _DEBUG
    23             log += text + "\r\n";
    24 
    25             {
    26                 ofstream ofs( ( (string)BasicSystemDir + "Log\\compile.log" ).c_str(), ios_base::app );
    27                 ofs << text << endl;
    28                 ofs.close();
    29             }
    30 #endif
    31         }
     21        static void Put( const string &text );
    3222        static void PutFile( const string &fileName, const string &buffer ){
    3323            ofstream ofs( ( (string)BasicSystemDir + "Log\\" + fileName ).c_str() );
     
    4939        static vector<ProcPointer *> procPointers;
    5040        static NamespaceScopesCollection namespaceScopesCollection;
     41        static NamespaceScopesCollection importedNamespaces;
    5142    };
    5243};
  • BasicCompiler_Common/src/Namespace.cpp

    r105 r107  
    2121}
    2222
     23bool NamespaceScopes::IsImported() const
     24{
     25    BOOST_FOREACH( const NamespaceScopes &namespaceScopes, Smoothie::Meta::importedNamespaces ){
     26        if( this->IsEqual( namespaceScopes ) ){
     27            return true;
     28        }
     29    }
     30    return false;
     31}
    2332bool NamespaceScopes::IsLiving() const
    2433{
     
    9099    lstrcpy( simpleName, fullName + lstrlen( namespaceStr ) + dotLength );
    91100}
     101void NamespaceScopesCollection::Imports( const string &namespaceStr ){
     102    NamespaceScopes namespaceScopes( namespaceStr );
     103    if( !Smoothie::Meta::namespaceScopesCollection.IsExist( namespaceScopes ) ){
     104        SetError(64,namespaceStr.c_str(),cp );
     105        return;
     106    }
     107
     108    this->push_back( namespaceScopes );
     109}
    92110bool NamespaceScopesCollection::CollectNamespaces( const char *source, NamespaceScopesCollection &namespaceScopesCollection )
    93111{
  • BasicCompiler_Common/src/Smoothie.cpp

    r105 r107  
    22
    33string Smoothie::Logger::log = "";
     4
     5void Smoothie::Logger::Put( const string &text )
     6{
     7//#ifdef _DEBUG
     8    log += text + "\r\n";
     9
     10    {
     11        ofstream ofs( ( (string)BasicSystemDir + "Log\\compile.log" ).c_str(), ios_base::app );
     12        ofs << text << endl;
     13        ofs.close();
     14    }
     15//#endif
     16}
    417
    518BasicSource Smoothie::Lexical::source;
     
    922vector<ProcPointer *> Smoothie::Meta::procPointers;
    1023NamespaceScopesCollection Smoothie::Meta::namespaceScopesCollection;
     24NamespaceScopesCollection Smoothie::Meta::importedNamespaces;
  • ProjectEditor/ProjectControl.cpp

    r84 r107  
    23182318            sprintf(buffer+i2,"#include \"%s\"\r\n",ProjectInfo.pobj_DBFileInfo->ppobj_FileInfo[i]->m_path);
    23192319            i2+=lstrlen(buffer+i2);
     2320            lstrcpy(buffer+i2,"_ClearNamespaceImported\r\n");
     2321            i2+=lstrlen(buffer+i2);
    23202322        }
    23212323    }
  • ProjectEditor/ProjectEditor.vcproj

    r58 r107  
    555555            <Tool
    556556                Name="VCLinkerTool"
    557                 AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib imm32.lib htmlhelp.lib rpcrt4.lib"
     557                AdditionalDependencies="odbc32.lib odbccp32.lib comctl32.lib imm32.lib htmlhelp.lib rpcrt4.lib libcp.lib"
    558558                OutputFile="../ActiveBasic/abdev.exe"
    559559                LinkIncremental="1"
  • ProjectEditor/SubOperation.cpp

    r101 r107  
    517517    else if(str[0]=='i'||str[0]=='I'){
    518518        if(lstrcmpi(str,"If")==0) return COM_IF;
     519        if(lstrcmpi(str,"Imports")==0) return -1;
    519520        if(lstrcmpi(str,"Inherits")==0) return COM_INHERITS;
    520521        if(lstrcmpi(str,"Input")==0) return COM_INPUT;
Note: See TracChangeset for help on using the changeset viewer.