本文整理汇总了C++中CFileWriter::writeOutputFiles方法的典型用法代码示例。如果您正苦于以下问题:C++ CFileWriter::writeOutputFiles方法的具体用法?C++ CFileWriter::writeOutputFiles怎么用?C++ CFileWriter::writeOutputFiles使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CFileWriter
的用法示例。
在下文中一共展示了CFileWriter::writeOutputFiles方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: sizeof
RCType
TraceGen::generate(J9TDFOptions *options, const char *currentTDFFile)
{
RCType rc = RC_FAILED;
unsigned int groupCount = 0;
J9TDFGroup *groups = NULL;
J9TDFFile *tdf = NULL;
FileReader reader;
TDFParser parser;
Path *current = _visitedFile;
char *realPath = NULL;
/**
* User might specify multiple scan roots for example -root src,src/omr
* To avoid processing trace files multiple times keep the record of processed files.
* To handle relative paths omrfile_realpath is used to resolve canonicalized absolute pathname.
*/
if (NULL == (realPath = Port::omrfile_realpath(currentTDFFile))) {
FileUtils::printError("Failed to resolve full path to file: %s\n", currentTDFFile);
goto done;
}
while (NULL != current) {
if (0 == strcmp(current->path, realPath)) {
break;
}
current = current->next;
}
if (NULL == current) {
Path *tmp = (Path *) Port::omrmem_calloc(1, sizeof(Path));
tmp->path = realPath;
tmp->next = _visitedFile;
_visitedFile = tmp;
} else if (options->debugOutput) {
FileUtils::printError("File %s was already processed\n", realPath);
goto done;
}
printf("Processing tdf file %s\n", currentTDFFile);
rc = reader.init(currentTDFFile);
if (RC_OK != rc) {
FileUtils::printError("Failed to read from file: %s\n", currentTDFFile);
goto done;
}
parser.init(&reader, options->treatWarningAsError);
tdf = parser.parse();
if (NULL == tdf) {
rc = RC_FAILED;
goto done;
}
tdf->fileName = strdup(currentTDFFile);
if (NULL == tdf->fileName) {
eprintf("Failed to allocate memory");
rc = RC_FAILED;
goto done;
}
groups = calculateGroups(tdf, &groupCount);
if (NULL == groups) {
FileUtils::printError("Failed to calculate tracepoint groups");
rc = RC_FAILED;
goto done;
}
TraceHeaderWriter hfw;
DATFileWriter dfw;
CFileWriter cfw;
rc = hfw.writeOutputFiles(options, tdf);
if (RC_OK != rc) {
FileUtils::printError("Failed to generate header file for %s\n", currentTDFFile);
goto done;
}
rc = dfw.writeOutputFiles(options, tdf);
if (RC_OK != rc) {
FileUtils::printError("Failed to generate DAT file for %s\n", currentTDFFile);
goto done;
}
if (options->generateCFiles) {
rc = cfw.writeOutputFiles(options, tdf, groups, groupCount);
if (RC_OK != rc) {
FileUtils::printError("Failed to generate C file for %s\n", currentTDFFile);
goto done;
}
}
done:
if (NULL != tdf) {
Port::omrmem_free((void **)&tdf->fileName);
Port::omrmem_free((void **)&tdf->header.datfilename);
Port::omrmem_free((void **)&tdf->header.executable);
Port::omrmem_free((void **)&tdf->header.submodules);
J9TDFTracepoint *tp = tdf->tracepoints;
while (NULL != tp) {
//.........这里部分代码省略.........