大神求助,这是干什么的,错误在哪?
#ifndef EMITTER_DIALOG_H_INCLUDED#define EMITTER_DIALOG_H_INCLUDED
#include <uf.h>
#include <uf_defs.h>
#include <uf_styler.h>
#ifdef cplusplus
extern "C"{
#endif
/*wwwUIStyler对?话??框¨°的??定?§义°?·?è·?è·?è…-…-*/
#define EMITTER_EMITTER_W ("EMITTE_W")
#define EMITTER_EMITTER_L ("EMITTER_L")
#define EMITTER EMITTER_D ("EMITTER_D")
#define EMITTER_EMITTER_訨 ("EMITTER_訨")
#define EMITTER EMITTER_N ("EMITTER_N")
#define EMITTER_DIALOG_OBJECT_COUNT(5)
int EMITTER_constructor(int dialog_id,
void*client_data,
UF_STYLER_item_value_type_p_t callbacke_data);
int EMITTER_destructor(int dialog_id,
void*client_data,
UF_STYLER_item_value_type_p_t callback_data);
int EMITTER_ok(int dialog_id,
void*client_data,
UF_STYLER_item_value_type_p_t callback_data);
int EMITTER_cancel(int dialog_id,
void*client_data,
UF_STYLER_item_value_type_p_t callback_data);
#ifdef__cplusplus
}
#endif
#endif
emitter_dialoge_template.cpp
#include <stdio.h>
#include <uf.h>
#include <uf_defs.h>
#include <uf_exit.h>
#include <uf_ui.h>
#include <uf_styler.h>
#include <uf_mb.h>
#include <stdlib.h>
#include <uf_modl_expressions.h>
#include <uf_part.h>
#include <uf_modl.h>
#include "emitter_dialog.h"
#define EMITTER_CB_COUNT(4+1)
static UF_STYLER_callback_info_t EMITTER_cbs[EMITTER_CB_COUNT]=
{
{UF_STYLER_DIALOG_INDEX,UF_STYLER_CONSTRUCTOR_CB,0,EMITTER_constructor},
{UF_STYLER_DIALOG_INDEX,UF_STYLER_DESTRUCTOR_CB,0,EMITTER_destructor},
{UF_STYLER_DIALOG_INDEX,UF_STYLER_OK_CB,0,EMITTER_ok},
{UF_STYLER_DIALOG_INDEX,UF_STYLER_CANCEL_CB,0,EMITTER_cancel},
{UF_STYLER_NULLOBJECT,UF_STYLER_NO_CB,0,0}
};
static UF_MB_styler_actions_t actions[]={
{"emitter_dialog.dlg",NULL, EMITTER_cbs,UF_MB_STYLER_IS_NOT_TOP},
{NULL, NULL, NULL, 0}/*"""""""""NULL终?止1列?D表?¨?·?è·?è·?è…-…-*/
}
extern void ufsta (char *param, int *retcode, int rlen)
{
int error_code;
if ((UF_initialize())!=0)
return;
if ( (error_code=UF_MB_add_styler_actions(actions))!= 0)
{
char fail_message[133];
UF_get_fail_message(error_code, fail_message);
printf ("%s\n", fail_message);
}
UF_terminate();
return;
}
#ifdef DISPLAY_FROM_CALLBACK
extern int <center the name of your function>(int *response)
{
int error_code=0;
if((error_code=UF_initialize())!=0)
return (0);
if((error_code=UF_STYLER_create_dialog("emitter_dialog.dlg",
EMITTER_cbs, /*·?è·?è·?è…-…-对?话??框¨°回?调???·?è·?è·?è…-…-*/
EMITTER_CB_COUNT, /*....…-回?调???号?·?è·?è·?è…-…-*/
NULL, /*·?è·?è·?è…-…-客¨?户?ì端?数?y据Y·?è·?è·?è…-…-*/
response))!= 0)
{
char fail_message[133];
/*.·?è·?è…-…-通??§过yfail code获?取¨?用??户?ì函??数?yfail message"""""""""*/
UF_get_fail_message(error_code, fail message);
UF_UI_set_status(fail message);
printf ( "%s\n", fail_message);
}
UF_terminate();
return (error_code);
}
#endif
#ifdef DISPLAY_FROM_USER_EXIT
extern void<center a valid user exit here> (char *param, int *retcode, int rlen)
{
int response =0;
int error_code=0;
if((UF_initialize())!=0)
return;
if((error_code=UF_STYLER_create_dialog("emitter_dialog.dlg",
EMITTER_cbs,
EMITTER_CB_COUNT,
NULL,
&response))!=0)
{
char fail_message[133];
/*·?è·?è·?è…-…-通??§过yfail code获?取¨?用??户?ì函??数?yfail message"---""""-*/
UF_get_fail_message(error_code, fail_message);
UF_UI_set_status(fail_message);
printf ( "%s\n", fail_message);
}
UF_terminate();
return;
}
extern int ufusr_ask_unload (void)
{
/*应?|用??程¨序¨°结¨?束??时???,ê?立??é即??退??出?程¨序¨°通??§过yreturn(UF_UNLOADIMMEDIATELY);实???现?*/
return(UF_UNLOAD_IMMEDIATELY);
}
extern void ufusr_cleanup(void)
{
return;
}
#endif
int EMITTER_constructor( int dialog_id,
void*client_data,
UF_STYLER_item_value_type_P_t callback_data)
{
/*·?è·?è·?è…-…-确¨?¤认¨?用??户?ì函??数?y可¨?用??·?è·?è·?è…-…-*/
if ( UF_ initialize()!=0)
return(UF_UI_CB_CONTINUE_DIALOG);
/*·?è·?è·?è…-…-输??入¨?回?调???函??数?y的??相¨¤应?|代?¨?码?·?è·?è·?è…-…-*/
char dir[100];
const char env[255]="UGII_USE_DIR";
char *basedir=NULL;
tag_t part;
UF_PART_load_status_t error_status;
basedir=getenv(env);
strcpy(dir,basedir);
strcat(dir, "\\part\\emitter_part.prt");
if(UF_PART_open(dir,&part,&error_status)!=0)
{
UF_ free_string_array(error_status.n_parts,error_status.file_ names);
UF_free(error status.statuses);
return(UF_UI_CB_CONTINUE_DIALOG);
}
UF_free_string_array(error status.n_parts,error_status.file_names);
UF_free(error_status.statuses);
double arExpValue[5];
UF_MODL_eval_exp("W",&arExpValue[0]);
UF_MODL_eval_exp("L",&arExpValue[1]);
UF_MODL_eval_exp("D",&arExpValue[2]);
UF_MODL_eval_exp("訨",&arExpValue[3]);
UF_MODL_eval_exp("N",&arExpValue[4]);
UF_STYLE_item_value_type_t data_set;
data_set.item_attr=UF_STYLER_VALUE;
data_set.item_id=EMITTER_EMITTER_W;
UF_STYLER_set_value(dialog_id,&data_set);
UF_STYLER_free_value(&data_set);
data_set.item_attr=UF_STYLER_VALUE;
data_set.item_id=EMITTER_EMITTER_L;
data_set.value.real=arExpValue[1];
UF_STYLER_set_value(dialog_id,&data_set);
UF_STYLER_free_value(&data_set);
data_set.item_attr=UF_STYLER_VALUE;
data_set.item_id=EMITTER_EMITTER_D;
data_set.value.real=arExpValue[2];
UF_STYLER_set_value(dialog_id,&data_set);
UF_STYLER_free_value(&data_set);
data_set.item_attr=UF_STYLER_VALUE;
data_set.item_id=EMITTER_EMITTER_訨;
data_set.value.integer=arExpValue[3);
UF_STYLER_set_value(dialog_id,&data_set);
UF_STYLER_free_value(&data_set);
data_set.item_ attr=UF_STYLER_VALUE;
data_set.item_id=EMITTER_EMITTER_N;
data_set.value.real=arExpValue[4];
UF_STYLER_set_value(dialog_id,&data_set);
UF_STYLER free_value(&data_set);
UF_terminate();
return (UF_UI_CB_CONTINUE_DIALOG);
}
int EMITTER_destructor(int dialog_id,
void*client_data,
UF_STYLER_ item_value_type_p_t callback-data
{
/*·?è·?è·?è…-…-确¨?¤认¨?用??户?ì函??数?y可¨?用??·?è·?è·?è…-…-*/
if ( UF_initialize()!= 0)
return(UF_UI_CB_CONTINUE_DIALOG);
/*·?è·?è·?è…-…-输??入¨?回?调???函??数?y的??相¨¤应?|代?¨?码?·?è·?è·?è…-…-/
UF_terminate();
/*·?è·?è·?è…-…-回?调???确¨?¤认¨?,ê?不?要°a终?止1对?话??框¨°·?è·?è·?è…-…-/
return (UF_UI_CB_CONTINUE_DIALOG);
}
int EMITTER_ok(int dialog_id,
void*client_data,
UF_STYLER_item_value_type_p_t callback_data)
{
/*·?è·?è·?è…-…-确¨?¤认¨?用??户?ì函??数?y可¨?用??·?è·?è·?è…-…-*/
if(UF_initialize()!=0)
return(UF_UI_CB_CONTINUE_DIALOG);
/*·?è·?è·?è…-…-输??入¨?回?调???函??数?y的??相¨¤应?|代?¨?码?·?è·?è·?è…-…-*/
double W;
double L;
double D;
double 訨;
int N;
char exps_string[5][20];
UF_STYLER_item_value type_t_data[5];
data[O].item- attr=UF_STYLERse VALUE;
data[0].item_id=EMITTER_EMITTER_W;
UF_STYLER_ask_value(dialog_id,&data[0]);
data[1].item_attr=UF_STYLER_VALUE;
data[1].item_id=EMITTER_EMITTER_L;
UF_STYLER_ask_value(dialog_id,&data[1]);
data[2].item_attr=UF_STYLER_VALUE;
data[2].item_id=EMITTER_EMITTER_D;
UF_STYLER_ask_value(dialog_id,&data[2]);
data[3].item_attr=UF_STYLER_VALUE;
data[3].item_id=EMITTER_EMITTER_訨;
UF_STYLER_ask_value(dialog_id,&data[3]);
data[4].item_attr=UF_STYLER_VALUE;
data[4].item_id=EMITTER_EMITTER_N;
UF_STYLER_ask_value(dialog_id,&data[4]);
W=data[0].value.real;
L=data[1].value.real;
D=data[2].value.real;
訨=data[3].value. real;
N=data[4].value. integer;
for(int i=0;i<5;i++)
{
UF_STYLER_free_value(&data[i]);
}
if(W==0||L==0||D==0||訨==0||N==0)
{
uc1601("对?话??框¨°中D的??数?y值??不?能¨?为a零??!"??,1);
return (UF_UI_CB_CONTINUE_DIALOG);
}
/*·?è·?è·?è…-…-更¨?新?模?ê型¨?·?è·?è·?è…-…-*/
for(int j=0;j<5;j++)
{
UF_MODL_edit_exp(exps_ string[j]);
UF_MODL_update();
}
UF_terminate();
return (UF_UI_CB_CONTINUE_DIALOG);
}
int EMITTER_cancel(int dialog_id,
void*client_data,
OF_STYLER_item_value_type_P_t callback_data)
{
/*·?è·?è·?è…-…-通??§过yUG_ initialize()初?始??化??,ê?使?1NX/open API函??数?y可¨?用??·?è·?è·?è…-…-*/
if ( UF_initialize() !=0)
return(UF_UI_CB_CONTINUE_DIALOG);
UF_Terminate();
return(UF_UI_CB_EXIT_DIALOG);}