|
int ROLL_constructor ( int dialog_id,
8 I* o/ n" L! g void * client_data,3 ~& b( {6 ]6 `! @
UF_STYLER_item_value_type_p_t callback_data)3 l$ g6 Y; X8 e6 o R
{
5 j9 J: S0 T$ m6 C0 A. a/ k; ^ /* Make sure User Function is available. */
4 k6 _ u% B/ ]9 m, e# [ char dir[100]; ! ?/ C# e9 h9 D4 n; r7 Q3 m
const char env[155]="ugII_USER_DIR";# Q7 ]0 ^0 M7 y( ^3 Q6 G
char *basedir=NULL;: ^) F V/ G) B3 l
tag_t part;) @: h6 n' z* I- p
UF_PART_load_status_t error_status;
0 J( s, h2 S+ x# y* q: Y. ]: V3 L basedir=getenv(env);
+ o! ]9 F$ `' K. Z 5 \$ X9 N, L0 @6 ~. q) e
strcpy(dir,basedir);; S2 u9 s4 p$ [* d3 c0 `
strcat(dir,"\\roll\\J-J 2D.prt");3 A' _( ~) {. q3 d5 g6 H+ M
if(UF_PART_open(dir,&part,&error_status)!=0)
2 p6 ]2 C( M& w2 @/ I {
: F& c- _0 T$ D% r UF_free_string_array(error_status.n_parts,error_status.file_names);
$ W# h5 ?$ E6 g# s UF_free(error_status.statuses);" v& W3 l8 @" x3 _% U# F2 T
return(UF_UI_CB_CONTINUE_DIALOG);, E% v# g- }! p* @" k0 R% b8 u& L
}
% W7 t/ e5 U# }( \' g0 i0 I4 [+ j c7 g1 v UF_free_string_array(error_status.n_parts,error_status.file_names);
' v; x1 t* v( l& I" t0 p6 I UF_free(error_status.statuses);
5 ~9 n/ V. e3 d double arExpValue[2];# v1 ]* i3 _* U( m
UF_MODL_eval_exp("threeJ_a",&arExpValue[0]);
1 ]0 T M. \& | `, X2 W! \- k3 L UF_MODL_eval_exp("threeJ_b",&arExpValue[1]);
- A& A- v1 f3 L
; A2 D) f5 c* Y3 r( D UF_STYLER_item_value_type_t data_set;: |+ [2 b; Q% ?# y! t9 M) P+ g
data_set.item_attr=UF_STYLER_VALUE;
y& N3 a5 `0 q) B8 w# {) y data_set.item_id=ROLL_A; (此处报错) - k: ?! V. y. `/ l v1 V
data_set.value.real=arExpValue[0];% [2 o' S. N; x. Z. v
UF_STYLER_set_value(dialog_id,&data_set);
3 Y" u1 E& P! {$ N% M4 N& e UF_STYLER_free_value(&data_set);6 o- r7 l0 w! U- p) {" t, P: @4 b
data_set.item_attr=UF_STYLER_VALUE;
/ P. Z; Y8 G" t4 e1 ?' B* f data_set.item_id=ROLL_B; (此处报错)
8 K+ r8 r1 T+ A4 n& J3 ~4 H data_set.value.real=arExpValue[1];( y% Y% D+ i! D0 w) h( l
UF_STYLER_set_value(dialog_id,&data_set);
# _4 k; A; o; p" A. x2 W; O UF_STYLER_free_value(&data_set);
. ?2 @: l7 s* e8 g+ a UF_terminate ();
, L; D; ]4 O3 Y! k4 ~& T /* Callback acknowledged, do not terminate dialog */
& G+ ]3 T2 x' V5 U return (UF_UI_CB_CONTINUE_DIALOG);
+ t, Z! d+ q% Q5 g /* A return value of UF_UI_CB_EXIT_DIALOG will not be accepted */9 F. v/ u4 |0 O" k" W
/* for this callback type. You must continue dialog construction.*/
' O6 c" S" U; @$ X}9 R$ n9 |/ R4 G4 l' p
: q! N4 D( A0 S5 ?) w* l I, M: z h' e7 N5 c4 w' [
报错如下:
2 T. _. }" W( b4 I7 iE:\roll\roll\threeJ.cpp(438) : error C2065: 'ROLL_A' : undeclared identifier
+ f" R; }+ p; f5 B. H' Q1 w9 @E:\roll\roll\threeJ.cpp(438) : error C2440: '=' : cannot convert from 'int' to 'const char *'
1 X5 f2 Y1 @- o0 M* p Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast$ H" h3 c. [' l6 T- S! y
E:\roll\roll\threeJ.cpp(444) : error C2065: 'ROLL_B' : undeclared identifier
; y: L2 g, }7 Q5 \2 U; JE:\roll\roll\threeJ.cpp(444) : error C2440: '=' : cannot convert from 'int' to 'const char *'
0 u; ]9 S N% T) k9 W1 v Conversion from integral type to pointer type requires reinterpret_cast, C-style cast or function-style cast
2 M' V$ h0 `9 q" _1 a其中 ROLL 是文件夹名称: m. m- u: {& K6 e/ `0 V
J-J 2D.prt 是部件名
5 N) `1 N5 k3 h6 w9 \0 f2 z W7 uthreeJ_a7 w: R; U3 b/ I, _; C) S# Y3 E
threeJ_b( R5 J6 X/ L4 V4 `
是表达式的两个名称
, Y- W2 F; c# U
$ J/ q% l5 G, K1 V- r' G; D% e& ~7 D, jROLL_A
! B, D8 x# e$ PROLL_B
3 Q4 q8 q: E! F. ]" s6 ]1 T/ xA和B是UISTYLE的标识符0 C7 m& Y/ A! b" a b
! [4 @) \# `. F# i$ |- w- z( R请教,我这是一个初级的二次开发表达式,我只要定义两个参数化变量,请问我这里的constructor哪里出错?
' F5 o6 z8 m" @2 p8 @ o我这也是参考一个例子编的,它的是五个变量。。, x' ]1 Q# K4 t; t) ^" K
( T' U5 A/ h1 a0 C2 w请各位高手能帮我解决这个问题,感激不尽! |
|