1 //%% (c) Copyright 1993, 1994 Hewlett-Packard Company
2 //%% (c) Copyright 1993, 1994 International Business Machines Corp.
3 //%% (c) Copyright 1993, 1994 Sun Microsystems, Inc.
4 //%% (c) Copyright 1993, 1994 Novell, Inc.
5 //%% $XConsortium: tt_c++.C /main/3 1995/11/06 17:14:22 rswiston $
16 char *string = tt_status_message( status );
20 char *tab = strchr( string, '\t' );
30 Tt_status status2Print
33 char *string = tt_status_string( status2Print );
47 case TT_SCOPE_NONE: string = "TT_SCOPE_NONE"; break;
48 case TT_SESSION: string = "TT_SESSION"; break;
49 case TT_FILE: string = "TT_FILE"; break;
50 case TT_BOTH: string = "TT_BOTH"; break;
51 case TT_FILE_IN_SESSION: string = "TT_FILE_IN_SESSION"; break;
56 sink << "(Tt_scope)" << (int)scope;
69 case TT_CLASS_UNDEFINED: string = "TT_CLASS_UNDEFINED"; break;
70 case TT_NOTICE: string = "TT_NOTICE"; break;
71 case TT_REQUEST: string = "TT_REQUEST"; break;
72 case TT_OFFER: string = "TT_OFFER"; break;
77 sink << "(Tt_class)" << (int)_class;
90 case TT_MODE_UNDEFINED: string = "TT_MODE_UNDEFINED"; break;
91 case TT_IN: string = "TT_IN"; break;
92 case TT_OUT: string = "TT_OUT"; break;
93 case TT_INOUT: string = "TT_INOUT"; break;
98 sink << "(Tt_mode)" << (int)mode;
111 case TT_PROCEDURE: string = "TT_PROCEDURE"; break;
112 case TT_OBJECT: string = "TT_OBJECT"; break;
113 case TT_HANDLER: string = "TT_HANDLER"; break;
114 case TT_OTYPE: string = "TT_OTYPE"; break;
119 sink << "(Tt_address)" << (int)address;
127 Tt_callback_action action
132 case TT_CALLBACK_CONTINUE: string = "TT_CALLBACK_CONTINUE";break;
133 case TT_CALLBACK_PROCESSED: string = "TT_CALLBACK_PROCESSED";break;
138 sink << "(Tt_callback_action)" << (int)action;
148 if (tt_ptr_error( msg1 ) != TT_OK) {
151 Tt_message msg2 = tt_message_create();
152 Tt_status status = tt_ptr_error( msg2 );
153 if (tt_ptr_error( msg2 ) != TT_OK) {
156 int contexts = tt_message_contexts_count( msg1 );
157 status = tt_int_error( contexts );
158 if (status != TT_OK) {
159 tt_message_destroy( msg2 );
160 return (Tt_message)tt_error_pointer( status );
162 for (int context = 0; context < contexts; context++) {
163 char *slot = tt_message_context_slotname( msg1, context );
165 status = tt_message_context_ival( msg1, slot, &ival );
170 tt_message_icontext_set( msg2, slot, ival );
173 tt_message_context_bval( msg1, slot, &bval, &len );
174 tt_message_bcontext_set( msg2, slot, bval, len );
175 tt_free( (caddr_t)bval );
180 int args = tt_message_args_count( msg1 );
181 status = tt_int_error( args );
182 if (status != TT_OK) {
183 tt_message_destroy( msg2 );
184 return (Tt_message)tt_error_pointer( status );
186 for (int arg = 0; arg < args; arg++) {
187 Tt_mode mode = tt_message_arg_mode( msg1, arg );
188 char *vtype = tt_message_arg_type( msg1, arg );
190 status = tt_message_arg_ival( msg1, arg, &ival );
195 tt_message_iarg_add( msg2, mode, vtype, ival );
198 tt_message_arg_bval( msg1, arg, &bval, &len );
199 tt_message_barg_add( msg2, mode, vtype, bval, len );
200 tt_free( (caddr_t)bval );
206 tt_message_class_set( msg2, tt_message_class( msg1 ));
208 char *file = tt_message_file( msg1 );
209 if ((tt_ptr_error( file ) == TT_OK) && (file != 0)) {
210 tt_message_file_set( msg2, file );
214 char *object = tt_message_object( msg1 );
215 if ((tt_ptr_error( object ) == TT_OK) && (object != 0)) {
216 tt_message_object_set( msg2, object );
220 char *op = tt_message_op( msg1 );
221 if ((tt_ptr_error( op ) == TT_OK) && (op != 0)) {
222 tt_message_op_set( msg2, op );
226 char *otype = tt_message_otype( msg1 );
227 if ((tt_ptr_error( otype ) == TT_OK) && (otype != 0)) {
228 tt_message_otype_set( msg2, otype );
232 tt_message_address_set( msg2, tt_message_address( msg1 ));
234 // XXX skip handler, handler_ptype, sender
236 tt_message_scope_set( msg2, tt_message_scope( msg1 ));
238 char *sender_ptype = tt_message_sender_ptype( msg1 );
239 if ((tt_ptr_error( sender_ptype ) == TT_OK) && (sender_ptype != 0)) {
240 tt_message_sender_ptype_set( msg2, sender_ptype );
241 tt_free( sender_ptype );
244 char *session = tt_message_session( msg1 );
245 if ((tt_ptr_error( session ) == TT_OK) && (session != 0)) {
246 tt_message_session_set( msg2, session );
250 tt_message_status_set( msg2, tt_message_status( msg1 ));
252 char *status_string = tt_message_status_string( msg1 );
253 if ((tt_ptr_error( status_string ) == TT_OK) && (status_string != 0)) {
254 tt_message_status_string_set( msg2, status_string );
255 tt_free( status_string );
266 Tttk_op op = tttk_string_op( optext );
270 theClass = TT_REQUEST;
281 theClass = TT_NOTICE;
295 case TTDT_GET_MODIFIED:
301 Tt_message msg = tttk_message_create( 0, theClass, scope,
303 Tt_mode mode = TT_INOUT;
308 tt_message_arg_add( msg, TT_IN, Tttk_file, 0 );
315 case TTDT_GET_MODIFIED:
318 tt_message_arg_add( msg, TT_IN, Tttk_file, 0 );
320 case TTDT_GET_SYSINFO:
321 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
323 case TTDT_GET_STATUS:
324 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
325 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
326 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
327 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
330 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
334 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
335 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
336 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
338 case TTDT_GET_ICONIFIED:
339 case TTDT_GET_MAPPED:
340 tt_message_arg_add( msg, TT_OUT, Tttk_boolean, 0 );
343 tt_message_arg_add( msg, TT_IN, Tttk_boolean, 0 );
345 case TTDT_SET_MAPPED:
346 case TTDT_SET_ICONIFIED:
347 tt_message_arg_add( msg, TT_IN, Tttk_boolean, 0 );
349 case TTDT_GET_GEOMETRY:
351 case TTDT_SET_GEOMETRY:
352 tt_message_arg_add( msg, mode, Tttk_width, 0 );
353 tt_message_arg_add( msg, mode, Tttk_height, 0 );
354 tt_message_arg_add( msg, mode, Tttk_xoffset, 0 );
355 tt_message_arg_add( msg, mode, Tttk_yoffset, 0 );
358 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
359 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
360 tt_message_arg_add( msg, TT_OUT, Tttk_integer, 0 );
362 case TTDT_GET_SITUATION:
363 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
366 case TTDT_SET_SITUATION:
367 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
369 case TTDT_DO_COMMAND:
370 case TTDT_GET_ENVIRONMENT:
371 case TTDT_GET_LOCALE:
372 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
373 tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 );
375 case TTDT_SET_LOCALE:
376 case TTDT_SET_ENVIRONMENT:
377 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
378 tt_message_arg_add( msg, TT_IN, Tttk_string, 0 );
389 char *defaultProcid = tt_default_procid();
390 tt_default_procid_set( procid );
391 int val2return = tt_fd();
392 if (! tt_is_err( tt_ptr_error( defaultProcid ))) {
393 tt_default_procid_set( defaultProcid );