OpenASIP 2.2
Loading...
Searching...
No Matches
GenerateBits.cc
Go to the documentation of this file.
1/*
2 Copyright (c) 2002-2011 Tampere University.
3
4 This file is part of TTA-Based Codesign Environment (TCE).
5
6 Permission is hereby granted, free of charge, to any person obtaining a
7 copy of this software and associated documentation files (the "Software"),
8 to deal in the Software without restriction, including without limitation
9 the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 and/or sell copies of the Software, and to permit persons to whom the
11 Software is furnished to do so, subject to the following conditions:
12
13 The above copyright notice and this permission notice shall be included in
14 all copies or substantial portions of the Software.
15
16 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
19 THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 DEALINGS IN THE SOFTWARE.
23 */
24/**
25 * @file GenerateBits.cc
26 *
27 * Implementation of the main function of generatebits application.
28 *
29 * @author Lasse Laasonen 2005 (lasse.laasonen-no.spam-tut.fi)
30 * @author Otto Esko 2009 (otto.esko-no.spam-tut.fi)
31 * @author Pekka Jääskeläinen 2009 (pekka.jaaskelainen-no.spam-tut.fi)
32 * @author Otto Esko 2010 (otto.esko-no.spam-tut.fi)
33 * @author Pekka Jääskeläinen 2011
34 * @author Vinogradov Viacheslav(added Verilog generating) 2012
35 * @note rating: red
36 */
37
38#include <iostream>
39#include <cmath>
40
41#include <boost/format.hpp>
42
43#include "PIGCmdLineOptions.hh"
46#include "ADFSerializer.hh"
47#include "Machine.hh"
48#include "ControlUnit.hh"
49#include "BinaryEncoding.hh"
50#include "BEMSerializer.hh"
51#include "BEMGenerator.hh"
52#include "Binary.hh"
53#include "BinaryStream.hh"
54#include "BinaryReader.hh"
55#include "FileSystem.hh"
56
57using std::cerr;
58using std::endl;
59using std::string;
60using std::ofstream;
61
62using namespace TPEF;
63using namespace TTAMachine;
64
66const string IMEM_MAU_PKG = "imem_mau_pkg.vhdl";
67const string VER_IMEM_MAU_PKG = "imem_mau_pkg.vh";
68const string DECOMPRESSOR_FILE = "idecompressor.vhdl";
69
70const string TB_DIR = "tb";
72const string TB_IMEM_FILE = "imem_init.img";
73const string TB_DMEM_FILE = "dmem_init.img";
74
75/**
76 * Loads the given TPEF file and creates a Binary instance from it.
77 *
78 * @param tpefFile The TPEF file.
79 * @return The newly created Binary instance.
80 * @exception InstanceNotFound If instance for reading wasn't found.
81 * @exception UnreachableStream If given file can't be read.
82 * @exception KeyAlreadyExists Key was in use when trying to register object.
83 * @exception EndOfFile If end of file were reached while it shouldn't.
84 * @exception OutOfRange Some read value was out of range.
85 * @exception WrongSubclass Some class couldn't do what it was asked for.
86 * @exception UnexpectedValue If there was unexpected value when reading.
87 */
88static Binary*
89loadTPEF(const std::string& tpefFile) {
90 BinaryStream stream(tpefFile);
91 return BinaryReader::readBinary(stream);
92}
93
94/**
95 * Loads the given BEM file and creates a BinaryEncoding instance from it.
96 *
97 * @param bemFile The BEM file.
98 * @return The newly created BinaryEncoding instance.
99 * @exception SerializerException If an error occurs while reading the
100 * file.
101 * @exception ObjectStateLoadingException If an error occurs while loading
102 * the state of BinaryEncoding
103 * instance.
104 */
105static BinaryEncoding*
106loadBEM(const std::string& bemFile) {
107 BEMSerializer serializer;
108 serializer.setSourceFile(bemFile);
109 return serializer.readBinaryEncoding();
110}
111
112/**
113 * Loads the given ADF file and creates a Machine instance from it.
114 *
115 * @param adfFile The ADF file.
116 * @return The newly created Machine instance.
117 * @exception SerializerException If an error occurs while reading the file.
118 * @exception ObjectStateLoadingException If an error occurs while loading
119 * the state of Machine instance.
120 */
121static Machine*
122loadMachine(const std::string& adfFile) {
123 ADFSerializer serializer;
124 serializer.setSourceFile(adfFile);
125 return serializer.readMachine();
126}
127
128/**
129 * Tells whether the given address space is instruction memory.
130 *
131 * @param as The address space.
132 * @return True if the address space is instruction memory, otherwise false.
133 */
134static bool
136 Machine* mach = as.machine();
137 ControlUnit* gcu = mach->controlUnit();
138 if (gcu != NULL && gcu->addressSpace() == &as) {
139 return true;
140 } else {
141 return false;
142 }
143}
144
145
146/**
147 * Returns the name of the program's imem image file for the given TPEF file.
148 *
149 * @param tpefFile Name of the TPEF file.
150 * @param format The image output format
151 * @return Name of the program image file.
152 */
153std::string
154programImemImageFile(const std::string& tpefFile, const std::string& format) {
155
156 string imageFile = FileSystem::fileNameBody(tpefFile);
157 if (format == "mif") {
158 // altera tools want .mif ending for MIF files
159 imageFile += ".mif";
160 } else if (format == "vhdl") {
161 imageFile += "_imem_pkg.vhdl";
162 } else if (format == "coe") {
163 imageFile += ".coe";
164 } else {
165 imageFile += ".img";
166 }
167 return imageFile;
168}
169
170/**
171 * Returns the name of the program data image file for the given TPEF file.
172 *
173 * @param tpefFile Name of the TPEF file.
174 * @param format The image output format
175 * @param asName Name of the address space the image belongs to.
176 * @return Name of the program image file.
177 */
178std::string
180 const std::string& tpefFile,
181 const std::string& format,
182 const std::string& asName) {
183
184 string imageFile = FileSystem::fileNameBody(tpefFile) + "_" + asName;
185 if (format == "mif") {
186 imageFile += ".mif";
187 } else if (format == "vhdl") {
188 imageFile += "_pkg.vhdl";
189 } else if (format == "coe") {
190 imageFile += ".coe";
191 } else {
192 imageFile += ".img";
193 }
194 return imageFile;
195}
196
197/**
198 * Parses the given parameter which has form 'paramname=paramvalue" to
199 * different strings.
200 *
201 * @param param The parameter.
202 * @param paramName Parameter name is stored here.
203 * @param paramValue Parameter value is stored here.
204 * @exception InvalidData If the given parameter is not in the correct form.
205 */
206void
208 const std::string& param, std::string& paramName, std::string& paramValue) {
209 string::size_type separatorPos = param.find("=", 0);
210 if (separatorPos == string::npos) {
211 string errorMsg =
212 "Compressor parameters must be in form "
213 "'parametername=parametervalue'.";
214 throw InvalidData(__FILE__, __LINE__, __func__, errorMsg);
215 }
216
217 paramName = param.substr(0, separatorPos);
218 paramValue = param.substr(separatorPos+1, param.length());
219}
220
221void
222createMauPkg(int language,
223 int imemMauWidth, string fileName, string entityNameStr) {
224
225 string indentation = " ";
226
227 if (!FileSystem::fileExists(fileName)
228 && !FileSystem::createFile(fileName)) {
229 string errorMsg = "Unable to create file " + fileName;
230 throw IOException(__FILE__, __LINE__, __func__, errorMsg);
231 } else if (!FileSystem::fileIsWritable(fileName)) {
232 string errorMsg = "Unable to write to file " + fileName;
233 throw IOException(__FILE__, __LINE__, __func__, errorMsg);
234 }
235 std::ofstream stream(fileName.c_str());
236 string entityName = entityNameStr + "_imem_mau";
237 if(language==0){//vhdl
238 stream << "package " << entityName << " is" << endl
239 << indentation << "-- created by generatebits" << endl
240 << indentation << "constant IMEMMAUWIDTH : positive := "
241 << imemMauWidth << ";" << endl
242 << "end " << entityName << ";" << endl;
243 } else {
244 stream << "//package " << entityName << " is" << endl
245 << indentation << "// created by generatebits" << endl
246 << indentation << "parameter IMEMMAUWIDTH = "
247 << imemMauWidth << endl
248 << "//end " << entityName << ";" << endl;
249 }
250 stream.close();
251}
252
253void
255 string fileName, ProgramImageGenerator& imageGenerator,
256 string entityStr) {
257
258 bool created = FileSystem::createFile(fileName);
259 if (!created) {
260 string errorMsg = "Unable to create file " +
261 fileName;
262 throw IOException(__FILE__, __LINE__, __func__, errorMsg);
263 }
264 std::ofstream decompressorStream(
265 fileName.c_str(), std::ofstream::out);
266 imageGenerator.generateDecompressor(decompressorStream, entityStr);
267 decompressorStream.close();
268}
269
270void
272 const string& source,
273 const string& progeDir,
274 const string& newImage) {
275
276 if (!progeDir.empty()) {
277 string tbDir = progeDir + DIR_SEP + TB_DIR;
278 string tbImage = tbDir + DIR_SEP + newImage;
280 && (FileSystem::fileIsWritable(tbImage)
281 || FileSystem::fileIsCreatable(tbImage))) {
282 try {
283 FileSystem::copy(source, tbImage);
284 } catch (Exception& e) {
285 cerr << e.errorMessage() << endl;
286 }
287 }
288 }
289}
290
291/**
292 * The main function of generatebits application.
293 */
294int main(int argc, char* argv[]) {
295
297 try {
298 options->parse(argv, argc);
299 } catch (ParserStopRequest const&) {
300 return EXIT_SUCCESS;
301 } catch (const IllegalCommandLine& exception) {
302 cerr << exception.errorMessage() << endl;
303 return EXIT_FAILURE;
304 }
305
307
308 string adfFile = "";
309 if (options->numberOfArguments() < 1) {
310 PIGCLITextGenerator textGen;
311 cerr << textGen.text(PIGCLITextGenerator::TXT_ADF_REQUIRED) << endl;
312 return EXIT_FAILURE;
313 } else if (options->numberOfArguments() > 1) {
314 PIGCLITextGenerator textGen;
315 cerr << textGen.text(PIGCLITextGenerator::TXT_ILLEGAL_ARGS) << endl;
316 return EXIT_FAILURE;
317 } else {
318 adfFile = options->argument(1);
319 }
320
321 string bemFile = options->bemFile();
322 string piFormat = options->programImageOutputFormat();
323 string diFormat = options->dataImageOutputFormat();
324 int dmemMAUsPerLine = options->dataMemoryWidthInMAUs();
325 string compressor = options->compressorPlugin();
326 const bool useCompression = compressor != "";
327 bool generateDataImages = options->generateDataImages();
328 bool generateDecompressor = options->generateDecompressor();
329 bool showCompressors = options->showCompressors();
330 int imemMAUsPerLine = DEFAULT_IMEMWIDTH_IN_MAUS;
331 string progeOutputDir = options->progeOutputDirectory();
332
333 TCEString entityStr = options->entityName();
334 if (entityStr == "")
335 entityStr = "tta0";
336
337 if (showCompressors) {
338 std::vector<string> compressorFiles =
340 for (std::vector<string>::const_iterator iter =
341 compressorFiles.begin();
342 iter != compressorFiles.end(); iter++) {
343 try {
344 std::cout << "******************************************"
345 << "**********************" << endl;
346 std::cout << "Compressor file: " << *iter << endl;
347
349 *iter, std::cout);
350 } catch (const Exception& e) {
351 cerr << "Error: " << e.errorMessage() << endl;
352 }
353 std::cout << std::endl;
354 }
355 return EXIT_SUCCESS;
356 }
357
359 for (int i = 0; i < options->compressorParameterCount(); i++) {
360 string param = options->compressorParameter(i);
361 string paramName;
362 string paramValue;
363 try {
364 parseParameter(param, paramName, paramValue);
365 } catch (const Exception& e) {
366 cerr << e.errorMessage() << endl;
367 return EXIT_FAILURE;
368 }
369 CodeCompressorPlugin::Parameter newParam = {paramName, paramValue};
370 compressorParams.push_back(newParam);
371 }
372
373 if (adfFile == "" ||
374 (piFormat != "" && piFormat != "binary" && piFormat != "ascii" &&
375 piFormat != "array" && piFormat != "mif" && piFormat != "vhdl" &&
376 piFormat != "coe" && piFormat != "hex" && piFormat != "bin2n") ||
377 (diFormat != "" && diFormat != "binary" &&
378 diFormat != "ascii" && diFormat != "array" && diFormat != "mif" &&
379 diFormat != "vhdl" && diFormat != "coe" && diFormat != "hex" && diFormat != "bin2n")) {
381 return EXIT_FAILURE;
382 }
383
384 std::vector<Binary*> tpefTable;
386 try {
387 Machine* mach = loadMachine(adfFile);
388
389 for (int i = 0; i < options->tpefFileCount(); i++) {
390 string tpefFile = options->tpefFile(i);
391 Binary* tpef = loadTPEF(tpefFile);
392 tpefTable.push_back(tpef);
393 tpefMap[FileSystem::fileOfPath(tpefFile)] = tpef;
394 }
395
396 BinaryEncoding* bem = NULL;
397
398 if (bemFile != "") {
399 bem = loadBEM(bemFile);
400 } else {
401 PIGCLITextGenerator textGen;
402#if 0
403 // useless error output as this happens 100% of the time,
404 // no-one hasn't wanted to customize BEMs yet
405 std::cerr
407 str() << std::endl;
408#endif
409 BEMGenerator bemGenerator(*mach);
410 bem = bemGenerator.generate();
411 }
412
413 ProgramImageGenerator imageGenerator;
414 if (useCompression) {
415 imageGenerator.loadCompressorPlugin(compressor);
416 }
417 imageGenerator.loadCompressorParameters(compressorParams);
418 imageGenerator.loadBEM(*bem);
419 imageGenerator.loadMachine(*mach);
420 imageGenerator.loadPrograms(tpefMap);
421 imageGenerator.setEntityName(entityStr);
422 imageGenerator.setDataStartOptions(options->dataStart());
423
424 if (Application::verboseLevel() > 0) {
426 << (boost::format(
427 "uncompressed instruction width: %d bits (%d bytes)\n" )
428 % bem->width() % std::ceil(bem->width() / 8.0)).str();
429 }
430
431 for (size_t i = 0; i < tpefTable.size(); i++) {
432
433 Binary* program = tpefTable[i];
434 string tpefFile = FileSystem::fileOfPath(options->tpefFile(i));
435 string imageFile = programImemImageFile(tpefFile, piFormat);
436 ofstream piStream(imageFile.c_str());
437 if (piFormat == "binary") {
438 imageGenerator.generateProgramImage(
439 tpefFile, piStream, ProgramImageGenerator::BINARY);
440 } else if (piFormat == "array") {
441 imageGenerator.generateProgramImage(
442 tpefFile, piStream, ProgramImageGenerator::ARRAY,
443 imemMAUsPerLine);
444 } else if (piFormat == "mif") {
445 imageGenerator.generateProgramImage(
446 tpefFile, piStream, ProgramImageGenerator::MIF,
447 imemMAUsPerLine);
448 } else if (piFormat == "vhdl") {
449 imageGenerator.generateProgramImage(
450 tpefFile, piStream, ProgramImageGenerator::VHDL,
451 imemMAUsPerLine);
452 } else if (piFormat == "coe") {
453 imageGenerator.generateProgramImage(
454 tpefFile, piStream, ProgramImageGenerator::COE,
455 imemMAUsPerLine);
456 } else if (piFormat == "hex") {
457 imageGenerator.generateProgramImage(
458 tpefFile, piStream, ProgramImageGenerator::HEX,
459 imemMAUsPerLine);
460 } else if (piFormat == "bin2n") {
461 imageGenerator.generateProgramImage(
462 tpefFile, piStream, ProgramImageGenerator::BIN2N,
463 imemMAUsPerLine);
464 } else {
465 assert(piFormat == "ascii" || piFormat == "");
466 imageGenerator.generateProgramImage(
467 tpefFile, piStream, ProgramImageGenerator::ASCII,
468 imemMAUsPerLine);
469 }
470 piStream.close();
471
472 if (piFormat == "ascii" || piFormat == "") {
473 copyImageToTb(imageFile, progeOutputDir, TB_IMEM_FILE);
474 }
475
476 if (generateDataImages) {
478 mach->addressSpaceNavigator();
479 for (int i = 0; i < asNav.count(); i++) {
480 AddressSpace* as = asNav.item(i);
481 if (!isInstructionMemory(*as)) {
482 string fileName =
484 tpefFile, diFormat, as->name());
485 ofstream stream(fileName.c_str());
486 if (diFormat == "binary") {
487 imageGenerator.generateDataImage(
488 tpefFile, *program, as->name(), stream,
490 } else if (diFormat == "array") {
491 imageGenerator.generateDataImage(
492 tpefFile, *program, as->name(), stream,
494 dmemMAUsPerLine, true);
495 } else if (diFormat == "mif") {
496 imageGenerator.generateDataImage(
497 tpefFile, *program, as->name(), stream,
499 dmemMAUsPerLine, true);
500 } else if (diFormat == "vhdl") {
501 imageGenerator.generateDataImage(
502 tpefFile, *program, as->name(), stream,
504 dmemMAUsPerLine, true);
505 } else if (diFormat == "coe") {
506 imageGenerator.generateDataImage(
507 tpefFile, *program, as->name(), stream,
509 dmemMAUsPerLine, true);
510 } else if (diFormat == "hex") {
511 imageGenerator.generateDataImage(
512 tpefFile, *program, as->name(), stream,
514 dmemMAUsPerLine, true);
515 } else if (diFormat == "bin2n") {
516 imageGenerator.generateDataImage(
517 tpefFile, *program, as->name(), stream,
519 dmemMAUsPerLine, true);
520 } else {
521 assert(diFormat == "ascii" || diFormat == "");
522 imageGenerator.generateDataImage(
523 tpefFile, *program, as->name(), stream,
525 dmemMAUsPerLine, true);
526 }
527 stream.close();
528
529 if (diFormat == "ascii" || piFormat == "") {
530 std::string dmemInitFile("dmem_");
531 dmemInitFile += as->name() + "_init.img";
533 fileName, progeOutputDir, dmemInitFile);
534 }
535 }
536 }
537 }
538 }
539
540 if (generateDecompressor) {
541 string decomp = DECOMPRESSOR_FILE;
542 if (!progeOutputDir.empty()) {
543 string temp =
544 progeOutputDir + DIR_SEP + "gcu_ic" + DIR_SEP
546 if ( (FileSystem::fileExists(temp)
549 decomp = temp;
550 }
551 }
552 createCompressor(decomp, imageGenerator, entityStr);
553 }
554
555 int compressedInstructionWidth = imageGenerator.imemMauWidth();
556 if (!progeOutputDir.empty()) {
557 string temp =
558 progeOutputDir + DIR_SEP + "vhdl" + DIR_SEP + entityStr +
559 "_" + IMEM_MAU_PKG;
560 if ( (FileSystem::fileExists(temp)
563 //vhdl
564 createMauPkg(0,compressedInstructionWidth, temp, entityStr);
565 }
566 temp =
567 progeOutputDir + DIR_SEP + "verilog" + DIR_SEP + entityStr +
568 "_" + VER_IMEM_MAU_PKG;
569 if ( (FileSystem::fileExists(temp)
572 //verilog
573 createMauPkg(1,compressedInstructionWidth, temp, entityStr);
574 }
575 } else {//if none exist generate in current folder for both HDLs
576 createMauPkg(0,compressedInstructionWidth, entityStr + "_" +
577 IMEM_MAU_PKG, entityStr); //vhdl
578 createMauPkg(1,compressedInstructionWidth,
579 entityStr + "_" + VER_IMEM_MAU_PKG, entityStr); //verilog
580 }
581
582 for (std::vector<Binary*>::iterator iter = tpefTable.begin();
583 iter != tpefTable.end(); iter++) {
584 delete *iter;
585 }
586 delete mach;
587 delete bem;
588
589 return EXIT_SUCCESS;
590
591 } catch (const Exception& exception) {
592 cerr << exception.errorMessageStack() << endl;
593 return EXIT_FAILURE;
594 }
595}
#define __func__
#define assert(condition)
const string VER_IMEM_MAU_PKG
const string DIR_SEP
int main(int argc, char *argv[])
void createCompressor(string fileName, ProgramImageGenerator &imageGenerator, string entityStr)
static bool isInstructionMemory(const TTAMachine::AddressSpace &as)
void parseParameter(const std::string &param, std::string &paramName, std::string &paramValue)
const string DECOMPRESSOR_FILE
const string IMEM_MAU_PKG
static Binary * loadTPEF(const std::string &tpefFile)
static Machine * loadMachine(const std::string &adfFile)
void copyImageToTb(const string &source, const string &progeDir, const string &newImage)
const string TB_DMEM_FILE
std::string programDataImageFile(const std::string &tpefFile, const std::string &format, const std::string &asName)
const int DEFAULT_IMEMWIDTH_IN_MAUS
void createMauPkg(int language, int imemMauWidth, string fileName, string entityNameStr)
const string TB_DIR
std::string programImemImageFile(const std::string &tpefFile, const std::string &format)
const string TB_IMEM_FILE
static BinaryEncoding * loadBEM(const std::string &bemFile)
find Finds info of the inner loops in the program
static MachInfoCmdLineOptions options
Definition MachInfo.cc:46
TTAMachine::Machine * readMachine()
static void setCmdLineOptions(CmdLineOptions *options_)
static int verboseLevel()
static std::ostream & logStream()
BinaryEncoding * generate()
BinaryEncoding * readBinaryEncoding()
virtual int width(const TCEString &templateName) const
void parse(char *argv[], int argc)
virtual std::string argument(int index) const
virtual int numberOfArguments() const
std::vector< Parameter > ParameterTable
Table for passing plugin parameters.
std::string errorMessageStack(bool messagesOnly=false) const
Definition Exception.cc:138
std::string errorMessage() const
Definition Exception.cc:123
static bool createFile(const std::string &file)
static const std::string DIRECTORY_SEPARATOR
static std::string fileNameBody(const std::string &fileName)
static std::string fileOfPath(const std::string pathName)
static void copy(const std::string &source, const std::string &target)
static bool fileIsDirectory(const std::string fileName)
static bool fileIsWritable(const std::string fileName)
static bool fileIsCreatable(const std::string fileName)
static bool fileExists(const std::string fileName)
virtual void printHelp() const
void loadPrograms(TPEFMap programs)
void setDataStartOptions(CmdLineOptionParser *options)
static std::vector< std::string > availableCompressors()
std::map< std::string, TPEF::Binary * > TPEFMap
void generateDataImage(const std::string &programName, TPEF::Binary &program, const std::string &addressSpace, std::ostream &stream, OutputFormat format, int mausPerLine, bool usePregeneratedImage)
void setEntityName(const std::string &entity)
void loadCompressorPlugin(const std::string &fileName)
void loadCompressorParameters(CodeCompressorPlugin::ParameterTable parameters)
@ BINARY
Real binary format.
@ VHDL
Array as a Vhdl package.
@ BIN2N
Binary format padded to 2**n.
@ MIF
MIF Memory Initialization File.
@ ARRAY
ASCII 1's and 0's in array form.
@ COE
COE memory initialization format.
@ HEX
HEX memory initialization format.
static void printCompressorDescription(const std::string &fileName, std::ostream &stream)
void generateProgramImage(const std::string &programName, std::ostream &stream, OutputFormat format, int mausPerLine=0)
void generateDecompressor(std::ostream &stream, TCEString entityStr)
void loadMachine(const TTAMachine::Machine &machine)
void loadBEM(const BinaryEncoding &bem)
static Binary * readBinary(BinaryStream &stream)
virtual Machine * machine() const
virtual TCEString name() const
virtual AddressSpace * addressSpace() const
ComponentType * item(int index) const
virtual AddressSpaceNavigator addressSpaceNavigator() const
Definition Machine.cc:392
virtual ControlUnit * controlUnit() const
Definition Machine.cc:345
virtual boost::format text(int textId)
void setSourceFile(const std::string &fileName)