Beispiel #1
0
/////////////////////////////////////////////////////////////////////////////
//
//    OPERATION: zwTZERRORD_ErrorListSelectEntity
//
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT /*DIALOG */  OPERATION
zwTZERRORD_ErrorListSelectEntity( zVIEW vSubtask )
{
   zVIEW  vTZERROR;
   zVIEW  vERD;

   if ( GetViewByName( &vERD, "TZEREMDO", vSubtask, zLEVEL_TASK ) < 0 )
      return( -1 );

   if ( GetViewByName( &vTZERROR, "TZERROR", vSubtask, zLEVEL_TASK ) >= 0 )
   {
      if ( SetCursorFirstEntityByAttr( vERD, "ER_Entity", "Name",
                                       vTZERROR, "ErrorMsg", "Name",
                                       "" ) >= zCURSOR_SET )
      {
      //BLZ   zwTZEREMDD_SetEntitySelect( vSubtask );
      }
   }

   return( 0 );

} // zwTZERRORD_ErrorListSelectEntity
Beispiel #2
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: zofnTZSIXSKO_BldXSKChildEnt
//
// PURPOSE:
//
// TRIGGLODED BY:
//    WINDOW: TZZOLODD
//    ACTION: OPTION
//    NAME: File_Save
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
zofnTZSIXSKO_BldXSKChildEnt ( zVIEW vKZSIXSKO_Root,
                              zVIEW vKZSIXSKO, zVIEW vTZZOXOD1,
                              zVIEW vTZTENVRO_REF,
                              zSHORT nEntityFlag )
{
   zVIEW  vTZTENVRO_Parent;
   zSHORT nRC;
   zSHORT nRC2;
   zPCHAR szDBMS;
   zSHORT nEntImpls;
   zLONG  lEntityZKey;
   zSHORT nEntitySet    = nEntityFlag;
   zSHORT nSetViewToSubXsk = 0;

   nRC = CreateViewFromViewForTask( &vTZTENVRO_Parent, vTZTENVRO_REF, 0 );

   nRC = zCURSOR_SET;
   while ( nRC >= zCURSOR_SET )
   {
      nRC = SetViewToSubobject( vTZZOXOD1, "CHILDENTITY" );

      /* Check physik, if no, then do not process this entity */
      if ( (nRC = CheckExistenceOfEntity ( vTZZOXOD1, "DATARECORD" )) >= zCURSOR_SET )
      {

         nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1,
                                        "ENTITY", "ERENT_TOK" );
         nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                              "ZKey", lEntityZKey,
                                              "TE_DBMS_Source" );
         if ( nRC < zCURSOR_SET )
         {
            GetAddrForAttribute( &szDBMS,
                                 vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS" );
            nEntImpls = 0;
            for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                "ZKey", lEntityZKey,
                                                "TE_DB_Environ" );
                  nRC > zCURSOR_UNCHANGED;
                  nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                "ZKey", lEntityZKey,
                                                "TE_DB_Environ" ) )
            {
               if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS",
                               szDBMS ) == 0 )
               {
                  nEntImpls++;
               }
            }
            if ( nEntImpls == 1 )
            {
               nRC = zCURSOR_SET;
            }
            else
            if ( nEntImpls > 1 )
            {
              for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                  "ZKey", lEntityZKey,
                                                  "TE_DB_Environ" );
                    nRC > zCURSOR_UNCHANGED;
                    nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity",
                                                  "ZKey", lEntityZKey,
                                                  "TE_DB_Environ" ) )
              {
                 if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS",
                                szDBMS ) == 0 )
                 {
                    zstrcpy( szMsg, "Do you want to use Data Source '" );
                    GetAddrForAttribute( &szMsgName,
                                         vTZTENVRO_Parent, "TE_DBMS_Source", "Name" );
                    zstrcat( szMsg, szMsgName );
                    zstrcat( szMsg, "' to implement ER Entity '" );
                    GetAddrForAttribute( &szMsgName,
                                         vTZTENVRO_Parent, "ER_Entity", "Name" );
                    zstrcat( szMsg, szMsgName );
                    zstrcat( szMsg, "'?" );
                    nRC = MessagePrompt ( vTZTENVRO_Parent, "XOD_06", "TE Choice",
                                          szMsg, 0, zBUTTONS_YESNO, 0, 0 );
                    if ( nRC == zRESPONSE_YES )
                        break;   // found Entity implemented in same DBMS
                 }
              }
            }

            if ( nRC < zCURSOR_SET )
            {
               zstrcpy( szMsg, "Unable to Find Entity in TE Data Source with same DBMS.\n\nEntity Name = " );
               GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ER_EntityRec", "Name" );
               zstrcat( szMsg, szMsgName );
               nRC = MessagePrompt( vTZZOXOD1, "XOD_06", "Internal LOD Error", szMsg, 0,
                                    zBUTTONS_OK, 0, 0 );
               nRC = DropView( vTZTENVRO_Parent );
               return( 0 );
            }
         }

         //  new Entity found
         //  if SironGroup exists
         //     if SironKatalog exists
         //        create new Katalog
         //     create next ENTITY and ENTITYCOM entities
         //     create dependent ATTRIB and ATTRICOM entities
         nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironGroup" );
         if ( nRC >= zCURSOR_SET )
         {
          nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironKatalog" );
          if ( nRC >= zCURSOR_SET )
          {
            // Go back to KATALOG entity
            if ( nEntitySet )
            {
              while ( ResetViewFromSubobject( vKZSIXSKO_Root ) == 0 );
            }

            // Create new  KATALOG entity
            nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "KATALOG", "" );
            nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER );
            SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG",
                                        vTZTENVRO_Parent, "SironKatalog", zSET_ALL );

            for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent,
                                            "KatalogComment", "SironKatalog");
                  nRC > zCURSOR_UNCHANGED;
                  nRC = SetCursorNextEntity( vTZTENVRO_Parent,
                                             "KatalogComment", "SironKatalog") )
            {
              CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER );
              SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM",
                                           vTZTENVRO_Parent, "KatalogComment", zSET_ALL );
            }
          }

          // ViewToSubobject only, if caller created an ENTITY entity
          if ( nEntitySet )
          {
            if ( CheckExistenceOfEntity( vKZSIXSKO_Root, "ENTITY" )
                                                             >= zCURSOR_SET )
            {
               SetViewToSubobject( vKZSIXSKO_Root, "ENTITYCHILD" );
               nSetViewToSubXsk = 1;
            }
          }

          // Create next ENTITY entity
          nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "ENTITY", "" );
          nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER );
          nEntitySet = 1;
          SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY",
                                      vTZTENVRO_Parent, "SironGroup", zSET_ALL );
          SetAttributeFromInteger( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK",
                                   lEntityZKey );

          for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup");
                nRC > zCURSOR_UNCHANGED;
                nRC = SetCursorNextEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup") )
          {
            CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER );
            SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM",
                                         vTZTENVRO_Parent, "GroupComment", zSET_ALL );
          }

          // Create all dependent ATTRIB entities according to XOD ATTRIB
          // entities
          for ( nRC  = SetCursorFirstEntity( vTZZOXOD1, "ATTRIB", "ENTITY");
                nRC  > zCURSOR_UNCHANGED;
                nRC  = SetCursorNextEntity( vTZZOXOD1, "ATTRIB", "ENTITY") )
          {
             nRC = SetCursorFirstEntityByAttr( vTZTENVRO_Parent,
                                               "TE_FieldDataRel","Name",
                                               vTZZOXOD1, "ATTRIB", "NAME",
                                               "TE_TablRec");

             nRC = CheckExistenceOfEntity( vTZTENVRO_Parent, "SironField" );
             if ( nRC < zCURSOR_SET )
             {
               zstrcpy( szMsg,
       "Unable to Find SironField in TE Data Source .\n\nAttribute Name = " );
               GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ATTRIB", "NAME" );
               zstrcat( szMsg, szMsgName );
               nRC = MessagePrompt ( vTZZOXOD1, "XOD_06",
                                     "Internal XOD Error", szMsg,
                                     0, zBUTTONS_OK, 0, 0 );
               nRC = DropView( vTZTENVRO_Parent );
               return( 0 );
             }

             CreateEntity( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER );
             SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB",
                                          vTZTENVRO_Parent, "SironField", zSET_ALL );
             SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK",
                                        vTZZOXOD1,      "ATTRIB", "XVAATT_TOK" );

             // Create all dependent ATTRIBCOM entities
             for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent,
                                               "SironFieldComment","SironField");
                   nRC > zCURSOR_UNCHANGED;
                   nRC = SetCursorNextEntity( vTZTENVRO_Parent,
                                              "SironFieldComment","SironField"))
             {
               CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER );
               SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM",
                                            vTZTENVRO_Parent, "SironFieldComment",
                                            zSET_ALL );
             }
          }
        }
      }

      // Abstieg des Pfades
      nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" );
      if ( nRC >= zCURSOR_SET )
              zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO,
                   vTZZOXOD1, vTZTENVRO_Parent, nEntitySet );

      nRC2 = ResetViewFromSubobject( vTZZOXOD1 );
      if ( nSetViewToSubXsk )
      {
        nRC2 = ResetViewFromSubobject( vKZSIXSKO_Root );
        nSetViewToSubXsk = 0;
      }

      nRC  = SetCursorNextEntity( vTZZOXOD1, "CHILDENTITY", "" );
   }

   if ( vTZTENVRO_Parent )
      nRC = DropView( vTZTENVRO_Parent );

   return( 0 );
}
Beispiel #3
0
/////////////////////////////////////////////////////////////////////////////
//
// OPERATION: zofnTZSIXSKO_BldXSK
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
zofnTZSIXSKO_BldXSK ( zVIEW vKZSIXSKO_Root,
                      zVIEW vKZSIXSKO, zVIEW vTZZOXODO,
                      zVIEW vTZTENVRO_REF )
{
   zVIEW  vTZZOXOD1;
   zVIEW  vTZZOXOD_TestWorkAttrib;
   zVIEW  vTZTENVR1;
   zPCHAR szDBMS;
   zSHORT nEntImpls;
   zSHORT nRC;
   zLONG  lEntityZKey;
   zSHORT nAttrCount = 0;
   zSHORT nEntitySet = 0;

   nRC = CreateViewFromViewForTask( &vTZTENVR1, vTZTENVRO_REF, 0 );
   nRC = CreateViewFromViewForTask( &vTZZOXOD1, vTZZOXODO, 0 );

   nRC = SetCursorFirstEntity( vTZZOXOD1, "ENTITY", "" );

   /*=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?
   ?? Was ist hier mit Work Entities ?
   ?? Wie koennen diese umgangen werden
   ?? natuerlich auch fuer Kinder beruecksichtigen
   **=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?*/

   /* Check physik, if no, then do not process this entity */
   if ( (nRC = CheckExistenceOfEntity( vTZZOXOD1,
                                       "DATARECORD" )) >= zCURSOR_SET )
   {
     // Suche SironKatalog in TE
     nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1, "ENTITY",
                                    "ERENT_TOK" );
     nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity",
                                          "ZKey", lEntityZKey,
                                          "TE_DBMS_Source" );
     if ( nRC < zCURSOR_SET )
     {
         GetAddrForAttribute( &szDBMS,
                              vTZTENVR1, "TE_DBMS_Source", "DBMS" );
           nEntImpls = 0;
           for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity",
                                                      "ZKey", lEntityZKey,
                                                      "TE_DB_Environ" );
               nRC > zCURSOR_UNCHANGED;
               nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity",
                                             "ZKey", lEntityZKey,
                                             "TE_DB_Environ" ) )
           {
              if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source",
                                             "DBMS", szDBMS ) == 0 )
              {
                 nEntImpls++;
              }
           }

           if ( nEntImpls == 1 )
           {
              nRC = zCURSOR_SET;
           }
           else
           if ( nEntImpls > 1 )
           {
              for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity",
                                                         "ZKey", lEntityZKey,
                                                         "TE_DB_Environ" );
                    nRC > zCURSOR_UNCHANGED;
                    nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity",
                                                        "ZKey", lEntityZKey,
                                                        "TE_DB_Environ" ) )
              {
                 if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source",
                                                "DBMS", szDBMS ) == 0 )
                 {
                    zstrcpy( szMsg, "Do you want to use Data Source '" );
                    GetAddrForAttribute( &szMsgName,
                                    vTZTENVR1, "TE_DBMS_Source", "Name" );
                    zstrcat( szMsg, szMsgName );
                    zstrcat( szMsg, "' to implement ER Entity '" );
                    GetAddrForAttribute( &szMsgName,
                                         vTZTENVR1, "ER_Entity", "Name" );
                    zstrcat( szMsg, szMsgName );
                    zstrcat( szMsg, "'?" );
                    nRC = MessagePrompt ( vTZTENVR1, "XOD_06", "TE Choice",
                                         szMsg, 0, zBUTTONS_YESNO, 0, 0 );
                    if ( nRC == zRESPONSE_YES )
                       break;   // found Entity implemented in same DBMS
                 }
              }
           }

           if ( nRC < zCURSOR_SET )
           {
              zstrcpy( szMsg,
                       "Unable to Find Entity in TE Data Source with same "
                         "DBMS.\n\nEntity Name = " );
              GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ENTITY", "NAME" );
              zstrcat( szMsg, szMsgName );
              nRC = MessagePrompt( vTZZOXOD1, "XOD_03",
                                   "Internal LOD Error", szMsg,
                                   0, zBUTTONS_OK, 0, 0 );
              return( 0 );
           }
     }

     // Now: First Entity found
     //      if SironKatalog Exits
     //         create KATALOG and KATCOM entities
     //         create first ENTITY and ENTITYCOM entities
     //         create dependent ATTRIB and ATTRICOM entities
     nRC = CheckExistenceOfEntity ( vTZTENVR1, "SironKatalog" );
     if (  nRC >= zCURSOR_SET )
     {
        // Create KATALOG entity
        nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER );
        SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG",
                               vTZTENVR1, "SironKatalog", zSET_ALL );

        for ( nRC = SetCursorFirstEntity( vTZTENVR1,
                                   "KatalogComment", "SironKatalog");
              nRC > zCURSOR_UNCHANGED;
              nRC = SetCursorNextEntity( vTZTENVR1,
                                  "KatalogComment", "SironKatalog") )
        {
          CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER );
          SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM",
                             vTZTENVR1, "KatalogComment", zSET_ALL );
        }

        // Create first ENTITY entity
        nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER );
        nEntitySet = 1;
        SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY",
                                    vTZTENVR1, "OrigSironField", zSET_ALL );
        SetAttributeFromAttribute( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK",
                                   vTZZOXOD1,      "ENTITY", "ERENT_TOK" );

        for ( nRC = SetCursorFirstEntity( vTZTENVR1,
                                          "FieldComment", "OrigSironField");
              nRC > zCURSOR_UNCHANGED;
              nRC = SetCursorNextEntity( vTZTENVR1,
                                        "FieldComment", "OrigSironField") )
        {
          CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER );
          SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM",
                                       vTZTENVR1, "FieldComment",
                                       zSET_ALL );
        }

        // Create all dependent ATTRIB entities
        //                             according to XOD ATTRIB entities
        for ( nRC = SetCursorFirstEntity( vTZZOXOD1, "ATTRIB", "ENTITY");
              nRC > zCURSOR_UNCHANGED;
              nRC = SetCursorNextEntity( vTZZOXOD1, "ATTRIB", "ENTITY") )
        {
          // If the Attribute is a Workattribute there is no Datafield.
          // Do not save the Workattributes in the XSK-file.
          nRC = CreateViewFromViewForTask( &vTZZOXOD_TestWorkAttrib, vTZZOXOD1, 0 );
          nRC = SetCursorFirstEntityByAttr (vTZZOXOD_TestWorkAttrib, "DATAFIELD",
                                            "FLDNAME",
                                            vTZZOXOD1, "ATTRIB", "NAME", "");

          if (nRC == zCURSOR_SET)
          {
             nRC = SetCursorFirstEntityByAttr
                        ( vTZTENVR1, "TE_FieldDataRel", "Name",
                          vTZZOXOD1, "ATTRIB", "NAME", "TE_TablRec");


             CreateEntity ( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER );
             SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB",
                                       vTZTENVR1, "SironField", zSET_ALL );
             SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK",
                                     vTZZOXOD1,      "ATTRIB", "XVAATT_TOK" );
             // Create all dependent ATTRIBCOM entities
             for ( nRC = SetCursorFirstEntity( vTZTENVR1,"SironFieldComment","SironField");
                nRC > zCURSOR_UNCHANGED;
                nRC = SetCursorNextEntity( vTZTENVR1,"SironFieldComment","SironField") )
             {
                CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER );
                SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM",
                                         vTZTENVR1, "SironFieldComment", zSET_ALL );
             }
          }

          DropView( vTZZOXOD_TestWorkAttrib );
        }
     }
   }

   nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" );
   if ( nRC >= zCURSOR_SET )
        zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXOD1,
                                     vTZTENVRO_REF, nEntitySet );

   nRC = DropView( vTZZOXOD1 );
   nRC = DropView( vTZTENVR1 );
   return( 0 );
}
Beispiel #4
0
//
// OPERATION: SetStackObjectFromViews
//
// DESCRIPTION: SetStackObjectFromViews creates an operation entity in the
//    Stack call object an copies all of the variable data thers as well.
//
//
//
zOPER_EXPORT zSHORT OPERATION
SetStackObjectFromViews( zVIEW  lpInterpSubtask,            // interp subtask
                         zVIEW  vXPG,                      // View to the XPG
                         zVIEW  vStmtView,           // View to the statement
                         zSHORT nIndex )         // index into the expression
{
   zSHORT nRC;                                          // a Return code
   //zSHORT nPrevOperation;                                       // a ret code
   zVIEW  vStackObject;                           // view to the stack object
   //zVIEW  vPriorOperation; // view to the prior operation in the stack object

   // Get the stack object as it was loaded with the XPG
   nRC =
      GetViewByName( &vStackObject,
                     "StackObject",
                     lpInterpSubtask,
                     zLEVEL_SUBTASK );
   if ( nRC != zLEVEL_SUBTASK )
   {
      return( -1 );
   }

   SfLockView( vXPG );
   SfLockView( vStmtView );

// DGC 8/19/02
// vPriorOperation doesn't appear to be used outside of this function, so
// I'm removing the code.
#if 0
   nRC =
      CreateViewFromViewForTask( &vPriorOperation,
                          vStackObject, 0 );


   nPrevOperation =
      SetCursorPrevEntity( vPriorOperation,
                           "OperationCall", "" );
#endif

   if ( SetCursorFirstEntityByAttr( vStackObject, "OperationCall", "Name",
                                    vXPG, "Operation", "Name", 0 ) < zCURSOR_SET )
   {
      // create an operation entity at the end of the list ( stack )
      CreateEntity( vStackObject, "OperationCall", zPOS_AFTER );


      // set the name of the operation that was called.
      SetAttributeFromAttribute( vStackObject, "OperationCall", "Name",
                                 vXPG, "Operation", "Name" );
   }

   // set the views
   SetAttributeFromInteger( vStackObject, "OperationCall", "XPGView",
                            (zLONG) vXPG );

   // set the views
   SetAttributeFromInteger( vStackObject, "OperationCall", "StatementView",
                            (zLONG) vStmtView );
   // set the offset
   SetAttributeFromInteger( vStackObject, "OperationCall", "StatementOffset",
                            nIndex );

   // now loop through and do all of the variables
   for ( nRC = SetCursorFirstEntity( vXPG, "Variable", "" );
         nRC >= zCURSOR_SET;
         nRC = SetCursorNextEntity( vXPG, "Variable", "" ) )
   {
      // Check to see if the variable already exists in the stack object.  It
      // will exist if the interpreter is being called from a different app
      // (like Core) and the app has set up the arguments already.
      if ( SetCursorFirstEntityByAttr( vStackObject, "Variable", "Name",
                                       vXPG, "Variable", "Name", 0 ) < zCURSOR_SET )
      {
         CreateEntity( vStackObject, "Variable", zPOS_LAST );
      }

      SetMatchingAttributesByName( vStackObject, "Variable",
                                   vXPG, "Variable", zSET_NULL );
   }

   SetCursorFirstEntity( vStackObject, "Variable", "" );
   SetCursorFirstEntity( vXPG, "Variable", "" );

// DropView( vPriorOperation );
   return( 0 );
}
Beispiel #5
0
static void ProcessXods( HWND hWnd, zVIEW vSubtask,
                          zCHAR *cTE_Name, zCHAR *cLogFile, zCHAR cNet )
{
   FILE *fLog=NULL;
   zVIEW vTaskLPLR = NULL;
   zCHAR szMsg[ 256 ];
   zVIEW vTZTEDBLO, vDTE, vCM_List;
   zVIEW vLOD, vLOD_List, vXOD;
   zVIEW vTemp = NULL;
   zVIEW vT=NULL;
   zSHORT nRC;
   RECT rect;
   LPLIBRARY hLib = NULL;
   zCHAR szLODName[ 32 ];
   zCHAR szFileName[ 256 ];
   zCHAR szNetwork[ 256 ];

   if ( cLogFile && cLogFile[0] )
      fLog = fopen( cLogFile, "w");

   memset (szNetwork, 0, 256);
   SysReadZeidonIni( -1, "[Zeidon]", "DefaultNetWork", szNetwork );
   if (*szNetwork == 0)
   {
      strcpy( szMsg, "No default Network set" );
      MessageBox( hWnd, szMsg,
                  "Error Running xodgen",
                  MB_OK | MB_ICONSTOP | MB_APPLMODAL );
      zstrcat( szMsg, "\n" );
      if ( fLog )
      {
         fputs( szMsg,fLog );
         fclose (fLog);
      }
      return;
   }

   ActivateOI_FromFile( &vTZTEDBLO, "tztedblo", vSubtask, "tztedblo.xdl",
                        zMULTIPLE );
   SetNameForView( vTZTEDBLO, "TZTEDBLO", 0, zLEVEL_TASK );

   //oTZTENVRO_GetUpdViewForDTE_P
   nRC = RetrieveViewForMetaList( vSubtask, vSubtask, &vCM_List, zSOURCE_DTE_META );

   nRC = ActivateMetaOI( &vDTE, vCM_List, zSOURCE_DTE_META,
                            zSINGLE | zACTIVATE_ROOTONLY );
   if ( nRC < 0 )
   {
      strcpy( szMsg, "Internal error activating TE" );
      MessageBox( hWnd, szMsg,
                  "Error Running xodgen",
                  MB_OK | MB_ICONSTOP | MB_APPLMODAL );
      zstrcat( szMsg, "\n" );
      if ( fLog )
      {
         fputs( szMsg,fLog );
         fclose (fLog);
      }
      return;
   }
   SetNameForView( vDTE, "TE_DB_Environ", vSubtask, zLEVEL_TASK );
   // Position on given DBMS Source
   nRC = SetCursorFirstEntityByString( vDTE,
               "TE_DBMS_Source", "Name", cTE_Name, 0 );
   if ( nRC < zCURSOR_SET )
   {
      strcpy( szMsg, "Invalid TE Name :");
      strcat( szMsg, cTE_Name );
      MessageBox( hWnd, szMsg,
                  "Error Running xodgen",
                  MB_OK | MB_ICONSTOP | MB_APPLMODAL );
      zstrcat( szMsg, "\n" );
      if ( fLog )
      {
         fputs( szMsg,fLog );
         fclose (fLog);
      }
      return;
   }

   nRC = GetViewByName( &vTaskLPLR, "TaskLPLR", 0, zLEVEL_TASK );
   assert(nRC >= 0 ) ;

   // Check for network build
   if ( cNet )
   {
      // Use default network for Ton Beller (DBMS = "Network Server")
      SetCursorFirstEntityByString( vTZTEDBLO, "TE_DBMS_Source", "Network",
                                    szNetwork, 0 );
      SetAttributeFromAttribute( vDTE,      "TE_DBMS_Source", "DBMS",
                                 vTZTEDBLO, "TE_DBMS_Source", "DBMS" );
      SetAttributeFromAttribute( vDTE,      "TE_DBMS_Source", "Network",
                                 vTZTEDBLO, "TE_DBMS_Source", "Network" );
   }
   else
   {
      // Position on corresponding DBMS entry in DB Handler object.
      SetCursorFirstEntityByAttr( vTZTEDBLO, "TE_DBMS_Source", "DBMS",
                                 vDTE, "TE_DBMS_Source", "DBMS", 0 );

   }


   //zwTZTEUPDD_BuildXODsOnLPLR( zVIEW vSubtask )

   // Create a view that lists all LODs.

   RetrieveViewForMetaList( vSubtask, vSubtask, &vLOD_List, zREFER_LOD_META );
   OrderEntityForView( vLOD_List, "W_MetaDef", "Name A" );
   SetNameForView( vLOD_List, "TZZOLFLO", vSubtask, zLEVEL_TASK );

   // Loop through each of the LOD's
   // WMetaType.Type= zREFER_LOD_META
   //
   for ( nRC = SetCursorFirstEntity( vLOD_List, "W_MetaDef", "" );
         nRC >= zCURSOR_SET;
         nRC = SetCursorNextEntity( vLOD_List, "W_MetaDef", "" ) )
   {

      GetStringFromAttribute( szLODName,
                              vLOD_List, "W_MetaDef", "Name" );

      nRC = ActivateMetaOI( &vLOD, vLOD_List, zREFER_LOD_META, zCURRENT_OI );
      if ( nRC < 0 )
      {
         zstrcpy( szMsg, "Could not Activate LOD: " );
         zstrcat( szMsg, szLODName );
         zstrcat( szMsg, ".\nAborting Build" );

         MessageBox( hWnd,
                  szMsg,
                  "Error Running xodgen",
                  MB_OK | MB_ICONSTOP | MB_APPLMODAL );

         zstrcat( szMsg, "\n" );
         if ( fLog )
         {
            fputs( szMsg,fLog );
            fclose (fLog);
         }

         return ;
      }
      else
      {
         // Send message that we are building the LOD.
         strcpy( szMsg, "Building executable for LOD: " );
         strcat( szMsg, szLODName );
         strcat( szMsg, "." );
         strcpy( szOutLine, szMsg );
         GetClientRect( hWnd, &rect );
         InvalidateRect( hWnd, &rect, TRUE );
         UpdateWindow( hWnd );

         if ( fLog )
         {
           zstrcat( szMsg, "\n" );
           fputs( szMsg,fLog );
         }
         else
            TraceLineS( szMsg, "" );

         // Make sure the TE_SourceZKey attribute is set because it determines
         // what DBMS_Source is used in building the XOD.
         if ( CheckExistenceOfEntity( vLOD, "POD" ) >= zCURSOR_SET )
            SetAttributeFromAttribute ( vLOD, "POD", "TE_SourceZKey",
                                       vDTE, "TE_DBMS_Source", "ZKey" );

         // Build the XOD in memory
         oTZZOXODO_SaveXOD( vLOD );
         SetNameForView( vLOD, "TZZOLODO", 0, zLEVEL_TASK );
         DropMetaOI( vSubtask, vLOD );

         // Commit the XOD to LPLR file.
         GetViewByName( &vXOD, "TZZOXODO", 0, zLEVEL_TASK );
         GetStringFromAttribute( szFileName,
                                 vTaskLPLR, "LPLR", "ExecDir" );
         ofnTZCMWKSO_AppendSlash( szFileName );
         zstrcat( szFileName, szLODName );
         zstrcat( szFileName, ".XOD" );
         CommitOI_ToFile( vXOD, szFileName, zSINGLE );
      }
   }

   if (fLog)
      fclose (fLog);
   else
      TraceLineS( "Completed XOD build", "" );

   return;

}
Beispiel #6
0
/*

   This operation builds the operation list for the OperationList window.
   Depending on what the value is for vProfileXFER.ED.OpIns_CurrentType
   we build different operations lists.

*/
zOPER_EXPORT zSHORT OPERATION
OpIns_BuildOperList( zVIEW vSubtask )
{
#define DISP_SELECT_SET    1
#define SEL_SELECT_SET     2

   zCHAR  szCurrentType[ 5 ];
   zVIEW  vProfileXFER;
   zVIEW  vEdWrk;
   zSHORT nRC;
   zCHAR  szKeyword[ 255 ];
   zLONG  lSelectCount = 0;

   GetWorkView( &vEdWrk );
   GetProfileView( &vProfileXFER );
   GetStringFromAttribute( szCurrentType, vProfileXFER, "ED",
                           "OpIns_CurrentType" );

   // Default of CurrentType is 'Z'...
   if ( *szCurrentType == 0 )
   {
      zstrcpy( szCurrentType, "Z" );
      SetAttributeFromString( vProfileXFER, "ED", "OpIns_CurrentType",
                              szCurrentType );
   }

   // Check to see if the operations for the current type are already
   // loaded. If they are, then we obviously don't need to load them again.
   if ( SetCursorFirstEntityByString( vEdWrk, "OperListType", "Type",
                                      szCurrentType, 0 ) != zCURSOR_SET )
   {
      // Operations haven't been loaded yet, so load 'em up.

      CreateEntity( vEdWrk, "OperListType", zPOS_LAST );
      SetAttributeFromString( vEdWrk, "OperListType", "Type", szCurrentType );

      switch ( *szCurrentType )
      {
         case 'Z':
         {
            zVIEW vTZOPSIGK;

            // Get list of Zeidon operations.

            // Check to see if we've already activated the Zeidon opers list.
            // If not, activate it and save the view.
            GetViewByName( &vTZOPSIGK, "TZOPSIGK", vSubtask, zLEVEL_TASK );
            if ( !vTZOPSIGK )
            {
               oTZOPGRPO_GetViewForXGO( vSubtask, &vTZOPSIGK, zSYS_CURRENT_OI );
               SetNameForView( vTZOPSIGK, "TZOPSIGK", vSubtask, zLEVEL_TASK );
            }

            // Now copy each of the operations to the editor work object.
            for ( nRC = SetCursorFirstEntity( vTZOPSIGK, "Operation", 0 );
                  nRC == zCURSOR_SET;
                  nRC = SetCursorNextEntity( vTZOPSIGK, "Operation", 0 ) )
            {
               CreateEntity( vEdWrk, "Oper", zPOS_LAST );
               SetMatchingAttributesByName( vEdWrk, "Oper",
                                            vTZOPSIGK, "Operation", zSET_ALL );
            }

            break;
         } // Case 'Z'...

         case 'G':
         {
            zVIEW vOp;

            // Get list of Global operations.

            RetrieveViewForMetaList( vSubtask, &vOp, zREFER_GO_META );

            // Now copy each of the operations to the editor work object.
            for ( nRC = SetCursorFirstEntity( vOp, "W_MetaDef", 0 );
                  nRC == zCURSOR_SET;
                  nRC = SetCursorNextEntity( vOp, "W_MetaDef", 0 ) )
            {
               CreateEntity( vEdWrk, "Oper", zPOS_LAST );
               SetMatchingAttributesByName( vEdWrk, "Oper",
                                            vOp, "W_MetaDef", zSET_ALL );
            }

            DropView( vOp );

            break;
         } // Case 'G'...

         case 'L':
         {
            zVIEW vMeta;
            zLONG lMetaType;

            // Get list of "Local" operations.  "Local" operations in this
            // case mean all operations that are for the current meta.
            // For example, if the current meta is a Dialog, then the "Local"
            // operations include local and Dialog operations.

            // Get the source view and the meta type.
            GetIntegerFromAttribute( (zPLONG) &vMeta, vEdWrk, "Buffer",
                                     "SourceViewID" );
            GetIntegerFromAttribute( &lMetaType, vEdWrk, "Buffer",
                                     "MetaType" );

            // Create a new, temp view of the meta so that we can muck around
            // with the cursors.
            CreateViewFromViewForTask( &vMeta, vMeta, 0 );

            //
            // Now copy the "Local" meta operations to vEdWrk.
            //

            if ( lMetaType == zREFER_DIALOG_META ||
                 lMetaType == zREFER_LOD_META )
            {
               // Make sure we are reading the "Local" operations for
               // the current source file.
               SetCursorFirstEntityByAttr( vMeta, "SourceFile", "Name",
                                           vEdWrk, "Buffer",
                                           "SourceFileName", 0 );
            }

            // Copy all the operations to vEdWrk
            for ( nRC = SetCursorFirstEntity( vMeta, "Operation", 0 );
                  nRC == zCURSOR_SET;
                  nRC = SetCursorNextEntity( vMeta, "Operation", 0 ) )
            {
               CreateEntity( vEdWrk, "Oper", zPOS_LAST );
               SetMatchingAttributesByName( vEdWrk, "Oper",
                                            vMeta, "Operation",
                                            zSET_ALL );
            }

            DropView( vMeta );

            break;

         } // Case 'L'...

         case 'O':
         {
            // Since we load the object operations by object, we don't have
            // to do anything here.
            break;

         } // Case 'O'...

         default:
            SysMessageBox( "Zeidon Internal",
                           "This operation type not yet supported", 0 );
            break;

      } // switch ( *szCurrentType )...

      // Now that we've loaded the operations, sort them.
      OrderEntityForView( vEdWrk, "Oper", "Name A" );

   } // if ( SetCursor...)...

   // Disable the "Objects" button unless we are showing object operations.
   if ( *szCurrentType == 'O' )
      SetCtrlState( vSubtask, "ListObjects", zCONTROL_STATUS_ENABLED, TRUE );
   else
      SetCtrlState( vSubtask, "ListObjects", zCONTROL_STATUS_ENABLED, FALSE );

   // Now set the select states depending on the keyword values.
   GetStringFromAttribute( szKeyword, vProfileXFER, "ED", "OpIns_Keyword" );
   if ( *szKeyword &&
        CompareAttributeToString( vProfileXFER,
                                  "ED", "OpIns_UseKeyword", "Y" ) == 0 )
   {
      zCHAR  szIgnoreCase[ 5 ];
      zPCHAR pszKeyword;
      zBOOL  bStartColOne;
      zSHORT nKeywordLth;

      // De-select all operations.
      SetAllSelectStatesForEntity( vEdWrk, "Oper", FALSE, 0 );

      GetStringFromAttribute( szIgnoreCase, vProfileXFER, "ED",
                              "OpIns_KeywordIgnoreCase" );
      if ( *szIgnoreCase == 'Y' )
      {
         for ( pszKeyword = szKeyWord; *pszKeyword; pszKeyword++ )
            *pszKeyword = ztoupper( *pszKeyword );
      }

      // If the keyword starts with a "/", then the keyword search starts
      // with the first zCHAR (e.g. column) ONLY.
      pszKeyword = szKeyword;
      if ( *pszKeyword == '/' )
      {
         pszKeyword++;
         bStartColOne = TRUE;
         nKeywordLth = zstrlen( pszKeyword );
      }
      else
         bStartColOne = FALSE;

      for ( nRC = SetCursorFirstEntity( vEdWrk, "Oper", 0 );
            nRC == zCURSOR_SET;
            nRC = SetCursorNextEntity( vEdWrk, "Oper", 0 ) )
      {
         zCHAR  szOperName[ 255 ];

         GetStringFromAttribute( szOperName, vEdWrk, "Oper", "Name" );
         if ( *szIgnoreCase == 'Y' )
            strupr( szOperName );

         if ( bStartColOne )
         {
            if ( zstrncmp( szOperName, pszKeyword, nKeywordLth ) == 0 )
            {
               SetSelectStateOfEntity( vEdWrk, "Oper", TRUE );
               lSelectCount++;
            }
         }
         else
         {
            if ( strstr( szOperName, pszKeyword ) )
            {
               SetSelectStateOfEntity( vEdWrk, "Oper", TRUE );
               lSelectCount++;
            }
         }
      } // for...
   }
   else
   {
      // Select all operations.
      SetAllSelectStatesForEntity( vEdWrk, "Oper", TRUE, 0 );
      lSelectCount = CountEntitiesForView( vEdWrk, "Oper" );
   }

   //SetSelectSetForView( vEdWrk, nOldSelectSet );
   SetCursorFirstSelectedEntity( vEdWrk, "Oper", 0 );
   LB_SetDisplaySelectSet( vSubtask, "OperationList", DISP_SELECT_SET );
   LB_SetSelectSelectSet( vSubtask, "OperationList", SEL_SELECT_SET );

   // Re-use szKeyword to set the message...
   sprintf( szKeyword, "%d Operations listed", lSelectCount );
   MB_SetMessage( vSubtask, 0, szKeyword );

   RefreshWindow( vSubtask );

   return( 0 );

} // OpIns_BuildOperList