/************************************************* * * Routine to send done request. */ void DoneRequest(int doneCode) { static int beenhere = 0; Tt_message msg; Tt_status status; char *procid; /* * Only allow one Done(Request) to be issued. */ if (!beenhere) { beenhere = 1; procid = tt_default_procid(); msg = dtexec_tttk_message_create( (Tt_message) NULL, TT_REQUEST, TT_SESSION, dtSvcProcIdG, "_DtActDtexecDone", DoneRequestReplyCB ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcInvIdG ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcChildIdG ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, doneCode ); status = tt_message_send( msg ); tt_free(procid); if (status != TT_OK) { dtexec_tttk_message_destroy( msg ); DetachFromTooltalk(NULL); } } }
/************************************************* * * Routine to send identification request. */ void IdSelfToCallerRequest(void) { Tt_message msg; Tt_status status; char *procid; procid = tt_default_procid(); msg = dtexec_tttk_message_create( (Tt_message) NULL, TT_REQUEST, TT_SESSION, dtSvcProcIdG, "_DtActDtexecID", IdSelfToCallerReplyCB ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcInvIdG ); tt_message_iarg_add( msg, TT_IN, dtexec_Tttk_integer, dtSvcChildIdG ); tt_message_arg_add( msg, TT_IN, dtexec_Tttk_message_id, procid ); status = tt_message_send( msg ); tt_free(procid); if (status != TT_OK) { dtexec_tttk_message_destroy( msg ); DetachFromTooltalk(NULL); } }
static Tt_message _ttDtStarted( Tttk_op op, Tt_message context, const char *toolName, const char *vendor, const char *version, int sendAndDestroy ) { Tt_message msg = tttk_message_create( context, TT_NOTICE, TT_SESSION, 0, _ttDtOp( op ), 0 ); Tt_status status = tt_ptr_error( msg ); if (status != TT_OK) { return msg; } tt_message_arg_add( msg, TT_IN, Tttk_string, toolName ); tt_message_arg_add( msg, TT_IN, Tttk_string, vendor ); tt_message_arg_add( msg, TT_IN, Tttk_string, version ); if (! sendAndDestroy) { return msg; } status = tt_message_send( msg ); if (status != TT_OK) { tttk_message_destroy( msg ); return (Tt_message)tt_error_pointer( status ); } tttk_message_destroy( msg ); return 0; }
// // Add commission id and send, if appropriate // Tt_message _ttDesktopMessageFinish( Tt_message msg, Tt_message commission, int send ) { _TttkItem2Free fuse = msg; Tt_status status; if (commission != 0) { char *id = _tttk_message_id( commission ); status = tt_message_arg_add( msg, TT_IN, Tttk_message_id, id ); tt_free( id ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } if (send) { status = tt_message_send( msg ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } fuse = (caddr_t)0; return msg; }
// // If clientCB is 0, uses _ttDtApplyLocale, q.v. re clientData. // Tt_message ttdt_Get_Locale( const char *handler, Tt_message commission, Ttdt_Get_Locale_msg_cb clientCB, void *clientData, const char **categories, int send ) { const char *_handler = handler; if ((handler == 0) && (commission != 0)) { _handler = tt_message_sender( commission ); } if (clientCB == 0) { clientCB = _ttDtApplyLocale; } Tt_message msg = _ttDtPMessageCreate( commission, TT_REQUEST, TT_SESSION, handler, TTDT_GET_LOCALE, _ttDtGetLocaleCB, (void *)clientCB, clientData ); Tt_status status = tt_ptr_error( msg ); if (status != TT_OK) { return msg; } // // Guarantees that msg will be destroyed when this function returns // _TttkItem2Free fuse = msg; const char **_cats = categories; if (_cats == 0) { _cats = _Tt_categories; } while (*_cats != 0) { status = tt_message_arg_add( msg, TT_IN, Tttk_string, *_cats ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } status = tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } _cats++; } if (send) { status = tt_message_send( msg ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } fuse = (caddr_t)0; return msg; }
// // If clientCB is 0, uses _ttDtApplySituation, q.v. re clientData. // Tt_message ttdt_Get_Situation( const char *handler, Tt_message commission, Ttdt_Get_Situation_msg_cb clientCB, void *clientData, int send ) { const char *_handler = handler; if ((handler == 0) && (commission != 0)) { _handler = tt_message_sender( commission ); } if (clientCB == 0) { clientCB = _ttDtApplySituation; } Tt_message msg = _ttDtPMessageCreate( commission, TT_REQUEST, TT_SESSION, _handler, TTDT_GET_SITUATION, _ttDtGetSituationCB, (void *)clientCB, clientData ); Tt_status status = tt_ptr_error( msg ); if (status != TT_OK) { return msg; } // // Guarantees that msg will be destroyed when this function returns // _TttkItem2Free fuse = msg; status = tt_message_arg_add( msg, TT_OUT, Tttk_string, 0 ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } if (send) { status = tt_message_send( msg ); if (status != TT_OK) { return (Tt_message)tt_error_pointer( status ); } } fuse = (caddr_t)0; return msg; }