Commit c54ebce9 authored by lw's avatar lw

Update Proview for Berkely Db 4.1

parent a8c33a34
......@@ -676,6 +676,7 @@ int ClassRead::struct_cixstr_to_classid( char *cix_str, pwr_tClassId *cid)
{ "pwr_eCix_MountVolume", pwr_eCix_MountVolume},
{ "pwr_eCix_MountObject", pwr_eCix_MountObject},
{ "pwr_eCix_RtMenu", pwr_eCix_RtMenu},
{ "pwr_eCix_VolatileVolume", pwr_eCix_VolatileVolume},
{ "", 0}};
found = 0;
......
......@@ -206,7 +206,7 @@ addNode (
co_SetFormat(&np->fm, node->bo, node->ft);
if (np == gdbroot->my_node)
np->flags.m |= net_eState_up;
np->flags.m |= net_eState_up; /* ERROR. ERROR, ERROR !!! */
} gdb_ScopeUnlock;
......
#ifndef co_cdh_h
#define co_cdh_h
#ifdef __cplusplus
extern "C" {
#endif
/* co_cdh.h -- class definition handler
PROVIEW/R
......@@ -24,6 +20,10 @@ extern "C" {
#endif
#ifdef __cplusplus
extern "C" {
#endif
#define cdh_cMaxVidGroup 255
#define cdh_cMaxCix 4095
#define cdh_cMaxBix 7
......
#ifndef co_mrm_util_h
#define co_mrm_util_h
/* co_mrm_util.h -- Motif utitlities
PROVIEW/R
......@@ -5,6 +8,10 @@
<Description>. */
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
mrm_eUtility_Xtt,
mrm_eUtility_Admin,
......@@ -18,7 +25,12 @@ typedef enum {
void mrm_TextInit( Widget w, XtActionProc value_changed_cb, mrm_eUtility utility);
int mrm_TextInput( Widget w, XEvent *event, char *recall, int line_size,
int recall_size, int *current_recall_line);
int recall_size, int *current_recall_line);
int mrm_IsIconicState( Widget W);
void mrm_PositionPopup( Widget popup, Widget parent, int x, int y);
#ifdef __cplusplus
}
#endif
#endif
......@@ -13,7 +13,7 @@
extern "C" {
#include "co_cdh.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
//#include "pwr_baseclasses.h"
}
#include <Xm/Xm.h>
......
......@@ -10,12 +10,9 @@
#include <stdio.h>
#include <stdlib.h>
extern "C" {
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "pwr_baseclasses.h"
}
#include "co_dcli.h"
#include <Xm/Xm.h>
#include <Xm/XmP.h>
......
#ifndef co_time_h
#define co_time_h
#ifndef pwr_h
# include "pwr.h"
#endif
#ifdef __cplusplus
extern "C" {
#endif
......@@ -16,10 +20,6 @@ extern "C" {
time_AtoFormAscii replaces co_TimeToAsc and
time_FormAsciiToA replaces co_AscToTime from Comator Lib. */
#ifndef pwr_h
# include "pwr.h"
#endif
#if defined OS_LINUX
# include <time.h>
#endif
......
......@@ -31,13 +31,13 @@
#include "flow_browapi.h"
#include "flow_browwidget.h"
extern "C" {
//extern "C" {
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "flow_x.h"
#include "co_mrm_util.h"
}
//}
#include "co_lng.h"
#include "co_xhelpnav.h"
......@@ -57,12 +57,12 @@ static void xhelp_open_input_dialog( CoXHelp *xhelp, char *text, char *title,
i = 0;
XtSetArg(args[0], XmNlabelString,
cstr=XmStringCreateLtoR( text, "ISO8859-1") ); i++;
cstr=XmStringCreateLtoR( text, "ISO8859-1") ); i++;
XtSetValues( xhelp->india_label, args, i);
XmStringFree( cstr);
i = 0;
XtSetArg(args[0], XmNdialogTitle,
cstr=XmStringCreateLtoR( title, "ISO8859-1") ); i++;
cstr=XmStringCreateLtoR( title, "ISO8859-1") ); i++;
XtSetValues( xhelp->india_widget, args, i);
XmStringFree( cstr);
......@@ -301,25 +301,25 @@ CoXHelp::CoXHelp(
static XtTranslations compiled_translations = NULL;
static XtActionsRec actions[] =
{
{"xhelp_inputfocus", (XtActionProc) xhelp_action_inputfocus}
};
{
{"xhelp_inputfocus", (XtActionProc) xhelp_action_inputfocus}
};
static MrmRegisterArg reglist[] = {
{ "xhelp_ctx", 0 },
{"xhelp_activate_exit",(caddr_t)xhelp_activate_exit },
{"xhelp_activate_zoom_in",(caddr_t)xhelp_activate_zoom_in },
{"xhelp_activate_zoom_out",(caddr_t)xhelp_activate_zoom_out },
{"xhelp_activate_zoom_reset",(caddr_t)xhelp_activate_zoom_reset },
{"xhelp_activate_search",(caddr_t)xhelp_activate_search },
{"xhelp_activate_searchnext",(caddr_t)xhelp_activate_searchnext },
{"xhelp_activate_searchprevious",(caddr_t)xhelp_activate_searchprevious },
{"xhelp_activate_india_ok",(caddr_t)xhelp_activate_india_ok },
{"xhelp_activate_india_cancel",(caddr_t)xhelp_activate_india_cancel },
{"xhelp_create_india_label",(caddr_t)xhelp_create_india_label },
{"xhelp_create_india_text",(caddr_t)xhelp_create_india_text },
{"xhelp_activate_help",(caddr_t)xhelp_activate_help },
{"xhelp_create_xhelpnav_form",(caddr_t)xhelp_create_xhelpnav_form }
{ "xhelp_ctx", 0 },
{"xhelp_activate_exit",(caddr_t)xhelp_activate_exit },
{"xhelp_activate_zoom_in",(caddr_t)xhelp_activate_zoom_in },
{"xhelp_activate_zoom_out",(caddr_t)xhelp_activate_zoom_out },
{"xhelp_activate_zoom_reset",(caddr_t)xhelp_activate_zoom_reset },
{"xhelp_activate_search",(caddr_t)xhelp_activate_search },
{"xhelp_activate_searchnext",(caddr_t)xhelp_activate_searchnext },
{"xhelp_activate_searchprevious",(caddr_t)xhelp_activate_searchprevious },
{"xhelp_activate_india_ok",(caddr_t)xhelp_activate_india_ok },
{"xhelp_activate_india_cancel",(caddr_t)xhelp_activate_india_cancel },
{"xhelp_create_india_label",(caddr_t)xhelp_create_india_label },
{"xhelp_create_india_text",(caddr_t)xhelp_create_india_text },
{"xhelp_activate_help",(caddr_t)xhelp_activate_help },
{"xhelp_create_xhelpnav_form",(caddr_t)xhelp_create_xhelpnav_form }
};
static int reglist_num = (sizeof reglist / sizeof reglist[0]);
......@@ -343,14 +343,14 @@ CoXHelp::CoXHelp(
MrmRegisterNames(reglist, reglist_num);
parent_wid = XtCreatePopupShell( title,
topLevelShellWidgetClass, parent_wid, args, i);
topLevelShellWidgetClass, parent_wid, args, i);
sts = MrmFetchWidgetOverride( s_DRMh, "xhelp_window", parent_wid,
name, args, 1, &toplevel, &dclass);
name, args, 1, &toplevel, &dclass);
if (sts != MrmSUCCESS) printf("can't fetch %s\n", name);
sts = MrmFetchWidget(s_DRMh, "input_dialog", toplevel,
&india_widget, &dclass);
&india_widget, &dclass);
if (sts != MrmSUCCESS) printf("can't fetch input dialog\n");
MrmCloseHierarchy(s_DRMh);
......@@ -358,7 +358,7 @@ CoXHelp::CoXHelp(
if (compiled_translations == NULL)
XtAppAddActions( XtWidgetToApplicationContext(toplevel),
actions, XtNumber(actions));
actions, XtNumber(actions));
if (compiled_translations == NULL)
compiled_translations = XtParseTranslationTable(translations);
......@@ -372,7 +372,7 @@ CoXHelp::CoXHelp(
XtManageChild( toplevel);
xhelpnav = new CoXHelpNav( (void *)this, xhelpnav_form, title, utility, &brow_widget,
&sts);
&sts);
// XtPopup( parent_wid, XtGrabNone);
// displayed = 1;
......@@ -380,7 +380,7 @@ CoXHelp::CoXHelp(
// Connect the window manager close-button to exit
flow_AddCloseVMProtocolCb( parent_wid,
(XtCallbackProc)xhelp_activate_exit, this);
(XtCallbackProc)xhelp_activate_exit, this);
*xa_sts = 1;
}
......
......@@ -8,9 +8,9 @@
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
//#if defined __cplusplus
//extern "C" {
//#endif
#ifndef pwr_h
# include "pwr.h"
......@@ -62,9 +62,9 @@ class CoXHelp {
};
#if defined __cplusplus
}
#endif
//#if defined __cplusplus
//}
//#endif
#endif
......
......@@ -10,13 +10,13 @@
#include <stdio.h>
#include <stdlib.h>
extern "C" {
//extern "C" {
#include "co_cdh.h"
#include "co_dcli.h"
#include "co_time.h"
#include "co_msg.h"
#include "pwr_baseclasses.h"
}
//#include "pwr_baseclasses.h"
//}
#include <Xm/Xm.h>
#include <Xm/XmP.h>
......
......@@ -8,10 +8,6 @@
<Description>. */
#if defined __cplusplus
extern "C" {
#endif
#ifndef pwr_h
# include "pwr.h"
#endif
......@@ -20,10 +16,6 @@ extern "C" {
#include "co_nav_help.h"
#endif
#if defined __cplusplus
}
#endif
#ifndef flow_h
#include "flow.h"
#endif
......
......@@ -84,7 +84,7 @@ wb_msg_objs := $(obj_dir)/pwr_msg_wb.o $(obj_dir)/pwr_msg_ge.o $(obj_dir)/pwr_m
log_done =
csetos := -DOS_LINUX=1 -DOS=linux -DHW_X86=1 -DHW=x86
cinc := -I$(inc_dir) -I$(hw_source) -I$(os_source) -I$(co_source) -I/usr/X11R6/include -I$(jdk)/include -I$(jdk)/include/linux -I$(dbinc)
cinc := -I$(inc_dir) -I$(hw_source) -I$(os_source) -I$(co_source) -I$(dbinc) -I/usr/X11R6/include -I$(jdk)/include -I$(jdk)/include/linux
rm := rm
cp := cp
......
......@@ -3,10 +3,10 @@ link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_objs) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib \
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.1/lib \
-lpwr_wb -lpwr_rt -lpwr_ge -lpwr_flow -lpwr_glow -lpwr_co \
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -ldb_cxx-4.0 -lz
-lrpcsvc -lpthread -lm -ldb_cxx-4.1 -lz
endif
ifndef link_rule_mk
link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_objs) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.1/lib\
-lpwr_wb -lpwr_ge -lpwr_rt -lpwr_co -lpwr_flow -lpwr_glow\
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp -ldb_cxx-4.1\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -lrt
endif
This diff is collapsed.
......@@ -4,10 +4,10 @@ link_rule_mk := 1
link = $(ldxx) $(linkflags) $(domap) -o $(export_exe) \
$(export_obj) $(objects) $(wb_msg_objs) $(rt_msg_objs) \
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/lib\
$(pwr_obj)/rt_io_user.o -L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.1/lib\
-lpwr_wb -lpwr_ge -lpwr_rt -lpwr_co -lpwr_flow -lpwr_glow\
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp -ldb_cxx-4.0\
-lpwr_msg_dummy -lantlr -lImlib -lMrm -lXm -lXpm -lXt -lX11 -lXext -lXp -ldb_cxx-4.1\
-lXmu -lSM -lICE\
-lrpcsvc -lpthread -lm -lposix1b -lrt
-lrpcsvc -lpthread -lm -lrt
endif
......@@ -24,19 +24,19 @@ int main( int argc, char *argv[])
//dbs_sEnv *ep;
wb_erep *erep = new wb_erep();
if (argc <= 1) exit(0);
if (argc <= 2) exit(0);
// ep = dbs_Map(&sts, &env, argv[1]);
wb_vrepdbs *vdbs = new wb_vrepdbs(erep, argv[1]);
vdbs->load();
wb_dbs dbs(vdbs);
dbs.setFileName("/home/lw/lasse.dbs");
dbs.setFileName("lasse.dbs");
dbs.importVolume(*vdbs);
wb_orepdbs *op = (wb_orepdbs *)vdbs->object(&sts);
wb_db db(vdbs->vid());
db.create(vdbs->vid(), vdbs->cid(), vdbs->name(), "/home/lw/lasse.db");
db.create(vdbs->vid(), vdbs->cid(), vdbs->name(), argv[2]);
db.importVolume(*vdbs);
db.close();
......
This diff is collapsed.
......@@ -63,7 +63,7 @@ public:
void close();
void open(const char *fileName);
void openDb();
void openDb(bool useTxn);
void create(pwr_tVid vid, pwr_tCid cid, const char *volumeName, const char *fileName);
......@@ -71,9 +71,9 @@ public:
wb_db_txn *begin(wb_db_txn *txn);
bool commit(wb_db_txn *txn);
bool commit(pwr_tStatus *sts);
bool abort(wb_db_txn *txn);
bool abort(pwr_tStatus *sts);
//void adopt(wb_db_txn *txn, wb_db_ohead &o, wb_destination &dest);
......@@ -85,9 +85,11 @@ public:
bool importVolume(wb_export &e);
bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid,
pwr_tOid loid, const char *name, const char *normname, pwr_mClassDef flags, pwr_tTime ohTime,
pwr_tTime rbTime, pwr_tTime dbTime, size_t rbSize, size_t dbSize);
bool importHead(pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname, pwr_mClassDef flags,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize);
bool importRbody(pwr_tOid oid, size_t size, void *body);
......@@ -142,13 +144,15 @@ public:
Dbt m_key;
Dbt m_data;
Dbc *m_dbc;
wb_db_ohead();
wb_db_ohead(wb_db *db);
wb_db_ohead(wb_db *db, pwr_tOid oid);
wb_db_ohead(wb_db *db, wb_db_txn *txn, pwr_tOid oid);
wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid,
pwr_tOid poid, pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname,
wb_db_ohead(wb_db *db, pwr_tOid oid, pwr_tCid cid, pwr_tOid poid,
pwr_tOid boid, pwr_tOid aoid, pwr_tOid foid, pwr_tOid loid,
const char *name, const char *normname, pwr_mClassDef flags,
pwr_tTime ohTime, pwr_tTime rbTime, pwr_tTime dbTime,
size_t rbSize, size_t dbSize);
......@@ -157,8 +161,8 @@ public:
void setDb(wb_db *db) { m_db = db;}
void put(wb_db_txn *txn);
void del(wb_db_txn *txn);
int put(wb_db_txn *txn);
int del(wb_db_txn *txn);
pwr_tOid oid() { return m_o.oid;}
pwr_tVid vid() { return m_o.oid.vid;}
......@@ -181,14 +185,27 @@ public:
pwr_tTime dbTime() { return m_o.body[1].time;}
void name(wb_name &name);
void name(pwr_tOid &oid);
void oid(pwr_tOid oid) { m_o.oid = m_oid = oid;}
void cid(pwr_tCid cid) { m_o.cid = cid;}
void poid(pwr_tOid oid) { m_o.poid = oid;}
void foid(pwr_tOid oid) { m_o.foid = oid;}
void loid(pwr_tOid oid) { m_o.loid = oid;}
void boid(pwr_tOid oid) { m_o.boid = oid;}
void aoid(pwr_tOid oid) { m_o.aoid = oid;}
void flags(pwr_mClassDef flags) { m_o.flags = flags;}
void rbSize(size_t size) { m_o.body[0].size = size;}
void dbSize(size_t size) { m_o.body[1].size = size;}
void ohTime(pwr_tTime &time) { m_o.time = time;}
void rbTime(pwr_tTime &time) { m_o.body[0].time = time;}
void dbTime(pwr_tTime &time) { m_o.body[1].time = time;}
void clear();
void iter(void (*print)(pwr_tOid oid, db_sObject *op));
};
class wb_db_name
......@@ -199,6 +216,7 @@ public:
pwr_tOid poid;
pwr_tObjName normname;
} m_k;
struct
{
pwr_tOid oid;
......@@ -209,6 +227,7 @@ public:
wb_db *m_db;
Dbt m_key;
Dbt m_data;
Dbc *m_dbc;
wb_db_name(wb_db *db, wb_db_txn *txn);
wb_db_name(wb_db *db, wb_db_ohead &o);
......@@ -217,11 +236,12 @@ public:
wb_db_name(wb_db *db, pwr_tOid oid, pwr_tOid poid, const char *name);
wb_db_name(wb_db *db, wb_db_txn *txn, pwr_tOid poid, wb_name &name);
void get(wb_db_txn *txn);
void put(wb_db_txn *txn);
void del(wb_db_txn *txn);
int get(wb_db_txn *txn);
int put(wb_db_txn *txn);
int del(wb_db_txn *txn);
void name(wb_name &name);
void iter(void (*print)(pwr_tOid poid, pwr_tObjName name, pwr_tOid oid));
pwr_tOid oid() { return m_d.oid;}
};
......@@ -241,6 +261,7 @@ public:
Dbt m_data;
Dbc *m_dbc;
wb_db_class(wb_db *db);
wb_db_class(wb_db *db, pwr_tCid cid);
wb_db_class(wb_db *db, pwr_tCid cid, pwr_tOid oid);
wb_db_class(wb_db *db, wb_db_ohead &o);
......@@ -249,12 +270,13 @@ public:
bool succ(pwr_tOid oid);
bool pred(pwr_tOid oid);
void put(wb_db_txn *txn);
void del(wb_db_txn *txn);
int put(wb_db_txn *txn);
int del(wb_db_txn *txn);
pwr_tCid cid() { return m_k.cid;}
pwr_tOid oid() { return m_k.oid;}
void iter(void (*print)(pwr_tOid oid, pwr_tCid cid));
};
......@@ -269,13 +291,21 @@ public:
Dbt m_key;
Dbt m_data;
Dbc *m_dbc;
wb_db_dbody(wb_db *db);
wb_db_dbody(wb_db *db, pwr_tOid oid);
wb_db_dbody(wb_db *db, pwr_tOid oid, size_t size, void *p);
void get(wb_db_txn *txn, size_t offset, size_t size, void *p);
void put(wb_db_txn *txn);
void put(wb_db_txn *txn, size_t offset, size_t size, void *p);
void oid(pwr_tOid oid) {m_oid = oid;}
int get(wb_db_txn *txn, size_t offset, size_t size, void *p);
int put(wb_db_txn *txn);
int put(wb_db_txn *txn, size_t offset, size_t size, void *p);
int del(wb_db_txn *txn);
void iter(void (*print)(pwr_tOid oid));
};
class wb_db_rbody
......@@ -289,13 +319,21 @@ public:
Dbt m_key;
Dbt m_data;
Dbc *m_dbc;
wb_db_rbody(wb_db *db);
wb_db_rbody(wb_db *db, pwr_tOid oid);
wb_db_rbody(wb_db *db, pwr_tOid oid, size_t size, void *p);
void get(wb_db_txn *txn, size_t offset, size_t size, void *p);
void put(wb_db_txn *txn);
void put(wb_db_txn *txn, size_t offset, size_t size, void *p);
void oid(pwr_tOid oid) {m_oid = oid;}
int get(wb_db_txn *txn, size_t offset, size_t size, void *p);
int put(wb_db_txn *txn);
int put(wb_db_txn *txn, size_t offset, size_t size, void *p);
int del(wb_db_txn *txn);
void iter(void (*print)(pwr_tOid oid));
};
class wb_db_txn : public DbTxn
......
......@@ -2922,10 +2922,10 @@ int foe_print_overview (
{
/* Calculate coordinates for an overview */
gre_measure_object( *node_ptr, &ll_x, &ll_y, &width, &height);
ll_x_min = min( ll_x_min, ll_x);
ll_y_min = min( ll_y_min, ll_y);
ur_x_max = max( ur_x_max, ll_x + width);
ur_y_max = max( ur_y_max, ll_y + height);
ll_x_min = MIN( ll_x_min, ll_x);
ll_y_min = MIN( ll_y_min, ll_y);
ur_x_max = MAX( ur_x_max, ll_x + width);
ur_y_max = MAX( ur_y_max, ll_y + height);
doc_count++;
}
......
......@@ -728,7 +728,7 @@ int goen_create_contype(
if ((graphbody->dashes < 0.0) || (graphbody->dashes > 1.0))
return GOEN__BADCONGRAP;
max( 3 * graphbody->linewidth, 0.015);
MAX( 3 * graphbody->linewidth, 0.015);
/* Specify dashes */
if ((graphbody->dashes < 0.0) || (graphbody->dashes > 1.0))
......@@ -1128,7 +1128,7 @@ int goen_get_text_width(
XTextExtents( font_id, text_line, length, &direction, &ascent, &descent,
&charstruct);
line_width = charstruct.width;
max_width = max( max_width, line_width);
max_width = MAX( max_width, line_width);
t = s + 1;
rows++;
......
......@@ -173,10 +173,10 @@ int goen_create_nodetype_m0(
}
f_height = 3 * f_repeat +
(max(inputpoints,outputpoints)-1)*f_repeat;
(MAX(inputpoints,outputpoints)-1)*f_repeat;
classname_width = strlen( graphbody->graphname) * f_strlength;
f_width = max( f_strlength * 4 + max( classname_width, annot_width),
f_width = MAX( f_strlength * 4 + MAX( classname_width, annot_width),
f_defwidth + f_strlength * 2);
f_namepos = f_width/2.0 - classname_width/2;
......
......@@ -168,18 +168,18 @@ int goen_create_nodetype_m1(
}
f_height = f_header/2 + f_header/2 +
max((max(inputpoints,outputpoints)-1), 1) * f_repeat;
MAX((MAX(inputpoints,outputpoints)-1), 1) * f_repeat;
classname_width = strlen( graphbody->graphname) * f_strlength;
if ( annot_count <= 1)
{
f_width = max( f_strlength * 2 + max( classname_width, annot_width[0]),
f_width = MAX( f_strlength * 2 + MAX( classname_width, annot_width[0]),
f_defwidth + f_strlength * 2);
f_width_left = 0;
}
else
{
f_width = max( f_strlength * 4 + max( classname_width, annot_width[0])
f_width = MAX( f_strlength * 4 + MAX( classname_width, annot_width[0])
+ annot_width[1], f_defwidth + f_strlength * 2);
f_width_left = f_strlength * 2 + annot_width[1];
}
......
......@@ -161,10 +161,10 @@ int goen_create_nodetype_m14(
}
}
f_height = (max(inputpoints,outputpoints) + 2)*f_repeat
f_height = (MAX(inputpoints,outputpoints) + 2)*f_repeat
+ (floor( code_height / GOEN_F_GRID) + 1) * GOEN_F_GRID;
f_width = max( f_strlength * (2 + node_width), f_defwidth);
f_width = max( f_width, code_width + f_strlength *2);
f_width = MAX( f_strlength * (2 + node_width), f_defwidth);
f_width = MAX( f_width, code_width + f_strlength *2);
f_namepos = f_width/2.0 - strlen( graphbody->graphname)*
f_strlength/2.0;
......@@ -180,9 +180,9 @@ int goen_create_nodetype_m14(
f_height - f_repeat - f_yoffs, flow_eDrawType_Line, 2);
flow_AddLine( nc_pid, 0,
(max(inputpoints,outputpoints) + 1)*f_repeat - f_yoffs,
(MAX(inputpoints,outputpoints) + 1)*f_repeat - f_yoffs,
f_width,
(max(inputpoints,outputpoints) + 1)*f_repeat - f_yoffs,
(MAX(inputpoints,outputpoints) + 1)*f_repeat - f_yoffs,
flow_eDrawType_Line, 2);
if ( subwindowmark == 0 )
......
......@@ -180,12 +180,12 @@ int goen_create_nodetype_m15(
f_height = f_repeat * 2;
if ( !annot3_found)
f_width = max( f_strlength * 2 + max( annot_width[0], annot2_width),
f_width = MAX( f_strlength * 2 + MAX( annot_width[0], annot2_width),
f_defwidth)
+ f_classnamewidth;
else
{
f_width = max( f_strlength * 4 + max( annot_width[0], annot2_width)
f_width = MAX( f_strlength * 4 + MAX( annot_width[0], annot2_width)
+ annot3_width,
f_defwidth + f_strlength * 2) + f_classnamewidth;
f_width_left = f_strlength * 2 + annot3_width;
......
......@@ -165,9 +165,9 @@ int goen_create_nodetype_m16(
points_at_right = (outputpoints != 0);
f_height = 3 * f_repeat +
(max(inputpoints,outputpoints)-1)*f_repeat;
(MAX(inputpoints,outputpoints)-1)*f_repeat;
f_width = max( f_strlength * (2 + node_width), f_defwidth);
f_width = MAX( f_strlength * (2 + node_width), f_defwidth);
f_namepos = f_width/2.0 - strlen( graphbody->graphname)*
f_strlength/2.0;
......@@ -485,8 +485,8 @@ int goen_get_point_info_m16( grectx, graphbody, point_nr, mask, node_width,
points_at_left = (inputpoints != 0);
points_at_right = (outputpoints != 0);
f_height = (max(inputpoints,outputpoints) + 2)*f_repeat;
f_width = max( f_strlength * (2 + node_width), f_defwidth);
f_height = (MAX(inputpoints,outputpoints) + 2)*f_repeat;
f_width = MAX( f_strlength * (2 + node_width), f_defwidth);
points_top = 0;
points_bottom = 0;
......
......@@ -185,16 +185,16 @@ int goen_create_nodetype_m2(
}
f_height = (max(inputpoints,outputpoints) + 4)*f_repeat;
f_height = (MAX(inputpoints,outputpoints) + 4)*f_repeat;
classname_width = strlen( graphbody->graphname) * f_strlength;
f_width = max( f_strlength * 4 + max( classname_width, annot_width[0]),
f_width = MAX( f_strlength * 4 + MAX( classname_width, annot_width[0]),
f_defwidth + f_strlength * 2);
if ( annot_count >= 2)
f_width = max( f_width, f_strlength * 4 + annot_width[1]);
f_width = MAX( f_width, f_strlength * 4 + annot_width[1]);
if ( annot_count >= 3)
f_width = max( f_width, f_strlength * 4 + annot_width[2]);
f_width = MAX( f_width, f_strlength * 4 + annot_width[2]);
f_namepos = f_width/2.0 - classname_width/2;
......
......@@ -223,7 +223,7 @@ int goen_create_nodetype_m3(
free((char *) parvalue);
f_height = (floor( height / GOEN_F_GRID) + 1) * GOEN_F_GRID - f_delta*2;
f_width = max( width + f_strlength *2, f_defwidth) - f_delta*2;
f_width = MAX( width + f_strlength *2, f_defwidth) - f_delta*2;
if ( (height < GOEN_F_GRID-f_delta*2) && (f_height > GOEN_F_GRID))
f_height = GOEN_F_GRID - f_delta*2;
......
......@@ -158,11 +158,11 @@ int goen_create_nodetype_m5(
f_height = f_repeat;
f_ordertypewidth =
max( f_ordertypewidth, annot_width[1] + f_strlength);
MAX( f_ordertypewidth, annot_width[1] + f_strlength);
f_backcheckwidth =
max( f_backcheckwidth, annot_width[2] + 2 * f_strlength);
MAX( f_backcheckwidth, annot_width[2] + 2 * f_strlength);
f_width = f_ordertypewidth +
max( f_defwidth, annot_width[0] + 2 * f_strlength) +
MAX( f_defwidth, annot_width[0] + 2 * f_strlength) +
f_backcheckwidth;
flow_CreateNodeClass(ctx, name, flow_eNodeGroup_Common,
......
......@@ -156,11 +156,11 @@ int goen_create_nodetype_m7(
(strlen( graphbody->graphname) + 2);
f_height = f_repeat;
if ( annot_count <= 1)
f_width = max( f_strlength * 2 + annot_width[0], f_defwidth)
f_width = MAX( f_strlength * 2 + annot_width[0], f_defwidth)
+ f_classnamewidth;
else
{
f_width = max( f_strlength * 4 + annot_width[0] + annot_width[1],
f_width = MAX( f_strlength * 4 + annot_width[0] + annot_width[1],
f_defwidth + f_strlength * 2) + f_classnamewidth;
f_width_left = f_strlength * 2 + annot_width[1];
}
......
......@@ -848,108 +848,108 @@ int gre_node_annot_message(
/* Get graphbody for the class */
sts = ldh_GetClassBody( (node->hn.window_pointer)->hw.ldhsession,
node->ln.classid, "GraphPlcNode",
&bodyclass, (char **)&graphbody, &size);
node->ln.classid, "GraphPlcNode",
&bodyclass, (char **)&graphbody, &size);
if( EVEN(sts)) return sts;
/* Draw the parameters in devbody that has an annotation nr */
sts = ldh_GetObjectBodyDef((node->hn.window_pointer)->hw.ldhsession,
node->ln.classid, "DevBody", 1,
&bodydef, &rows);
node->ln.classid, "DevBody", 1,
&bodydef, &rows);
if ( EVEN(sts) ) return GRE__SUCCESS;
*message = '\0';
annotcount = 0;
for ( i = 0; i < rows; i++)
{
strcpy( annot_str, "");
annotnr = 0;
switch ( bodydef[i].ParClass )
{
case pwr_eClass_Input:
{
annotnr = bodydef[i].Par->Input.Graph.NiNaAnnot;
type = bodydef[i].Par->Input.Info.Type;
parname = bodydef[i].ParName;
break;
}
case pwr_eClass_Intern:
{
annotnr = bodydef[i].Par->Intern.Graph.NiNaAnnot;
type = bodydef[i].Par->Intern.Info.Type;
parname = bodydef[i].ParName;
break;
}
case pwr_eClass_Output:
{
annotnr = bodydef[i].Par->Output.Graph.NiNaAnnot;
type = bodydef[i].Par->Output.Info.Type;
parname = bodydef[i].ParName;
break;
}
default:
;
}
if( annotnr != 0 )
{
/* Get the parameter value */
sts = ldh_GetObjectPar( (node->hn.window_pointer)->hw.ldhsession,
node->ln.object_did,
"DevBody",
bodydef[i].ParName,
(char **)&parvalue, &size);
if ( EVEN(sts)) return sts;
{
strcpy( annot_str, "");
annotnr = 0;
switch ( bodydef[i].ParClass )
{
case pwr_eClass_Input:
{
annotnr = bodydef[i].Par->Input.Graph.NiNaAnnot;
type = bodydef[i].Par->Input.Info.Type;
parname = bodydef[i].ParName;
break;
}
case pwr_eClass_Intern:
{
annotnr = bodydef[i].Par->Intern.Graph.NiNaAnnot;
type = bodydef[i].Par->Intern.Info.Type;
parname = bodydef[i].ParName;
break;
}
case pwr_eClass_Output:
{
annotnr = bodydef[i].Par->Output.Graph.NiNaAnnot;
type = bodydef[i].Par->Output.Info.Type;
parname = bodydef[i].ParName;
break;
}
default:
;
}
if( annotnr != 0 )
{
/* Get the parameter value */
sts = ldh_GetObjectPar( (node->hn.window_pointer)->hw.ldhsession,
node->ln.object_did,
"DevBody",
bodydef[i].ParName,
(char **)&parvalue, &size);
if ( EVEN(sts)) return sts;
switch ( type )
{
case pwr_eType_Float32:
{
parfloat = (pwr_tFloat32 *)parvalue;
sprintf( annot_str,"%f", *parfloat);
break;
}
case pwr_eType_String:
case pwr_eType_Text:
{
strncpy( annot_str, parvalue,
min( sizeof(annot_str), annot_max_size));
annot_str[min( sizeof(annot_str), annot_max_size)-1] = 0;
break;
}
case pwr_eType_Char:
{
annot_str[0] = *parvalue;
annot_str[1] = '\0';
break;
}
case pwr_eType_ObjDId:
{
/* Get the object name from ldh */
parobjdid = (pwr_tObjid *)parvalue;
if ( cdh_ObjidIsNull(*parobjdid))
annot_str[0] = '\0';
else
{
sts = ldh_ObjidToName( (node->hn.window_pointer)->hw.ldhsession,
*parobjdid, ldh_eName_Object,
annot_str, sizeof( annot_str), &size);
if ( EVEN(sts)) annot_str[0] = '\0';
}
break;
}
}
if ( strcmp( annot_str, "") != 0)
{
if (annotcount != 0)
strncat( message, ", ", msg_size-strlen(message));
strncat( message, annot_str, msg_size-strlen(message));
annotcount++;
}
free((char *) parvalue);
if ( annotcount >= 3 ) break;
}
}
switch ( type )
{
case pwr_eType_Float32:
{
parfloat = (pwr_tFloat32 *)parvalue;
sprintf( annot_str,"%f", *parfloat);
break;
}
case pwr_eType_String:
case pwr_eType_Text:
{
strncpy( annot_str, parvalue,
MIN( sizeof(annot_str), annot_max_size));
annot_str[MIN( sizeof(annot_str), annot_max_size)-1] = 0;
break;
}
case pwr_eType_Char:
{
annot_str[0] = *parvalue;
annot_str[1] = '\0';
break;
}
case pwr_eType_ObjDId:
{
/* Get the object name from ldh */
parobjdid = (pwr_tObjid *)parvalue;
if ( cdh_ObjidIsNull(*parobjdid))
annot_str[0] = '\0';
else
{
sts = ldh_ObjidToName( (node->hn.window_pointer)->hw.ldhsession,
*parobjdid, ldh_eName_Object,
annot_str, sizeof( annot_str), &size);
if ( EVEN(sts)) annot_str[0] = '\0';
}
break;
}
}
if ( strcmp( annot_str, "") != 0)
{
if (annotcount != 0)
strncat( message, ", ", msg_size-strlen(message));
strncat( message, annot_str, msg_size-strlen(message));
annotcount++;
}
free((char *) parvalue);
if ( annotcount >= 3 ) break;
}
}
free((char *) bodydef);
message[msg_size-1] = 0;
......
......@@ -255,7 +255,8 @@ ldh_ChangeObjectName(ldh_tSession session, pwr_tOid oid, char *name)
if (!o) return o.sts();
if (!sp->isLocal(o)) return LDH__OTHERVOLUME;
return sp->renameObject(o, n);
sp->renameObject(o, n);
return sp->sts();
}
catch ( wb_error& e) {
return e.sts();
......@@ -365,24 +366,18 @@ ldh_CreateObject(ldh_tSession session, pwr_tOid *oid, char *name, pwr_tCid cid,
wb_cdef cdef = sp->cdef(cid);
if ( cdh_ObjidIsNull(doid)) {
wb_object d_o = wb_object();
wb_destination d = wb_destination( doid, dest);
wb_object o = sp->createObject(cdef, d, n);
if (!o) return sp->sts();
*oid = o.oid();
return o.sts();
if (cdh_ObjidIsNull(doid)) {
doid.vid = sp->vid();
dest = ldh_eDest_IntoLast;
}
else {
wb_object d_o = sp->object(doid);
wb_destination d = d_o.destination(dest);
wb_object o = sp->createObject(cdef, d, n);
if (!o) return sp->sts();
wb_object d_o = sp->object(doid);
wb_destination d = d_o.destination(dest);
wb_object o = sp->createObject(cdef, d, n);
if (!o) return sp->sts();
*oid = o.oid();
return o.sts();
}
*oid = o.oid();
return o.sts();
}
catch (wb_error& e) {
return e.sts();
......
......@@ -34,12 +34,12 @@
#define EVEN(a) (((int)(a) & 1) == 0)
#endif
#ifndef max
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#ifndef MAX
#define MAX(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#endif
#ifndef min
#define min(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
#ifndef MIN
#define MIN(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
#endif
#define SwapInts(Dragon,Eagle)\
......
This diff is collapsed.
......@@ -6,7 +6,7 @@
#include "wb_orep.h"
#include "wb_ldh.h"
#include "wb_destination.h"
#include "wb_location.h"
//#include "wb_location.h"
#include "wb_attribute.h"
class wb_bdef;
......
......@@ -6,7 +6,7 @@
#include "wb_orep.h"
#include "wb_vrep.h"
#include "wb_ldh.h"
#include "wb_position.h"
//#include "wb_position.h"
#include "wb_adrep.h"
class wb_vrep;
......
......@@ -42,9 +42,7 @@ wb_orepdb::operator delete(void *p)
//
pwr_tOid wb_orepdb::oid() const
{
pwr_tStatus sts;
{
return m_oid;
}
......
......@@ -68,36 +68,36 @@ wb_object wb_session::createObject(wb_cdef cdef, wb_destination d, wb_name name)
if (isReadonly())
throw wb_error_str("ReadOnlySession");
validateDestination( d, cdef.cid());
if ( evenSts()) return wb_object();
validateDestination(d, cdef.cid());
if (evenSts()) throw wb_error(sts());
wb_object parent;
switch ( d.code()) {
switch (d.code()) {
case ldh_eDest_IntoFirst:
case ldh_eDest_IntoLast:
parent = object( d.oid());
parent = object(d.oid());
break;
case ldh_eDest_After:
case ldh_eDest_Before:
parent = object( d.oid()).parent();
parent = object(d.oid()).parent();
break;
default:
throw wb_error(LDH__NODEST);
throw wb_error(LDH__NODEST);
}
m_sts = triggAnteCreate( parent, cdef.cid());
if ( evenSts()) return wb_object();
m_sts = triggAnteAdopt( parent, cdef.cid());
if ( evenSts()) return wb_object();
m_sts = triggAnteCreate(parent, cdef.cid());
if (evenSts()) throw wb_error(sts());
m_sts = triggAnteAdopt(parent, cdef.cid());
if (evenSts()) throw wb_error(sts());
orep = m_vrep->createObject(&m_sts, cdef, d, name);
wb_object o = wb_object(m_sts, orep);
ldh_sEvent *ep = m_srep->eventStart( o.oid(), ldh_eEvent_ObjectCreated);
m_srep->eventNewFamily( ep, o);
triggPostCreate( o);
triggPostAdopt( parent, o);
m_srep->eventSend( ep);
ldh_sEvent *ep = m_srep->eventStart(o.oid(), ldh_eEvent_ObjectCreated);
m_srep->eventNewFamily(ep, o);
triggPostCreate(o);
triggPostAdopt(parent, o);
m_srep->eventSend(ep);
return o;
}
......@@ -108,8 +108,8 @@ wb_object wb_session::copyObject(wb_object o, wb_destination d, wb_name name)
if (isReadonly())
throw wb_error_str("ReadOnlySession");
validateDestination( d, o.cid());
if ( evenSts()) return wb_object();
validateDestination(d, o.cid());
if (evenSts()) throw wb_error(sts());
wb_object parent;
switch ( d.code()) {
......@@ -122,22 +122,22 @@ wb_object wb_session::copyObject(wb_object o, wb_destination d, wb_name name)
parent = object( d.oid()).parent();
break;
default:
throw wb_error(LDH__NODEST);
throw wb_error(LDH__NODEST);
}
m_sts = triggAnteCreate( parent, o.cid());
if ( evenSts()) return wb_object();
m_sts = triggAnteAdopt( parent, o.cid());
if ( evenSts()) return wb_object();
m_sts = triggAnteCreate(parent, o.cid());
if (evenSts()) throw wb_error(sts());
m_sts = triggAnteAdopt(parent, o.cid());
if (evenSts()) throw wb_error(sts());
orep = m_vrep->copyObject(&m_sts, (wb_orep*)o, d, name);
wb_object onew = wb_object(m_sts, orep);
ldh_sEvent *ep = m_srep->eventStart( onew.oid(), ldh_eEvent_ObjectCreated);
m_srep->eventNewFamily( ep, onew);
triggPostCreate( onew);
triggPostAdopt( parent, onew);
m_srep->eventSend( ep);
ldh_sEvent *ep = m_srep->eventStart(onew.oid(), ldh_eEvent_ObjectCreated);
m_srep->eventNewFamily(ep, onew);
triggPostCreate(onew);
triggPostAdopt(parent, onew);
m_srep->eventSend(ep);
return onew;
}
......@@ -147,39 +147,39 @@ bool wb_session::moveObject(wb_object o, wb_destination d)
if (isReadonly())
throw wb_error_str("ReadOnlySession");
validateDestination( d, o.cid());
if ( evenSts()) return false;
validateDestination(d, o.cid());
if (evenSts()) return false;
wb_object parent;
switch ( d.code()) {
switch (d.code()) {
case ldh_eDest_IntoFirst:
case ldh_eDest_IntoLast:
parent = object( d.oid());
parent = object(d.oid());
break;
case ldh_eDest_After:
case ldh_eDest_Before:
parent = object( d.oid()).parent();
parent = object(d.oid()).parent();
break;
default:
throw wb_error(LDH__NODEST);
}
wb_object old_parent = o.parent();
m_sts = triggAnteMove( o, parent);
if ( evenSts()) return false;
m_sts = triggAnteUnadopt( old_parent, o);
if ( evenSts()) return false;
m_sts = triggAnteAdopt( parent, o.cid());
if ( evenSts()) return false;
ldh_sEvent *ep = m_srep->eventStart( o.oid(), ldh_eEvent_ObjectMoved);
m_srep->eventOldFamily( ep, o);
m_sts = triggAnteMove(o, parent);
if (evenSts()) return false;
m_sts = triggAnteUnadopt(old_parent, o);
if (evenSts()) return false;
m_sts = triggAnteAdopt(parent, o.cid());
if (evenSts()) return false;
ldh_sEvent *ep = m_srep->eventStart(o.oid(), ldh_eEvent_ObjectMoved);
m_srep->eventOldFamily(ep, o);
bool rsts = m_vrep->moveObject(&m_sts, (wb_orep*)o, d);
triggPostMove( o);
triggPostUnadopt( old_parent, o);
triggPostAdopt( parent, o);
triggPostMove(o);
triggPostUnadopt(old_parent, o);
triggPostAdopt(parent, o);
m_srep->eventNewFamily( ep, o);
m_srep->eventSend( ep);
......@@ -190,14 +190,16 @@ bool wb_session::moveObject(wb_object o, wb_destination d)
bool wb_session::renameObject(wb_object o, wb_name name)
{
m_sts = LDH__SUCCESS;
if (isReadonly())
throw wb_error_str("ReadOnlySession");
bool sts = m_vrep->renameObject(&m_sts, (wb_orep*)o, name);
ldh_sEvent *ep = m_srep->eventStart( o.oid(), ldh_eEvent_ObjectRenamed);
m_srep->eventSend( ep);
return sts;
bool ok = m_vrep->renameObject(&m_sts, (wb_orep*)o, name);
if (!ok) return ok;
ldh_sEvent *ep = m_srep->eventStart(o.oid(), ldh_eEvent_ObjectRenamed);
m_srep->eventSend(ep);
return ok;
}
bool wb_session::deleteObject(wb_object o)
......@@ -205,18 +207,18 @@ bool wb_session::deleteObject(wb_object o)
if (isReadonly())
throw wb_error_str("ReadOnlySession");
if (!isLocal( o)) {
if (!isLocal(o)) {
m_sts = LDH__OTHERVOLUME;
return false;
}
if ( o.first()) {
if (o.first()) {
m_sts = LDH__HAS_CHILD;
return false;
}
pwr_tStatus sts;
wb_object parent = o.parent();
sts = triggAnteUnadopt( parent, o);
sts = triggAnteUnadopt(parent, o);
ldh_sEvent *ep = m_srep->eventStart( o.oid(), ldh_eEvent_ObjectDeleted);
m_srep->eventOldFamily( ep, o);
......
......@@ -7530,7 +7530,7 @@ int utl_list (
if ( EVEN (sts)) return sts;
listobject_ptr = listobject_list;
for ( i = 0; i < min( listobject_count, UTL_LIST_MAX); i++)
for ( i = 0; i < MIN( listobject_count, UTL_LIST_MAX); i++)
{
sublist_ptr = utlctx->list[0];
while( sublist_ptr)
......@@ -7594,7 +7594,7 @@ int utl_list (
if ( listbody_ptr->NoPrintIfNoList)
{
print_ok = 0;
for ( j = 0; j < min( listobject_count, UTL_LIST_MAX); j++)
for ( j = 0; j < MIN( listobject_count, UTL_LIST_MAX); j++)
{
if ( list_ptr->sublistcount[j] != 0)
{
......@@ -7716,7 +7716,7 @@ int utl_list (
}
listobject_ptr = listobject_list;
for ( j = 0; j < min( listobject_count, UTL_LIST_MAX); j++)
for ( j = 0; j < MIN( listobject_count, UTL_LIST_MAX); j++)
{
sts = utl_list_sublist_print( utlctx, listobject_ptr->objdid,
list_ptr->sublist[j], list_ptr->sublistcount[j], &first);
......@@ -7943,7 +7943,7 @@ static int utl_list_sublist (
while ( sublist_ptr)
{
listobject_ptr = listobject_list;
for ( j = 0; j < min( listobject_count, UTL_LIST_MAX); j++)
for ( j = 0; j < MIN( listobject_count, UTL_LIST_MAX); j++)
{
sts = utl_list_sublist( utlctx, listobject_ptr->objdid,
&(sublist_ptr->sublist[j]),
......@@ -8079,7 +8079,7 @@ static int utl_list_sublist_print (
while( list_ptr)
{
printlist_ok = 0;
for ( j = 0; j < min( listobject_count, UTL_LIST_MAX); j++)
for ( j = 0; j < MIN( listobject_count, UTL_LIST_MAX); j++)
{
if ( list_ptr->sublistcount[j] != 0)
{
......@@ -8117,7 +8117,7 @@ static int utl_list_sublist_print (
if ( listbody_ptr->NoPrintIfNoList)
{
for ( j = 0; j < min( listobject_count, UTL_LIST_MAX); j++)
for ( j = 0; j < MIN( listobject_count, UTL_LIST_MAX); j++)
{
print_ok = 0;
if ( list_ptr->sublistcount[j] != 0)
......@@ -8239,7 +8239,7 @@ static int utl_list_sublist_print (
page);
}
listobject_ptr = listobject_list;
for ( k = 0; k < min( listobject_count, UTL_LIST_MAX); k++)
for ( k = 0; k < MIN( listobject_count, UTL_LIST_MAX); k++)
{
utl_list_sublist_print( utlctx, listobject_ptr->objdid,
list_ptr->sublist[k],
......@@ -9184,7 +9184,7 @@ static int utl_config_replace(
else
strcpy( outstr, (char *)par_str[0]);
for ( i = 1; i < min( 5, nr); i++)
for ( i = 1; i < MIN( 5, nr); i++)
{
strcat( outstr, indexstr);
strcat( outstr, (char *)par_str[i]);
......@@ -10222,7 +10222,7 @@ int utl_move_window (
for ( i = 0; i < PWR_OBJTYPES_MAX; i++)
{
source_plcbuffer->defnamecount[i] =
max( source_plcbuffer->defnamecount[i],
MAX( source_plcbuffer->defnamecount[i],
dest_plcbuffer->defnamecount[i]);
dest_plcbuffer->defnamecount[i] =
source_plcbuffer->defnamecount[i];
......
......@@ -35,8 +35,8 @@ wb_srep *wb_vrep::nextSrep( pwr_tStatus *sts, wb_srep* srep)
for ( srep_iterator it = m_srep.begin(); it != m_srep.end(); it++) {
if ( *it == srep) {
if ( ++it == m_srep.end()) {
*sts = LDH__NOSUCHSESS;
return 0;
*sts = LDH__NOSUCHSESS;
return 0;
}
*sts = LDH__SUCCESS;
return *it;
......@@ -45,7 +45,3 @@ wb_srep *wb_vrep::nextSrep( pwr_tStatus *sts, wb_srep* srep)
*sts = LDH__NOSUCHSESS;
return 0;
}
This diff is collapsed.
......@@ -8,6 +8,9 @@
class wb_vrepdb : public wb_vrep
{
private:
bool deleteFamilyMember(pwr_tOid oid, wb_db_txn *txn);
protected:
wb_erep *m_erep;
wb_merep *m_merep;
......@@ -19,7 +22,6 @@ protected:
public:
wb_db *m_db;
wb_db_txn *m_txn;
wb_db_ohead m_ohead;
wb_vrepdb(wb_erep *erep, const char *fileName);
......@@ -72,8 +74,9 @@ public:
virtual bool renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name &name);
virtual bool commit(pwr_tStatus *sts);
virtual bool abort(pwr_tStatus *sts);
virtual bool commit(pwr_tStatus *sts) {return m_db->commit(sts);}
virtual bool abort(pwr_tStatus *sts) {return m_db->abort(sts);}
virtual bool writeAttribute(pwr_tStatus *sts, wb_orep *o, pwr_eBix bix, size_t offset, size_t size, void *p);
......
......@@ -6,12 +6,24 @@ extern "C" {
#endif
#ifndef ODD
#define ODD(a) (((int)(a) & 1) != 0)
#endif
#ifndef EVEN
#define EVEN(a) (((int)(a) & 1) == 0)
#define max(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#define min(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
#endif
#ifndef MAX
#define MAX(Dragon,Eagle) ((Dragon) > (Eagle) ? (Dragon) : (Eagle))
#endif
#ifndef MIN
#define MIN(Dragon,Eagle) ((Dragon) < (Eagle) ? (Dragon) : (Eagle))
#endif
#ifndef __ALPHA
#define abs(Dragon) ((Dragon) >= 0 ? (Dragon) : (-(Dragon)))
#define ABS(Dragon) ((Dragon) >= 0 ? (Dragon) : (-(Dragon)))
#endif
#define DRAW_TYPE_SIZE 9
......
......@@ -44,12 +44,12 @@ void FlowAnnot::print( void *pos, void *node)
if ( size <= 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
switch ( annot_type) {
case flow_eAnnotType_OneLine:
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = ((FlowPoint *)pos)->print_z_x + max( p.print_z_x,
x = ((FlowPoint *)pos)->print_z_x + MAX( p.print_z_x,
((FlowNode *)node)->rel_annot_x[number] * ctx->print_zoom_factor);
}
else
......@@ -146,12 +146,12 @@ void FlowAnnot::draw( void *pos, int highlight, int hot, void *node)
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * (text_size +4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
switch ( annot_type) {
case flow_eAnnotType_OneLine:
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + max( p.z_x,
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + MAX( p.z_x,
((FlowNode *)node)->rel_annot_x[number] * ctx->zoom_factor));
}
else
......@@ -211,12 +211,12 @@ void FlowAnnot::erase( void *pos, int hot, void *node)
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * (text_size +4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
switch ( annot_type) {
case flow_eAnnotType_OneLine:
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + max( p.z_x,
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + MAX( p.z_x,
((FlowNode *)node)->rel_annot_x[number] * ctx->zoom_factor));
}
else
......@@ -268,7 +268,7 @@ void FlowAnnot::nav_draw( void *pos, int highlight, void *node)
(text_size +4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
switch ( annot_type) {
case flow_eAnnotType_OneLine:
flow_draw_nav_text( ctx,
......@@ -320,7 +320,7 @@ void FlowAnnot::nav_erase( void *pos, void *node)
(text_size +4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
switch ( annot_type) {
case flow_eAnnotType_OneLine:
flow_draw_nav_text_erase( ctx,
......@@ -420,7 +420,7 @@ void FlowAnnot::measure_annot( char *text, double *width, double *height)
*height = 0;
return;
}
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
switch ( annot_type) {
case flow_eAnnotType_OneLine:
draw_get_text_extent( ctx, text, strlen(text), draw_type, idx,
......@@ -442,7 +442,7 @@ void FlowAnnot::measure_annot( char *text, double *width, double *height)
{
draw_get_text_extent( ctx, line, len, draw_type, idx,
&l_width, &l_height);
z_width = max( z_width, l_width);
z_width = MAX( z_width, l_width);
}
len = 0;
line = s+1;
......@@ -455,7 +455,7 @@ void FlowAnnot::measure_annot( char *text, double *width, double *height)
{
draw_get_text_extent( ctx, line, len, draw_type, idx,
&l_width, &l_height);
z_width = max( z_width, l_width);
z_width = MAX( z_width, l_width);
line_cnt++;
}
z_height = line_cnt * l_height;
......@@ -478,7 +478,7 @@ void FlowAnnot::configure_annotations( void *pos, void *node)
((FlowNode *)node)->relative_annot_x;
measure_annot( ((FlowNode *) node)->annotv[number], &width, &height);
((FlowNode *)node)->relative_annot_x =
max( p.x, ((FlowNode *)node)->rel_annot_x[number]) +
MAX( p.x, ((FlowNode *)node)->rel_annot_x[number]) +
width + ((BrowCtx *)ctx)->annotation_space;
}
......@@ -491,8 +491,8 @@ void FlowAnnot::open_annotation_input( void *pos, void *node)
int x, width_pix, height_pix;
double width, height;
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * (text_size +4) - 4);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
switch ( annot_type) {
case flow_eAnnotType_OneLine:
measure_annot( ((FlowNode *) node)->annotv[number], &width, &height);
......@@ -500,7 +500,7 @@ void FlowAnnot::open_annotation_input( void *pos, void *node)
height_pix = int( height * ctx->zoom_factor);
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + max( p.z_x,
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + MAX( p.z_x,
((FlowNode *)node)->rel_annot_x[number] * ctx->zoom_factor));
}
else
......@@ -580,7 +580,7 @@ void flow_measure_annot_text( FlowCtx *ctx, char *text, flow_eDrawType draw_type
{
draw_get_text_extent( ctx, line, len, draw_type, text_size,
&l_width, &l_height);
z_width = max( z_width, l_width);
z_width = MAX( z_width, l_width);
}
len = 0;
line = s+1;
......@@ -593,11 +593,11 @@ void flow_measure_annot_text( FlowCtx *ctx, char *text, flow_eDrawType draw_type
{
draw_get_text_extent( ctx, line, len, draw_type, text_size,
&l_width, &l_height);
z_width = max( z_width, l_width);
z_width = MAX( z_width, l_width);
line_cnt++;
}
z_height = line_cnt * l_height;
*rows = max( line_cnt, 1);
*rows = MAX( line_cnt, 1);
break;
}
}
......
......@@ -54,11 +54,11 @@ void FlowAnnotPixmap::print( void *pos, void *node)
if ( size <= 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( idx, DRAW_TYPE_SIZE-1);
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = ((FlowPoint *)pos)->print_z_x + max( p.print_z_x,
x = ((FlowPoint *)pos)->print_z_x + MAX( p.print_z_x,
((FlowNode *)node)->rel_annotpixmap_x[number] * ctx->print_zoom_factor);
}
else
......@@ -123,10 +123,10 @@ void FlowAnnotPixmap::draw( void *pos, int highlight, int hot, void *node)
(pixmap_size + 4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + max( p.z_x,
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + MAX( p.z_x,
((FlowNode *)node)->rel_annotpixmap_x[number] * ctx->zoom_factor));
}
else
......@@ -148,10 +148,10 @@ void FlowAnnotPixmap::draw_inverse( void *pos, int hot, void *node)
(pixmap_size + 4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + max( p.z_x,
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + MAX( p.z_x,
((FlowNode *)node)->rel_annotpixmap_x[number] * ctx->zoom_factor));
}
else
......@@ -173,10 +173,10 @@ void FlowAnnotPixmap::erase( void *pos, int hot, void *node)
(pixmap_size + 4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( relative_pos && ((FlowNode *)node)->relative_annot_pos)
{
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + max( p.z_x,
x = int( ((FlowPoint *)pos)->z_x - ctx->offset_x + MAX( p.z_x,
((FlowNode *)node)->rel_annotpixmap_x[number] * ctx->zoom_factor));
}
else
......@@ -196,7 +196,7 @@ void FlowAnnotPixmap::nav_draw( void *pos, int highlight, void *node)
(pixmap_size + 4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_pixmap( ctx,
p.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -213,7 +213,7 @@ void FlowAnnotPixmap::nav_erase( void *pos, void *node)
(pixmap_size + 4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_pixmap_erase( ctx,
p.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -303,7 +303,7 @@ void FlowAnnotPixmap::configure_annotations( void *pos, void *node)
width = 1.0 * ((FlowNode *)node)->annotpixmapv[number]->
pixmap_data[pixmap_size].width / ctx->base_zoom_factor;
((FlowNode *)node)->relative_annot_x =
max( p.x, ((FlowNode *)node)->rel_annotpixmap_x[number]) +
MAX( p.x, ((FlowNode *)node)->rel_annotpixmap_x[number]) +
width + ((BrowCtx *)ctx)->annotation_space;
}
......
......@@ -33,8 +33,8 @@ void FlowArc::print( void *pos, void *node)
{
int idx = int( ctx->print_zoom_factor / ctx->base_zoom_factor *
line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->arc( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
ur.print_z_x - ll.print_z_x, ur.print_z_y - ll.print_z_y, angel1, angel2,
......@@ -87,8 +87,8 @@ void FlowArc::draw( void *pos, int highlight, int hot, void *node)
{
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_arc( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
ll.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y,
ur.z_x - ll.z_x, ur.z_y - ll.z_y, angel1, angel2,
......@@ -99,8 +99,8 @@ void FlowArc::erase( void *pos, int hot, void *node)
{
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_arc_erase( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
ll.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y,
ur.z_x - ll.z_x, ur.z_y - ll.z_y, angel1, angel2, idx);
......@@ -109,8 +109,8 @@ void FlowArc::erase( void *pos, int hot, void *node)
void FlowArc::nav_draw( void *pos, int highlight, void *node)
{
int idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_arc( ctx,
ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
ll.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -121,8 +121,8 @@ void FlowArc::nav_draw( void *pos, int highlight, void *node)
void FlowArc::nav_erase( void *pos, void *node)
{
int idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_arc_erase( ctx,
ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
ll.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......
......@@ -94,8 +94,8 @@ void FlowArrow::print( void *pos, void *node)
{
int idx = int( ctx->print_zoom_factor / ctx->base_zoom_factor *
line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->arrow(
p_dest.print_z_x + ((FlowPoint *)pos)->print_z_x,
p_dest.print_z_y + ((FlowPoint *)pos)->print_z_y,
......@@ -155,8 +155,8 @@ void FlowArrow::draw( void *pos, int highlight, int hot, void *node)
{
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_arrow( ctx,
p_dest.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p_dest.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y,
......@@ -171,8 +171,8 @@ void FlowArrow::erase( void *pos, int hot, void *node)
{
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_arrow_erase( ctx,
p_dest.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p_dest.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y,
......@@ -186,8 +186,8 @@ void FlowArrow::erase( void *pos, int hot, void *node)
void FlowArrow::nav_draw( void *pos, int highlight, void *node)
{
int idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_arrow( ctx,
p_dest.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p_dest.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -201,8 +201,8 @@ void FlowArrow::nav_draw( void *pos, int highlight, void *node)
void FlowArrow::nav_erase( void *pos, void *node)
{
int idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_arrow_erase( ctx,
p_dest.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p_dest.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......
......@@ -62,7 +62,7 @@ void BrowCtx::configure( double y_redraw)
flow_draw_get_window_size( this, &window_width, &window_height);
a.configure();
get_borders();
frame_x_right = max( x_right,
frame_x_right = MAX( x_right,
1.0 * (window_width + offset_x) / zoom_factor);
a.zoom();
redraw( y_redraw);
......@@ -129,8 +129,8 @@ void BrowCtx::zoom( double factor)
if ( offset_y != 0)
offset_y = int( (offset_y - window_height / 2.0 * ( 1.0/factor - 1))
* factor);
offset_x = max( offset_x, 0);
offset_y = max( offset_y, 0);
offset_x = MAX( offset_x, 0);
offset_y = MAX( offset_y, 0);
if ( (x_right - x_left) * zoom_factor <= window_width)
offset_x = 0;
if ( (y_high - y_low) * zoom_factor <= window_height)
......
......@@ -1511,20 +1511,20 @@ int FlowCon::con_route( double src_x, double src_y, flow_eDirection src_dir,
double doc_ll_x, doc_ur_x, doc_ll_y, doc_ur_y;
FlowNode *doc;
ll_x = min( source_node->x_left, dest_node->x_left) - 10 * ctx->draw_delta;
ur_x = max( source_node->x_right, dest_node->x_right) + 10 * ctx->draw_delta;
ll_y = min( source_node->y_low, dest_node->y_low) - 10 * ctx->draw_delta;
ur_y = max( source_node->y_high, dest_node->y_high) + 10 * ctx->draw_delta;
ll_x = MIN( source_node->x_left, dest_node->x_left) - 10 * ctx->draw_delta;
ur_x = MAX( source_node->x_right, dest_node->x_right) + 10 * ctx->draw_delta;
ll_y = MIN( source_node->y_low, dest_node->y_low) - 10 * ctx->draw_delta;
ur_y = MAX( source_node->y_high, dest_node->y_high) + 10 * ctx->draw_delta;
/* Find the document node */
doc = (FlowNode *) ctx->get_document( src_x, src_y);
if ( doc )
{
doc->measure( &doc_ll_x, &doc_ll_y, &doc_ur_x, &doc_ur_y);
ll_x = max( ll_x, doc_ll_x);
ur_x = min( ur_x, doc_ur_x);
ll_y = max( ll_y, doc_ll_y);
ur_y = min( ur_y, doc_ur_y);
ll_x = MAX( ll_x, doc_ll_x);
ur_x = MIN( ur_x, doc_ur_x);
ll_y = MAX( ll_y, doc_ll_y);
ur_y = MIN( ur_y, doc_ur_y);
if ( dest_x < doc_ll_x || dest_x > doc_ur_x ||
dest_y < doc_ll_y || dest_y > doc_ur_y ||
......@@ -1582,8 +1582,8 @@ int FlowCon::con_route_area( double wind_ll_x, double wind_ll_y,
for ( node_p = nodelist; node_p; node_p = node_p->link)
{
if ( node_p->in_horiz_line( dest_y,
min( dest_x, src_x) + ctx->draw_delta + CON_EPSILON,
max( dest_x, src_x) - ctx->draw_delta - CON_EPSILON))
MIN( dest_x, src_x) + ctx->draw_delta + CON_EPSILON,
MAX( dest_x, src_x) - ctx->draw_delta - CON_EPSILON))
{
found = 1;
break;
......@@ -1617,8 +1617,8 @@ int FlowCon::con_route_area( double wind_ll_x, double wind_ll_y,
for ( node_p = nodelist; node_p; node_p = node_p->link)
{
if ( node_p->in_vert_line( dest_x,
min( dest_y, src_y) + ctx->draw_delta + CON_EPSILON,
max( dest_y, src_y) - ctx->draw_delta - CON_EPSILON))
MIN( dest_y, src_y) + ctx->draw_delta + CON_EPSILON,
MAX( dest_y, src_y) - ctx->draw_delta - CON_EPSILON))
{
found = 1;
break;
......@@ -2462,8 +2462,8 @@ int FlowCon::find_horiz_line_up( double check_y, double check_l_x,
}
else
{
check_wind_l_x = max( check_l_x, node_p->obst_x_left);
check_wind_u_x = min( check_u_x, node_p->obst_x_right);
check_wind_l_x = MAX( check_l_x, node_p->obst_x_left);
check_wind_u_x = MIN( check_u_x, node_p->obst_x_right);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......@@ -2546,8 +2546,8 @@ int FlowCon::find_horiz_line_up( double check_y, double check_l_x,
}
else
{
check_wind_l_x = max( check_l_x, l_x);
check_wind_u_x = min( check_u_x, u_x);
check_wind_l_x = MAX( check_l_x, l_x);
check_wind_u_x = MIN( check_u_x, u_x);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......@@ -2623,8 +2623,8 @@ int FlowCon::find_horiz_line_down( double check_y, double check_l_x,
}
else
{
check_wind_l_x = max( check_l_x, node_p->obst_x_left);
check_wind_u_x = min( check_u_x, node_p->obst_x_right);
check_wind_l_x = MAX( check_l_x, node_p->obst_x_left);
check_wind_u_x = MIN( check_u_x, node_p->obst_x_right);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......@@ -2707,8 +2707,8 @@ int FlowCon::find_horiz_line_down( double check_y, double check_l_x,
}
else
{
check_wind_l_x = max( check_l_x, l_x);
check_wind_u_x = min( check_u_x, u_x);
check_wind_l_x = MAX( check_l_x, l_x);
check_wind_u_x = MIN( check_u_x, u_x);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......@@ -2784,8 +2784,8 @@ int FlowCon::find_vert_line_right( double check_x, double check_l_y,
}
else
{
check_wind_l_y = max( check_l_y, node_p->obst_y_low);
check_wind_u_y = min( check_u_y, node_p->obst_y_high);
check_wind_l_y = MAX( check_l_y, node_p->obst_y_low);
check_wind_u_y = MIN( check_u_y, node_p->obst_y_high);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......@@ -2869,8 +2869,8 @@ int FlowCon::find_vert_line_right( double check_x, double check_l_y,
}
else
{
check_wind_l_y = max( check_l_y, l_y);
check_wind_u_y = min( check_u_y, u_y);
check_wind_l_y = MAX( check_l_y, l_y);
check_wind_u_y = MIN( check_u_y, u_y);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......@@ -2947,8 +2947,8 @@ int FlowCon::find_vert_line_left( double check_x, double check_l_y,
}
else
{
check_wind_l_y = max( check_l_y, node_p->obst_y_low);
check_wind_u_y = min( check_u_y, node_p->obst_y_high);
check_wind_l_y = MAX( check_l_y, node_p->obst_y_low);
check_wind_u_y = MIN( check_u_y, node_p->obst_y_high);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......@@ -3031,8 +3031,8 @@ int FlowCon::find_vert_line_left( double check_x, double check_l_y,
}
else
{
check_wind_l_y = max( check_l_y, l_y);
check_wind_u_y = min( check_u_y, u_y);
check_wind_l_y = MAX( check_l_y, l_y);
check_wind_u_y = MIN( check_u_y, u_y);
}
found = 0;
for ( node_p2 = nodelist; node_p2; node_p2 = node_p2->link)
......
......@@ -537,13 +537,13 @@ void FlowCtx::nav_zoom()
get_borders();
// cout << "Borders : <" << x_left << " > " << x_right << " ^ " <<
// y_high << " Y " << y_low << endl;
x_nav_left = min( x_left, offset_x / zoom_factor);
x_nav_right = max( x_right, (offset_x + window_width) / zoom_factor);
y_nav_low = min( y_low, offset_y / zoom_factor);
y_nav_high = max( y_high, (offset_y + window_height) / zoom_factor);
x_nav_left = MIN( x_left, offset_x / zoom_factor);
x_nav_right = MAX( x_right, (offset_x + window_width) / zoom_factor);
y_nav_low = MIN( y_low, offset_y / zoom_factor);
y_nav_high = MAX( y_high, (offset_y + window_height) / zoom_factor);
if ( x_nav_right - x_nav_left == 0 || y_nav_high - y_nav_low == 0)
return;
nav_zoom_factor = min( nav_window_width / (x_nav_right - x_nav_left),
nav_zoom_factor = MIN( nav_window_width / (x_nav_right - x_nav_left),
nav_window_height / (y_nav_high - y_nav_low));
nav_offset_x = int( x_nav_left * nav_zoom_factor);
nav_offset_y = int( y_nav_low * nav_zoom_factor);
......@@ -883,10 +883,10 @@ int FlowCtx::event_handler( flow_eEvent event, int x, int y, int w, int h)
select_rect_ur_x - select_rect_ll_x,
select_rect_ur_y - select_rect_ll_y, 0);
select_rect_ll_x = min( x, select_rect_start_x);
select_rect_ll_y = min( y, select_rect_start_y);
select_rect_ur_x = max( x, select_rect_start_x);
select_rect_ur_y = max( y, select_rect_start_y);
select_rect_ll_x = MIN( x, select_rect_start_x);
select_rect_ll_y = MIN( y, select_rect_start_y);
select_rect_ur_x = MAX( x, select_rect_start_x);
select_rect_ur_y = MAX( y, select_rect_start_y);
draw( select_rect_ll_x, select_rect_ll_y,
select_rect_ur_x, select_rect_ur_y);
......@@ -933,10 +933,10 @@ int FlowCtx::event_handler( flow_eEvent event, int x, int y, int w, int h)
select_rect_active = 0;
select_rect_last_x = x;
select_rect_last_y = y;
select_rect_ll_x = min( x, select_rect_start_x);
select_rect_ll_y = min( y, select_rect_start_y);
select_rect_ur_x = max( x, select_rect_start_x);
select_rect_ur_y = max( y, select_rect_start_y);
select_rect_ll_x = MIN( x, select_rect_start_x);
select_rect_ll_y = MIN( y, select_rect_start_y);
select_rect_ur_x = MAX( x, select_rect_start_x);
select_rect_ur_y = MAX( y, select_rect_start_y);
flow_draw_rect_erase( this, select_rect_ll_x, select_rect_ll_y,
select_rect_ur_x - select_rect_ll_x,
......
......@@ -41,8 +41,8 @@ void FlowFrame::draw( void *pos, int highlight, int hot, void *node)
idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_rect( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
ll.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y,
int( ur_x * ctx->zoom_factor - ll.z_x - ((FlowPoint *)pos)->z_x - 1),
......@@ -71,8 +71,8 @@ void FlowFrame::erase( void *pos, int hot, void *node)
ur_x = ((FlowNode *)node)->x_right;
ur_y = ((FlowNode *)node)->y_high;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_rect_erase( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x, ll.z_y +
((FlowPoint *)pos)->z_y - ctx->offset_y,
......
#include <iostream.h>
#include "co_dcli.h"
#include "flow_std.h"
#include <float.h>
#include <iostream.h>
#include "flow_image.h"
#include "flow_draw.h"
extern "C" {
#include "co_dcli.h"
}
FlowImage::FlowImage( FlowCtx *flow_ctx, char *imagefile, double x = 0, double y = 0,
flow_mDisplayLevel display_lev = flow_mDisplayLevel_1) :
FlowImage::FlowImage( FlowCtx *flow_ctx, char *imagefile, double x, double y,
flow_mDisplayLevel display_lev) :
ctx(flow_ctx), ll(flow_ctx,x,y), ur(flow_ctx,x,y), display_level(display_lev),
image(0), original_image(0),
pixmap(0), nav_pixmap(0), clip_mask(0), nav_clip_mask(0), current_zoom_factor(0)
......@@ -122,8 +118,8 @@ void FlowImage::print( void *pos, void *node)
return;
int idx = int( ctx->print_zoom_factor / ctx->base_zoom_factor * line_width -
1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->print_ps->rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
......
......@@ -34,8 +34,8 @@ void FlowLine::print( void *pos, void *node)
return;
int idx = int( ctx->print_zoom_factor / ctx->base_zoom_factor *
line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->line( p1.print_z_x + ((FlowPoint *)pos)->print_z_x,
p1.print_z_y + ((FlowPoint *)pos)->print_z_y,
p2.print_z_x + ((FlowPoint *)pos)->print_z_x,
......@@ -87,8 +87,8 @@ void FlowLine::draw( void *pos, int hightlight, int hot, void *node)
return;
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_line( ctx, p1.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p1.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y,
p2.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
......@@ -102,8 +102,8 @@ void FlowLine::erase( void *pos, int hot, void *node)
return;
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_line_erase( ctx, p1.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p1.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y,
p2.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
......@@ -115,8 +115,8 @@ void FlowLine::nav_draw( void *pos, int highlight, void *node)
if ( p1.z_x == p2.z_x && p1.z_y == p2.z_y)
return;
int idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_line( ctx,
p1.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p1.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -130,8 +130,8 @@ void FlowLine::nav_erase( void *pos, void *node)
if ( p1.z_x == p2.z_x && p1.z_y == p2.z_y)
return;
int idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_line_erase( ctx,
p1.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p1.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -152,29 +152,29 @@ int FlowLine::event_handler( void *pos, flow_eEvent event, int x, int y,
int y2 = p2.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y;
if ((x1 == x2 && y1 < y2 && // Vertical
abs( x1 - x) < 3 &&
ABS( x1 - x) < 3 &&
y1 < y && y < y2)
||
(x1 == x2 && y1 > y2 && // Vertical
abs( x1 - x) < 3 &&
ABS( x1 - x) < 3 &&
y2 < y && y < y1)
||
(y1 == y2 && x1 < x2 && // Horizontal
abs( y1 - y) < 3 &&
ABS( y1 - y) < 3 &&
x1 < x && x < x2)
||
(y1 == y2 && x1 > x2 && // Horizontal
abs( y1 - y) < 3 &&
ABS( y1 - y) < 3 &&
x2 < x && x < x1))
{
// cout << "Event handler: Hit in line" << endl;
return 1;
}
else if (( !(x1 == x2 || y1 == y2) && x1 < x2 && x1 <= x && x <= x2 &&
abs(y - 1.0 * (y2-y1)/(x2-x1) * x - y1 + 1.0 * (y2-y1)/(x2-x1) * x1) < 3)
ABS(y - 1.0 * (y2-y1)/(x2-x1) * x - y1 + 1.0 * (y2-y1)/(x2-x1) * x1) < 3)
||
( !(x1 == x2 || y1 == y2) && x1 > x2 && x2 <= x && x <= x1 &&
abs(y - 1.0 * (y2-y1)/(x2-x1) * x - y1 + 1.0 * (y2-y1)/(x2-x1) * x1) < 3))
ABS(y - 1.0 * (y2-y1)/(x2-x1) * x - y1 + 1.0 * (y2-y1)/(x2-x1) * x1) < 3))
{
// cout << "Event handler: Hit in line" << endl;
return 1;
......
......@@ -54,7 +54,7 @@ void FlowPixmap::print( void *pos, void *node)
if ( size <= 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->pixmap( p.print_z_x + ((FlowPoint *)pos)->print_z_x,
p.print_z_y + ((FlowPoint *)pos)->print_z_y,
......@@ -112,7 +112,7 @@ void FlowPixmap::draw( void *pos, int highlight, int hot, void *node)
4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_pixmap( ctx, p.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps,
draw_type, idx, highlight, 0);
......@@ -124,7 +124,7 @@ void FlowPixmap::draw_inverse( void *pos, int hot, void *node)
4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_pixmap_inverse( ctx, p.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps,
draw_type, idx, 0);
......@@ -136,7 +136,7 @@ void FlowPixmap::erase( void *pos, int hot, void *node)
4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_pixmap_erase( ctx, p.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y, &pixmap_data, pixmaps,
draw_type, idx, 0);
......@@ -148,7 +148,7 @@ void FlowPixmap::nav_draw( void *pos, int highlight, void *node)
(pixmap_size + 4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_pixmap( ctx,
p.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -161,7 +161,7 @@ void FlowPixmap::nav_erase( void *pos, void *node)
(pixmap_size + 4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_pixmap_erase( ctx,
p.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......
......@@ -39,8 +39,8 @@ void FlowRect::print( void *pos, void *node)
return;
int idx = int( ctx->print_zoom_factor / ctx->base_zoom_factor * line_width -
1);
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
ctx->print_ps->rect( ll.print_z_x + ((FlowPoint *)pos)->print_z_x,
ll.print_z_y + ((FlowPoint *)pos)->print_z_y,
......@@ -113,8 +113,8 @@ void FlowRect::draw( void *pos, int highlight, int hot, void *node)
idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
}
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
flow_draw_rect( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x, ll.z_y +
((FlowPoint *)pos)->z_y - ctx->offset_y,
......@@ -141,8 +141,8 @@ void FlowRect::erase( void *pos, int hot, void *node)
idx = int( ctx->zoom_factor / ctx->base_zoom_factor * line_width - 1);
idx += hot;
}
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
flow_draw_rect_erase( ctx, ll.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x, ll.z_y +
((FlowPoint *)pos)->z_y - ctx->offset_y,
......@@ -167,8 +167,8 @@ void FlowRect::nav_draw( void *pos, int highlight, void *node)
{
idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
}
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
flow_draw_nav_rect( ctx, ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x -
ctx->nav_offset_x, ll.nav_z_y +
......@@ -191,8 +191,8 @@ void FlowRect::nav_erase( void *pos, void *node)
{
idx = int( ctx->nav_zoom_factor / ctx->base_zoom_factor * line_width - 1);
}
idx = max( 0, idx);
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MAX( 0, idx);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
if ( !fill)
flow_draw_nav_rect_erase( ctx, ll.nav_z_x + ((FlowPoint *)pos)->nav_z_x -
ctx->nav_offset_x, ll.nav_z_y +
......
......@@ -33,7 +33,7 @@ void FlowText::print( void *pos, void *node)
if ( size <= 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
ctx->print_ps->text( p.print_z_x + ((FlowPoint *)pos)->print_z_x ,
p.print_z_y + ((FlowPoint *)pos)->print_z_y, text, strlen(text),
draw_type, size);
......@@ -84,7 +84,7 @@ void FlowText::draw( void *pos, int highlight, int hot, void *node)
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * (text_size +4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_text( ctx, p.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y, text, strlen(text),
draw_type, idx, highlight, 0);
......@@ -95,7 +95,7 @@ void FlowText::erase( void *pos, int hot, void *node)
int idx = int( ctx->zoom_factor / ctx->base_zoom_factor * (text_size +4) - 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_text_erase( ctx, p.z_x + ((FlowPoint *)pos)->z_x - ctx->offset_x,
p.z_y + ((FlowPoint *)pos)->z_y - ctx->offset_y, text, strlen(text),
draw_type, idx, 0);
......@@ -107,7 +107,7 @@ void FlowText::nav_draw( void *pos, int highlight, void *node)
- 4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_text( ctx,
p.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......@@ -120,7 +120,7 @@ void FlowText::nav_erase( void *pos, void *node)
4);
if ( idx < 0)
return;
idx = min( idx, DRAW_TYPE_SIZE-1);
idx = MIN( idx, DRAW_TYPE_SIZE-1);
flow_draw_nav_text_erase( ctx,
p.nav_z_x + ((FlowPoint *)pos)->nav_z_x - ctx->nav_offset_x,
p.nav_z_y + ((FlowPoint *)pos)->nav_z_y - ctx->nav_offset_y,
......
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