Exemple #1
0
/* Supervise emon server process */
void
pwrs_Node_SupEmon (
)
{
  int i = errh_eAnix_emon - 1;
  pwr_tTime current_time;
  pwr_tDeltaTime diff;
  static float timeout = 3;

  if ( !np) {
    pwr_tOid oid;
    pwr_tStatus sts;

    sts = gdh_GetNodeObject( 0, &oid);
    if ( ODD(sts))
      gdh_ObjidToPointer( oid, (void **) &np);
    if ( EVEN(sts)) return;
  }

  if ( !np)
    return;

  if ( np->ProcStatus[i] != 0 && np->ProcStatus[i] != PWR__PTIMEOUT) {
    time_GetTime( &current_time);
    time_Adiff( &diff, &current_time, &np->ProcTimeStamp[i]);

    if ( time_DToFloat( 0, &diff) > timeout) {
      if ( errh_Severity( np->ProcStatus[i]) < errh_Severity(PWR__PTIMEOUT)) {
	np->ProcStatus[i] = PWR__PTIMEOUT;
	np->SystemStatus = PWR__PTIMEOUT;
      }
    }
  }
}
Exemple #2
0
static pwr_tStatus	logg_init( logg_ctx	loggctx)
{
	pwr_tStatus	sts;
	pwr_tObjid	objid;
	logg_t_loggconf_list	*conflist_ptr;
	int		i;

	/* Get the logg config objects on this node */
	sts = gdh_GetClassList ( pwr_cClass_LoggConfig, &objid);
	while ( ODD(sts))
	{
          /* Store and direct link the LoggConfig objects */
          sts = logg_loggconflist_add( loggctx, objid,
		&loggctx->loggconflist,
		&loggctx->loggconf_count);
	  if (EVEN(sts)) Log( REM__CONFINIT, sts);

	  sts = gdh_GetNextObject( objid, &objid);
	}

	/* Open the files */
	conflist_ptr = loggctx->loggconflist;
	for ( i = 0; i < loggctx->loggconf_count; i++)
	{
	  sts = logg_open_file( conflist_ptr, 1);
	  conflist_ptr++;
	}

	return REM__SUCCESS;
}
Exemple #3
0
write_xms_store (j_common_ptr cinfo, backing_store_ptr info,
		 void FAR * buffer_address,
		 long file_offset, long byte_count)
{
  XMScontext ctx;
  XMSspec spec;
  char endbuffer[2];

  /* The XMS driver can't cope with an odd length, so handle the last byte
   * specially if byte_count is odd.  We don't expect this to be common.
   */

  spec.length = byte_count & (~ 1L);
  spec.src_handle = 0;
  spec.src.ptr = buffer_address;
  spec.dst_handle = info->handle.xms_handle;
  spec.dst.offset = file_offset;

  ctx.ds_si = (void far *) & spec;
  ctx.ax = 0x0b00;		/* EMB move */
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  if (ctx.ax != 1)
    ERREXIT(cinfo, JERR_XMS_WRITE);

  if (ODD(byte_count)) {
    read_xms_store(cinfo, info, (void FAR *) endbuffer,
		   file_offset + byte_count - 1L, 2L);
    endbuffer[0] = ((char FAR *) buffer_address)[byte_count - 1L];
    write_xms_store(cinfo, info, (void FAR *) endbuffer,
		    file_offset + byte_count - 1L, 2L);
  }
}
pwr_tStatus wb_volume::triggPostCreate(wb_object& o)
{
  pwr_tStatus sts;
  char *methodName;
  wb_tMethod method;
  
  // Call object method, or inherited method
  for ( wb_cdef cd = cdef(o.cid()); cd; cd = cd.super()) {
    wb_cdrep *cdrep = cd;
    
    cdrep->dbCallBack(&sts, ldh_eDbCallBack_PostCreate, &methodName, 0);

    if (ODD(sts)) {
      m_vrep->erep()->method(&sts, methodName, &method);
      if (EVEN(sts)) return LDH__SUCCESS;

      wb_object father = o.parent();
      if (father) {
	sts = ((wb_tMethodPostCreate) (method))((ldh_tSesContext)this, o.oid(), father.oid(),
						father.cid());
      }
      else
	sts = ((wb_tMethodPostCreate) (method))((ldh_tSesContext)this, o.oid(), pwr_cNObjid,
						pwr_cNClassId);
      return sts;
    }
  }

  return LDH__SUCCESS;
}
Exemple #5
0
void WVselMotif::activate_ok( Widget w, WVselMotif *vsel, XmAnyCallbackStruct *data)
{
  int		sts;
  int 		*pos_list, pos_cnt;
  int 		i;
  pwr_tVolumeId	*volume_ptr;

  volume_ptr = (pwr_tVolumeId *) calloc( vsel->volume_count, 
					 sizeof( pwr_tVolumeId));
  if (XmListGetSelectedPos( vsel->widgets.volumelist, 
			    &pos_list, &pos_cnt))  {
    for (i = 0; i < pos_cnt; i++) {
      *(volume_ptr + i) = vsel->volumes[ pos_list[i] - 1];
    }
  }

  if (vsel->vsel_bc_success != NULL)
    sts = (vsel->vsel_bc_success) ( vsel, volume_ptr, pos_cnt);
  free( (char *) volume_ptr);

  if ( ODD(sts)) {
    if (vsel->vsel_bc_cancel != NULL)
      (vsel->vsel_bc_cancel) ();
    delete vsel;
  }
  else if ( sts == LDH__VOLALRATT) {
    vsel->wow->DisplayError( "Error",
			     "         Volume is already open        ");
  }
}
Exemple #6
0
//
// Backcall routine called at creation of the brow widget
// Enable event, create nodeclasses and insert the root objects.
//
int CLogNav::init_brow_cb( FlowCtx *fctx, void *client_data)
{
  int start_idx = 1;

  CLogNav *clognav = (CLogNav *) client_data;
  BrowCtx *ctx = (BrowCtx *)fctx;

  clognav->brow = new CLogNavBrow( ctx, (void *)clognav);

  clognav->brow->brow_setup();
  clognav->brow->create_nodeclasses();

  clognav->get_files();
  clognav->read( &start_idx, 1);

  // View last items
  brow_tObject last;
  int sts;

  sts = brow_GetLast( clognav->brow->ctx, &last);
  if ( ODD(sts))
    brow_CenterObject( clognav->brow->ctx, last, 0.9);
  
  return 1;
}
Exemple #7
0
double lchoose(double n, double k)
{
    k = floor(k + 0.5);
#ifdef IEEE_754
    /* NaNs propagated correctly */
    if(ISNAN(n) || ISNAN(k)) return n + k;
#endif
    if (k < 2) {
	if (k <	 0) return ML_NEGINF;
	if (k == 0) return 0.;
	/* else: k == 1 */
	return log(n);
    }
    /* else: k >= 2 */
    if (n < 0) {
	if (ODD(k)) return ML_NAN;/* log( <negative> ) */
	return lchoose(-n+ k-1, k);
    }
    else if (R_IS_INT(n)) {
	if(n < k) return ML_NEGINF;
	if(n - k < 2) return lchoose(n, n-k); /* <- Symmetry */
	return lfastchoose(n, k);
    }
    /* else non-integer n >= 0 : */
    if (n < k-1) {
	int s;
	if (fmod(floor(n-k+1), 2.) == 0) /* choose() < 0 */
	    return ML_NAN;
	return lfastchoose2(n, k, &s);
    }
    return lfastchoose(n, k);
}
Exemple #8
0
wb_orep *wb_vrepext::object(pwr_tStatus *sts)
{
  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.Any.Type = vext_eMsgType_Object;
  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Object.Status)) {
    *sts = LDH__SUCCESS;
    wb_cdrep *cdrep = m_merep->cdrep( sts, amsg.Object.cid);
    wb_cdef cdef = wb_cdef( cdrep);

    ext_object exto( &amsg.Object, m_vid, cdef);
    wb_orepext *orep = new wb_orepext( this, exto);
    return orep;
  }
  else {
    *sts = amsg.Object.Status;
    return 0;
  }
}
Exemple #9
0
void *wb_vrepext::readBody(pwr_tStatus *sts, const wb_orep *o, pwr_eBix bix, void *p)
{
  vext_sQMsg qmsg;
  static vext_sAMsg amsg;

  if ( bix != pwr_eBix_rt) {
    *sts = LDH__NOSUCHBODY;
    return 0;
  }

  qmsg.Oid.Type = vext_eMsgType_ObjectBody;
  qmsg.Oid.Oix = o->oid().oix;
  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.ObjectBody.Status)) {
    *sts = LDH__SUCCESS;
    if ( p) {
      memcpy( p, &amsg.ObjectBody.body, amsg.ObjectBody.size);
      return p;
    }
    return &amsg.ObjectBody.body;
  }
  *sts = LDH__NOSUCHBODY;
  return 0;
}
static pwr_tStatus AnteCreate (
  ldh_tSesContext   Session,
  pwr_tObjid	    Father,
  pwr_tClassId	    Class
) {
  pwr_tCid cid;
  pwr_tStatus sts;
  pwr_tOid oid;

  // ClassHier should be child to a $Node object
  if ( Father.oix == 0)
    return PWRS__POSSECURITY;

  sts = ldh_GetObjectClass( Session, Father, &cid);
  if ( EVEN(sts)) return sts;
  
  if ( cid != pwr_eClass_Node)
    return PWRS__POSSECURITY;

  // There should only be one security object
  sts = ldh_GetClassList( Session, pwr_eClass_Security, &oid);
  if ( ODD(sts))
    return PWRS__SECURITYALREX;

  return PWRS__SUCCESS;
}
Exemple #11
0
wb_orep *wb_vrepext::object(pwr_tStatus *sts, wb_name &name)
{
  if ( name.hasVolume() && !name.hasObject()) {
    // Volume object
    *sts = LDH__SUCCESS;
    return new wb_orepext( this, volume_object);
  }

  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.ObjectName.Type = vext_eMsgType_ObjectName;
  strcpy( qmsg.ObjectName.Name, name.name(cdh_mName_path | cdh_mName_object));
  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Object.Status)) {
    *sts = LDH__SUCCESS;
    wb_cdrep *cdrep = m_merep->cdrep( sts, amsg.Object.cid);
    wb_cdef cdef = wb_cdef( cdrep);

    ext_object exto( &amsg.Object, m_vid, cdef);
    wb_orepext *orep = new wb_orepext( this, exto);
    return orep;
  }
  else {
    *sts = amsg.Object.Status;
    return 0;
  }
}
METHODDEF void
read_xms_store (backing_store_ptr info, void FAR * buffer_address,
		long file_offset, long byte_count)
{
  XMScontext ctx;
  XMSspec spec;
  char endbuffer[2];

  /* The XMS driver can't cope with an odd length, so handle the last byte
   * specially if byte_count is odd.  We don't expect this to be common.
   */

  spec.length = byte_count & (~ 1L);
  spec.src_handle = info->handle.xms_handle;
  spec.src.offset = file_offset;
  spec.dst_handle = 0;
  spec.dst.ptr = buffer_address;
  
  ctx.ds_si = (void far *) & spec;
  ctx.ax = 0x0b00;		/* EMB move */
  jxms_calldriver(xms_driver, (XMScontext far *) & ctx);
  if (ctx.ax != 1)
    ERREXIT(methods, "read from extended memory failed");

  if (ODD(byte_count)) {
    read_xms_store(info, (void FAR *) endbuffer,
		   file_offset + byte_count - 1L, 2L);
    ((char FAR *) buffer_address)[byte_count - 1L] = endbuffer[0];
  }
}
Exemple #13
0
pwr_tBoolean
ivol_BuildVolume (
  pwr_tStatus		*status,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*ol;
  gdb_sObject		*op;

  pwr_dStatus(sts, status, GDH__SUCCESS);

  /* First link the volume block.  */


  /* Now link all objects.  */

  for (
    ol = pool_Qsucc(sts, gdbroot->pool, &vp->l.obj_lh);
    ol != &vp->l.obj_lh;
    ol = pool_Qsucc(sts, gdbroot->pool, ol)
  ) {
    op = pool_Qitem(ol, gdb_sObject, l.obj_ll);

    vol_LinkObject(sts, vp, op, vol_mLink_build);
    pwr_Assert(ODD(*sts));

  }
  return YES;
}
Exemple #14
0
static pwr_tBoolean
mountClients (
  pwr_tStatus		*sts,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*ol;
  gdb_sObject		*op;

  /* First link the volume block.  */


  /* Now link all objects.  */

  for (
    ol = pool_Qsucc(sts, gdbroot->pool, &vp->l.obj_lh);
    ol != &vp->l.obj_lh;
    ol = pool_Qsucc(sts, gdbroot->pool, ol)
  ) {
    op = pool_Qitem(ol, gdb_sObject, l.obj_ll);

    if (op->g.flags.b.isMountClient && op->g.oid.vid == gdbroot->db->vid) {
      /* Only root volumes can mount.  */
      mountVolume(sts, op);
      if ( *sts != GDH__NOMOUNTOBJECT)
	pwr_Assert(ODD(*sts));
    }
  }
  return YES;
}
Exemple #15
0
int PalFile::check_volume( ldh_tSession ldhses, char *name)
{
  pwr_tClassId classid;
  pwr_tVolumeId volume;
  int sts;
  int size;
  char volume_name[80];

  // Find a class volume with this name
  sts = ldh_GetVolumeList( ldh_SessionToWB(ldhses), &volume);
  while ( ODD(sts))
  {
    sts = ldh_GetVolumeClass( ldh_SessionToWB(ldhses), volume, &classid);
    if ( EVEN(sts)) return 0;

    if ( cdh_isClassVolumeClass( classid))
    {
      sts = ldh_VolumeIdToName( ldh_SessionToWB(ldhses),
		volume, volume_name, sizeof(volume_name), &size);
      if ( EVEN(sts)) return 0;

      if ( !cdh_NoCaseStrcmp( volume_name, name))
        return 1;
    }
    sts = ldh_GetNextVolume( ldh_SessionToWB(ldhses), volume, &volume);
  }
  return 0;
}
Exemple #16
0
bool wb_vrepext::moveObject(pwr_tStatus *sts, wb_orep *orep, wb_destination &d)
{
  if ( d.oid().vid != m_vid || orep->oid().vid != m_vid) {
    *sts = LDH__BADOBJID;
    return 0;
  }
  
  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.MoveObject.Oix = orep->oix();
  qmsg.MoveObject.Type = vext_eMsgType_MoveObject;
  qmsg.MoveObject.DestOix = d.oid().oix;
  qmsg.MoveObject.DestType = d.code();

  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Any.Status)) {
    *sts = LDH__SUCCESS;
  }
  else {
    *sts = amsg.Any.Status;
    return false;
  }
  return true;
}
Exemple #17
0
void Ev::update( double scantime)
{
  int sts;
  int nodraw_set = 0;

  sts = mh_OutunitReceive();     
  while (ODD(sts))
  {
    if ( !nodraw_set)
    {
      eve->set_nodraw();
      ala->set_nodraw();
      nodraw_set = 1;
    }
    sts = mh_OutunitReceive();     
  }
  if ( nodraw_set)
  {
    eve->reset_nodraw();
    ala->reset_nodraw();
  }

  ala->flash();
  for ( int i = 0; i < sala_cnt; i++)
    sala[i]->update();
  if ( beep)
    ala->beep( scantime);
}      
Exemple #18
0
bool wb_vrepext::deleteFamily(pwr_tStatus *sts, wb_orep *orep)
{
  if ( orep->oid().vid != m_vid) {
    *sts = LDH__BADOBJID;
    return false;
  }
  
  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.DeleteFamily.Oix = orep->oix();
  qmsg.DeleteFamily.Type = vext_eMsgType_DeleteFamily;

  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Any.Status)) {
    *sts = LDH__SUCCESS;
  }
  else {
    *sts = amsg.Any.Status;
    return false;
  }
  return true;
}
Exemple #19
0
pwr_tStatus EvEve::set_view(pwr_tOid view)
{
  pwr_tStatus sts;

  sts = ala->set_view( view);
  if ( ODD(sts)) {
    pwr_tString80 name;

    if ( cdh_ObjidIsNull( view)) {
      strcpy( name, "Event List");
    }
    else {
      pwr_tAttrRef name_ar, ar;

      ar = cdh_ObjidToAref( view);
      sts = gdh_ArefANameToAref( &ar, "Name", &name_ar);
      if (EVEN(sts)) return sts;

      sts = gdh_GetObjectInfoAttrref( &name_ar, name, sizeof(name));
      if (EVEN(sts)) return sts;
    }
    set_title_ala( name);
  }
  return sts;
}
Exemple #20
0
bool wb_vrepext::renameObject(pwr_tStatus *sts, wb_orep *orep, wb_name &name) 
{
  if ( orep->oid().vid != m_vid) {
    *sts = LDH__BADOBJID;
    return false;
  }
  if ( !name) {
    *sts = name.sts();
    return false;
  }
  
  vext_sQMsg qmsg;
  vext_sAMsg amsg;

  qmsg.RenameObject.Oix = orep->oix();
  qmsg.RenameObject.Type = vext_eMsgType_RenameObject;
  strcpy( qmsg.RenameObject.Name, name.object());

  put( &qmsg, sizeof(qmsg), sts);
  if ( EVEN(*sts)) return 0;
  receive( &amsg, sizeof(amsg), sts);
  if ( EVEN(*sts)) return 0;

  if ( ODD( amsg.Any.Status)) {
    *sts = LDH__SUCCESS;
  }
  else {
    *sts = amsg.Any.Status;
    return false;
  }
  // Remove from cashe
  cashe_remove( orep->oid().oix);
  return true;
}
Exemple #21
0
static pwr_tStatus PostCreate (
  ldh_tSesContext   Session,
  pwr_tOid	    Object,
  pwr_tOid	    Father,
  pwr_tCid	    Class
) {
  pwr_tOid oid;
  pwr_tOid toid;
  pwr_tStatus sts;
  int cnt = 0;

  sts = ldh_GetClassList( Session, pwr_cClass_PlcThread, &oid);
  while ( ODD(sts)) {
    cnt++;
    toid = oid;
    sts = ldh_GetNextObject( Session, oid, &oid);
  }

  if ( cnt > 0) {
    sts = ldh_SetObjectPar( Session, Object, "RtBody", "ThreadObject", (char *)&toid,
			 sizeof(toid));
    if ( EVEN(sts)) return sts;
  }
  return PWRB__SUCCESS;
}
void XttMethodToolbarGtk::activate_button( GtkWidget *w, gpointer data)
{
  XttMethodToolbarGtk *mt = ((xtt_sMethodButtonCb *)data)->mt;
  int idx = ((xtt_sMethodButtonCb *)data)->idx;

  int		sts = 0;
  int		is_attr;
  pwr_sAttrRef	aref;
  xmenu_eItemType menu_type;

  if ( mt->get_select_cb)
    sts = (mt->get_select_cb)( mt->m_parent_ctx, &aref, &is_attr);

  if ( ODD(sts)) {
    if ( aref.Flags.b.Object)
      menu_type = xmenu_eItemType_Object;
    else if ( aref.Flags.b.ObjectAttr)
      menu_type = xmenu_eItemType_AttrObject;
    else
      menu_type = xmenu_eItemType_Attribute;
    
    mt->m_xnav->call_method( mt->m_data[idx].method, mt->m_data[idx].filter, aref,
			     menu_type,
			     xmenu_mUtility_XNav,
			     mt->m_xnav->priv, 0);
  }  
}
Exemple #23
0
void WVselMotif::action_volumelist( Widget w, WVselMotif *vsel, XmListCallbackStruct *data)
{
  int		sts;
  pwr_tVolumeId	*volume_ptr;

  if ( data->event->type == KeyPress)
    // The ok callback will be called later
    return;

  volume_ptr = (pwr_tVolumeId *) calloc( 1, sizeof( pwr_tVolumeId));

  *volume_ptr = vsel->volumes[ data->item_position - 1];

  if (vsel->vsel_bc_success != NULL)
    sts = (vsel->vsel_bc_success) ( vsel, volume_ptr, 1);
  free( (char *) volume_ptr);

  if ( ODD(sts)) {
    if (vsel->vsel_bc_cancel != NULL)
      (vsel->vsel_bc_cancel) ();
    delete vsel;
  }
  else if ( sts == LDH__VOLALRATT) {
    vsel->wow->DisplayError( "Error",
		       "         Volume is already open        ");
  }
}
Exemple #24
0
double lchoose(double n, double k)
{
    double k0 = k;
    k = floor(k + 0.5);
#ifdef IEEE_754
    /* NaNs propagated correctly */
    if(ISNAN(n) || ISNAN(k)) return n + k;
#endif
    if (fabs(k - k0) > 1e-7)
	MATHLIB_WARNING2(_("'k' (%.2f) must be integer, rounded to %.0f"), k0, k);
    if (k < 2) {
	if (k <	 0) return ML_NEGINF;
	if (k == 0) return 0.;
	/* else: k == 1 */
	return log(n);
    }
    /* else: k >= 2 */
    if (n < 0) {
	if (ODD(k)) return ML_NAN;/* log( <negative> ) */
	return lchoose(-n+ k-1, k);
    }
    else if (R_IS_INT(n)) {
	if(n < k) return ML_NEGINF;
	if(n - k < 2) return lchoose(n, n-k); /* <- Symmetry */
	return lfastchoose(n, k);
    }
    /* else non-integer n >= 0 : */
    if (n < k-1) {
	int s;
	if (fmod(floor(n-k+1), 2.) == 0) /* choose() < 0 */
	    return ML_NAN;
	return lfastchoose2(n, k, &s);
    }
    return lfastchoose(n, k);
}
Exemple #25
0
void GrowSlider::get_info_pixel( glow_eDirection *dir, double *max_position,
                                 double *min_position, int bg_dyn_type)
{
    GlowArrayElem *background;
    glow_eDirection bg_dir;
    double bg_max, bg_min;
    int bg_found;
    int sts;
    double origo;

    sts = ctx->get_background_object_limits(
              (glow_eTraceType) bg_dyn_type,
              (x_right + x_left) / 2, (y_low + y_high) / 2,
              &background, &bg_min, &bg_max, &bg_dir);
    if ( ODD(sts))
        bg_found = 1;
    else
        bg_found = 0;

    if ( !bg_found) {
        *dir = direction;
        if ( direction == glow_eDirection_Left ||
                direction == glow_eDirection_Right) {
            *max_position = max_pos * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
            *min_position = min_pos * ctx->mw.zoom_factor_x - ctx->mw.offset_x;
        }
        else {
            *max_position = max_pos * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
            *min_position = min_pos * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
        }
    }
    else {
        *dir = bg_dir;
        get_origo( bg_dir, &origo);
        switch ( bg_dir) {
        case glow_eDirection_Right:
            *max_position = (bg_max - origo) * ctx->mw.zoom_factor_x- ctx->mw.offset_x;
            *min_position = (bg_min - origo) * ctx->mw.zoom_factor_x- ctx->mw.offset_x;
            break;
        case glow_eDirection_Left:
            *max_position = (bg_max - (x_right - x_left - origo)) *
                            ctx->mw.zoom_factor_x- ctx->mw.offset_x;
            *min_position = (bg_min - (x_right - x_left - origo)) *
                            ctx->mw.zoom_factor_x- ctx->mw.offset_x;
            break;
        case glow_eDirection_Down:
            *max_position = (bg_max - origo) * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
            *min_position = (bg_min - origo) * ctx->mw.zoom_factor_y - ctx->mw.offset_y;
            break;
        case glow_eDirection_Up:
            *max_position = (bg_max - (y_high - y_low - origo)) *
                            ctx->mw.zoom_factor_y - ctx->mw.offset_y;
            *min_position = (bg_min - (y_high - y_low - origo)) *
                            ctx->mw.zoom_factor_y - ctx->mw.offset_y;
            break;
        default:
            ;
        }
    }
}
Exemple #26
0
// Show Configuration
static pwr_tStatus ShowConfiguration(xmenu_sMenuCall* ip)
{
  pwr_tStatus sts;
  xtt_pndevice_sCtx* ctx;
  pwr_tFileName datafile;

  sprintf(
      datafile, "$pwrp_load/pwr_pn_%s.xml", id_to_string(ip->Pointed.Objid));

  sts = xtt_pndevice_create_ctx(ip->Pointed, ip->EditorContext, &ctx);
  if (EVEN(sts))
    return sts;

  ctx->attr = new GsdmlAttrQt(
      CoXHelpQt::get_widget(), ctx, 0, ctx->gsdml, 0, datafile, &sts);
  if (sts == PB__CONFIGABORTED) {
    delete ctx->attr;
    return 1;
  }
  ctx->attr->close_cb = xtt_pndevice_close_cb;
  ctx->attr->save_cb = xtt_pndevice_save_cb;
  ctx->attr->help_cb = xtt_pndevice_help_cb;
#if 0
  if (ODD(sts))
    sts = pndevice_init(ctx);
#endif
  if (EVEN(sts)) {
    ctx->attr->wow->DisplayError("Configuration load error",
        "Configuration load error\nCheck configuration data");
  }

  return 1;
}
Exemple #27
0
static pwr_tStatus
init_nodes ()
{
  pwr_tStatus sts;
  LstLink(sNode) *nl;
  sNode *np;
  pwr_tObjid oid;

  nl = LstEnd(&node_l);

  for (
    sts = gdh_GetClassList(pwr_cClass_NodeLinkSup, &oid);
    ODD(sts);
    sts = gdh_GetNextObject(oid, &oid)
  ) {
    np = init_node(oid, NULL, 1);
    if (np != NULL) {
      nl = LstIns(nl, np, node_l);
    }
  }

  if (LstEmp(&node_l))
    errh_Info("No NodeLink objects");

  return(sts);
}
Exemple #28
0
int wb_bdrep::nAttribute()
{
  pwr_tStatus sts;
  int attr_count = 0;
  wb_orep *old;

  wb_orep *orep = m_orep->vrep()->first( &sts, m_orep);
  while ( ODD(sts)) {
    switch ( orep->cid()) {
    case pwr_eClass_Param:
    case pwr_eClass_Intern:
    case pwr_eClass_Input:
    case pwr_eClass_Output:
    case pwr_eClass_ObjXRef:
    case pwr_eClass_AttrXRef:
    case pwr_eClass_Buffer:
      attr_count++;
      break;
    default:
      ;
    }
    old = orep;
    orep = orep->after( &sts);
    old->ref();
    old->unref();
  }
  return attr_count;
}
Exemple #29
0
static pwr_tBoolean
buildScObjects (
  pwr_tStatus		*status,
  gdb_sVolume		*vp
)
{
  pool_sQlink		*scl;
  gdb_sScObject		*scp;

  pwr_dStatus(sts, status, GDH__SUCCESS); 

  /* Link all sc objects.  */

  for (
    scl = pool_Qsucc(sts, gdbroot->pool, &vp->u.n.sc_lh);
    scl != &vp->u.n.sc_lh;
    scl = pool_Qsucc(sts, gdbroot->pool, scl)
  ) {
    scp = pool_Qitem(scl, gdb_sScObject, sc_ll);

    vol_LinkScObject(sts, vp, scp, vol_mLinkSc_build);
    pwr_Assert(ODD(*sts));

  }
  return YES;
}
Exemple #30
0
base& base::power_int_mod(INT l, base &p)
{
	base a, b, c;
	
	a = *this;
	a.one();
	b = *this;
	// cout << "base:power_int_mod() x=" << *this << " l=" << l << " p=" << p << endl;
	while (l) {
		// cout << "= " << a << " * " << b << "^" << l << endl;
		if (EVEN(l)) {
			c.mult_mod(b, b, p);
			c.swap(b);
			l >>= 1;
			}
		// cout << "= " << a << " * " << b << "^" << l << endl;
		if (ODD(l)) {
			c.mult_mod(a, b, p);
			c.swap(a);
			l--;
			}
		}
	// cout << "= " << a << " * " << b << "^" << l << endl;
	*this = a;
	return *this;
}