/****************************************************************************** Copyright (c) 1999 Unigraphics Solutions, Inc. Unpublished - All Rights Reserved *******************************************************************************/ /* The following is an example of a users program, written as a user exit to be executed at startup of Unigraphics, to check the current pointer to a registered program and register a new one. */ /***************************************************************/ #include #include #include #include #include /* /***************************************************************/ static int my_new_partrev_func ( UF_UGMGR_new_part_rev_p_t appl_data ) { int ifail = 0; const char* item = appl_data->item; const char* item_type = appl_data->item_type; char partrev[132], *ptr = partrev; /* 24-Mar-98 Just return for now... */ strcpy(appl_data->new_revision, ""); appl_data->part_revision_modifiable = TRUE; appl_data->ifail = ifail; partrev[0] = '\0'; if (item != NULL) strcpy(ptr, item); if (item_type != NULL) strcat(ptr, item_type); appl_data->ifail = ifail; return ifail; } /***************************************************************/ extern void ufsta(char *name, int *rtcode, int rtlen) { int irc = 0, argc = 1; const char* argv[] = {"new_partrev"}; UF_UGMGR_new_part_rev_fn_t old_one; /**************************beginning ofexecutable*******************/ printf("\nstarting partrev v1.0\n"); /*********************************************/ irc=UF_UGMGR_initialize(argc, argv);/* get licence*/ if (irc != 0) { printf("Unable to get a UG/Open API/ugmanager license!\n"); return; } printf("got UG/Open API license!\n"); /*********************************************/ /* 24-Mar-98 Make sure we do not have one already. */ old_one = UF_UGMGR_get_new_part_rev(); if (old_one != NULL) { printf("Already registered partrev method! &%p\n",old_one); return; } /* 24-Mar-98 Try and register the routine as supplied. */ irc = UF_UGMGR_reg_new_part_rev(my_new_partrev_func); if (irc != 0) { printf("Unable to register partrev method!\n"); return; } printf("Setting routines all finished, bye bye\n"); UF_UGMGR_terminate(); return; }