Commit bcaa379f authored by claes's avatar claes

New administrator

parent f3d9cf9b
/*
* Proview $Id: pwr.h,v 1.16 2005-09-01 14:57:49 claes Exp $
* Proview $Id: pwr.h,v 1.17 2005-09-20 13:21:45 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -372,6 +372,10 @@ typedef char pwr_tString8 [8]; //!< 8 byte string type.
@aref string1 String1
*/
typedef char pwr_tString1 [1]; //!< 1 byte string type.
/*_*
@aref prostring40 ProString40
*/
typedef char pwr_tProString40 [40]; //!< 40 byte protected string type.
/*_*
@aref text1024 Text1024
*/
......
/*
* Proview $Id: pwr_class.h,v 1.15 2005-09-01 14:57:49 claes Exp $
* Proview $Id: pwr_class.h,v 1.16 2005-09-20 13:21:45 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -51,6 +51,7 @@ typedef union pwr_m_ClassDef pwr_mClassDef;
typedef struct pwr_s_Alias pwr_sAlias;
typedef struct pwr_s_AttrXRef pwr_sAttrXRef;
typedef struct pwr_s_ClassDef pwr_sClassDef;
typedef struct pwr_s_Hier pwr_sHier;
typedef struct pwr_s_DocHier pwr_sDocHier;
typedef struct pwr_s_LibHier pwr_sLibHier;
typedef struct pwr_s_NodeHier pwr_sNodeHier;
......@@ -143,6 +144,7 @@ typedef enum {
pwr_eTix_Status = 29, /* Basic type */
pwr_eTix_NetStatus = 30, /* Basic type */
pwr_eTix_CastId = 31, /* Basic type */
pwr_eTix_ProString = 32, /* Basic type */
pwr_eTix_
} pwr_eTix;
......@@ -184,6 +186,7 @@ typedef enum {
pwr_eType_Status = pwr_TypeId(pwr_eTix_Status),
pwr_eType_NetStatus = pwr_TypeId(pwr_eTix_NetStatus),
pwr_eType_CastId = pwr_TypeId(pwr_eTix_CastId),
pwr_eType_ProString = pwr_TypeId(pwr_eTix_ProString),
pwr_eType_ = pwr_TypeId(pwr_eTix_)
} pwr_eType;
......@@ -281,6 +284,7 @@ typedef enum {
pwr_eCix_Method = 63,
pwr_eCix_RtMethod = 64,
pwr_eCix_ExternVolume = 65,
pwr_eCix_Hier = 66,
pwr_eCix_
} pwr_eCix;
......@@ -350,6 +354,7 @@ typedef enum {
pwr_eClass_Method = pwr_ClassId(pwr_eCix_Method),
pwr_eClass_RtMethod = pwr_ClassId(pwr_eCix_RtMethod),
pwr_eClass_ExternVolume = pwr_ClassId(pwr_eCix_ExternVolume),
pwr_eClass_Hier = pwr_ClassId(pwr_eCix_Hier),
pwr_eClass_
} pwr_eClass;
......@@ -578,6 +583,11 @@ struct pwr_s_ParInfo
pwr_tUInt32 ParamIndex; /* Index of param within a body. */
};
/*_*
@aref privmask PrivMask
*/
typedef pwr_tMask pwr_tPrivMask;
/* Operating system. */
/*_*
@aref opsys OpSys
......@@ -1069,6 +1079,11 @@ struct pwr_s_Alias
pwr_tObjid Object;
};
struct pwr_s_Hier
{
pwr_tString80 Description;
};
struct pwr_s_DocHier
{
pwr_tString80 Description;
......
/**
* Proview $Id: co_user.cpp,v 1.5 2005-09-01 14:57:52 claes Exp $
* Proview $Id: co_user.cpp,v 1.6 2005-09-20 13:21:45 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -47,6 +47,19 @@ GeUser::~GeUser()
}
}
void GeUser::clear()
{
SystemList *sl, *next;
for ( sl = root; sl; )
{
next = sl->next;
delete sl;
sl = next;
}
root = 0;
}
int GeUser::load( char *filename)
{
ifstream fp;
......@@ -149,10 +162,16 @@ int GeUser::add_system( char *name, unsigned int attributes)
SystemName *parent = sn->parent();
if ( !parent)
{
SystemList *system_list = new SystemList(name, 0, 0);
system_list->next = root;
root = system_list;
SystemList *sl;
SystemList *system_list = new SystemList(name, 0, attributes);
// Insert as last sibling to root
if ( !root)
root = system_list;
else {
for ( sl = root; sl->next; sl = sl->next) ;
sl->next = system_list;
}
}
else
{
......
/**
* Proview $Id: co_user.h,v 1.4 2005-09-01 14:57:52 claes Exp $
* Proview $Id: co_user.h,v 1.5 2005-09-20 13:21:45 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -178,6 +178,7 @@ class GeUser {
public:
int load( char *filename);
void clear();
int save() { return save( fname);}
int save( char *filename);
int load_system( ifstream& fp);
......
......@@ -3,7 +3,8 @@ 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 $(pwr_obj)/wb_provider.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/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\
......
/*
* Proview $Id: wb.cpp,v 1.16 2005-09-06 14:13:22 claes Exp $
* Proview $Id: wb.cpp,v 1.17 2005-09-20 13:21:45 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -66,6 +66,7 @@ extern "C" {
#include "wb_vrepwbl.h"
#include "wb_vrepdbs.h"
#include "wb_vrepmem.h"
#include "wb_vrepext.h"
using namespace std;
......@@ -364,23 +365,6 @@ void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFile
// Load volume and import to vrepmem
wb_erep *erep = (wb_erep *)(*(wb_env *)wbctx);
#if 0
wb_vrepwbl *vrep = new wb_vrepwbl( erep);
sts = vrep->load( filename);
if ( vrep->vid() == 0) {
delete vrep;
return;
}
vrep->ref();
wb_vrepmem *mem = new wb_vrepmem(erep, vrep->vid());
mem->name( vrep->name());
erep->addExtern( &sts, mem);
mem->importVolume( *vrep);
vrep->unref();
#endif
wb_vrepmem *mem = new wb_vrepmem(erep, 0);
mem->loadWbl( filename, &sts);
if ( EVEN(sts)) {
......@@ -410,8 +394,67 @@ void pwr_wtt_open_volume( void *wttctx, wb_eType type, char *filename, wow_eFile
wtt->time_to_exit_cb = pwr_time_to_exit;
}
}
else
printf( "Unknown file type\n");
else {
if ( strcmp( filename, "ProjectList") == 0) {
// Load ProjectList
wb_erep *erep = (wb_erep *)(*(wb_env *)wbctx);
wb_vrepext *ext = new wb_vrepext(erep, ldh_cProjectListVolume, filename, filename);
erep->addExtern( &sts, ext);
// Display buffer
wb_volume *vol = new wb_volume(ext);
Wtt *wtt = new Wtt( 0, toplevel, filename,
"Navigator", wbctx, ext->vid(), vol, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit;
}
}
else if ( strcmp( filename, "GlobalVolumeList") == 0) {
// Load GlobalVolumeList
wb_erep *erep = (wb_erep *)(*(wb_env *)wbctx);
wb_vrepext *ext = new wb_vrepext(erep, ldh_cGlobalVolumeListVolume, filename, filename);
erep->addExtern( &sts, ext);
// Display buffer
wb_volume *vol = new wb_volume(ext);
Wtt *wtt = new Wtt( 0, toplevel, filename,
"Navigator", wbctx, ext->vid(), vol, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit;
}
}
else if ( strcmp( filename, "UserDatabase") == 0) {
// Load UserDatabase
wb_erep *erep = (wb_erep *)(*(wb_env *)wbctx);
wb_vrepext *ext = new wb_vrepext(erep, ldh_cUserDatabaseVolume, filename, filename);
erep->addExtern( &sts, ext);
// Display buffer
wb_volume *vol = new wb_volume(ext);
Wtt *wtt = new Wtt( 0, toplevel, filename,
"Navigator", wbctx, ext->vid(), vol, 0, &sts);
if (ODD(sts)) {
appl_count++;
wtt->close_cb = pwr_wtt_close;
wtt->open_volume_cb = pwr_wtt_open_volume;
wtt->time_to_exit_cb = pwr_time_to_exit;
}
}
else
printf( "Unknown file\n");
}
}
}
......@@ -502,6 +545,7 @@ int main( int argc, char *argv[])
XtAppContext app_ctx;
int sw_projectvolume = 0;
int sw_classeditor = 0;
int sw_projectlist = 0;
char filename[200];
int i;
int quiet = 0;
......@@ -547,6 +591,10 @@ int main( int argc, char *argv[])
sw_projectvolume = 0;
i++;
break;
case 'p':
sw_projectlist = 1;
sw_projectvolume = 0;
break;
default:
printf("Unknown argument: %s\n", argv[i]);
}
......@@ -678,6 +726,9 @@ int main( int argc, char *argv[])
else if ( sw_classeditor) {
pwr_wtt_open_volume( 0, wb_eType_ClassEditor, filename, wow_eFileSelType_WblClass);
}
else if ( sw_projectlist) {
pwr_wtt_open_volume( 0, wb_eType_Volume, "ProjectList", wow_eFileSelType_);
}
else if ( nav_display) {
if ( login_prv.priv & pwr_mPrv_DevRead ) {
strcpy( title, "PwR Navigator: ");
......
......@@ -3,7 +3,8 @@ 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 $(pwr_obj)/wb_provider.o \
-L/usr/X11R6/lib -L/usr/local/BerkeleyDB.4.0/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\
......
......@@ -12,8 +12,12 @@ topobjects NavigatorW1
{
class $PlantHier
class $LibHier
class $Hier
class $Alias
class $MountObject
class ProjectReg
class VolumeReg
class SystemGroupReg
}
topobjects NavigatorW2
{
......@@ -631,6 +635,7 @@ palette PlcEditorPalette
class SafetySwitchFo
class CircuitBreakerFo
class BaseSensorFo
class PositSensorFo
class CompModeDFo
class CompModeAFo
class CompModeDMFo
......@@ -654,6 +659,7 @@ palette PlcEditorPalette
class MValveOrSwOpFo
class MValveOrSwClFo
class MValveOrNoSwFo
class PropValveOrFo
class SupSwitchFo
}
menu ABB
......
/*
* Proview $Id: wb_provider.cpp,v 1.2 2005-09-01 14:57:49 claes Exp $
* Proview $Id: wb_provider.cpp,v 1.3 2005-09-20 13:21:45 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -38,12 +38,18 @@ extern "C" {
void wb_procom::put( vext_sAMsg *msg, int size, pwr_tStatus *sts)
{
*sts = LDH__SUCCESS;
msg->Any.message_type = 1;
if ( msgsnd( m_msgsndid, (void *)msg, size, 0) == -1) {
*sts = LDH__MSGSND;
return;
switch ( m_type) {
case procom_eType_Ipc:
if ( msgsnd( m_msgsndid, (void *)msg, size, 0) == -1) {
*sts = LDH__MSGSND;
return;
}
case procom_eType_Local:
memcpy( &m_msg, msg, sizeof(m_msg));
break;
}
*sts = LDH__SUCCESS;
}
void wb_procom::receive( vext_sQMsg *msg, int size, pwr_tStatus *sts)
......@@ -110,6 +116,7 @@ void wb_procom::provideBody( pwr_tStatus sts, pwr_tOix oix, int size, void *body
vext_sAMsg amsg;
pwr_tStatus asts;
amsg.Object.Type = vext_eMsgType_ObjectBody;
amsg.ObjectBody.Status = sts;
amsg.ObjectBody.oix = oix;
if ( (int)sizeof(amsg.ObjectBody.body) < size)
......@@ -120,6 +127,93 @@ void wb_procom::provideBody( pwr_tStatus sts, pwr_tOix oix, int size, void *body
put( &amsg, sizeof(amsg), &asts);
}
void wb_procom::provideStatus( pwr_tStatus sts)
{
vext_sAMsg amsg;
pwr_tStatus asts;
amsg.Object.Type = vext_eMsgType_Status;
amsg.Any.Status = sts;
put( &amsg, sizeof(amsg), &asts);
}
void wb_procom::dispatch( vext_sQMsg *qmsg)
{
switch( qmsg->Any.Type) {
case vext_eMsgType_Object:
printf( "Object\n");
m_provider->object( this);
break;
case vext_eMsgType_ObjectOid:
printf( "ObjectOid %d\n", qmsg->Oid.Oix);
m_provider->objectOid( this, qmsg->Oid.Oix);
break;
case vext_eMsgType_ObjectBody:
printf( "ObjectBody %d\n", qmsg->Oid.Oix);
m_provider->objectBody( this, qmsg->Oid.Oix);
break;
case vext_eMsgType_ObjectName:
printf( "ObjectName %s\n", qmsg->ObjectName.Name);
m_provider->objectName( this, qmsg->ObjectName.Name);
break;
case vext_eMsgType_CreateObject:
printf( "CreateObject %s\n", qmsg->CreateObject.Name);
m_provider->createObject( this, qmsg->CreateObject.DestOix, qmsg->CreateObject.DestType,
qmsg->CreateObject.Cid, qmsg->CreateObject.Name);
break;
case vext_eMsgType_MoveObject:
printf( "MoveObject %d\n", qmsg->Oid.Oix);
m_provider->moveObject( this, qmsg->MoveObject.Oix, qmsg->MoveObject.DestOix,
qmsg->MoveObject.DestType);
break;
case vext_eMsgType_CopyObject:
printf( "CopyObject %d\n", qmsg->Oid.Oix);
m_provider->copyObject( this, qmsg->CopyObject.Oix, qmsg->CopyObject.DestOix,
qmsg->CopyObject.DestType, qmsg->CopyObject.Name);
break;
case vext_eMsgType_DeleteObject:
printf( "DeleteObject %d\n", qmsg->Oid.Oix);
m_provider->deleteObject( this, qmsg->DeleteObject.Oix);
break;
case vext_eMsgType_DeleteFamily:
printf( "DeleteFamily %d\n", qmsg->Oid.Oix);
m_provider->deleteFamily( this, qmsg->DeleteFamily.Oix);
break;
case vext_eMsgType_RenameObject:
printf( "RenameObject %d\n", qmsg->Oid.Oix);
m_provider->renameObject( this, qmsg->RenameObject.Oix, qmsg->RenameObject.Name);
break;
case vext_eMsgType_WriteAttr:
printf( "WriteAttr %d\n", qmsg->Oid.Oix);
m_provider->writeAttribute( this, qmsg->WriteAttr.Oix, qmsg->WriteAttr.Offset,
qmsg->WriteAttr.Size, qmsg->WriteAttr.Buffer);
break;
case vext_eMsgType_Commit:
printf( "Commit\n");
m_provider->commit( this);
break;
case vext_eMsgType_Abort:
printf( "Abort\n");
m_provider->abort( this);
break;
default:
;
}
}
int wb_procom::lmsgsnd( int msgid, const void *msg_ptr, size_t msg_sz, int msgflg)
{
dispatch( (vext_sQMsg *)msg_ptr);
return 0;
}
int wb_procom::lmsgrcv( int msgid, const void *msg_ptr, size_t msg_sz, int msgtype,
int msgflg)
{
memcpy( (void *)msg_ptr, &m_msg, sizeof(m_msg));
return 0;
}
void wb_procom::mainloop()
{
vext_sQMsg qmsg;
......@@ -127,27 +221,7 @@ void wb_procom::mainloop()
for (;;) {
receive( &qmsg, sizeof(qmsg), &sts);
switch( qmsg.Any.Type) {
case vext_eMsgType_Object:
printf( "Object\n");
m_provider->object( this);
break;
case vext_eMsgType_ObjectOid:
printf( "ObjectOid %d\n", qmsg.Oid.Oix);
m_provider->objectOid( this, qmsg.Oid.Oix);
break;
case vext_eMsgType_ObjectBody:
printf( "ObjectBody %d\n", qmsg.Oid.Oix);
m_provider->objectBody( this, qmsg.Oid.Oix);
break;
case vext_eMsgType_ObjectName:
printf( "ObjectName %s\n", qmsg.ObjectName.Name);
m_provider->objectName( this, qmsg.ObjectName.Name);
break;
default:
;
}
dispatch( &qmsg);
}
}
......
/*
* Proview $Id: wb_provider.h,v 1.2 2005-09-01 14:57:49 claes Exp $
* Proview $Id: wb_provider.h,v 1.3 2005-09-20 13:21:45 claes Exp $
* Copyright (C) 2005 SSAB Oxelsund AB.
*
* This program is free software; you can redistribute it and/or
......@@ -27,33 +27,61 @@ class wb_procom;
class wb_provider {
public:
virtual ~wb_provider() {}
virtual void object( wb_procom *pcom) {}
virtual void objectOid( wb_procom *pcom, pwr_tOix oix) {}
virtual void objectName( wb_procom *pcom, char *name) {}
virtual void objectBody( wb_procom *pcom, pwr_tOix oix) {}
virtual void createObject( wb_procom *pcom, pwr_tOix destoix, int desttype,
pwr_tCid cid, char *name) {}
virtual void moveObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix,
int desttype) {}
virtual void copyObject( wb_procom *pcom, pwr_tOix oix, pwr_tOix destoix, int desttype,
char *name) {}
virtual void deleteObject( wb_procom *pcom, pwr_tOix oix) {}
virtual void deleteFamily( wb_procom *pcom, pwr_tOix oix) {}
virtual void renameObject( wb_procom *pcom, pwr_tOix oix, char *name) {}
virtual void writeAttribute( wb_procom *pcom, pwr_tOix oix, unsigned int offset,
unsigned int size, char *buffer) {}
virtual void commit( wb_procom *pcom) {}
virtual void abort( wb_procom *pcom) {}
};
typedef enum {
procom_eType_Ipc,
procom_eType_Local
} procom_eType;
class wb_procom
{
char m_key[200];
int m_connected;
int m_msgsndid;
int m_msgrcvid;
procom_eType type;
wb_provider *m_provider;
vext_sAMsg m_msg;
procom_eType m_type;
public:
wb_procom( char *key, wb_provider *p) : m_connected(0), m_provider(p)
wb_procom( char *key, wb_provider *p, procom_eType type) :
m_connected(0), m_provider(p), m_type( type)
{
strcpy( m_key, key);
}
void put( vext_sAMsg *msg, int size, pwr_tStatus *sts);
void receive( vext_sQMsg *msg, int size, pwr_tStatus *sts);
void dispatch( vext_sQMsg *qmsg);
void mainloop();
void provideObject( pwr_tStatus sts, pwr_tOix oix, pwr_tOix fthoix, pwr_tOix bwsoix,
pwr_tOix fwsoix, pwr_tOix fchoix, pwr_tOix lchoix, pwr_tCid cid,
char *name, char *longname);
void provideBody( pwr_tStatus sts, pwr_tOix oix, int size, void *body);
void provideStatus( pwr_tStatus sts);
int lmsgsnd( int msgid, const void *msg_ptr, size_t msg_sz, int msgflg);
int lmsgrcv( int msgid, const void *msg_ptr, size_t msg_sz, int msgtype, int msgflg);
};
......
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