|
2 \5 L- { @2 }- w6 W' N
/* Include files */. i3 ~& d- @1 i/ G# d5 P* s
#if ! defined ( __hp9000s800 ) && ! defined ( __sgi ) && ! defined ( __sun ) U# M) r% O$ f) i
# include <strstream>8 H' N& C5 O) w7 Q/ k8 S- l; C
# include <iostream>
8 M/ ?! c) R2 J( S# m using std:strstream;
0 G$ [/ B! m1 s4 @- H5 t% a using std::endl; + @- G9 c* t: B' ~* T" c1 z
using std::ends;
2 V* {( S! q1 d using std::cerr;
, ?5 F. I* j$ |) h( t* ~( R, G7 h#else& S, O- V/ `9 `' I) Q$ |
# include <strstream.h>; k- h/ ^& {2 `- ~7 m
# include <iostream.h>- P1 {' Y# l1 _: m
#endif8 l2 {8 p% O! D, T
#include <uf.h> q% p6 g, u6 _ I( x, E
#include <uf_ui.h>
2 A0 d& R0 |6 l$ |+ [4 [( K. \#include <uf_exit.h>
% U) m3 Y7 a6 }1 J# S9 f) r#include <uf_layer.h>
4 _& e1 q0 h' v% k% ?" p6 {#define UF_CALL(X) (report_error( __FILE__, __LINE__, #X, (X))) v: s& M; H, ?; R# L! |
- B1 ^6 T6 {1 f$ hstatic int report_error( char *file, int line, char *call, int irc). ]3 Y6 |' v! H
{7 j: r1 q! g% O; J
if (irc)
/ n$ K: I4 Y% Q1 q; s- Q# ]9 F {
* @# {, L* Q0 z2 o6 j( o5 z% ^ char err[133],
9 X L ]- k# R0 _: C0 i msg[133];& X( U; ]. P7 n. T; D
* ~% O$ m+ Y6 ]
sprintf(msg, "*** ERROR code %d at line %d in %s:\n+++ ",
8 v+ l6 y! t# h8 [% ^3 L irc, line, file);/ d- P5 L& s. z6 M( B8 Z6 X
UF_get_fail_message(irc, err);
3 d. b+ L% I# x# I: o' T( x1 n9 r# v$ I4 m7 |" S" l
UF_print_syslog(msg, FALSE);
* S1 b, a8 K4 ^( ] UF_print_syslog(err, FALSE);) x6 @; a/ C- z( @9 m; c
UF_print_syslog("\n", FALSE);
: V0 K/ s( `% d% U1 C9 y9 [3 p UF_print_syslog(call, FALSE);8 [( M, e3 H5 `! _; m/ N, B' A
UF_print_syslog(";\n", FALSE);. K3 k. j# s \3 \" A4 @
6 N4 i5 v* W% q. N1 i8 [
if (!UF_UI_open_listing_window())
+ ?/ `3 V) N2 B& F( G% t$ ` {2 B' f9 B4 O3 E; E
UF_UI_write_listing_window(msg);
7 S, Z) e, g* X/ f UF_UI_write_listing_window(err);7 Q G8 c1 W* G1 J2 K
UF_UI_write_listing_window("\n");- J8 b9 E- d5 ~ P6 w
UF_UI_write_listing_window(call);
0 \" D) f( A& Y$ P% D6 W4 W UF_UI_write_listing_window(";\n");: `0 o$ J8 q. w* C3 |) p
}
6 b5 }) j6 h# l' n }
9 ?% ^; Y# b7 M Y! M1 w% H% N, X) V& z* o/ Z# J9 E& T2 m
return(irc);
, F2 V# F/ Y7 V}
! U1 G, e$ l3 ]: D- X: |+ L$ {% v7 E' a4 P9 _% e
7 e" Y( r6 ?0 _' P/* "File->Execute UG/Open->User Function..." */& W4 R; |4 K$ P; e0 B5 K$ `
extern DllExport void ufusr( char *parm, int *returnCode, int rlen )
5 L$ O6 c4 k- @: i& R0 y, Y7 i{8 Z7 i6 P+ Z) H/ x! n
/* Initialize the API environment */
: i8 p: y- J0 R6 [) `) i. \ if( UF_CALL(UF_initialize()) ) ) S; E) ]6 f4 P
{
5 Y6 H# r- v- u /* Failed to initialize */, j5 ^5 G4 @7 V- ?+ Y7 M
return;2 ?4 i) U% ~9 M( R1 G
}5 E6 g+ }4 }4 A, \& ^/ A8 g) j
+ l- P! Z& v9 g N# A9 _
/* TODO: Add your application code here */
( i8 s8 {! }% F' p* o# J7 b& P) }
$ I0 {3 D+ T* }- t' u) f- C int layer_number=10;$ |' g: [. M: m. {7 B
int layer_status =
$ d4 [% E4 v5 W2 [ // UF_LAYER_WORK_LAYER ;//设置工作图层
5 P" L5 z/ r+ W0 C% [//UF_LAYER_ACTIVE_LAYER ;//设置可选图层
' w# K, f1 s) ~( f1 x n$ |//UF_LAYER_REFERENCE_LAYER ;//设置只见图层1 \7 D) e: \$ Z0 }& V# D
UF_LAYER_INACTIVE_LAYER; //设置不可选不可见活动图层
6 X2 A5 |; T5 S; c9 H% v
5 H" q1 `% h( g( `7 U/ t0 a UF_LAYER_set_status( layer_number, layer_status);% i, g: {2 N7 S8 N0 K5 Y
6 g; ~5 @0 E& |
/* Terminate the API environment */2 J1 p/ ]4 F6 c. Z8 F
UF_CALL(UF_terminate());0 j; O" v+ O6 {& p1 y% o: d
}
, C! @+ x0 \# G" R8 j, [7 l
" q; J$ m A! `9 K! v& m/*****************************************************************************
8 v" c8 p3 t/ {8 `** Utilities) Z4 c9 ^# w# Y |& @1 Z# |
*****************************************************************************/6 V$ ^ J( ~0 s, v) Y
5 i% F) b# p5 F" G% Z3 Xextern int ufusr_ask_unload( void )' n6 o4 T) R2 F$ R0 j
{
: s( v1 [+ T2 N) D( e ~ return( UF_UNLOAD_IMMEDIATELY );4 _( N2 R+ V* [5 S3 U
}
4 I; V# ^ d8 ?- a; |7 e" s' l9 Z8 ]1 |3 x$ g2 c
|
|