Changeset 173 in dev
- Timestamp:
- Jun 20, 2007, 3:38:44 AM (17 years ago)
- Location:
- trunk/jenga
- Files:
-
- 5 added
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/jenga/include/smoothie/Class.h
r172 r173 4 4 #include "Member.h" 5 5 #include "Method.h" 6 #include "LexicalAnalysis.h" 6 7 7 8 class InheritedInterface … … 120 121 bool IsDelegate() const; 121 122 bool IsStructure() const; 123 void SetClassType( ClassType classType ) 124 { 125 this->classType = classType; 126 } 122 127 123 128 //継承させる … … 248 253 for( int i=0; desc[i]; i++ ){ 249 254 if( desc[i] == '(' ){ 250 i= BasicSource::JumpStringInPare(desc,i+1);255 i=JumpStringInPare(desc,i+1); 251 256 continue; 252 257 } 253 258 else if( desc[i] == '[' ){ 254 i= BasicSource::JumpStringInBracket(desc,i+1);259 i=JumpStringInBracket(desc,i+1); 255 260 continue; 256 261 } … … 296 301 Classes(); 297 302 ~Classes(); 303 void Clear(); 298 304 299 305 const CClass *Find( const string &fullName ) const; -
trunk/jenga/include/smoothie/Source.h
r170 r173 34 34 bool ReadFile( const string &filePath ); 35 35 36 static bool IsBlank( char c )37 {38 if( c == ' ' || c == '\t' )39 {40 return true;41 }42 return false;43 }44 36 static void Text::SlideString(char *buffer, int slide){ 45 37 char *temp; … … 82 74 return buffer+2; 83 75 } 84 int GetLength(){ 76 const char *GetBuffer() const 77 { 78 return buffer+2; 79 } 80 int GetLength() const 81 { 85 82 return length-2; 86 83 } … … 99 96 } 100 97 101 static bool IsCommandDelimitation( char c ){ 102 if( c == '\n' || c == ':' || c == '\0' ){ 103 return true; 98 char operator[]( int index ) const 99 { 100 if( index>GetLength() ) 101 { 102 throw "bad access"; 104 103 } 105 106 return false; 107 } 108 109 static int JumpStringInPare(const char *buffer,int pos){ 110 int PareNum; 111 for(PareNum=1;;pos++){ 112 if(buffer[pos]=='\"'){ 113 for(pos++;;pos++){ 114 if(buffer[pos]=='\"') break; 115 } 116 continue; 117 } 118 else if(buffer[pos]=='(') PareNum++; 119 else if(buffer[pos]==')'){ 120 PareNum--; 121 if(PareNum==0) return pos; 122 } 123 else if(buffer[pos]=='\0') break; 124 } 125 return 0; 126 } 127 static int JumpStringInBracket(const char *buffer,int pos){ 128 int PareNum; 129 for(PareNum=1;;pos++){ 130 if(buffer[pos]=='\"'){ 131 for(pos++;;pos++){ 132 if(buffer[pos]=='\"') break; 133 } 134 continue; 135 } 136 else if(buffer[pos]=='[') PareNum++; 137 else if(buffer[pos]==']'){ 138 PareNum--; 139 if(PareNum==0) return pos; 140 } 141 else if(buffer[pos]=='\0') break; 142 } 143 return 0; 104 return buffer[2+index]; 144 105 } 145 106 }; -
trunk/jenga/include/smoothie/Type.h
r172 r173 139 139 static bool StringToBasicType( const std::string &typeName, int &basicType ); 140 140 static bool StringToType( const std::string &typeName, Type &type ); 141 static int GetBasicTypeFromSimpleName( const char *variable ); 141 142 }; 142 143 -
trunk/jenga/include/smoothie/TypeDef.h
r170 r173 20 20 Type baseType; 21 21 public: 22 TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName );22 TypeDef( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName, int nowLine ); 23 23 ~TypeDef(); 24 24 … … 46 46 ~TypeDefCollection(); 47 47 48 void Add( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName );48 void Add( const NamespaceScopes &namespaceScopes, const string &name, const string &baseName, int nowLine ); 49 49 int GetIndex( const NamespaceScopes &namespaceScopes, const string &name ) const; 50 50 int GetIndex( const string &fullName ) const; -
trunk/jenga/include/smoothie/Variable.h
r172 r173 176 176 177 177 extern Variables globalVars; 178 179 180 -
trunk/jenga/projects/smoothie/smoothie.vcproj
r172 r173 273 273 </File> 274 274 <File 275 RelativePath="..\..\src\smoothie\LexicalAnalysis.cpp" 276 > 277 </File> 278 <File 275 279 RelativePath="..\..\src\smoothie\Method.cpp" 276 280 > … … 281 285 </File> 282 286 <File 287 RelativePath="..\..\src\smoothie\Procedure.cpp" 288 > 289 </File> 290 <File 283 291 RelativePath="..\..\src\smoothie\Prototype.cpp" 284 292 > … … 298 306 <File 299 307 RelativePath="..\..\src\smoothie\Type.cpp" 308 > 309 </File> 310 <File 311 RelativePath="..\..\src\smoothie\TypeDef.cpp" 312 > 313 </File> 314 <File 315 RelativePath="..\..\src\smoothie\Variable.cpp" 300 316 > 301 317 </File> … … 315 331 </File> 316 332 <File 333 RelativePath="..\..\include\smoothie\LexicalAnalysis.h" 334 > 335 </File> 336 <File 317 337 RelativePath="..\..\include\smoothie\Member.h" 318 338 > -
trunk/jenga/src/smoothie/Class.cpp
r172 r173 669 669 iIteNextNum( 0 ) 670 670 { 671 memset( pobj_ClassHash, 0, MAX_CLASS_HASH * sizeof(CClass *));671 Clear(); 672 672 } 673 673 Classes::~Classes(){ 674 Clear(); 675 } 676 void Classes::Clear() 677 { 674 678 int i; 675 679 for(i=0;i<MAX_CLASS_HASH;i++){ … … 678 682 679 683 if(ppobj_IteClass) free(ppobj_IteClass); 684 memset( pobj_ClassHash, 0, MAX_CLASS_HASH * sizeof(CClass *) ); 680 685 } 681 686 -
trunk/jenga/src/smoothie/Namespace.cpp
r170 r173 129 129 if( source[i] == 1 && source[i+1] == ESC_NAMESPACE ){ 130 130 for(i+=2,i2=0;;i2++,i++){ 131 if( BasicSource::IsCommandDelimitation( source[i] ) ){131 if( IsCommandDelimitation( source[i] ) ){ 132 132 temporary[i2]=0; 133 133 break; -
trunk/jenga/src/smoothie/Source.cpp
r170 r173 5 5 #include <jenga/include/smoothie/BasicFixed.h> 6 6 #include <jenga/include/smoothie/Source.h> 7 #include <jenga/include/smoothie/LexicalAnalysis.h> 7 8 #include <jenga/include/smoothie/SmoothieException.h> 8 9 … … 874 875 i++; 875 876 } 876 while( Text::IsBlank( buffer[i] ) ){877 while( IsBlank( buffer[i] ) ){ 877 878 i++; 878 879 } … … 882 883 if( memicmp( buffer + i, generateDirectiveName.c_str(), generateDirectiveName.size() ) == 0 ){ 883 884 i += (int)generateDirectiveName.size(); 884 while( Text::IsBlank( buffer[i] ) ){885 while( IsBlank( buffer[i] ) ){ 885 886 i++; 886 887 } -
trunk/jenga/src/smoothie/Type.cpp
r172 r173 93 93 // Object型だったとき 94 94 if( typeName == "Object" ){ 95 type.SetType( DEF_OBJECT, pobj_DBClass->GetObjectClassPtr() );95 type.SetType( DEF_OBJECT, Smoothie::meta.classes.GetObjectClassPtr() ); 96 96 return true; 97 97 } … … 99 99 // String型だったとき 100 100 if( typeName == "String" ){ 101 type.SetType( DEF_OBJECT, pobj_DBClass->GetStringClassPtr() );101 type.SetType( DEF_OBJECT, Smoothie::meta.classes.GetStringClassPtr() ); 102 102 return true; 103 103 } … … 114 114 115 115 //クラス 116 const CClass *pobj_c = pobj_DBClass->Find( typeName );116 const CClass *pobj_c = Smoothie::meta.classes.Find( typeName ); 117 117 if(pobj_c){ 118 118 type.pClass = pobj_c; … … 539 539 540 540 Type Type::String(){ 541 return Type( DEF_OBJECT, * pobj_DBClass->GetStringClassPtr() );541 return Type( DEF_OBJECT, *Smoothie::meta.classes.GetStringClassPtr() ); 542 542 }*/ 543 543 544 int Type::GetBasicTypeFromSimpleName( const char *variable ){ 545 extern char DefIntVari[26],DefSngVari[26],DefStrVari[26],divNum,dsvNum,dStrvNum; 546 int i; 547 char name[VN_SIZE]; 548 549 //構造体メンバの場合を考慮 550 for(i=lstrlen(variable);i>0;i--){ 551 if(variable[i]=='.'){ 552 i++; 553 break; 554 } 555 } 556 557 for(;;i++){ 558 if(variable[i]=='('||variable[i]=='\0'){ 559 name[i]=0; 560 break; 561 } 562 name[i]=variable[i]; 563 } 564 //変数名から選択 565 i--; 566 if(name[i]=='#') return DEF_DOUBLE; 567 if(name[i]=='!') return DEF_SINGLE; 568 if(name[i]=='%') return DEF_INTEGER; 569 return DEF_DOUBLE; 570 } 571 572 544 573 const string BlittableType::GetCreateStaticMethodFullName() const 545 574 {
Note:
See TracChangeset
for help on using the changeset viewer.