//: VIEW TZZOLODO REGISTERED AS TZZOLODO zOPER_EXPORT zSHORT OPERATION CopyEntityGroupMappingStart( zVIEW vSubtask ) { zVIEW TZZOLODO = 0; zSHORT RESULT; //:STRING ( 100 ) MappingName zCHAR MappingName[ 101 ] = { 0 }; zSHORT lTempInteger_0; zCHAR szTempString_0[ 33 ]; RESULT = GetViewByName( &TZZOLODO, "TZZOLODO", vSubtask, zLEVEL_TASK ); //:// Copy the mapping name of the attribute to the clip board. //:IF TZZOLODO.LOD_Entity EXISTS lTempInteger_0 = CheckExistenceOfEntity( TZZOLODO, "LOD_Entity" ); if ( lTempInteger_0 == 0 ) { //:MappingName = "[Z:#S:" + //: TZZOLODO.LOD_Entity.Name + "]" GetVariableFromAttribute( szTempString_0, 0, 'S', 33, TZZOLODO, "LOD_Entity", "Name", "", 0 ); ZeidonStringCopy( MappingName, 1, 0, "[Z:#S:", 1, 0, 101 ); ZeidonStringConcat( MappingName, 1, 0, szTempString_0, 1, 0, 101 ); ZeidonStringConcat( MappingName, 1, 0, "]", 1, 0, 101 ); //:SetClipboardBlob( MappingName, 0, 0 ) SetClipboardBlob( MappingName, 0, 0 ); } //:END return( 0 ); // END }
//: STRING ( 32 ) szEntityName static zSHORT oTZRPSRCO_XML_PageHeaderFooter( zVIEW vReportDef, zVIEW vSourceOI, zPCHAR szOutputLine, zLONG lFileHandle, zPCHAR szIndentationValue ) { zCHAR szEntityName[ 33 ] = { 0 }; //:STRING ( 50 ) szIndentationSubValue zCHAR szIndentationSubValue[ 51 ] = { 0 }; zSHORT lTempInteger_0; //:IF vReportDef.Control EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDef, "Control" ); if ( lTempInteger_0 == 0 ) { //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ); } //:END return( 0 ); // END }
zOPER_EXPORT zLONG OPERATION GetExecModeByZKey( zVIEW lpInterpSubtask, zVIEW lpAppSubtask, zLONG lZKey ) { zVIEW vXChecker; zVIEW CM_List; zCHAR szExecDir[ zMAX_FILESPEC_LTH + 1 ]; zSHORT nRC; nRC = GetViewByName( &vXChecker, "TZVSXCOO", lpInterpSubtask, zLEVEL_APPLICATION ); if ( nRC != zLEVEL_APPLICATION ) { nRC = GetViewByName( &CM_List, "TZCMWKSO", lpInterpSubtask, zLEVEL_APPLICATION ); nRC = 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 ); } nRC = SetCursorFirstEntityByInteger( vXChecker, "DialogOperation", "ZKey", lZKey, "APPLICATION" ); #if 0 if ( nRC != zCURSOR_SET ) return( -1 ); #else if ( nRC < zCURSOR_SET ) nRC = SetCursorFirstEntityByInteger( vXChecker, "LOD_Operation", "ZKey", lZKey, "APPLICATION" ); if ( nRC < zCURSOR_SET ) nRC = SetCursorFirstEntityByInteger( vXChecker, "Operation", "ZKey", lZKey, "APPLICATION" ); // why do this??? if ( nRC < zCURSOR_SET ) return( -1 ); #endif 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 ); } }
//: 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 }
//: VIEW vMappingOI static zSHORT oTZRPSRCO_GenerateXML_CtlRecurs( zVIEW vReportDef, zVIEW vSourceOI, zPCHAR szDrivingObjectViewName, zPCHAR szOutputLine, zLONG lFileHandle, zPCHAR szIndentationValue ) { zVIEW vMappingOI = 0; //:STRING ( 32 ) szEntityName zCHAR szEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szAttributeName zCHAR szAttributeName[ 33 ] = { 0 }; //:STRING ( 32 ) szMappingName zCHAR szMappingName[ 33 ] = { 0 }; //:STRING ( 32 ) szContextName zCHAR szContextName[ 33 ] = { 0 }; //:STRING ( 5000 ) szReturnedAttributeValue zCHAR szReturnedAttributeValue[ 5001 ] = { 0 }; //:STRING ( 5000 ) szConvertedAttributeValue zCHAR szConvertedAttributeValue[ 5001 ] = { 0 }; //:STRING ( 200 ) szMsg zCHAR szMsg[ 201 ] = { 0 }; zSHORT RESULT; zSHORT lTempInteger_0; zSHORT lTempInteger_1; zSHORT lTempInteger_2; //:// Generate an attribute entry for each attribute with mapping in the GroupSet. Note that these are all at the same //:// hierarchical level since we're assuming no tables within a GroupSet. However, the controls in the GroupSet may well be //:// organized hierarchically and must thus be processed recursively. //:// Sort the Controls in position order so they will be in the same order as in the XSLT. (This probably isn't //:// necessary, but it will simply debugging.) //:OrderEntityForView( vReportDef, "Control", "PSDLG_Y A PSDLG_X A" ) OrderEntityForView( vReportDef, "Control", "PSDLG_Y A PSDLG_X A" ); //:// Process each Control. The processing rule is simple: //:// If the control has mapping, build an XML node. //:// If the control doesn't have mapping, ignore it. //:// The only issue is that we must step down a level if the Control has a subcontrol. //:FOR EACH vReportDef.Control RESULT = SetCursorFirstEntity( vReportDef, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:IF vReportDef.CtrlCtrl EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDef, "CtrlCtrl" ); if ( lTempInteger_0 == 0 ) { //:SetViewToSubobject( vReportDef, "CtrlCtrl" ) SetViewToSubobject( vReportDef, "CtrlCtrl" ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingObjectViewName, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingObjectViewName, szOutputLine, lFileHandle, szIndentationValue ); //:ResetViewFromSubobject( vReportDef ) ResetViewFromSubobject( vReportDef ); //:ELSE } else { //:IF vReportDef.CtrlMapER_Attribute EXISTS lTempInteger_1 = CheckExistenceOfEntity( vReportDef, "CtrlMapER_Attribute" ); if ( lTempInteger_1 == 0 ) { //:// Format XML Line for Attribute. //:szReturnedAttributeValue = "" ZeidonStringCopy( szReturnedAttributeValue, 1, 0, "", 1, 0, 5001 ); //:szConvertedAttributeValue = "" ZeidonStringCopy( szConvertedAttributeValue, 1, 0, "", 1, 0, 5001 ); //:szAttributeName = vReportDef.CtrlMapER_Attribute.Name GetVariableFromAttribute( szAttributeName, 0, 'S', 33, vReportDef, "CtrlMapER_Attribute", "Name", "", 0 ); //:szEntityName = vReportDef.CtrlMapRelatedEntity.Name GetVariableFromAttribute( szEntityName, 0, 'S', 33, vReportDef, "CtrlMapRelatedEntity", "Name", "", 0 ); //:szContextName = "" ZeidonStringCopy( szContextName, 1, 0, "", 1, 0, 33 ); //:IF vReportDef.CtrlMapContext EXISTS lTempInteger_2 = CheckExistenceOfEntity( vReportDef, "CtrlMapContext" ); if ( lTempInteger_2 == 0 ) { //:szContextName = vReportDef.CtrlMapContext.Name GetVariableFromAttribute( szContextName, 0, 'S', 33, vReportDef, "CtrlMapContext", "Name", "", 0 ); } //:END //:IF vReportDef.CtrlMapView.Name = szDrivingObjectViewName // Check if mapping if from Driving Object View. if ( CompareAttributeToString( vReportDef, "CtrlMapView", "Name", szDrivingObjectViewName ) == 0 ) { //:GetStringFromAttributeByContext( szReturnedAttributeValue, vSourceOI, szEntityName, szAttributeName, szContextName, 5000 ) GetStringFromAttributeByContext( szReturnedAttributeValue, vSourceOI, szEntityName, szAttributeName, szContextName, 5000 ); //:ELSE } else { //:// Mapping is from separate view. //:szMappingName = vReportDef.CtrlMapView.Name GetVariableFromAttribute( szMappingName, 0, 'S', 33, vReportDef, "CtrlMapView", "Name", "", 0 ); //:GET VIEW vMappingOI NAMED szMappingName RESULT = GetViewByName( &vMappingOI, szMappingName, vReportDef, zLEVEL_TASK ); //:GetStringFromAttributeByContext( szReturnedAttributeValue, vMappingOI, szEntityName, szAttributeName, szContextName, 5000 ) GetStringFromAttributeByContext( szReturnedAttributeValue, vMappingOI, szEntityName, szAttributeName, szContextName, 5000 ); } //:END //:ConvertXML_SpecialCharacters( vReportDef, szConvertedAttributeValue, szReturnedAttributeValue, 5000 ) ConvertXML_SpecialCharacters( vReportDef, szConvertedAttributeValue, szReturnedAttributeValue, 5000 ); //:szOutputLine = szIndentationValue + " " + "<" + szEntityName + "." + szAttributeName + ">" + szConvertedAttributeValue ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " ", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "<", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ".", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szAttributeName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szConvertedAttributeValue, 1, 0, 5001 ); //:szOutputLine = szOutputLine + "</" + szEntityName + "." + szAttributeName + ">" ZeidonStringConcat( szOutputLine, 1, 0, "</", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ".", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szAttributeName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END } RESULT = SetCursorNextEntity( vReportDef, "Control", "" ); //:END } //:END return( 0 ); // END }
//: VIEW vReportDef BASED ON LOD TZRPSRCO zOPER_EXPORT zSHORT OPERATION oTZRPSRCO_GenerateXSLT_XML( zVIEW vSourceOI, zPCHAR szReportName, zPCHAR szXMLFileName, zPCHAR szTopEntityName ) { zVIEW vReportDef = 0; //:VIEW vReportLODRecurs BASED ON LOD TZRPSRCO zVIEW vReportLODRecurs = 0; //:VIEW vReportDefRoot BASED ON LOD TZRPSRCO zVIEW vReportDefRoot = 0; //:VIEW vSourceOIHier zVIEW vSourceOIHier = 0; //:VIEW vSourceOIDebug zVIEW vSourceOIDebug = 0; //:VIEW vLOD BASED ON LOD TZZOLODO zVIEW vLOD = 0; //:VIEW vTaskLPLR BASED ON LOD TZCMLPLO zVIEW vTaskLPLR = 0; //:STRING ( 200 ) szMsg zCHAR szMsg[ 201 ] = { 0 }; //:STRING ( 200 ) szFileName zCHAR szFileName[ 201 ] = { 0 }; //:STRING ( 32 ) szReturnedEntityName zCHAR szReturnedEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szLastReturnedEntityName zCHAR szLastReturnedEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szParentEntityName zCHAR szParentEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szDrivingViewName zCHAR szDrivingViewName[ 33 ] = { 0 }; //:STRING ( 50 ) szIndentationValue zCHAR szIndentationValue[ 51 ] = { 0 }; //:STRING ( 50 ) szIndentationSubValue zCHAR szIndentationSubValue[ 51 ] = { 0 }; //:STRING ( 1 ) szInNodeFlag zCHAR szInNodeFlag[ 2 ] = { 0 }; //:STRING ( 5000 ) szOutputLine zCHAR szOutputLine[ 5001 ] = { 0 }; //:INTEGER lFileHandle zLONG lFileHandle = 0; //:INTEGER Indentation zLONG Indentation = 0; //:SHORT ReturnedHierLevel zSHORT ReturnedHierLevel = 0; //:SHORT LastHierLevel zSHORT LastHierLevel = 0; //:SHORT nRC zSHORT nRC = 0; zSHORT lTempInteger_0; zSHORT RESULT; //:// Build an XSLT XML FO object for the passed in application object and Report Definition. //:// First we need to activate the report def... //:SysReadZeidonIni( -1, "[WorkStation]", "ResourcePath", szFileName ) SysReadZeidonIni( -1, "[WorkStation]", "ResourcePath", szFileName ); //://szFileName = "c:\lplr\zencas\bin\" //:szFileName = szFileName + szReportName + ".xrp" ZeidonStringConcat( szFileName, 1, 0, szReportName, 1, 0, 201 ); ZeidonStringConcat( szFileName, 1, 0, ".xrp", 1, 0, 201 ); //:SfActivateSysOI_FromFile( vReportDef, "TZRPSRCO", vSourceOI, szFileName, zSINGLE ) SfActivateSysOI_FromFile( &vReportDef, "TZRPSRCO", vSourceOI, szFileName, zSINGLE ); //:// Get the Name of the Driving object, as we will need that in processing mapping. //:IF vReportDef.DrivingViewObjRef EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDef, "DrivingViewObjRef" ); if ( lTempInteger_0 == 0 ) { //:szDrivingViewName = vReportDef.DrivingViewObjRef.Name GetVariableFromAttribute( szDrivingViewName, 0, 'S', 33, vReportDef, "DrivingViewObjRef", "Name", "", 0 ); //:ELSE } else { //:szMsg = "The report must have a 'Driving View' set in the report details." ZeidonStringCopy( szMsg, 1, 0, "The report must have a 'Driving View' set in the report details.", 1, 0, 201 ); //:MessageSend( vReportDef, "", "Generate XSLT", //: szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ) MessageSend( vReportDef, "", "Generate XSLT", szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ); //:RETURN -1 return( -1 ); } //:END //:// Open XML output file. //:SysReadZeidonIni( -1, "[Workstation]", "XSLTDirectory", szFileName ) SysReadZeidonIni( -1, "[Workstation]", "XSLTDirectory", szFileName ); //:szFileName = szFileName + szXMLFileName + ".xml" ZeidonStringConcat( szFileName, 1, 0, szXMLFileName, 1, 0, 201 ); ZeidonStringConcat( szFileName, 1, 0, ".xml", 1, 0, 201 ); //:lFileHandle = SysOpenFile( vReportDef, szFileName, COREFILE_WRITE ) lFileHandle = SysOpenFile( vReportDef, szFileName, COREFILE_WRITE ); //:IF lFileHandle < 0 if ( lFileHandle < 0 ) { //:szMsg = "Cannot open XSLT Output File, " + szFileName ZeidonStringCopy( szMsg, 1, 0, "Cannot open XSLT Output File, ", 1, 0, 201 ); ZeidonStringConcat( szMsg, 1, 0, szFileName, 1, 0, 201 ); //:MessageSend( vReportDef, "", "Generate XSLT", //: szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ) MessageSend( vReportDef, "", "Generate XSLT", szMsg, zMSGQ_OBJECT_CONSTRAINT_WARNING, 0 ); //:RETURN -1 return( -1 ); } //:END //:// Navigate the vSourceOI object/subobject hierarchically and create an XML node for each entity that has a corresponding //:// GroupSet entity in the Report Def. //:// Generate basic header. //:szOutputLine = "<?xml version=" + QUOTES + "1.0" + QUOTES + " encoding=" + QUOTES + "iso-8859-1" + QUOTES + "?>" ZeidonStringCopy( szOutputLine, 1, 0, "<?xml version=", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "1.0", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " encoding=", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "iso-8859-1", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, QUOTES, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "?>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szOutputLine = "<zOI>" ZeidonStringCopy( szOutputLine, 1, 0, "<zOI>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:// Process the page header. //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Type = "PH" RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Type", "PH", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = "<PageHeader>" ZeidonStringCopy( szOutputLine, 1, 0, "<PageHeader>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ); //:szOutputLine = "</PageHeader>" ZeidonStringCopy( szOutputLine, 1, 0, "</PageHeader>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:szOutputLine = " <GR_" + szTopEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, " <GR_", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szTopEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:// Process Top Entity Header, if it exists. //:CreateViewFromView( vReportLODRecurs, vReportDef ) CreateViewFromView( &vReportLODRecurs, vReportDef ); //:GenerateXML_LODRecurs( vReportDef, vReportLODRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_GenerateXML_LODRecurs( vReportDef, vReportLODRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ); //:szOutputLine = " </GR_" + szTopEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, " </GR_", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szTopEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:// Process the page footer. //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Type = "PF" RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Type", "PF", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = "<PageFooter>" ZeidonStringCopy( szOutputLine, 1, 0, "<PageFooter>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ) oTZRPSRCO_XML_PageHeaderFooter( vReportDef, vSourceOI, szOutputLine, lFileHandle, szIndentationValue ); //:szOutputLine = "</PageFooter>" ZeidonStringCopy( szOutputLine, 1, 0, "</PageFooter>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:// Terminate and close the XML file. //:szOutputLine = "</zOI>" ZeidonStringCopy( szOutputLine, 1, 0, "</zOI>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:SysCloseFile( vReportDef, lFileHandle, 0 ) SysCloseFile( vReportDef, lFileHandle, 0 ); return( 0 ); // END }
//: STRING ( 32 ) szEntityName zOPER_EXPORT zSHORT OPERATION oTZRPSRCO_GenerateXML_LODRecurs( zVIEW vReportDef, zVIEW vReportDefRecurs, zVIEW vSourceOI, zPCHAR szOutputLine, zLONG lFileHandle, zPCHAR szIndentationValue ) { zCHAR szEntityName[ 33 ] = { 0 }; //:STRING ( 32 ) szDrivingViewName zCHAR szDrivingViewName[ 33 ] = { 0 }; //:STRING ( 50 ) szIndentationSubValue zCHAR szIndentationSubValue[ 51 ] = { 0 }; //:STRING ( 10 ) szCnt zCHAR szCnt[ 11 ] = { 0 }; //:SHORT nRC zSHORT nRC = 0; zSHORT RESULT; zSHORT lTempInteger_0; zSHORT lTempInteger_1; //:szDrivingViewName = vReportDef.DrivingViewObjRef.Name GetVariableFromAttribute( szDrivingViewName, 0, 'S', 33, vReportDef, "DrivingViewObjRef", "Name", "", 0 ); //:// Build one level of the PartialReportEntity subobject, matching the structure of the Driving LOD and //:// setting the ReportDisplayFlag entity for any entity with a corresponding GroupSet entity in the report, or having //:// a PartialReportEntityChild entity with a corresponding GroupSet entity. The flag is set to "D" if the entity has //:// a corresponding GroupSet entity and to a "C" if it has a child with a corresponding GroupSet entity. //:FOR EACH vReportDefRecurs.PartialReportEntity RESULT = SetCursorFirstEntity( vReportDefRecurs, "PartialReportEntity", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:szEntityName = vReportDefRecurs.PartialReportEntity.Name GetVariableFromAttribute( szEntityName, 0, 'S', 33, vReportDefRecurs, "PartialReportEntity", "Name", "", 0 ); //: //:// If ReportDisplayFlag = "D" then this is an entity that is displayed on the report (there is a GroupSet). //:// Otherwise, it's a parent entity where one of it's children is displayed on the report. //:IF vReportDefRecurs.PartialReportEntity.ReportDisplayFlag = "D" if ( CompareAttributeToString( vReportDefRecurs, "PartialReportEntity", "ReportDisplayFlag", "D" ) == 0 ) { //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Tag = szEntityName RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Tag", szEntityName, "" ); //:IF RESULT < zCURSOR_SET if ( RESULT < zCURSOR_SET ) { } //: // There is an error because the report should have a GroupSet for this. //:END //:nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ); //:// Process group header //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "gh" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "gh", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = szIndentationValue + " <" + szEntityName + "Header>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " <", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Header>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ); //:szOutputLine = szIndentationValue + " </" + szEntityName + "Header>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " </", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Header>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:// Go to generate an attribute entry for each attribute with mapping in the Detail Group of the GroupSet. //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "ga" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "ga", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //: //:// Loop through vSourceOI for each entity //:LOOP WHILE nRC >= zCURSOR_SET while ( nRC >= zCURSOR_SET ) { //:szOutputLine = szIndentationValue + " <" + szEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " <", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szDrivingViewName, szOutputLine, lFileHandle, szIndentationSubValue ); //:// Check to see if there are child entities. //:IF vReportDefRecurs.PartialReportEntityChild EXISTS lTempInteger_0 = CheckExistenceOfEntity( vReportDefRecurs, "PartialReportEntityChild" ); if ( lTempInteger_0 == 0 ) { //:SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ) SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:nRC = GenerateXML_LODRecurs( vReportDef, //: vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ) nRC = oTZRPSRCO_GenerateXML_LODRecurs( vReportDef, vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ); //:ResetViewFromSubobject( vReportDefRecurs ) ResetViewFromSubobject( vReportDefRecurs ); //:// We need to reset on the report GroupSet/Group because it has been changed when we go down levels. //:SET CURSOR FIRST vReportDef.GroupSet WHERE vReportDef.GroupSet.Tag = szEntityName RESULT = SetCursorFirstEntityByString( vReportDef, "GroupSet", "Tag", szEntityName, "" ); //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "ga" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "ga", "" ); } //:END //:// End of checking for child entities... //:szOutputLine = szIndentationValue + " </" + szEntityName + ">" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " </", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, ">", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ); } //:END } //:END //:// Process group footer. //:SET CURSOR FIRST vReportDef.Group WHERE vReportDef.Group.Type = "gf" RESULT = SetCursorFirstEntityByString( vReportDef, "Group", "Type", "gf", "" ); //:IF RESULT >= zCURSOR_SET if ( RESULT >= zCURSOR_SET ) { //:szOutputLine = szIndentationValue + " <" + szEntityName + "Footer>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " <", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Footer>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ) oTZRPSRCO_GenerateXML_CtlRecurs( vReportDef, vSourceOI, szEntityName, szOutputLine, lFileHandle, szIndentationSubValue ); //:szOutputLine = szIndentationValue + " </" + szEntityName + "Footer>" ZeidonStringCopy( szOutputLine, 1, 0, szIndentationValue, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, " </", 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, szEntityName, 1, 0, 5001 ); ZeidonStringConcat( szOutputLine, 1, 0, "Footer>", 1, 0, 5001 ); //:GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ) oTZRPSRCO_GenerateXMLLine( vReportDef, lFileHandle, szOutputLine ); } //:END //:ELSE } else { //:// Maybe the parent isn't being displayed but a child might be, so we need to check... //: //:// Loop through vSourceOI for each entity //:nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorFirstEntity( vSourceOI, szEntityName, "" ); //:LOOP WHILE nRC >= zCURSOR_SET while ( nRC >= zCURSOR_SET ) { //:IF vReportDefRecurs.PartialReportEntityChild EXISTS lTempInteger_1 = CheckExistenceOfEntity( vReportDefRecurs, "PartialReportEntityChild" ); if ( lTempInteger_1 == 0 ) { //:SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ) SetViewToSubobject( vReportDefRecurs, "PartialReportEntityChild" ); //:szIndentationSubValue = szIndentationValue + " " ZeidonStringCopy( szIndentationSubValue, 1, 0, szIndentationValue, 1, 0, 51 ); ZeidonStringConcat( szIndentationSubValue, 1, 0, " ", 1, 0, 51 ); //:nRC = GenerateXML_LODRecurs( vReportDef, //: vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ) nRC = oTZRPSRCO_GenerateXML_LODRecurs( vReportDef, vReportDefRecurs, vSourceOI, szOutputLine, lFileHandle, szIndentationSubValue ); //:ResetViewFromSubobject( vReportDefRecurs ) ResetViewFromSubobject( vReportDefRecurs ); } //: //:END //:nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ) nRC = SetCursorNextEntity( vSourceOI, szEntityName, "" ); } //:END } RESULT = SetCursorNextEntity( vReportDefRecurs, "PartialReportEntity", "" ); //:END } //: //:END // FOR EACH vReportDefRecurs.PartialReportEntity return( 0 ); // END }
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 ); } }
//: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 }
//: 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 }