zOPER_EXPORT zSHORT OPERATION IncludeAttributeMapping( zVIEW vSubtask, zVIEW OrigW, zVIEW OrigWC ) { #if 0 zVIEW vLOD; zVIEW LOD_List; zVIEW vDomain; zVIEW DomainList; zSHORT nZRetCode; zSHORT RESULT; zCHAR szTempString_0[ 33 ]; RetrieveViewForMetaList( vSubtask, &LOD_List, zREFER_LOD_META ); GetStringFromAttribute( szTempString_0, OrigW, "LOD", "Name" ); SetCursorFirstEntityByString( LOD_List, "W_MetaDef", "Name", szTempString_0, "" ); ActivateMetaOI( vSubtask, &vLOD, LOD_List, zREFER_LOD_META, zSINGLE ); GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_EntityName" ); RESULT = SetCursorFirstEntityByString( vLOD, "LOD_Entity", "Name", szTempString_0, "" ); if ( RESULT >= 0 ) { nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_AttributeName" ); RESULT = SetCursorFirstEntityByString( vLOD, "ER_Attribute", "Name", szTempString_0, "LOD_Entity" ); if ( RESULT >= 0 ) { nZRetCode = IncludeSubobjectFromSubobject( OrigWC, "CtrlMapLOD_Attribute", vLOD, "LOD_Attribute", zPOS_AFTER ); if ( CompareAttributeToString ( OrigWC, "CtrlMap", "X_Context", "" ) != 0 ) { nZRetCode = RetrieveViewForMetaList( vSubtask, &DomainList, zREFER_DOMAIN_META ); nZRetCode = GetStringFromAttribute( szTempString_0, vLOD, "Domain", "Name" ); RESULT = SetCursorFirstEntityByString( DomainList, "W_MetaDef", "Name", szTempString_0, "" ); nZRetCode = ActivateMetaOI( vSubtask, &vDomain, DomainList, zREFER_DOMAIN_META, zSINGLE ); nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_Context" ); RESULT = SetCursorFirstEntityByString( vDomain, "Context", "Name", szTempString_0, "" ); if ( RESULT >= 0 ) { nZRetCode = IncludeSubobjectFromSubobject( OrigWC, "CtrlMapContext", vDomain, "Context", zPOS_AFTER ); } nZRetCode = DropMetaOI( vSubtask, vDomain ); nZRetCode = DropView( DomainList ); } } } nZRetCode = DropMetaOI( vSubtask, vLOD ); nZRetCode = DropView( LOD_List ); #endif return( 0 ); }
zOPER_EXPORT zSHORT OPERATION OpIns_RebuildOperList( zVIEW vSubtask ) { zCHAR szCurrentType[ 5 ]; zVIEW vProfileXFER; zVIEW vEdWrk; 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 delete the list. if ( SetCursorFirstEntityByString( vEdWrk, "OperListType", "Type", szCurrentType, 0 ) == zCURSOR_SET ) { DeleteEntity( vEdWrk, "OperListType", zREPOS_FIRST ); } // if ( SetCursor...)... // Now call BuildOperList to rebuild the oper list. OpIns_BuildOperList( vSubtask ); return( 0 ); } // OpIns_RebuildOperList
zOPER_EXPORT zSHORT OPERATION UpgradeAction( zVIEW vSubtask, zVIEW OrigW ) { #if 0 zSHORT RESULT; zCHAR szTempString_0[ 33 ]; zSHORT nZRetCode; if ( CompareAttributeToString( OrigW, "Action", "OperName", "" ) != 0 ) { nZRetCode = GetStringFromAttribute( szTempString_0, OrigW, "Action", "OperName" ); RESULT = SetCursorFirstEntityByString( OrigW, "Operation", "Name", szTempString_0, "" ); if ( RESULT < 0 ) { nZRetCode = CreateMetaEntity( vSubtask, OrigW, "Operation", zPOS_AFTER ); SetAttributeFromAttribute( OrigW, "Operation", "Name", OrigW, "Action", "OperName" ); nZRetCode = IncludeSubobjectFromSubobject( OrigW, "SourceFileOfOperation", OrigW, "SourceFile", zPOS_AFTER ); SetAttributeFromString( OrigW, "Action", "OperName", ""); } nZRetCode = IncludeSubobjectFromSubobject( OrigW, "ActOper", OrigW, "Operation", zPOS_AFTER ); SetAttributeFromString( OrigW, "Action", "OperName", ""); } #endif return( 0 ); }
zOPER_EXPORT zSHORT OPERATION UpgradeCtrlMap( zVIEW vSubtask, zVIEW OrigW, zVIEW OrigWC ) { #if 0 zLONG lTempInteger_0; zSHORT RESULT; zCHAR szTempString_0[ 33 ]; zSHORT nZRetCode; zLONG lTempInteger_1; zLONG lTempInteger_2; lTempInteger_0 = CheckExistenceOfEntity( OrigWC, "CtrlMapView" ); if ( lTempInteger_0 >= 0 ) { nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMapView", "Name" ); RESULT = SetCursorFirstEntityByString( OrigW, "ViewObjRef", "Name", szTempString_0, "" ); } else { if ( CompareAttributeToString ( OrigWC, "CtrlMap", "X_ViewName", "" ) != 0 ) { nZRetCode = GetStringFromAttribute( szTempString_0, OrigWC, "CtrlMap", "X_ViewName" ); RESULT = SetCursorFirstEntityByString( OrigW, "ViewObjRef", "Name", szTempString_0, "" ); } } lTempInteger_1 = CheckExistenceOfEntity( OrigWC, "CtrlMapView" ); if ( lTempInteger_1 < 0 && CompareAttributeToString ( OrigWC, "CtrlMap", "X_ViewName", "" ) != 0 ) { nZRetCode = IncludeSubobjectFromSubobject( OrigWC, "CtrlMapView", OrigW, "ViewObjRef", zPOS_AFTER ); } lTempInteger_2 = CheckExistenceOfEntity( OrigWC, "CtrlMapLOD_Attribute" ); if ( lTempInteger_2 < 0 && CompareAttributeToString ( OrigWC, "CtrlMap", "X_AttributeName", "" ) != 0 ) { nZRetCode = IncludeAttributeMapping( vSubtask, OrigW, OrigWC ); } nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_ViewName", "" ); nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_EntityName", "" ); nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_AttributeName", "" ); nZRetCode = SetAttributeFromString( OrigWC, "CtrlMap", "X_Context", "" ); #endif return( 0 ); }
zOPER_EXPORT zSHORT OPERATION UpgradeControl( zVIEW vSubtask, zVIEW OrigW, zVIEW OrigWC, zVIEW vType, zVIEW vPE ) { #if 0 zLONG lType; zCHAR szTag[ 35 ]; zSHORT RESULT; zSHORT nZRetCode; RESULT = SetCursorFirstEntity( OrigWC, "CtrlCtrl", "" ); while ( RESULT >= 0 ) { nZRetCode = SetViewToSubobject( OrigWC, "CtrlCtrl" ); nZRetCode = UpgradeControl( vSubtask, OrigW, OrigWC, vType, vPE ); nZRetCode = ResetViewFromSubobject( OrigWC ); RESULT = SetCursorNextEntity( OrigWC, "CtrlCtrl", "" ); } RESULT = SetCursorFirstEntity( OrigWC, "CtrlMap", "" ); while ( RESULT >= 0 ) { nZRetCode = UpgradeCtrlMap( vSubtask, OrigW, OrigWC ); RESULT = SetCursorNextEntity( OrigWC, "CtrlMap", "" ); } // Upgrade Control to relate to ControlDef if ( CheckExistenceOfEntity ( OrigWC, "ControlDef" ) < 0 ) { GetIntegerFromAttribute( &lType, OrigWC, "Control", "Type" ); SetCursorFirstEntityByInteger( vType, "Control", "Type", lType, "" ); GetStringFromAttribute( szTag, vType, "Control", "Tag" ); SetCursorFirstEntityByString( vPE, "ControlDef", "Tag", szTag, "" ); IncludeSubobjectFromSubobject( OrigWC, "ControlDef", vPE, "ControlDef", zPOS_AFTER ); SetAttributeFromString ( OrigWC, "Control", "Type", ""); } #endif return( 0 ); }
zOPER_EXPORT zSHORT OPERATION VML_BuildTextList( zVIEW vSubtask ) { zSHORT i; zVIEW vProfileXFER; GetProfileView( &vProfileXFER ); // Add each of the 'standard' VML statements to the text list. for ( i = 0; VML_TextStrings[ i ].pszText != 0; i++ ) { if ( SetCursorFirstEntityByString( vProfileXFER, "VML_Text", "Text", VML_TextStrings[ i ].pszText, 0 ) != zCURSOR_SET ) { // Text doesn't exist, so create it. CreateEntity( vProfileXFER, "VML_Text", zPOS_LAST ); SetAttributeFromString( vProfileXFER, "VML_Text", "Text", VML_TextStrings[ i ].pszText ); SetAttributeFromString( vProfileXFER, "VML_Text", "Type", VML_TextStrings[ i ].pszType ); SetAttributeFromString( vProfileXFER, "VML_Text", "UserDefined", "N" ); if ( VML_TextStrings[ i ].pszInsertText ) SetAttributeFromString( vProfileXFER, "VML_Text", "InsertText", VML_TextStrings[ i ].pszInsertText ); if ( VML_TextStrings[ i ].pszInsertTextFull ) SetAttributeFromString( vProfileXFER, "VML_Text", "InsertTextFull", VML_TextStrings[ i ].pszInsertTextFull ); } } OrderEntityForView( vProfileXFER, "VML_Text", "Text A" ); VML_DisplayList( vSubtask ); return( 0 ); }
// // OPERATION: AddResultCondExpr // // DESCRIPTION: AddResultCondExpr // zOPER_EXPORT zLONG OPERATION AddResultCondExprToView( zVIEW vSubtask, zVIEW vTargetView, zLONG lOperator, zPCHAR pchCompareValue ) { zLONG lResultID; // zCHAR szConstant[ 31 ]; zLONG lDefineZKey; zLONG lVarDataType; lResultID = AddResult( vSubtask ); AddExprNodeEntityToView( vSubtask, vTargetView, qVARIABLE, qNUMERIC, qTSHORT, "ResultID", lResultID, 0 ); AddExprNodeEntityToView( vSubtask, vTargetView, qOPERATOR, qNUMERIC, qTINTEGER, "", lOperator, 0 ); #if 0 // Convert the Define value passed into a constant. SetCursorFirstEntityByString( g_lpSGView, "DefinedItem", "ExternalValue", pchCompareValue, "VML_XSource" ); GetVariableFromAttribute( szConstant, 0, zTYPE_STRING, 30, g_lpSGView, "DefinedItem", "InternalValue", 0, 0 ); AddExprNodeEntityToView( vSubtask, vTargetView, qCONSTANT, qNUMERIC, qTINTEGER, szConstant, 0, 0 ); #endif lDefineZKey = GetDefineZKey( vSubtask, &lVarDataType, pchCompareValue ); AddExprNodeEntityToView( vSubtask, vTargetView, qDEFINE, qZEIDONOPERATION, qTINTEGER, pchCompareValue, lDefineZKey, 0 ); // SetNameForView( vTargetView, "***TargetView", vSubtask, zLEVEL_TASK ); // IssueError( vSubtask, 0, 0, "AddResultCondExprToView" ); return( 0 ); }
zOPER_EXPORT zLONG OPERATION SyntaxError( zVIEW vSubtask, zLONG lErrorNumber, zPCHAR szErrorString ) { zVIEW vError; zVIEW vSearchError; zBOOL bFound; zBOOL bDone; zCHAR szMessage[ 256 ]; zCHAR szNum[ 10 ]; zLONG lRC; if ( GetViewByName( &vError, "TZVMEROO", vSubtask, zLEVEL_TASK ) > 0 ) { // IssueError( vError, 0, 0, "Syntax Error" ); // build msc type error message GetStringFromAttribute( szMessage, vError, "Root", "SourceFileName" ); zstrcat( szMessage, "(" ); zltoa( qqlineno, szNum ); zstrcat( szMessage, szNum ); zstrcat( szMessage, ") : error " ); zltoa( lErrorNumber, szNum ); zstrcat( szMessage, szNum ); zstrcat( szMessage, ": " ); zstrcat( szMessage, g_szMessages[ lErrorNumber - 501 ] ); switch ( lErrorNumber ) { case eQINVALIDFUNCTIONPARAM /*553*/: case eQINVALIDFUNCTIONDEF /*554*/ : case 556: break; default: zstrcat( szMessage, " Last Token " ); if ( !szErrorString || !szErrorString[ 0 ] ) zstrcat( szMessage, sQToken.szToken ); } zstrcat( szMessage, szErrorString ); // look to see if a similar error message has been posted // we need to match both nErrorNumber and szErrorString CreateViewFromViewForTask( &vSearchError, vError, 0 ); bFound = FALSE; bDone = FALSE; // Try to find 1st occurrence of current Last Token lRC = SetCursorFirstEntityByString( vSearchError, "Error", "LastToken", szErrorString, "" ); // if none was found, skip the following loop if ( lRC < zCURSOR_SET ) bDone = TRUE; while ( !bDone ) { // If we have found an occurrence of current Last Token if ( lRC >= zCURSOR_SET ) { // check error number lRC = CompareAttributeToInteger( vSearchError, "Error", "ErrorNumber", lErrorNumber ); // if a match if ( lRC == 0 ) { bDone = TRUE; bFound = TRUE; } // otherwise, look again else { lRC = SetCursorNextEntityByString( vSearchError, "Error", "LastToken", szErrorString, "" ); } } // otherwise, no more occurrences of szErrorString found else { // so we quit looking bDone = TRUE; } } // if a simlar error was NOT previously issued if ( bFound == FALSE ) { // put the error in error LOD CreateEntity( vError, "Error", zPOS_AFTER ); SetAttributeFromString ( vError, "Error", "String", szMessage ); SetAttributeFromString ( vError, "Error", "LastToken", szErrorString ); SetAttributeFromInteger( vError, "Error", "ErrorNumber", lErrorNumber ); // SysWriteLine( g_lfErrorHandle, "------" ); // SysWriteLine( g_lfErrorHandle, "------" ); SysWriteLine( vError, g_lfErrorHandle, szMessage ); } // drop the search view DropView( vSearchError ); } // some errors require the parsing process to be stopped, // because Object Engine errors would come up. switch ( lErrorNumber ) { case eQNOOPERATIONNAMEGIVEN: SkipRemainingFile( ); TraceLineS( "VML Parsing STOPPED on ERROR --", szMessage ); break; default: TraceLineS( "VML Parsing ERROR --", szMessage ); break; } return( 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 ); }
//: 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 InvokeInterp( zVIEW lpInterpSubtask, // Interpretor's subtask zVIEW lpAppSubtask, // application's subtask zPCHAR szSrcDLLName, // name of the dialog zPCHAR szOperationName, // operation to interp zPLONG plRC ) { zVIEW vXChecker; zSHORT nRC; zLONG lStepRC; zVIEW vStackObject; // view to the stack object zVIEW vS_View; zVIEW vZ_View; zVIEW vSO; zVIEW vSubtask = 0; zVIEW vTaskLPLR; zPVOID hWRKS = NULL; // Check to make sure the LPLR is active. GetViewByName( &vTaskLPLR, "TaskLPLR", lpAppSubtask, zLEVEL_TASK ); if ( vTaskLPLR == 0 ) InitializeLPLR( lpInterpSubtask, "" ); aInterpreterSave[ lMultiple ].vSubtask = lpInterpSubtask; if ( lMultiple > 0 ) { if ( lMultiple >= MAX_INTEPRETER_ENTRY ) { // Error, because number of recursive entries // is greater than MAX_INTEPRETER_ENTRY return( -99 ); } vSubtask = aInterpreterSave[ lMultiple -1 ].vSubtask; // save the global variables aInterpreterSave[ lMultiple -1 ].nStackPtr = g_nStackPtr; g_nStackPtr = 0; memcpy( aInterpreterSave[ lMultiple -1 ].nCallStack, g_nCallStack, zsizeof( g_nCallStack ) ); memset( g_nCallStack, 0, zsizeof( g_nCallStack ) ); aInterpreterSave[ lMultiple -1 ].vXPGView = g_vXPGView; g_vXPGView = 0; GetViewByName( &g_vStatementView, "StatementView", vSubtask, zLEVEL_SUBTASK ); aInterpreterSave[ lMultiple -1 ].vStatementView = g_vStatementView; g_vStatementView = 0; GetViewByName( &vSO, "StackObject", vSubtask, zLEVEL_SUBTASK ); aInterpreterSave[ lMultiple -1 ].vStackObject = vSO; memcpy( aInterpreterSave[ lMultiple -1 ].sValueStack, sValueStack, zsizeof( sValueStack ) ); memset( sValueStack, 0, zsizeof( sValueStack ) ); } lMultiple++; // see if we can load the XPG. if not, don't parse for now, exit out nRC = InitInterp( lpInterpSubtask, lpAppSubtask, szSrcDLLName ); if ( nRC < 0 ) { lStepRC = 1; // if the init failed return. goto EndOfInvokeInterp; } // Initialize the Working 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" ); lStepRC = 1; // if the init failed return. goto EndOfInvokeInterp; } if ( setjmp( g_jbWRKS ) != 0 ) { // Error return from longjmp WRKS_Close( &hWRKS ); lStepRC = 1; goto EndOfInvokeInterp; } // get the program object as it was loaded by the init function. GetViewByName( &g_vXPGView, "XPG", lpInterpSubtask, zLEVEL_SUBTASK ); // try to position at the correct operation in the Subtask nRC = SetCursorFirstEntityByString( g_vXPGView, "Operation", "Name", szOperationName, "" ); if ( nRC != zCURSOR_SET ) { // no error message here, as we assume that the operation // to be called is a C operation. // Returning -1, the driver will try to load it from the DLL lStepRC = -1; goto EndOfInvokeInterp; } SetCursorFirstEntityByEntityCsr( g_vXPGView, "SourceFile", g_vXPGView, "SourceFileOfOperation", "" ); SetCursorFirstEntityByEntityCsr( g_vXPGView, "OperationSource", g_vXPGView, "Operation", "" ); SetCursorFirstEntity( g_vXPGView, "OperationText", "" ); SetCursorFirstEntity( g_vXPGView, "Statement", "" ); CreateViewFromViewForTask( &g_vStatementView, g_vXPGView, 0 ); // Create all of the entities needed in the stack object SetStackObjectFromViews( lpInterpSubtask, g_vXPGView, // View to the XPG g_vStatementView, // View to the statement 0 ); // index into the expression // Get the stack object as it was loaded with the XPG GetViewByName( &vStackObject, "StackObject", lpInterpSubtask, zLEVEL_SUBTASK ); // ###blob SetAttributeFromInteger( vStackObject, // "Variable", "Value", (zLONG)lpAppSubtask ); SetAttributeFromBlob( vStackObject, "Variable", "Value", &lpAppSubtask, sizeof( void * ) ); SetNameForView( g_vStatementView, "StatementView", lpInterpSubtask, zLEVEL_SUBTASK ); SetNameForView( lpAppSubtask, "ApplicationView", lpInterpSubtask, zLEVEL_SUBTASK ); GetViewByName( &vXChecker, "TZVSXCOO", lpInterpSubtask, zLEVEL_APPLICATION ); if ( vXChecker != 0 ) { nRC = SetCursorFirstEntityByString( vXChecker, "DialogOperation", "Name", szOperationName, "" ); if ( nRC == zCURSOR_SET ) { GetViewByName( &vZ_View, "ZeidonVML", vSubtask, zLEVEL_TASK ); GetViewByName( &vS_View, "XPG", vZ_View, zLEVEL_SUBTASK ); SetAttributeFromString( vS_View, "Operation", "CurrentDebugFlag", "Y" ); lStepRC = zXC_SETUP_DEBUGGER; goto EndOfInvokeInterp; } } // lStepRC = zXC_STEP_EXECUTED; #if 0 OperationCount( 3 ); OperationCount( 1 ); #endif // Loop through each statement using the Go function. lStepRC = Go( lpAppSubtask, hWRKS, plRC ); EndOfInvokeInterp: // close work storage manager if ( hWRKS ) WRKS_Close( &hWRKS ); lMultiple--; if ( lMultiple > 0 ) { vSubtask = aInterpreterSave[ lMultiple - 1 ].vSubtask; // restore the global variables g_nStackPtr = aInterpreterSave[ lMultiple - 1 ].nStackPtr; memcpy( g_nCallStack, aInterpreterSave[ lMultiple -1 ].nCallStack, zsizeof( g_nCallStack ) ); g_vXPGView = aInterpreterSave[ lMultiple - 1 ].vXPGView; SetNameForView( g_vXPGView, "XPG", vSubtask, zLEVEL_SUBTASK ); g_vStatementView = aInterpreterSave[ lMultiple - 1 ].vStatementView; SetNameForView( g_vStatementView, "StatementView", vSubtask, zLEVEL_SUBTASK ); vSO = aInterpreterSave[ lMultiple - 1 ].vStackObject; SetNameForView( vSO, "StackObject", vSubtask, zLEVEL_SUBTASK ); memcpy( sValueStack, aInterpreterSave[ lMultiple - 1 ].sValueStack, zsizeof( sValueStack ) ); } return( lStepRC ); }
///////////////////////////////////////////////////////////////////////////// // // PURPOSE: This function places selected attributes in an already // existing partition without the attributes text literals. // // vNewDialog - handle to the partition // lFieldRow - offset row in the group // lFieldCol - offset column in the group // PartitionSize - length size for the group // // Return Codes: // 0 - Everything is O.K. and the fields were placed into the // partition // -1 - The field widths exceeded the partitions width // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION ofnTZWDLGSO_AutoPaintListPart( zVIEW vSubtask, zVIEW vUserSpec, zVIEW vNewDialog, zLONG lFieldRow, zLONG lFieldCol, zLONG PartitionSize, zPCHAR szListType ) { zVIEW vAutoDesWk; zVIEW vTempStyle; zVIEW vSubobject; zVIEW vCtrlDef; zLONG lListAttributeLength; zLONG lPaintLiteralLength; zLONG lCC; zLONG lCL; zCHAR szControlType[ 33 ]; zCHAR szMapEntity[ 33 ]; zCHAR szParentName[ 33 ]; zCHAR szWorkString[ 65 ]; zCHAR szLiteralString[ 65 ]; zLONG lTempInteger_0; zSHORT RESULT; zSHORT lFieldsPainted; zLONG lRC; zCHAR X_LOD_Attribute[ 16 ]; zCHAR X_LOD_Entity[ 13 ]; zCHAR X_ER_Attribute[ 15 ]; // TraceLineS( "IN", "AutoPaintListPart W4" ); // Set up variables to either I_LOD listbox or L_LOD listbox. if ( szListType[ 0 ] == 'I' ) { zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" ); zstrcpy( X_LOD_Entity, "I_LOD_Entity" ); zstrcpy( X_ER_Attribute, "I_ER_Attribute" ); } else { zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" ); zstrcpy( X_LOD_Entity, "L_LOD_Entity" ); zstrcpy( X_ER_Attribute, "L_ER_Attribute" ); } lCL = 12; lCC = 5; GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK ); GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK ); GetStringFromAttribute( szControlType, vNewDialog, "ControlDef", "Tag" ); /* It is important to know whether the parent is a WINDOW(WDODs) or a SECTION(RODs). */ zstrcpy( szParentName, "Window" ); /* IF we are Autodesigning a ROD, set lCL to 8 so line skips do not take place */ lTempInteger_0 = zstrcmp( szParentName, "SECTION" ); if ( lTempInteger_0 == 0 ) { lCL = 8; } /* Create a view that will point to the controls under the listbox. */ CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 ); /* Set handle to the fields under the group */ SetViewToSubobject( vSubobject, "CtrlCtrl" ); /* Delete any existing fields in the listbox */ RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } /* Create a new view that will point to the UIS_ViewObjRef entity in the user spec object. Sometimes vUserSpec is pointing to a recursive subobject and UI_ViewObjRef cannot be accessed. */ CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 ); ResetView( vTempStyle ); lFieldsPainted = 0; //// Paint the fields in the Partition ////////// /* IF Attributes have been found to paint, paint them */ RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" ); while ( RESULT > zCURSOR_UNCHANGED ) { // This gets the length of the field to be painted. lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType ); if ( lListAttributeLength == 0 ) lListAttributeLength = 4; lListAttributeLength = lListAttributeLength * lCC; if ( lListAttributeLength > 100 ) lListAttributeLength = 100; if ( lListAttributeLength < 25 ) lListAttributeLength = 25; /* If there isn't a paint literal then use the entity name as the paint literal */ GetStringFromAttribute( szLiteralString, vUserSpec, X_ER_Attribute, "ListPaintLit" ); if ( szLiteralString[ 0 ] == 0 ) GetStringFromAttribute( szLiteralString, vUserSpec, X_ER_Attribute, "PromptPaintLit" ); lPaintLiteralLength = zstrlen( szLiteralString ); if ( szLiteralString[ 0 ] == 0 ) { GetStringFromAttribute( szLiteralString, vUserSpec, X_ER_Attribute, "Name" ); AddSpacesToString( szLiteralString ); lPaintLiteralLength = zstrlen( szLiteralString ) + 1; } lPaintLiteralLength = lPaintLiteralLength * lCC; if ( lPaintLiteralLength > 100 ) lPaintLiteralLength = 100; if ( lPaintLiteralLength < 25 ) lPaintLiteralLength = 25; /* Do not continue to add fields into the partition if the field sizes exceed the size of the partition */ /* If the field attribute length is greater than the text literal length, then add the field attribute length to lFieldCol. */ if ( lPaintLiteralLength < lListAttributeLength ) { /* If the length of lFieldCol is greater than the partition size, then delete all the fields that have been added and give a message to the user. */ if ( lFieldCol + lListAttributeLength > PartitionSize ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); RESULT = SetCursorNextEntity( vSubobject, "Control", "" ); } DropView( vSubobject ); MessageSend( vUserSpec, "AD10302", "Autodesigner", "Partition too small( width )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } } else { /* If the text literal length is greater than the field attribute length, then add the text literal length to lFieldCol. */ /* If the length of lFieldCol is greater than the partition size, then delete all the fields that have been added and give a message to the user. */ if ( lFieldCol + lPaintLiteralLength > PartitionSize ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); RESULT = SetCursorNextEntity( vSubobject, "Control", "" ); } DropView( vSubobject ); MessageSend( vUserSpec, "AD10303", "Autodesigner", "Partition too small( width )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } } /* Create the partition's fields */ CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER ); SetAttributeFromString( vSubobject, "Control", "Text", szLiteralString ); if ( zstrcmp( szControlType, "ListBox" ) == 0 ) { SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "ListBoxCtl", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); } else { SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); } // Set the tag ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vSubobject, "ListCtrl" ); /* GetStringFromAttribute( szTag, vUserSpec, X_ER_Attribute, "Name" ); szTag[ 30 ] = 0; lFieldsPainted = lFieldsPainted + 1; zltoa( lFieldsPainted, szWork ); zstrcat( szTag, szWork ); SetAttributeFromString( vSubobject, "Control", "Tag", szTag ); */ SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", lListAttributeLength ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL ); /* If the domain is an integer or a long, then right justify. */ /* IF vUserSpec.L_Domain.DerivedDataType = 'I' OR vUserSpec.L_Domain.DerivedDataType = 'L' OR vUserSpec.L_Domain.DerivedDataType = 'M' vNewDialog.FLAGFLD.RJUST = 'Y' END */ GetStringFromAttribute( szMapEntity, vUserSpec, "LOD_Entity", "Name" ); GetStringFromAttribute( szWorkString, vUserSpec, X_LOD_Entity, "Name" ); /* If this LISTATTRIB is from a different ENTITY than the current ENTITY, then make sure the value gets mapped. */ lRC = zstrcmp( szWorkString, "" ); if ( lRC != 0 ) { lRC = zstrcmp( szWorkString, szMapEntity ); if ( lRC == 0 ) { zstrcpy( szMapEntity, szWorkString ); } } /* setting the group and field's ENAME and ANAME */ CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER ); /* set the partitions OI name */ if ( szListType[ 0 ] == 'I' ) IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView", vUserSpec, "ListViewObjRef", zPOS_AFTER ); else IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView", vTempStyle, "UIS_ViewObjRef", zPOS_AFTER ); IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute", vUserSpec, X_LOD_Attribute, zPOS_AFTER ); /* lFieldRow should always stay the same */ SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lFieldCol ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lFieldRow ); /* If the field length is longer than the paint literal, then position the next field by using the field length, otherwise position the next field by using the paint literal length */ if ( lPaintLiteralLength < lListAttributeLength ) { lFieldCol = lFieldCol + lListAttributeLength + lCC; } else { lFieldCol = lFieldCol + lPaintLiteralLength + lCC; } RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" ); } DropView( vSubobject ); DropView( vTempStyle ); // TraceLineS("END", "AutoPaintListPart W4" ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // OPERATION: oTZWDLGSO_DIL_Inherited_Ctrl // PURPOSE: This derived attribute determines the DIL message by the following // algorithm. // 1. If the control is a Radio or Push button, the Control Text // attribute is used. // 2. If there is no mapping, the Control Text attribute is used. // 3. If there is mapping, we will use the Domain's Context to // determine the DIL Text. If there is a Context specified for // the Control, that Context will be used. Otherwise the default // Context will be used. // NOTE: The operation is designed for Control only. // It will not handle CtrlCtrl, Option, or OptOpt. ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZWDLGSO_DIL_Inherited_Ctrl( zVIEW vIn, LPVIEWENTITY lpViewEntity, LPVIEWATTRIB lpViewAttrib, zSHORT nMsg ) { zPCHAR szAttr; zVIEW vDomain; zLONG lZKey; // If this is a derived retrieval call, then assign the attribute // using the derivation formula defined above if ( nMsg == zDERIVED_GET ) { GetAddrForAttribute( &szAttr, vIn, "ControlDef", "Tag" ); if ( lstrcmp( szAttr, "Radio" ) == 0 || lstrcmp( szAttr, "Push" ) == 0 ) { GetAddrForAttribute( &szAttr, vIn, "Control", "Text" ); } else { if ( CheckExistenceOfEntity( vIn, "CtrlMapER_Domain" ) < zCURSOR_SET ) { // no mapping so use text of control GetAddrForAttribute( &szAttr, vIn, "Control", "Text" ); } else { // OK, This is where we use the mapping // Context/Domain info to determine what the DIL needs to be. // First get a view to the Domain. GetIntegerFromAttribute( &lZKey, vIn, "CtrlMapER_Domain", "ZKey" ); ActivateMetaOI_ByZKey( vIn, &vDomain, 0, zREFER_DOMAIN_META, zSINGLE, lZKey, zCURRENT_OI ); if ( CheckExistenceOfEntity( vIn, "CtrlMapContext" ) >= zCURSOR_SET ) { // If there is a Context override, position on that Context. GetIntegerFromAttribute( &lZKey, vIn, "CtrlMapContext", "ZKey" ); SetCursorFirstEntityByInteger( vDomain, "Context", "ZKey", lZKey, 0 ); } else // If there is no Context override, position on the default // Context. SetCursorFirstEntityByString( vDomain, "Context", "IsDefault", "Y", 0 ); // Now retrieve the DIL Message from the Context. GetAddrForAttribute( &szAttr, vDomain, "Context", "DIL_NLS_Text" ); if ( szAttr[ 0 ] == 0 ) { GetAddrForAttribute( &szAttr, vDomain, "Context", "DIL_Inherited" ); } DropView( vDomain ); } } // Update the value of the DIL message text in the object StoreValueInRecord( vIn, lpViewEntity, lpViewAttrib, szAttr, 0 ); } return( 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
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; }
///////////////////////////////////////////////////////////////////////////// // // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // PURPOSE: This function places the paint literals of selected // attributes above the fields in a partition or list box. // // vNewDialog - handle to the group // OffsetDLG_Y - offset row to the group // OffsetDLG_X - offset column to the group // PartitionSize - length size of the group // // Return Codes: // 0 - Everything is O.K. and the literals were placed into the // partition // -1 - The literal widths exceeded the partitions width // //////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION ofnTZWDLGSO_AutoPaintLstLitPart( zVIEW vSubtask, zVIEW vUserSpec, zVIEW vNewDialog, zLONG OffsetDLG_Y, zLONG OffsetDLG_X, zLONG PartitionSize, zPCHAR szListType ) { zVIEW vCtrlDef; zLONG lCC; zLONG lCL; zLONG lFieldCol; zLONG lListAttributeLength; zLONG lPaintLiteralLength; zCHAR sPaintLiteral[ 65 ]; zSHORT RESULT; zLONG lTempInteger_1; zLONG lTempInteger_2; 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' ) { zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "I_ER_Attribute" ); } else { zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "L_ER_Attribute" ); } lCC = 5; lCL = 12; GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK ); lFieldCol = 1; RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" ); while ( RESULT > zCURSOR_UNCHANGED ) { /* This gets the length of the field to be painted */ lListAttributeLength = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType ); lListAttributeLength = lListAttributeLength * lCC; /* Limit the size of the attribute length. */ if ( lListAttributeLength > 100 ) lListAttributeLength = 100; if ( lListAttributeLength < 25 ) lListAttributeLength = 25; /* Get the paint literal */ GetStringFromAttribute( sPaintLiteral, vUserSpec, X_ER_Attribute, "ListPaintLit" ); if ( sPaintLiteral[ 0 ] == 0 ) GetStringFromAttribute( sPaintLiteral, vUserSpec, X_ER_Attribute, "PromptPaintLit" ); if ( sPaintLiteral[ 0 ] == 0 ) { GetStringFromAttribute( sPaintLiteral, vUserSpec, X_ER_Attribute, "Name" ); /* Add a ':' to the end. */ zstrcat( sPaintLiteral, ":" ); /* Add spaces before any capital letters. */ AddSpacesToString( sPaintLiteral ); } lPaintLiteralLength = zstrlen( sPaintLiteral ); lPaintLiteralLength = lPaintLiteralLength * lCC; /* Limit the size of the literal length. */ if ( lPaintLiteralLength > 100 ) lPaintLiteralLength = 100; if ( lPaintLiteralLength < 25 ) lPaintLiteralLength = 25; /* lTempInteger_1 = CheckForOverlappingFields( vNewDialog, OffsetDLG_Y, OffsetDLG_Y + nCL, lFieldCol + OffsetDLG_X - lCC, lFieldCol + OffsetDLG_X + lPaintLiteralLength - lCC ); */ lTempInteger_1 = 0; /* Check to see IF there is a field or group located above the listbox that would be in the way of painting the literals */ if ( lTempInteger_1 == -1 ) { /* Cannot place text fields above the listbox because of either a field or a group */ /* InformationMessage( "Field literals can't fit because of FIELD or GROUP" ); */ MessageSend( vUserSpec, "AD10301", "Autodesigner", "Field literals can't fit because of FIELD or GROUP", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } /* Add the listbox literals at the end of the client fields. This makes a difference in fnCompressWindow in autodesigning.*/ SetCursorLastEntity( vNewDialog, "Control", "" ); /* Do not continue to add fields into the list box if the field sizes exceed the size of the list box */ /* If the field attribute length is greater than the text literal length, then add the field attribute length to lFieldCol. */ if ( lPaintLiteralLength < lListAttributeLength ) { /* If the length of lFieldCol is greater than the partition size, then RETURN */ if ( lFieldCol + lListAttributeLength > PartitionSize ) { return( 1 ); } } else { /* If the length of lFieldCol is greater than the partition size, then RETURN */ if ( lFieldCol + lPaintLiteralLength > PartitionSize ) { return( 1 ); } } /* Create literals for the list box */ CreateMetaEntity( vSubtask, vNewDialog, "Control", zPOS_AFTER ); SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" ); IncludeSubobjectFromSubobject( vNewDialog, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); /* Remove the text border. */ SetAttributeFromInteger( vNewDialog, "Control", "Subtype", zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP ); SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_Y", OffsetDLG_Y ); lTempInteger_2 = OffsetDLG_X + lFieldCol - lCC; SetAttributeFromInteger( vNewDialog, "Control", "PSDLG_X", lTempInteger_2 ); SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_X", lPaintLiteralLength ); SetAttributeFromInteger( vNewDialog, "Control", "SZDLG_Y", 10 ); ofnTZWDLGSO_AssignTag( vSubtask, vNewDialog, vNewDialog, "ListText" ); SetAttributeFromString( vNewDialog, "Control", "Text", sPaintLiteral ); /* If the field length is longer than the paint literal, then position the next field by using the field length, otherwise position the next field by using the paint literal length */ if ( lPaintLiteralLength < lListAttributeLength ) { lFieldCol = lFieldCol + lListAttributeLength + lCC; } else { lFieldCol = lFieldCol + lPaintLiteralLength + lCC; } RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" ); } // TraceLineS("END", "AutoPaintLstListPart W4" ); return( 0 ); }
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 ); } }
/////////////////////////////////////////////////////////////////////// // // PURPOSE: This function paints the list attributes from the user spec // into the existing partition. // //////////////////////////////////////////////////////////////////////// zOPER_EXPORT zLONG OPERATION ofnTZWDLGSO_AutoPntFldPartWLits( zVIEW vSubtask, zVIEW vUserSpec, zVIEW vNewDialog, zPCHAR szListType ) { zVIEW vAutoDesWk; zVIEW vSubobject; zVIEW vTempStyle; zVIEW vCtrlDef; zLONG k, j; zLONG lCC, lCL; zLONG lMaxLines; zLONG lLine, lFirstPaintLine, lFieldsPainted, lColumn; zLONG lMaxFieldDLG_X, lMaxText, lPush; zLONG lGroupDLG_X, lGroupDLG_Y; zSHORT RESULT; zLONG lLastPaintLine, lLastWindowLine, lMaxLength; // zCHAR cUsage[ 1 ]; zCHAR szMapEntity[ 33 ]; zCHAR szMapAttribute[ 33 ]; zCHAR szType[ 33 ]; zCHAR szWorkString[ 256 ]; zCHAR X_LOD_Attribute[ 16 ]; zCHAR X_ER_Attribute[ 15 ]; // TraceLineS( "IN", " AutoPaintPartitionWithFields" ); // Set up variables to either I_LOD listbox or L_LOD listbox. if ( szListType[ 0 ] == 'I' ) { zstrcpy( X_LOD_Attribute, "I_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "I_ER_Attribute" ); } else { zstrcpy( X_LOD_Attribute, "L_LOD_Attribute" ); zstrcpy( X_ER_Attribute, "L_ER_Attribute" ); } // TraceLineS( "IN", " AutoPaintPartitionWithFields" ); GetViewByName( &vCtrlDef, "TZADCTLD", vNewDialog, zLEVEL_TASK ); GetViewByName( &vAutoDesWk, "TZADWWKO", vNewDialog, zLEVEL_TASK ); CreateViewFromViewForTask( &vSubobject, vNewDialog, 0 ); lCL = 12; lCC = 5; /* Create a new view that will point to the UIS_ViewObjRef entity in the user spec object. Sometimes vUserSpec is pointing to a recursive subobject and UI_ViewObjRef cannot be accessed. */ CreateViewFromViewForTask( &vTempStyle, vUserSpec, 0 ); ResetView( vTempStyle ); SetViewToSubobject( vSubobject, "CtrlCtrl" ); /* Delete any existing fields in the listbox */ RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } GetIntegerFromAttribute( &lMaxLines, vNewDialog, "Control", "SZDLG_Y" ); szMapEntity[ 0 ] = 0; lFirstPaintLine = 0; lLastPaintLine = 1; lLine = 1; lMaxFieldDLG_X = 0; lMaxLength = 0; lMaxText = 0; lPush = 0; lFieldsPainted = 0; // cUsage[ 0 ] = 'U'; /* If there is a paint object, loop through its attributes */ RESULT = SetCursorFirstEntity( vUserSpec, X_LOD_Attribute, "" ); while ( RESULT > zCURSOR_UNCHANGED ) { /* The last line painted was at this posititon */ lLastPaintLine = lLine; lColumn = 1; /* Create the Text Field for the Attribute */ CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lLine ); if ( lFirstPaintLine == 0 ) lFirstPaintLine = lLine; SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lColumn ); /* Creating text field. */ SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "Text", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); // Remove the text border. SetAttributeFromInteger( vSubobject, "Control", "Subtype", zCONTROL_BORDEROFF | zCONTROL_NOTABSTOP ); GetStringFromAttribute( szWorkString, vUserSpec, X_ER_Attribute, "ListPaintLit" ); GetStringFromAttribute( szMapAttribute, vUserSpec, X_ER_Attribute, "Name" ); // If there is no paint literal for this attribute then // use the attribute name as the paint literal. if ( szWorkString[ 0 ] == 0 ) zstrcpy( szWorkString, szMapAttribute ); SetAttributeFromString( vSubobject, "Control", "Text", szWorkString ); j = zstrlen( szWorkString ); j = j * lCC; // Determine the size of the longest paint literal. if ( j > lMaxText ) lMaxText = j; SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", j ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL ); /* Add the length of the longest paint literal to the column so the attribute field will be painted there */ lColumn += j; lColumn = lColumn + lCC; // If there is no paint length for the field, then // use the field's length. j = ofnTZWDLGSO_GetSizeForListAttr( vSubtask, vUserSpec, szListType ); j = j * lCC; // If there is no paint length for the field, then // use the field's length. if ( j > 100 ) j = 100; else if ( j < 25 ) j = 25; // Create the appropriate Data Field for the Attribute. CreateMetaEntity( vSubtask, vSubobject, "Control", zPOS_AFTER ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_Y", lLine ); SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lColumn ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_X", j ); SetAttributeFromInteger( vSubobject, "Control", "SZDLG_Y", lCL ); // Determine the maximum column length. if ( lMaxFieldDLG_X < lColumn ) lMaxFieldDLG_X = lColumn; lColumn += j; lColumn = lColumn - 1 * lCC; // Determine the maximum length of colum and literal. if ( lMaxLength < lColumn ) lMaxLength = lColumn; SetCursorFirstEntityByString( vCtrlDef, "ControlDef", "Tag", "EditBox", "" ); IncludeSubobjectFromSubobject( vSubobject, "ControlDef", vCtrlDef, "ControlDef", zPOS_AFTER ); // SetAttributeFromInteger( vSubobject, "Control", "Type", 1010 ); /* if ( cUsage[ 0 ] == 'U' ) { GetStringFromAttribute( cWork, vUserSpec, X_LOD_Attribute, "DERIVEDF" ); if ( cWork[ 0 ] != 0 ) SetAttributeFromCharacter( vSubobject, "Control", "Type", 1000 ); } */ /* setting the group and field's ENAME and ANAME */ CreateMetaEntity( vSubtask, vSubobject, "CtrlMap", zPOS_AFTER ); /* set the partitions OI name */ IncludeSubobjectFromSubobject( vSubobject, "CtrlMapView", vTempStyle, "UIS_ViewObjRef", zPOS_AFTER ); IncludeSubobjectFromSubobject( vSubobject, "CtrlMapLOD_Attribute", vUserSpec, X_LOD_Attribute, zPOS_AFTER ); lFieldsPainted++; lLine = lLine + lCL; RESULT = SetCursorNextEntity( vUserSpec, X_LOD_Attribute, "" ); } lLastPaintLine = lLine; /* Get the dimensions of the partition. */ GetIntegerFromAttribute( &lGroupDLG_X, vNewDialog, "Control", "SZDLG_X" ); GetIntegerFromAttribute( &lGroupDLG_Y, vNewDialog, "Control", "SZDLG_Y" ); RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { GetIntegerFromAttribute( &lLine, vSubobject, "Control", "PSDLG_Y" ); if ( lLine >= lFirstPaintLine && lLine <= lLastPaintLine ) { GetStringFromAttribute( szType, vSubobject, "ControlDef", "Tag" ); /* If the control is not a text control. */ if ( zstrcmp( szType, "Text" ) != 0 ) { GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" ); GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" ); if ( j < lMaxFieldDLG_X ) { j = lMaxFieldDLG_X - j; if ( ( lMaxFieldDLG_X + k ) > ( lMaxLength + lCC ) ) { if ( ( lMaxFieldDLG_X + k ) <= lGroupDLG_X ) { lMaxLength = lMaxFieldDLG_X +( k - lCC ); } else { j -=( ( lMaxFieldDLG_X + k ) - lGroupDLG_X ); if ( j > 0 ) { AddToAttributeFromInteger( vSubobject, "Control", "PSDLG_X", j ); lMaxLength = lGroupDLG_X - lCC; j = -1; } } } if ( j > 0 ) { SetAttributeFromInteger( vSubobject, "Control", "PSDLG_X", lMaxFieldDLG_X ); } } } GetIntegerFromAttribute( &j, vSubobject, "Control", "PSDLG_X" ); GetIntegerFromAttribute( &k, vSubobject, "Control", "SZDLG_X" ); if ( ( j + k ) >= lGroupDLG_X ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } MessageSend( vNewDialog, "AD10304", "Autodesigner", "Partition too small( width )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); /* the partition is not wide enough */ return( -1 ); } /////////////////////////////////////////////////////////// // Code to truncate fields which extend over the partition to // the right COMMENTED out. This is a 'too small' error as // noted above. // else // if ( (j + k) >= lGroupDLG_X ) // { // k =( lGroupDLG_X - 1 ) - j; // SetAttributeFromInteger( vSubobject, "Control", // "SZDLG_X", k ); // } //////////////////////////////////////////////////////////// } RESULT = SetCursorNextEntity( vSubobject, "Control", "" ); } lLastWindowLine = lLine; /* If the window painted has too many lines for the terminal being used for painting. Attempt to compress the window into a more manageable size by combining painted fields which are located on separate lines */ /* for ( i = 1; i < 8; i++ ) { if ( lLastWindowLine + 12 <= lMaxLines ) { break; } fnCompressPartition( vNewDialog, i, lFirstPaintLine, lMaxText, lMaxLines, &lLastPaintLine, &lLastWindowLine, &lMaxLength ); } */ if ( ( lLastWindowLine + lCL ) > lMaxLines ) { RESULT = SetCursorFirstEntity( vSubobject, "Control", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { RESULT = DeleteEntity( vSubobject, "Control", zREPOS_NEXT ); } MessageSend( vNewDialog, "AD10305", "Autodesigner", "Partition too small( height )", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( -1 ); } // TraceLineS( "END", " AutoPaintPartitionWithFields" ); /* Return the last paint line for AutoDesign */ return( lLastPaintLine ); }
//: 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 }