///////////////////////////////////////////////////////////////////////////// // // 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 ); }
///////////////////////////////////////////////////////////////////////////// // // ENTRY: // // PURPOSE: Save the HK object(both Source & Executable???) // ///////////////////////////////////////////////////////////////////////////// zOPER_EXPORT zSHORT OPERATION zwTZHKEYAD_SaveHK_ForLPLR( zVIEW vSubtask ) { zPCHAR lpGlobalHotkey; zUSHORT usGlobalHotkeyLth; LPACCEL_TABLE lpAT; LPACCEL_TABLE lpAT_Start; zCHAR szFileSpec[ zMAX_FILESPEC_LTH + 1 ]; zVIEW vKZHKEYSO; zVIEW vKZHKEYXO; zVIEW vTaskLPLR; zULONG ulMaxLth; zSHORT nRC; GetViewByName( &vKZHKEYSO, "KZHKEYSO", vSubtask, zLEVEL_ANY ); // Get the directory. GetViewByName( &vTaskLPLR, "TaskLPLR", vSubtask, zLEVEL_TASK ); if ( vTaskLPLR == 0 ) { MessageSend( vSubtask, "HK00102", "Hot Keys", "Can't locate LPLR?", zMSGQ_OBJECT_CONSTRAINT_ERROR, zBEEP ); return( 0 ); } GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "MetaSrcDir" ); zstrcat( szFileSpec, "\\ZEIDON.PHK" ); MiSetOI_ReleaseForView( vKZHKEYSO, szlReleaseCurrent ); CommitOI_ToFile( vKZHKEYSO, szFileSpec, zASCII | zENCODE_BLOBS | zNO_NULL_STRING_TERM ); SfAllocTaskMemory( vSubtask, (zCOREMEM) &lpGlobalHotkey, 65000 ); lpAT = (LPACCEL_TABLE) SfLockTaskMemory( lpGlobalHotkey ); lpAT_Start = lpAT; usGlobalHotkeyLth = 0; SfActivateSysEmptyOI( &vKZHKEYXO, "KZHKEYXO", vSubtask, zSINGLE | zLEVEL_APPLICATION ); CreateEntity( vKZHKEYXO, "App", zPOS_AFTER ); nRC = SetEntityCursor( vKZHKEYSO, "Hotkey", 0, zPOS_FIRST, 0, 0, 0, 0, 0, 0 ); while ( nRC >= 0 ) { CreateEntity( vKZHKEYXO, "Hotkey", zPOS_AFTER ); SetMatchingAttributesByName( vKZHKEYXO, "Hotkey", vKZHKEYSO, "Hotkey", zSET_ALL ); SetAttributeFromAttribute( vKZHKEYXO, "Hotkey", "COP", vKZHKEYSO, "Operation", "Name" ); SetAttributeFromAttribute( vKZHKEYXO, "Hotkey", "DLL", vKZHKEYSO, "Hotkey", "DLL_Name" ); lpAT->chType = zACCEL_HOTKEY; ulMaxLth = sizeof( zACCEL_DEF ); GetBlobFromAttribute( &(lpAT->ac), &ulMaxLth, vKZHKEYSO, "Hotkey", "KeyCombo" ); lpAT->nID = (zSHORT) GetRelativeEntityNumber( vKZHKEYSO, "Hotkey", 0, 0L ); usGlobalHotkeyLth += sizeof( zACCEL_TABLE ); lpAT++; nRC = SetCursorNextEntity( vKZHKEYSO, "Hotkey", 0 ); } zmemset( lpAT, 0xFF, sizeof( zACCEL_TABLE ) ); // terminator usGlobalHotkeyLth += sizeof( zACCEL_TABLE ); lpAT = lpAT_Start; SetAttributeFromBlob( vKZHKEYXO, "App", "Hotkey", lpAT, usGlobalHotkeyLth ); SfUnlockTaskMemory( lpAT ); SfFreeTaskMemory( lpGlobalHotkey ); GetStringFromAttribute( szFileSpec, vTaskLPLR, "LPLR", "ExecDir" ); zstrcat( szFileSpec, "\\ZEIDON.XKY" ); CommitOI_ToFile( vKZHKEYXO, szFileSpec, zASCII ); return( 0 ); }
// // OPERATION: SetStackObjectFromViews // // DESCRIPTION: SetStackObjectFromViews creates an operation entity in the // Stack call object an copies all of the variable data thers as well. // // // zOPER_EXPORT zSHORT OPERATION SetStackObjectFromViews( zVIEW lpInterpSubtask, // interp subtask zVIEW vXPG, // View to the XPG zVIEW vStmtView, // View to the statement zSHORT nIndex ) // index into the expression { zSHORT nRC; // a Return code //zSHORT nPrevOperation; // a ret code zVIEW vStackObject; // view to the stack object //zVIEW vPriorOperation; // view to the prior operation in the stack object // Get the stack object as it was loaded with the XPG nRC = GetViewByName( &vStackObject, "StackObject", lpInterpSubtask, zLEVEL_SUBTASK ); if ( nRC != zLEVEL_SUBTASK ) { return( -1 ); } SfLockView( vXPG ); SfLockView( vStmtView ); // DGC 8/19/02 // vPriorOperation doesn't appear to be used outside of this function, so // I'm removing the code. #if 0 nRC = CreateViewFromViewForTask( &vPriorOperation, vStackObject, 0 ); nPrevOperation = SetCursorPrevEntity( vPriorOperation, "OperationCall", "" ); #endif if ( SetCursorFirstEntityByAttr( vStackObject, "OperationCall", "Name", vXPG, "Operation", "Name", 0 ) < zCURSOR_SET ) { // create an operation entity at the end of the list ( stack ) CreateEntity( vStackObject, "OperationCall", zPOS_AFTER ); // set the name of the operation that was called. SetAttributeFromAttribute( vStackObject, "OperationCall", "Name", vXPG, "Operation", "Name" ); } // set the views SetAttributeFromInteger( vStackObject, "OperationCall", "XPGView", (zLONG) vXPG ); // set the views SetAttributeFromInteger( vStackObject, "OperationCall", "StatementView", (zLONG) vStmtView ); // set the offset SetAttributeFromInteger( vStackObject, "OperationCall", "StatementOffset", nIndex ); // now loop through and do all of the variables for ( nRC = SetCursorFirstEntity( vXPG, "Variable", "" ); nRC >= zCURSOR_SET; nRC = SetCursorNextEntity( vXPG, "Variable", "" ) ) { // Check to see if the variable already exists in the stack object. It // will exist if the interpreter is being called from a different app // (like Core) and the app has set up the arguments already. if ( SetCursorFirstEntityByAttr( vStackObject, "Variable", "Name", vXPG, "Variable", "Name", 0 ) < zCURSOR_SET ) { CreateEntity( vStackObject, "Variable", zPOS_LAST ); } SetMatchingAttributesByName( vStackObject, "Variable", vXPG, "Variable", zSET_NULL ); } SetCursorFirstEntity( vStackObject, "Variable", "" ); SetCursorFirstEntity( vXPG, "Variable", "" ); // DropView( vPriorOperation ); return( 0 ); }
/* 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
//: 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 }