Commit be97b24a authored by claes's avatar claes

Class tree html-files added

parent 183f258b
/*
* Proview $Id: cnv_classdep.cpp,v 1.1 2005-11-14 16:11:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#include <vector>
#include <iostream.h>
#include <fstream.h>
#include <float.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "cnv_classdep.h"
extern "C" {
#include "pwr.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
}
#include "co_lng.h"
int CnvClassDep::read()
{
pwr_tFileName fname, found_file;
pwr_tStatus sts;
int idx;
int currentidx = 0;
sprintf( fname, "$pwre_broot/$pwre_target/bld/wbl/*.cdp");
// dcli_translate_filename( fname, fname);
// Create root;
CdpItem root;
root.idx = currentidx++;
classlist.push_back( root);
sts = dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_INIT);
while ( ODD(sts)) {
pwr_tObjName classname, supername, volumename;
ifstream fp( found_file);
fp >> volumename >> classname >> supername;
CdpItem item;
strcpy( item.name, classname);
strcpy( item.supername, supername);
strcpy( item.volumename, volumename);
item.idx = currentidx++;
item.fth = 0;
item.bws = classlist[0].lch;
classlist[item.bws].fws = item.idx;
if ( classlist[0].fch == 0)
classlist[0].fch = item.idx;
classlist[0].lch = item.idx;
classlist.push_back( item);
sts = dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_NEXT);
}
dcli_search_file( fname, found_file, DCLI_DIR_SEARCH_END);
for ( int i = 1; i < (int)classlist.size(); i++) {
if ( strcmp( classlist[i].supername, "-") == 0)
continue;
if ( find( classlist[i].supername, &idx)) {
// Unlink from current position
if ( classlist[i].bws)
classlist[ classlist[i].bws].fws = classlist[i].fws;
if ( classlist[i].fws)
classlist[ classlist[i].fws].bws = classlist[i].bws;
if ( classlist[classlist[i].fth].fch == i)
classlist[classlist[i].fth].fch = classlist[i].fws;
if ( classlist[classlist[i].fth].lch == i)
classlist[classlist[i].fth].lch = classlist[i].bws;
// Link as last child to new father
classlist[i].fws = 0;
classlist[i].fth = idx;
if ( classlist[idx].fch) {
classlist[classlist[idx].lch].fws = i;
classlist[i].bws = classlist[idx].lch;
classlist[idx].lch = i;
}
else {
classlist[i].bws = 0;
classlist[idx].fch = i;
classlist[idx].lch = i;
}
}
else
printf( "SuperClass not found: %s\n", classlist[i].supername);
}
// print( 0, 0);
for ( int i = 1; i < (int)classlist.size(); i++) {
print_html_classtable( i);
}
return 1;
}
void CnvClassDep::print( int idx, int level) {
for ( int i = classlist[idx].fch; i; i = classlist[i].fws) {
for ( int j = 0; j < level; j++)
printf( " ");
printf( "%s\n", classlist[i].name);
print( i, level+1);
}
}
void CnvClassDep::print_html_classtable( int idx)
{
pwr_tFileName fname;
int parentlist[100];
int parent_cnt = 0;
char href[200];
for ( int fth = classlist[idx].fth; fth; fth = classlist[fth].fth)
parentlist[parent_cnt++] = fth;
sprintf( fname, "%s%s_%s_ctree.html", ctx->dir, classlist[idx].volumename,
classlist[idx].name);
cdh_ToLower( fname, fname);
dcli_translate_filename( fname, fname);
ofstream fp( fname);
fp <<
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Frameset//EN\"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">" << endl <<
"<!-- Generated by co_convert -->" << endl <<
"<html>" << endl <<
" <head>" << endl <<
" <title>Proview classtree</title>" << endl <<
" <link rel=\"stylesheet\" type=\"text/css\" href=\"orm.css\">" << endl <<
" </head>" << endl <<
" <body>" << endl;
if ( parent_cnt == 0 && classlist[idx].fch == 0)
fp << "There are no superclass and no known subclasses to this class" << endl;
else {
fp << "<table border><tr>" << endl;
for ( int i = parent_cnt - 1; i >= 0; i--) {
sprintf( href, "%s_%s.html", classlist[parentlist[i]].volumename, classlist[parentlist[i]].name);
cdh_ToLower( href, href);
fp << "<td><a href=\"" << href << "\">" << classlist[parentlist[i]].name << "</a></td>" << endl;
}
sprintf( href, "%s_%s.html", classlist[idx].volumename, classlist[idx].name);
cdh_ToLower( href, href);
fp << "<td bgcolor=\"lightblue\"><a href=\"" << href << "\">" << classlist[idx].name << "</a></td><td>" << endl;
print_html_classtable_children( fp, idx);
fp << "</td></table>" << endl;
}
fp <<
" </body>" << endl <<
"</html>" << endl;
}
void CnvClassDep::print_html_classtable_children( ofstream& fp, int idx)
{
char href[200];
if ( classlist[idx].fch == 0)
return;
fp << "<table border>" << endl;
for ( int i = classlist[idx].fch; i; i = classlist[i].fws) {
sprintf( href, "%s_%s.html", classlist[i].volumename, classlist[i].name);
cdh_ToLower( href, href);
fp << "<tr><td><a href=\"" << href << "\">" << classlist[i].name << "</a>" << endl;
if ( classlist[i].fch) {
fp << "<td>" << endl;
print_html_classtable_children( fp, i);
fp << "</td></tr>" << endl;
}
}
fp << "</table>" << endl;
}
bool CnvClassDep::find( char *name, int *idx)
{
for ( int i = 0; i < (int)classlist.size(); i++) {
if ( cdh_NoCaseStrcmp( name, classlist[i].name) == 0) {
*idx = i;
return true;
}
}
return false;
}
/*
* Proview $Id: cnv_classdep.h,v 1.1 2005-11-14 16:11:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* 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 the program, if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*/
#ifndef cnv_classdep_h
#define cnv_classdep_h
#if defined __cplusplus
extern "C" {
#endif
#include <vector>
#include "pwr.h"
#include "cnv_ctx.h"
using namespace std;
class CdpItem {
public:
CdpItem() : idx(0), fth(0), fch(0), lch(0), fws(0), bws(0) {}
pwr_tObjName name;
pwr_tObjName supername;
pwr_tObjName volumename;
int idx;
int fth;
int fch;
int lch;
int fws;
int bws;
};
class CnvClassDep {
private:
vector<CdpItem> classlist;
public:
CnvClassDep( CnvCtx *cnv_ctx) : ctx(cnv_ctx) {}
virtual ~CnvClassDep() {}
CnvCtx *ctx;
int read();
bool find( char *name, int *idx);
void print( int idx, int level);
void print_html_classtable( int idx);
void print_html_classtable_children( ofstream& fp, int idx);
};
#if defined __cplusplus
}
#endif
#endif
/*
* Proview $Id: cnv_ctx.h,v 1.2 2005-09-01 14:57:47 claes Exp $
* Proview $Id: cnv_ctx.h,v 1.3 2005-11-14 16:11:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -38,7 +38,7 @@ class CnvReadXtthelp;
class CnvCtx {
public:
CnvCtx() : generate_html(0), generate_xtthelp(0), generate_src(0),
generate_struct(0), generate_ps(0), common_structfile_only(0), hpp(0),
generate_struct(0), generate_ps(0), generate_cdp(0), common_structfile_only(0), hpp(0),
verbose(0), first_class(1), setup(0), wblto(0), rw(0), rx(0)
{
strcpy( dir, "");
......@@ -50,6 +50,7 @@ class CnvCtx {
int generate_src;
int generate_struct;
int generate_ps;
int generate_cdp;
int common_structfile_only;
int hpp;
int verbose;
......
/*
* Proview $Id: cnv_readwbl.cpp,v 1.8 2005-10-07 05:57:28 claes Exp $
* Proview $Id: cnv_readwbl.cpp,v 1.9 2005-11-14 16:11:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -722,7 +722,7 @@ int CnvReadWbl::attribute_attr( char *name, char *value)
attr_array = 1;
if ( strcmp( value, "PWR_MASK_RTVIRTUAL") == 0)
attr_rtvirtual = 1;
if ( strcmp( value, "PWR_MASK_ISCLASS") == 0)
if ( strcmp( value, "PWR_MASK_CLASS") == 0)
attr_isclass = 1;
}
else {
......
/*
* Proview $Id: cnv_wbltohtml.cpp,v 1.9 2005-09-22 14:36:58 claes Exp $
* Proview $Id: cnv_wbltohtml.cpp,v 1.10 2005-11-14 16:11:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -32,6 +32,7 @@ extern "C" {
#include "pwr.h"
#include "co_cdh.h"
#include "co_time.h"
#include "co_dcli.h"
}
#include "co_lng.h"
......@@ -409,6 +410,7 @@ int CnvWblToHtml::class_exec()
pwr_tFileName fname;
int i;
pwr_tFileName html_file_name;
pwr_tFileName ctree_file;
char full_class_name[80];
char ref_name[200];
pwr_tFileName struct_file;
......@@ -419,6 +421,8 @@ int CnvWblToHtml::class_exec()
char timestr[80];
int lng_sts = 1;
cdp_created = false;
if ( Lng::current() != lng_eLanguage_en_us)
lng_sts = ctx->rw->read_lng( ctx->rw->class_name, 0);
......@@ -443,6 +447,12 @@ int CnvWblToHtml::class_exec()
strcat( html_file_name, "_");
strcat( html_file_name, low_class_name);
strcpy( ctree_file, low_volume_name);
strcat( ctree_file, "_");
strcat( ctree_file, low_class_name);
strcat( ctree_file, "_ctree.html");
// Add into index file
fp_html_index <<
"<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << ctx->rw->class_name << "</A>" << endl <<
......@@ -522,7 +532,8 @@ endl <<
"&nbsp;|&nbsp;<A HREF=\"#detail\">Detail</A>" << endl <<
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C Binding: " << endl <<
"&nbsp;<A HREF=\"" << struct_file << "#" << ctx->rw->class_name << "\">Struct</A>" << endl <<
"&nbsp;|&nbsp<A HREF=\"" << hpp_file << "#" << ctx->rw->class_name << "\">Class</A>" << endl;
"&nbsp;|&nbsp<A HREF=\"" << hpp_file << "#" << ctx->rw->class_name << "\">Class</A>" << endl <<
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp<A HREF=\"" << ctree_file << "\">ClassTree</A>" << endl;
if ( ctx->rw->doc_fresh && strcmp( ctx->rw->doc_code, "") != 0) {
CnvReadSrc::filename_to_html( ref_name, ctx->rw->doc_code);
......@@ -753,9 +764,25 @@ int CnvWblToHtml::class_close()
html_class_open = 0;
if ( !cdp_created) {
create_cdp_file( ctx->rw->volume_name, ctx->rw->class_name, "-");
cdp_created = true;
}
return 1;
}
// Create class dependency file
void CnvWblToHtml::create_cdp_file( char *volume_name, char *class_name, char *attr_typeref)
{
pwr_tFileName fname;
sprintf( fname, "$pwre_broot/$pwre_target/bld/wbl/%s.cdp", CnvCtx::low(class_name));
dcli_translate_filename( fname, fname);
ofstream fp( fname);
fp << volume_name << " " << class_name << " " << attr_typeref << endl;
}
int CnvWblToHtml::attribute_exec()
{
int i;
......@@ -764,6 +791,11 @@ int CnvWblToHtml::attribute_exec()
char attrtype_href[80];
int lng_sts = 1;
if ( strcmp( CnvCtx::low( ctx->rw->attr_name), "super") == 0) {
create_cdp_file( ctx->rw->volume_name, ctx->rw->class_name, ctx->rw->attr_typeref);
cdp_created = true;
}
if ( strcmp( ctx->rw->attr_typeref, "CastId") == 0 ||
strcmp( ctx->rw->attr_typeref, "DisableAttr") == 0)
return 1;
......
/*
* Proview $Id: cnv_wbltohtml.h,v 1.3 2005-09-01 14:57:47 claes Exp $
* Proview $Id: cnv_wbltohtml.h,v 1.4 2005-11-14 16:11:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -36,7 +36,7 @@ class CnvReadWbl;
class CnvWblToHtml : public CnvWblTo {
public:
CnvWblToHtml( CnvCtx *cnv_ctx) : ctx(cnv_ctx),
html_class_open(0), html_index_open(0), js_all_first(0) {}
html_class_open(0), html_index_open(0), js_all_first(0), cdp_created(false) {}
virtual ~CnvWblToHtml() {}
CnvCtx *ctx;
......@@ -52,6 +52,7 @@ class CnvWblToHtml : public CnvWblTo {
int html_index_open;
bool js_all_first;
bool js_group_first[80];
bool cdp_created;
int init( char *first);
int close();
......@@ -69,6 +70,7 @@ class CnvWblToHtml : public CnvWblTo {
Cnv_eWblToType type() { return Cnv_eWblToType_Html;}
int class_open() { return html_class_open;}
int index_open() { return html_index_open;}
void create_cdp_file( char *volume_name, char *class_name, char *attr_typeref);
};
......
/*
* Proview $Id: co_convert.cpp,v 1.9 2005-09-01 14:57:47 claes Exp $
* Proview $Id: co_convert.cpp,v 1.10 2005-11-14 16:11:23 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -42,6 +42,7 @@ extern "C" {
#include "cnv_xtthelptoxml.h"
#include "cnv_xtthelptops.h"
#include "cnv_xtthelptopdf.h"
#include "cnv_classdep.h"
typedef char cnv_tName[200];
......@@ -195,94 +196,8 @@ int main( int argc, char *argv[])
case 'o':
ctx->common_structfile_only = 1;
break;
case 'v':
ctx->verbose = 1;
break;
case 't':
xtthelp_to_html = 1;
break;
case 'm':
xtthelp_to_xml = 1;
break;
case 'n':
xtthelp_to_ps = 1;
break;
case 'f':
xtthelp_to_pdf = 1;
break;
default:
usage();
exit(0);
}
s++;
}
}
else
strcpy( files, argv[i]);
}
for ( i = 1; i < argc; i++) {
if ( strcmp( argv[i], "-d") == 0) {
if ( i+1 >= argc) {
usage();
exit(0);
}
strcpy( ctx->dir, argv[i+1]);
i++;
#if defined OS_VMS
if ( ctx->dir[strlen(ctx->dir)-1] != ':' &&
(ctx->dir[strlen(ctx->dir)-1] != '>' &&
ctx->dir[strlen(ctx->dir)-1] != ']' ))
strcat( ctx->dir , ":");
#else
if ( ctx->dir[strlen(ctx->dir)-1] != '/')
strcat( ctx->dir , "/");
#endif
}
if ( strcmp( argv[i], "-g") == 0) {
if ( i+1 >= argc) {
usage();
exit(0);
}
strcpy( ctx->setup_filename, argv[i+1]);
i++;
}
if ( strcmp( argv[i], "-l") == 0) {
if ( i+1 >= argc) {
usage();
exit(0);
}
Lng::set( argv[i+1]);
i++;
}
else if ( argv[i][0] == '-') {
s = &argv[i][1];
while( *s) {
switch( *s) {
case 'h':
help();
exit(0);
case 'w':
ctx->generate_html = 1;
break;
case 'x':
ctx->generate_xtthelp = 1;
break;
case 'c':
ctx->generate_src = 1;
break;
case 's':
ctx->generate_struct = 1;
break;
case 'q':
ctx->generate_ps = 1;
ctx->common_structfile_only = 1;
break;
case 'p':
ctx->generate_struct = 1;
ctx->hpp = 1;
break;
case 'o':
ctx->common_structfile_only = 1;
case 'k':
ctx->generate_cdp = 1;
break;
case 'v':
ctx->verbose = 1;
......@@ -347,6 +262,12 @@ int main( int argc, char *argv[])
delete xtthelpto;
exit(0);
}
if ( ctx->generate_cdp) {
CnvClassDep *classdep = new CnvClassDep( ctx);
classdep->read();
delete classdep;
exit(0);
}
// Get the files and order them
file_cnt = 0;
......
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