|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
! G' Q9 B+ `9 j2 p
" H; d( o! T, B8 D ^; p9 ~# P
9 ?( F ^$ y$ x6 {NX二次开发源码分享:封装一个函数--将ufun的链表转化成数组
* |8 c H# h" H7 Y% q9 j8 X; U; I# P7 [/ R% \. F' Z$ a5 m
( g+ ?, ]3 E: }: L' Mstatic int allocate_memory(unsigned int nbytes, void **where)
/ a8 ~+ [" }! h( Z0 N- ?{
C. s9 t$ m% p4 H5 b! E% y6 X( J& G* F int
9 g/ h. D: g1 z# J resp;
6 K- X2 \& s% o3 c* G9 n( l- y# N0 ~
*where = UF_allocate_memory(nbytes, &resp);* K3 ?5 p/ n& v4 K% G2 x
& `9 l g; y7 C
return resp;# R8 u' s- x- A" a
}) _8 N( b8 F! L; ~
, y/ r$ E* U* H q
static int make_an_array(uf_list_p_t *object_list, tag_t **objects), Q+ j \ k: q0 Z; O: J
{
3 y% p g+ A$ L: _+ m9 j int
* f" R2 h2 M7 ^4 z$ g1 h6 U5 b ii,
( q/ G8 R: U( c' q4 `: i+ g n;
e( q4 e4 g; v* S& P7 J1 m uf_list_p_t) V. F/ ~( q- R! l4 F. U6 Q
temp;
2 A5 {2 h2 {$ c! T; B$ U9 k' ^2 y; c2 ^4 T9 i# u! D B
UF_CALL(UF_MODL_ask_list_count(*object_list, &n));6 K9 {: g Q6 _0 N( l
6 {) z) u4 o \8 ] UF_CALL(allocate_memory(n * sizeof(tag_t), (void **)objects));
& C2 |; H6 y$ W
0 m+ v9 p) L, ` for (ii = 0, temp = *object_list; ii < n; temp = temp->next, ii++). A" ]4 a1 P# B
(*objects)[ii] = temp->eid;
3 ?9 W( ~/ S+ R+ q9 p' U, Q
; f4 |4 E# a6 Z5 E, I7 x UF_CALL(UF_MODL_delete_list(object_list));2 R9 R* ] T! Q
0 \) c* v+ p# h+ [; f/ h" t& n8 C return n;
: v1 {' v" p6 d$ Z; V& r& X! }}
# K" ?0 R B0 z0 N9 P3 L9 { h0 Y9 J* Z6 u& z: t9 m- ?
0 t8 M* ]8 R- c% s; m+ ]$ R* E: x
|
|