|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
+ q) [( i$ k Y/ R& N7 b
{) q& @' f; G9 J. H. U1 U
0 b6 ^- w" ^' ?. TNX二次开发源码分享:封装一个函数--将ufun的链表转化成数组3 c m$ e$ m w# J
/ B& f# ?, N4 `' [
; t r, m* ?& z( Estatic int allocate_memory(unsigned int nbytes, void **where)) H& q8 f C" y: I
{. d2 E$ a5 s5 L
int2 g3 @4 [. a$ B5 e3 v8 V# V5 n# P' j
resp;3 C/ n4 a! s' f: n
2 x7 w/ w1 u s *where = UF_allocate_memory(nbytes, &resp);
' d |* t2 R2 x" b, T$ F; B3 I7 ~" X- I0 g
return resp;
' w6 G) \# y% {+ L}
' X; G0 i5 v2 u0 E% u v- r$ s8 x9 W) S) s
static int make_an_array(uf_list_p_t *object_list, tag_t **objects)# K- E% y# k y, ~( `( S7 B$ J
{; c" L/ ~: r1 I6 x
int
/ _0 z$ E7 S7 t( I1 Y _* ~9 S ii,
o1 L4 |- v: G8 x& | n;
8 y. w7 P$ J8 G+ S6 j uf_list_p_t
+ A0 h# m- E; F; J$ d" E' c. X temp;3 d8 L4 E2 R5 j, i
# d7 E! u, F) f' R
UF_CALL(UF_MODL_ask_list_count(*object_list, &n));& h1 G1 f) L* s" F8 l& h1 m
F, s$ H8 z- C( _+ K7 M UF_CALL(allocate_memory(n * sizeof(tag_t), (void **)objects));5 h2 y$ W- R# g* g1 Z* G/ C0 W
4 R- v# v |4 f5 ^ A/ F for (ii = 0, temp = *object_list; ii < n; temp = temp->next, ii++). {1 O, G1 g& g4 X
(*objects)[ii] = temp->eid;
8 O/ R3 g7 `& W0 s: x' ~
9 f- G9 @# N2 Z9 P UF_CALL(UF_MODL_delete_list(object_list));/ X. n. D1 R8 w$ ~/ }
3 Y. _) b/ o5 K F
return n;
" U7 ]/ f. q- h3 E' w1 q% t}9 b3 _ {( H( l5 V8 h
6 [7 F# H6 x5 ^
! G" w* e6 k% G$ O! m- N% |* ^ |
|