///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZVSPOOO_C_GenOperationName // // PURPOSE: For Object and Local operations, concatenate the LOD // name in front of the VML operation name. // For others, just use the regular operation name. // The Type for a Local Oper is L. // The Types for Object operations are either O, T, C, E or A. // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZVSPOOO_C_GenOperationName( zVIEW PIView, LPVIEWENTITY EntityStructure, LPVIEWATTRIB AttributeStructure, zSHORT nGetOrSetFlag ) { zCHAR szTempName1[ 64 ]; zCHAR szTempName2[ 32 ]; zCHAR szType[ 2 ]; zLONG lZKey; zVIEW vTempView; // Set up a temporary view so that PIView remains unchanged CreateViewFromViewForTask( &vTempView, PIView, 0 ); // Position on the corresponding OperationSource for Operation entity GetIntegerFromAttribute( &lZKey, vTempView, "Operation", "ZKey" ); SetCursorFirstEntityByInteger( vTempView, "OperationSource", "ZKey", lZKey, "VML_XSource" ); GetStringFromAttribute( szType, vTempView, "Operation", "Type" ); if ( szType[ 0 ] == 'L' || szType[ 0 ] == 'O' || szType[ 0 ] == 'T' || szType[ 0 ] == 'C' || szType[ 0 ] == 'E' || szType[ 0 ] == 'A' ) { szTempName1[ 0 ] = 'o'; GetStringFromAttribute( szTempName1 + 1, vTempView, "VML_XSource", "MetaName" ); zstrcat( szTempName1, "_" ); GetStringFromAttribute( szTempName2, vTempView, "Operation", "Name" ); zstrcat( szTempName1, szTempName2 ); } else GetStringFromAttribute( szTempName1, vTempView, "Operation", "Name" ); StoreValueInRecord( vTempView, EntityStructure, AttributeStructure, szTempName1, 0 ); // Get rid of temporary view DropView( vTempView ); 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 zwTZVSDBAD_SetBreakPoint( zVIEW vSubtask ) { zVIEW XPG; zVIEW XPG2; zVIEW lpZeidonVML; zLONG FoundFlag; zSHORT nZRetCode; zSHORT RESULT; zLONG lTempInteger_0; nZRetCode = GetViewByName( &lpZeidonVML, "ZeidonVML", vSubtask, zLEVEL_TASK ); nZRetCode = GetViewByName( &XPG, "XPG", lpZeidonVML, zLEVEL_SUBTASK ); nZRetCode = CreateViewFromViewForTask( &XPG2, XPG, 0 ); nZRetCode = GetIntegerFromAttribute( &lTempInteger_0, XPG2, "OperationSource", "ZKey" ); RESULT = SetCursorFirstEntityByInteger( XPG2, "Operation", "ZKey", lTempInteger_0, "" ); FoundFlag = zwTZVSDBAD_FindStatement( XPG2, XPG ); if ( FoundFlag == 1 ) { nZRetCode = SetWindowActionBehavior( vSubtask, zWAB_StayOnWindowWithRefresh, "", "" ); } 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 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zofnTZSIXSKO_BldXSKChildEnt // // PURPOSE: // // TRIGGLODED BY: // WINDOW: TZZOLODD // ACTION: OPTION // NAME: File_Save // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zofnTZSIXSKO_BldXSKChildEnt ( zVIEW vKZSIXSKO_Root, zVIEW vKZSIXSKO, zVIEW vTZZOXOD1, zVIEW vTZTENVRO_REF, zSHORT nEntityFlag ) { zVIEW vTZTENVRO_Parent; zSHORT nRC; zSHORT nRC2; zPCHAR szDBMS; zSHORT nEntImpls; zLONG lEntityZKey; zSHORT nEntitySet = nEntityFlag; zSHORT nSetViewToSubXsk = 0; nRC = CreateViewFromViewForTask( &vTZTENVRO_Parent, vTZTENVRO_REF, 0 ); nRC = zCURSOR_SET; while ( nRC >= zCURSOR_SET ) { nRC = SetViewToSubobject( vTZZOXOD1, "CHILDENTITY" ); /* Check physik, if no, then do not process this entity */ if ( (nRC = CheckExistenceOfEntity ( vTZZOXOD1, "DATARECORD" )) >= zCURSOR_SET ) { nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1, "ENTITY", "ERENT_TOK" ); nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DBMS_Source" ); if ( nRC < zCURSOR_SET ) { GetAddrForAttribute( &szDBMS, vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS" ); nEntImpls = 0; for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { nEntImpls++; } } if ( nEntImpls == 1 ) { nRC = zCURSOR_SET; } else if ( nEntImpls > 1 ) { for ( nRC = SetCursorFirstEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVRO_Parent, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVRO_Parent, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { zstrcpy( szMsg, "Do you want to use Data Source '" ); GetAddrForAttribute( &szMsgName, vTZTENVRO_Parent, "TE_DBMS_Source", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "' to implement ER Entity '" ); GetAddrForAttribute( &szMsgName, vTZTENVRO_Parent, "ER_Entity", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "'?" ); nRC = MessagePrompt ( vTZTENVRO_Parent, "XOD_06", "TE Choice", szMsg, 0, zBUTTONS_YESNO, 0, 0 ); if ( nRC == zRESPONSE_YES ) break; // found Entity implemented in same DBMS } } } if ( nRC < zCURSOR_SET ) { zstrcpy( szMsg, "Unable to Find Entity in TE Data Source with same DBMS.\n\nEntity Name = " ); GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ER_EntityRec", "Name" ); zstrcat( szMsg, szMsgName ); nRC = MessagePrompt( vTZZOXOD1, "XOD_06", "Internal LOD Error", szMsg, 0, zBUTTONS_OK, 0, 0 ); nRC = DropView( vTZTENVRO_Parent ); return( 0 ); } } // new Entity found // if SironGroup exists // if SironKatalog exists // create new Katalog // create next ENTITY and ENTITYCOM entities // create dependent ATTRIB and ATTRICOM entities nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironGroup" ); if ( nRC >= zCURSOR_SET ) { nRC = CheckExistenceOfEntity ( vTZTENVRO_Parent, "SironKatalog" ); if ( nRC >= zCURSOR_SET ) { // Go back to KATALOG entity if ( nEntitySet ) { while ( ResetViewFromSubobject( vKZSIXSKO_Root ) == 0 ); } // Create new KATALOG entity nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "KATALOG", "" ); nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER ); SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG", vTZTENVRO_Parent, "SironKatalog", zSET_ALL ); for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "KatalogComment", "SironKatalog"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVRO_Parent, "KatalogComment", "SironKatalog") ) { CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM", vTZTENVRO_Parent, "KatalogComment", zSET_ALL ); } } // ViewToSubobject only, if caller created an ENTITY entity if ( nEntitySet ) { if ( CheckExistenceOfEntity( vKZSIXSKO_Root, "ENTITY" ) >= zCURSOR_SET ) { SetViewToSubobject( vKZSIXSKO_Root, "ENTITYCHILD" ); nSetViewToSubXsk = 1; } } // Create next ENTITY entity nRC = SetCursorLastEntity ( vKZSIXSKO_Root, "ENTITY", "" ); nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER ); nEntitySet = 1; SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY", vTZTENVRO_Parent, "SironGroup", zSET_ALL ); SetAttributeFromInteger( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK", lEntityZKey ); for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVRO_Parent, "GroupComment", "SironGroup") ) { CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM", vTZTENVRO_Parent, "GroupComment", zSET_ALL ); } // Create all dependent ATTRIB entities according to XOD ATTRIB // entities for ( nRC = SetCursorFirstEntity( vTZZOXOD1, "ATTRIB", "ENTITY"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZZOXOD1, "ATTRIB", "ENTITY") ) { nRC = SetCursorFirstEntityByAttr( vTZTENVRO_Parent, "TE_FieldDataRel","Name", vTZZOXOD1, "ATTRIB", "NAME", "TE_TablRec"); nRC = CheckExistenceOfEntity( vTZTENVRO_Parent, "SironField" ); if ( nRC < zCURSOR_SET ) { zstrcpy( szMsg, "Unable to Find SironField in TE Data Source .\n\nAttribute Name = " ); GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ATTRIB", "NAME" ); zstrcat( szMsg, szMsgName ); nRC = MessagePrompt ( vTZZOXOD1, "XOD_06", "Internal XOD Error", szMsg, 0, zBUTTONS_OK, 0, 0 ); nRC = DropView( vTZTENVRO_Parent ); return( 0 ); } CreateEntity( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB", vTZTENVRO_Parent, "SironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK", vTZZOXOD1, "ATTRIB", "XVAATT_TOK" ); // Create all dependent ATTRIBCOM entities for ( nRC = SetCursorFirstEntity( vTZTENVRO_Parent, "SironFieldComment","SironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVRO_Parent, "SironFieldComment","SironField")) { CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM", vTZTENVRO_Parent, "SironFieldComment", zSET_ALL ); } } } } // Abstieg des Pfades nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" ); if ( nRC >= zCURSOR_SET ) zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXOD1, vTZTENVRO_Parent, nEntitySet ); nRC2 = ResetViewFromSubobject( vTZZOXOD1 ); if ( nSetViewToSubXsk ) { nRC2 = ResetViewFromSubobject( vKZSIXSKO_Root ); nSetViewToSubXsk = 0; } nRC = SetCursorNextEntity( vTZZOXOD1, "CHILDENTITY", "" ); } if ( vTZTENVRO_Parent ) nRC = DropView( vTZTENVRO_Parent ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: zofnTZSIXSKO_BldXSK // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zofnTZSIXSKO_BldXSK ( zVIEW vKZSIXSKO_Root, zVIEW vKZSIXSKO, zVIEW vTZZOXODO, zVIEW vTZTENVRO_REF ) { zVIEW vTZZOXOD1; zVIEW vTZZOXOD_TestWorkAttrib; zVIEW vTZTENVR1; zPCHAR szDBMS; zSHORT nEntImpls; zSHORT nRC; zLONG lEntityZKey; zSHORT nAttrCount = 0; zSHORT nEntitySet = 0; nRC = CreateViewFromViewForTask( &vTZTENVR1, vTZTENVRO_REF, 0 ); nRC = CreateViewFromViewForTask( &vTZZOXOD1, vTZZOXODO, 0 ); nRC = SetCursorFirstEntity( vTZZOXOD1, "ENTITY", "" ); /*=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=? ?? Was ist hier mit Work Entities ? ?? Wie koennen diese umgangen werden ?? natuerlich auch fuer Kinder beruecksichtigen **=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?=?*/ /* Check physik, if no, then do not process this entity */ if ( (nRC = CheckExistenceOfEntity( vTZZOXOD1, "DATARECORD" )) >= zCURSOR_SET ) { // Suche SironKatalog in TE nRC = GetIntegerFromAttribute( &lEntityZKey, vTZZOXOD1, "ENTITY", "ERENT_TOK" ); nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DBMS_Source" ); if ( nRC < zCURSOR_SET ) { GetAddrForAttribute( &szDBMS, vTZTENVR1, "TE_DBMS_Source", "DBMS" ); nEntImpls = 0; for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { nEntImpls++; } } if ( nEntImpls == 1 ) { nRC = zCURSOR_SET; } else if ( nEntImpls > 1 ) { for ( nRC = SetCursorFirstEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntityByInteger( vTZTENVR1, "ER_Entity", "ZKey", lEntityZKey, "TE_DB_Environ" ) ) { if ( CompareAttributeToString( vTZTENVR1, "TE_DBMS_Source", "DBMS", szDBMS ) == 0 ) { zstrcpy( szMsg, "Do you want to use Data Source '" ); GetAddrForAttribute( &szMsgName, vTZTENVR1, "TE_DBMS_Source", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "' to implement ER Entity '" ); GetAddrForAttribute( &szMsgName, vTZTENVR1, "ER_Entity", "Name" ); zstrcat( szMsg, szMsgName ); zstrcat( szMsg, "'?" ); nRC = MessagePrompt ( vTZTENVR1, "XOD_06", "TE Choice", szMsg, 0, zBUTTONS_YESNO, 0, 0 ); if ( nRC == zRESPONSE_YES ) break; // found Entity implemented in same DBMS } } } if ( nRC < zCURSOR_SET ) { zstrcpy( szMsg, "Unable to Find Entity in TE Data Source with same " "DBMS.\n\nEntity Name = " ); GetAddrForAttribute( &szMsgName, vTZZOXOD1, "ENTITY", "NAME" ); zstrcat( szMsg, szMsgName ); nRC = MessagePrompt( vTZZOXOD1, "XOD_03", "Internal LOD Error", szMsg, 0, zBUTTONS_OK, 0, 0 ); return( 0 ); } } // Now: First Entity found // if SironKatalog Exits // create KATALOG and KATCOM entities // create first ENTITY and ENTITYCOM entities // create dependent ATTRIB and ATTRICOM entities nRC = CheckExistenceOfEntity ( vTZTENVR1, "SironKatalog" ); if ( nRC >= zCURSOR_SET ) { // Create KATALOG entity nRC = CreateEntity ( vKZSIXSKO_Root, "KATALOG", zPOS_AFTER ); SetMatchingAttributesByName(vKZSIXSKO_Root, "KATALOG", vTZTENVR1, "SironKatalog", zSET_ALL ); for ( nRC = SetCursorFirstEntity( vTZTENVR1, "KatalogComment", "SironKatalog"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1, "KatalogComment", "SironKatalog") ) { CreateEntity ( vKZSIXSKO_Root, "KATCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "KATCOM", vTZTENVR1, "KatalogComment", zSET_ALL ); } // Create first ENTITY entity nRC = CreateEntity ( vKZSIXSKO_Root, "ENTITY", zPOS_AFTER ); nEntitySet = 1; SetMatchingAttributesByName(vKZSIXSKO_Root, "ENTITY", vTZTENVR1, "OrigSironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ENTITY", "ERENT_TOK", vTZZOXOD1, "ENTITY", "ERENT_TOK" ); for ( nRC = SetCursorFirstEntity( vTZTENVR1, "FieldComment", "OrigSironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1, "FieldComment", "OrigSironField") ) { CreateEntity ( vKZSIXSKO_Root, "ENTITYCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ENTITYCOM", vTZTENVR1, "FieldComment", zSET_ALL ); } // Create all dependent ATTRIB entities // according to XOD ATTRIB entities for ( nRC = SetCursorFirstEntity( vTZZOXOD1, "ATTRIB", "ENTITY"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZZOXOD1, "ATTRIB", "ENTITY") ) { // If the Attribute is a Workattribute there is no Datafield. // Do not save the Workattributes in the XSK-file. nRC = CreateViewFromViewForTask( &vTZZOXOD_TestWorkAttrib, vTZZOXOD1, 0 ); nRC = SetCursorFirstEntityByAttr (vTZZOXOD_TestWorkAttrib, "DATAFIELD", "FLDNAME", vTZZOXOD1, "ATTRIB", "NAME", ""); if (nRC == zCURSOR_SET) { nRC = SetCursorFirstEntityByAttr ( vTZTENVR1, "TE_FieldDataRel", "Name", vTZZOXOD1, "ATTRIB", "NAME", "TE_TablRec"); CreateEntity ( vKZSIXSKO_Root, "ATTRIB", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIB", vTZTENVR1, "SironField", zSET_ALL ); SetAttributeFromAttribute( vKZSIXSKO_Root, "ATTRIB", "XVAATT_TOK", vTZZOXOD1, "ATTRIB", "XVAATT_TOK" ); // Create all dependent ATTRIBCOM entities for ( nRC = SetCursorFirstEntity( vTZTENVR1,"SironFieldComment","SironField"); nRC > zCURSOR_UNCHANGED; nRC = SetCursorNextEntity( vTZTENVR1,"SironFieldComment","SironField") ) { CreateEntity ( vKZSIXSKO_Root, "ATTRIBCOM", zPOS_AFTER ); SetMatchingAttributesByName( vKZSIXSKO_Root, "ATTRIBCOM", vTZTENVR1, "SironFieldComment", zSET_ALL ); } } DropView( vTZZOXOD_TestWorkAttrib ); } } } nRC = CheckExistenceOfEntity( vTZZOXOD1, "CHILDENTITY" ); if ( nRC >= zCURSOR_SET ) zofnTZSIXSKO_BldXSKChildEnt( vKZSIXSKO_Root, vKZSIXSKO, vTZZOXOD1, vTZTENVRO_REF, nEntitySet ); nRC = DropView( vTZZOXOD1 ); nRC = DropView( vTZTENVR1 ); return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZEREMDO_DeleteRelationship // // PURPOSE: Delete Relationship from ER Model // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZEREMDO_DeleteRelationship( zVIEW vTZEREMDO, zSHORT nReposition, zSHORT nQuietMode ) { zVIEW vTZERSASO; zVIEW vSubtask; zVIEW vERD; zSHORT nRC; unsigned long ulZKey; LPLIBRARY hLibrary = 0; // used for dynamic call to ER control func's zFARPROC_RemoveFunc lpfn = 0; // Positon on ER_RelType on Right Side( side representing relationships // only ) thus allowing a single Delete to cascade and Delete all // representations of the Relationship on both sides of the Object. nRC = SetCursorFirstEntityByEntityCsr( vTZEREMDO, "ER_RelType", vTZEREMDO, "ER_RelType_1", "EntpER_Model" ); if ( GetViewByName( &vSubtask, "TZEREMDD", vTZEREMDO, zLEVEL_TASK ) > 0 ) { if ( lpfn == 0 ) // only get func addr once { lpfn =(zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask,(LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveRelationship", "(tzlooprs)" ); } if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } // if delete Relationship and this Relationship is a part of the // Identifier, then delete the Relationship from the Identifier CreateViewFromViewForTask( &vERD, vTZEREMDO, 0 ); for ( nRC = SetCursorFirstEntity( vERD, "ER_RelLink_2", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vERD, "ER_RelLink_2", "" ) ) { GetIntegerFromAttribute( &ulZKey, vERD, "ER_RelLink_2", "ZKey" ); for ( nRC = SetCursorFirstEntityByInteger( vERD, "ER_RelLinkIdentifier", "ZKey", ulZKey, "EntpER_Model" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntityByInteger( vERD, "ER_RelLinkIdentifier", "ZKey", ulZKey, "EntpER_Model" )) { if ( CheckExistenceOfEntity( vERD, "ER_AttributeIdentifier" ) == zCURSOR_NULL ) { DeleteEntity( vERD, "ER_FactType", zREPOS_NONE ); } } } DropView( vERD ); nRC = DeleteEntity( vTZEREMDO, "ER_RelType", nReposition ); if ( nReposition != zREPOS_NONE ) { if ( nReposition == zREPOS_NEXT ) SetCursorNextEntity( vTZEREMDO, "ER_RelLink", "" ); else SetCursorPrevEntity( vTZEREMDO, "ER_RelLink", "" ); } // It is possible that the ER_RelType we just deleted is part of an // opened Subject Area. If so, we must be sure that Subject Area doesn't // have hanging SA_RelType entities that result from the deleted // relationships. if ( GetViewByName( &vTZERSASO, "TZERSASO", vTZEREMDO, zLEVEL_TASK ) > 0 ) { nRC = SetCursorFirstEntity( vTZERSASO, "SA_RelType", 0 ); while ( nRC >= zCURSOR_SET ) { if ( CheckExistenceOfEntity( vTZERSASO, "ER_RelType" ) < zCURSOR_SET ) { if ( GetViewByName( &vSubtask, "SAVIEW", vTZEREMDO, zLEVEL_TASK ) > 0 ) { if ( lpfn == 0 ) // only get func addr once { lpfn = (zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask, (LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveRelationship", "(tzlooprs)" ); } if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } DeleteEntity( vTZERSASO, "SA_RelType", zREPOS_NONE ); } nRC = SetCursorNextEntity( vTZERSASO, "SA_RelType", 0 ); } } return( 0 ); }
///////////////////////////////////////////////////////////////////////////// // // OPERATION: oTZEREMDO_DeleteEntity // // PURPOSE: Delete Relationship from ER Model // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION oTZEREMDO_DeleteEntity( zVIEW vTZEREMDO, zSHORT nReposition ) { zVIEW vTZEREMD1; zVIEW vTZERSASO; zVIEW vSubtask; // to refresh ER Diagram zSHORT nRC; zLONG lEntityZKey; LPLIBRARY hLibrary = 0; // used for dynamic call to ER control func's zFARPROC_RemoveFunc lpfn = 0; // Position and determine if there are any relationships involving // this Entity prior to deleting the Entity. nRC = CreateViewFromViewForTask( &vTZEREMD1, vTZEREMDO, 0 ); nRC = GetIntegerFromAttribute( &lEntityZKey, vTZEREMD1, "ER_Entity", "ZKey" ); nRC = SetCursorFirstEntityByInteger( vTZEREMD1, "ER_Entity_2", "ZKey", lEntityZKey, "EntpER_Model" ); // Delete the entity if it is involved in any relationships. if ( nRC >= zCURSOR_SET ) { // Loop and Delete all ER RelLinks for ( nRC = SetCursorFirstEntity( vTZEREMDO, "ER_RelLink", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vTZEREMDO, "ER_RelLink", "" ) ) { oTZEREMDO_DeleteRelationship( vTZEREMDO, zREPOS_NONE, 1 ); } // Check to if all relationships were deleted. if ( SetCursorFirstEntityByInteger( vTZEREMD1, "ER_Entity_2", "ZKey", lEntityZKey, "EntpER_Model" ) >= zCURSOR_SET ) { DropView( vTZEREMD1 ); return( -1 ); } } // Delete ER Entity if ( GetViewByName( &vSubtask, "TZEREMDD", vTZEREMDO, zLEVEL_TASK ) > 0 ) { lpfn = (zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask, (LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveEntity", "(tzlooprs)" ); if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } nRC = DeleteEntity( vTZEREMDO, "ER_Entity", nReposition ); // It is possible that the ER_Entity we just deleted is part of an // opened Subject Area. If so, we must be sure that Subject Area doesn't // have hanging SA_Entity entities. if ( GetViewByName( &vTZERSASO, "TZERSASO", vTZEREMDO, zLEVEL_TASK ) > 0 ) { nRC = SetCursorFirstEntity( vTZERSASO, "SA_Entity", 0 ); while ( nRC >= zCURSOR_SET ) { if ( CheckExistenceOfEntity( vTZERSASO, "ER_Entity" ) < zCURSOR_SET ) { if ( GetViewByName( &vSubtask, "SAVIEW", vTZEREMDO, zLEVEL_TASK ) > 0 ) { if ( lpfn == 0 ) // only get func addr once { lpfn = (zFARPROC_RemoveFunc) GetOperationDynamicCallAddress( vSubtask, (LPLPLIBRARY) &hLibrary, "TZCTL", "RemoveEntity", "(tzlooprs)" ); } if ( lpfn ) (*lpfn)( vSubtask, "ERD", 0, 0 ); } DeleteEntity( vTZERSASO, "SA_Entity", zREPOS_NONE ); } nRC = SetCursorNextEntity( vTZERSASO, "SA_Entity", 0 ); } } DropView( vTZEREMD1 ); 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 ); }
///////////////////////////////////////////////////////////////////////////// // // bSubcontrol - TRUE - add controls to existing pZSubtask->m_pZMIXCtrl // FALSE - delete existing pZSubtask->m_pZMIXCtrl and start // a new list // ///////////////////////////////////////////////////////////////////////////// void OPERATION CreateZeidonCtrls( zVIEW vSubobject, ZSubtask *pZSubtask, CWnd *pWndParent, ZMapAct *pzmaComposite, zSHORT nOffsetX, zSHORT nOffsetY, zBOOL bSubcontrol ) { zKZWDLGXO_Ctrl_DEF CtrlDef; zFARPROC_CONTROL lpfnCtrlProc; LPLIBRARY hCCtlLibrary; zPCHAR pchDLL_Name; zPCHAR pchCOP; zSHORT nRC; #ifdef DEBUG_ALL TraceLineX( "CreateZeidonCtrls parent - ", (zLONG) pZSubtask ); #endif nRC = CheckExistenceOfEntity( vSubobject, szlCtrl ); if ( bSubcontrol == FALSE ) { mDeleteInit( pZSubtask->m_pZMIXCtrl ); if ( nRC > zCURSOR_UNCHANGED ) { zLONG lTempCtrlCnt; // just to get the long temporarily GetIntegerFromAttribute( &lTempCtrlCnt, pZSubtask->m_vDialog, szlWnd, "CtrlCnt" ); // TraceLineI( "CreateZeidonCtrls count ", lTempCtrlCnt ); pZSubtask->m_pZMIXCtrl = new ZMultiIdxSet( (fnCOMPARE) fnCompareCtrlNodes, (fnCOMPARE) fnSeekCtrlNode, lTempCtrlCnt ); // Instead of having ZMultiIdxSet delete the nodes itself, we call // a recursive routine (fnDeleteCtrls) to guarantee the child // controls are deleted before their parents. } else pZSubtask->m_pZMIXCtrl = 0; CreateViewFromViewForTask( &(pZSubtask->m_vPE), pZSubtask->m_pZTask->m_vPE, pZSubtask->m_vDialog ); } #ifdef DEBUG_LODSTRUCT zmemset( CtrlDef.Tag, 0xFE, sizeof( CtrlDef ) ); // CtrlDef.CheckByte = 0xFE; #endif while ( nRC > zCURSOR_UNCHANGED ) { // Get the structure of attributes for this control. zPCHAR pch = 0; // for derived Text attribute GetStructFromEntityAttrs( (zPCHAR) CtrlDef.Tag, vSubobject, szlCtrl ); #ifdef DEBUG_LODSTRUCT if ( CtrlDef.CheckByte != 0xFE ) MessageBox( 0, "CtrlDef Structure Length Error", "GetStructFromEntityAttrs", MB_OK ); // zPCHAR pchCheckByte = (zPCHAR) &(CtrlDef.CheckByte); // pchCheckByte--; // if ( *pchCheckByte == (char) 0xFE ) // TraceLineS( "zdrctl CtrlDef CheckByte error??", "" ); #endif GetAddrForAttribute( (zPCHAR *) &pch, vSubobject, szlCtrl, szlD_Text ); if ( *pch ) zstrcpy( CtrlDef.Text, pch ); #ifdef DEBUG_ALL TraceLineS( "Tag ", CtrlDef.Tag ); TraceLineI( "Type ", CtrlDef.Type ); TraceLineI( "IdNbr ", CtrlDef.IdNbr ); TraceLineI( "PSDLG_X ", CtrlDef.PSDLG_X ); TraceLineI( "PSDLG_Y ", CtrlDef.PSDLG_Y ); TraceLineI( "SZDLG_X ", CtrlDef.SZDLG_X ); TraceLineI( "SZDLG_Y ", CtrlDef.SZDLG_Y ); #endif // The token is validated by the painter and/or conversion to // the executable object, but we check here anyway. nRC = SetCursorFirstEntityByInteger( pZSubtask->m_pZTask->m_vPE, szlCtrl, szlKey, CtrlDef.Type, 0 ); if ( nRC != zCURSOR_SET ) { TraceLine( "(drvr) ID (%d) not found (%d) in PPE for Ctrl: %s.%s.%s", CtrlDef.Type, nRC, pZSubtask->m_pzsDlgTag ? *(pZSubtask->m_pzsDlgTag) : "?", pZSubtask->m_pzsWndTag ? *(pZSubtask->m_pzsWndTag) : "?", CtrlDef.Tag ); DisplayEntityInstance( pZSubtask->m_pZTask->m_vPE, szlCtrl ); DisplayObjectInstance( pZSubtask->m_pZTask->m_vPE, 0, 0 ); // Skip this one and try the next. nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 ); continue; } GetAddrForAttribute( (zPCHAR *) &pchDLL_Name, pZSubtask->m_pZTask->m_vPE, szlCtrl, szlDLL ); GetAddrForAttribute( (zPCHAR *) &pchCOP, pZSubtask->m_pZTask->m_vPE, szlCtrl, szlCOP ); // If the DLL name is added to the list, this is the first time it // has been encountered ... so call its initialization routine. pZSubtask->m_pZTask->AddApplicationDLL( pZSubtask, pchDLL_Name ); hCCtlLibrary = 0; // set to zero for GetOperationDynamicCallAddress lpfnCtrlProc = (zFARPROC_CONTROL) GetOperationDynamicCallAddress( pZSubtask->m_vDialog, (LPLPLIBRARY) &hCCtlLibrary, pchDLL_Name, pchCOP, "(drvr) Ctrl" ); try { if ( lpfnCtrlProc ) // && (k % 2) == 0 ) { // TraceLineS( "Create Control: ", pchCOP ); (*lpfnCtrlProc)( pZSubtask, pWndParent, pzmaComposite, vSubobject, nOffsetX, nOffsetY, &CtrlDef ); } } #if 0 catch( CResourceException *e ) { zCHAR szMsg[ 256 ]; e->GetErrorMessage( szMsg, sizeof( szMsg ) ); zstrcat( szMsg, } #endif catch( CException *e ) { zCHAR szMsg[ 256 ]; e->GetErrorMessage( szMsg, sizeof( szMsg ) ); MessageSend( pZSubtask->m_vDialog, 0, "Zeidon Control", szMsg, zMSGQ_MODAL_ERROR, FALSE ); break; } nRC = SetCursorNextEntity( vSubobject, szlCtrl, 0 ); } // end of: while ( nRC == zCURSOR_UNCHANGED ) looping thru controls if ( bSubcontrol == FALSE ) { DropView( pZSubtask->m_vPE ); pZSubtask->m_vPE = 0; // using this to determine Ctrls have been created // Ctrl creation is complete ... notify each ctrl. if ( pZSubtask->m_pZMIXCtrl ) { pZSubtask->m_pZMIXCtrl->VisitInorder( (fnVISIT_INORDER) fnPostCreateCtrls, 0, 0, 0 ); } } }
// // OPERATION: AddGetVariableFromAttribute // // DESCRIPTION: Creates a GetVariableFromAttribute call with the // result of the operation being put in nZRetCode // zOPER_EXPORT zLONG OPERATION AddGetVariableFromAttribute( zVIEW vSubtask, zPCHAR pchOperationName, zLONG lViewID, zLONG lReturnLthID, zLONG lUseVariable, zLONG lVariableDataType, zLONG lVariableID, zPCHAR pchEntityName, zLONG lEntityID, zPCHAR pchAttributeName, zLONG lAttributeID, zLONG lUseExtra, zPCHAR pchExtra, zLONG lExtra ) { zLONG sParmList[ PARM_LIST_SIZE ] = { 0 }; zLONG sParmListExt[ PARM_LIST_SIZE ] = { 0 }; zLONG lParmListIndex = 0; zLONG lRCID; zLONG lOperZKey; zLONG lTempVariableID; zCHAR szVariableLth[ 12 ]; // memset( sParmListExt, 0, sizeof( sParmListExt ) ); // lParmListIndex = 0; lLocal3Code = 0; lLocal3Text = 0; // Set temp variable ID because VariableID can be set to negative. lTempVariableID = lVariableID; // Insert new bottom of stack. AddOperatorToView( vSubtask, 0, -2 ); // add result lRCID = AddRetCode( vSubtask ); ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qNUMERIC, qTSHORT, "RC", lRCID, 0 ); // add operation name lOperZKey = GetOperationZKey( vSubtask, qZEIDONOPERATION, pchOperationName ); ADDEXPRESSIONENTRYTOSTRING( qOPERATIONCALL, qZEIDONOPERATION, qTSHORT, pchOperationName, lOperZKey, 0 ); GetOperationParmListPM( vSubtask, sParmList, sParmListExt, lOperZKey, qZEIDONOPERATION ); ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, "(", qOPENOPER, 0 ); lParmListIndex = 1; // return attribute value // Add target string variable. if ( sParmList[ lParmListIndex++ ] < 0 ) lVariableID *= -1; if ( g_szGenLang[ 0 ] == 'J' ) ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, qTSTRING, "", lVariableID, 0 ); // add return attribute value else ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, lVariableDataType, "", lVariableID, 0 ); // add return attribute value ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); if ( sParmList[ lParmListIndex++ ] < 0 ) // return attribute value length lReturnLthID *= -1; if ( g_szGenLang[ 0 ] == 'J' ) { // Add zero parm and comma. if ( lReturnLthID == 0 ) ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, "0", lVariableID, 0 ); // add return attribute value length else ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, qTINTEGER, "", lReturnLthID, 0 ); // add return attribute value length } else { // Add zero parm and comma. ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, "0", lVariableID, 0 ); // add return attribute value length } ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); // Add string type 'S' and comma. lParmListIndex++; // variable type ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTCHARACTER, "S", lVariableID, 0 ); // add variable type ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); // Add variable length and comma. First position on variable. lParmListIndex++; // variable length SetCursorFirstEntityByInteger( g_lpPIView, "Variable", "ID", lTempVariableID, 0 ); GetStringFromAttribute( szVariableLth, g_lpPIView, "Variable", "NElements" ); ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, szVariableLth, lVariableID, 0 ); // add variable length ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); // Add view and comma. lParmListIndex++; // view ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qNUMERIC, qTVIEW, "", lViewID, 0 ); // add view ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); // Add entity name and comma. lParmListIndex++; // entity name if ( lEntityID > 0 ) // is a var { if ( sParmList[ lParmListIndex ] < 0 ) lEntityID *= -1; ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qTEXT, qTENTITYNAME, "", lEntityID, 0 ); // add entity name } else // is a string constant { ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, qTEXT, qTENTITYNAME, pchEntityName, lEntityID, 0 ); // add entity name } ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); // Add attribute name and comma. lParmListIndex++; // attribute name if ( lAttributeID > 0 ) // is a var { if ( sParmList[ lParmListIndex ] < 0 ) lAttributeID *= -1; ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, qTEXT, qTATTRIBUTENAME, "", lAttributeID, 0 ); // add attribute name } else // is a string constant { ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, qTEXT, qTATTRIBUTENAME, pchAttributeName, lAttributeID, 0 ); // add attribute name } ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); // Add context name and comma. lParmListIndex++; // context name if ( lUseVariable == 1 ) { if ( sParmList[ lParmListIndex ] < 0 ) lVariableID *= -1; ADDEXPRESSIONENTRYTOSTRING( qVARIABLE, 0, lVariableDataType, "", lVariableID, 0 ); // add context name } else { ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, qTEXT, qTSTRING, "", lVariableID, 0 ); } ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ",", qCOMMA, 0 ); // Add zero parm and close paren. lParmListIndex++; ADDEXPRESSIONENTRYTOSTRING( qCONSTANT, 0, qTINTEGER, "0", lVariableID, 0 ); ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, ")", qCLOSEOPER, 0 ); // add EQUAL ADDEXPRESSIONENTRYTOSTRING( qOPERATOR, qNUMERIC, qTINTEGER, "=", qEQUAL, 0 ); // Dump the expression from the stack. AddOperatorToView( vSubtask, 0, -1 ); AddStatementEntityWithStringToPI( vSubtask, qEXPRESSION, qqlineno, szLocal3Code, &lLocal3Code, szLocal3Text, &lLocal3Text, zPOS_AFTER ); return( 0 ); }
//:VIEW OperationXOG BASED ON LOD TZZOXOGO zOPER_EXPORT zSHORT OPERATION oTZOGSRCO_GenerateXOG( zVIEW OperationGroup ) { zVIEW OperationXOG = 0; //:VIEW OperationGroupT BASED ON LOD TZOGSRCO zVIEW OperationGroupT = 0; //:VIEW CurrentLPLR BASED ON LOD TZCMLPLO zVIEW CurrentLPLR = 0; //:STRING ( 513 ) XOG_FileName zCHAR XOG_FileName[ 514 ] = { 0 }; //:STRING ( 513 ) POG_FileName zCHAR POG_FileName[ 514 ] = { 0 }; //:STRING ( 200 ) szMsg zCHAR szMsg[ 201 ] = { 0 }; //:INTEGER lFile zLONG lFile = 0; //:SHORT nRC zSHORT nRC = 0; zSHORT RESULT; zCHAR szTempString_0[ 33 ]; zCHAR szTempString_1[ 33 ]; //:// Build the executable Global Object executable for all Operations in the LPLR. //:// Activate or initialize the XOG executable object. //:GET VIEW CurrentLPLR NAMED "TaskLPLR" RESULT = GetViewByName( &CurrentLPLR, "TaskLPLR", OperationGroup, zLEVEL_TASK ); //:XOG_FileName = CurrentLPLR.LPLR.ExecDir + "\" + CurrentLPLR.LPLR.Name + ".XOG" GetStringFromAttribute( XOG_FileName, CurrentLPLR, "LPLR", "ExecDir" ); ZeidonStringConcat( XOG_FileName, 1, 0, "\\", 1, 0, 514 ); GetVariableFromAttribute( szTempString_0, 0, 'S', 33, CurrentLPLR, "LPLR", "Name", "", 0 ); ZeidonStringConcat( XOG_FileName, 1, 0, szTempString_0, 1, 0, 514 ); ZeidonStringConcat( XOG_FileName, 1, 0, ".XOG", 1, 0, 514 ); //:lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ ) lFile = SysOpenFile( OperationGroup, XOG_FileName, COREFILE_READ ); //:IF lFile < 0 if ( lFile < 0 ) { //:// Executable has not yet been generated. //:ACTIVATE OperationXOG EMPTY RESULT = ActivateEmptyObjectInstance( &OperationXOG, "TZZOXOGO", OperationGroup, zSINGLE ); //:CREATE ENTITY OperationXOG.TZZOXOGO RESULT = CreateEntity( OperationXOG, "TZZOXOGO", zPOS_AFTER ); //:OperationXOG.TZZOXOGO.NAME = CurrentLPLR.LPLR.Name SetAttributeFromAttribute( OperationXOG, "TZZOXOGO", "NAME", CurrentLPLR, "LPLR", "Name" ); //:ELSE } else { //:SysCloseFile( OperationGroup, lFile, 0 ) SysCloseFile( OperationGroup, lFile, 0 ); //:// Get current executable File. //:ActivateOI_FromFile( OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE ) ActivateOI_FromFile( &OperationXOG, "TZZOXOGO", OperationGroup, XOG_FileName, zSINGLE ); //:// Delete current source file entries. //:FOR EACH OperationXOG.GLOBALOPERATIONSOURCEFILE RESULT = SetCursorFirstEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:DELETE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE NONE RESULT = DeleteEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zREPOS_NONE ); RESULT = SetCursorNextEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "" ); } //:END } //:END //:NAME VIEW OperationXOG "OperationXOG" SetNameForView( OperationXOG, "OperationXOG", 0, zLEVEL_TASK ); //:// Build the executable components from each POG Operation. //:SET CURSOR FIRST CurrentLPLR.W_MetaType WHERE CurrentLPLR.W_MetaType.Type = 14 // 14 is Global Operation Group RESULT = SetCursorFirstEntityByInteger( CurrentLPLR, "W_MetaType", "Type", 14, "" ); //:FOR EACH CurrentLPLR.W_MetaDef RESULT = SetCursorFirstEntity( CurrentLPLR, "W_MetaDef", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:POG_FileName = CurrentLPLR.LPLR.MetaSrcDir + "\" + CurrentLPLR.W_MetaDef.Name + ".POG" GetStringFromAttribute( POG_FileName, CurrentLPLR, "LPLR", "MetaSrcDir" ); ZeidonStringConcat( POG_FileName, 1, 0, "\\", 1, 0, 514 ); GetVariableFromAttribute( szTempString_1, 0, 'S', 33, CurrentLPLR, "W_MetaDef", "Name", "", 0 ); ZeidonStringConcat( POG_FileName, 1, 0, szTempString_1, 1, 0, 514 ); ZeidonStringConcat( POG_FileName, 1, 0, ".POG", 1, 0, 514 ); //:nRC = ActivateOI_FromFile( OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 ) nRC = ActivateOI_FromFile( &OperationGroupT, "TZOGSRCO", OperationGroup, POG_FileName, zSINGLE + 8192 ); //:IF nRC < 0 if ( nRC < 0 ) { //:szMsg = "Can't open POG file, " + POG_FileName ZeidonStringCopy( szMsg, 1, 0, "Can't open POG file, ", 1, 0, 201 ); ZeidonStringConcat( szMsg, 1, 0, POG_FileName, 1, 0, 201 ); //:IssueError( OperationGroup,0,0, szMsg ) IssueError( OperationGroup, 0, 0, szMsg ); //:RETURN -1 return( -1 ); } //:END //:// Create Source file entry. //:CREATE ENTITY OperationXOG.GLOBALOPERATIONSOURCEFILE RESULT = CreateEntity( OperationXOG, "GLOBALOPERATIONSOURCEFILE", zPOS_AFTER ); //:OperationXOG.GLOBALOPERATIONSOURCEFILE.NAME = OperationGroupT.GlobalOperationGroup.Name SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "NAME", OperationGroupT, "GlobalOperationGroup", "Name" ); //:OperationXOG.GLOBALOPERATIONSOURCEFILE.LANGUAGETYPE = OperationGroupT.GlobalOperationGroup.LanguageType SetAttributeFromAttribute( OperationXOG, "GLOBALOPERATIONSOURCEFILE", "LANGUAGETYPE", OperationGroupT, "GlobalOperationGroup", "LanguageType" ); //:// Create each Operation entry. //:FOR EACH OperationGroupT.Operation RESULT = SetCursorFirstEntity( OperationGroupT, "Operation", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:CREATE ENTITY OperationXOG.OPERATION RESULT = CreateEntity( OperationXOG, "OPERATION", zPOS_AFTER ); //:OperationXOG.OPERATION.NAME = OperationGroupT.Operation.Name SetAttributeFromAttribute( OperationXOG, "OPERATION", "NAME", OperationGroupT, "Operation", "Name" ); //:OperationXOG.OPERATION.TYPE = OperationGroupT.Operation.Type SetAttributeFromAttribute( OperationXOG, "OPERATION", "TYPE", OperationGroupT, "Operation", "Type" ); //:FOR EACH OperationGroupT.Parameter RESULT = SetCursorFirstEntity( OperationGroupT, "Parameter", "" ); while ( RESULT > zCURSOR_UNCHANGED ) { //:CREATE ENTITY OperationXOG.PARAMETER RESULT = CreateEntity( OperationXOG, "PARAMETER", zPOS_AFTER ); //:OperationXOG.PARAMETER.NAME = OperationGroupT.Parameter.ShortDesc SetAttributeFromAttribute( OperationXOG, "PARAMETER", "NAME", OperationGroupT, "Parameter", "ShortDesc" ); //:OperationXOG.PARAMETER.DATATYPE = OperationGroupT.Parameter.DataType SetAttributeFromAttribute( OperationXOG, "PARAMETER", "DATATYPE", OperationGroupT, "Parameter", "DataType" ); RESULT = SetCursorNextEntity( OperationGroupT, "Parameter", "" ); } RESULT = SetCursorNextEntity( OperationGroupT, "Operation", "" ); //:END } RESULT = SetCursorNextEntity( CurrentLPLR, "W_MetaDef", "" ); //:END } //:END //:CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII ) CommitOI_ToFile( OperationXOG, XOG_FileName, zASCII ); //:DropObjectInstance( OperationXOG ) DropObjectInstance( OperationXOG ); return( 0 ); // END }
///////////////////////////////////////////////////////////////////////////// // // CONSTRUCTOR: Tab sub-control (to group controls at the tab level) // ///////////////////////////////////////////////////////////////////////////// // ctor TZNotePage::TZNotePage( TZPainterWindow *pPainterWindow, TZPainterCtrl *pCtrlParent, CWnd *pWndParent, CRect& rect, zVIEW vCtrl, zLONG lType, zBOOL bPlaceHolder, zLONG lZKey, zLONG lTabStopNbr, zLONG lCtrlID, zPCHAR pchTag, zPCHAR pchText ) : CWnd( ), TZPainterCtrl( pPainterWindow, pCtrlParent, pWndParent, rect, vCtrl, this, pchTag, pchText, lType, bPlaceHolder, lZKey, lTabStopNbr, lCtrlID ) { #ifdef DEBUG_ALL TraceLineS( "TZNotePage::ctor ", m_csTag ); #endif m_pNext = 0; m_uVisible = 0x0100; m_lSubtype = 0; m_pZNoteBook = DYNAMIC_DOWNCAST( TZNoteBook, pWndParent ); if ( m_pZNoteBook == 0 ) return; zPCHAR pch; zLONG lTabNbr; zLONG lLth; if ( vCtrl ) { GetAddrForAttribute( &pch, vCtrl, szlControl, szlText ); lLth = zstrlen( pch ) + 1; m_pchCaption = new char[ lLth ]; strcpy_s( m_pchCaption, lLth, pch ); GetIntegerFromAttribute( &lTabNbr, vCtrl, szlControl, szlType ); if ( lTabNbr == 0 ) { zVIEW vTemp; m_pZNoteBook->m_nTabNbrMax++; CreateViewFromViewForTask( &vTemp, vCtrl, pPainterWindow->m_vDialog ); ResetViewFromSubobject( vTemp ); while ( SetCursorFirstEntityByInteger( vTemp, szlCtrlCtrl, szlType, m_pZNoteBook->m_nTabNbrMax, 0 ) == zCURSOR_SET ) { m_pZNoteBook->m_nTabNbrMax++; } SetAttributeFromInteger( vCtrl, szlControl, szlType, m_pZNoteBook->m_nTabNbrMax ); m_lSubtype = m_pZNoteBook->m_nTabNbrMax; DropView( vTemp ); } else { if ( lTabNbr > m_pZNoteBook->m_nTabNbrMax ) m_pZNoteBook->m_nTabNbrMax = (zSHORT) lTabNbr; m_lSubtype = m_pZNoteBook->m_nTabNbrMax; } if ( MiGetUpdateForView( vCtrl ) > 0 ) { SetAttributeFromAttribute( vCtrl, szlControl, szlSyncKey, vCtrl, szlControl, szlType ); } } else { m_pZNoteBook->m_nTabNbrMax++; m_lSubtype = m_pZNoteBook->m_nTabNbrMax; lTabNbr = m_pZNoteBook->m_nTabNbrMax; lLth = zstrlen( pchText ) + 1; m_pchCaption = new char[ lLth ]; strcpy_s( m_pchCaption, lLth, pchText ); } // TraceRect( "TabCtl rect ", rect ); // TraceLineI( " Attr.X ", Attr.X ); // TraceLineI( " Attr.Y ", Attr.Y ); // TraceLineI( " Attr.W ", Attr.W ); // TraceLineI( " Attr.H ", Attr.H ); // Build sub-controls on demand (only when visible or selectable). m_bBuildOnDemand = TRUE; if ( m_pZNoteBook->m_pZNotePage ) { m_nTabIdx = 1; TZNotePage *pCurrNotePage = m_pZNoteBook->m_pZNotePage; while ( pCurrNotePage->m_pNext ) { m_nTabIdx++; pCurrNotePage = pCurrNotePage->m_pNext; } pCurrNotePage->m_pNext = this; } else { m_nTabIdx = 0; m_pZNoteBook->m_pZNotePage = this; } // m_nTabNbr = (zSHORT) lTabNbr; m_nTabNbr = m_nTabIdx + 1; m_pZNoteBook->m_nPageCnt++; TC_ITEM TabCtrlItem; TabCtrlItem.mask = TCIF_TEXT; TabCtrlItem.pszText = m_pchCaption; #ifdef DEBUG_ALL TraceLineS( "Adding TabCtrlItem: ", m_pchCaption ); #endif m_pZNoteBook->InsertItem( m_nTabIdx, &TabCtrlItem ); //?Attr.StyleEx = WS_EX_TRANSPARENT; //?Attr.Style &= ~(WS_CLIPSIBLINGS | WS_CLIPCHILDREN); CreateZ( ); }