是的,我在学清华的书,加了几个头文件还是没有,代码如下,帮我分析分析,有38个错误和41个警告
/*****************************************************************************
**
** List.c
**
** Description:
** Contains Unigraphics entry points for the application.
**
*****************************************************************************/
/* Include files */
#include <stdio.h>
#include <uf.h>
#include <uf_ui.h>
#include <uf_defs.h>
#include <uf_object_types.h>
#include <uf_modl.h>
#include "List.h"
/*****************************************************************************
** Activation Methods
*****************************************************************************/
/* Unigraphics Startup
** This entry point activates the application at Unigraphics startup */
extern DllExport void ufsta( char *param, int *returnCode, int rlen )
{
/* Initialize the API environment */
int errorCode = UF_initialize();
if ( 0 == errorCode )
{
/* TODO: Add your application code here */
//创建参数 create parameters
tag_t new_exp;
UF_MODL_create_exp_tag("w=10", [$new_exp)]
/*get the parameters and export*/
char *string, *lhs_str, *rhs_str;
UF_MODL_ask_exp_tag_string (new_exp, [$string)]
UF_UI_open_listing_window();
UF_UI_write_listing_window("the new created parameter is:\n");
UF_UI_write_listing_window(string);
UF_UI_write_listing_window("\n");
//delete the parameter
UF_MODL_dissect_exp_string(string, [$lhs_str, &rhs_str, &new_exp)]
UF_MODL_delete_exp(lhs_str);
UF_free(string);
UF_free(lhs_str);
UF_free(rhs_str);
//create 2 rectangles
UF_FEATURE_SIGN sign = UF_NULLSIGN; //create a new rectangle
UF_FEATURE_SIGN sign1 = UF_POSITIVE; //create a rectangle that join with the rectangle created before
double block_orig[3] = {0.0, 0.0, 0.0};
double block_orig1[3] = {0.0, 0.0, 2.5};
char *block_len[3] = {"1", "2", "3"};
char *block_len1[3] = {"1", "1", "1"};
tag_t blk_obj;
tag_t blk1_obj;
UF_MODL_create_block1(sign, block_orig, block_len, [$blk_obj)]
UF_MODL_create_block1(sign1, block_orig1, block_len1, [$blk1_obj)]
uf_list_t *list;
// create the list
UF_MODL_create_list([$list)]
//put the rectangles into the list
UF_MODL_put_list_item(list,blk_obj);
UF_MODL_put_list_item(list,blk1_obj);
int list_count;
tag_t list_item;
UF_MODL_ask_list_count(list, [$list_count)]
for(int i=0; i<list_count;i++)
{
UF_MODL_ask_list_item(list, i, [$list_item)]
UF_DISP_set_highlight(list_item, 1);
}
//delete the blk_obj in the list
UF_MODL_delete_list_item([$list, blk_obj)]
//delete the rectangles in the list
UF_MODL_delete_feature(list);
UF_MODL_update();
//delete the list
UF_MODL_delete_list([$list)]
//delete the blk_obj
UF_OBJ_delete_object(blk_obj);
/* Terminate the API environment */
errorCode = UF_terminate();
}
/* Print out any error messages */
//PrintErrorMessage( errorCode );
}
/*****************************************************************************
** Utilities
*****************************************************************************/
/* Unload Handler
** This function specifies when to unload your application from Unigraphics.
** If your application registers a callback (from a MenuScript item or a
** User Defined Object for example), this function MUST return
** "UF_UNLOAD_UG_TERMINATE". */
extern int ufusr_ask_unload( void )
{
return( UF_UNLOAD_UG_TERMINATE );
}
/* PrintErrorMessage
**
** Prints error messages to standard error and the Unigraphics status
** line. */
static void PrintErrorMessage( int errorCode )
{
if ( 0 != errorCode )
{
/* Retrieve the associated error message */
char message[133];
UF_get_fail_message( errorCode, message );
/* Print out the message */
UF_UI_set_status( message );
fprintf( stderr, "%s\n", message );
}
} |