Commit 02ae14e8 authored by claes's avatar claes

java script orm menu

parent 7be41817
......@@ -626,6 +626,7 @@ void ClassRead::attribute_init()
attr_array = 0;
attr_rtvirtual = 0;
attr_elem = 0;
attr_isclass = 0;
}
int ClassRead::attribute_attr( char *name, char *value)
......@@ -654,10 +655,12 @@ int ClassRead::attribute_attr( char *name, char *value)
if ( strcmp( value, "PWR_MASK_POINTER") == 0)
attr_pointer = 1;
else if ( strcmp( value, "PWR_MASK_ARRAY") == 0)
if ( strcmp( value, "PWR_MASK_ARRAY") == 0)
attr_array = 1;
else if ( strcmp( value, "PWR_MASK_RTVIRTUAL") == 0)
if ( strcmp( value, "PWR_MASK_RTVIRTUAL") == 0)
attr_rtvirtual = 1;
if ( strcmp( value, "PWR_MASK_ISCLASS") == 0)
attr_isclass = 1;
}
else {
int flags_value;
......@@ -676,6 +679,8 @@ int ClassRead::attribute_attr( char *name, char *value)
attr_array = 1;
if ( flags_value & pwr_mAdef_rtvirtual)
attr_rtvirtual = 1;
if ( flags_value & pwr_mAdef_class)
attr_isclass = 1;
}
}
else if ( strcmp( low( name), "elements") == 0)
......
......@@ -98,7 +98,7 @@ class ClassRead {
html_class_open(0), html_index_open(0),
generate_xtthelp(0), xtthelp_index_open(0), xtthelp_in_topic(0),
generate_src(0), generate_struct(0), struct_class_open(0),
common_structfile_only(0), setup_group_cnt(0)
common_structfile_only(0), hpp(0), setup_group_cnt(0)
{ strcpy( setup_filename, "");};
~ClassRead() {};
......@@ -117,6 +117,7 @@ class ClassRead {
int attr_pointer;
int attr_array;
int attr_rtvirtual;
int attr_isclass;
char attr_elements[80];
int attr_elem;
char attr_pgmname[80];
......@@ -199,12 +200,16 @@ class ClassRead {
// ofstream fp_html_class;
CnvFile *html_clf;
ofstream fp_html_index;
ofstream fp_js_all;
ofstream fp_tmp;
ofstream fp_html_group[MAX_GROUPS];
ofstream fp_js_group[MAX_GROUPS];
char html_first[80];
char html_tmp_name[80];
int html_class_open;
int html_index_open;
bool js_all_first;
bool js_group_first[80];
int html_init( char *first);
int html_close();
......@@ -252,11 +257,13 @@ class ClassRead {
// ofstream fp_cstruc;
CnvFile *cstruc;
int struct_cclass_written;
int struct_cclass_endwritten;
int struct_filler_cnt;
char struct_volid[80];
unsigned int struct_vid_0;
unsigned int struct_vid_1;
int attr_count;
int hpp;
int struct_init();
int struct_close();
......
......@@ -82,6 +82,20 @@ int ClassRead::html_init( char *first)
"</HTML>" << endl;
}
// Create js index file
strcpy( fname, dir);
strcat( fname, volume_name);
strcat( fname, "_allclasses.jsf");
cdh_ToLower( fname, fname);
fp_js_all.open( fname);
js_all_first = true;
fp_js_all <<
"function " << volume_name << "_AllClasses( parent)" << endl <<
"{" << endl <<
"parent.addChildren([" << endl;
// Create group menu file
if ( setup_group_cnt) {
strcpy( fname, dir);
......@@ -120,12 +134,12 @@ int ClassRead::html_init( char *first)
"<BR>" << endl;
for ( int i = 0; i < setup_group_cnt; i++) {
// Put group index filename in fname
strcpy( fname, volume_name);
strcat( fname, "_group_");
strcat( fname, setup_groups[i]);
strcat( fname, "_index.html");
cdh_ToLower( fname, fname);
// Put group index filename in fname
strcpy( fname, volume_name);
strcat( fname, "_group_");
strcat( fname, setup_groups[i]);
strcat( fname, "_index.html");
cdh_ToLower( fname, fname);
fp <<
"<A HREF=\"" << fname << "\" TARGET=\"_parent\">" << setup_groups[i] << "</A>" << endl <<
......@@ -235,6 +249,14 @@ int ClassRead::html_init( char *first)
cdh_ToLower( fname, fname);
fp_html_group[i].open( fname);
strcpy( fname, dir);
strcat( fname, volume_name);
strcat( fname, "_group_");
strcat( fname, setup_groups[i]);
strcat( fname, ".jsf");
cdh_ToLower( fname, fname);
fp_js_group[i].open( fname);
fp_html_group[i] <<
"<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.0 Frameset//EN\"\"http://www.w3.org/TR/REC-html40/frameset.dtd\">" << endl <<
"<!-- Generated by co_convert " << timestr << " -->" << endl <<
......@@ -254,7 +276,44 @@ setup_groups[i] << endl <<
"<TR>" << endl <<
"<TD NOWRAP><FONT CLASS=\"FrameItemFont\"> " << endl;
js_group_first[i] = true;
fp_js_group[i] <<
"function " << volume_name << "_" << setup_groups[i] << "(parent)" << endl <<
"{" << endl <<
"parent.addChildren([" << endl;
}
// Create js map for volume
{
strcpy( fname, dir);
strcat( fname, volume_name);
strcat( fname, "_groups.jsf");
cdh_ToLower( fname, fname);
ofstream fp( fname);
fp <<
"function " << volume_name << "(parent)" << endl <<
"{" << endl <<
" aux = insFld(parent, gFld(\"AllClasses\",\"" << volume_name << "_index.html\"))" << endl <<
" " << volume_name << "_AllClasses(aux)" << endl;
for ( int i = 0; i < setup_group_cnt; i++) {
strcpy( fname, volume_name);
strcat( fname, "_group_");
strcat( fname, setup_groups[i]);
strcat( fname, "_index.html");
cdh_ToLower( fname, fname);
fp <<
" aux = insFld(parent, gFld(\"" << setup_groups[i] << "\",\"" << fname << "\"))" << endl <<
" " << volume_name << "_" << setup_groups[i] << "(aux)" << endl;
}
fp <<
"}" << endl;
}
return 1;
}
......@@ -270,6 +329,11 @@ int ClassRead::html_close()
"</HTML>" << endl;
fp_html_index.close();
fp_js_all <<
"])" << endl <<
"}" << endl;
fp_js_all.close();
for ( int i = 0; i < setup_group_cnt; i++) {
fp_html_group[i] <<
"</FONT></TD>" << endl <<
......@@ -279,8 +343,42 @@ int ClassRead::html_close()
"</BODY>" << endl <<
"</HTML>" << endl;
fp_html_group[i].close();
fp_js_group[i] <<
"])" << endl <<
"}" << endl;
fp_js_group[i].close();
}
#if 0
{
char fname[200];
strcpy( fname, dir);
strcat( fname, "index.jsm");
cdh_ToLower( fname, fname);
ofstream fp( fname);
fp <<
" aux = insFld(foldersTree, gFld(\"<b>pwrs</b>\",\"pwrs_index.html\"))" << endl <<
" pwrs_index(aux)" << endl <<
" aux = insFld(foldersTree, gFld(\"<b>pwrb</b>\",\"pwrb_index.html\"))" << endl <<
" pwrb_index(aux)" << endl <<
" aux = insFld(foldersTree, gFld(\"<b>nmps</b>\",\"nmps_index.html\"))" << endl <<
" nmps_index(aux)" << endl <<
" aux = insFld(foldersTree, gFld(\"<b>ssab</b>\",\"ssab_index.html\"))" << endl <<
" ssab_index(aux)" << endl <<
" aux = insFld(foldersTree, gFld(\"<b>tlog/b>\",\"tlog_index.html\"))" << endl <<
" tlog_index(aux)" << endl;
fp.close();
}
#endif
char cmd[200];
sprintf( cmd, "cat %s/*.jsf %s/../orm_menu.js > %s/menu.js", dir, dir, dir);
system( cmd);
return 1;
}
......@@ -292,6 +390,7 @@ int ClassRead::html_class()
char full_class_name[80];
char ref_name[200];
char struct_file[100];
char hpp_file[100];
char low_volume_name[80];
char low_class_name[80];
char txt[200];
......@@ -305,6 +404,11 @@ int ClassRead::html_class()
struct_get_filename( fname);
src_filename_to_html( struct_file, fname);
hpp = 1;
struct_get_filename( fname);
src_filename_to_html( hpp_file, fname);
hpp = 0;
strcpy( full_class_name, volume_name);
strcat( full_class_name, ":");
strcat( full_class_name, class_name);
......@@ -318,6 +422,15 @@ int ClassRead::html_class()
"<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << class_name << "</A>" << endl <<
"<BR>" << endl;
// Add into AllClasses js file
if ( !js_all_first)
fp_js_all << ",";
else
js_all_first = false;
fp_js_all <<
"[\"" << class_name << "\",\"" << html_file_name << ".html\"]" << endl;
// Add into group file
for ( int i = 0; i < doc_group_cnt; i++) {
for ( int j = 0; j < setup_group_cnt; j++) {
......@@ -325,6 +438,13 @@ int ClassRead::html_class()
fp_html_group[j] <<
"<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << class_name << "</A>" << endl <<
"<BR>" << endl;
if ( !js_group_first[j])
fp_js_group[j] << ",";
else
js_group_first[j] = false;
fp_js_group[j] <<
"[\"" << class_name << "\",\"" << html_file_name << ".html\"]" << endl;
}
}
}
......@@ -375,7 +495,8 @@ endl <<
"&nbsp;|&nbsp;<A HREF=\"#template\">Template</A>" << endl <<
"&nbsp;|&nbsp;<A HREF=\"#detail\">Detail</A>" << endl <<
"&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;C Binding: " << endl <<
"&nbsp;<A HREF=\"" << struct_file << "#" << class_name << "\">Struct</A>" << endl;
"&nbsp;<A HREF=\"" << struct_file << "#" << class_name << "\">Struct</A>" << endl <<
"&nbsp;|&nbsp<A HREF=\"" << hpp_file << "#" << class_name << "\">Class</A>" << endl;
if ( doc_fresh && strcmp( doc_code, "") != 0) {
src_filename_to_html( ref_name, doc_code);
......@@ -779,6 +900,15 @@ int ClassRead::html_typedef()
"<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << class_name << "</A>" << endl <<
"<BR>" << endl;
// Add into AllClasses js file
if ( !js_all_first)
fp_js_all << ",";
else
js_all_first = false;
fp_js_all <<
"[\"" << class_name << "\",\"" << html_file_name << ".html\"]" << endl;
// Add into group file
for ( int i = 0; i < doc_group_cnt; i++) {
for ( int j = 0; j < setup_group_cnt; j++) {
......@@ -786,6 +916,14 @@ int ClassRead::html_typedef()
fp_html_group[j] <<
"<A HREF=\"" << html_file_name << ".html\" TARGET=\"classFrame\">" << class_name << "</A>" << endl <<
"<BR>" << endl;
if ( !js_group_first[j])
fp_js_group[j] << ",";
else
js_group_first[j] = false;
fp_js_group[j] <<
"[\"" << class_name << "\",\"" << html_file_name << ".html\"]" << endl;
}
}
}
......
......@@ -30,12 +30,22 @@ int ClassRead::struct_init()
strcat( fname, struct_filename);
fp_struct.open( fname);
if ( strcmp( low(volume_name), "pwrb") == 0)
sprintf( fname, "pwr_%sclasses_h", "base");
else if ( strcmp( low(volume_name), "pwrs") == 0)
sprintf( fname, "pwr_%sclasses_h", "system");
else
sprintf( fname, "pwr_%sclasses_h", low(volume_name));
if ( hpp) {
if ( strcmp( low(volume_name), "pwrb") == 0)
sprintf( fname, "pwr_%sclasses_hpp", "base");
else if ( strcmp( low(volume_name), "pwrs") == 0)
sprintf( fname, "pwr_%sclasses_hpp", "system");
else
sprintf( fname, "pwr_%sclasses_hpp", low(volume_name));
}
else {
if ( strcmp( low(volume_name), "pwrb") == 0)
sprintf( fname, "pwr_%sclasses_h", "base");
else if ( strcmp( low(volume_name), "pwrs") == 0)
sprintf( fname, "pwr_%sclasses_h", "system");
else
sprintf( fname, "pwr_%sclasses_h", low(volume_name));
}
sts = struct_volname_to_id();
if ( sts == 0)
......@@ -80,7 +90,10 @@ int ClassRead::struct_class()
strcpy( volume_name_low, low(volume_name));
struct_get_filename( struct_filename);
sprintf( fname, "%s%s_c_%s.h", dir, volume_name_low, low(class_name));
if ( hpp)
sprintf( fname, "%s%s_c_%s.hpp", dir, volume_name_low, low(class_name));
else
sprintf( fname, "%s%s_c_%s.h", dir, volume_name_low, low(class_name));
if ( !common_structfile_only) {
cstruc = new CnvFile();
cstruc->f.open( fname);
......@@ -102,6 +115,7 @@ endl;
// Add into index file
struct_cclass_written = 0;
struct_cclass_endwritten = 0;
struct_filler_cnt = 0;
return 1;
......@@ -117,10 +131,18 @@ int ClassRead::struct_body()
attr_count = 0;
if ( strcmp( low( body_name), "devbody") == 0)
strcpy( struct_name, "pwr_sdClass_");
else
strcpy( struct_name, "pwr_sClass_");
if ( strcmp( low( body_name), "devbody") == 0) {
if ( hpp)
strcpy( struct_name, "pwr_dClass_");
else
strcpy( struct_name, "pwr_sdClass_");
}
else {
if ( hpp)
strcpy( struct_name, "pwr_Class_");
else
strcpy( struct_name, "pwr_sClass_");
}
if ( strcmp( body_structname, "") == 0)
strcat( struct_name, class_name);
else
......@@ -188,14 +210,20 @@ endl;
cstruc->f <<
"/* Body: " << body_name << " */" << endl;
fp_struct <<
endl <<
"typedef struct {" << endl;
if ( !common_structfile_only)
cstruc->f <<
endl <<
if ( hpp)
fp_struct << endl <<
"class " << struct_name << " ";
else
fp_struct << endl <<
"typedef struct {" << endl;
if ( !common_structfile_only) {
if ( hpp)
cstruc->f << endl <<
"class " << struct_name << " ";
else
cstruc->f << endl <<
"typedef struct {" << endl;
}
return 1;
}
......@@ -225,12 +253,21 @@ int ClassRead::struct_body_close()
strcat( struct_name, class_name);
else
strcat( struct_name, body_structname);
fp_struct <<
if ( hpp) {
fp_struct <<
"};" << endl;
if ( !common_structfile_only)
cstruc->f <<
"};" << endl;
}
else {
fp_struct <<
"} " << struct_name << ";" << endl;
if ( !common_structfile_only)
cstruc->f <<
if ( !common_structfile_only)
cstruc->f <<
"} " << struct_name << ";" << endl;
}
fp_struct <<
endl;
......@@ -261,15 +298,17 @@ endl;
}
// endif pwr_cClass...
if ( struct_class_open)
if ( !struct_cclass_endwritten) {
fp_struct <<
"#endif" << endl <<
endl;
if ( !common_structfile_only && struct_class_open)
cstruc->f <<
if ( !common_structfile_only && struct_class_open)
cstruc->f <<
"#endif" << endl <<
endl;
struct_cclass_endwritten = 1;
}
// Close class structfile
if ( !common_structfile_only && struct_class_open)
......@@ -281,6 +320,7 @@ endl;
delete cstruc;
struct_class_open = 0;
}
return 1;
}
......@@ -322,6 +362,14 @@ int ClassRead::struct_attribute()
strcpy( type_name, "pwr_s");
strcat( type_name, attr_typeref);
}
else if ( attr_isclass)
{
if ( hpp)
strcpy( type_name, "pwr_Class_");
else
strcpy( type_name, "pwr_sClass_");
strcat( type_name, attr_typeref);
}
else
{
strcpy( type_name, "pwr_t");
......@@ -342,6 +390,29 @@ int ClassRead::struct_attribute()
}
}
if ( hpp && attr_count == 0) {
if ( attr_isclass && strcmp( pgmname, "Super") == 0) {
fp_struct <<
": public " << type_name << " {" << endl <<
" public:" << endl;
if ( !common_structfile_only)
cstruc->f <<
type_name << " {" << endl <<
" public:" << endl;
attr_count++;
return 1;
}
else {
fp_struct <<
" {" << endl <<
" public:" << endl;
if ( !common_structfile_only)
cstruc->f <<
" {" << endl <<
" public:" << endl;
}
}
if ( strcmp( low(attr_type), "input") == 0)
{
if ( attr_array && attr_pointer)
......@@ -723,7 +794,10 @@ void ClassRead::struct_get_filename( char *struct_file)
else
strcat( struct_file, low(volume_name));
strcat( struct_file, "classes.h");
if ( hpp)
strcat( struct_file, "classes.hpp");
else
strcat( struct_file, "classes.h");
}
int ClassRead::struct_check_typename( char *type_name)
......
......@@ -23,6 +23,8 @@ static void usage()
printf( " -c: Create html files from c- and -h-files\n");
printf( " -s: Create h files from wb_load-files\n");
printf( " -so: Create one common h file from wb_load-files\n");
printf( " -p: Create hpp files from wb_load-files\n");
printf( " -po: Create one common hpp file from wb_load-files\n");
printf( " -t: Create html from xtthelp-file\n");
printf( " -d: Output directory\n");
printf( " -g: Setup file\n");
......@@ -131,6 +133,10 @@ int main( int argc, char *argv[])
case 's':
cr->generate_struct = 1;
break;
case 'p':
cr->generate_struct = 1;
cr->hpp = 1;
break;
case 'o':
cr->common_structfile_only = 1;
break;
......
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