Changeset 603 in dev for trunk/ab5.0/abdev/BasicCompiler_Common/StrOperation.cpp
- Timestamp:
- May 10, 2008, 11:10:33 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/abdev/BasicCompiler_Common/StrOperation.cpp
r465 r603 1 1 #include "stdafx.h" 2 3 #include <Source.h>4 5 #include "../BasicCompiler_Common/common.h"6 2 7 3 void KillSpaces(char *str1,char *str2){ … … 840 836 } 841 837 842 char *calcNames[255] = {843 "xor",844 };845 void InitCalcNames()846 {847 if( calcNames[CALC_XOR] )848 {849 return;850 }851 852 memset( calcNames, 0, 255 * sizeof(char *) );853 calcNames[CALC_XOR] = "xor";854 calcNames[CALC_OR] = "or";855 calcNames[CALC_AND] = "and";856 calcNames[CALC_NOT] = "Not";857 calcNames[CALC_PE] = "<=";858 calcNames[CALC_QE] = ">=";859 calcNames[CALC_NOTEQUAL] = "<>";860 calcNames[CALC_EQUAL] = "=(compare)";861 calcNames[CALC_P] = "<";862 calcNames[CALC_Q] = ">";863 calcNames[CALC_SHL] = "<<";864 calcNames[CALC_SHR] = ">>";865 calcNames[CALC_ADDITION] = "+";866 calcNames[CALC_SUBTRACTION] = "-";867 calcNames[CALC_STRPLUS] = "&";868 calcNames[CALC_MOD] = "mod";869 calcNames[CALC_PRODUCT] = "*";870 calcNames[CALC_QUOTIENT] = "/";871 calcNames[CALC_INTQUOTIENT] = "\\";872 calcNames[CALC_AS] = "As";873 calcNames[CALC_BYVAL] = "ByVal";874 calcNames[CALC_MINUSMARK] = "-(mark)";875 calcNames[CALC_POWER] = "^";876 calcNames[CALC_SUBSITUATION] = "=";877 calcNames[CALC_ARRAY_GET] = "[]";878 calcNames[CALC_ARRAY_SET] = "[]=";879 }880 void GetCalcName(int idCalc,char *name){881 InitCalcNames();882 883 if( calcNames[idCalc] == NULL )884 {885 compiler.errorMessenger.OutputFatalError();886 }887 lstrcpy( name, calcNames[idCalc] );888 }889 BYTE ToCalcId( const char *name )890 {891 InitCalcNames();892 893 for( int i=0; i<255; i++ )894 {895 if( calcNames[i] )896 {897 if( lstrcmp( name, calcNames[i] ) == 0 )898 {899 return i;900 }901 }902 }903 compiler.errorMessenger.OutputFatalError();904 return 0;905 }906 907 std::string Operator_NaturalStringToCalcMarkString( const std::string &name )908 {909 if( name[0] == 1 && name[1] == ESC_OPERATOR )910 {911 BYTE calcId = ToCalcId( name.c_str()+2 );912 char temporary[255];913 temporary[0] = name[0];914 temporary[1] = name[1];915 temporary[2] = calcId;916 temporary[3] = 0;917 return temporary;918 }919 return name;920 }921 std::string Operator_CalcMarkStringToNaturalString( const std::string &name )922 {923 if( name[0] == 1 && name[1] == ESC_OPERATOR )924 {925 BYTE calcId = name[2];926 char temporary[255], calcName[255];927 GetCalcName( calcId, calcName );928 temporary[0] = name[0];929 temporary[1] = name[1];930 lstrcpy( temporary+2, calcName );931 return temporary;932 }933 return name;934 }935 936 838 bool IsGenericTypeSourcePart( const char *buffer ) 937 839 {
Note:
See TracChangeset
for help on using the changeset viewer.