/****************************************************************************** Copyright (c) 1999 Unigraphics Solutions, Inc. Unpublished - All Rights Reserved *******************************************************************************/ /* The IMAN ITK program contains the function USER_invoke_pdm_server(). This function is used to obtain the date of creation or modification of the specified part, given the part number as input. The value of the input_code argument controls whether the date of creation, or the date of modification is returned (input_code=1 returns creation date, input_code=2 returns modification date). The return code output_code indicates whether an error occurred - output_code=0 if successful, output_code=0 for failure. */ #include #include #include #include #include #include #include #define CREATION_DATE 1 #define MODIFICATION_DATE 2 /* You may need to include the following prototype for the function USER_invoke_pdm_server() in your ITK program to prevent compiler errors. */ extern void USER_invoke_pdm_server(int input_code, char* input_string, int* output_code, char** output_string); extern void USER_invoke_pdm_server(int input_code, char* input_string, int* output_code, char** output_string) { tag_t item_tag; int itkfail; WSO_description_t description; char get_date[WSO_date_size_c+1]; *output_code = 0; itkfail = ITEM_find_item( input_string, &item_tag ); if ( itkfail != ITK_ok ) { printf( "Failed to find item %s\n", input_string ); *output_code = 1; } itkfail = WSOM_describe( item_tag, &description ); if ( itkfail != ITK_ok ) { printf( "Failed to get description of the item\n" ); *output_code = 1; } printf( "ITK USER_invoke_pdm_server() routine :\n" ); printf( "INPUT:\n" ); printf( "input_code : %d\n", input_code ); printf( "input_string : %s\n\n", input_string ); switch (input_code) { case CREATION_DATE: strcpy( get_date, description.date_created ); break; case MODIFICATION_DATE: strcpy( get_date, description.date_modified ); break; default: break; } *output_string = malloc( sizeof( get_date ) ); strcpy( *output_string, get_date ); printf( "OUTPUT:\n" ); printf("output_string : %s (%s)\n", *output_string, (input_code == 1) ? "CREATION DATE" : "MODIFICATION DATE"); printf( "output_code : %d\n", *output_code ); }