Ignore:
Timestamp:
May 10, 2008, 11:10:33 PM (17 years ago)
Author:
dai_9181
Message:

ObjectModuleに関連するクラス一式をab_commonプロジェクトに移動した。

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ab5.0/abdev/ab_common/src/Lexical/Symbol.cpp

    r516 r603  
    44
    55const NamespaceSupporter *Symbol::namespaceSupporter = NULL;
     6
     7char *calcNames[255] = {
     8    "xor",
     9};
     10void InitCalcNames()
     11{
     12    if( calcNames[CALC_XOR] )
     13    {
     14        return;
     15    }
     16
     17    memset( calcNames, 0, 255 * sizeof(char *) );
     18    calcNames[CALC_XOR] = "xor";
     19    calcNames[CALC_OR] = "or";
     20    calcNames[CALC_AND] = "and";
     21    calcNames[CALC_NOT] = "Not";
     22    calcNames[CALC_PE] = "<=";
     23    calcNames[CALC_QE] = ">=";
     24    calcNames[CALC_NOTEQUAL] = "<>";
     25    calcNames[CALC_EQUAL] = "=(compare)";
     26    calcNames[CALC_P] = "<";
     27    calcNames[CALC_Q] = ">";
     28    calcNames[CALC_SHL] = "<<";
     29    calcNames[CALC_SHR] = ">>";
     30    calcNames[CALC_ADDITION] = "+";
     31    calcNames[CALC_SUBTRACTION] = "-";
     32    calcNames[CALC_STRPLUS] = "&";
     33    calcNames[CALC_MOD] = "mod";
     34    calcNames[CALC_PRODUCT] = "*";
     35    calcNames[CALC_QUOTIENT] = "/";
     36    calcNames[CALC_INTQUOTIENT] = "\\";
     37    calcNames[CALC_AS] = "As";
     38    calcNames[CALC_BYVAL] = "ByVal";
     39    calcNames[CALC_MINUSMARK] = "-(mark)";
     40    calcNames[CALC_POWER] = "^";
     41    calcNames[CALC_SUBSITUATION] = "=";
     42    calcNames[CALC_ARRAY_GET] = "[]";
     43    calcNames[CALC_ARRAY_SET] = "[]=";
     44}
     45void GetCalcName(int idCalc,char *name){
     46    InitCalcNames();
     47
     48    if( calcNames[idCalc] == NULL )
     49    {
     50        throw;
     51    }
     52
     53    lstrcpy( name, calcNames[idCalc] );
     54}
     55
     56std::string ActiveBasic::Common::Lexical::Operator_CalcMarkStringToNaturalString( const std::string &name )
     57{
     58    if( name[0] == 1 && name[1] == ESC_OPERATOR )
     59    {
     60        BYTE calcId = name[2];
     61        char temporary[255], calcName[255];
     62        GetCalcName( calcId, calcName );
     63        temporary[0] = name[0];
     64        temporary[1] = name[1];
     65        lstrcpy( temporary+2, calcName );
     66        return temporary;
     67    }
     68    return name;
     69}
     70
     71BYTE ToCalcId( const char *name )
     72{
     73    InitCalcNames();
     74
     75    for( int i=0; i<255; i++ )
     76    {
     77        if( calcNames[i] )
     78        {
     79            if( lstrcmp( name, calcNames[i] ) == 0 )
     80            {
     81                return i;
     82            }
     83        }
     84    }
     85
     86    throw;
     87}
     88
     89std::string ActiveBasic::Common::Lexical::Operator_NaturalStringToCalcMarkString( const std::string &name )
     90{
     91    if( name[0] == 1 && name[1] == ESC_OPERATOR )
     92    {
     93        BYTE calcId = ToCalcId( name.c_str()+2 );
     94        char temporary[255];
     95        temporary[0] = name[0];
     96        temporary[1] = name[1];
     97        temporary[2] = calcId;
     98        temporary[3] = 0;
     99        return temporary;
     100    }
     101    return name;
     102}
    6103
    7104std::string Symbol::GetFullName() const
Note: See TracChangeset for help on using the changeset viewer.