equal
deleted
inserted
replaced
31 extern TBool gGenBsymbols; |
31 extern TBool gGenBsymbols; |
32 |
32 |
33 boost::mutex SymbolGenerator::iMutexSingleton; |
33 boost::mutex SymbolGenerator::iMutexSingleton; |
34 SymbolGenerator* SymbolGenerator::iInst = NULL; |
34 SymbolGenerator* SymbolGenerator::iInst = NULL; |
35 SymbolGenerator* SymbolGenerator::GetInstance(){ |
35 SymbolGenerator* SymbolGenerator::GetInstance(){ |
36 iMutexSingleton.lock(); |
36 if(iInst == NULL) |
37 if(iInst == NULL) { |
37 { |
38 iInst = new SymbolGenerator(); |
38 iMutexSingleton.lock(); |
39 } |
39 if(iInst == NULL) { |
40 iMutexSingleton.unlock(); |
40 iInst = new SymbolGenerator(); |
|
41 } |
|
42 iMutexSingleton.unlock(); |
|
43 } |
41 return iInst; |
44 return iInst; |
42 } |
45 } |
43 void SymbolGenerator::Release() { |
46 void SymbolGenerator::Release() { |
44 if(iInst != NULL) { |
47 if(iInst != NULL) { |
45 iInst->join(); |
48 iInst->join(); |
97 iCond.notify_all(); |
100 iCond.notify_all(); |
98 } |
101 } |
99 |
102 |
100 void SymbolGenerator::SetFinished() |
103 void SymbolGenerator::SetFinished() |
101 { |
104 { |
102 |
105 boost::mutex::scoped_lock lock(iMutex); |
103 iFinished = true; |
106 iFinished = true; |
104 iCond.notify_all(); |
107 iCond.notify_all(); |
105 } |
108 } |
106 TPlacedEntry SymbolGenerator::GetNextPlacedEntry() |
109 TPlacedEntry SymbolGenerator::GetNextPlacedEntry() |
107 { |
110 { |
140 } |
143 } |
141 } |
144 } |
142 SymbolGenerator::~SymbolGenerator(){ |
145 SymbolGenerator::~SymbolGenerator(){ |
143 if(joinable()) |
146 if(joinable()) |
144 join(); |
147 join(); |
|
148 for(int i=0; i < (int)iLogMessages.size(); i++) |
|
149 { |
|
150 cout << iLogMessages[i]; |
|
151 } |
145 iSymFile.flush(); |
152 iSymFile.flush(); |
146 iSymFile.close(); |
153 iSymFile.close(); |
147 } |
154 } |
148 void SymbolGenerator::FlushSymbolFileContent() |
155 void SymbolGenerator::FlushSymbolFileContent() |
149 { |
156 { |
302 { |
309 { |
303 SymbolProcessUnit* aSymbolProcessUnit; |
310 SymbolProcessUnit* aSymbolProcessUnit; |
304 SymbolGenerator* symbolgenerator = SymbolGenerator::GetInstance(); |
311 SymbolGenerator* symbolgenerator = SymbolGenerator::GetInstance(); |
305 if(symbolgenerator->GetImageType() == ERomImage) |
312 if(symbolgenerator->GetImageType() == ERomImage) |
306 { |
313 { |
307 aSymbolProcessUnit = new CommenRomSymbolProcessUnit(); |
314 if(gGenBsymbols) |
|
315 { |
|
316 aSymbolProcessUnit = new BsymRomSymbolProcessUnit(symbolgenerator); |
|
317 } |
|
318 else |
|
319 { |
|
320 aSymbolProcessUnit = new CommenRomSymbolProcessUnit(); |
|
321 } |
308 } |
322 } |
309 else |
323 else |
310 { |
324 { |
311 if(gGenBsymbols) |
325 if(gGenBsymbols) |
312 { |
326 { |
329 continue; |
343 continue; |
330 |
344 |
331 aSymbolProcessUnit->ProcessEntry(pe); |
345 aSymbolProcessUnit->ProcessEntry(pe); |
332 |
346 |
333 symbolgenerator->LockOutput(); |
347 symbolgenerator->LockOutput(); |
334 aSymbolProcessUnit->FlushStdOut(cout); |
348 aSymbolProcessUnit->FlushStdOut(symbolgenerator->iLogMessages); |
335 aSymbolProcessUnit->FlushSymbolContent(symbolgenerator->GetOutputFileStream()); |
349 aSymbolProcessUnit->FlushSymbolContent(symbolgenerator->GetOutputFileStream()); |
336 symbolgenerator->UnlockOutput(); |
350 symbolgenerator->UnlockOutput(); |
337 } |
351 } |
338 delete aSymbolProcessUnit; |
352 delete aSymbolProcessUnit; |
339 } |
353 } |