|
|
请使用QQ关联注册PLM之家,学习更多关于内容,更多精彩原创视频供你学习!
您需要 登录 才可以下载或查看,没有账号?注册
x
5 T d1 _( `0 c% Q& T) F9 E1 ^2 QNX二次开发源码分享:报告装配加载状态,设置装配加载
4 | ?9 Q+ ]: F" ]' ^) N( G k2 Q/ S5 `. g6 c) ? k
获取Load Options 并进行处理!- R1 K* _; O: Z1 V- Z
( I& r3 V1 A$ \8 m[mw_shl_code=c,true]#include <stdio.h>8 @7 J' `6 [, i
#include <string.h>
* s& ]; {1 g* r1 n( J: U% \ T#include <uf.h>% ]8 O, {& `$ ~" P: H8 u1 x/ E. H7 k
#include <uf_ui.h>8 o% c: N4 b9 C' Q8 j
#include <uf_assem.h>" F& S- M& C) I% m3 P a: H: o" @
+ b$ i4 z, i) v p2 i#include <stdarg.h>
3 [6 {) `, c' N2 q" `
" H& b: F) x. y0 Y2 l/ Tstatic void ECHO(char *format, ...)7 ? }* b$ Y) ]/ X& c2 m0 E6 T
{
( w* {. c3 b: ^: |8 X2 r char msg[UF_UI_MAX_STRING_LEN+1];
! H; [. r$ C/ ]* j9 `: ` va_list args;
7 k9 l1 }+ \2 q. t L1 N2 V) R7 Q va_start(args, format);
5 M$ s# C) C& `' l6 n vsprintf(msg, format, args);
6 J6 p. Q: L0 Y& v4 g+ o! U va_end(args);. S; ?1 C$ i" O
UF_UI_open_listing_window();
$ [) A) @1 H6 w1 R, j UF_UI_write_listing_window(msg);
4 Y+ i$ c8 {' G( Z) P5 m UF_print_syslog(msg, FALSE);
3 e) q1 Y- f# `6 W* [}( d+ Y# `& {& J9 Y1 y
( w9 H1 e- t" Y1 _; R$ I#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X)))
# n: R: d+ I# M0 g
' r: U& t1 y; D3 r: S1 Nstatic int report_error( char *file, int line, char *call, int irc)
( i1 h* _4 ^; m2 |% }$ N+ a{: S* f: P. J; {5 C. P# K5 y8 W
if (irc)* N. E+ b0 }% V' b7 K0 P' C) R& t
{
, c8 U2 h4 f. g" H# A; N, N8 B char err[133];
6 N8 n8 I( z8 G7 |" Z4 k. a
( S7 Y. v: l. Y* t: G( ], w1 i UF_get_fail_message(irc, err);7 G# y$ Y4 i' t& i9 Y
ECHO("*** ERROR code %d at line %d in %s:\n",
m9 |. j8 \2 I5 E/ B irc, line, file);
. ?: C) w' `1 `4 `6 Q ECHO("+++ %s\n", err);
7 B( j- I- l1 j5 |' m _) e& \6 k5 | ECHO("%s;\n", call);
5 R8 H! F# c6 n$ v2 B( _* A$ O3 k* ^ }4 K- Y- q2 M* ?3 C$ h- j( X
7 e5 R5 q' l$ K return(irc);
7 }$ O! w8 O6 c! O' h}
9 P8 u( ~* N; Y1 S# n9 T2 Q0 p! ^7 g
! k9 W& d) z# U) t7 fstatic void report_assem_search_directories(void)
9 _/ l5 N' C Q# [6 Z4 i8 m3 a, g{
7 d! k. g% L5 @8 P6 T/ T char
$ W+ w( R( w* q0 \( L1 a2 h **dir_list;
) O' b: P( M6 B& @ int
( e" c& M9 L* | ii,1 H% p U+ [' I
num_dir = 0;
3 C8 c. q) q' |; Q logical
- ~/ S6 p. _& N1 E; @ *subs;$ u/ ]3 s. d1 U1 ^, V* l
9 U( g T& D, p! E* V& b3 z
UF_CALL(UF_ASSEM_ask_search_directories(&num_dir, &dir_list, &subs));( G* A8 x5 y) r; @; C
for (ii = 0; ii < num_dir; ii++)4 i) X7 m/ e2 v8 A
{2 w' z4 T9 ~' X! i' y. D
ECHO("%s", dir_list[ii]);
; l3 Z7 \. r$ y8 d- u8 q1 I if (subs[ii]) ECHO("...");
8 S: z. ]5 l4 T0 h l ECHO("\n");
2 F% P+ ^# t* X }
7 a3 Y5 S4 z3 L4 x l UF_free_string_array(num_dir, dir_list);: M6 z- I( s- ~
UF_free(subs);
; [6 N8 u% i* y' S}
" L$ |% q% H8 P2 G' ^- z1 ^9 o1 X
static void report_assem_options(void)
0 Z/ E6 P+ S' _3 S% H' h{
$ ~4 s" L( M9 r UF_ASSEM_options_t
. {: p) d4 ?3 a Q assem_opts;
" f, m! E7 M5 w% P$ Q
! S) A/ o2 ^# d' N UF_CALL(UF_ASSEM_ask_assem_options(&assem_opts));
1 T4 i/ K! `6 g1 w; @' c8 O2 u4 M0 r$ e0 m0 c" {: X) c$ \+ t
ECHO("Part Versions\n");
. A8 z5 S* v2 _: c* d' P2 V swiTCh (assem_opts.load_options)2 t0 c0 O! r' T/ N4 x" k+ R
{6 g' A$ ^ I0 x
case UF_ASSEM_load_from_directory:0 h0 J8 @8 l- M: {, S
ECHO(" Load = From Folder\n");
4 ~. q/ P! D" w' d2 J break;5 f5 L/ u3 z; \" o. k
case UF_ASSEM_load_from_search_dirs:7 z& `1 B% D: n9 g
ECHO(" Load = From Search Folders\n");& }1 V6 E& Z2 Y% M
break;; u: n, a9 |, E* X) V. I$ l
case UF_ASSEM_load_as_saved:
}' n; o( r! q. N ECHO(" Load = As Saved\n");( H6 @8 O7 d+ a
break;- B9 c% G9 ]& ` J B3 q6 Z" Z
default:
4 n4 x2 g1 I" @2 B ECHO(" assem_opts.load_options = unknown value (%d)",$ X' r$ ^& A" F9 n3 }7 L% L5 V: B
assem_opts.load_options);0 m. p" [. F# {' D
break;
+ a7 r& g) O8 W* o }+ M3 R5 p, G) B: ]3 @! U* f6 ?
6 C% ~0 i5 K2 G: M9 n; ?% G switch (assem_opts.load_latest)
/ g9 a% Z# G) L5 Y, D {, ^5 @/ p6 v* Q
case UF_ASSEM_load_exact_version:
" m+ k2 \2 U0 c8 {7 M" @( a' Q ECHO(" Load Latest = Off\n");' n& t+ g! m: S" {; Y* u; q
break;8 O8 v9 W) @0 w9 F
case UF_ASSEM_load_latest_version:
* ]& J5 [! |2 ] ECHO(" Load Latest = On\n");, b4 Z3 Q* r: E! M1 j
break;
- |; u: a; i, Q+ G! w$ x& w* ] default:8 X b- k" N: E) l9 {
ECHO(" assem_opts.load_latest = unknown value (%d)",
1 n# b5 J1 B# }) l$ }* H, ] assem_opts.load_latest); n0 E) ]9 \& g
break;0 @2 E2 C7 Y* ?/ C N: q
}) } Z# v! e, {3 S7 u5 M4 X0 s! w
, J9 U3 D- K: K- y; h8 Z" v1 q' B
if (assem_opts.load_options == UF_ASSEM_load_from_search_dirs)5 B/ ~# r$ {$ L4 v0 `
report_assem_search_directories();
* s) U0 ~! m; [# R( V3 v; r: k0 S% K' \: u0 ?9 E) U
ECHO("Scope\n");4 K% @+ h- |) ]* ]% Q+ s& a4 a3 ~+ E
switch(assem_opts.load_components)# A0 d+ _2 i( P+ {
{) q T1 s( i. H4 X( o( K% t
case UF_ASSEM_dont_load_components:) T' }! L: x' R! x2 U( g- }5 v6 J
ECHO(" Load = Structure Only\n");
" Q* M, Z6 z; u1 G, [8 T7 V break;
5 v; C* b7 S c: \4 Y6 a { case UF_ASSEM_do_load_components:
9 J w5 J% Z* F& y ECHO(" Load = All Components\n");2 o3 j2 ?0 P9 p8 E
break;
( S8 T- G& K& Q |- X' H9 b case UF_ASSEM_use_last_component_set:
M6 D2 I8 X6 i- C, @* _ ECHO(" Load = As Saved\n");
2 k7 f: I Q, h# u3 X+ U" ~ break;
9 Q( t3 B0 } n, R3 r case UF_ASSEM_use_last_filter:1 {. W. I! K' \* L$ Y3 S
ECHO(" Load = Re-evaluate Last Component Group\n");$ _; q3 G( x" D
break;
4 N( i. h; L3 D6 {+ H- G1 h case UF_ASSEM_specify_filter:
# N5 Y) G& _4 g! z$ J ECHO(" Load = Specify Component Group\n");
+ L; R D" ~! w7 ~* x/ t+ I break;9 z5 q% a7 T9 \/ Z2 L: N9 B$ z
default:. t3 j4 @ C0 l' ?% e# k8 H, a
ECHO(" assem_opts.load_components = unknown value (%d)",
& U6 ]% U0 E/ a# ]# S% K3 _; U assem_opts.load_components);
0 S( W# A6 t$ T break;- Z: W! e0 N2 `
}3 |; z( ~* V5 N
2 w0 S# D% E0 [( C8 o
switch(assem_opts.load_fully)5 Y5 H8 Q7 |3 l J2 O
{6 W; }2 r$ w+ x8 y1 n' Y
case UF_ASSEM_load_components_partially:
9 A6 `: t1 M$ h) I ECHO(" Use Partial Loading = On\n");
% M1 P y. h6 Q% [ break;
: e4 O. K2 _6 v% S: v; D& r% V0 [ case UF_ASSEM_load_components_fully:# n) n: \2 h$ u4 \3 y5 v1 h/ l0 X
ECHO(" Use Partial Loading = Off\n");/ o! x( K, H2 t" X; i+ v7 m
break;
& _% ^6 E) ~. F6 V4 s- T default:
% q/ e7 O* b1 f ECHO(" assem_opts.load_fully = unknown value (%d)",! l+ G0 b! r* N0 {5 x4 O
assem_opts.load_fully);
7 O( l1 w# H" c" N; j break;4 u" z/ k; S* v% _
}' p7 [# C5 l0 |" N% l
" h9 N. K8 l) `% g0 b# T
switch (assem_opts.load_wave_data)8 @/ y- A# L9 {3 t' n' H8 C
{
( P+ `* ~ n% ^# j+ l& f case UF_ASSEM_load_wave_data:) E8 {3 n/ R+ {
ECHO(" Load Interpart Data = On\n");
$ u, U" G/ q; J2 @$ T& M0 Y break;2 @6 o( L* ~ L) j; o; ~
case UF_ASSEM_default_load_behaviour:
' q @% i% J! l B ECHO(" Load Interpart Data = Off\n");0 E m3 j* K# N: B% B
break;7 N$ F6 m% S$ ?3 Z
default:7 I" y3 y- x- W. i
ECHO(" assem_opts.load_wave_data = unknown value (%d)",
: P4 k0 p, j' {8 d assem_opts.load_wave_data);
- Q: m& s o" S4 O/ f0 W break;7 g3 v6 L9 m% V& F2 f9 g" }
}: l3 u9 @+ w0 e
/ F5 B0 S9 T, R. D0 ?
switch (assem_opts.load_wave_parents)
6 L; a, s3 W% C4 [" K9 M( e" ?* } {# i1 [" o2 @( d
case UF_ASSEM_none:
4 ~+ v$ E& i; N% K$ e3 ?" { ECHO(" Load Parents = None\n");
6 q" L( C, n4 Q; r& ` break;
0 x7 o4 I) R3 e4 h8 P- ^ L case UF_ASSEM_immediate:1 X" E3 B* q* D9 @# l
ECHO(" Load Parents = Immediate Level Only\n");
6 z( O/ w# I# {% r- z: N( G6 r3 f break;
0 R% Z) q6 ~- L8 |5 o case UF_ASSEM_all:' u/ y) y3 m/ u* I- G7 B
ECHO(" Load Parents = All Levels\n");
) i4 M6 [8 ]+ A, W break;% r, k6 h9 a* {% _1 T5 ~+ m
default:
b1 U" p6 x7 ?5 |* x ECHO(" assem_opts.load_wave_parents = unknown value (%d)",$ n( T. P( A8 l/ d
assem_opts.load_wave_parents);) L" N4 V& o3 F( v
break;8 V% m3 N; L( {0 S( ]+ ]# y
}
% K6 |/ r4 U8 M: _" b% \% O0 z% ?) X; N
ECHO("Load Behavior\n");
( e) d! R3 p% K% c+ | switch (assem_opts.load_substitution)
; U) d2 k# Z* e x5 [; o2 l! `8 R {
/ z. J3 E: N* w3 l) F( @ case UF_ASSEM_do_allow_substitution:
# K q5 O/ J* s. G& V ECHO(" Allow Replacement = On\n");6 C1 g5 y _8 ]
break;0 s1 A3 s: m! ?3 b2 R) d" k) b' Z+ V( J
case UF_ASSEM_dont_allow_substitution:' K5 }5 P$ ^+ [2 A
ECHO(" Allow Replacement = Off\n");
' n( B {; n9 `! e* n8 h break;
6 V! f9 p- ~4 c default:
4 y$ K* F6 V* G8 l+ }' O ECHO(" assem_opts.load_substitution = unknown value (%d)",
* i! e1 k0 x- X7 M; k4 t9 i- f% m assem_opts.load_substitution);
4 ^5 @5 t8 m* e7 C' `9 a break;
# I% B/ s8 @- {( r5 `" p% k }
i9 } M& d: j6 d" R+ ]
* c: X; s. b3 c0 F3 b1 G5 ` switch (assem_opts.auto_regen_pfm_option)
9 B0 @8 [* ^6 l% V' F {! L/ _% _! @/ N, f0 @( {2 y$ G( h, M
case UF_ASSEM_auto_generate_pfm:
4 W) p( U( l6 E5 Y. i ECHO(" Generate Missing Part Family Members = On\n");$ ~) c9 s+ v# T& E$ `; Z [
break;
4 M5 q6 j& a& p9 h% z- g case UF_ASSEM_dont_auto_generate_pfm:( Y6 J8 i m) T& c1 ~7 G+ T, b
ECHO(" Generate Missing Part Family Members = Off\n");
5 ?) T- o# w1 a9 M0 }2 g; b4 J+ z break;
0 B" E; v% A2 X) K1 ^: y default:. w3 H, z; B7 V6 T% h
ECHO(" assem_opts.auto_regen_pfm_option = unknown value (%d)",4 Z" ?; p0 ]9 L' S3 r& _! J
assem_opts.auto_regen_pfm_option);
* O3 f' o9 n6 T3 u break;6 T |# T+ d+ G F3 y' c
}
. C3 n1 i B2 I7 v6 M( l( V1 {7 e# H' E3 \- a9 H3 E' W
switch (assem_opts.failure_action)
- T% A4 ^8 T$ e; _4 k1 `0 @ {
+ r. G8 O* D: W/ ~! J2 y case UF_ASSEM_do_abort_on_failure:
9 x0 v7 N+ ^4 E( r; a' E. W( ] ECHO(" Cancel Load on Failure = On\n");: y x7 Q; p. u3 D4 k
break;& b& T; f1 v+ R) r4 C
case UF_ASSEM_dont_abort_on_failure:( O+ J' S% Q- C
ECHO(" Cancel Load on Failure = Off\n");
' j$ g8 U! B! j% i5 [* T break;5 F Z' ~5 i/ e+ }
default:" O" p9 L/ ]% M
ECHO(" assem_opts.failure_action = unknown value (%d)",
3 K D- e0 l: l assem_opts.failure_action);
, _3 t e& u4 v! a break;
6 T" K& L: ]- A9 y2 A! Z }
' l8 R ?: R1 J% S. Z
" p% E3 k' t5 {0 K, u* e! y' f, @ ECHO("Reference Sets\n");
[, `8 l, v Y! t, j switch (assem_opts.apply_to_all_levels)8 s7 y( S. h- S/ r% d' B& W
{
/ S, k6 n7 V { case UF_ASSEM_do_apply_to_all_levels:5 n, c% e0 ?6 ~- p* `6 x; h: J0 b
ECHO(" Apply to All Assembly Levels = On\n");% W% e4 @/ _( E5 z* n5 E
break;4 f3 S! a8 z4 q
case UF_ASSEM_dont_apply_to_all_levels:; `0 a* G0 k3 u) g
ECHO(" Apply to All Assembly Levels = Off\n");/ b7 U1 V5 {7 B. ^
break;, g) y1 p9 Y2 ~3 u' @' P' @$ c: l
default:3 w& Y0 Q& ~, y1 q- {# }
ECHO(" assem_opts.apply_to_all_levels = unknown value (%d)",) s" z% Y5 h6 j$ y" Q3 e" m
assem_opts.apply_to_all_levels);+ N! D: _2 i+ O' B- E8 C2 _
break;' N* N6 D/ e" U: N3 Q9 b S/ [$ h; z" g
}( R1 I; b- P' J7 f& |( ?9 i
/ Z6 F) Y( @" g9 k" A8 W- M, Y1 S( i
ECHO("Preferences-> Assembly (misc)\n");9 Q/ w: g. }, h( B7 W5 t. K
switch(assem_opts.emphasize)
4 ~0 n9 `* |+ { {' w" O/ q! G( M# H; J
case UF_ASSEM_do_not_emphasize_wp:' `) t B5 J$ m3 J: r
ECHO(" Work Part-> Emphasize = Off\n");' x% K( v- y# z0 f& p6 y
break;
2 }7 G0 o! ]9 i% `) ^5 T case UF_ASSEM_emphasize_wp:$ f+ m, U+ n) K% E; l. q6 z
ECHO(" Work Part-> Emphasize = On\n");
8 t4 F% P- h% o: W, S: [% s, r break;( H A( x0 m1 F1 J# [, d/ o" Y
default:! t1 L3 a, P- n1 B# }5 B* l
ECHO(" assem_opts.emphasize = unknown value (%d)",
/ F1 j3 D3 S6 D( g assem_opts.emphasize);8 |0 S* }/ c: h) l& q+ t) c
break;/ l0 A/ z: @& q$ d- ~
}
$ R9 a, x2 z; f3 X7 F
' ^! \, m' S! l" ~ switch(assem_opts.maintain_work_part)
; s! K* a* q$ p5 Y7 c# G {) P1 |# X9 V/ q# e0 ^" N7 l+ B
case UF_ASSEM_do_maintain_work_part:
& f- x" |/ b& X; u2 V! l& x6 s8 E ECHO(" Work Part-> Maintain = On\n");
/ {6 @6 u# u% Y- v3 A break;
# d5 [& k) w: t# k8 e, M) W8 w8 M& \ case UF_ASSEM_dont_maintain_work_part:2 a$ a7 q1 {3 c$ ~, E
ECHO(" Work Part-> Maintain = Off\n");9 ]; c: [8 q, P( L7 ^
break;
3 F; C8 A6 i- K2 T+ e: J) J* a+ T default:6 F- p; K9 x. @% a. Q) B, T
ECHO("assem_opts.maintain_work_part = unknown value (%d)",- Q/ }0 @- T, z; g
assem_opts.maintain_work_part);
% h! |3 C, B% F. y1 H! K$ c break;$ Q: [6 H: k$ s* s7 J$ V
}* x# R5 B! }9 S2 q1 Q; b8 C$ q/ }
switch(assem_opts.update)0 N g, c% W4 i8 ^" r. U7 O2 h" ^
{
& w7 E: z' S9 o: G1 Z, e case UF_ASSEM_no_update_report:5 x x: u* I# y$ h
ECHO(" Display Update Report = Off\n");
0 I) Z0 O9 K% j+ Y7 \) y break;7 {4 r$ h- a" l/ Z( ~
case UF_ASSEM_update_report:
4 N- s. y& d, P' \% w; ~+ L ECHO(" Do Not Display Update Report = On\n");
5 I% x) j# {- C0 q4 ?8 ]4 c break;. y/ p& C; d8 G( J
default:
- f! M% O1 z3 I+ N4 w ECHO(" assem_opts.update = unknown value (%d)",
- G8 K( M/ j5 n* D9 r assem_opts.update);
. G9 z" N, S: }( K break;; ?3 v5 U; C! Y( B
}2 R2 b) g k# e% |
}( a( r4 r& U0 c* o) X4 ]
6 N b: Q6 Z/ p7 S+ Q% Zstatic void load_specified_load_options_def_file(void)
x( E* H4 u' i2 \2 [{* s# z2 M: w2 @9 a
int
; R4 y6 y* V' ?4 r! V/ G1 }+ ?! k resp;
: u5 p0 V2 f; a1 F3 r8 u" v char
% n2 ^7 b2 E+ O2 L2 { filter[MAX_FSPEC_SIZE+1] = { "*.def" },
" b: p7 c+ s6 K* S" N fspec[MAX_FSPEC_SIZE+1] = { "" };
( @$ @3 b( ^- Q9 P+ H9 }8 h7 h
4 M7 h. R1 n, w) Z5 B if (!UF_CALL(UF_UI_create_filebox("Enter load options file to restore"," Y& U( A# Q' Z! S1 p$ }' k/ ?! x4 L
"Restore Load Options File", filter, "", fspec, &resp)) &&' H2 [2 K2 K' P6 G
(resp == UF_UI_OK))2 P0 O+ m5 ]' i3 t1 R
UF_CALL(UF_ASSEM_restore_load_options(fspec));
2 u0 N& v$ q3 g8 j Q5 N- j}
) D. g$ D1 [/ b& ]/ z1 ^# v4 K/ T. x" c( s D5 K1 a+ Z9 v
static void do_it(void)$ d! n# f/ c$ G
{3 h9 j7 ~" w4 J. O
ECHO("Current load options:\n");
& H' J+ ?& r& `' ^5 l report_assem_options();
f6 [5 S4 w2 U
4 t } Q* C7 t load_specified_load_options_def_file();
; U6 W2 p! w/ a6 g. [
8 H1 d4 N3 G/ J+ l; f ECHO("\nNewly restored load options:\n");
3 y4 E4 H4 I8 B1 O report_assem_options();% v; Z: X- M& [4 n% w
}
# d' Z& g0 `# s$ H+ X( a
$ w! x/ X8 d+ e, a9 k3 y/*ARGSUSED*/
+ i4 l# K" @" S' [( svoid ufusr(char *param, int *retcode, int paramLen)
, F4 G. o5 K0 D; O N, D. W3 e" _{9 [4 ]( H- K# a9 q! z! q
if (UF_CALL(UF_initialize())) return;# L: o" ?) C* q8 M$ [4 K
do_it();
# k0 {6 E! Z9 J UF_terminate();
. _$ F8 T. B+ k4 O9 D( Z7 C0 q" [}- T$ o+ N% i- W) n- p: y
x8 X) a# q( t) S: E+ {
int ufusr_ask_unload(void)
0 C6 v9 f% m9 e7 I; J6 E{
& Q3 j5 g% a6 A9 |' C0 g9 M# n5 B return (UF_UNLOAD_IMMEDIATELY);: G! U: d' i$ [4 b; Z; L
}[/mw_shl_code]
1 a( M# R9 B' G5 p L |
|