samfkkkk 发表于 2012-4-5 14:13 
+ L4 @7 Z6 F, Z: d你好歹得把你的源代码放上来才能看你到底错在哪里了
: W I/ i/ u( [# M( G哦,多谢高手关注,我贴上代码求指导!!# s' v2 `& }2 P0 t
$ Y6 x, w' _2 L2 e8 M2 z6 L
#include <stdio.h>
% D; _; K/ G, Q4 r#include <uf.h>" b( ~& F* y! e! K. G
#include <uf_ui.h>
. G- G) _( }: e& a1 i#include <uf_modl.h>
' n* p! }' E/ T4 I- v( R* c#define ptnum 52 \ E* d7 b0 p4 B4 W
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))# B+ k6 X( D/ Q
0 I' | e) A$ y! A) }* X+ ?
static int report_error( char *file, int line, char *call, int irc)
( _8 o8 d3 d8 K) B* j0 v5 b{" C( x7 c/ A7 y$ \8 ` z/ D' W6 D
if (irc), g/ Q& f; a { E' @
{! k+ O" W/ S* I" @( s& y6 F) r
char err[133],
8 w$ O# a, o& H: e" n) R+ q' O msg[133];7 h( D2 {1 K$ C q# G; Q+ v M
, v0 \. U9 M0 T sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
. Z& q- P$ P \ irc, line, file);" E; w" P' \: v7 i
UF_get_fail_message(irc, err);6 p7 @' O( K; n7 V
& b6 S0 p7 {' |0 }& t( U+ l4 M* R
UF_print_syslog(msg, FALSE);
6 y! K, I4 {4 ]% K1 X UF_print_syslog(err, FALSE);
1 s) K* I9 X" R UF_print_syslog("\n", FALSE);! g9 F- }$ R; {9 {; {
UF_print_syslog(call, FALSE);
. h0 C. I1 m8 i- z UF_print_syslog(";\n", FALSE);
; E: v7 h) \3 k l, v1 p: b2 s" x1 P- T1 f" M
if (!UF_UI_open_listing_window())% D. M7 m; M) ?5 P
{! |+ R/ A0 @7 z$ L0 [' ?3 |
UF_UI_write_listing_window(msg);
/ I3 C8 w7 V7 N: d2 q! R ~/ m7 n! f UF_UI_write_listing_window(err);# ~7 @2 ?9 N( e7 q/ E: [3 c
UF_UI_write_listing_window("\n");
9 I6 i- E, v F5 l- @& r UF_UI_write_listing_window(call);3 Y4 D# N/ m# d+ d$ D
UF_UI_write_listing_window(";\n");
. S1 B% Q. j- [. Q }
3 F+ ^1 A5 [9 ?2 M! | }
* ^2 ` M/ }1 e" ]/ e" ~6 g& }% S$ T' y. @9 d# y- p& k# p) d+ d3 {3 s
return(irc);2 w5 F" l& H' a2 H% t C& C
}
V: g- u/ R' X( d; u
: P W1 w+ y* S$ S+ C& o4 X2 a7 x+ L3 M3 L
static void do_creat_spline()& v+ K% J4 [" \% H) }4 d
{+ m3 }0 b7 N& f2 s; Q% y, M
SPLINE_FIT_p_t spdata;
) K% o' {' Q" ~8 p4 } double sp1,+ _& U" N+ `% r2 \
pt[3*ptnum]={1.1000, 0.5320, 2.0000,
g9 U& N9 v" _( ^1 W! A6 G& I/ ` 1.5240, 0.6789, 2.3000,/ x! C- }. |4 i. [
2.0000, 0.9000, 3.5956,
! F( c1 I8 x# B/ ~9 V, T 2.3456, 1.3456, 3.7890,
- Y D3 |6 U/ [: T+ R 3.1000, 2.4567, 3.3214};/ K! b( O7 U' u- M, W' p# s+ D- d
int poit,i;
# d$ R# H/ D Y' F tag_p_t curve_id;1 c r" q* r7 e
spdata->degree=3;
* z* K& E+ f9 d7 X- f# z spdata->num_of_points=ptnum;
' R7 \$ R% f) j/ X, S- ~ spdata->num_of_segments=1;
5 S/ E- W$ K' t3 O g for (i=0;i<ptnum;i++)
5 T5 n) N% g6 L6 q7 x9 C7 M {: e0 [" o; U; [- v4 s
spdata.points[0]=pt;
D2 Z- ?# [: a( O w6 @ spdata.points[1]=pt[i+1];$ r% Q3 |/ p: i0 p7 _- Q- D! }
spdata.points[2]=pt[i+2];1 L- n7 i( v( I& X) a% ?6 t
}* } V0 d3 u% _1 c$ N/ b# m
UF_CALL(UF_MODL_create_fitted_spline(spdata,&sp1,&poit,curve_id));3 W+ c$ i: ]+ Z* d4 t( \# n
}
7 O% [. A2 d1 {5 d7 [
6 N5 ]+ k6 s) f _extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
, n* a/ @3 \4 L2 m( ~% w6 R# x{
m3 P2 g5 z l t* s- ]" }2 } if( UF_CALL(UF_initialize()) ) 1 t: h7 n) e9 q; M* z( A& o$ o
{! Z! F- R" d, H# r$ D$ B* N5 i
return;
$ H8 T8 \$ H. c) g" A1 Q }
& N) p0 g0 L. J" x$ \ do_creat_spline();
: L3 h4 C& o, i. v4 N" Z0 o" E UF_CALL(UF_terminate());/ r+ A! q; H+ x# E
}1 h# ~* B G* {& b1 x( @# _
0 v! m8 D3 u) r7 k
' J( B" l8 n: t5 F6 x& Pextern int ufusr_ask_unload( void )
5 H6 I' L! K' m6 k8 }( }. F{
& F1 p$ W @' n3 ] return( UF_UNLOAD_UG_TERMINATE );7 K* q4 r2 H7 ?6 O; k& f
}0 O6 o7 o2 ?# d' @
+ `6 E! B' F& z1 e1 C3 u3 R7 y2 ?& Z0 v |