Esempio n. 1
0
//:   VIEW TZZOLODO  REGISTERED AS TZZOLODO
zOPER_EXPORT zSHORT OPERATION
EntityChanged( zVIEW     vSubtask )
{
   zVIEW     TZZOLODO = 0; 
   zSHORT    RESULT; 
   //:VIEW TZTENVRO  REGISTERED AS TZTENVRO
   zVIEW     TZTENVRO = 0; 
   //:SHORT nIsCheckedOut
   zSHORT    nIsCheckedOut = 0; 
   zSHORT    lTempInteger_0; 
   zSHORT    lTempInteger_1; 
   zCHAR     szTempString_0[ 201 ]; 
   zCHAR     szTempString_1[ 2 ]; 
   zCHAR     szTempString_2[ 201 ]; 

   RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK );
   RESULT = GetViewByName( &TZTENVRO, "TZTENVRO", vSubtask, zLEVEL_TASK );

   //:nIsCheckedOut = ComponentIsCheckedOut( vSubtask, TZZOLODO, zSOURCE_LOD_META )
   nIsCheckedOut = ComponentIsCheckedOut( vSubtask, TZZOLODO, zSOURCE_LOD_META );

   //:IF nIsCheckedOut = 1
   if ( nIsCheckedOut == 1 )
   { 
      //:// do not allow any input to the Join checkbox, if we are on the root
      //://  or if the currrent LOD entity is work or if the currrent LOD entity is derived
      //:IF TZZOLODO.ER_RelLinkRec EXISTS AND TZZOLODO.LOD_EntityParent.Work != "Y"
      lTempInteger_0 = CheckExistenceOfEntity( TZZOLODO, "ER_RelLinkRec" );
      //:   AND TZZOLODO.LOD_EntityParent.Derived != "Y"
      if ( lTempInteger_0 == 0 && CompareAttributeToString( TZZOLODO, "LOD_EntityParent", "Work", "Y" ) != 0 && CompareAttributeToString( TZZOLODO, "LOD_EntityParent", "Derived", "Y" ) != 0 )
      { 

         //:// Set the cursor to the POD_Entity for the current TE Source.
         //:SET CURSOR FIRST TZZOLODO.POD_Entity
         //:           WHERE  TZZOLODO.TE_DBMS_SourceForEntity.ZKey = TZTENVRO.TE_DBMS_Source.ZKey
         RESULT = SetCursorFirstEntity( TZZOLODO, "POD_Entity", "" );
         if ( RESULT > zCURSOR_UNCHANGED )
         { 
            while ( RESULT > zCURSOR_UNCHANGED && ( CompareAttributeToAttribute( TZZOLODO, "TE_DBMS_SourceForEntity", "ZKey", TZTENVRO, "TE_DBMS_Source", "ZKey" ) != 0 ) )
            { 
               RESULT = SetCursorNextEntity( TZZOLODO, "POD_Entity", "" );
            } 

         } 


         //:IF RESULT < zCURSOR_SET
         if ( RESULT < zCURSOR_SET )
         { 
            //:// POD_Entity doesn't exist so create one.
            //:CREATE ENTITY TZZOLODO.POD_Entity
            RESULT = CreateEntity( TZZOLODO, "POD_Entity", zPOS_AFTER );

            //:TZZOLODO.POD_Entity.SQL_JoinWithParent = "N"
            SetAttributeFromString( TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "N" );
            //:INCLUDE TZZOLODO.TE_DBMS_SourceForEntity FROM TZTENVRO.TE_DBMS_Source
            RESULT = IncludeSubobjectFromSubobject( TZZOLODO, "TE_DBMS_SourceForEntity", TZTENVRO, "TE_DBMS_Source", zPOS_AFTER );
         } 

         //:END

         //:// not the root and not work and not derived
         //:SetCtrlState( vSubtask,      "JoinCheck", zCONTROL_STATUS_ENABLED, TRUE )
         SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, TRUE );
         //:ELSE
      } 
      else
      { 
         //:SetCtrlState( vSubtask,      "JoinCheck", zCONTROL_STATUS_ENABLED, FALSE )
         SetCtrlState( vSubtask, "JoinCheck", zCONTROL_STATUS_ENABLED, FALSE );
      } 

      //:END

      //:// Refresh checkbox and set the string being displayed.
      //:IF  TZZOLODO.POD_Entity EXISTS
      lTempInteger_1 = CheckExistenceOfEntity( TZZOLODO, "POD_Entity" );
      if ( lTempInteger_1 == 0 )
      { 
         //: TZZOLODO.LOD_EntityParent.WorkString = TZZOLODO.LOD_EntityParent.Name +
         //:                                        " JOIN = " + TZZOLODO.POD_Entity.SQL_JoinWithParent
         GetStringFromAttribute( szTempString_0, TZZOLODO, "LOD_EntityParent", "Name" );
         ZeidonStringConcat( szTempString_0, 1, 0, " JOIN = ", 1, 0, 201 );
         GetVariableFromAttribute( szTempString_1, 0, 'S', 2, TZZOLODO, "POD_Entity", "SQL_JoinWithParent", "", 0 );
         ZeidonStringConcat( szTempString_0, 1, 0, szTempString_1, 1, 0, 201 );
         SetAttributeFromString( TZZOLODO, "LOD_EntityParent", "WorkString", szTempString_0 );
         //:ELSE
      } 
      else
      { 
         //: TZZOLODO.LOD_EntityParent.WorkString = TZZOLODO.LOD_EntityParent.Name + " JOIN = N"
         GetStringFromAttribute( szTempString_2, TZZOLODO, "LOD_EntityParent", "Name" );
         ZeidonStringConcat( szTempString_2, 1, 0, " JOIN = N", 1, 0, 201 );
         SetAttributeFromString( TZZOLODO, "LOD_EntityParent", "WorkString", szTempString_2 );
      } 

      //:END
   } 

   //:END

   //:RefreshCtrl( vSubtask, "JoinCheck" )
   RefreshCtrl( vSubtask, "JoinCheck" );
   //:RefreshCtrl( vSubtask, "edDescription" )
   RefreshCtrl( vSubtask, "edDescription" );
   //:RefreshCtrl( vSubtask, "cbDerived" )
   RefreshCtrl( vSubtask, "cbDerived" );
   //:RefreshCtrl( vSubtask, "cbWork" )
   RefreshCtrl( vSubtask, "cbWork" );
   return( 0 );
// END
} 
Esempio n. 2
0
///////////////////////////////////////////////////////////////////////////////
//
// OPERATION:  TZZAPPSD_SendServerExecs
//
// PURPOSE:    This Entry takes the zeidon.xdm and all xod object instances
//       and sends them to the Server for running the application on
//       the server.
//
////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
TZZAPP2D_SendServerExecs( zVIEW vSubtask )
{
   zVIEW  vZApp;
   zVIEW  vLPLR;
   zVIEW  vMeta;
   zSHORT nRC;
   zCHAR  szFileName[ zMAX_FILESPEC_LTH + 1 ];
   zCHAR  szMetaName[ 13 ];
   zCHAR  szAppName[ 32 ];
   zCHAR  szServerSubDir[ 33 ];
   zCHAR  szLPLR_Path[ zMAX_FILESPEC_LTH + 1 ];
   zCHAR  szMsg[ zSHORT_MESSAGE_LTH + 1 ];
   zVIEW  vApplSubtask;
   zCHAR  szServer[ 33 ];

   // get XLP for selceted application
   GetViewByName( &vZApp, "KZAPPLOO", vSubtask, zLEVEL_TASK );
   GetStringFromAttribute( szAppName, vZApp, "APPLICATION", "APP_NAME" );
   GetStringFromAttribute( szLPLR_Path, vZApp, "APPLICATION", "APP_ADOBIN" );
   SysAppendcDirSep( szLPLR_Path );
   zstrcpy( szFileName, szLPLR_Path );
   zstrcat( szFileName, szAppName );
   zstrcat( szFileName, ".XLP" );

   // open Task LPLR
   nRC = ActivateOI_FromFile( &vLPLR, "TZCMLPLO", vSubtask, szFileName,
                              zMULTIPLE );
   if ( nRC )
   {
      MessageSend( vSubtask, "CM00285", "Configuration Management",
                   "Can't activate XLP for task.",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      return( -1 );
   }

   SetNameForView( vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK);

   zmemset (szServer,0,sizeof(szServer));
// GetViewByName( &vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK );

   // Start the network if necessary.  Use zeidon and hzkzoe as constants for now.
   nRC = NetStatus( "zeidon" );
   if ( nRC == 0 )
   {
      nRC = NetStartup( "zeidon", "hzkzoe" );
      if ( nRC )
      {
         MessageSend( vSubtask, "CM00285", "Configuration Management",
                      "Network cannot be started.",
                      zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
         return( 0 );
      }
   }

   // First get the application name and make sure it exists in the
   // zeidon.app object on the server.  If it isn't there, add it.
   GetStringFromAttribute( szAppName, vLPLR, "LPLR", "Name" );
   zstrcpy( szFileName, "zeidon.app" );
   SfCreateSubtask( &vApplSubtask, vSubtask, "Zeidon System" );
   nRC = NetActivateOI_FromFile( 0, szServer, &vMeta, "KZAPPLOO",
                                 vApplSubtask, szFileName, zSINGLE );
   if ( nRC >= 0 )
   {
      nRC = SetCursorFirstEntityByString( vMeta, "APPLICATION",
                                          "APP_NAME", szAppName, 0 );
      if ( nRC >= zCURSOR_SET )
         DropObjectInstance( vMeta );
      else
      {
         CreateEntity( vMeta, "APPLICATION", zPOS_LAST );
         SetAttributeFromString( vMeta, "APPLICATION", "APP_NAME", szAppName );
         zstrcpy( szServerSubDir, szAppName );
         zstrcat( szServerSubDir, "/" );
         SetAttributeFromString( vMeta, "APPLICATION",
                                 "APP_DLL", szServerSubDir );
         SetAttributeFromString( vMeta, "APPLICATION",
                                 "APP_ADOBIN", szServerSubDir );
         SetAttributeFromString( vMeta, "APPLICATION",
                                 "APP_LOCAL", szServerSubDir );
         TraceLineS( "*** Committing server file: ", szFileName );
         zstrcpy( szMsg, "Sending ZEIDON.APP: " );
         MB_SetMessage( vSubtask, 1, szMsg );

         // Send OI to server.
         NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII );

         DropObjectInstance( vMeta );
      }
   }
   else
   {
      SfDropSubtask( vApplSubtask, 0 );
      MessageSend( vSubtask, "CM00286", "Configuration Management",
                   "ZEIDON.APP cannot be activated.",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      return( 0 );
   }

   SfDropSubtask( vApplSubtask, 0 );

   // Send the XDM before all the xods.
   // First format the file name for activation on the client and then
   // format it for commit on the server.
// GetStringFromAttribute( szFileName, vLPLR, "LPLR", "ExecDir" );
   zstrcpy( szFileName, szLPLR_Path );
   zstrcpy( szMetaName, "ZEIDON.XDM" );
   zstrcat( szFileName, szMetaName );
   TraceLineS( "*** Activating client file: ", szFileName );
   nRC = ActivateOI_FromFile( &vMeta, "TZDMXGPO", vSubtask,
                              szFileName, zSINGLE );

   if ( nRC >= 0 )
   {
      // Filename includes Directory-prefix **HH**
      GetStringFromAttribute( szFileName, vLPLR, "LPLR", "Name" );
      zstrcat( szFileName, "/" );
      zstrcat( szFileName, szMetaName );
      TraceLineS( "*** Committing server file: ", szFileName );
      MB_SetMessage( vSubtask, 1, "Sending XDM" );

      // Send OI to server.
      NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII );
   }

   // Next loop through all the LODs, activating each XOD and sending
   // it to the server.
   SetCursorFirstEntityByInteger( vLPLR, "W_MetaType", "Type",
                                  zREFER_LOD_META, 0 );
   nRC = SetCursorFirstEntity( vLPLR, "W_MetaDef", 0 );
   while ( nRC >= zCURSOR_SET )
   {
      zstrcpy( szFileName, szLPLR_Path );
      GetStringFromAttribute( szMetaName, vLPLR, "W_MetaDef", "Name" );
      zstrcat( szFileName, szMetaName );
      zstrcat( szFileName, ".XOD" );
      TraceLineS( "*** Activating client file: ", szFileName );
      nRC = ActivateOI_FromFile( &vMeta, "TZZOXODO", vSubtask,
                                 szFileName, zSINGLE );
      if ( nRC >= 0 )
      {
        // Filename includes Directory-prefix **HH**
        GetStringFromAttribute( szFileName, vLPLR, "LPLR", "Name" );
        zstrcat( szFileName, "/" );
        zstrcat( szFileName, szMetaName );
        zstrcat( szFileName, ".XOD" );
        TraceLineS( "*** Committing server file: ", szFileName );
        zstrcpy( szMsg, "Sending XOD: " );
        zstrcat( szMsg, szMetaName );
        MB_SetMessage( vSubtask, 1, szMsg );

        // Send OI to server.
        NetCommitOI_ToFile( 0, szServer, vMeta, szFileName, zASCII );
      }

      nRC = SetCursorNextEntity( vLPLR, "W_MetaDef", 0 );
   }

   MB_SetMessage( vSubtask, 1, "Transmission Complete" );

   return( 0 );
}
Esempio n. 3
0
//:   VIEW            SourceView
zOPER_EXPORT zSHORT OPERATION
oKZXMLPGO_AddWebControlSubobject( zVIEW     vKZXMLPGO,
                                  zPCHAR    ControlName,
                                  zPCHAR    ControlType,
                                  zPCHAR    ControlContext,
                                  zPCHAR    SourceViewName,
                                  zPCHAR    SourceEntity,
                                  zPCHAR    SourceAttribute,
                                  zPCHAR    AutoComboBoxExternalValue )
{
   zVIEW     SourceView = 0; 
   //:VIEW            SourceView2
   zVIEW     SourceView2 = 0; 
   //:SHORT           nRC
   zSHORT    nRC = 0; 
   //:INTEGER         CursorPos
   zLONG     CursorPos = 0; 
   //:STRING ( 2000 ) ExternalValue
   zCHAR     ExternalValue[ 2001 ] = { 0 }; 
   //:STRING ( 200 )  CurrentValue
   zCHAR     CurrentValue[ 201 ] = { 0 }; 
   zSHORT    RESULT; 
   zCHAR     szTempString_0[ 255 ]; 
   zCHAR     szTempString_1[ 32001 ]; 


   //:// Create a Control entity for the data passed.
   //:// If the Control is a ListBox or ComboBox, also create the SubControl entries for each list value.

   //:CREATE ENTITY vKZXMLPGO.Control
   RESULT = CreateEntity( vKZXMLPGO, "Control", zPOS_AFTER );
   //:vKZXMLPGO.Control.Name = ControlName
   SetAttributeFromString( vKZXMLPGO, "Control", "Name", ControlName );
   //:vKZXMLPGO.Control.Type = ControlType
   SetAttributeFromString( vKZXMLPGO, "Control", "Type", ControlType );

   //:// If the Named View does not exist or the EntityName doesn't exist, simply return.
   //:GET VIEW SourceView NAMED SourceViewName
   RESULT = GetViewByName( &SourceView, SourceViewName, vKZXMLPGO, zLEVEL_TASK );
   //:IF RESULT < 0
   if ( RESULT < 0 )
   { 
      //:// There is no mapping, so return having just created the entity, with Name and Type,
      //:// unless the Control is Text, in which case we'll add the Text value, which is passed as
      //:// AutoComboBoxExternalValue.
      //:IF vKZXMLPGO.Control.Type = "Text" OR
      //:   vKZXMLPGO.Control.Type = "PushBtn"
      if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "Text" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "PushBtn" ) == 0 )
      { 

         //:vKZXMLPGO.Control.CurrentValue = AutoComboBoxExternalValue
         SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", AutoComboBoxExternalValue );
      } 

      //:END
      //:RETURN
      return( 0 );
   } 

   //:END
   //:IF SourceEntity != ""
   if ( ZeidonStringCompare( SourceEntity, 1, 0, "", 1, 0, 33 ) != 0 )
   { 
      //:nRC = CheckExistenceOfEntity( SourceView, SourceEntity )
      nRC = CheckExistenceOfEntity( SourceView, SourceEntity );
      //:IF nRC < 0
      if ( nRC < 0 )
      { 
         //:RETURN
         return( 0 );
      } 

      //:END
   } 

   //:END

   //:// If there is mapping, process according to Control Type
   //:IF vKZXMLPGO.Control.Type = "EditBox" OR
   //:   vKZXMLPGO.Control.Type = "Text" OR
   //:   vKZXMLPGO.Control.Type = "CheckBox"
   if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "EditBox" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "Text" ) == 0 || CompareAttributeToString( vKZXMLPGO, "Control", "Type", "CheckBox" ) == 0 )
   { 

      //:GetStringFromAttributeByContext( ExternalValue,
      //:                                 SourceView, SourceEntity, SourceAttribute, ControlContext, 2000 )
      GetStringFromAttributeByContext( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, 2000 );
      //:vKZXMLPGO.Control.CurrentValue = ExternalValue
      SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", ExternalValue );
      //:ELSE
   } 
   else
   { 

      //:IF vKZXMLPGO.Control.Type = "MLEdit"
      if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "MLEdit" ) == 0 )
      { 
         //:SetAttributeFromAttribute( vKZXMLPGO, "Control", "CurrentValue",
         //:                        SourceView, SourceEntity, SourceAttribute )
         SetAttributeFromAttribute( vKZXMLPGO, "Control", "CurrentValue", SourceView, SourceEntity, SourceAttribute );
         //:ELSE
      } 
      else
      { 

         //:IF vKZXMLPGO.Control.Type = "ComboBox"
         if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBox" ) == 0 )
         { 
            //:// Build the list of selection values from the Domain table entries.
            //:GetStringFromAttributeByContext( CurrentValue,
            //:                           SourceView, SourceEntity, SourceAttribute, ControlContext, 200 )
            GetStringFromAttributeByContext( CurrentValue, SourceView, SourceEntity, SourceAttribute, ControlContext, 200 );
            //:vKZXMLPGO.Control.CurrentValue = CurrentValue
            SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", CurrentValue );
            //:nRC = GetFirstTableEntryForAttribute( ExternalValue,
            //:                                SourceView, SourceEntity, SourceAttribute,
            //:                                ControlContext, CursorPos )
            nRC = GetFirstTableEntryForAttribute( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, &CursorPos );
            //:LOOP WHILE nRC >= 0
            while ( nRC >= 0 )
            { 
               //:CREATE ENTITY vKZXMLPGO.ComboValue
               RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER );
               //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue
               SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue );
               //:IF ExternalValue = CurrentValue
               if ( ZeidonStringCompare( ExternalValue, 1, 0, CurrentValue, 1, 0, 2001 ) == 0 )
               { 
                  //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 )
                  SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 );
                  //:ELSE
               } 
               else
               { 
                  //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 )
                  SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 );
               } 

               //:END
               //:nRC = GetNextTableEntryForAttribute( ExternalValue,
               //:                               SourceView, SourceEntity, SourceAttribute,
               //:                               ControlContext, CursorPos )
               nRC = GetNextTableEntryForAttribute( ExternalValue, SourceView, SourceEntity, SourceAttribute, ControlContext, &CursorPos );
            } 

            //:END
            //:ELSE
         } 
         else
         { 

            //:IF vKZXMLPGO.Control.Type = "ComboBoxAuto"
            if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBoxAuto" ) == 0 )
            { 
               //:// Build the list of selection values from the list of entities.
               //:// Note that the entry selected is defined by the AutoComboBoxExternalValue passed, which
               //:// was set from the value of the Edit Mapping.
               //:vKZXMLPGO.Control.CurrentValue = AutoComboBoxExternalValue
               SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", AutoComboBoxExternalValue );
               //:nRC = SetCursorFirstEntity( SourceView, SourceEntity, "" )
               nRC = SetCursorFirstEntity( SourceView, SourceEntity, "" );
               //:LOOP WHILE nRC >= 0
               while ( nRC >= 0 )
               { 
                  //:CREATE ENTITY vKZXMLPGO.ComboValue
                  RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER );
                  //:GetStringFromAttributeByContext( ExternalValue,
                  //:                        SourceView, SourceEntity, SourceAttribute, "", 2000 )
                  GetStringFromAttributeByContext( ExternalValue, SourceView, SourceEntity, SourceAttribute, "", 2000 );
                  //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue
                  SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue );
                  //:IF ExternalValue = AutoComboBoxExternalValue
                  if ( ZeidonStringCompare( ExternalValue, 1, 0, AutoComboBoxExternalValue, 1, 0, 2001 ) == 0 )
                  { 
                     //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 )
                     SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 );
                     //:ELSE
                  } 
                  else
                  { 
                     //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 )
                     SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 );
                  } 

                  //:END
                  //:nRC = SetCursorNextEntity( SourceView, SourceEntity, "" )
                  nRC = SetCursorNextEntity( SourceView, SourceEntity, "" );
               } 

               //:END
               //:ELSE
            } 
            else
            { 

               //:IF vKZXMLPGO.Control.Type = "ComboBoxList"
               if ( CompareAttributeToString( vKZXMLPGO, "Control", "Type", "ComboBoxList" ) == 0 )
               { 
                  //:// Build the list of selection values from the list of entities.
                  //:// Note that the entry selected is defined by the cursor position.
                  //:CreateViewFromViewForTask( SourceView2, SourceView, vKZXMLPGO )
                  CreateViewFromViewForTask( &SourceView2, SourceView, vKZXMLPGO );
                  //:GetStringFromAttributeByContext( CurrentValue,
                  //:                     SourceView, SourceEntity, SourceAttribute, "", 2000 )
                  GetStringFromAttributeByContext( CurrentValue, SourceView, SourceEntity, SourceAttribute, "", 2000 );
                  //:vKZXMLPGO.Control.CurrentValue = CurrentValue
                  SetAttributeFromString( vKZXMLPGO, "Control", "CurrentValue", CurrentValue );
                  //:nRC = SetCursorFirstEntity( SourceView2, SourceEntity, "" )
                  nRC = SetCursorFirstEntity( SourceView2, SourceEntity, "" );
                  //:LOOP WHILE nRC >= 0
                  while ( nRC >= 0 )
                  { 
                     //:CREATE ENTITY vKZXMLPGO.ComboValue
                     RESULT = CreateEntity( vKZXMLPGO, "ComboValue", zPOS_AFTER );
                     //:GetStringFromAttributeByContext( ExternalValue,
                     //:                     SourceView2, SourceEntity, SourceAttribute, "", 2000 )
                     GetStringFromAttributeByContext( ExternalValue, SourceView2, SourceEntity, SourceAttribute, "", 2000 );
                     //:vKZXMLPGO.ComboValue.ExternalValue = ExternalValue
                     SetAttributeFromString( vKZXMLPGO, "ComboValue", "ExternalValue", ExternalValue );
                     //:IF ExternalValue = CurrentValue
                     if ( ZeidonStringCompare( ExternalValue, 1, 0, CurrentValue, 1, 0, 2001 ) == 0 )
                     { 
                        //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 )
                        SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 1 );
                        //:ELSE
                     } 
                     else
                     { 
                        //:SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 )
                        SetSelectStateOfEntity( vKZXMLPGO, "ComboValue", 0 );
                     } 

                     //:END
                     //:nRC = SetCursorNextEntity( SourceView2, SourceEntity, "" )
                     nRC = SetCursorNextEntity( SourceView2, SourceEntity, "" );
                  } 

                  //:END
                  //:DropView( SourceView2 )
                  DropView( SourceView2 );
               } 


               //:END
            } 

            //:END
         } 

         //:END
      } 

      //:END
   } 

   //:END

   //:TraceLineS( "AddWebControlSubobject Type: ", vKZXMLPGO.Control.Type )
   GetStringFromAttribute( szTempString_0, vKZXMLPGO, "Control", "Type" );
   TraceLineS( "AddWebControlSubobject Type: ", szTempString_0 );
   //:TraceLineS( "      =============== Value: ", vKZXMLPGO.Control.CurrentValue )
   GetStringFromAttribute( szTempString_1, vKZXMLPGO, "Control", "CurrentValue" );
   TraceLineS( "      =============== Value: ", szTempString_1 );
   return( 0 );
//    /* vKZXMLPGO.Control.Type = "EditBox" OR
//       vKZXMLPGO.Control.Type = "ListBox" OR
//       vKZXMLPGO.Control.Type = "Text" OR
//       vKZXMLPGO.Control.Type = "CheckBox" OR
//       vKZXMLPGO.Control.Type = "ListBox" OR
//       vKZXMLPGO.Control.Type = "MLE" OR
//       vKZXMLPGO.Control.Type = "Outliner" OR
//       vKZXMLPGO.Control.Type = "RadioBtnGroup" */
// END
} 
Esempio n. 4
0
File: tzvminaa.c Progetto: DeegC/10d
//
// OPERATION: LoadXPG
//
// DESCRIPTION: LoadXPG Gets the executable directory from the TaskLPLR.
//    It then creates a file name from which to load the pared instance file.
//    If the load is successful then the view is names in the interp
//    subtask as XPG.
//
zOPER_EXPORT zSHORT OPERATION
LoadXPG( zVIEW  lpInterpSubtask,                      // interpretor subtask
         zVIEW  vSubtask,                             // application subtask
         zPCHAR szSrcDLLName,                         // source dllname
         zCPCHAR cpcGenLang )
{

   zVIEW  vViewObject;                                       // task view
   zCHAR  szExecDir[ zMAX_FILESPEC_LTH + 1 ];                // dir string
   zCHAR  szMessage[ zMAX_MESSAGE_LTH + 1 ];
   zLONG  lParserVersion = 0;
   zSHORT nLth;                                              // string length
   zSHORT nRC;

   // First check to see if it already exists.
   GetViewByName( &g_vXPGView, "XPG", lpInterpSubtask, zLEVEL_SUBTASK );
   if ( g_vXPGView != 0 )
      return( 0 );

   // get a view to the Task LPLR
   if ( GetViewByName( &vViewObject, "TaskLPLR", vSubtask, zLEVEL_TASK ) != zLEVEL_TASK )
   {
      return( -1 );
   }

   // get the exec directory
   GetStringFromAttribute( szExecDir, zsizeof( szExecDir ), vViewObject, "LPLR", "ExecDir" );

   // be sure it was terminated with a '\'
   nLth = (zSHORT) zstrlen( szExecDir );
   if ( szExecDir[ nLth ] != '\\' )
   {
      szExecDir[ nLth ] = '\\';
      szExecDir[ nLth + 1 ] = 0;
   }

   // concat the name. and the .XPG extention
   strcat_s( szExecDir, zsizeof( szExecDir ), szSrcDLLName );
   if ( cpcGenLang[ 0 ] == 'J' )
      strcat_s( szExecDir, zsizeof( szExecDir ), ".XPJ" );
   else
      strcat_s( szExecDir, zsizeof( szExecDir ), ".XPG" );

   // activate the file
   nRC = ActivateOI_FromFile( &g_vXPGView,
                                   "TZVSPOOO",
                                   lpInterpSubtask,
                                   szExecDir,
                                   zSINGLE | zNOI_OKAY |
                                   zIGNORE_ATTRIB_ERRORS );

   if ( nRC != 0 ) //  failed
   {
      strcpy_s( szMessage, zsizeof( szMessage ), "Source VML :" );
      strcat_s( szMessage, zsizeof( szMessage ), szSrcDLLName );
      strcat_s( szMessage, zsizeof( szMessage ), " must be parsed prior to execution" );
      MessageSend( lpInterpSubtask, "VM03002", "VML Interpretor",
                   szMessage,
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      TraceLineS( "Could Not Load ", szExecDir );
      return( -1 );
   }
   // do the Parser Version Compatibility Check
#define PARSER_VERSION_REQUIRED 1
   nRC = GetIntegerFromAttribute( &lParserVersion, g_vXPGView,
                                       "VML_XSource",  "ParserVersion" );
   if ( nRC != 0 || lParserVersion < PARSER_VERSION_REQUIRED )
   {
      // the XPG is too old, and not compatible with the current
      //  interpreter.
      strcpy_s( szMessage, zsizeof( szMessage ), "Source VML :" );
      strcat_s( szMessage, zsizeof( szMessage ), szSrcDLLName );
      strcat_s( szMessage, zsizeof( szMessage ),
         " is outdated and must be re-parsed prior to execution" );
      MessageSend( lpInterpSubtask, "VM03002", "VML Interpretor",
                   szMessage,
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      TraceLineS( "Program File Outdated : ", szExecDir );
      return( -1 );
   }

   // name the view to the interpretor subtask
   SetNameForView( g_vXPGView, "XPG", lpInterpSubtask, zLEVEL_SUBTASK );

   return( 0 );
}
Esempio n. 5
0
//
// OPERATION: AddGetVariableFromAttribute
//
// DESCRIPTION: Creates a GetVariableFromAttribute call with the
//    result of the operation being put in nZRetCode
//
zOPER_EXPORT zLONG OPERATION
AddGetVariableFromAttribute( zVIEW  vSubtask,
                             zPCHAR pchOperationName,
                             zLONG  lViewID,
                             zLONG  lReturnLthID,
                             zLONG  lUseVariable,
                             zLONG  lVariableDataType,
                             zLONG  lVariableID,
                             zPCHAR pchEntityName,
                             zLONG  lEntityID,
                             zPCHAR pchAttributeName,
                             zLONG  lAttributeID,
                             zLONG  lUseExtra,
                             zPCHAR pchExtra,
                             zLONG  lExtra )
{
   zLONG sParmList[ PARM_LIST_SIZE ] = { 0 };
   zLONG sParmListExt[ PARM_LIST_SIZE ] = { 0 };
   zLONG lParmListIndex = 0;
   zLONG lRCID;
   zLONG lOperZKey;
   zLONG lTempVariableID;
   zCHAR szVariableLth[ 12 ];

// memset( sParmListExt, 0, sizeof( sParmListExt ) );
// lParmListIndex = 0;

   lLocal3Code = 0;
   lLocal3Text = 0;

   // Set temp variable ID because VariableID can be set to negative.
   lTempVariableID = lVariableID;

   // Insert new bottom of stack.
   AddOperatorToView( vSubtask, 0, -2 );

   // add result
   lRCID = AddRetCode( vSubtask );
   ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qNUMERIC, qTSHORT, "RC", lRCID, 0 );

   // add operation name
   lOperZKey = GetOperationZKey( vSubtask, qZEIDONOPERATION, pchOperationName );
   ADDEXPRESSIONENTRYTOSTRING( qOPERATIONCALL, qZEIDONOPERATION, qTSHORT, pchOperationName, lOperZKey, 0 );

   GetOperationParmListPM( vSubtask, sParmList, sParmListExt, lOperZKey, qZEIDONOPERATION );
   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, "(", qOPENOPER, 0 );

   lParmListIndex = 1;  // return attribute value
   // Add target string variable.
   if ( sParmList[ lParmListIndex++ ] < 0 )
      lVariableID *= -1;

   if ( g_szGenLang[ 0 ] == 'J' )
      ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, qTSTRING, "", lVariableID, 0 );  // add return attribute value
   else
      ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, lVariableDataType, "", lVariableID, 0 );  // add return attribute value

   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   if ( sParmList[ lParmListIndex++ ] < 0 )  // return attribute value length
      lReturnLthID *= -1;

   if ( g_szGenLang[ 0 ] == 'J' )
   {
      // Add zero parm and comma.
      if ( lReturnLthID == 0 )
         ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, "0", lVariableID, 0 );  // add return attribute value length
      else
         ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, qTINTEGER, "", lReturnLthID, 0 );  // add return attribute value length

   }
   else
   {
      // Add zero parm and comma.
      ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, "0", lVariableID, 0 );  // add return attribute value length
   }

   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   // Add string type 'S' and comma.
   lParmListIndex++;  // variable type
   ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTCHARACTER, "S", lVariableID, 0 );  // add variable type
   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   // Add variable length and comma. First position on variable.
   lParmListIndex++;  // variable length
   SetCursorFirstEntityByInteger( g_lpPIView, "Variable", "ID", lTempVariableID, 0 );
   GetStringFromAttribute( szVariableLth, g_lpPIView, "Variable", "NElements" );

   ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, szVariableLth, lVariableID, 0 );  // add variable length
   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   // Add view and comma.
   lParmListIndex++;  // view
   ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qNUMERIC, qTVIEW, "", lViewID, 0 );  // add view
   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   // Add entity name and comma.
   lParmListIndex++;  // entity name
   if ( lEntityID > 0 ) // is a var
   {
      if ( sParmList[ lParmListIndex ] < 0 )
         lEntityID *= -1;

      ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qTEXT, qTENTITYNAME, "", lEntityID, 0 );  // add entity name
   }
   else  // is a string constant
   {
      ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, qTEXT, qTENTITYNAME, pchEntityName, lEntityID, 0 );  // add entity name
   }

   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   // Add attribute name and comma.
   lParmListIndex++;  // attribute name
   if ( lAttributeID > 0 ) // is a var
   {
      if ( sParmList[ lParmListIndex ] < 0 )
         lAttributeID *= -1;

      ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qTEXT, qTATTRIBUTENAME, "", lAttributeID, 0 );  // add attribute name
   }
   else  // is a string constant
   {
      ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, qTEXT, qTATTRIBUTENAME, pchAttributeName, lAttributeID, 0 );  // add attribute name
   }

   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   // Add context name and comma.
   lParmListIndex++;  // context name
   if ( lUseVariable == 1 )
   {
      if ( sParmList[ lParmListIndex ] < 0 )
         lVariableID *= -1;

      ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, lVariableDataType, "", lVariableID, 0 );  // add context name
   }
   else
   {
      ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, qTEXT, qTSTRING, "", lVariableID, 0 );
   }

   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 );

   // Add zero parm and close paren.
   lParmListIndex++;
   ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, "0", lVariableID, 0 );
   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ")", qCLOSEOPER, 0 );

   // add EQUAL
   ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, "=", qEQUAL, 0 );

   // Dump the expression from the stack.
   AddOperatorToView( vSubtask, 0, -1 );

   AddStatementEntityWithStringToPI( vSubtask, qEXPRESSION, qqlineno,
                                     szLocal3Code, &lLocal3Code, szLocal3Text, &lLocal3Text, zPOS_AFTER );
   return( 0 );
}
Esempio n. 6
0
File: tzvminaa.c Progetto: DeegC/10d
zOPER_EXPORT zLONG OPERATION
GetExecMode( zVIEW  lpInterpSubtask,
             zVIEW  lpAppSubtask,
             zPCHAR szSrcDLLName,
             zPCHAR szOperationName,
             zPCHAR szMetaType )
{
   zVIEW  vXChecker;
   zVIEW  CM_List;
   zCHAR  szExecDir[ zMAX_FILESPEC_LTH + 1 ];
   zCHAR  szScopeMeta[ 33 ];
   zCHAR  szSourceFileMeta1[ 33 ];
   zCHAR  szSourceFileMeta2[ 33 ];
   zCHAR  szOperationMeta[ 33 ];
   zSHORT nRC;

   if ( !szMetaType || !*szMetaType )
      return( -1 );

   nRC = GetViewByName( &vXChecker, "TZVSXCOO",
                             lpInterpSubtask, zLEVEL_APPLICATION );

   if ( nRC != zLEVEL_APPLICATION )
   {
      GetViewByName( &CM_List, "TZCMWKSO", lpInterpSubtask, zLEVEL_APPLICATION );

      // If CM_List is 0 then we must have been called from Core at runtime.
      // In this case all operations are run natively so don't bother checking
      // the exec mode.
      if ( CM_List == 0 )
         return( -1 );

      GetStringFromAttribute( szExecDir, zsizeof( szExecDir ), CM_List, "LPLR", "ExecDir" );
      ZeidonStringConcat( szExecDir, 1, 0, "\\TZVSXC01.POR", 1, 0, zMAX_FILESPEC_LTH+1 );
      nRC = ActivateOI_FromFile( &vXChecker, "TZVSXCOO",
                                 lpAppSubtask, szExecDir,
                                 zSINGLE | zIGNORE_ATTRIB_ERRORS );
      if ( nRC != 0 )
         return( -1 );
   }

   // set up the Operation Meta Name
   if ( zstrcmp( szMetaType, "Dialog" ) == 0 )
   {
      strcpy_s( szSourceFileMeta1, zsizeof( szSourceFileMeta1 ), "DialogSourceFile" );
      strcpy_s( szSourceFileMeta2, zsizeof( szSourceFileMeta2 ), "Dialog" );
      strcpy_s( szOperationMeta, zsizeof( szOperationMeta ), "DialogOperation" );
      strcpy_s( szScopeMeta, zsizeof( szScopeMeta), "Dialogs" );
   }
   else
   if ( zstrcmp( szMetaType, "LOD" ) == 0 )
   {
      strcpy_s( szSourceFileMeta1, zsizeof( szSourceFileMeta1 ), "LODSourceFile" );
      strcpy_s( szSourceFileMeta2, zsizeof( szSourceFileMeta2 ), "LOD" );
      strcpy_s( szOperationMeta, zsizeof( szOperationMeta ), "LOD_Operation" );
      strcpy_s( szScopeMeta, zsizeof( szScopeMeta), "LODs" );
   }
   else
   {
      strcpy_s( szSourceFileMeta1, zsizeof( szSourceFileMeta1 ), "GlobalSourceFile" );
      strcpy_s( szSourceFileMeta2, zsizeof( szSourceFileMeta2 ), "GlobalOperation" );
      strcpy_s( szOperationMeta, zsizeof( szOperationMeta ), "Operation" );
      strcpy_s( szScopeMeta, zsizeof( szScopeMeta), "GlobalOperations" );
   }

   nRC = SetCursorFirstEntityByString( vXChecker, szSourceFileMeta1,
                                       "Name", szSrcDLLName, szScopeMeta );
#if 0
   if ( nRC < zCURSOR_SET )
   {
      nRC = SetCursorFirstEntityByString( vXChecker, szSourceFileMeta2,
                                          "Name", szSrcDLLName, szScopeMeta );
      if ( nRC == zCURSOR_SET )
      {
         nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", 1 );
         return( zXC_OPERATION_STAGED );
      }
      else
         return( -1 );
   }
#endif

   if ( nRC < zCURSOR_SET )
      return( -1 );

   nRC = SetCursorFirstEntityByString( vXChecker, szOperationMeta, "Name", szOperationName, "" );

   if ( nRC >= zCURSOR_SET )
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", zXC_SETUP_DEBUGGER );
      return( zXC_SETUP_DEBUGGER );
   }
   else
   {
      nRC = SetAttributeFromInteger( vXChecker, "APPLICATION", "CurrentMode", 1 );
      return( zXC_OPERATION_STAGED );
   }
}
Esempio n. 7
0
File: tzvminaa.c Progetto: DeegC/10d
zOPER_EXPORT zLONG OPERATION
Exec_StepOnce( zVIEW vSubtask )
{
   zVIEW vZ_View;
   zVIEW vS_View;
   zLONG lStepRC;
   zLONG lRC;
   zCHAR szDebugFlag[ 2 ];

   // Single step actually loops unless one of these conditions occur.
   //   1.  The next statement to execute is within an operation currently in debug mode.
   //   2.  The return code from the last statement executed indicates debugging is to start for that operation.
   //   3.  Execution is terminating.
   //
   // The loop is very close to that in the Go function.
   //

   szDebugFlag[ 0 ] = 'N';
   lStepRC = zXC_STEP_EXECUTED;
   zPVOID hWRKS;

   // initialize work storage manager
   if ( WRKS_Init( &hWRKS ) < 0 )
   {
      // Error in WRKS system
      MessageSend( vSubtask, "VM03002", "VML Interpretor",
                   "Error Initializing Work Storage",
                   zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
      TraceLineS( "VML Interpreter Error ","Initializing Work Storage" );

      return( lStepRC );
   }

   if ( setjmp( g_jbWRKS ) != 0 )
   {
      // Error return from longjmp
      WRKS_Close( &hWRKS );
      return( zXC_STEP_EXECUTED );
   }

   while ( (lStepRC == zXC_STEP_EXECUTED       ||
            lStepRC == zXC_OPERATION_STAGED) &&
            szDebugFlag[ 0 ] != 'Y' )
   {
      lStepRC = StepOnce( vSubtask, hWRKS, &lRC );

      // Don't execute the following if the operation is terminating.
      if ( lStepRC )
      {
         GetViewByName( &vZ_View, "ZeidonVML", vSubtask, zLEVEL_TASK );
         GetViewByName( &vS_View, "XPG", vZ_View, zLEVEL_SUBTASK );
         GetStringFromAttribute( szDebugFlag, zsizeof( szDebugFlag ), vS_View, "Operation", "CurrentDebugFlag" );
      }
   }

   if ( lStepRC == zXC_SETUP_DEBUGGER )
   {
      SetAttributeFromString( vS_View, "Operation", "CurrentDebugFlag", "Y" );
   }

   // close work storage manager
   WRKS_Close( &hWRKS );

   return( lStepRC );
}
Esempio n. 8
0
File: tzadw3aw.c Progetto: DeegC/10d
/////////////////////////////////////////////////////////////////////////////
//
// ENTRY:   CreateListBox
//
// PURPOSE: This function creates a listbox with the given
//          specifications and then autodesigns this listbox with
//          the LISTATTRIB attributes for the listbox's entity.
//          In addition to auto designing the listbox's fields, any
//          actions defined for the listbox(in the style object)
//          get autodesigned.
//
/////////////////////////////////////////////////////////////////////////////
zOPER_EXPORT zSHORT OPERATION
ofnTZWDLGSO_CreateListBox( zVIEW    vSubtask,
                           zVIEW    vNewDialog,
                           zVIEW    vUserSpec,
                           zLONG    lStart_X,
                           zLONG    lStart_Y,
                           zLONG    lHeight,
                           zPCHAR   szListType )
{
   zVIEW    vCtrlDef;
   zVIEW    vTZPNCTWO;
   zLONG    lTotalLth;
   zLONG    lAttribLth;
   zLONG    lPaintLth;
   zLONG    lCC;
   zLONG    lCL;
   zSHORT   RESULT;
   zCHAR    szPaintStr[ 50 ];
   zCHAR    X_LOD_Attribute[ 16 ];
   zCHAR    X_ER_Attribute[ 15 ];

// TraceLineS("IN", "AutoPaintLstListPart W4" );

   // Set up variables to either I_LOD listbox or L_LOD listbox.
   if ( szListType[ 0 ] == 'I' )
   {
      strcpy_s( X_LOD_Attribute, zsizeof( X_LOD_Attribute ), "I_LOD_Attribute" );
      strcpy_s( X_ER_Attribute, zsizeof( X_ER_Attribute ), "I_ER_Attribute" );
   }
   else
   {
      strcpy_s( X_LOD_Attribute, zsizeof( X_LOD_Attribute ), "L_LOD_Attribute" );
      strcpy_s( X_ER_Attribute, zsizeof( X_ER_Attribute ), "L_ER_Attribute" );
   }

   lCC = 5;
   lCL = 12;
   GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK );

// TraceLineS("IN", "CreateListBox W3" );
   /* Create the listbox. */
   CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER );

   SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "ListBox", "" );
   IncludeSubobjectFromSubobject( vNewDialog, "ControlDef",
                                  vCtrlDef, "ControlDef", zPOS_AFTER );
   SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_X", lStart_X );
   SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_Y", lStart_Y );

   // We must set the CtrlBOI.
   ActivateEmptyObjectInstance( &vTZPNCTWO, "TZPNCTWO",
                                vUserSpec, zSINGLE );
   CreateEntity( vTZPNCTWO, "TZPNCTWO", zPOS_AFTER );
   CreateEntity( vTZPNCTWO, "ListBox", zPOS_AFTER );
   SetAttributeFromInteger( vTZPNCTWO, "ListBox", "Subtype", 8192 );

   // Set Control.CtrlBOI from work entity GroupBox
   SetBlobFromEntityAttributes( vNewDialog, "Control",
                                 "CtrlBOI", vTZPNCTWO, "ListBox" );
   DropView( vTZPNCTWO );

   // Set the control subtype to 0(Single).
   SetAttributeFromInteger( vNewDialog, "Control", "Subtype", 8192 );

   lTotalLth = 0;

   if ( CheckExistenceOfEntity ( vUserSpec, X_LOD_Attribute ) != 0 )
      lTotalLth = 5;

   // Loop through the L_LOD_Attribute and find the total width needed
   // for this listbox.
   RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   {
      lAttribLth = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec,
                                                   szListType );

      if ( lAttribLth > 20 )
         lAttribLth = 20;

      if ( lAttribLth < 5 )
         lAttribLth = 5;

      GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                              X_ER_Attribute, "ListPaintLit" );
      if ( szPaintStr[ 0 ] == 0 )
      {
         GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                                 X_ER_Attribute, "PromptPaintLit" );
      }
      if ( szPaintStr[ 0 ] == 0 )
      {
         GetStringFromAttribute( szPaintStr, zsizeof( szPaintStr ), vUserSpec,
                                 X_ER_Attribute, "Name" );
         /* Add a ':' to the end. */
         strcat_s( szPaintStr, zsizeof( szPaintStr ), ":" );
         /* Add spaces before any capital letters. */
         AddSpacesToString( szPaintStr );
      }
      lPaintLth = zstrlen( szPaintStr );
      if ( lPaintLth > 20 )
         lPaintLth = 20;
      if ( lPaintLth < 5 )
         lPaintLth = 5;

      if ( lAttribLth > lPaintLth )
         lTotalLth = lTotalLth + lAttribLth + 1;
      else
         lTotalLth = lTotalLth + lPaintLth + 1;

      RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" );
   }

   lTotalLth ++;

   SetAttributeFromInteger( vNewDialog, "Control",
                            "SZDLG_X", lTotalLth * lCC );
   SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_Y", lHeight );

// TraceLineS("END", "CreateListBox W3" );
   return( 0 );
}
Esempio n. 9
0
zOPER_EXPORT zSHORT OPERATION
BuildXODsOnLPLR( zVIEW vSubtask )
{
   // This routine does not actually save LODs, but only builds the XODs
   // on the LPLR.

   zVIEW  vDTE;
   zVIEW  vLPLR;
   zVIEW  vLOD_List;
   zVIEW  vLOD;
   zVIEW  vXOD;
   zSHORT nRC;
   zCHAR  szMsg[ zSHORT_MESSAGE_LTH + 1 ];
   zCHAR  szLOD_Name[ 33 ];
   zCHAR  szFileName[ zMAX_FILESPEC_LTH + 1 ];

   GetViewByName( &vDTE, "TE_DB_Environ", vSubtask, zLEVEL_TASK );
   GetViewByName( &vLOD_List, "TZZOLFLO", vSubtask, zLEVEL_TASK );
   GetViewByName( &vLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK );

   // Save Subtask for use by XOD build routine.
   SetNameForView( vSubtask, "TE_Window", vSubtask, zLEVEL_TASK );

   // For each selected LOD, build the XOD using the current DBMS and
   // commit as file to LPLR, unless the LOD does not have a POD.
   // Note that we are not looking to see if the DBMS identified
   // in the POD.TE_SourceZKey matches the current DBMS. We will save
   // selected LODs with the current DBMS no matter how they were saved
   // last time.

   for ( nRC = SetCursorFirstSelectedEntity( vLOD_List, "W_MetaDef", "" );
         nRC >= zCURSOR_SET;
         nRC = SetCursorNextSelectedEntity( vLOD_List, "W_MetaDef", "" ) )
   {
      GetStringFromAttribute( szLOD_Name, vLOD_List, "W_MetaDef", "Name" );

      nRC = ActivateMetaOI( vSubtask, &vLOD, vLOD_List, zREFER_LOD_META, zCURRENT_OI );
      if ( nRC < 0 )
      {
         zstrcpy( szMsg, "Could not Activate LOD: " );
         zstrcat( szMsg, szLOD_Name );
         zstrcat( szMsg, ".\nAborting Build" );
         MessageSend( vSubtask, "TE00426", "Physical Data Model",
                      szMsg,
                      zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP );
         return( 0 );
      }
      else
      {
         // Send message that we are building the LOD.
         zstrcpy( szMsg, "Building executable for LOD: " );
         zstrcat( szMsg, szLOD_Name );
         zstrcat( szMsg, "." );
         MB_SetMessage( vSubtask, 1, 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( vSubtask, vLOD );
         SetNameForView( vLOD, "TZZOLODO", vSubtask, zLEVEL_TASK );
         GetViewByName( &vXOD, "TZZOXODO", vSubtask, zLEVEL_TASK );
         DropMetaOI( vSubtask, vLOD );

         // Commit the XOD to LPLR file.
         GetStringFromAttribute( szFileName, vLPLR, "LPLR", "ExecDir" );
         ofnTZCMWKSO_AppendSlash( szFileName );
         zstrcat( szFileName, szLOD_Name );
         zstrcat( szFileName, ".XOD" );
         TraceLineS( "*** Committing workstation file: ", szFileName );
         CommitOI_ToFile( vXOD, szFileName, zSINGLE );
      }
   }

   MB_SetMessage( vSubtask, 1, "Build of XODs complete." );
   return( 0 );
}
Esempio n. 10
0
static zSHORT GetCatalogs( zVIEW vSubtask, zVIEW vAktView )
{
    zSHORT nRet;
    zCHAR szServerName[9];
    zCHAR szCatalogFileName[9];
    zCHAR szEinschraenkung[9];
    zCHAR szCatalogName[9];
    zCHAR *pszCatalogList = NULL;
    long lAnzahlCatalogs;
    long lLv;
    zCHAR szLocalServer[MAX_COMPUTERNAME_LENGTH + 1];
    zLONG lLocalLength;

    // First we have to see, if the catalogs should be loaded locally or from
    // the server
    lLocalLength = MAX_COMPUTERNAME_LENGTH + 1;
    memset(szLocalServer, 0, MAX_COMPUTERNAME_LENGTH + 1);
    if (GetComputerName( szLocalServer, &lLocalLength ) == 0 )
       return( -3);

    // Get the actual Servername and CatalogFileName
    memset(szServerName, 0, 9);
    GetStringFromAttribute(szServerName, vAktView, "TZSIIMWK", "wkServerName");

    if ( zstrcmp( szServerName, szLocalServer ) != 0 )
    {
       // For servers we have to see if the list of catalogs is
       // already loaded. If not we have to Create an entity for
       // the catalogfile ADRTAFEL
       // If the list of catalogfiles still exists, return
       nRet = CheckExistenceOfEntity( vAktView, "CatFiles" );
       if ( nRet == zCURSOR_SET || nRet == zCALL_ERROR )
          return( nRet );

       // First we have to Create the Catalogfilename in the WorkLOD
       CreateEntity(vAktView, "CatFiles", zPOS_AFTER);
       SetAttributeFromString( vAktView, "CatFiles",
                               "wkCatFiles", "ADRTAFEL");
       SetAttributeFromString( vAktView, "CatFiles",
                               "wkEinschraenkung", "");
    }

    // If the siron modules are not loaded, load them now
    if ( g_hLib == NULL )
    {
       nRet = fnLoadHzvaffz( vSubtask );
       if ( nRet != 0 )
         return( nRet );
    }

    // Position onto the first catalogfile
    nRet = SetCursorFirstEntity(vAktView, "CatFiles", "");
    while ( nRet == zCURSOR_SET )
    {
       // Set Catalogfilename in structure for getting the cataloglist
       memset(szCatalogFileName, 0, 9);
       GetStringFromAttribute( szCatalogFileName, vAktView,
                               "CatFiles", "wkCatFiles");
       GetStringFromAttribute( szEinschraenkung, vAktView,
                               "CatFiles", "wkCatFiles");

       lAnzahlCatalogs = 0;
       if ( zstrcmp( szServerName, szLocalServer ) == 0 )
       {
          // Read all Catalogs from local PC
          nRet = pfnGetLocalCatalogs( szCatalogFileName, szEinschraenkung,
                                      &lAnzahlCatalogs, &pszCatalogList,
                                      "", "" );
       }
       else
       {
          // Read all Catalogs from the selected server
          nRet = pfnGetServerCatalogs( szServerName, szCatalogFileName,
                                       szEinschraenkung, &lAnzahlCatalogs,
                                       &pszCatalogList, "", "" );
       }

       if ( nRet != 0 )
       {
          pfnFreeListMemory( &pszCatalogList );
          return( nRet );   // Umsetzen auf 590
       }

       for (lLv = 0; lLv < lAnzahlCatalogs; lLv++)
       {
           memset( szCatalogName, 0, 9 );
           memcpy( szCatalogName, pszCatalogList+(lLv*9), 8);
           CreateEntity (vAktView, "Catalogs", zPOS_AFTER);
           SetAttributeFromString (vAktView, "Catalogs", "wkCatalogName", szCatalogName);
       }

       // Free Memory
       pfnFreeListMemory( &pszCatalogList );

       nRet = SetCursorNextEntity( vAktView, "CatFiles", "" );
    }

    return( 0 );
}
Esempio n. 11
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;

}
Esempio n. 12
0
zOPER_EXPORT zSHORT OPERATION
VML_DisplayList( zVIEW vSubtask )
{
   zVIEW  vProfileXFER;
   zCHAR  szShowStr[ 10 ];
   zSHORT nRC;

   GetProfileView( &vProfileXFER );
   *szShowStr = 0;

   // Build a string that contains each of the VML types that the user
   // wants shown.

   if ( CompareAttributeToString( vProfileXFER, "ED",
                                  "VML_ShowDeclarations", "Y" ) == 0 )
   {
      zstrcat( szShowStr, "D" );
   }

   if ( CompareAttributeToString( vProfileXFER, "ED",
                                  "VML_ShowControlStatements", "Y" ) == 0 )
   {
      zstrcat( szShowStr, "C" );
   }

   if ( CompareAttributeToString( vProfileXFER, "ED",
                                  "VML_ShowViewStatements", "Y" ) == 0 )
   {
      zstrcat( szShowStr, "V" );
   }

   if ( CompareAttributeToString( vProfileXFER, "ED",
                                  "VML_ShowEntityStatements", "Y" ) == 0 )
   {
      zstrcat( szShowStr, "E" );
   }

   if ( CompareAttributeToString( vProfileXFER, "ED",
                                  "VML_ShowOperators", "Y" ) == 0 )
   {
      zstrcat( szShowStr, "O" );
   }

   if ( CompareAttributeToString( vProfileXFER, "ED",
                                  "VML_ShowOther", "Y" ) == 0 )
   {
      zstrcat( szShowStr, "?" );
   }

   // szShowStr lists all the types that the user wants shown. eg "CV?" means
   // that the user wants all control, view, and 'other' vml statements
   // shown.
   for ( nRC = SetCursorFirstEntity( vProfileXFER, "VML_Text", 0 );
         nRC == zCURSOR_SET;
         nRC = SetCursorNextEntity( vProfileXFER, "VML_Text", 0 ) )
   {
      zCHAR szType[ 5 ];

      GetStringFromAttribute( szType, vProfileXFER, "VML_Text", "Type" );
      if ( zstrchr( szShowStr, *szType ) )
         SetSelectStateOfEntity( vProfileXFER, "VML_Text", TRUE );
      else
         SetSelectStateOfEntity( vProfileXFER, "VML_Text", FALSE );
   }

   SetCursorFirstSelectedEntity( vProfileXFER, "VML_Text", 0 );
   LB_SetDisplaySelectSet( vSubtask, "TextList", DISP_SELECT_SET );
   LB_SetSelectSelectSet( vSubtask, "TextList", SEL_SELECT_SET );

   return( 0 );

} // VML_DisplayList
Esempio n. 13
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
Esempio n. 14
0
/////////////////////////////////////////////////////////////////////////////
//
//   OPERATION:   EnqueueInstance
//
//   PARAMETERS:  zVIEW  vInstance - View to the instance to be enqueued
//                zPCHAR szEntityNames - A string containing 1 or
//                                  more entity names on which to enqueue
//                                  the instance. The first entity name
//                                  MUST BE the root of the object and
//                                  the remaining entity names MUST be
//                                  separated by the plus '+' character.
//
//   RETURN CODES:  0 - Enqueue successful
//                  1 - Enqueue unsuccessful, the instance is already
//                      Enqueued
//                 zCALL_ERROR - Enqueue unsuccessful, error in processing
//
/////////////////////////////////////////////////////////////////////////////
zSHORT OPERATION
EnqueueInstance( zVIEW vInstance, zPCHAR szEntityNames )
{
   zVIEW  vEnqueue;
   zVIEW  vEnqueueHolder;
   zVIEW  vQual;
   zVIEW  vWkInstance;
   zPCHAR szEntityNamePtr;
   zCHAR  szCurrentEntity[ 34 ];
   zCHAR  szLevel[ 2 ];
   zSHORT nEntity, nEnqueue, nIdx, nRC, nRetries;
   zLONG  lER_Token;
   zCHAR  szTimestamp[ 6 ];
   zCHAR  szObjectName[ 34 ];
   zCHAR  szUserID[ 34 ];
   zCHAR  szPassword[ 34 ];
   zCHAR  szKey[ 64 ];
   zCHAR  szMsg[ 256 ];

   // We put the enqueue logic in a for loop so we can restart the
   // enqueue if the enqueue fails and we cannot find the owner of
   // the enqueue.
   nRetries = 4;
   if ( MiGetObjectNameForView( szObjectName, vInstance ) < 0 )
      return( zCALL_ERROR );

   for ( ; ; )
   {
      // Set up work variables
      szEntityNamePtr = szEntityNames;
      _fstrcpy( szLevel, "R" );
      nEntity = nEnqueue = 0;

      // Set up a multiple root instance for enqueueing
      if ( ActivateEmptyObjectInstance( &vEnqueue, szlCGENQUEU,
                                        vInstance, zMULTIPLE ) != 0 )
      {
         return( zCALL_ERROR );
      }

      // Create a view on the instance so we do not step on the applications
      // cursor positions.
      CreateViewFromViewForTask( &vWkInstance, vInstance, 0 );

      // Get timestamp and user information for enqueue
      MiGetDateTimeForOI( szTimestamp, vWkInstance );
      SysGetUserID( vInstance, szUserID, szPassword );
      if ( szUserID[ 0 ] == 0 )
         _fstrcpy( szUserID, "(null)" );

      // Loop for each entity type to be enqueued
      while ( szEntityNamePtr[ 0 ] )
      {
         // Gather the next entity name on which to enqueue
         nIdx = 0;
         while ( szEntityNamePtr[ 0 ] && szEntityNamePtr[ 0 ] != '+' )
         {
            szCurrentEntity[ nIdx++ ] = szEntityNamePtr[ 0 ];
            szEntityNamePtr++;
         }

         szCurrentEntity[ nIdx ] = 0;
         if ( szEntityNamePtr[ 0 ] == '+' )
            szEntityNamePtr++;

         nEntity++;

         // Now that an entity name has been gathered, troll the instance
         // for every occurrence of that entity type and create an
         // enqueue instance for it
         nRC = SetCursorFirstEntity( vWkInstance, szCurrentEntity,
                                     zSCOPE_OI );
         if ( nRC == zCALL_ERROR )
         {
            DropView( vWkInstance );
            DropObjectInstance( vEnqueue );
            return( zCALL_ERROR );
         }

         if ( nRC >= zCURSOR_SET )
         {
            lER_Token = MiGetERTokenForEntity( vWkInstance, szCurrentEntity );
            do
            {
               // Set up an enqueue instance, The ER_Token and the Instance
               // key are the unique keys to the object, a duplicate instance
               // on the database will result in an enqueue failure with the
               // instance in use. The UserID combined with the Timestamp is
               // the non-unique key for deletion of a logical enqueue.

               // The object name and level ( 'R' - root, 'C' - child ) are
               // informational only.

               CreateEntity( vEnqueue, szlEnqueue, zPOS_AFTER );
               SetAttributeFromInteger( vEnqueue,
                           szlEnqueue, szlER_Token, lER_Token );
               MiGetKeyFromInstance( szKey, 61, vWkInstance, szCurrentEntity );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlInstanceKey,
                                       szKey );
               SetAttributeFromVariable( vEnqueue, szlEnqueue, szlTimestamp,
                                       szTimestamp, zTYPE_DATETIME,
                                       6, 0, 0 );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlType,
                                       "U" );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlUser,
                                       szUserID );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlObject,
                                       szObjectName );
               SetAttributeFromString( vEnqueue, szlEnqueue, szlLevel,
                                       szLevel );
               nEnqueue++;
            }  while ( SetCursorNextEntity( vWkInstance, szCurrentEntity,
                                            zSCOPE_OI ) >= zCURSOR_SET );
         }

         // After processing an entity type, all other enqueues are at the
         // child level
         szLevel[ 0 ] = 'C';
      }

      // Now that we're done gathering the enqueue information, we can drop
      // the view to the instance
      DropView( vWkInstance );

      // The enqueue instance has been built, now it is time to insert it
      // into the database for locking the instance.
      nRC = CommitObjectInstance( vEnqueue );
      if ( nRC != zDUPLICATE_ROOT )
      {
         DropObjectInstance( vEnqueue );
         return( nRC );
      }

      // The enqueue failed, now we will determine the owner of the enqueue
      // to see if we are conflicting with ourself or to report the owner
      // to the enqueue requestor
      SetCursorFirstEntity( vEnqueue, szlEnqueue, 0 );
      do
      {
         fnBuildQualForEnqueue( vEnqueue, &vQual );
         nRC = ActivateObjectInstance( &vEnqueueHolder, szlCGENQUEU,
                                       vInstance, vQual, zSINGLE );
         DropObjectInstance( vQual );
         if ( nRC < -1 )
            return( zCALL_ERROR );
         else
         if ( nRC >= 0 )
            break;
         else
            DropObjectInstance( vEnqueueHolder );

      } while ( SetCursorNextEntity( vEnqueue, szlEnqueue, 0 ) >= zCURSOR_SET );

      // If the enqueue holder was not found, then the enqueue may have
      // disappeared while trying to find the holder, retry the enqueue
      // operation.
      nRetries--;
      if ( nRC == -1 )
      {
         if ( nRetries == 0 )
            return( zCALL_ERROR );
      }

      // Report on the enqueue holder
      GetStringFromAttribute( szKey, vEnqueueHolder, szlEnqueue, szlUser );
      GetStringFromAttribute( &szKey[ 30 ],
                              vEnqueueHolder, szlEnqueue, szlObject );

      // if the current enqueue holder is the current user for the
      // same object type, then offer to drop the previous enqueue and
      // re-establish the enqueue for the current user
      if ( _fstrcmp( szUserID, szKey ) == 0 &&
           _fstrcmp( szObjectName, &szKey[ 30 ] ) == 0 && nRetries )
      {
         // we will retry this once and once only
         nRetries = 1;
         _fstrcpy( szMsg, "The " );
         _fstrcat( szMsg, szObjectName );
         _fstrcat( szMsg, " is already enqueued by you in this session or"
                          " a previous session. Would you like to release"
                          " the previously held enqueue?" );
         nRC = MessagePrompt( vInstance, "1", szlEnqueue, szMsg, 0,
                              zBUTTONS_YESNO, zRESPONSE_YES,
                              zICON_QUESTION );
         if ( nRC == zRESPONSE_NO )
         {
            DropObjectInstance( vEnqueue );
            DropObjectInstance( vEnqueueHolder );
            return( 1 );
         }

         // The user wants to delete a previous enqueue for the same
         // object type, build the qualification for the delete and remove
         // the prior enqueue.
         fnBuildQualForEnqueueDelete( vEnqueueHolder, &vQual );
         DropObjectInstance( vEnqueueHolder );
         nRC = ActivateObjectInstance( &vEnqueueHolder, szlCGENQUEU,
                                       vInstance, vQual, zMULTIPLE );
         DropObjectInstance( vQual );
         if ( nRC < 0 )
            return( zCALL_ERROR );

         nRC = SetCursorFirstEntity( vEnqueueHolder, szlEnqueue, 0 );
         while ( nRC >= zCURSOR_SET )
            nRC = DeleteEntity( vEnqueueHolder, szlEnqueue, zREPOS_NEXT );

         nRC = CommitObjectInstance( vEnqueueHolder );
         DropObjectInstance( vEnqueueHolder );

         // If the attempt to reuse the enqueue failed on a database error,
         // return that error. Otherwise, return zero ==> the enqueue was
         // reused.
         if ( nRC < 0 )
            return( zCALL_ERROR );
         else
            return( 0 );
      }
      else
      {
         // Report on the owner of the enqueue
         _fstrcpy( szMsg, "The " );
         _fstrcat( szMsg, szObjectName );
         _fstrcat( szMsg, " is currently in use by " );
         _fstrcat( szMsg, szKey );
         if ( _fstrcmp( szObjectName, &szKey[ 30 ] ) != 0 )
         {
            _fstrcat( szMsg, " under the object " );
            _fstrcat( szMsg, &szKey[ 30 ] );
         }
         _fstrcat( szMsg, "." );
         MessagePrompt( vInstance, "1", szlEnqueue, szMsg, 0,
                        zBUTTONS_OK, zRESPONSE_OK, 0 );
         DropObjectInstance( vEnqueue );
         DropObjectInstance( vEnqueueHolder );
         return( 1 );
      }
   }  // End of for loop for enqueueing

   // If we reach here, then the enqueue was in use and failed.
   return( 1 );
}
Esempio n. 15
0
   //:VIEW OperationXOG    BASED ON LOD TZZOXOGO
zOPER_EXPORT zSHORT OPERATION
oTZOGSRCO_GenerateXOG( zVIEW     OperationGroup )
{
   zVIEW     OperationXOG = 0; 
   //:VIEW OperationGroupT BASED ON LOD TZOGSRCO
   zVIEW     OperationGroupT = 0; 
   //:VIEW CurrentLPLR     BASED ON LOD TZCMLPLO
   zVIEW     CurrentLPLR = 0; 
   //:STRING ( 513 ) XOG_FileName 
   zCHAR     XOG_FileName[ 514 ] = { 0 }; 
   //:STRING ( 513 ) POG_FileName
   zCHAR     POG_FileName[ 514 ] = { 0 }; 
   //:STRING ( 200 ) szMsg
   zCHAR     szMsg[ 201 ] = { 0 }; 
   //:INTEGER        lFile
   zLONG     lFile = 0; 
   //:SHORT          nRC                 
   zSHORT    nRC = 0; 
   zSHORT    RESULT; 
   zCHAR     szTempString_0[ 33 ]; 
   zCHAR     szTempString_1[ 33 ]; 


   //:// Build the executable Global Object executable for all Operations in the LPLR.

   //:// Activate or initialize the XOG executable object.
   //:GET VIEW CurrentLPLR NAMED "TaskLPLR"
   RESULT = GetViewByName( &CurrentLPLR, "TaskLPLR", OperationGroup, zLEVEL_TASK );
   //:XOG_FileName = CurrentLPLR.LPLR.ExecDir + "\" + CurrentLPLR.LPLR.Name + ".XOG"
   GetStringFromAttribute( XOG_FileName, CurrentLPLR, "LPLR", "ExecDir" );
   ZeidonStringConcat( XOG_FileName, 1, 0, "\\", 1, 0, 514 );
   GetVariableFromAttribute( szTempString_0, 0, 'S', 33, CurrentLPLR, "LPLR", "Name", "", 0 );
   ZeidonStringConcat( XOG_FileName, 1, 0, szTempString_0, 1, 0, 514 );
   ZeidonStringConcat( XOG_FileName, 1, 0, ".XOG", 1, 0, 514 );
   //:lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ )
   lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ );
   //:IF lFile < 0
   if ( lFile < 0 )
   { 
      //:// Executable has not yet been generated.
      //:ACTIVATE OperationXOG EMPTY 
      RESULT = ActivateEmptyObjectInstance( &OperationXOG, "TZZOXOGO", OperationGroup, zSINGLE );
      //:CREATE ENTITY OperationXOG.TZZOXOGO 
      RESULT = CreateEntity( OperationXOG, "TZZOXOGO", zPOS_AFTER );
      //:OperationXOG.TZZOXOGO.NAME = CurrentLPLR.LPLR.Name
      SetAttributeFromAttribute( OperationXOG, "TZZOXOGO", "NAME", CurrentLPLR, "LPLR", "Name" );
      //:ELSE
   } 
   else
   { 
      //:SysCloseFile( OperationGroup, lFile, 0 )
      SysCloseFile( OperationGroup, lFile, 0 );
      //:// Get current executable File.
      //:ActivateOI_FromFile( OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE )
      ActivateOI_FromFile( &OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE );

      //:// Delete current source file entries.
      //:FOR EACH OperationXOG.GLOBALOPERATIONSOURCEFILE 
      RESULT = SetCursorFirstEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 
         //:DELETE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE NONE 
         RESULT = DeleteEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zREPOS_NONE );
         RESULT = SetCursorNextEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" );
      } 

      //:END
   } 

   //:END
   //:NAME VIEW OperationXOG "OperationXOG"
   SetNameForView( OperationXOG, "OperationXOG", 0, zLEVEL_TASK );

   //:// Build the executable components from each POG Operation.
   //:SET CURSOR FIRST CurrentLPLR.W_MetaType WHERE CurrentLPLR.W_MetaType.Type = 14   // 14 is Global Operation Group 
   RESULT = SetCursorFirstEntityByInteger( CurrentLPLR, "W_MetaType", "Type", 14, "" );
   //:FOR EACH CurrentLPLR.W_MetaDef 
   RESULT = SetCursorFirstEntity( CurrentLPLR, "W_MetaDef", "" );
   while ( RESULT > zCURSOR_UNCHANGED )
   { 
      //:POG_FileName = CurrentLPLR.LPLR.MetaSrcDir + "\" + CurrentLPLR.W_MetaDef.Name + ".POG"
      GetStringFromAttribute( POG_FileName, CurrentLPLR, "LPLR", "MetaSrcDir" );
      ZeidonStringConcat( POG_FileName, 1, 0, "\\", 1, 0, 514 );
      GetVariableFromAttribute( szTempString_1, 0, 'S', 33, CurrentLPLR, "W_MetaDef", "Name", "", 0 );
      ZeidonStringConcat( POG_FileName, 1, 0, szTempString_1, 1, 0, 514 );
      ZeidonStringConcat( POG_FileName, 1, 0, ".POG", 1, 0, 514 );
      //:nRC = ActivateOI_FromFile( OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 )
      nRC = ActivateOI_FromFile( &OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 );
      //:IF nRC < 0
      if ( nRC < 0 )
      { 
         //:szMsg = "Can't open POG file, " + POG_FileName
         ZeidonStringCopy( szMsg, 1, 0, "Can't open POG file, ", 1, 0, 201 );
         ZeidonStringConcat( szMsg, 1, 0, POG_FileName, 1, 0, 201 );
         //:IssueError( OperationGroup,0,0, szMsg )
         IssueError( OperationGroup, 0, 0, szMsg );
         //:RETURN -1
         return( -1 );
      } 

      //:END
      //:// Create Source file entry.
      //:CREATE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE 
      RESULT = CreateEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zPOS_AFTER );
      //:OperationXOG.GLOBALOPERATIONSOURCEFILE.NAME         = OperationGroupT.GlobalOperationGroup.Name 
      SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "NAME", OperationGroupT, "GlobalOperationGroup", "Name" );
      //:OperationXOG.GLOBALOPERATIONSOURCEFILE.LANGUAGETYPE = OperationGroupT.GlobalOperationGroup.LanguageType 
      SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "LANGUAGETYPE", OperationGroupT, "GlobalOperationGroup", "LanguageType" );

      //:// Create each Operation entry.
      //:FOR EACH OperationGroupT.Operation 
      RESULT = SetCursorFirstEntity( OperationGroupT, "Operation", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 
         //:CREATE ENTITY OperationXOG.OPERATION 
         RESULT = CreateEntity( OperationXOG, "OPERATION", zPOS_AFTER );
         //:OperationXOG.OPERATION.NAME = OperationGroupT.Operation.Name 
         SetAttributeFromAttribute( OperationXOG, "OPERATION", "NAME", OperationGroupT, "Operation", "Name" );
         //:OperationXOG.OPERATION.TYPE = OperationGroupT.Operation.Type 
         SetAttributeFromAttribute( OperationXOG, "OPERATION", "TYPE", OperationGroupT, "Operation", "Type" );

         //:FOR EACH OperationGroupT.Parameter 
         RESULT = SetCursorFirstEntity( OperationGroupT, "Parameter", "" );
         while ( RESULT > zCURSOR_UNCHANGED )
         { 
            //:CREATE ENTITY OperationXOG.PARAMETER 
            RESULT = CreateEntity( OperationXOG, "PARAMETER", zPOS_AFTER );
            //:OperationXOG.PARAMETER.NAME     = OperationGroupT.Parameter.ShortDesc 
            SetAttributeFromAttribute( OperationXOG, "PARAMETER", "NAME", OperationGroupT, "Parameter", "ShortDesc" );
            //:OperationXOG.PARAMETER.DATATYPE = OperationGroupT.Parameter.DataType 
            SetAttributeFromAttribute( OperationXOG, "PARAMETER", "DATATYPE", OperationGroupT, "Parameter", "DataType" );
            RESULT = SetCursorNextEntity( OperationGroupT, "Parameter", "" );
         } 

         RESULT = SetCursorNextEntity( OperationGroupT, "Operation", "" );
         //:END 
      } 

      RESULT = SetCursorNextEntity( CurrentLPLR, "W_MetaDef", "" );
      //:END
   } 

   //:END
   //:CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII )
   CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII );
   //:DropObjectInstance( OperationXOG )
   DropObjectInstance( OperationXOG );
   return( 0 );
// END
} 
Esempio n. 16
0
//:   VIEW OldOperGrp  BASED ON LOD TZOGSRCO
zOPER_EXPORT zSHORT OPERATION
oTZOGSRCO_GlobalOperGrpMigrate( zVIEW     NewOperGrp,
                                zPCHAR    OperGroupMetaName,
                                zVIEW     SourceLPLR,
                                zVIEW     vSubtask )
{
   zVIEW     OldOperGrp = 0; 
   //:VIEW CurrentLPLR BASED ON LOD TZCMLPLO
   zVIEW     CurrentLPLR = 0; 

   //:STRING ( 513 ) SourceFileName                    // size according to zMAX_FILESPEC+1
   zCHAR     SourceFileName[ 514 ] = { 0 }; 
   //:STRING ( 513 ) SourceFileName2                   // size according to zMAX_FILESPEC+1
   zCHAR     SourceFileName2[ 514 ] = { 0 }; 
   //:STRING ( 36 ) SourceName
   zCHAR     SourceName[ 37 ] = { 0 }; 
   zSHORT    lTempInteger_0; 
   zSHORT    RESULT; 
   zCHAR     szTempString_0[ 33 ]; 


   //:// Activate existing source meta OldOperGroup
   //:SourceFileName = SourceLPLR.LPLR.MetaSrcDir + "\" + OperGroupMetaName + ".POG"
   GetStringFromAttribute( SourceFileName, SourceLPLR, "LPLR", "MetaSrcDir" );
   ZeidonStringConcat( SourceFileName, 1, 0, "\\", 1, 0, 514 );
   ZeidonStringConcat( SourceFileName, 1, 0, OperGroupMetaName, 1, 0, 514 );
   ZeidonStringConcat( SourceFileName, 1, 0, ".POG", 1, 0, 514 );
   //:// zIGNORE_ATTRIB_ERRORS=8192
   //:ActivateOI_FromFile( OldOperGrp, "TZOGSRCO", SourceLPLR,
   //:                     SourceFileName, zSINGLE + 8192 )
   ActivateOI_FromFile( &OldOperGrp, "TZOGSRCO", SourceLPLR, SourceFileName, zSINGLE + 8192 );
   //:NAME VIEW OldOperGrp "OldOperGrp"
   SetNameForView( OldOperGrp, "OldOperGrp", 0, zLEVEL_TASK );
   //://ActivateEmptyMetaOI( vSubtask, NewOperGrp, 14, zSINGLE ) // 14 is zSOURCE_GOPGRP_META
   //://NAME VIEW NewOperGrp "NewOperGrp"

   //:IF NewOperGrp.GlobalOperationGroup DOES NOT EXIST
   lTempInteger_0 = CheckExistenceOfEntity( NewOperGrp, "GlobalOperationGroup" );
   if ( lTempInteger_0 != 0 )
   { 

      //:// The Global Operation Group does not exist in the target, so simply copy everything over.

      //:CreateMetaEntity( vSubtask, NewOperGrp, "GlobalOperationGroup", zPOS_AFTER )
      CreateMetaEntity( vSubtask, NewOperGrp, "GlobalOperationGroup", zPOS_AFTER );
      //:SetMatchingAttributesByName( NewOperGrp, "GlobalOperationGroup", OldOperGrp, "GlobalOperationGroup", zSET_NULL )
      SetMatchingAttributesByName( NewOperGrp, "GlobalOperationGroup", OldOperGrp, "GlobalOperationGroup", zSET_NULL );

      //:// Copy over the source file to the new LPLR directory, if there is a source file.
      //:// We will assume a source file exists if the SourceFile.Extension is not null.  If there
      //:// is actually no source file, the CopyFile does no harm.
      //:IF OldOperGrp.GlobalOperationGroup.Extension != ""
      if ( CompareAttributeToString( OldOperGrp, "GlobalOperationGroup", "Extension", "" ) != 0 )
      { 
         //:RetrieveViewForMetaList( vSubtask, CurrentLPLR, zSOURCE_ERD_META ) // Get view for directory info.
         RetrieveViewForMetaList( vSubtask, &CurrentLPLR, zSOURCE_ERD_META );
         //:ResetViewFromSubobject( CurrentLPLR )
         ResetViewFromSubobject( CurrentLPLR );
         //:IF OldOperGrp.GlobalOperationGroup.Extension = "C"
         if ( CompareAttributeToString( OldOperGrp, "GlobalOperationGroup", "Extension", "C" ) == 0 )
         { 
            //:SourceName = OperGroupMetaName + ".C"
            ZeidonStringCopy( SourceName, 1, 0, OperGroupMetaName, 1, 0, 37 );
            ZeidonStringConcat( SourceName, 1, 0, ".C", 1, 0, 37 );
            //:ELSE
         } 
         else
         { 
            //:SourceName = OperGroupMetaName + ".VML"
            ZeidonStringCopy( SourceName, 1, 0, OperGroupMetaName, 1, 0, 37 );
            ZeidonStringConcat( SourceName, 1, 0, ".VML", 1, 0, 37 );
         } 

         //:END
         //:SourceFileName = SourceLPLR.LPLR.PgmSrcDir + "\" + SourceName
         GetStringFromAttribute( SourceFileName, SourceLPLR, "LPLR", "PgmSrcDir" );
         ZeidonStringConcat( SourceFileName, 1, 0, "\\", 1, 0, 514 );
         ZeidonStringConcat( SourceFileName, 1, 0, SourceName, 1, 0, 514 );
         //:SourceFileName2 = CurrentLPLR.LPLR.PgmSrcDir + "\" + SourceName
         GetStringFromAttribute( SourceFileName2, CurrentLPLR, "LPLR", "PgmSrcDir" );
         ZeidonStringConcat( SourceFileName2, 1, 0, "\\", 1, 0, 514 );
         ZeidonStringConcat( SourceFileName2, 1, 0, SourceName, 1, 0, 514 );
         //:SysCopyFile( vSubtask, SourceFileName, SourceFileName2, TRUE )
         SysCopyFile( vSubtask, SourceFileName, SourceFileName2, TRUE );
         //:DropMetaOI( vSubtask, CurrentLPLR )
         DropMetaOI( vSubtask, CurrentLPLR );
      } 

      //:END

      //:FOR EACH OldOperGrp.Operation
      RESULT = SetCursorFirstEntity( OldOperGrp, "Operation", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 

         //:CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER )
         CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER );
         //:SetMatchingAttributesByName ( NewOperGrp, "Operation", OldOperGrp,
         //:                              "Operation", zSET_NULL )
         SetMatchingAttributesByName( NewOperGrp, "Operation", OldOperGrp, "Operation", zSET_NULL );

         //:FOR EACH OldOperGrp.Parameter
         RESULT = SetCursorFirstEntity( OldOperGrp, "Parameter", "" );
         while ( RESULT > zCURSOR_UNCHANGED )
         { 
            //:// Make sure the ShortDesc in the Parameter is not null.
            //:IF OldOperGrp.Parameter.ShortDesc = ""
            if ( CompareAttributeToString( OldOperGrp, "Parameter", "ShortDesc", "" ) == 0 )
            { 
               //:OldOperGrp.Parameter.ShortDesc = "Parm"
               SetAttributeFromString( OldOperGrp, "Parameter", "ShortDesc", "Parm" );
            } 

            //:END
            //:CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER )
            CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER );
            //:SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp,
            //:                             "Parameter", zSET_NULL )
            SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp, "Parameter", zSET_NULL );
            RESULT = SetCursorNextEntity( OldOperGrp, "Parameter", "" );
         } 

         RESULT = SetCursorNextEntity( OldOperGrp, "Operation", "" );
         //:END
      } 


      //:END

      //:ELSE
   } 
   else
   { 

      //:// The Global Operation Group exists in the target, so merge in any new Operations.
      //:// We will force over any Operations (both prototype and code) for any Operations not flagged as modified in target LPLR.

      //:FOR EACH OldOperGrp.Operation
      RESULT = SetCursorFirstEntity( OldOperGrp, "Operation", "" );
      while ( RESULT > zCURSOR_UNCHANGED )
      { 

         //:SET CURSOR FIRST NewOperGrp.Operation WHERE NewOperGrp.Operation.Name = OldOperGrp.Operation.Name
         GetStringFromAttribute( szTempString_0, OldOperGrp, "Operation", "Name" );
         RESULT = SetCursorFirstEntityByString( NewOperGrp, "Operation", "Name", szTempString_0, "" );
         //:IF RESULT < zCURSOR_SET
         if ( RESULT < zCURSOR_SET )
         { 
            //:CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER )
            CreateMetaEntity( vSubtask, NewOperGrp, "Operation", zPOS_AFTER );
            //:SetMatchingAttributesByName ( NewOperGrp, "Operation", OldOperGrp, "Operation", zSET_NULL )
            SetMatchingAttributesByName( NewOperGrp, "Operation", OldOperGrp, "Operation", zSET_NULL );
         } 

         //:END

         //:// If the operation is new or modifiable, set new parameters and operation code.
         //:IF NewOperGrp.Operation.DoNotMergeFlag = ""
         if ( CompareAttributeToString( NewOperGrp, "Operation", "DoNotMergeFlag", "" ) == 0 )
         { 
            //:FOR EACH NewOperGrp.Parameter
            RESULT = SetCursorFirstEntity( NewOperGrp, "Parameter", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            { 
               //:DELETE ENTITY NewOperGrp.Parameter NONE
               RESULT = DeleteEntity( NewOperGrp, "Parameter", zREPOS_NONE );
               RESULT = SetCursorNextEntity( NewOperGrp, "Parameter", "" );
            } 

            //:END
            //:FOR EACH OldOperGrp.Parameter
            RESULT = SetCursorFirstEntity( OldOperGrp, "Parameter", "" );
            while ( RESULT > zCURSOR_UNCHANGED )
            { 
               //:// Make sure the ShortDesc in the Parameter is not null.
               //:IF OldOperGrp.Parameter.ShortDesc = ""
               if ( CompareAttributeToString( OldOperGrp, "Parameter", "ShortDesc", "" ) == 0 )
               { 
                  //:OldOperGrp.Parameter.ShortDesc = "Parm"
                  SetAttributeFromString( OldOperGrp, "Parameter", "ShortDesc", "Parm" );
               } 

               //:END
               //:CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER )
               CreateMetaEntity( vSubtask, NewOperGrp, "Parameter", zPOS_AFTER );
               //:SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp, "Parameter", zSET_NULL )
               SetMatchingAttributesByName( NewOperGrp, "Parameter", OldOperGrp, "Parameter", zSET_NULL );
               RESULT = SetCursorNextEntity( OldOperGrp, "Parameter", "" );
            } 

            //:END
         } 

         RESULT = SetCursorNextEntity( OldOperGrp, "Operation", "" );

         //:   // Add new Operation Code.
         //:   // CopyOperationCode

         //:END
      } 


      //:END
   } 


   //:END



   //:DropObjectInstance( OldOperGrp )
   DropObjectInstance( OldOperGrp );
   //:CommitMetaOI( vSubtask, NewOperGrp, 14 )   // 14 is zSOURCE_GOPGRP_META
   CommitMetaOI( vSubtask, NewOperGrp, 14 );

   //:// Build the prototypes in zeidon.h file.
   //:RetrieveViewForMetaList( vSubtask, CurrentLPLR, zSOURCE_GOPGRP_META ) // Get view for Merge oper.
   RetrieveViewForMetaList( vSubtask, &CurrentLPLR, zSOURCE_GOPGRP_META );
   //:ResetViewFromSubobject( CurrentLPLR )
   ResetViewFromSubobject( CurrentLPLR );
   //:MergeGlobalPrototypes( NewOperGrp,
   //:                       NewOperGrp.GlobalOperationGroup.Name,
   //:                       "GlobalOperationGroup",
   //:                       CurrentLPLR )
   GetStringFromAttribute( szTempString_0, NewOperGrp, "GlobalOperationGroup", "Name" );
   MergeGlobalPrototypes( NewOperGrp, szTempString_0, "GlobalOperationGroup", CurrentLPLR );
   //:DropMetaOI( vSubtask, CurrentLPLR )
   DropMetaOI( vSubtask, CurrentLPLR );
   return( 0 );
// END
}