/****************************************************************************** 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 callback and register a new one. */ /***************************************************************/ #include #include #include #include #include /***************************************************************/ static int my_new_dataset_name_func ( UF_UGMGR_new_dataset_name_p_t appl_data ) { int ifail = 0; const char* owner = appl_data->owner; const char* dataset_type = appl_data->dataset_type; char partname[132], *ptr = partname; /* Just return for now... */ strcpy(appl_data->dataset_name, ""); appl_data->dataset_name_modifiable = TRUE; appl_data->ifail = ifail; partname[0] = '\0'; if (owner != NULL) strcpy(ptr, owner); if (dataset_type != NULL) strcat(ptr, dataset_type); appl_data->ifail = ifail; return ifail; } /***************************************************************/ extern void ufsta(char *name, int *rtcode, int rtlen) { int irc = 0, argc = 1, ifail = 0; const char* argv[] = {"new_dataset_name"}; UF_UGMGR_new_dataset_name_fn_t *old_one = NULL; /**************************beginning of executable*******************/ printf("\nstarting dataset_name 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"); /*********************************************/ /* Make sure we do not have one already. */ ifail = UF_UGMGR_ask_new_dataset_name(old_one); if (old_one != NULL) { printf("Already registered new dataset method! &%p\n", old_one); return; } /* Try and register the routine as supplied. */ irc = UF_UGMGR_reg_new_dataset_name(my_new_dataset_name_func); if (irc != 0) { printf("Unable to register new dataset method!\n"); return; } printf("Setting routines all finished, bye bye\n"); UF_UGMGR_terminate(); return; }