samfkkkk 发表于 2012-4-5 14:13 K7 ?$ D# G. L
你好歹得把你的源代码放上来才能看你到底错在哪里了
* g3 d+ M' Q+ T2 t( b哦,多谢高手关注,我贴上代码求指导!!! T+ Y; m9 K' o7 Q
( Y+ \+ E. t( _! R#include <stdio.h>
$ e& I$ Q: `+ l8 ], D, \#include <uf.h>
9 Z1 v: q, k: G) Z8 y#include <uf_ui.h>5 \8 |& E! ~! P9 V4 G4 L
#include <uf_modl.h>
5 Q7 i$ r* `' c& _$ G# T; T1 H#define ptnum 5
c2 M2 H4 n3 b0 s; U/ l9 O#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
* G$ b7 { j# E6 q( i/ w/ }$ r, P
. \$ ~: ` L, ?9 k' istatic int report_error( char *file, int line, char *call, int irc)7 h+ @2 @/ A- y
{
- W8 j% F+ \ ]8 ?9 o4 F6 o if (irc)
( d" n7 _. w& N6 R/ ` K {
, n# j8 L) J2 f7 |& ` p# n char err[133],
5 ^" X0 ~, \3 E# ]& l/ n msg[133];
+ [( i- R5 G, P
% y! Y1 d: r* F sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
% C) e% ?: r' Y! N irc, line, file);6 i$ I P- O4 ~0 _' f& P# `
UF_get_fail_message(irc, err);
! m: M _1 V, C* d5 }, P" J% P3 e0 _1 l, d
UF_print_syslog(msg, FALSE);( x; J; J% ^$ S: b7 R' j8 X
UF_print_syslog(err, FALSE);
. o% N1 _0 g- m0 X UF_print_syslog("\n", FALSE); T' P0 {2 l& }' L3 q+ | s
UF_print_syslog(call, FALSE);
1 W* A) y0 F# H. E9 O) e0 ] UF_print_syslog(";\n", FALSE);
- s( |* P; ~. L# X/ B: E. X) A8 \" U0 D8 K& A8 F
if (!UF_UI_open_listing_window())% `8 U4 [" C+ L& ^( s
{
( w, P# [6 s ^" k m: W UF_UI_write_listing_window(msg);
+ |& S3 f4 w9 q: q UF_UI_write_listing_window(err);
9 v" T2 F5 k$ ?' N8 a UF_UI_write_listing_window("\n");
) \3 W! `/ J# G/ t2 m: _ UF_UI_write_listing_window(call);8 n9 ^9 N; i7 ~, z _- u
UF_UI_write_listing_window(";\n");% E! ~% V) I+ a* _4 \' z, F
}7 ? w& y v* g" s+ |- v1 U( e
}5 Z0 J( F( l z% n$ ~* Z
- ^# k7 Q% _4 m" e return(irc);3 x: ]& [1 N' m# g
}
5 n' b" Z; {0 x0 n' I
( V+ W) W x6 @0 l$ w9 Z3 z4 z+ Z& p1 {! h3 _) m/ W, r3 O9 F
static void do_creat_spline(): R% @$ c5 u: t
{
) F: p3 W- i j2 g G; J- s SPLINE_FIT_p_t spdata;
: @7 G0 p9 M7 L4 ~: v' Q double sp1,
2 P- s% f" B W% c/ c pt[3*ptnum]={1.1000, 0.5320, 2.0000,- K4 P4 \8 G9 U0 u4 I; x
1.5240, 0.6789, 2.3000,
X4 b, N- R3 A8 A+ |, l 2.0000, 0.9000, 3.5956,, O2 W7 N" Y. n1 y, S
2.3456, 1.3456, 3.7890,) b3 ?4 j$ s" z1 Y- Q5 N$ ~5 G
3.1000, 2.4567, 3.3214};% \0 n% K g% k7 @& a% B. A
int poit,i;8 {# k, _8 e9 ~# ]
tag_p_t curve_id;8 Z* W( F5 P5 ?; g% K$ X8 K$ r
spdata->degree=3;
' ~6 @, y# d: K9 U) l; R spdata->num_of_points=ptnum;) a; i9 C5 j1 y9 e! r7 ?
spdata->num_of_segments=1;+ ~) X- K, p" q7 F* x2 W
for (i=0;i<ptnum;i++)
; k( E" C9 I4 m2 q {
6 }# K Y) z6 t. A5 @ spdata.points[0]=pt;
* h7 s4 l" C/ x( f3 \7 |) p/ w spdata.points[1]=pt[i+1];" n% o4 M2 E0 i \( G$ y+ B0 X- R
spdata.points[2]=pt[i+2];
0 H. M, O8 P) z# \* i/ D5 j }' d* Q6 z1 k. ~. u
UF_CALL(UF_MODL_create_fitted_spline(spdata,&sp1,&poit,curve_id));1 [# X3 a, J" {. C8 y6 |
}
1 m' i5 M* [; }! D Y R7 x* ^+ g
" u5 {0 [+ W7 g! P |( @extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
, }/ h: J: }7 U4 l3 J! m: [{
0 ~- R6 H' y$ N) c if( UF_CALL(UF_initialize()) ) 4 O$ m0 \$ \+ G, V, L9 C
{
3 o" [; m9 |9 O; t2 o return;0 B7 {& Z+ V0 O" Z
}6 p9 K" } j( T; `- |
do_creat_spline();
7 m4 W3 Y+ `; @& F8 D- w) J UF_CALL(UF_terminate());
9 m* T6 c$ T! _}% U' K' U/ `$ q0 H2 ?, K
' \6 @' N- w, I
! Y6 r7 d4 n. ]( q9 {9 C' E J+ Hextern int ufusr_ask_unload( void )0 X6 X/ y" {# |4 ~0 Z1 J
{
" U3 l ?/ g& z, {6 A9 S return( UF_UNLOAD_UG_TERMINATE );; P. s3 A: n3 i3 O
}
2 M& l+ O, ]6 q3 j' W8 {: g0 f' d5 s& t+ T. I
|