samfkkkk 发表于 2012-4-5 14:13
" [- k8 \7 F. P4 h9 |; M, f你好歹得把你的源代码放上来才能看你到底错在哪里了 % b1 ^' o4 i) z3 ^* V! I3 v
哦,多谢高手关注,我贴上代码求指导!!
2 i& d5 v- E: \+ R8 J/ a0 e( `0 `7 @. o1 x& Q
#include <stdio.h>
3 E0 s0 m+ _$ o( @+ S; A; j( j#include <uf.h>
5 v, m! y1 h$ j6 u#include <uf_ui.h>7 R: _3 O# ?% f0 P
#include <uf_modl.h>
8 }0 b% X. b' T8 G# W: g5 J#define ptnum 5% w* {4 j. J, w5 f2 c; d
#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
$ ]( _ e* a/ V/ s: r
: d! t a7 M: H9 N, nstatic int report_error( char *file, int line, char *call, int irc)
4 W& Z* L/ L- i% K4 O{+ `4 }1 g8 O7 @
if (irc)
. C% A; L9 a) y5 p# k4 b9 I6 ~3 q: | {
/ `. |) x* Y! g4 m char err[133],0 h2 z/ D& ?* o- q- F& h
msg[133];
( Z Z4 R! \9 k* |- ?# G9 q2 ]1 `% d: d" f
sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",& s$ h8 O& r! R. ~" S
irc, line, file);
2 ]) _7 P! u& G" p UF_get_fail_message(irc, err);
: G* o& v. O9 ^. E9 Z& M! u* a: B
c/ K. G0 O" d+ q% m UF_print_syslog(msg, FALSE);
3 l' m; v5 a- A UF_print_syslog(err, FALSE);
# x% J9 Y/ J1 u7 Y; U UF_print_syslog("\n", FALSE);
( m6 u0 w5 c$ c4 N2 e9 B UF_print_syslog(call, FALSE);* T, L8 q, \) b: u1 n/ q* H
UF_print_syslog(";\n", FALSE);
! ~& ?: E" D% Y" U2 q- P/ l8 A, g; ^! C/ L4 f: O ~" M8 @4 _
if (!UF_UI_open_listing_window())% U3 N" e: e0 U9 i! J
{
6 k: _# H2 s+ F UF_UI_write_listing_window(msg);
7 h* U h" R) e+ ~% H5 F UF_UI_write_listing_window(err);
% s7 T1 |" s: h2 J9 E UF_UI_write_listing_window("\n");
; p! r. e/ k7 M" n4 C& l UF_UI_write_listing_window(call);
5 G4 u/ t7 ~, Z m7 e6 b UF_UI_write_listing_window(";\n");
. _; k5 P# X' ?% h }3 M [8 d) `, ?$ C
}
& y, h0 ?* ~9 s5 y/ d' T" l h2 M# |* I* b# v7 H, S
return(irc);! y6 p# p7 R4 N0 y' W5 q- X; p9 T
}
* {' z0 ]. c+ w! Y% y* o- E1 [9 B E* J- m2 [: t3 A
: [! e# J# A. }! [. astatic void do_creat_spline() M8 f! k: } S3 X# |; n
{% I) {8 n( R$ g: U' X& l j3 L
SPLINE_FIT_p_t spdata;
) N$ T- Y! a& Q' a# C3 z4 @# w double sp1,
4 _6 |% Q0 v' _4 H5 k* e" b4 z' F pt[3*ptnum]={1.1000, 0.5320, 2.0000,
/ b6 n9 W8 X0 u6 _- h% K 1.5240, 0.6789, 2.3000,# i# K) K0 ]7 n9 ]* U
2.0000, 0.9000, 3.5956,' P8 C! c0 `" D5 d# \
2.3456, 1.3456, 3.7890,
3 e7 H, z' b2 e: j: t: j 3.1000, 2.4567, 3.3214};
) Z$ H/ \2 d4 g8 b1 R% T int poit,i;
2 A8 U& ^$ y+ c8 v' s2 Y7 ]3 a. C tag_p_t curve_id;3 ~# u- p2 { c7 t6 `
spdata->degree=3;
: |/ h! U$ T- x) s* g spdata->num_of_points=ptnum;) M2 N' {4 r/ }8 M+ ^
spdata->num_of_segments=1;
M& m3 F! X0 ~" H8 o for (i=0;i<ptnum;i++)
- z8 L4 q3 Y! `3 ? {) E& C9 p2 p6 }% W
spdata.points[0]=pt;
, z3 q8 G& L6 Z) Z spdata.points[1]=pt[i+1];
+ |9 X& d, s) |( u2 ] spdata.points[2]=pt[i+2];1 c6 |. a! m0 W
}
8 T. `9 N7 u2 q% @; |+ T3 P$ C UF_CALL(UF_MODL_create_fitted_spline(spdata,&sp1,&poit,curve_id));7 z; L2 O. N7 ^. p$ a
}
# ~4 q+ C1 {, p: w6 `' w) T- x, V3 m
X0 t' {; \* V! Nextern DllExport void ufusr( char *parm, int *returnCode, int rlen )
8 l1 o3 Q3 H4 d: S, W% I* F{
6 W$ o: Z. g. K% p. q if( UF_CALL(UF_initialize()) ) # N6 d; u# x* d& r4 H) `
{9 G7 d/ O& U- _+ g, B
return;1 D- H2 c, V) z
}
$ v5 V1 p, G/ c5 _/ {4 s x* l do_creat_spline();$ [5 X" w; M3 U7 [ c7 N) P( N' U1 k @
UF_CALL(UF_terminate());4 R) Q) d3 t& W4 h( A9 ~, X/ l
}/ l4 W' S1 m# H. Z" X; d Q& P
* l8 B+ D! l+ q) D9 o
" _5 _6 R5 a. X# z; i$ l* Sextern int ufusr_ask_unload( void ); j) e% a. }% z( G1 W+ w
{5 { M* b: ~# b/ L( Y7 `
return( UF_UNLOAD_UG_TERMINATE );) ?6 t, q" c# l# S
}- m4 n+ \2 ^! `3 F [2 q
8 s* F) M% t/ P, P. T% f9 D! Y
|