- Timestamp:
- Sep 20, 2001, 5:55:27 AM (24 years ago)
- Location:
- branches/stage2/tools/database/occ
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/stage2/tools/database/occ/Makefile
r6768 r6770 1 # $Id: Makefile,v 1.1.2. 1 2001-09-20 03:12:05bird Exp $1 # $Id: Makefile,v 1.1.2.2 2001-09-20 03:55:26 bird Exp $ 2 2 3 3 # … … 42 42 CINCLUDES = -Igc 43 43 !ifdef DEBUG 44 CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY -D DEBUG44 CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY -DSDS -DDEBUG 45 45 !else 46 CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY 46 CDEFINES = -DOS2 -DOPERATOR_NEW_ARRAY -DSDS 47 47 !endif 48 48 !if "$(VAC3)" == "1" || "$(VAC36)" == "1" -
branches/stage2/tools/database/occ/buffer.cpp
r6768 r6770 2 2 Copyright (C) 1997-2001 Shigeru Chiba, Tokyo Institute of Technology. 3 3 4 Permission to use, copy, distribute and modify this software and 5 its documentation for any purpose is hereby granted without fee, 6 provided that the above copyright notice appear in all copies and that 7 both that copyright notice and this permission notice appear in 4 Permission to use, copy, distribute and modify this software and 5 its documentation for any purpose is hereby granted without fee, 6 provided that the above copyright notice appear in all copies and that 7 both that copyright notice and this permission notice appear in 8 8 supporting documentation. 9 9 10 Shigeru Chiba makes no representations about the suitability of this 10 Shigeru Chiba makes no representations about the suitability of this 11 11 software for any purpose. It is provided "as is" without express or 12 12 implied warranty. … … 155 155 } 156 156 157 #ifdef SDS 158 uint Program::LineNumber(char* ptr, char*& filename, int& filename_length) 159 { 160 int col_num, abs_pos; 161 return LineNumber(ptr, filename, filename_length, col_num, abs_pos); 162 } 163 #endif 164 157 165 /* 158 166 LineNumber() returns the line number of the line pointed to by PTR. 159 167 */ 168 #ifdef SDS 169 uint Program::LineNumber(char* ptr, char*& filename, int& filename_length, 170 int &col_num, int &abs_pos) 171 #else 160 172 uint Program::LineNumber(char* ptr, char*& filename, int& filename_length) 173 #endif 161 174 { 162 175 sint n; … … 166 179 int nline = 0; 167 180 uint pos = uint(ptr - buf); 181 182 #ifdef SDS 183 int column = -1; 184 uint start = pos; 185 #endif 186 168 187 if(pos > size){ 169 188 // error? … … 173 192 } 174 193 194 #ifdef SDS 195 abs_pos = pos; 196 #endif 197 175 198 sint line_number = -1; 176 199 filename_length = 0; … … 179 202 switch(Ref(--pos)){ 180 203 case '\n' : 181 ++nline; 204 #ifdef SDS 205 if (column == -1) 206 column = start - pos; 207 #endif 208 ++nline; 182 209 break; 183 210 case '#' : … … 197 224 198 225 if(line_number >= 0 && filename_length > 0) 226 #ifdef SDS 227 { 228 col_num = column; 229 return line_number; 230 } 231 #else 199 232 return line_number; 233 #endif 200 234 } 201 235 … … 207 241 if(line_number < 0) 208 242 line_number = nline + 1; 243 244 #ifdef SDS 245 col_num = column; 246 #endif 209 247 210 248 return line_number; … … 256 294 } 257 295 258 #if defined(_MSC_VER) || defined(IRIX_CC) 296 #if defined(_MSC_VER) || defined(IRIX_CC) || defined(__IBMCPP__) 259 297 out << "#line " << nlines + 1 << " \"" << file_name << "\"\n"; 260 298 #else … … 287 325 } 288 326 289 #if defined(_MSC_VER) || defined(IRIX_CC) 327 #if defined(_MSC_VER) || defined(IRIX_CC) || defined(__IBMCPP__) 290 328 out << "\n#line " << line_number << ' '; 291 329 #else … … 309 347 } 310 348 311 #if defined(_MSC_VER) || defined(IRIX_CC) 349 #if defined(_MSC_VER) || defined(IRIX_CC) || defined(OS2) 312 350 out << "\n#line " << nlines + 2 << " \"" << file_name << "\"\n"; 313 351 #else -
branches/stage2/tools/database/occ/buffer.h
r6768 r6770 2 2 Copyright (C) 1997-2001 Shigeru Chiba, Tokyo Institute of Technology. 3 3 4 Permission to use, copy, distribute and modify this software and 5 its documentation for any purpose is hereby granted without fee, 6 provided that the above copyright notice appear in all copies and that 7 both that copyright notice and this permission notice appear in 4 Permission to use, copy, distribute and modify this software and 5 its documentation for any purpose is hereby granted without fee, 6 provided that the above copyright notice appear in all copies and that 7 both that copyright notice and this permission notice appear in 8 8 supporting documentation. 9 9 10 Shigeru Chiba makes no representations about the suitability of this 10 Shigeru Chiba makes no representations about the suitability of this 11 11 software for any purpose. It is provided "as is" without express or 12 12 implied warranty. … … 76 76 77 77 uint LineNumber(char*, char*&, int&); 78 #ifdef SDS 79 uint LineNumber(char*, char*&, int&, int &, int &); 80 #endif 78 81 79 82 void Write(ostream&, const char*); -
branches/stage2/tools/database/occ/driver.cpp
r6768 r6770 147 147 char* cppfile = RunPreprocessor(src); 148 148 occfile = RunOpencxx(cppfile); 149 unlink(cppfile);149 //unlink(cppfile); 150 150 delete cppfile; 151 151 } -
branches/stage2/tools/database/occ/driver2.cpp
r6768 r6770 148 148 AddCppOption("-P"); /* preprocess the file. */ 149 149 AddCppOption("-Pe+"); /* #line */ 150 AddCppOption("-Tp"); // Consider source file as C++ file, 150 AddCppOption("-Tdp"); /* Consider source file as C++ file. */ 151 152 #ifdef SDS 153 AddCppOption("-Pc+"); /* Preserve comments. */ 154 #endif 151 155 152 156 #else … … 200 204 void RunCompiler(const char* org_src, const char *file_in) 201 205 { 206 #ifdef OS2 207 AddCcOption("-Q+"); 208 #else 202 209 AddCcOption("-nologo"); 210 #endif 203 211 if(!makeExecutable) 204 212 AddCcOption("-c"); 205 213 214 #ifdef OS2 215 AddCcOption("-Tdp"); 216 #else 206 217 AddCcOption("-Tp"); 218 #endif 207 219 AddCcOption(file_in); 208 220 if (makeExecutable && makeSharedLibrary) { -
branches/stage2/tools/database/occ/token.cpp
r6768 r6770 70 70 HashTable* Lex::user_keywords = nil; 71 71 Ptree* Lex::comments = nil; 72 #ifdef SDS 73 Ptree* Lex::all_comments = nil; 74 #endif 72 75 73 76 Lex::Lex(Program* prog) : fifo(this) … … 111 114 return file->LineNumber(pos, ptr, len); 112 115 } 116 117 #ifdef SDS 118 uint Lex::LineNumber(char* pos, char*& ptr, int& len, int& col_num, int& abs_pos) 119 { 120 return file->LineNumber(pos, ptr, len, col_num, abs_pos); 121 } 122 #endif 113 123 114 124 int Lex::GetToken(Token& t) … … 767 777 { "asm", token(ATTRIBUTE) }, 768 778 { "auto", token(AUTO) }, 769 #if !defined(_MSC_VER) || (_MSC_VER >= 1100)779 #if (!defined(_MSC_VER) || (_MSC_VER >= 1100)) && !defined(__IBMCPP__) 770 780 { "bool", token(BOOLEAN) }, 771 781 #endif … … 876 886 fRc = Lex::RecordKeyword("_Seg16", Ignore); assert(fRc); //kso 877 887 fRc = Lex::RecordKeyword("_System", Ignore); assert(fRc); //kso 888 #ifdef __IBMCPP__ 889 fRc = Lex::RecordKeyword("_Builtin", Ignore); assert(fRc); //kso 890 #endif 878 891 #endif //kso 879 892 } … … 1013 1026 int Lex::ReadComment(char c, uint top) { 1014 1027 uint len = 0; 1028 #ifdef SDS 1029 bool foneliner = false; 1030 #endif 1015 1031 if (c == '*') // a nested C-style comment is prohibited. 1016 1032 do { … … 1027 1043 }while(c != '\0'); 1028 1044 else /* if (c == '/') */ 1045 #ifdef SDS 1046 { 1047 foneliner = true; 1048 do 1049 { 1050 c = file->Get(); 1051 } while (c && c != '\n'); 1052 } 1053 #else 1029 1054 do { 1030 1055 c = file->Get(); 1031 1056 }while(c != '\n' && c != '\0'); 1057 #endif 1032 1058 1033 1059 len += file->GetCurPos() - top; 1060 #ifdef SDS 1061 if (foneliner) 1062 file->Unget(); 1063 #endif 1034 1064 token_len = int(len); 1035 1065 Leaf* node = new Leaf((char*)file->Read(top), int(len)); 1036 1066 comments = Ptree::Snoc(comments, node); 1067 #ifdef SDS 1068 all_comments = Ptree::Snoc(all_comments, node); 1069 #endif 1037 1070 return Ignore; 1038 1071 } … … 1043 1076 return c; 1044 1077 } 1078 1079 #ifdef SDS 1080 Ptree *Lex::GetAllComments() { 1081 return all_comments; 1082 } 1083 #endif 1045 1084 1046 1085 Ptree* Lex::GetComments2() { -
branches/stage2/tools/database/occ/token.h
r6768 r6770 70 70 Ptree* GetComments(); 71 71 Ptree* GetComments2(); 72 #ifdef SDS 73 Ptree* GetAllComments(); 74 #endif 72 75 73 76 uint LineNumber(char*, char*&, int&); 77 #ifdef SDS 78 uint LineNumber(char*, char*&, int&, int&, int&); 79 #endif 74 80 75 81 static bool RecordKeyword(char*, int); … … 139 145 static HashTable* user_keywords; 140 146 static Ptree* comments; 147 #ifdef SDS 148 static Ptree* all_comments; 149 #endif 141 150 }; 142 151 -
branches/stage2/tools/database/occ/types.h
r6768 r6770 53 53 #endif 54 54 55 #if defined(OS2) && defined(__IBMCPP__) 55 #if defined(OS2) && defined(__IBMCPP__)// && !defined(__opencxx) 56 56 typedef int bool; 57 57 #define true TRUE
Note:
See TracChangeset
for help on using the changeset viewer.
