Example #1
0
static Tt_message
create_new_message(char *name, int height, int width)
{
  Tt_message	msg;

  msg = tt_message_create();
  exit_err_ptr(msg);

  exit_err(tt_message_address_set (msg, TT_PROCEDURE));
  exit_err(tt_message_class_set   (msg, TT_REQUEST));
  exit_err(tt_message_scope_set   (msg, TT_SESSION));
  exit_err(tt_message_op_set      (msg, "emacs-make-client-frame"));
  exit_err(tt_message_arg_add     (msg, TT_IN, "string", name));
  exit_err(tt_message_iarg_add    (msg, TT_IN, "int",    height));
  exit_err(tt_message_iarg_add    (msg, TT_IN, "int",    width));
  exit_err(tt_message_callback_add(msg, callback_fn));

  return msg;
}
Example #2
0
Tt_message
dtexec_tttk_message_create(
	Tt_message		context,
	Tt_class		theClass,
	Tt_scope		theScope,
	const char	       *handler,
	const char	       *op,
	Tt_message_callback	callback
)
{
	Tt_message msg;
	Tt_address address;
	Tt_status status;


	msg = tt_message_create();
	status = tt_ptr_error( msg );
	if (status != TT_OK) {
		return msg;
	}

	status = tt_message_class_set( msg, theClass );
	if (status != TT_OK) {
		return (Tt_message)tt_error_pointer( status );
	}

	status = tt_message_scope_set( msg, theScope );
	if (status != TT_OK) {
		return (Tt_message)tt_error_pointer( status );
	}

	address = TT_PROCEDURE;
	if (handler != 0) {
		status = tt_message_handler_set( msg, handler );
		if (status != TT_OK) {
			return (Tt_message)tt_error_pointer( status );
		}
		address = TT_HANDLER;
	}

	status = tt_message_address_set( msg, address );
	if (status != TT_OK) {
		return (Tt_message)tt_error_pointer( status );
	}

	if (op != 0) {
		status = tt_message_op_set( msg, op );
		if (status != TT_OK) {
			return (Tt_message)tt_error_pointer( status );
		}
	}

	if (callback != 0) {
		status = tt_message_callback_add( msg, callback );
		if (status != TT_OK) {
			return (Tt_message)tt_error_pointer( status );
		}
	}

	return msg;
}