/****************************************************************************** Copyright (c) 1999 Unigraphics Solutions, Inc. Unpublished - All Rights Reserved *******************************************************************************/ /* The code in the following example implements a ufsta user exit which registers an auto_translate function; the autotranslate function translates @DB names to _ Native names, and Native names to @DB//A (Note that this is not a symmetrical translation). */ #include #include #include int translate_name(const char old_name[MAX_FSPEC_SIZE +1], char new_name[MAX_FSPEC_SIZE + 1]) { if (old_name[0] == '@') /* export */ { char no[UF_UGMGR_PARTNO_SIZE+1]; char rev[UF_UGMGR_PARTREV_SIZE+1]; char ftype[UF_UGMGR_FTYPE_SIZE+1]; char fname[UF_UGMGR_FNAME_SIZE+1]; if (UF_UGMGR_decode_part_filename((char *)old_name, no,rev,ftype,fname) != 0) return 5; sprintf(new_name,"%s_%s.prt",no,rev); return 0; } else /* import */ { int file_type = 2; char simple_name[31]; if (uc4574(old_name,file_type,simple_name) != 0) return 5; sprintf(new_name,"@DB/%s/A",simple_name); return 0; } } /****************************************************************** *********** * ufsta is a user exit added for the User Function Custom Application * project. This user exit is activated when the environment variable * USER_STARTUP is defined. USER_STARTUP must point to the path of the user * function that you want to execute, and this user function program must * have the ufsta entry. * * For example: export USER_STARTUP=/ui1/ui_v104/ufun_test/ufd_ugmgr_set_clone_auto_trans. hpp * ******************************************************************* **********/ void ufsta(char *param, int *retcod, int param_len) { UF_initialize(); UF_UGMGR_set_clone_auto_trans(translate_name); UF_terminate(); }