logical pc_ODC_FunctImp :: InitializeImplementations (PropertyHandle *source_ph )
{
  PropertyHandle *parms        = GPH("parameters");
  PropertyHandle *source_parms = source_ph->GPH("parameters");
  PropertyHandle *start_code   = GPH("start_code");
  PropertyHandle *error_code   = GPH("error_code");
  PropertyHandle *term_code    = GPH("term_code");
  PropertyHandle *memb_ph      = GetParentProperty()->GPH("SDB_Member");
  PropertyHandle *retval_name  = GetParentProperty()->GPH("retval_name");
  PropertyHandle *ddeinit      = GetParentProperty()->GPH("ddeinit");
  PropertyHandle *errorcase    = GetParentProperty()->GPH("errorcase");
  PropertyHandle  ret_ph;
  int32           indx0        = 0;
  std::string     data("");
  logical         term         = NO;
  while ( source_ph->Get(indx0++) )
  {
    Provide(source_ph->ExtractSortKey());
    parms->CopySet(*source_parms);
    
    if ( *retval_name->GetString() > ' ' )
    {
      data = "  ";
      if ( !memb_ph->ExecuteInstanceAction("DataTypeCString",NULL) )
      {
        data.append(memb_ph->GetActionResult());
        data.append("   ");
      }
      data.append(retval_name->GetString());
      if ( *ddeinit->GetString() > ' ' )
      {
        data.append(" = ");
        data.append(ddeinit->GetString());
      }
      data.append(";");
      *start_code = (char *)data.c_str();
      
      if ( *errorcase->GetString() > ' ' )
      {
        data = "  ";
        data.append(retval_name->GetString());
        data.append(" = ");
        data.append(errorcase->GetString());
        data.append(";");
        *error_code = (char *)data.c_str();
      }

      data = "  ";
      data.append("return(");
      data.append(retval_name->GetString());
      data.append(");");
      *term_code = (char *)data.c_str();
    }    
    
    Save();    
  }

  return(term);
}
logical pc_SDB_Relationship :: Check (ErrorProtocol *protocol, PropertyHandle *str_ph, PropertyHandle *cs_ph, PropertyHandle *ext_ph, logical base_opt )
{
  PropertyHandle  *ddetype  = GPH("ddetype");
  PropertyHandle  *ddeinv   = GPH("ddeinv");
  PropertyHandle  *ddeext   = GPH("ddeext");
  PropertyHandle  *ddesecr  = GPH("ddesecr");
  PropertyHandle  *str_rshp = NULL;
  PropertyHandle  *str_base = NULL;
  PropertyHandle  *inv_ph   = NULL;
  TypeKey          tkey;
  logical          term         = NO;
BEGINSEQ
  protocol->SetErrorVariable(2,GPH("sys_ident")->GetString(),0);

  term = pc_SDB_Reference::Check(protocol,str_ph,cs_ph,base_opt);
  GetTypeKey(tkey);

  if ( CheckExtend(protocol,str_ph,ext_ph,NULL) )
    term = YES;
    
  if ( !GPH("ddeext")->IsEmpty() )
    SetProperty("owning","N",protocol,"required when base extent");
  
  if ( !ddeinv->IsEmpty() )
  {
    if ( !str_ph->Get(tkey.GetKey()) )
    {
      if ( !term )
        protocol->Write(140,0);
      ERROR
    } 
    if ( GPH("week_typed")->IsTrue() && *ddetype == *GetParentProperty()->GPH("sys_ident") )
                                                     LEAVESEQ
    str_rshp = str_ph->GPH("smcershp");
    str_base = str_ph->GPH("smcebase");
    
    if ( str_rshp->Get(*ddeinv) )
      inv_ph = str_rshp;
    else
    {
      if ( !str_base->Get(*ddeinv) )
      {
        protocol->Write(191,0,NULL,NULL,GetScopedType(),ddeinv->GetString());
        ERROR
      }
      else if ( base_opt )
      {
        protocol->Write(195,0,NULL,NULL,GetScopedType(),ddeinv->GetString());
        ERROR
      }
      inv_ph = str_base;
    }
logical cMainFunctionEdit :: ErrorLookup ( )
{
  CTX_Project        *proj_ctx        = GetProjectContext();
  PropertyHandle     *prophdl         = GetPropertyHandle();    
  NString             command;
  NBuffer             buffer;
  logical             term            = NO;
BEGINSEQ
  if ( !prophdl->GetInstanceContext() )             ERROR
  if ( prophdl->ExecuteInstanceAction("GetProjectPath","ERC_Batch") )
    SetupOutput("Error providing command path\n",NO);
  else
  {
    command = prophdl->GetActionResult();
    command += "ShowErrors.bat";
    command += ' ';
    command += prophdl->GetString("sys_ident");
    ExecuteCommand(command,buffer,YES,NO);
    SetupOutput(buffer,YES);
  }


RECOVER
  term = YES;
ENDSEQ
  return(term);
}
logical sBase_SharedData :: InitKey (char *prop_path, char *extnames )
{
  PropertyHandle    *ph        = GetPropertyHandle();
  PropertyHandle    *kennung   = ph->GPH("kennung");
  PropertyHandle    *id        = ph->GPH(prop_path);
  char               idkey[16];
BEGINSEQ
  if ( kennung->IsEmpty() )
    kennung->SetValue(::GetEigentuemerKennung(),NO);
    
  if ( extnames && id->IsEmpty() )
  {
    id->SetValue(1,NO);  

    PropertyHandle    all(ph->GetObjectHandle(),extnames,PI_Read);
                                                    SDBCERR
    all.SetOrder("ik_kennung");
    memset(idkey,0,sizeof(idkey));
    *idkey = *kennung->GetString();
    if ( !all.LocateKey(Key(idkey)) )
      all.Position(-1);
    else
      all.Get(LAST_INSTANCE);
    if ( all.IsPositioned() )
      if ( *all.GPH("kennung") == *kennung )
        id->SetValue(all.GPH(prop_path)->GetInt()+1,NO);  
  }

RECOVER

ENDSEQ
  return(NO);
}
char *pc_ODC_Variable :: DataTypeCString (NString &nstring )
{
  PropertyHandle   *ddetype   = GPH("ddetype");
  char             *save_type = NULL;
  logical           term      = NO;
BEGINSEQ
  if ( GPH("const_val")->IsTrue() )
  {
    nstring += "const";
    nstring.Append(' ');
  }

  if ( TestSysVariable("C_INTERFACE","Y") )
  {
    PropertyHandle   inst_coll(GetDBHandle(),"InstCollection",PI_Read);
                                                    SDBCERR
	PropertyHandle phCInterface("CInterface");
    if ( !inst_coll(phCInterface) ) SDBERR(99)

    if ( inst_coll.GPH("collection")->Get(*ddetype) )
    {
      save_type = strdup(ddetype->GetString());
      ddetype->SetValue("void",NO);
    }
  } 
예제 #6
0
char *InputArea :: GetLine (char *string )
{
  PropertyHandle  *in    = input_ctx ? input_ctx->GetPropertyHandle() : NULL;
  logical          term  = NO;

BEGINSEQ
  input = "";
  if ( !in )                                        ERROR
  
  input = in->GetString();
  *in = "";
  input_ctx->FillControl();
  input_ctx->FlushGUI();

  if ( string )
    strcpy(string,input);
RECOVER
  if ( string ) *string = 0;
ENDSEQ
  return(input);
}
logical pc_ADK_Field :: SetupField ( )
{
  PropertyHandle        *pfc = GetParentProperty();
  PropertyHandle        *my_class  = pfc->GPH("class");
  PropertyHandle        *member;
  PropertyHandle        *fc;
  logical                vgrow = YES;
  logical                hgrow = YES;
  logical                coll_opt;
  char                  *ref_type;  
  char                  *propnames = NULL;
  char                   strnames[ID_SIZE+1];
  logical                term = NO;
BEGINSEQ
  if ( IsInitialized() )                             LEAVESEQ
    
  propnames = strdup(GPH("sys_ident")->GetString());
    
  SetupFromParent();
  
  if ( !my_class->Get(FIRST_INSTANCE) )              ERROR
    
  pc_ADK_Class   new_class(GetObjectHandle(),PI_Update);  
  PropertyHandle extent(GetObjectHandle(),"SDB_Extend",PI_Read);  
  PropertyHandle phpropnames(propnames);
  pc_ADK_Class    structure(*my_class);  
  if ( member = structure.GetMember(propnames) )
  {
    if ( !(fc = new_class.ProvideDefaultControl(member,hgrow,vgrow)) ||
         !fc->Exist()  )                             ERROR
    coll_opt = pc0_SDB_Member(member).IsMultipleRef() ? YES : NO;
    ref_type = "DRT_PropertyPath";
    strcpy(strnames,member->GetString("ddetype"));
  }
  else if ( extent.Get(phpropnames) )
  {
    if ( !(fc = new_class.ProvideDefaultControl(&extent,hgrow,vgrow)) ||
         !fc->Exist()  )                             ERROR
    coll_opt = YES;
    ref_type = "DRT_Extent";
    strcpy(strnames,extent.GetString("ddetype"));
  }
  else                                               ERROR
    
  if ( !hgrow )
    *GPH("allign.hori_sizing") = "SIZE_Fixed";
  if ( !vgrow )
    *GPH("allign.vert_sizing") = "SIZE_Fixed";
  
  *GPH("auto_open") = YES;
  SetupDataSource(propnames,ref_type,coll_opt);
  SetupFromFieldControl(fc);
  SetupTitle(propnames);

  GPH("class")->Add(new_class.ExtractKey());        CTXCERR
  GPH("field_control")->Add(fc->ExtractKey());      CTXCERR


RECOVER
  term = YES;
ENDSEQ
  if ( propnames )
    free(propnames);
  return(term);
}