Example #1
0
wb_object wb_volume::templateObject(pwr_tCid cid) const
{
  pwr_tOid oid;

  oid.oix = cdh_cixToOix( cdh_cidToCix(cid), pwr_eBix_template, 0);
  oid.vid = cdh_CidToVid( cid);

  return object(oid);
}
Example #2
0
//
// Help for class of an object in wnav
//
static pwr_tStatus HelpClass( ldh_sMenuCall *ip) 
{
  pwr_tStatus sts;
  int size;
  char cname[32];
  char vname[32];
  char cmd[200];
  pwr_tCid cid;
  pwr_tVid vid;
  
  sts = ldh_GetAttrRefTid( ip->PointedSession, &ip->Pointed, &cid);
  if ( EVEN(sts)) return sts;

  sts = ldh_ClassIdToName( ip->PointedSession, cid, cname, sizeof(cname), &size);
  if ( EVEN(sts)) return sts;

  vid = cdh_CidToVid(cid);
  if ( cdh_cManufactClassVolMin <= vid && vid <= cdh_cManufactClassVolMax) {
    /* Get help file for this volume */
    sts = ldh_VolumeIdToName( ldh_SessionToWB(ip->PointedSession), vid, vname, sizeof(vname), &size);
    if ( EVEN(sts)) return sts;

    cdh_ToLower( vname, vname);
    snprintf( cmd, sizeof(cmd), "help %s /helpfile=\"$pwr_exe/%s/%s_xtthelp.dat\"/strict", cname, 
	     lng_get_language_str(), vname);

    ip->wnav->command( cmd);
    return 1;
  }

  if ( cname[0] == '$')
    snprintf( cmd, sizeof(cmd), "help %s /strict", &cname[1]);
  else
    snprintf( cmd, sizeof(cmd), "help %s /strict", cname);

  ip->wnav->command( cmd);
  return 1;
}
Example #3
0
void
wb_dbs::cidInsert(pwr_tStatus *sts, pwr_tCid cid, pwr_sAttrRef *arp, sCentry **cep)
{
  *cep = (sCentry*)tree_Insert(sts, m_class_th, &cid);
  if ( !arp)
    return;

  if (*sts == TREE__INSERTED) {
    // Insert depending classes
    pwr_tCid *lst;
    pwr_sAttrRef *arlst;
    sCentry *entry;
    int cnt;
    pwr_tStatus lsts;
    pwr_sAttrRef aref;
    pwr_sAttrRef cast_aref;
    pwr_tCid cast_cid;

    m_v->merep()->classDependency( &lsts, cid, &lst, &arlst, &cnt);
    for ( int i = 0; i < cnt; i++) {
      aref = cdh_ArefAdd( arp, &arlst[i]);
      cidInsert(&lsts, lst[i], &aref, &entry);

      if ( aref.Flags.b.CastAttr) {
	cast_aref = cdh_ArefToCastAref( &aref);

	wb_volume v(m_v);
	wb_attribute a = v.attribute( &cast_aref);
	if ( a) {
	  a.value( &cast_cid);
	  if ( cast_cid != pwr_cNCid) {
	    wb_cdef cd = v.cdef( cast_cid);
	    if ( cd)
	      cidInsert(&lsts, cast_cid, 0, &entry);
	    else
	      printf("** Invalid cast class %s\n", cdh_ObjidToString( 0, aref.Objid, 1));
	  }
	}
      }
    }
    free(lst);
    free(arlst);
  }
  else if ( !(cdh_CidToVid(cid) == 1 && cdh_CidToVid(cid) == 2)) {
    // Check class of casted attribute for every instance
    pwr_tCid *lst;
    pwr_sAttrRef *arlst;
    sCentry *entry;
    int cnt;
    pwr_tStatus lsts;
    pwr_sAttrRef aref;
    pwr_sAttrRef cast_aref;
    pwr_tCid cast_cid;

    m_v->merep()->classDependency( &lsts, cid, &lst, &arlst, &cnt);
    for ( int i = 0; i < cnt; i++) {
      aref = cdh_ArefAdd( arp, &arlst[i]);

      if ( aref.Flags.b.CastAttr) {
	cast_aref = cdh_ArefToCastAref( &aref);

	wb_volume v(m_v);
	wb_attribute a = v.attribute( &cast_aref);
	if ( a) {
	  a.value( &cast_cid);
	  if ( cast_cid != pwr_cNCid) {
	    wb_cdef cd = v.cdef( cast_cid);
	    if ( cd)
	      cidInsert(&lsts, cast_cid, 0, &entry);
	    else
	      printf("** Invalid cast class %s\n", cdh_ObjidToString( 0, aref.Objid, 1));
	  }
	}
      }
    }
    free(lst);
    free(arlst);
  }
}