Commit 13f18b02 authored by Christoffer Ackelman's avatar Christoffer Ackelman

Removed CnvFile since it was only an alias of std::ofstream.

parent bdb8a2b2
/*
* ProviewR Open Source Process Control.
* Copyright (C) 2005-2018 SSAB EMEA AB.
*
* This file is part of ProviewR.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation, either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with ProviewR. If not, see <http://www.gnu.org/licenses/>
*
* Linking ProviewR statically or dynamically with other modules is
* making a combined work based on ProviewR. Thus, the terms and
* conditions of the GNU General Public License cover the whole
* combination.
*
* In addition, as a special exception, the copyright holders of
* ProviewR give you permission to, from the build function in the
* ProviewR Configurator, combine ProviewR with modules generated by the
* ProviewR PLC Editor to a PLC program, regardless of the license
* terms of these modules. You may copy and distribute the resulting
* combined work under the terms of your choice, provided that every
* copy of the combined work is accompanied by a complete copy of
* the source code of ProviewR (the version used to produce the
* combined work), being distributed under the terms of the GNU
* General Public License plus this exception.
*/
#ifndef cnv_file_h
#define cnv_file_h
#include <fstream>
class CnvFile {
public:
std::ofstream f;
};
#endif
......@@ -37,6 +37,8 @@
#ifndef cnv_readsrc_h
#define cnv_readsrc_h
#include <fstream>
/* cnv_readsrc.h -- Read source files */
#include "cnv_ctx.h"
......
......@@ -37,8 +37,9 @@
#ifndef cnv_readwbl_h
#define cnv_readwbl_h
#include <fstream>
#include "pwr.h"
#include "cnv_file.h"
class CnvCtx;
class CnvWblTo;
......
......@@ -158,15 +158,14 @@ int CnvWblToH::class_exec()
sprintf(fname, "%s%s_c_%s.h", ctx->dir, volume_name_low,
CnvCtx::low(ctx->rw->class_name));
if (!ctx->common_structfile_only) {
cstruc = new CnvFile();
cstruc->f.open(fname);
fp_cstruc.open(fname);
}
struct_class_open = 1;
sprintf(
fname, "%s_c_%s_h", volume_name_low, CnvCtx::low(ctx->rw->class_name));
if (!ctx->common_structfile_only)
cstruc->f << "/* Generated by co_convert */\n\n"
fp_cstruc << "/* Generated by co_convert */\n\n"
<< "#ifndef " << fname << '\n'
<< "#define " << fname << '\n'
<< '\n'
......@@ -238,7 +237,7 @@ int CnvWblToH::body_exec()
<< "#define pwr_cClass_" << cclass_name << " " << cid << "UL\n"
<< '\n';
if (!ctx->common_structfile_only)
cstruc->f << '\n'
fp_cstruc << '\n'
<< "#ifndef pwr_cClass_" << cclass_name << '\n'
<< "#define pwr_cClass_" << cclass_name << " " << cid << "UL\n"
<< '\n';
......@@ -259,7 +258,7 @@ int CnvWblToH::body_exec()
<< " @Aref " << ctx->rw->class_name << " " << struct_name << '\n'
<< "*/\n";
if (!ctx->common_structfile_only)
cstruc->f << "/* Body: " << ctx->rw->body_name << " */\n";
fp_cstruc << "/* Body: " << ctx->rw->body_name << " */\n";
if (ctx->hpp)
fp_struct << '\n' << "class " << struct_name << " ";
......@@ -267,9 +266,9 @@ int CnvWblToH::body_exec()
fp_struct << '\n' << "typedef struct {\n";
if (!ctx->common_structfile_only) {
if (ctx->hpp)
cstruc->f << '\n' << "class " << struct_name << " ";
fp_cstruc << '\n' << "class " << struct_name << " ";
else
cstruc->f << '\n' << "typedef struct {\n";
fp_cstruc << '\n' << "typedef struct {\n";
}
return 1;
}
......@@ -286,7 +285,7 @@ int CnvWblToH::body_close()
// Write a dummy element...
fp_struct << " int dummy;\n";
if (!ctx->common_structfile_only)
cstruc->f << " int dummy;\n";
fp_cstruc << " int dummy;\n";
}
if (streq(CnvCtx::low(ctx->rw->body_name), "devbody"))
......@@ -301,16 +300,16 @@ int CnvWblToH::body_close()
if (ctx->hpp) {
fp_struct << "};" << '\n';
if (!ctx->common_structfile_only)
cstruc->f << "};" << '\n';
fp_cstruc << "};" << '\n';
} else {
fp_struct << "} " << struct_name << ";" << '\n';
if (!ctx->common_structfile_only)
cstruc->f << "} " << struct_name << ";" << '\n';
fp_cstruc << "} " << struct_name << ";" << '\n';
}
fp_struct << '\n';
if (!ctx->common_structfile_only)
cstruc->f << '\n';
fp_cstruc << '\n';
return 1;
}
......@@ -324,7 +323,7 @@ int CnvWblToH::class_close()
<< ctx->rw->class_id << "UL\n"
<< '\n';
if (!ctx->common_structfile_only && struct_class_open)
cstruc->f << '\n'
fp_cstruc << '\n'
<< "#ifndef pwr_cClass_" << ctx->rw->class_name << '\n'
<< "#define pwr_cClass_" << ctx->rw->class_name << " "
<< ctx->rw->class_id << "UL\n"
......@@ -338,16 +337,15 @@ int CnvWblToH::class_close()
fp_struct << "#endif\n" << '\n';
if (!ctx->common_structfile_only && struct_class_open)
cstruc->f << "#endif\n" << '\n';
fp_cstruc << "#endif\n" << '\n';
struct_cclass_endwritten = 1;
}
// Close class structfile
if (!ctx->common_structfile_only && struct_class_open)
cstruc->f << "#endif\n" << '\n';
fp_cstruc << "#endif\n" << '\n';
if (!ctx->common_structfile_only && struct_class_open) {
cstruc->f.close();
delete cstruc;
fp_cstruc.close();
struct_class_open = 0;
}
......@@ -455,7 +453,7 @@ int CnvWblToH::attribute_exec()
fp_struct << ": public " << type_name << " {\n"
<< " public:\n";
if (!ctx->common_structfile_only)
cstruc->f << type_name << " {\n"
fp_cstruc << type_name << " {\n"
<< " public:\n";
attr_count++;
return 1;
......@@ -463,7 +461,7 @@ int CnvWblToH::attribute_exec()
fp_struct << " {\n"
<< " public:\n";
if (!ctx->common_structfile_only)
cstruc->f << " {\n"
fp_cstruc << " {\n"
<< " public:\n";
}
}
......@@ -472,55 +470,55 @@ int CnvWblToH::attribute_exec()
if (ctx->rw->attr_array && ctx->rw->attr_pointer) {
fp_struct << " " << type_name;
if (!ctx->common_structfile_only)
cstruc->f << " " << type_name;
fp_cstruc << " " << type_name;
for (i = 0; i < int(35 - strlen(type_name)); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << " **" << pgmname << "P[" << ctx->rw->attr_elements << "]"
<< alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << " **" << pgmname << "P[" << ctx->rw->attr_elements << "]"
fp_cstruc << " **" << pgmname << "P[" << ctx->rw->attr_elements << "]"
<< alignstr << ";\n";
} else if (ctx->rw->attr_array) {
fp_struct << " " << type_name;
if (!ctx->common_structfile_only)
cstruc->f << " " << type_name;
fp_cstruc << " " << type_name;
for (i = 0; i < int(35 - strlen(type_name)); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << " *" << pgmname << "P[" << ctx->rw->attr_elements << "]"
<< alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << " *" << pgmname << "P[" << ctx->rw->attr_elements << "]"
fp_cstruc << " *" << pgmname << "P[" << ctx->rw->attr_elements << "]"
<< alignstr << ";\n";
} else if (ctx->rw->attr_pointer) {
fp_struct << " " << type_name;
if (!ctx->common_structfile_only)
cstruc->f << " " << type_name;
fp_cstruc << " " << type_name;
for (i = 0; i < int(35 - strlen(type_name)); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << " **" << pgmname << "P" << alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << " **" << pgmname << "P" << alignstr << ";\n";
fp_cstruc << " **" << pgmname << "P" << alignstr << ";\n";
} else {
fp_struct << " " << type_name;
if (!ctx->common_structfile_only)
cstruc->f << " " << type_name;
fp_cstruc << " " << type_name;
for (i = 0; i < int(35 - strlen(type_name)); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << " *" << pgmname << "P" << alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << " *" << pgmname << "P" << alignstr << ";\n";
fp_cstruc << " *" << pgmname << "P" << alignstr << ";\n";
}
}
......@@ -530,56 +528,56 @@ int CnvWblToH::attribute_exec()
fp_struct << " "
<< "pwr_tUInt64";
if (!ctx->common_structfile_only)
cstruc->f << " "
fp_cstruc << " "
<< "pwr_tUInt64";
for (i = 0; i < int(35 - strlen("pwr_tUInt64")); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << " " << pgmname << "[" << ctx->rw->attr_elements << "]"
<< alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << " " << pgmname << "[" << ctx->rw->attr_elements << "]"
fp_cstruc << " " << pgmname << "[" << ctx->rw->attr_elements << "]"
<< alignstr << ";\n";
} else if (ctx->rw->attr_array) {
fp_struct << " " << type_name;
if (!ctx->common_structfile_only)
cstruc->f << " " << type_name;
fp_cstruc << " " << type_name;
for (i = 0; i < int(35 - strlen(type_name)); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << ' ' << pgmname << "[" << ctx->rw->attr_elements << "]"
<< alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << pgmname << "[" << ctx->rw->attr_elements << "]" << alignstr
fp_cstruc << pgmname << "[" << ctx->rw->attr_elements << "]" << alignstr
<< ";\n";
} else if (ctx->rw->attr_pointer) {
fp_struct << " " << type_name;
if (!ctx->common_structfile_only)
cstruc->f << " " << type_name;
fp_cstruc << " " << type_name;
for (i = 0; i < int(35 - strlen(type_name)); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << " *" << pgmname << alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << " *" << pgmname << alignstr << ";\n";
fp_cstruc << " *" << pgmname << alignstr << ";\n";
} else {
fp_struct << " " << type_name;
if (!ctx->common_structfile_only)
cstruc->f << " " << type_name;
fp_cstruc << " " << type_name;
for (i = 0; i < int(35 - strlen(type_name)); i++) {
fp_struct << ' ';
if (!ctx->common_structfile_only)
cstruc->f << ' ';
fp_cstruc << ' ';
}
fp_struct << ' ' << pgmname << alignstr << ";\n";
if (!ctx->common_structfile_only)
cstruc->f << pgmname << alignstr << ";\n";
fp_cstruc << pgmname << alignstr << ";\n";
}
attr_count++;
......
......@@ -55,7 +55,7 @@ class CnvWblToH : public CnvWblTo {
CnvCtx* ctx;
int struct_class_open;
std::ofstream fp_struct;
CnvFile* cstruc;
std::ofstream fp_cstruc;
int struct_cclass_written;
int struct_cclass_endwritten;
int struct_filler_cnt;
......
......@@ -188,8 +188,6 @@ int CnvWblToHtml::init(char* first)
ctx->set_dependfile(fname);
html_index_open = 1;
fp_html_index
<< "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "
"Frameset//EN\"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
......@@ -467,17 +465,14 @@ int CnvWblToHtml::class_exec()
strcpy(fname, ctx->dir);
strcat(fname, html_file_name);
strcat(fname, ".html");
html_clf = new CnvFile();
html_clf->f.open(fname);
fp_html_clf.open(fname);
fp_tmp.open(cread_cTmpFile1);
fp_tmp << "<HR><BR>\n"
<< "<A NAME=\"detail\"><H1>Attributes detail</H1></A>\n";
html_class_open = 1;
html_clf->f
fp_html_clf
<< "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "
"Frameset//EN\"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
<< "<!-- Generated by co_convert " << timestr << " -->\n"
......@@ -520,17 +515,17 @@ int CnvWblToHtml::class_exec()
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) {
if (strstr(ctx->rw->doc_code, ".pdf") != 0) {
strcpy(ref_name, ctx->rw->doc_code);
html_clf->f << "&nbsp;|&nbsp;<A HREF=\"" << ref_name << "\">Code</A>\n";
fp_html_clf << "&nbsp;|&nbsp;<A HREF=\"" << ref_name << "\">Code</A>\n";
} else {
CnvReadSrc::filename_to_html(ref_name, ctx->rw->doc_code);
html_clf->f << "&nbsp;|&nbsp;<A HREF=\"" << ref_name << "#"
fp_html_clf << "&nbsp;|&nbsp;<A HREF=\"" << ref_name << "#"
<< low_class_name << "\">Code</A>\n";
}
}
html_clf->f << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<A HREF=\"" << ctree_file
fp_html_clf << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<A HREF=\"" << ctree_file
<< "\">ClassTree</A>\n";
html_clf->f
fp_html_clf
<< "</FONT></TD>\n"
<< "<TD BGCOLOR=\"white\" CLASS=\"NavBarCell2\"><FONT SIZE=\"-2\">\n"
<< " <A HREF=\"" << low_volume_name
......@@ -548,34 +543,34 @@ int CnvWblToHtml::class_exec()
<< "<HR>\n"
<< "<DL>\n";
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_author, "")) {
html_clf->f << "<DT><B>" << Lng::translate("Author")
fp_html_clf << "<DT><B>" << Lng::translate("Author")
<< "</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
<< ctx->rw->doc_author << "<DT>\n";
}
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_creator, "")) {
html_clf->f << "<DT><B>" << Lng::translate("Creator")
fp_html_clf << "<DT><B>" << Lng::translate("Creator")
<< "</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" << ctx->rw->doc_creator
<< "<DT>\n";
}
if (ctx->rw->doc_fresh && (!streq(ctx->rw->doc_version, "")
|| !streq(ctx->rw->class_version, ""))) {
html_clf->f << "<DT><B>" << Lng::translate("Version")
fp_html_clf << "<DT><B>" << Lng::translate("Version")
<< "</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
if (!streq(ctx->rw->doc_version, ""))
html_clf->f << ctx->rw->doc_version << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
fp_html_clf << ctx->rw->doc_version << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;";
if (!streq(ctx->rw->class_version, ""))
html_clf->f << ctx->rw->class_version;
html_clf->f << "<DT>\n";
fp_html_clf << ctx->rw->class_version;
fp_html_clf << "<DT>\n";
}
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) {
if (strstr(ctx->rw->doc_code, ".pdf") != 0) {
html_clf->f
fp_html_clf
<< "<DT><B>" << Lng::translate("Code")
<< "</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A HREF=\""
<< ref_name << "\"><FONT size=\"-1\">PlcTemplate</FONT></A><DT>\n";
} else {
html_clf->f
fp_html_clf
<< "<DT><B>" << Lng::translate("Code")
<< "</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <A HREF=\""
<< ref_name << "#" << low_class_name << "\"><FONT size=\"-1\">"
......@@ -583,7 +578,7 @@ int CnvWblToHtml::class_exec()
}
}
html_clf->f << "<BR><DT><B>" << Lng::translate("Description")
fp_html_clf << "<BR><DT><B>" << Lng::translate("Description")
<< "</B><DT><BR>\n"
<< "</DL><DIV ID=\"description\"><PRE>\n";
......@@ -594,41 +589,41 @@ int CnvWblToHtml::class_exec()
char imagefile[80];
ctx->remove_spaces(txt + 6, imagefile);
html_clf->f << "</PRE><IMG SRC=\"" << imagefile << "\"><PRE>\n";
fp_html_clf << "</PRE><IMG SRC=\"" << imagefile << "\"><PRE>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@b")) {
html_clf->f << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
fp_html_clf << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
<< "</FONT></B><BR><PRE>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h1")) {
html_clf->f << "</PRE><H3>" << txt + 3 << "</H3><BR><PRE>\n";
fp_html_clf << "</PRE><H3>" << txt + 3 << "</H3><BR><PRE>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h2")) {
html_clf->f << "</PRE><H4>" << txt + 3 << "</H4><BR><PRE>\n";
fp_html_clf << "</PRE><H4>" << txt + 3 << "</H4><BR><PRE>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@i")) {
html_clf->f << txt + 2 << '\n';
fp_html_clf << txt + 2 << '\n';
} else
html_clf->f << ctx->rw->doc_text[i] << '\n';
fp_html_clf << ctx->rw->doc_text[i] << '\n';
}
}
html_clf->f << "</PRE>\n";
fp_html_clf << "</PRE>\n";
for (i = 0; i < ctx->rw->doc_xlink_cnt; i++) {
html_clf->f << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
fp_html_clf << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
<< ctx->rw->doc_xlink_ref[i]
<< "\" TARGET=\"_self\"><FONT size=\"-1\"> "
<< ctx->rw->doc_xlink_text[i] << "</FONT></A><BR>\n";
}
for (i = 0; i < ctx->rw->doc_clink_cnt; i++) {
html_clf->f << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
fp_html_clf << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
<< ctx->rw->doc_clink_ref[i]
<< "\" TARGET=\"_self\"><FONT size=\"-1\"> "
<< ctx->rw->doc_clink_text[i] << "</FONT></A><BR>\n";
}
for (i = 0; i < ctx->rw->doc_link_cnt; i++) {
html_clf->f << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
fp_html_clf << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
<< ctx->rw->doc_link_ref[i]
<< "\" TARGET=\"_self\"><FONT size=\"-1\"> "
<< ctx->rw->doc_link_text[i] << "</FONT></A><BR>\n";
}
html_clf->f << "</DIV>\n";
fp_html_clf << "</DIV>\n";
return 1;
}
......@@ -651,7 +646,7 @@ int CnvWblToHtml::body_exec()
strcat(struct_name, ctx->rw->body_structname);
}
html_clf->f << "<!-- =========== BODY =========== -->\n"
fp_html_clf << "<!-- =========== BODY =========== -->\n"
<< '\n'
<< "<HR><BR>\n"
<< "<A NAME=\"" << ctx->rw->body_name << "\"><!-- --></A>\n"
......@@ -670,7 +665,7 @@ int CnvWblToHtml::body_exec()
int CnvWblToHtml::body_close()
{
html_clf->f << "</TABLE>\n";
fp_html_clf << "</TABLE>\n";
return 1;
}
......@@ -679,7 +674,7 @@ int CnvWblToHtml::graphplcnode()
{
int i;
html_clf->f << "<!-- =========== GRAPHPLCNODE =========== -->\n"
fp_html_clf << "<!-- =========== GRAPHPLCNODE =========== -->\n"
<< '\n'
<< "<HR><BR>\n"
<< "<A NAME=\"GraphPlcNode\"><!-- --></A>\n"
......@@ -691,12 +686,12 @@ int CnvWblToHtml::graphplcnode()
<< "</TR>\n";
for (i = 0; i < ctx->rw->doc_cnt; i += 2) {
html_clf->f << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
fp_html_clf << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
<< "<TD><CODE><B>" << ctx->rw->doc_text[i]
<< "</B></CODE></TD>\n"
<< "<TD><CODE>" << ctx->rw->doc_text[i + 1] << "</CODE></TD>\n";
}
html_clf->f << "</TABLE>\n";
fp_html_clf << "</TABLE>\n";
return 1;
}
......@@ -705,7 +700,7 @@ int CnvWblToHtml::graphplccon()
{
int i;
html_clf->f << "<!-- =========== GRAPHPLCCON =========== -->\n"
fp_html_clf << "<!-- =========== GRAPHPLCCON =========== -->\n"
<< '\n'
<< "<HR><BR>\n"
<< "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" "
......@@ -716,12 +711,12 @@ int CnvWblToHtml::graphplccon()
<< "</TR>\n";
for (i = 0; i < ctx->rw->doc_cnt; i += 2) {
html_clf->f << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
fp_html_clf << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
<< "<TD><CODE><B>" << ctx->rw->doc_text[i]
<< "</B></CODE></TD>\n"
<< "<TD><CODE>" << ctx->rw->doc_text[i + 1] << "</CODE></TD>\n";
}
html_clf->f << "</TABLE>\n";
fp_html_clf << "</TABLE>\n";
return 1;
}
......@@ -730,10 +725,10 @@ int CnvWblToHtml::template_exec()
{
int i;
if (!html_class_open)
if (!fp_html_clf.is_open())
return 1;
html_clf->f << "<!-- =========== TEMPLATE =========== -->\n"
fp_html_clf << "<!-- =========== TEMPLATE =========== -->\n"
<< '\n'
<< "<HR><BR>\n"
<< "<A NAME=\"template\"><!-- --></A>\n"
......@@ -745,12 +740,12 @@ int CnvWblToHtml::template_exec()
<< "</TR>\n";
for (i = 0; i < ctx->rw->doc_cnt; i += 2) {
html_clf->f << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
fp_html_clf << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
<< "<TD><CODE><B>" << ctx->rw->doc_text[i]
<< "</B></CODE></TD>\n"
<< "<TD><CODE>" << ctx->rw->doc_text[i + 1] << "</CODE></TD>\n";
}
html_clf->f << "</TABLE>\n";
fp_html_clf << "</TABLE>\n";
return 1;
}
......@@ -760,16 +755,13 @@ int CnvWblToHtml::class_close()
fp_tmp.close();
// Copy temporary file
ctx->rw->copy_tmp_file(cread_cTmpFile1, html_clf->f);
ctx->rw->copy_tmp_file(cread_cTmpFile1, fp_html_clf);
html_clf->f << "<!-- ========= END OF CLASS DATA ========= -->\n"
fp_html_clf << "<!-- ========= END OF CLASS DATA ========= -->\n"
<< "</BODY>\n"
<< "</HTML>\n";
html_clf->f.close();
delete html_clf;
html_class_open = 0;
fp_html_clf.close();
if (!cdp_created) {
create_cdp_file(ctx->rw->volume_name, ctx->rw->class_name, "-");
......@@ -835,31 +827,31 @@ int CnvWblToHtml::attribute_exec()
// Summary
html_clf->f
fp_html_clf
<< "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
<< "<TD ALIGN=\"right\" VALIGN=\"top\" WIDTH=\"1%\"><FONT SIZE=\"-1\">\n"
<< "<A HREF=\"" << typeref_href << "\">";
if (ctx->rw->attr_array && ctx->rw->attr_pointer)
html_clf->f << "<CODE>Array of pointers to " << ctx->rw->attr_typeref
fp_html_clf << "<CODE>Array of pointers to " << ctx->rw->attr_typeref
<< "</CODE></FONT></A></TD>\n";
else if (ctx->rw->attr_array)
html_clf->f << "<CODE>Array of " << ctx->rw->attr_typeref
fp_html_clf << "<CODE>Array of " << ctx->rw->attr_typeref
<< "</CODE></FONT></A></TD>\n";
else if (ctx->rw->attr_pointer)
html_clf->f << "<CODE>Pointer to " << ctx->rw->attr_typeref
fp_html_clf << "<CODE>Pointer to " << ctx->rw->attr_typeref
<< "</CODE></FONT></A></TD>\n";
else
html_clf->f << "<CODE>" << ctx->rw->attr_typeref
fp_html_clf << "<CODE>" << ctx->rw->attr_typeref
<< "</CODE></FONT></A></TD>\n";
html_clf->f << "</A><TD><A HREF=\"#" << ctx->rw->attr_name << "\"><CODE><B>"
fp_html_clf << "</A><TD><A HREF=\"#" << ctx->rw->attr_name << "\"><CODE><B>"
<< ctx->rw->attr_name << "</B></CODE></A></TD>\n";
if (!streq(ctx->rw->attr_graphname, ""))
html_clf->f << "<TD WIDTH=\"1%\">" << ctx->rw->attr_graphname << "</TD>\n";
fp_html_clf << "<TD WIDTH=\"1%\">" << ctx->rw->attr_graphname << "</TD>\n";
else
html_clf->f << "<TD WIDTH=\"1%\">&nbsp;</TD>\n";
html_clf->f << "<TD>";
fp_html_clf << "<TD WIDTH=\"1%\">&nbsp;</TD>\n";
fp_html_clf << "<TD>";
if (ctx->rw->doc_fresh) {
if (streq(ctx->rw->doc_summary, "")) {
for (i = 0; i < ctx->rw->doc_cnt; i++) {
......@@ -867,24 +859,24 @@ int CnvWblToHtml::attribute_exec()
if (str_StartsWith(CnvCtx::low(txt), "@image")) {
continue;
} else if (str_StartsWith(CnvCtx::low(txt), "@b")) {
html_clf->f << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
fp_html_clf << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
<< "</FONT></B><PRE><BR>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h1")) {
html_clf->f << "<H3>" << txt + 3 << "</H3><BR>\n";
fp_html_clf << "<H3>" << txt + 3 << "</H3><BR>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h2")) {
html_clf->f << "<H4>" << txt + 3 << "</H4><BR>\n";
fp_html_clf << "<H4>" << txt + 3 << "</H4><BR>\n";
} else {
html_clf->f << ctx->rw->doc_text[i];
fp_html_clf << ctx->rw->doc_text[i];
if (i < ctx->rw->doc_cnt - 1)
html_clf->f << "<BR>\n";
fp_html_clf << "<BR>\n";
}
}
} else
html_clf->f << ctx->rw->doc_summary << '\n';
fp_html_clf << ctx->rw->doc_summary << '\n';
} else
html_clf->f << "<BR>\n";
fp_html_clf << "<BR>\n";
html_clf->f << "</TD>\n";
fp_html_clf << "</TD>\n";
// Detail
......@@ -976,7 +968,7 @@ int CnvWblToHtml::bit_exec()
// Summary
char bitchar = _tolower(ctx->rw->typedef_typeref[0]);
html_clf->f << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
fp_html_clf << "<TR BGCOLOR=\"white\" CLASS=\"TableRowColor\">\n"
<< "<TD>\n"
<< "<CODE><FONT SIZE=\"-1\">pwr_" << bitchar
<< ctx->rw->typedef_name << "_" << ctx->rw->bit_pgmname
......@@ -992,24 +984,24 @@ int CnvWblToHtml::bit_exec()
if (str_StartsWith(CnvCtx::low(txt), "@image")) {
continue;
} else if (str_StartsWith(CnvCtx::low(txt), "@b")) {
html_clf->f << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
fp_html_clf << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
<< "</FONT></B><PRE><BR>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h1")) {
html_clf->f << "<H3>" << txt + 3 << "</H3><BR>\n";
fp_html_clf << "<H3>" << txt + 3 << "</H3><BR>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h2")) {
html_clf->f << "<H4>" << txt + 3 << "</H4><BR>\n";
fp_html_clf << "<H4>" << txt + 3 << "</H4><BR>\n";
} else {
html_clf->f << ctx->rw->doc_text[i];
fp_html_clf << ctx->rw->doc_text[i];
if (i < ctx->rw->doc_cnt - 1)
html_clf->f << "<BR>\n";
fp_html_clf << "<BR>\n";
}
}
} else
html_clf->f << ctx->rw->doc_summary << '\n';
fp_html_clf << ctx->rw->doc_summary << '\n';
} else
html_clf->f << "<BR>\n";
fp_html_clf << "<BR>\n";
html_clf->f << "</TD>\n";
fp_html_clf << "</TD>\n";
// Detail
......@@ -1122,14 +1114,11 @@ int CnvWblToHtml::typedef_exec()
strcpy(fname, ctx->dir);
strcat(fname, html_file_name);
strcat(fname, ".html");
html_clf = new CnvFile();
html_clf->f.open(fname);
fp_html_clf.open(fname);
fp_tmp.open(cread_cTmpFile1);
html_class_open = 1;
html_clf->f
fp_html_clf
<< "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "
"Frameset//EN\"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">\n"
<< "<!-- Generated by pwr_cnv-->\n"
......@@ -1163,17 +1152,17 @@ int CnvWblToHtml::typedef_exec()
|| streq(ctx->rw->typedef_typeref, "Enum"))
&& !streq(low_volume_name, "pwrs")) {
sprintf(code_aref, "%s#%s", struct_file, ctx->rw->typedef_name);
html_clf->f << " C Binding: &nbsp;<A HREF=\"" << code_aref
fp_html_clf << " C Binding: &nbsp;<A HREF=\"" << code_aref
<< "\">Typedef</A>\n";
} else if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) {
CnvReadSrc::filename_to_html(ref_name, ctx->rw->doc_code);
sprintf(code_aref, "%s#%s", ref_name, low_class_name);
html_clf->f << " C Binding: &nbsp;<A HREF=\"" << code_aref
fp_html_clf << " C Binding: &nbsp;<A HREF=\"" << code_aref
<< "\">Typedef</A>\n";
}
for (i = 0; i < 50; i++)
html_clf->f << "&nbsp;";
html_clf->f
fp_html_clf << "&nbsp;";
fp_html_clf
<< "</FONT></TD>\n"
<< "<TD BGCOLOR=\"white\" CLASS=\"NavBarCell2\"><FONT SIZE=\"-2\">\n"
<< " <A HREF=\"" << low_volume_name
......@@ -1191,21 +1180,21 @@ int CnvWblToHtml::typedef_exec()
<< "<HR>\n"
<< "<DL>\n";
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_author, "")) {
html_clf->f << "<DT><B>Author</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
fp_html_clf << "<DT><B>Author</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
<< ctx->rw->doc_author << "<DT>\n";
}
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_version, "")) {
html_clf->f << "<DT><B>Version</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
fp_html_clf << "<DT><B>Version</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
<< ctx->rw->doc_version << "<DT>\n";
}
if (ctx->rw->doc_fresh && !streq(ctx->rw->doc_code, "")) {
html_clf->f
fp_html_clf
<< "<DT><B>Code</B>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"
<< ctx->rw->doc_code << "<DT>\n";
}
html_clf->f << "<BR><DT><B>Description</B><DT><BR>\n"
fp_html_clf << "<BR><DT><B>Description</B><DT><BR>\n"
<< "</DL><DIV ID=\"description\"><PRE>\n";
if (ctx->rw->doc_fresh) {
......@@ -1215,39 +1204,39 @@ int CnvWblToHtml::typedef_exec()
char imagefile[80];
ctx->remove_spaces(txt + 6, imagefile);
html_clf->f << "</PRE><IMG SRC=\"" << imagefile << "\"><PRE>\n";
fp_html_clf << "</PRE><IMG SRC=\"" << imagefile << "\"><PRE>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@b")) {
html_clf->f << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
fp_html_clf << "</PRE><B><FONT SIZE=\"3\">" << txt + 2
<< "</FONT></B><BR><PRE>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h1")) {
html_clf->f << "</PRE><H3>" << txt + 3 << "</H3><BR><PRE>\n";
fp_html_clf << "</PRE><H3>" << txt + 3 << "</H3><BR><PRE>\n";
} else if (str_StartsWith(CnvCtx::low(txt), "@h2")) {
html_clf->f << "</PRE><H4>" << txt + 3 << "</H4><BR><PRE>\n";
fp_html_clf << "</PRE><H4>" << txt + 3 << "</H4><BR><PRE>\n";
} else
html_clf->f << ctx->rw->doc_text[i] << '\n';
fp_html_clf << ctx->rw->doc_text[i] << '\n';
}
}
html_clf->f << "</PRE></DIV>\n";
fp_html_clf << "</PRE></DIV>\n";
for (i = 0; i < ctx->rw->doc_link_cnt; i++) {
html_clf->f << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
fp_html_clf << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
<< ctx->rw->doc_link_ref[i]
<< "\" TARGET=\"_self\"><FONT size=\"-1\"> "
<< ctx->rw->doc_link_text[i] << "</FONT></A><BR>\n";
}
for (i = 0; i < ctx->rw->doc_clink_cnt; i++) {
html_clf->f << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
fp_html_clf << " &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<A HREF=\""
<< ctx->rw->doc_clink_ref[i]
<< "\" TARGET=\"_self\"><FONT size=\"-1\"> "
<< ctx->rw->doc_clink_text[i] << "</FONT></A><BR>\n";
}
html_clf->f << "</FONT>\n";
fp_html_clf << "</FONT>\n";
if (streq(ctx->rw->typedef_typeref, "Mask")
|| streq(ctx->rw->typedef_typeref, "Enum")) {
char bitchar = _tolower(ctx->rw->typedef_typeref[0]);
html_clf->f << "<HR><BR>\n"
fp_html_clf << "<HR><BR>\n"
<< "<A NAME=\"" << ctx->rw->typedef_name << "\"><!-- --></A>\n"
<< "<TABLE BORDER=\"1\" CELLPADDING=\"3\" CELLSPACING=\"0\" "
"WIDTH=\"100%\">\n"
......@@ -1266,22 +1255,19 @@ int CnvWblToHtml::typedef_close()
{
if (streq(ctx->rw->typedef_typeref, "Mask")
|| streq(ctx->rw->typedef_typeref, "Enum")) {
html_clf->f << "</TABLE>\n";
fp_html_clf << "</TABLE>\n";
}
fp_tmp.close();
// Copy temporary file
ctx->rw->copy_tmp_file(cread_cTmpFile1, html_clf->f);
ctx->rw->copy_tmp_file(cread_cTmpFile1, fp_html_clf);
html_clf->f << "<!-- ========= END OF CLASS DATA ========= -->\n"
fp_html_clf << "<!-- ========= END OF CLASS DATA ========= -->\n"
<< "</BODY>\n"
<< "</HTML>\n";
html_clf->f.close();
delete html_clf;
html_class_open = 0;
fp_html_clf.close();
return 1;
}
......
......@@ -68,7 +68,7 @@ class CnvWblToHtml : public CnvWblTo {
}
CnvCtx* ctx;
CnvFile* html_clf;
std::ofstream fp_html_clf;
std::ofstream fp_html_index;
std::ofstream fp_js_all;
std::ofstream fp_tmp;
......@@ -103,11 +103,11 @@ class CnvWblToHtml : public CnvWblTo {
}
int class_open()
{
return html_class_open;
return fp_html_clf.is_open();
}
int index_open()
{
return html_index_open;
return fp_html_index.is_open();
}
void create_cdp_file(const char* volume_name, const char* class_name,
const char* attr_typeref);
......
......@@ -87,18 +87,18 @@ void* CnvXtthelpToHtml::insert(navh_eItemType item_type, const char* text1,
static int in_table = 0;
if ((text2 && !streq(text2, "")) || (text3 && !streq(text3, ""))) {
if (!in_table && cf) {
cf->f << "<TABLE>\n";
if (!in_table) {
fp << "<TABLE>\n";
in_table = 1;
}
} else {
if (in_table && cf) {
if (in_table) {
// Close table (keep if empty line)
if (!(text1 && streq(text1, "")
&& (item_type == navh_eItemType_Help
|| item_type == navh_eItemType_HelpCode
|| item_type == navh_eItemType_HelpBold))) {
cf->f << "</TABLE>\n";
fp << "</TABLE>\n";
in_table = 0;
}
}
......@@ -112,9 +112,8 @@ void* CnvXtthelpToHtml::insert(navh_eItemType item_type, const char* text1,
strcpy(codingstr, "UTF-8");
subject_to_fname(fname, text1, 1);
cf = new CnvFile();
cf->f.open(fname);
cf->f << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "
fp.open(fname);
fp << "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 "
"Transitional//EN\"\"http://www.w3.org/TR/REC-html40/loose.dtd>\n"
<< "<!--NewPage-->\n"
<< "<HTML>\n"
......@@ -134,23 +133,18 @@ void* CnvXtthelpToHtml::insert(navh_eItemType item_type, const char* text1,
return NULL;
}
case navh_eItemType_EndTopic: {
if (!cf)
if (!fp.is_open())
break;
cf->f.close();
delete cf;
cf = 0;
fp.close();
return NULL;
}
case navh_eItemType_Help:
case navh_eItemType_HelpCode: {
if (!cf)
break;
if (item_type == navh_eItemType_HelpCode && !in_table) {
cf->f << "<CODE>";
fp << "<CODE>";
for (const char* s = text1; s && *s == ' '; s++)
cf->f << "&nbsp;";
fp << "&nbsp;";
}
pwr_tFileName fname;
......@@ -197,52 +191,49 @@ void* CnvXtthelpToHtml::insert(navh_eItemType item_type, const char* text1,
}
}
if (!in_table)
cf->f << "<A HREF=\"" << fname << "\">";
fp << "<A HREF=\"" << fname << "\">";
} else if (bookmark) {
if (in_table) {
cf->f << "</TABLE>\n";
fp << "</TABLE>\n";
in_table = 0;
}
cf->f << "<A NAME=\"" << bookmark << "\">";
fp << "<A NAME=\"" << bookmark << "\">";
}
if (!in_table) {
cf->f << text1;
fp << text1;
if (!streq(link, "") || bookmark)
cf->f << "<BR></A>\n";
fp << "<BR></A>\n";
else
cf->f << "<BR>\n";
fp << "<BR>\n";
if (item_type == navh_eItemType_HelpCode)
cf->f << "</CODE>";
fp << "</CODE>";
} else {
cf->f << "<TR><TD>";
fp << "<TR><TD>";
if (!streq(link, ""))
cf->f << "<A HREF=\"" << fname << "\">";
fp << "<A HREF=\"" << fname << "\">";
else if (bookmark != 0)
cf->f << "<A NAME=\"" << bookmark << "\">";
cf->f << text1;
fp << "<A NAME=\"" << bookmark << "\">";
fp << text1;
if (!streq(text2, "") || !streq(text3, "")) {
for (i = 0; i < (int)(CNV_TAB - strlen(text1)); i++)
cf->f << "&nbsp;";
cf->f << "&nbsp;&nbsp;</TD><TD>" << text2;
fp << "&nbsp;";
fp << "&nbsp;&nbsp;</TD><TD>" << text2;
if (!streq(text3, "")) {
for (i = 0; i < (int)(CNV_TAB - strlen(text2)); i++)
cf->f << "&nbsp;";
cf->f << "&nbsp;&nbsp;</TD><TD>" << text3;
fp << "&nbsp;";
fp << "&nbsp;&nbsp;</TD><TD>" << text3;
}
}
if (!streq(link, "") || bookmark)
cf->f << "</A>\n";
fp << "</A>\n";
else
cf->f << '\n';
cf->f << "</TD></TR>";
fp << '\n';
fp << "</TD></TR>";
}
return NULL;
}
case navh_eItemType_HelpBold: {
if (!cf)
break;
pwr_tFileName fname;
if (!streq(link, "")) {
if (str_StartsWith(link, "$web:")) {
......@@ -274,88 +265,73 @@ void* CnvXtthelpToHtml::insert(navh_eItemType item_type, const char* text1,
}
}
if (!in_table)
cf->f << "<A HREF=\"" << fname << "\">";
fp << "<A HREF=\"" << fname << "\">";
} else if (bookmark) {
if (!in_table)
cf->f << "<A NAME=\"" << bookmark << "\">";
fp << "<A NAME=\"" << bookmark << "\">";
}
if (!in_table) {
cf->f << "<B>" << text1 << "</B>";
fp << "<B>" << text1 << "</B>";
if (!streq(link, "") || bookmark)
cf->f << "<BR></A>\n";
fp << "<BR></A>\n";
else
cf->f << "<BR>\n";
fp << "<BR>\n";
} else {
cf->f << "<TR><TD><B>";
fp << "<TR><TD><B>";
if (!streq(link, ""))
cf->f << "<A HREF=\"" << fname << "\">";
fp << "<A HREF=\"" << fname << "\">";
else if (bookmark != 0)
cf->f << "<A NAME=\"" << bookmark << "\">";
cf->f << text1;
fp << "<A NAME=\"" << bookmark << "\">";
fp << text1;
if (!streq(link, "") || bookmark)
cf->f << "</A>";
fp << "</A>";
if (!streq(text2, "") || !streq(text3, "")) {
for (i = 0; i < (int)(CNV_TAB - strlen(text1)); i++)
cf->f << "&nbsp;";
cf->f << "&nbsp;&nbsp;</B></TD><TD><B>" << text2;
fp << "&nbsp;";
fp << "&nbsp;&nbsp;</B></TD><TD><B>" << text2;
if (!streq(text3, "")) {
for (i = 0; i < (int)(CNV_TAB - strlen(text2)); i++)
cf->f << "&nbsp;";
cf->f << "&nbsp;&nbsp;</B></TD><TD><B>" << text3;
fp << "&nbsp;";
fp << "&nbsp;&nbsp;</B></TD><TD><B>" << text3;
}
}
if (!streq(link, "") || bookmark)
cf->f << "</A>\n";
fp << "</A>\n";
else
cf->f << '\n';
cf->f << "</B></TD></TR>";
fp << '\n';
fp << "</B></TD></TR>";
}
return NULL;
}
case navh_eItemType_HelpHeader: {
if (!cf)
break;
cf->f << "<H1>" << text1 << "</H1>\n";
fp << "<H1>" << text1 << "</H1>\n";
return NULL;
}
case navh_eItemType_Header: {
if (!cf)
break;
if (bookmark != 0)
cf->f << "<A NAME=\"" << bookmark << "\">";
cf->f << "<H3>" << text1 << "</H3>";
fp << "<A NAME=\"" << bookmark << "\">";
fp << "<H3>" << text1 << "</H3>";
if (bookmark != 0)
cf->f << "</A>";
cf->f << '\n';
fp << "</A>";
fp << '\n';
return NULL;
}
case navh_eItemType_HeaderLarge: {
if (!cf)
break;
if (bookmark != 0)
cf->f << "<A NAME=\"" << bookmark << "\">";
cf->f << "<H2>" << text1 << "</H2>";
fp << "<A NAME=\"" << bookmark << "\">";
fp << "<H2>" << text1 << "</H2>";
if (bookmark != 0)
cf->f << "</A>";
cf->f << '\n';
fp << "</A>";
fp << '\n';
return NULL;
}
case navh_eItemType_HorizontalLine: {
if (!cf)
break;
cf->f << "<HR>\n";
fp << "<HR>\n";
return NULL;
}
case navh_eItemType_Image: {
if (!cf)
break;
cf->f << "<IMG SRC=\"" << text1 << "\"><BR>\n";
fp << "<IMG SRC=\"" << text1 << "\"><BR>\n";
return NULL;
}
default:
......
......@@ -41,14 +41,13 @@
extern "C" {
#endif
#include "cnv_file.h"
#include "cnv_xtthelpto.h"
class CnvCtx;
class CnvXtthelpToHtml : public CnvXtthelpTo {
public:
CnvXtthelpToHtml(CnvCtx* cnv_ctx) : ctx(cnv_ctx), cf(0)
CnvXtthelpToHtml(CnvCtx* cnv_ctx) : ctx(cnv_ctx)
{
}
virtual ~CnvXtthelpToHtml()
......@@ -66,8 +65,7 @@ class CnvXtthelpToHtml : public CnvXtthelpTo {
void subject_to_fname(char* fname, const char* subject, int path);
CnvCtx* ctx;
CnvFile* cf;
// std::ofstream fp;
std::ofstream fp;
};
#if defined __cplusplus
......
......@@ -67,9 +67,8 @@ void CnvXtthelpToText::subject_to_fname(
CnvXtthelpToText::~CnvXtthelpToText()
{
if (cf) {
cf->f.close();
delete cf;
if (fp.is_open()) {
fp.close();
}
}
......@@ -99,8 +98,7 @@ void* CnvXtthelpToText::insert(navh_eItemType item_type, const char* text1,
pwr_tFileName fname;
subject_to_fname(fname, text1, 1);
cf = new CnvFile();
cf->f.open(fname);
fp.open(fname);
first_topic = 0;
}
......@@ -112,7 +110,7 @@ void* CnvXtthelpToText::insert(navh_eItemType item_type, const char* text1,
in_topic = 0;
break;
case navh_eItemType_PageBreak: {
cf->f << "\f";
fp << "\f";
return NULL;
}
case navh_eItemType_Help:
......@@ -121,29 +119,29 @@ void* CnvXtthelpToText::insert(navh_eItemType item_type, const char* text1,
case navh_eItemType_Header:
case navh_eItemType_HeaderLarge:
case navh_eItemType_HelpHeader: {
cf->f << text1;
fp << text1;
if (text2) {
cf->f << " ";
fp << " ";
for (int i = 0; i < (int)(CNV_TAB - strlen(text1) - 1); i++)
cf->f << " ";
cf->f << text2;
fp << " ";
fp << text2;
if (text3) {
cf->f << " ";
fp << " ";
for (int i = 0; i < (int)(CNV_TAB - strlen(text2) - 1); i++)
cf->f << " ";
cf->f << text3;
fp << " ";
fp << text3;
}
}
cf->f << '\n';
fp << '\n';
break;
}
case navh_eItemType_HorizontalLine: {
for (int i = 0; i < 80; i++)
cf->f << "-";
cf->f << '\n';
fp << "-";
fp << '\n';
return NULL;
}
......
......@@ -39,14 +39,13 @@
#include "cnv_xtthelpto.h"
#include "cnv_content.h"
#include "cnv_file.h"
class CnvCtx;
class CnvXtthelpToText : public CnvXtthelpTo {
public:
CnvXtthelpToText(CnvCtx* cnv_ctx)
: ctx(cnv_ctx), cf(0), first_topic(1), in_topic(0), print_disable(0)
: ctx(cnv_ctx), first_topic(1), in_topic(0), print_disable(0)
{
}
virtual ~CnvXtthelpToText();
......@@ -62,7 +61,7 @@ class CnvXtthelpToText : public CnvXtthelpTo {
void subject_to_fname(char* fname, const char* subject, int path);
CnvCtx* ctx;
CnvFile* cf;
std::ofstream fp;
int first_topic;
int in_topic;
int print_disable;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment