Commit 5d3a4e05 authored by claes's avatar claes

Major redesign, conversion to postscript and xml

parent 6edd27e6
/* cnv_content.cpp --
PROVIEW/R
Copyright (C) 1996-98 by Mandator AB.
Table of content ist. */
/*_Include files_________________________________________________________*/
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
extern "C" {
#include "co_cdh.h"
#include "co_dcli.h"
}
#include "cnv_content.h"
int CnvContent::find_link( char *subject, char *text, int *page)
{
char key_part[4][40];
char subject_part[4][40];
int i, j;
int subject_nr;
int key_nr;
int hit = 0;
subject_nr = dcli_parse( subject, " ", "", (char *)subject_part,
sizeof( subject_part) / sizeof( subject_part[0]),
sizeof( subject_part[0]), 0);
for ( j = 0; j < (int)tab.size(); j++) {
key_nr = dcli_parse( tab[j].subject, " ", "", (char *)key_part,
sizeof( key_part) / sizeof( key_part[0]),
sizeof( key_part[0]), 0);
if ( key_nr == subject_nr ) {
for ( i = 0; i < key_nr; i++) {
if ( cdh_NoCaseStrcmp( subject_part[i], key_part[i]) == 0) {
if ( i == key_nr - 1) {
hit = 1;
break;
}
}
else
break;
}
}
if ( hit)
break;
}
if ( !hit)
return 0;
strcpy( text, tab[j].text);
*page = tab[j].page_number;
return 1;
}
void CnvContent::add( CnvContentElem& elem)
{
tab.push_back( elem);
}
#ifndef cnv_content_h
#define cnv_content_h
/* cnv_content.h -- Table of content list
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
using namespace std;
#include <iostream.h>
#include <vector.h>
#include <string>
#include "pwr.h"
#include "cnv_style.h"
class CnvContentElem {
public:
int page_number;
int header_level;
char header_number[40];
char subject[80];
char text[80];
};
class CnvContent {
public:
CnvContent() {}
vector<CnvContentElem> tab;
void add( CnvContentElem& elem);
int find_link( char *subject, char *text, int *page);
};
#endif
#include <stdio.h>
#include <float.h>
#include <string.h>
#include <stdlib.h>
#include <iostream.h>
#include <fstream.h>
extern "C" {
#include "pwr.h"
#include "co_dcli.h"
#include "co_cdh.h"
}
#include "cnv_ctx.h"
char *CnvCtx::low( char *in)
{
static char str[400];
cdh_ToLower( str, in);
return str;
}
int CnvCtx::remove_spaces(
char *in,
char *out)
{
char *s;
for ( s = in; !((*s == 0) || ((*s != ' ') && (*s != 9))); s++);
strcpy( out, s);
s = out;
if ( strlen(s) != 0) {
for ( s += strlen(s) - 1;
!((s == out) || ((*s != ' ') && (*s != 9))); s--) ;
s++;
*s = 0;
}
return 1;
}
int CnvCtx::read_line(
char *line,
int maxsize,
FILE *file)
{
char *s;
if (fgets( line, maxsize, file) == NULL)
return 0;
line[maxsize-1] = 0;
s = strchr( line, 10);
if ( s != 0)
*s = 0;
s = strchr( line, 13);
if ( s != 0)
*s = 0;
return 1;
}
#ifndef co_convert_h
#define co_convert_h
/* co_convert.h -- Setup
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include <stdio.h>
#include "pwr.h"
#include "cnv_setup.h"
class CnvWblTo;
class CnvReadWbl;
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),
verbose(0), first_class(1), setup(0), wblto(0), rw(0), rx(0)
{
strcpy( dir, "");
strcpy( setup_filename, "");
}
char dir[120];
int generate_html;
int generate_xtthelp;
int generate_src;
int generate_struct;
int generate_ps;
int common_structfile_only;
int hpp;
int verbose;
char setup_filename[120];
int first_class;
CnvSetup *setup;
CnvWblTo *wblto;
CnvReadWbl *rw;
CnvReadXtthelp *rx;
static int read_line( char *line, int maxsize, FILE *file);
static int remove_spaces( char *in, char *out);
static char *low( char *in);
};
#if defined __cplusplus
}
#endif
#endif
#include <iostream.h>
#include <float.h>
#include <math.h>
#include <stdlib.h>
#include "cnv_image.h"
static ImlibData *imlib = 0;
static Display *display = 0;
int cnv_get_image( char *fname, ImlibImage **image, Pixmap *pixmap)
{
#if defined IMLIB
if ( !imlib) {
display = XOpenDisplay(NULL);
imlib = Imlib_init( display);
}
#endif
*image = Imlib_load_image( imlib, fname);
if ( !*image)
return 0;
*pixmap = Imlib_move_image( imlib, *image);
return 1;
}
void cnv_free_image( ImlibImage *image, Pixmap pixmap)
{
Imlib_free_pixmap( imlib, pixmap);
Imlib_destroy_image( imlib, image);
}
#ifndef cnv_image_h
#define cnv_image_h
#include <stdlib.h>
#include <Xm/Xm.h>
#include <Mrm/MrmPublic.h>
#ifndef _XtIntrinsic_h
#include <X11/Intrinsic.h>
#endif
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#if defined OS_LINUX
#define IMLIB 1
#endif
#if defined IMLIB
# if defined OS_LYNX
# define __NO_INCLUDE_WARN__ 1
# endif
# include <X11/extensions/shape.h>
# include <Imlib.h>
# if defined OS_LYNX
# undef __NO_INCLUDE_WARN__
# endif
#else
typedef void *ImlibData;
typedef void *ImlibImage;
#endif
int cnv_get_image( char *fname, ImlibImage **image, Pixmap *pixmap);
void cnv_free_image( ImlibImage *image, Pixmap pixmap);
#endif
......@@ -10,15 +10,18 @@ extern "C" {
#include "co_dcli.h"
#include "co_cdh.h"
}
#include "cnv_classread.h"
#include "cnv_ctx.h"
#include "cnv_readsrc.h"
#include "cnv_wblto.h"
int ClassRead::src_read( char *filename)
int CnvReadSrc::read_src( char *filename)
{
int sts;
char orig_line[400];
char line[400];
char line_part[4][80];
int nr;
FILE *fp;
fp = fopen( filename, "r");
if ( !fp)
......@@ -27,23 +30,23 @@ int ClassRead::src_read( char *filename)
state = 0;
doc_fresh = 0;
src_html_init( filename);
html_init( filename);
while( 1)
{
sts = read_line( orig_line, sizeof(orig_line), fp);
sts = CnvCtx::read_line( orig_line, sizeof(orig_line), fp);
if ( !sts)
linetype = cread_eLine_EOF;
else
{
remove_spaces( orig_line, line);
CnvCtx::remove_spaces( orig_line, line);
if ( strcmp( line, "") == 0)
continue;
if ( strncmp( line, "/*_*", 4) != 0 &&
!(state & cread_mState_Doc))
{
src_html_line( orig_line);
html_line( orig_line);
continue;
}
......@@ -81,7 +84,7 @@ int ClassRead::src_read( char *filename)
strcpy( src_aref, line_part[1]);
if ( nr > 2)
strcpy( src_aref_text, line_part[2]);
src_html_aref();
html_aref();
}
if ( strstr( line, "*/"))
state &= ~cread_mState_Doc;
......@@ -91,23 +94,23 @@ int ClassRead::src_read( char *filename)
break;
}
if ( generate_html && html_class_open)
html_class_close();
if ( generate_xtthelp && xtthelp_index_open)
xtthelp_class_close();
if ( ctx->generate_html && ctx->wblto && ctx->wblto->class_open())
ctx->wblto->class_close();
if ( ctx->generate_xtthelp && ctx->wblto && ctx->wblto->index_open())
ctx->wblto->class_close();
fclose(fp);
src_html_close();
html_close();
return 1;
}
int ClassRead::src_html_init( char *filename)
int CnvReadSrc::html_init( char *filename)
{
char fname[200];
char dir_fname[200];
src_filename_to_html( fname, filename);
strcpy( dir_fname, dir);
filename_to_html( fname, filename);
strcpy( dir_fname, ctx->dir);
strcat( dir_fname, fname);
// Open html file
......@@ -135,7 +138,7 @@ filename << endl <<
return 1;
}
int ClassRead::src_html_close()
int CnvReadSrc::html_close()
{
fp_src_html <<
"</XMP></CODE>" << endl <<
......@@ -146,14 +149,14 @@ int ClassRead::src_html_close()
return 1;
}
int ClassRead::src_html_line( char *line)
int CnvReadSrc::html_line( char *line)
{
fp_src_html << line << endl;
return 1;
}
int ClassRead::src_html_aref()
int CnvReadSrc::html_aref()
{
fp_src_html <<
"</XMP></CODE>" << endl <<
......@@ -164,7 +167,7 @@ int ClassRead::src_html_aref()
return 1;
}
void ClassRead::src_filename_to_html( char *fname, char *filename)
void CnvReadSrc::filename_to_html( char *fname, char *filename)
{
char *s;
......@@ -186,3 +189,11 @@ void ClassRead::src_filename_to_html( char *fname, char *filename)
*s = '_';
strcat( fname, ".html");
}
char *CnvReadSrc::low( char *in)
{
static char str[400];
cdh_ToLower( str, in);
return str;
}
#ifndef cnv_readsrc_h
#define cnv_readsrc_h
/* cnv_readsrc.h -- Read source files
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "cnv_ctx.h"
#include "cnv_readwbl.h"
using namespace std;
class CnvReadSrc {
public:
CnvReadSrc( CnvCtx *cnv_ctx) :
ctx(cnv_ctx), state(0), linetype(cread_eLine_No), doc_fresh(0),
html_class_open(0)
{}
CnvCtx *ctx;
int state;
char src_aref[80];
char src_aref_text[200];
ofstream fp_src_html;
cread_eLine linetype;
int doc_fresh;
int html_class_open;
int read_src( char *filename);
int html_init( char *filename);
int html_close();
int html_line( char *line);
int html_aref();
static void filename_to_html( char *fname, char *filename);
char *low( char *in);
};
#if defined __cplusplus
}
#endif
#endif
#ifndef cnv_readwbl_h
#define cnv_readwbl_h
/* cnv_readwbl.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
using namespace std;
class CnvCtx;
class CnvWblTo;
#define MAX_GROUPS 100
typedef enum {
cread_eLine_No,
cread_eLine_EOF,
cread_eLine_SObject,
cread_eLine_EndSObject,
cread_eLine_ClassDef,
cread_eLine_ObjBodyDef,
cread_eLine_SysBody,
cread_eLine_RtBody,
cread_eLine_DevBody,
cread_eLine_EndBody,
cread_eLine_Input,
cread_eLine_Output,
cread_eLine_Intern,
cread_eLine_Attribute,
cread_eLine_ObjXRef,
cread_eLine_Attr,
cread_eLine_GraphPlcNode,
cread_eLine_GraphPlcCon,
cread_eLine_Buffer,
cread_eLine_Object,
cread_eLine_EndObject,
cread_eLine_Doc,
cread_eLine_DocEnd,
cread_eLine_Template,
cread_eLine_Comment,
cread_eLine_Volume,
cread_eLine_EndVolume,
cread_eLine_DParam,
cread_eLine_DAttr,
cread_eLine_Buff,
cread_eLine_EndBuff,
cread_eLine_Range,
cread_eLine_TypeDef,
cread_eLine_Type,
cread_eLine_Bit,
cread_eLine_Value,
cread_eLine_Unknown
} cread_eLine;
typedef enum {
cread_mState_SObject = 1 << 0,
cread_mState_ClassDef = 1 << 1,
cread_mState_ObjBodyDef = 1 << 2,
cread_mState_SysBody = 1 << 3,
cread_mState_RtBody = 1 << 4,
cread_mState_DevBody = 1 << 5,
cread_mState_Input = 1 << 6,
cread_mState_Output = 1 << 7,
cread_mState_Intern = 1 << 8,
cread_mState_Attribute = 1 << 9,
cread_mState_ObjXRef = 1 << 10,
cread_mState_GraphPlcNode = 1 << 11,
cread_mState_GraphPlcCon = 1 << 12,
cread_mState_Buffer = 1 << 13,
cread_mState_Object = 1 << 14,
cread_mState_Doc = 1 << 15,
cread_mState_Template = 1 << 16,
cread_mState_Volume = 1 << 17,
cread_mState_DParam = 1 << 18,
cread_mState_TypeDef = 1 << 19,
cread_mState_Type = 1 << 20,
cread_mState_StringAttr = 1 << 21,
cread_mState_Bit = 1 << 22,
cread_mState_Value = 1 << 23
} cread_mState;
#define cread_cTmpFile1 "classread1.tmp"
#define cread_cTmpFile2 "classread2.tmp"
#define cread_cTmpFile3 "classread3.tmp"
class CnvFile {
public:
ofstream f;
};
class CnvReadWbl {
public:
CnvReadWbl( CnvCtx *cnv_ctx, CnvWblTo *cnv_wblto) :
ctx(cnv_ctx), wblto(cnv_wblto)
{}
~CnvReadWbl() {}
CnvCtx *ctx;
CnvWblTo *wblto;
FILE *fp;
cread_eLine linetype;
int verbose;
int state;
int object_state;
char source_dir[200];
char current_file[200];
char attr_name[80];
char attr_flags[200];
char attr_type[80];
char attr_typeref[80];
char attr_typeref_volume[80];
int attr_pointer;
int attr_array;
int attr_rtvirtual;
int attr_isclass;
char attr_elements[80];
int attr_elem;
char attr_pgmname[80];
char volume_name[80];
char class_id[80];
char class_name[80];
char class_editor[80];
char class_method[80];
char class_popeditor[80];
char class_flags[200];
int class_devonly;
char body_name[80];
char body_structname[80];
char body_flags[200];
int body_rtvirtual;
char graphplcnode_name[80];
char graphplccon_name[20];
char typedef_name[80];
char typedef_typeref[80];
int typedef_elements;
char typedef_pgmname[32];
char bit_name[80];
char bit_type[80];
int bit_value;
char bit_text[80];
char bit_pgmname[80];
char doc_author[200];
char doc_version[80];
char doc_groups[10][40];
int doc_group_cnt;
char doc_code[200];
char doc_link_ref[20][80];
char doc_link_text[20][200];
int doc_link_cnt;
char doc_clink_ref[20][80];
char doc_clink_text[20][200];
int doc_clink_cnt;
char doc_summary[400];
char doc_text[1000][200];
int doc_cnt;
int doc_fresh;
char sobject_name[80];
char dir[120];
char ClassDef[80];
char ObjBodyDef[80];
char GraphPlcNode[80];
char GraphPlcCon[80];
char Attribute[80];
int read_wbl( char *filename);
int read_line( char *line, int maxsize, FILE *file);
int remove_spaces( char *in, char *out);
void attribute_init();
int attribute_attr( char *name, char *value);
int attribute_close();
void class_init();
int class_attr( char *name, char *value);
int class_close();
void typedef_init();
int typedef_attr( char *name, char *value);
int typedef_close();
void bit_init();
int bit_attr( char *name, char *value);
int bit_close();
void body_init();
int body_attr( char *name, char *value);
int body_close();
void graphplcnode_init();
int graphplcnode_attr( char *name, char *value);
int graphplcnode_close();
void graphplccon_init();
int graphplccon_attr( char *name, char *value);
int graphplccon_close();
void template_init();
int template_attr( char *name, char *value);
int template_close();
void doc_init();
int doc_add( char *line);
int doc_close();
void volume_init();
int object_close();
char *low( char *in);
int copy_tmp_file( char *tmpfilename, ofstream& fp_to);
char *flags_to_string( int value);
};
#if defined __cplusplus
}
#endif
#endif
/* cnv_readxtthelp.cpp --
PROVIEW/R
Copyright (C) 1996-98 by Mandator AB.
Convert xtt help file to html. */
/*_Include files_________________________________________________________*/
#include <iostream.h>
#include <fstream.h>
#include <stdio.h>
#include <ctype.h>
#include <string.h>
#include <stdlib.h>
extern "C" {
#include "co_cdh.h"
#include "co_dcli.h"
}
#include "co_nav_help.h"
#include "cnv_readxtthelp.h"
#include "cnv_xtthelpto.h"
#define CNV_TAB 18
/* Nice functions */
#define ODD(a) (((int)(a) & 1) != 0)
#define EVEN(a) (((int)(a) & 1) == 0)
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define min(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
#ifndef __ALPHA
#define abs(Dragon) ((Dragon) >= 0 ? (Dragon) : (-(Dragon)))
#endif
CnvReadXtthelp::CnvReadXtthelp( char *x_name, char *x_directory,
CnvXtthelpTo *to) :
xtthelpto(to)
{
char *s;
strcpy( filename, x_name);
if ( (s = strrchr(x_name,'/')))
strcpy( name, s+1);
else
strcpy( name, x_name);
if ((s = strrchr( name, '.')))
*s = 0;
strcpy( directory, x_directory);
}
void *help_insert_cb( void *ctx, navh_eItemType item_type, char *text1,
char *text2, char *text3, char *link,
char *link_bookmark, char *file_name,
navh_eHelpFile file_type, int help_index,
char *bookmark)
{
CnvReadXtthelp *xh = (CnvReadXtthelp *)ctx;
return xh->xtthelpto->insert( item_type, text1, text2, text3, link,
link_bookmark, file_name, file_type, help_index,
bookmark);
}
int CnvReadXtthelp::read_xtthelp()
{
int sts;
void *bookmark_node;
if ( xtthelpto->confpass()) {
xtthelpto->set_confpass( true);
NavHelp *navhelp = new NavHelp( (void *)this, "$pwr_exe/wtt_help.dat",
"$pwrp_exe/xtt_help.dat");
navhelp->insert_cb = help_insert_cb;
navhelp->set_propagate(0); // Don't print include files
sts = navhelp->help( NULL, "", navh_eHelpFile_Other,
filename, &bookmark_node);
if ( EVEN(sts)) return sts;
delete navhelp;
xtthelpto->set_confpass( false);
}
NavHelp *navhelp = new NavHelp( (void *)this, "$pwr_exe/wtt_help.dat",
"$pwrp_exe/xtt_help.dat");
navhelp->insert_cb = help_insert_cb;
navhelp->set_propagate(0); // Don't print include files
sts = navhelp->help( NULL, "", navh_eHelpFile_Other,
filename, &bookmark_node);
if ( EVEN(sts)) return sts;
delete navhelp;
return 1;
}
#ifndef cnv_help_h
#define cnv_help_h
#ifndef cnv_xtthelpread_h
#define cnv_xtthelpread_h
/* cnv_help.h -- Documentation
/* cnv_xtthelpread.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
......@@ -13,16 +13,19 @@
extern "C" {
#endif
class XhelpToHtml {
class CnvXtthelpTo;
class CnvReadXtthelp {
public:
XhelpToHtml( char *x_name, char *x_directory);
CnvReadXtthelp( char *x_name, char *x_directory,
CnvXtthelpTo *to);
ofstream fp;
char directory[80];
char name[80];
char filename[120];
CnvXtthelpTo *xtthelpto;
void subject_to_fname( char *fname, char *subject, int path);
int generate();
int read_xtthelp();
};
......
......@@ -10,27 +10,29 @@ extern "C" {
#include "co_dcli.h"
#include "co_cdh.h"
}
#include "cnv_classread.h"
#include "cnv_ctx.h"
#include "cnv_setup.h"
int ClassRead::setup()
int CnvSetup::setup( char *filename)
{
int sts;
char line[400];
char line_part[4][80];
int nr;
char line_cnt = 0;
FILE *fp;
fp = fopen( setup_filename, "r");
fp = fopen( filename, "r");
if ( !fp)
return 0;
while( 1) {
sts = read_line( line, sizeof(line), fp);
sts = CnvCtx::read_line( line, sizeof(line), fp);
if ( !sts)
break;
else {
line_cnt++;
remove_spaces( line, line);
CnvCtx::remove_spaces( line, line);
if ( strcmp( line, "") == 0)
continue;
......@@ -41,21 +43,21 @@ int ClassRead::setup()
sizeof( line_part) / sizeof( line_part[0]),
sizeof( line_part[0]), 0);
if ( strcmp( low( line_part[0]), "group") == 0){
if ( strcmp( CnvCtx::low( line_part[0]), "group") == 0){
if ( nr < 2) {
printf("** Setup syntax error in file %s, line %d\n", setup_filename, line_cnt);
printf("** Setup syntax error in file %s, line %d\n", filename, line_cnt);
continue;
}
if ( setup_group_cnt >= (int)(sizeof(setup_groups)/sizeof(setup_groups[0]))) {
printf("** Max number of groups exceeded in file %s, line %d\n", setup_filename, line_cnt);
if ( group_cnt >= (int)(sizeof(groups)/sizeof(groups[0]))) {
printf("** Max number of groups exceeded in file %s, line %d\n", filename, line_cnt);
continue;
}
strcpy( setup_groups[setup_group_cnt], line_part[1]);
strcpy( groups[group_cnt], line_part[1]);
if ( nr >= 3)
strcpy( setup_groups_startpage[setup_group_cnt], line_part[2]);
strcpy( groups_startpage[group_cnt], line_part[2]);
else
strcpy( setup_groups_startpage[setup_group_cnt], "");
setup_group_cnt++;
strcpy( groups_startpage[group_cnt], "");
group_cnt++;
}
}
}
......
#ifndef cnv_setup_h
#define cnv_setup_h
/* cnv_setup.h -- Setup
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#define MAX_GROUPS 100
class CnvSetup {
public:
int group_cnt;
char groups[MAX_GROUPS][40];
char groups_startpage[MAX_GROUPS][80];
int setup( char *filename);
};
#if defined __cplusplus
}
#endif
#endif
#ifndef cnv_style_h
#define cnv_style_h
/* cnv_style.h -- Convert style
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
using namespace std;
#include <iostream.h>
#include <vector.h>
#include <string>
#include "pwr.h"
typedef enum {
cnv_eAlignment_Left,
cnv_eAlignment_Center
} cnv_eAlignment;
class CnvStyle {
public:
CnvStyle() {}
CnvStyle( string s_font, int s_font_size, int s_indentation,
int s_top_offset, int s_bottom_offset, int s_alignment,
int s_pagebreak, int s_sidebreak, int s_display_number) :
font(s_font), font_size(s_font_size), indentation(s_indentation),
top_offset(s_top_offset), bottom_offset(s_bottom_offset),
alignment(s_alignment), pagebreak(s_pagebreak), sidebreak(s_sidebreak),
display_number(s_display_number)
{}
string font;
int font_size;
int indentation;
int top_offset;
int bottom_offset;
int alignment;
int pagebreak;
int sidebreak;
int display_number;
};
class CnvIdStyle {
public:
CnvIdStyle() {
h1 = CnvStyle( "Helvetica-Bold-ISOLatin1", 14, 0, 30, 25, cnv_eAlignment_Left, 0, 0, 1);
h2 = CnvStyle( "Helvetica-Bold-ISOLatin1", 12, 0, 25, 20, cnv_eAlignment_Left, 0, 0, 1);
h3 = CnvStyle( "Helvetica-Bold-ISOLatin1", 10, 0, 15, 10, cnv_eAlignment_Left, 0, 0, 1);
text = CnvStyle( "Helvetica-ISOLatin1", 10, 0, 11, 2, cnv_eAlignment_Left, 0, 0, 0);
boldtext = CnvStyle( "Helvetica-Bold-ISOLatin1", 10, 0, 11, 2, cnv_eAlignment_Left, 0, 0, 0);
link = CnvStyle( "Helvetica-Oblique-ISOLatin1", 8, 0, 11, 2, cnv_eAlignment_Left, 0, 0, 0);
image = CnvStyle( "Helvetica-Oblique-ISOLatin1", 10, 0, 10, 0, cnv_eAlignment_Left, 0, 0, 0);
code = CnvStyle( "Courier-ISOLatin1", 10, 0, 11, 2, cnv_eAlignment_Left, 0, 0, 0);
}
CnvStyle h1;
CnvStyle h2;
CnvStyle h3;
CnvStyle text;
CnvStyle boldtext;
CnvStyle link;
CnvStyle image;
CnvStyle code;
};
#endif
This diff is collapsed.
#ifndef cnv_tops_h
#define cnv_tops_h
/* cnv_tops.h -- Postscript output
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
using namespace std;
#include <iostream.h>
#include <vector.h>
#include <string>
#include "pwr.h"
#include "cnv_style.h"
#include "cnv_content.h"
#define ps_cMaxLevel 4
#define ps_cPageHeight 820
#define ps_cPageWidth 535
#define ps_cPageNumX (ps_cPageWidth - 10)
#define ps_cPageNumY (ps_cPageHeight - 13)
#define ps_cLeftMargin 100
#define ps_cTopMargin 100
#define ps_cBottomMargin 50
#define ps_cCellSize 110
#define ps_cTmpFile "/tmp/ptmp.ps"
typedef enum {
ps_mPrintMode_Pos = 1 << 0,
ps_mPrintMode_Start = 1 << 1,
ps_mPrintMode_Continue= 1 << 2,
ps_mPrintMode_End = 1 << 3,
ps_mPrintMode_KeepY = 1 << 4,
ps_mPrintMode_FixX = 1 << 5
} ps_mPrintMode;
typedef enum {
ps_eFile_Info,
ps_eFile_Body,
ps_eFile__
} ps_eFile;
typedef enum {
ps_eId_TitlePage,
ps_eId_InfoPage,
ps_eId_Content,
ps_eId_Chapter,
ps_eId_TopicL1,
ps_eId_TopicL2,
ps_eId_TopicL3,
ps_eId_Function,
ps_eId_Class,
ps_eId__
} ps_eId;
class CnvToPs {
public:
CnvToPs() :
cf(0), ci(0), conf_pass(false)
{
for ( int i = 0; i < ps_cMaxLevel; i++)
header_number[i] = 0;
for ( int i = 0; i < ps_eFile__; i++)
page_number[i] = 0;
style[ps_eId_TitlePage].h1 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 35, 0, 100, 20, cnv_eAlignment_Center, 0, 0, 0);
style[ps_eId_TitlePage].h2 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 25, 0, 50, 20, cnv_eAlignment_Center, 0, 0, 0);
style[ps_eId_TitlePage].h3 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 15, 0, 25, 10, cnv_eAlignment_Center, 0, 0, 0);
style[ps_eId_TitlePage].text =
CnvStyle( "Helvetica-ISOLatin1", 8, 0, 9, 1, cnv_eAlignment_Center, 0, 0, 0);
style[ps_eId_TitlePage].boldtext =
CnvStyle( "Helvetica-Bold-ISOLatin1", 8, 0, 9, 1, cnv_eAlignment_Center, 0, 0, 0);
style[ps_eId_Chapter].h1 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 24, 0, 24, 40, cnv_eAlignment_Left, 0, 1, 1);
style[ps_eId_TopicL2].h1 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 12, 0, 20, 10, cnv_eAlignment_Left, 0, 0, 1);
style[ps_eId_TopicL2].h2 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 10, 0, 16, 8, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_TopicL3].h1 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 10, 0, 16, 8, cnv_eAlignment_Left, 0, 0, 1);
style[ps_eId_TopicL3].h2 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 8, 0, 16, 5, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_Function].h1 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 24, 0, 24, 20, cnv_eAlignment_Left, 1, 0, 1);
style[ps_eId_Class].h1 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 24, 0, 24, 20, cnv_eAlignment_Left, 1, 0, 1);
style[ps_eId_Class].h2 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 20, 0, 24, 8, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_Class].h3 =
CnvStyle( "Helvetica-Bold-ISOLatin1", 16, -40, 24, 6, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_Content].boldtext =
CnvStyle( "Helvetica-Bold-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_Chapter].text =
CnvStyle( "TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_TopicL1].text =
CnvStyle( "TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_TopicL2].text =
CnvStyle( "TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
style[ps_eId_TopicL3].text =
CnvStyle( "TimesNewRoman-ISOLatin1", 10, 0, 11, 1, cnv_eAlignment_Left, 0, 0, 0);
}
~CnvToPs();
void close();
void print_text( char *text, CnvStyle& style, int mode = ps_mPrintMode_Pos);
void print_pagebreak( int print_num);
void print_content();
void print_h1( char *text, int hlevel, char *subject);
void print_h2( char *text);
void print_h3( char *text);
void print_horizontal_line();
int print_image( char *filename);
void cnv_text( char *to, char *from);
void set_confpass( bool conf) {
conf_pass = conf;
if ( !conf) {
// Reset
for ( int i = 0; i < ps_cMaxLevel; i++)
header_number[i] = 0;
for ( int i = 0; i < ps_eFile__; i++)
page_number[i] = 0;
cf = 0;
ci = 0;
}
}
void set_ci( int val) { ci = val;}
void set_cf( int val) { cf = val;}
void set_filename( int idx, char *name) {
strcpy( filename[idx], name);
}
void open();
void incr_headerlevel();
void decr_headerlevel();
void reset_headernumbers( int level);
void set_pageheader( char *text);
CnvContent content;
CnvIdStyle style[ps_eId__];
ofstream fp[ps_eFile__];
pwr_tFileName filename[ps_eFile__];
int cf;
int ci;
double x;
double y;
int page_number[ps_eFile__];
int header_number[ps_cMaxLevel];
bool conf_pass;
char current_chapter[160];
char previous_chapter[160];
};
#endif
#include <iostream.h>
#include <fstream.h>
#include <float.h>
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
extern "C" {
#include "pwr.h"
#include "co_dcli.h"
#include "co_cdh.h"
}
#include "cnv_wblto.h"
int CnvWblTo::init( char *)
{
return 1;
}
#ifndef cnv_wblto_h
#define cnv_wblto_h
/* cnv_wblto.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "cnv_readwbl.h"
using namespace std;
class CnvReadWbl;
typedef enum {
Cnv_eWblToType_Html,
Cnv_eWblToType_H,
Cnv_eWblToType_Xtthelp,
Cnv_eWblToType_Ps
} Cnv_eWblToType;
class CnvWblTo {
public:
// CnvWblTo() {}
virtual ~CnvWblTo() {}
virtual int init( char *);
virtual int close() { return 1;}
virtual int class_exec() { return 1;}
virtual int class_close() { return 1;}
virtual int body_exec() { return 1;}
virtual int body_close() { return 1;}
virtual int attribute_exec() { return 1;}
virtual int typedef_exec() { return 1;}
virtual int typedef_close() { return 1;}
virtual int bit_exec() { return 1;}
virtual int graphplcnode() { return 1;}
virtual int graphplccon() { return 1;}
virtual int template_exec() { return 1;}
virtual Cnv_eWblToType type() { return Cnv_eWblToType_H;}
virtual int class_open() { return 0;}
virtual int index_open() { return 0;}
virtual bool confpass() { return false;}
virtual void set_confpass( bool conf) {};
};
#if defined __cplusplus
}
#endif
#endif
#ifndef cnv_wbltoh_h
#define cnv_wbltoh_h
/* cnv_wbltoh.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "cnv_readwbl.h"
#include "cnv_wblto.h"
using namespace std;
class CnvReadWbl;
class CnvWblToH : public CnvWblTo {
public:
CnvWblToH( CnvCtx *cnv_ctx) : ctx(cnv_ctx), struct_class_open(0),
struct_filler_cnt(0), attr_count(0) {}
virtual ~CnvWblToH() {}
CnvCtx *ctx;
int struct_class_open;
ofstream fp_struct;
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 init( char *first);
int close();
int class_exec();
int class_close();
int body_exec();
int body_close();
int attribute_exec();
int typedef_exec();
int typedef_close();
int bit_exec();
int graphplcnode() { return 1;}
int graphplccon() { return 1;}
int template_exec() { return 1;}
Cnv_eWblToType type() { return Cnv_eWblToType_H;}
int class_open() { return struct_class_open;}
int index_open() { return 0;}
int volname_to_id();
void cix_to_classid( unsigned int cix, pwr_tClassId *cid);
int cixstr_to_classid( char *cix_str, pwr_tClassId *cid);
static void get_filename( CnvReadWbl *rw, char *struct_file, int hpp);
int check_typename( char *type_volume, char *type_name);
};
#if defined __cplusplus
}
#endif
#endif
#ifndef cnv_wbltohtml_h
#define cnv_wbltohtml_h
/* cnv_wbltohtml.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "cnv_readwbl.h"
#include "cnv_wblto.h"
using namespace std;
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) {}
virtual ~CnvWblToHtml() {}
CnvCtx *ctx;
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 init( char *first);
int close();
int class_exec();
int class_close();
int body_exec();
int body_close();
int attribute_exec();
int graphplcnode();
int graphplccon();
int template_exec();
int typedef_exec();
int typedef_close();
int bit_exec();
Cnv_eWblToType type() { return Cnv_eWblToType_Html;}
int class_open() { return html_class_open;}
};
#if defined __cplusplus
}
#endif
#endif
This diff is collapsed.
#ifndef cnv_wbltops_h
#define cnv_wbltops_h
/* cnv_wbltops.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#include "pwr.h"
#include "cnv_readwbl.h"
#include "cnv_wblto.h"
#include "cnv_tops.h"
using namespace std;
class CnvReadWbl;
class CnvWblToPs : public CnvWblTo {
public:
CnvWblToPs( CnvCtx *cnv_ctx) :
ctx(cnv_ctx), conf_pass(false) {}
virtual ~CnvWblToPs();
CnvCtx *ctx;
CnvToPs tops;
bool conf_pass;
int init( char *first);
int close();
int class_exec();
int class_close();
int body_exec();
int attribute_exec();
int typedef_exec();
int bit_exec();
Cnv_eWblToType type() { return Cnv_eWblToType_Ps;}
int index_open() { return 0;}
void set_confpass( bool conf) {
tops.set_confpass( conf);
conf_pass = conf;
}
bool confpass() { return true;}
};
#endif
#ifndef cnv_wbltoxtthelp_h
#define cnv_wbltoxtthelp_h
/* cnv_wbltoxtthelp.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "cnv_readwbl.h"
#include "cnv_wblto.h"
using namespace std;
class CnvReadWbl;
class CnvWblToXtthelp : public CnvWblTo {
public:
CnvWblToXtthelp( CnvCtx *cnv_ctx) :
ctx(cnv_ctx), xtthelp_index_open(0), xtthelp_in_topic(0) {}
virtual ~CnvWblToXtthelp() {}
CnvCtx *ctx;
ofstream fp_xtthelp_index;
int xtthelp_index_open;
int xtthelp_in_topic;
ofstream fp_tmp;
int init( char *first);
int close();
int class_exec();
int class_close();
int body_exec();
int attribute_exec();
int bit_exec();
Cnv_eWblToType type() { return Cnv_eWblToType_Xtthelp;}
int index_open() { return xtthelp_index_open;}
};
#if defined __cplusplus
}
#endif
#endif
#ifndef cnv_xtthelpto_h
#define cnv_xtthelpto_h
/* cnv_xtthelpto.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "co_nav_help.h"
#include "cnv_readxtthelp.h"
using namespace std;
class CnvReadXtthelp;
typedef enum {
Cnv_eXtthelpToType_Html,
Cnv_eXtthelpToType_Xml,
Cnv_eXtthelpToType_Ps
} Cnv_eXtthelpToType;
class CnvXtthelpTo {
public:
// CnvXtthelpTo() {}
virtual Cnv_eXtthelpToType type() { return Cnv_eXtthelpToType_Html;}
virtual void *insert( navh_eItemType item_type, char *text1,
char *text2, char *text3, char *link,
char *link_bookmark, char *file_name,
navh_eHelpFile file_type, int help_index,
char *bookmark)
{ return 0;}
virtual bool confpass() { return false;}
virtual void set_confpass( bool conf) {};
};
#if defined __cplusplus
}
#endif
#endif
#ifndef cnv_xtthelptohtml_h
#define cnv_xtthelptohtml_h
/* cnv_xtthelptohtml.h -- Documentation
PROVIEW/R
Copyright (C) 1996 by Comator Process AB.
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#include "pwr.h"
#include "cnv_xtthelpto.h"
using namespace std;
class CnvCtx;
class CnvXtthelpToHtml : public CnvXtthelpTo {
public:
CnvXtthelpToHtml( CnvCtx *cnv_ctx) :
ctx(cnv_ctx) {}
virtual ~CnvXtthelpToHtml() {}
Cnv_eXtthelpToType type() { return Cnv_eXtthelpToType_Html;}
void *insert( navh_eItemType item_type, char *text1,
char *text2, char *text3, char *link,
char *link_bookmark, char *file_name,
navh_eHelpFile file_type, int help_index,
char *bookmark);
void subject_to_fname( char *fname, char *subject, int path);
CnvCtx *ctx;
ofstream fp;
};
#if defined __cplusplus
}
#endif
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -2,6 +2,6 @@ ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) $(export_obj) \
$(objects) -lpwr_co -lrt -lm
$(objects) -L/usr/X11R6/lib -lpwr_co -lImlib -lX11 -lrt -lm
endif
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