samfkkkk 发表于 2012-4-5 14:13
7 P+ r7 v& V1 t2 R' G$ i: V6 S4 F你好歹得把你的源代码放上来才能看你到底错在哪里了
. Y& d/ q* X6 E2 } H9 l9 e2 `哦,多谢高手关注,我贴上代码求指导!!( z& O- H- l; r, R- ^
, G8 g5 m/ [$ Q9 z+ w
#include <stdio.h>) T9 K4 U( Y& |8 B. u
#include <uf.h>* y) C2 o) E+ ^, G
#include <uf_ui.h>
( T: w, s1 H K% y5 x#include <uf_modl.h>
1 ?- E/ v3 P v% I7 y7 R# ^#define ptnum 5. _: I" O' o& J
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
6 J7 _4 ~( J) n/ K% w; c+ [4 W3 r% e! B+ g8 D# G" D: L
static int report_error( char *file, int line, char *call, int irc)6 l; U& j1 r" q" b( \
{- j6 `# n( ]1 V- j2 e7 ?
if (irc)& b1 E7 l1 K9 q
{2 s q) R: j! T. q* f$ D7 p- I3 ~
char err[133],: }" h! u1 R; w: a4 x
msg[133]; t, U' j' k) M9 X
9 N6 h& i( e: e9 t
sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",* Y: S4 i& J1 @
irc, line, file);
/ m2 h" M y7 _$ ^! x UF_get_fail_message(irc, err);5 V7 C, n5 ^) \" T, U3 }/ Q2 D
8 \8 J# z) `# c) F" q. | ] UF_print_syslog(msg, FALSE);
% J0 j9 }/ i3 S$ k4 b UF_print_syslog(err, FALSE);: }5 H5 m' F( h) q/ |8 I
UF_print_syslog("\n", FALSE);
; T4 J" D4 r. R" r, ~% N. r UF_print_syslog(call, FALSE);' o8 b# r8 p7 X8 s+ z
UF_print_syslog(";\n", FALSE);( y2 c$ T1 \. n3 i8 A* [- p! h" a
' v% y2 y9 O; }% c7 C if (!UF_UI_open_listing_window())
% p1 ^# I( f0 E2 y- C4 [2 y {( A- u7 | {$ z
UF_UI_write_listing_window(msg);# P% E, `: `$ q" f, Q, ^% E6 ^$ p* z; q
UF_UI_write_listing_window(err); x! m) u4 V" P. s% t P
UF_UI_write_listing_window("\n");3 f: V; h" M' v6 c6 Q' y. t. {; a
UF_UI_write_listing_window(call); q. g; W' a- E1 X
UF_UI_write_listing_window(";\n");' l/ k7 O {$ Y; X
}! E3 w: Y j% b* w( [
}
4 O0 F0 e! @- L' s& W K) W4 M" k, O: t4 a
return(irc);( p0 T8 k& {3 u( D. _8 y7 c( p: f
}
: V" c) `5 q' B2 P( n' b% u- {9 c5 R% c0 f
) B- ]' W. i9 g% @) Istatic void do_creat_spline()$ ^2 x! K; X& C
{% J3 E/ ?3 V0 B
SPLINE_FIT_p_t spdata;
9 l9 ]" U( j, [( Y6 x$ V$ L! w double sp1,7 L7 Q Q: ?9 Y: u
pt[3*ptnum]={1.1000, 0.5320, 2.0000,
( [# B3 |6 J3 E6 J! `4 m1 I& q 1.5240, 0.6789, 2.3000,, K) R% ?4 u, C
2.0000, 0.9000, 3.5956,9 B0 R4 ~6 T! }0 X
2.3456, 1.3456, 3.7890,
4 M( ]! l1 Z s' n O) B 3.1000, 2.4567, 3.3214};& f9 `% w& C9 `% _
int poit,i;
$ }8 M7 |! J2 s. v2 Y$ a2 G: M tag_p_t curve_id;
# \5 S- O# s, `* p& F* a, D/ U spdata->degree=3;
$ t+ V# w0 l: h* P spdata->num_of_points=ptnum;4 u0 S) h1 C: \( \# v( U* f
spdata->num_of_segments=1;4 O5 a. V* q1 C! l, L
for (i=0;i<ptnum;i++)
0 `- [1 }& K3 N+ |* `- s) l. ]+ } {
0 m$ N/ h* ?( g+ y8 p/ @ spdata.points[0]=pt;
( c8 q" r9 K4 W% R spdata.points[1]=pt[i+1];
' ?; T2 B$ I) j spdata.points[2]=pt[i+2];
7 m8 x- w& I# [0 L u }
# e' ^( v! v) ?) d UF_CALL(UF_MODL_create_fitted_spline(spdata,&sp1,&poit,curve_id));1 U/ T+ H6 b- G3 G. @) {, J2 Z
}
: h* k; Q6 V5 ?; v! g* e& m( @1 o, d0 g1 S
extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
1 J; ?) J1 a! _. K$ \" y" P6 V{- i: c: W0 N6 J
if( UF_CALL(UF_initialize()) ) , b* O8 l+ S" p/ W: g3 ]
{
+ }, F4 \& K2 \3 y# o return;/ _8 }, ]. I, V9 C
}
! Z) E6 I, }9 l0 I, Z c do_creat_spline();
. C# \# M$ m: C# p$ m0 g, [, G UF_CALL(UF_terminate());! R$ s2 a: N i
}
+ R2 }- v& E) ^/ |" t0 s2 J* r7 F4 P9 ? b$ v" t+ Q6 Y; b
3 u- [. c9 f9 Y6 [- ?8 G
extern int ufusr_ask_unload( void )8 e4 X* K# t3 \/ ^
{- m! E; e# j, T; p" V: J% q, |2 T
return( UF_UNLOAD_UG_TERMINATE );
1 x# Y% d5 ^% u' r}+ Z0 }3 R+ K; p" n
8 S1 I/ a2 l1 h4 @( d
|