samfkkkk 发表于 2012-4-5 14:13 
3 r# T, O+ U! ~$ ]: S5 f+ K你好歹得把你的源代码放上来才能看你到底错在哪里了 ( M& V; p8 a6 z* I- c" m# ~
哦,多谢高手关注,我贴上代码求指导!!
9 A2 s3 q: ^4 G4 q( x" k; A" G* b3 y( \! y1 x* m% F5 k3 u8 O6 x) D
#include <stdio.h>; q6 K3 c+ F& H* A: Z: X. c& v
#include <uf.h>
+ q3 p5 C3 ?6 T& e0 b6 x#include <uf_ui.h>
' J9 p. M# ? h ~' T#include <uf_modl.h>
' L9 r6 K p/ F' o9 z# Q#define ptnum 5
0 c! _. j& ^7 w/ i0 z/ k# R#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))& D& j/ V1 y5 T& f: _ @
: |% D# h6 j/ t) B9 h2 d' S
static int report_error( char *file, int line, char *call, int irc)
' E; v2 O2 `0 j' W: B+ f{0 }; @; I/ \: u% t1 o2 O- T
if (irc)# P8 [8 A5 [3 [+ w
{0 `: U. g4 o' T l5 f: N
char err[133],$ |7 M. @& S- C$ g# c$ G- ?
msg[133];
% p7 ^) H( H5 k3 Z: Y6 A8 h/ j* Z# I4 k% k
sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
2 ]; h$ n( r: k9 {6 W$ s9 ]& m irc, line, file);
% y8 @+ q% p& C! u, w1 T UF_get_fail_message(irc, err);4 F, j# \5 v7 s' I! _; K% }
$ Y) G1 e' G4 X' I& f7 e. U
UF_print_syslog(msg, FALSE);
. C* s( s9 G. v. _6 m4 |3 w5 T1 N, S UF_print_syslog(err, FALSE);
+ Z5 i' X* k; ?. g UF_print_syslog("\n", FALSE);; V; D e: S( [! o! j/ ?
UF_print_syslog(call, FALSE);
# c7 [! |6 ]. b9 n. d UF_print_syslog(";\n", FALSE);8 p! H/ Z$ C; E. r* q: V
) ^* F3 y: C6 K1 ]6 a if (!UF_UI_open_listing_window())
& _0 s4 R& j: l, {6 d {9 ?8 m- V W4 d7 F' A2 K
UF_UI_write_listing_window(msg);9 J2 T* c0 p' k1 S( P b
UF_UI_write_listing_window(err);
- r' x- V7 ~0 m8 E/ q- z; Z& {3 N- {5 h UF_UI_write_listing_window("\n");) T x4 ~5 ?1 O. q& \/ n
UF_UI_write_listing_window(call);
4 y5 a8 N5 E" i0 @ x8 Y2 Z9 U UF_UI_write_listing_window(";\n");
" q" A4 ~, D! G o5 c }
, H* }8 a% N O3 [$ O }+ c# A3 W( G8 T- b
2 c# |) {3 D2 t* S1 ~ return(irc);
8 A& q' ~) M. L" w# ?0 }1 f}
6 K' }% c: v2 m% _+ r! r8 g
$ U; Y+ W w' ?; T: {/ A2 _$ E1 G8 A, B3 ~3 C: c% U( A
static void do_creat_spline()
/ G# U2 [' p% F4 ]' R" F{
V/ y: t' T. m& N# B5 }8 a8 T SPLINE_FIT_p_t spdata;
# Z# B6 `' {( K* h+ y double sp1,
4 h; ~. d" m2 \+ d7 u7 ?5 Q. C- x+ b: i pt[3*ptnum]={1.1000, 0.5320, 2.0000,$ {/ p& ~4 q) f; m+ [) {
1.5240, 0.6789, 2.3000,
2 {, @, ]) S) }( g$ c 2.0000, 0.9000, 3.5956,. a4 c1 _' [9 x3 O t% s
2.3456, 1.3456, 3.7890,5 f+ O \- f6 p/ k
3.1000, 2.4567, 3.3214};9 U& j" _; f1 ^* L8 g$ v# z
int poit,i;) N S4 P# L, G
tag_p_t curve_id;
* M6 u5 A. M/ ^: t U! K9 @4 Q spdata->degree=3;3 y+ }8 v3 O, M
spdata->num_of_points=ptnum;
" ]+ w& u8 B2 a# _* h spdata->num_of_segments=1;
1 o' N: y( x3 s2 N9 G for (i=0;i<ptnum;i++)
; w A- y/ Q$ A/ ^* g- b3 | {# B8 Z1 x' ^ q+ Z6 J2 Z2 o
spdata.points[0]=pt;! Y6 V; [6 P F% [( E
spdata.points[1]=pt[i+1];
$ Q( @4 r- t1 Q spdata.points[2]=pt[i+2];. G3 e* n) P( x/ E- P6 @
}
+ ~, N* T9 z. g* z, R+ M UF_CALL(UF_MODL_create_fitted_spline(spdata,&sp1,&poit,curve_id));
& n$ n7 K4 n" g5 Z}' e2 L8 w; h( s
. |) u( K( n% R, \; b8 p' Jextern DllExport void ufusr( char *parm, int *returnCode, int rlen )
1 `, v8 B! G- _- M; Z0 c{ i7 E& U4 ^6 v" d. f
if( UF_CALL(UF_initialize()) )
. v& O2 e3 n: s! N* `( I$ O {: Z& ?) g5 y3 E6 ^: {7 @
return;# p1 L0 z# `. _7 r
}
' U! \* d/ q! M do_creat_spline();
x T% ^* J0 U5 x UF_CALL(UF_terminate());
9 z: i! u l U( ] c% f}$ [% T! \/ U# C- D7 K$ f; o: w
) ?' q/ c4 `+ W% f3 K4 d# V
- d) X% W0 G# @& M0 e6 vextern int ufusr_ask_unload( void )
7 n3 F8 w; w k S& _. X( h{
1 v# j ?5 U6 D4 }/ G( A, Y8 `, }2 Y return( UF_UNLOAD_UG_TERMINATE );$ f- Y0 j) N% V9 S: o' ^
}
/ L* ?: H$ P+ A5 X5 b- K6 a! P+ ^( i* N" H
|