Exemplo n.º 1
0
//
// A callback used internally that sets the locales of this
// address space.  If clientData is non-zero, assumes it is a
// DisplayInfo *.
//
static Tt_message
_ttDtApplyLocale(
	Tt_message	msg,
	void	       *clientData,
	const char    **categories,
	const char    **locales
)
{
	DisplayInfo *info = (DisplayInfo *)clientData;
	if (info != 0) {
		info->repliesOutStanding--;
	}
	int i = 0;
	while (categories[ i ] != 0) {
		int category = _ttDtCategory( categories[ i ] );
		if (category != -1) {
			setlocale( category, locales[ i ] );
		}
		tt_free( (caddr_t)categories[ i ] );
		tt_free( (caddr_t)locales[ i ] );
		i++;
	}
	tt_free( (caddr_t)categories );
	tt_free( (caddr_t)locales );
	if (_tttk_message_am_handling( msg )) {
		// We are being used as a pattern callback
		tt_message_reply( msg );
	}
	tttk_message_destroy( msg );
	return 0;
}
Exemplo n.º 2
0
int 
_DtIsOpenableDirContext(
        char *path,
        char **ret_path )
{
   char *real_path = NULL;
   char * tmp_real_path;
   DIR *dirp;
   int ret_status;
   Tt_status status;
   char * host;
   char * filename;
   char * netfile;

   if (ret_path)
      *ret_path = NULL;

   host = _DtHostString(path);
   filename = _DtPathname(path);
   if (host)
   {
      netfile = tt_host_file_netfile(host, filename);
      if ((status = tt_ptr_error(netfile)) == TT_OK)
      {
         tmp_real_path = tt_netfile_file(netfile);
         status = tt_ptr_error(real_path);
         tt_free(netfile);
      }

      if (status != TT_OK) {
         real_path = NULL;
      } else {
	 real_path = XtNewString(tmp_real_path);
	 tt_free(tmp_real_path);
      }

      XtFree(filename);
      XtFree(host);
   }
   else
      real_path = filename;

   if (real_path && ((dirp = opendir (real_path)) != NULL)) 
   {
      closedir (dirp);
      ret_status = 1;
      if (ret_path)
         *ret_path = real_path;
   }
   else
   {
      ret_status = 0;
      if (real_path)
         XtFree(real_path);
   }

   return (ret_status);
}
Exemplo n.º 3
0
Tt_message
MediaCallback( Tt_message msg,
	       void * client_data,
	       Tttk_op op,
	       Tt_status diag,
	       unsigned char * contents,
	       int len,
	       char * file,
	       char * docname )
{
	char *ceiling;
	Boolean restricted = False;

	tt_free( docname );
	if (diag != TT_OK) {
		return msg;
	}
	if (file == 0) {
		if (contents == 0) {
			tttk_message_fail( msg, TT_DESKTOP_ENODATA, 0, 1 );
			return 0;
		} else {
			/* Buffers and files are the same to dtfile */
			/* ToolTalk buffers are always null-terminated */
			tt_free( file );
			file = (char *)contents;
		}
	}
	/* Old libtt SEGVs if you ask for a context that is not there */
	if (tt_message_contexts_count( msg ) > 0) {
		ceiling = tt_message_context_val( msg, "restricted" );
		if (! tt_is_err( tt_ptr_error( ceiling ))) {
			if ((ceiling == 0) || (strcmp( ceiling, "." ) != 0)) {
				tttk_message_fail( msg,
						   TT_DESKTOP_ENOTSUP, 0, 1 );
				return 0;
			}
			restricted = True;
		}
	}
	switch ( op ) {
	    default:
		break;
	    case TTME_DISPLAY:
	    case TTME_EDIT:
		/*
		 * Create a display of the given directory tree
		 */
		ViewDirectoryProc( file, restricted, msg );
		msg = 0;
		break;
	}
	tt_free( file );
	tt_free( (caddr_t)contents );
	return msg;
}
Exemplo n.º 4
0
/***************************************************************************
 *                                                                         *
 * Routine:   ConvertDropName                                              *
 *                                                                         *
 * Purpose:  Convert the "object" received from bms to a full path name    *
 *           note:  I am making BIG assumptions about the format of the    *
 *                  file I am getting from dtfile. "<host> - <path>"      *
 * WARNING:  I have used an Xe function directly (XeIsLocalHostP), rather  *
 *           than include Dt/Connect.h, which was causing bad things to    *
 *           happen at build time, probably because dticon is not ansi-   *
 *           clean (it tried to get c++ version of /usr/include/stdlib.h?) *
 *           It's simply too late to clean up the ansi... (the bell tolls) *
 *                                                                         *
 ***************************************************************************/
static char *
ConvertDropName( char *objects)
{
    char *host;
    char *path;
    char *fullName;
    char *tmp;
    char *netfile;

    host = objects;
    tmp = strchr(objects,' ');
    if (tmp==NULL)      /* shouldn't happen */
      return (strdup(strchr(objects, '/')));

    /* check if same host */
    tmp[0] = '\0';
    if ((Boolean)XeIsLocalHostP(host))
    {
        tmp[0] = ' ';
        return (strdup(strchr(objects, '/')));
    }

    /* different host... get full path name */
    path = tmp+3;      /* skip past the " - " */

    /* Convert to a valid name on the local host. */
    netfile = tt_host_file_netfile(host, path);
    fullName = tt_netfile_file(netfile);
    tt_free(netfile);

    tmp[0] = ' ';      /* put back the " " after host name */
    return (fullName);
}
Exemplo n.º 5
0
tt_sshmsg_t *tt_sshmsg_create(IN tt_u32_t msg_id,
                              IN tt_u32_t msg_len,
                              IN tt_sshmsg_itf_t *itf)
{
    tt_sshmsg_t *msg;

    TT_ASSERT(itf != NULL);
    TT_ASSERT(itf->render_prepare != NULL);
    TT_ASSERT(itf->render != NULL);
    TT_ASSERT(itf->parse != NULL);

    msg_len += sizeof(tt_sshmsg_t);
    msg = (tt_sshmsg_t *)tt_malloc(msg_len);
    tt_memset(msg, 0, msg_len);

    if (msg != NULL) {
        msg->msg_id = msg_id;
        msg->msg_private = 0;
        tt_atomic_s32_set(&msg->ref, 1);

        tt_buf_init(&msg->buf, NULL);
        msg->itf = itf;

        // flags are all set to 0

        if ((msg->itf->create != NULL) && !TT_OK(msg->itf->create(msg))) {
            tt_buf_destroy(&msg->buf);
            tt_free(msg);
            return NULL;
        }
    }

    return msg;
}
Exemplo n.º 6
0
/*************************************************
 *
 * 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);
    }
}
Exemplo n.º 7
0
Tt_message
ttdt_Status(
	Tt_message	context,
	Tt_message	commission,
	const char     *statusString,
	const char     *toolName,
	const char     *vendor,
	const char     *version,
	int		sendAndDestroy
)
{
	char *handler = 0;
	if (commission != 0) {
		handler = tt_message_sender( commission );
	}
	Tt_message msg = _ttDtPMessageCreate( context, TT_NOTICE, TT_SESSION,
					handler, TTDT_STATUS, 0, 0, 0 );
	tt_free( handler );
	Tt_status status = tt_ptr_error( msg );
	if (status != TT_OK) {
		return msg;
	}
	tt_message_arg_add( msg, TT_IN, Tttk_string, statusString );
	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 );
	msg = _ttDesktopMessageFinish( msg, commission, sendAndDestroy );
	status = tt_ptr_error( msg );
	if (sendAndDestroy && (tt_ptr_error( msg ) == TT_OK)) {
		tttk_message_destroy( msg );
		return 0;
	}
	return msg;
}
Exemplo n.º 8
0
//
// Pattern callback for Raise, Lower requests
//
Tt_message
_ttdt_do_RaiseLower(
	Tt_message	msg,
	void	       *_widget,
	Tt_message
)
{
	Widget widget = _ttdt_realized_widget( _widget, 0 );
	if (widget == 0) {
		tttk_message_fail( msg, TT_DESKTOP_ENOTSUP, 0, 1 );
		return 0;
	}
	char *ops = tt_message_op( msg );
	Tttk_op op = tttk_string_op( ops );
	tt_free( ops );
	Display		       *dpy = (Display *)CALLXT(XtDisplay)( widget );
	Window			win = CALLXT(XtWindow)( widget );
	switch (op) {
	    case TTDT_RAISE:
		CALLX11(XRaiseWindow)( dpy, win );
		break;
	    case TTDT_LOWER:
		CALLX11(XLowerWindow)( dpy, win );
		break;
	    default:
		tttk_message_fail( msg, TT_DESKTOP_ENOTSUP, 0, 1 );
		return 0;
	}
	_tttk_message_reply( msg );
	tttk_message_destroy( msg );
	return 0;
}
Exemplo n.º 9
0
//
// Add commission id and register in session, if appropriate
//
Tt_pattern
_ttDesktopPatternFinish(
	Tt_pattern	pat,
	Tt_message	commission,
	int		register_it
)
{
	_TttkItem2Free fuse = pat;
	Tt_status status;
	if (commission != 0) {
		char *id = _tttk_message_id( commission );
		status = tt_pattern_arg_add( pat, TT_IN, Tttk_message_id, id );
		tt_free( id );
		if (status != TT_OK) {
			return (Tt_pattern)tt_error_pointer( status );
		}
		tt_pattern_user_set( pat, _TttkContractKey, commission );
	}
	if (register_it) {
		status = tt_pattern_register( pat );
		if (status != TT_OK) {
			return (Tt_pattern)tt_error_pointer( status );
		}
	}
	fuse = (caddr_t)0;
	return pat;
}
Exemplo n.º 10
0
//
// Parse {GS}et_XInfo request, pass it to user callback,
// and optionally fill in and send the reply.
//
static Tt_message
_ttdt_XInfo_out_cb(
	Tt_message	msg,
	Tt_pattern	pat,
	void	       *clientCB,
	void	       *clientData
)
{
	_TttkItem2Free fuse = msg;
	char *display = _tttk_message_arg_val( msg, 0, 0 );
	char *_visual = _tttk_message_arg_val( msg, 1, 0 );
	int visual = _ttDtVisual( _visual );
	tt_free( _visual );
	int depth = _tttk_message_arg_ival( msg, 2, 1 );
	Ttdt_XInfo_out_cb _cb = (Ttdt_XInfo_out_cb)clientCB;
	msg = (*_cb)( msg, clientData, _tttk_pattern_contract( pat ),
		      &display, &visual, &depth );
	Tt_status status = tt_ptr_error( msg );
	if ((status != TT_OK) || (msg == 0)) {
		// user already replied or failed, and destroyed
		fuse = (caddr_t)0;
		return msg;
	}
	tt_message_arg_val_set( msg, 0, display );
	tt_message_arg_val_set( msg, 1, _ttDtVisualString( visual ));
	tt_message_arg_ival_set( msg, 2, depth );
	status = _tttk_message_reply( msg );
	if (status != TT_OK) {
		return (Tt_message)tt_error_pointer( status );
	}
	return 0;
}
Exemplo n.º 11
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;
}
Exemplo n.º 12
0
/*************************************************
 *
 * 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);
	}
    }
}
Exemplo n.º 13
0
/******************************************************************************
 *
 * Shutdown Tooltalk connection.
 *
 *****************************************************************************/
void DetachFromTooltalk(
    unsigned long *nocare1)     /* if Xt - XtInputId *id; */
{
    char *sessid;

    if (dtSvcProcIdG) {
	/*
	 * NULL the global to indicate that we no longer want to
	 * chit-chat with Tooltalk.
	 */
	dtSvcProcIdG = (char *) NULL;

	sessid = tt_default_session();
	tt_session_quit(sessid);
	tt_free(sessid);
	tt_close();
    }

    /*
     * Unregister the Tooltalk fildes from the select mask.
     */
    if (ttfdG != -1) {
	BITCLEAR(allactivefdsG, ttfdG);
	ttfdG = -1;
    }
}
Exemplo n.º 14
0
Tt_message
SessionCallback( Tt_message msg, void * client_data, Tt_message contract )
{
  View *view = client_data;
  char *opString = tt_message_op( msg );
  Tttk_op op = tttk_string_op( opString );
  tt_free( opString );

  switch (op) {
	  int i;
      default:
	  break;
      case TTDT_QUIT:
	  if (contract == 0) {
		  tt_message_reply( msg );
		  FinalizeToolTalkSession( );
		  exit( 0 );
	  }
	  /*
	   * Instead of quitting the whole process, we are to just
	   * quit the view associated with contract.
	   */
	  if (view == 0) {
		  tttk_message_fail( msg, TT_DESKTOP_EINVAL, 0, 1 );
		  return 0;
	  }
	  CloseView( (DialogData *)view->dialog_data );
	  tt_message_reply( msg );
	  tttk_message_destroy( msg );
	  return 0;
  }
  return msg;
}
Exemplo n.º 15
0
void __worker_io(IN tt_io_ev_t *io_ev)
{
    TT_ASSERT(TT_IO_WORKER_EV_VALID(io_ev->ev));

    // the only event is TT_IO_WORKER_EXIT
    tt_free(io_ev);
    tt_thread_exit();
}
Exemplo n.º 16
0
void tt_sh_destroy(IN tt_shell_t *sh)
{
    TT_ASSERT(sh != NULL);

    tt_cli_destroy(&sh->cli);

    if (sh->arg != sh->i_arg) {
        tt_free(sh->arg);
    }
}
Exemplo n.º 17
0
Tt_message
FileCallback(
	Tt_message msg,
	Tttk_op op,
	char * file,
	void * clientdata,
	int trust,
	int self)
{
  View *view = clientdata;
  char local_host[MAXHOSTNAMELEN];
  extern char home_host_name[];

  switch (op) {
	  char *to_file;
	  DialogData *dialog_data;
	  int i;
      default:
	  break;
      case TTDT_MOVED:
	  if (view == 0) {
		  break;
	  }
	  to_file = tt_message_arg_val(msg, 1);
	  strcpy(local_host, home_host_name);
	  dialog_data = (DialogData *)view->dialog_data;
	  ShowNewDirectory( (FileMgrData *)dialog_data->data,
			    local_host, to_file);

	  /* Quit the old file, join the new */
	  ttdt_file_quit( view->pats, 0 );
	  view->pats = ttdt_file_join( to_file, TT_SESSION,
				       0, FileCallback, view );
	  if (tt_is_err( tt_ptr_error( view->pats ))) {
	      view->pats = 0;
          }
	  tt_free( to_file );
	  tttk_message_destroy( msg );
	  msg = 0;
  }
  tt_free( file );
  return msg;
}
Exemplo n.º 18
0
CTEST2(io, zero_index)
{
  sptensor_t * zero_tt = tt_read(DATASET(small4.tns));
  sptensor_t * one_tt  = tt_read(DATASET(small4_zeroidx.tns));

  ASSERT_EQUAL(one_tt->nnz, zero_tt->nnz);
  ASSERT_EQUAL(one_tt->nmodes, zero_tt->nmodes);

  for(idx_t m=0; m < one_tt->nmodes; ++m) {
    ASSERT_EQUAL(one_tt->dims[m], zero_tt->dims[m]);

    for(idx_t n=0; n < one_tt->nnz; ++n) {
      ASSERT_EQUAL(one_tt->ind[m][n], zero_tt->ind[m][n]);
    }
  }

  tt_free(zero_tt);
  tt_free(one_tt);
}
Exemplo n.º 19
0
void tt_fs_worker_io(IN tt_io_ev_t *io_ev)
{
    __fs_io_handler[io_ev->ev](io_ev);

    if (io_ev->src != NULL) {
        tt_task_finish(io_ev->src->fs->thread->task, io_ev);
    } else {
        tt_free(io_ev);
    }
}
Exemplo n.º 20
0
void end(B b)
{
	tt_free();
	pt_free();
	int i;
	for(i = 0; i < 64; i++) free(sqs[i]);
  free(b->superbp);
  free(b->superbs);
  free(b->pieces);
  free(b);
}	
Exemplo n.º 21
0
void __sshmsg_destroy(IN tt_sshmsg_t *msg)
{
    TT_ASSERT(msg != NULL);
    TT_ASSERT(msg->itf != NULL);

    if ((msg->itf != NULL) && (msg->itf->destroy != NULL)) {
        msg->itf->destroy(msg);
    }

    tt_buf_destroy(&msg->buf);
    tt_free(msg);
}
Exemplo n.º 22
0
Arquivo: TTFile.C Projeto: juddy/edcde
TTFile::TTFile
	(
	const CString & host, 
	const CString & path
	) : CString(), status(TT_OK)
{
    char * temp = tt_host_file_netfile(host.data(), path.data());

    if ((status = tt_ptr_error(temp)) != TT_OK)
	Throw (TT_Exception(temp));

    contents = tt_netfile_file(temp);
    tt_free(temp);

    if ((status = tt_ptr_error(contents)) != TT_OK)
	Throw (TT_Exception(contents));
}
Exemplo n.º 23
0
int InitializeTooltalk(void)
{
    char * procid;
    Tt_status status;
    int fd;

    procid = tt_default_procid();
    status = tt_ptr_error(procid);
    if ((status == TT_ERR_NOMP) || (status == TT_ERR_PROCID)) {
	/*
	 * We need to try to establish a connection
	 */
	procid = tt_open();
	status = tt_ptr_error(procid);
	if (status != TT_OK) {
	    ToolTalkError("Could not connect to ToolTalk:\n%s\n", status);
	    return (False);
	}
	tt_free(procid);

	/*
	 * Determine the Tooltalk fildes.
	 */
	fd = tt_fd();
	status = tt_int_error(fd);
	if (status != TT_OK) {
	    ToolTalkError("Could not connect to ToolTalk:\n%s\n", status);
	    tt_close();
	    ttfdG = -1;
	    return(False);
	}
	else {
	    ttfdG = fd;
	}

#ifdef DtActUseXtOverSelect
	/*
	 * Add the ToolTalk file descriptor to the set monitored by Xt
	 */
	XtAddInput(fd, (XtPointer)XtInputReadMask, input_handler, 0);
#endif /* DtActUseXtOverSelect */
    }

    return (True);
}
Exemplo n.º 24
0
/******************************************************************************
 * PUBLIC FUNCTIONS
 *****************************************************************************/
void tt_tile(
  sptensor_t * const tt,
  idx_t * dim_perm)
{
  timer_start(&timers[TIMER_TILE]);
  idx_t const nslices = tt->dims[dim_perm[0]];
  idx_t const nslabs = (nslices / TILE_SIZES[0]) +
    (nslices % TILE_SIZES[0] != 0);

  tt_sort(tt, dim_perm[0], dim_perm);

  sptensor_t * tt_buf = tt_alloc(tt->nnz, tt->nmodes);
  for(idx_t m=0; m < tt->nmodes; ++m) {
    tt_buf->dims[m] = tt->dims[m];
  }

  /* fill in slabs */
  idx_t * slabptr = p_mkslabptr(tt->ind[dim_perm[0]], tt->nnz, nslabs);

  /* seen and uniques are used to mark unique idxs in each slab */
  idx_t * seen[MAX_NMODES];
  idx_t * uniques[MAX_NMODES];
  idx_t nuniques[MAX_NMODES];
  for(idx_t m=1; m < tt->nmodes; ++m) {
    seen[dim_perm[m]]    = (idx_t *) calloc(tt->dims[dim_perm[m]], sizeof(idx_t));
    uniques[dim_perm[m]] = (idx_t *) calloc(tt->dims[dim_perm[m]], sizeof(idx_t));
  }

  /* tile each slab of nonzeros */
  for(idx_t s=0; s < nslabs; ++s) {
    idx_t const start = slabptr[s];
    idx_t const end = slabptr[s+1];

    p_pack_slab(start, end, tt, tt_buf, dim_perm, seen, uniques, nuniques);
  }

  for(idx_t m=1; m < tt->nmodes; ++m) {
    free(seen[dim_perm[m]]);
    free(uniques[dim_perm[m]]);
  }

  tt_free(tt_buf);
  free(slabptr);
  timer_stop(&timers[TIMER_TILE]);
}
Exemplo n.º 25
0
static char *get_path_from_context (
	char 		*context)
{
   char			*host = NULL;
   char			*file = NULL;
   char			*netfile = NULL;
   char			*path = NULL;
   char			tmp[MAXPATHLEN];
   char			*pch;

   /*
    * Break context into its host and file parts.
    */
   if (context == NULL)
      return (NULL);

   (void) strcpy (tmp, context);
   file = tmp;

   if ((pch = (char *) strchr (tmp, ':')) != NULL) {
      host = tmp;
      file = pch + 1;
      *pch = '\000';
   }

   if (!host)
      return (strdup (file));

   netfile = (char *) tt_host_file_netfile (host, file);
   if (tt_ptr_error (netfile) != TT_OK) {
      SPC_Error (SPC_Cannot_Create_Netfilename, context, host);
      return (NULL);
   }

   path = (char *) tt_netfile_file (netfile);
   tt_free (netfile);
   if (tt_ptr_error (path) != TT_OK) {
      SPC_Error (SPC_Cannot_Create_Netfilename, context, host);
      return (NULL);
   }

   return (path);
}
Exemplo n.º 26
0
void __logfltr_destroy(IN tt_logfltr_t *lf)
{
    tt_logio_t *lio;

    if (lf == NULL) {
        return;
    }

    if (lf->itf->destroy != NULL) {
        lf->itf->destroy(lf);
    }

    while ((lio = (tt_logio_t *)tt_ptrq_pop_head(&lf->io_q)) != NULL) {
        tt_logio_release(lio);
    }
    tt_ptrq_destroy(&lf->io_q);

    tt_free(lf);
}
Exemplo n.º 27
0
//
// Pattern callback for {GS}et_Geometry requests and Set_Geometry edicts
//
Tt_message
_ttdt_do_GSet_Geometry(
	Tt_message	msg,
	void	       *clientData,
	Tt_message	,
	int	       *width,
	int	       *height,
	int	       *xOffset,
	int	       *yOffset
)
{
	_TttkItem2Free fuse = msg;
	Widget widget = _ttdt_realized_widget( clientData );
	if (widget == 0) {
		tttk_message_fail( msg, TT_DESKTOP_ENOTSUP, 0, 0 );
		return 0;
	}
	char *ops = tt_message_op( msg );
	Tttk_op op = tttk_string_op( ops );
	tt_free( ops );
	Tt_status status;
	if ( op == TTDT_SET_GEOMETRY) {
		msg = _ttdt_do_Set_Geometry( msg, clientData, width,
					     height, xOffset, yOffset );
		status = tt_ptr_error( msg );
		if ((status != TT_OK) || (msg == 0)) {
			return msg;
		}
	}
	int x, y, w, h;
	if (! _ttXGetGeometry( widget, &w, &h, &x, &y )) {
		tttk_message_fail( msg, TT_DESKTOP_ENOTSUP, 0, 0 );
		return 0;
	}
	*width = w;
	*height = h;
	*xOffset = x;
	*yOffset = y;
	fuse = (caddr_t)0;
	return msg;
}
Exemplo n.º 28
0
tt_result_t __expand_arg(IN tt_shell_t *sh)
{
    tt_u32_t num, size;
    tt_char_t **new_arg;

    num = sh->arg_size + TT_SH_ARG_NUM;
    size = num * sizeof(tt_char_t *);
    new_arg = (tt_char_t **)tt_zalloc(size);
    if (new_arg == NULL) {
        return TT_FAIL;
    }
    tt_memcpy(new_arg, sh->arg, sh->arg_size * sizeof(tt_char_t *));

    if (sh->arg != sh->i_arg) {
        tt_free(sh->arg);
    }
    sh->arg = new_arg;
    sh->arg_size = num;

    return TT_SUCCESS;
}
Exemplo n.º 29
0
int
dtexec_tttk_message_am_handling(
        Tt_message msg
)
{
	char *handler;
	int am_handling;

        if (tt_message_class( msg ) != TT_REQUEST) {
                return 0;
        }
        if (tt_message_state( msg ) != TT_SENT) {
                return 0;
        }
        handler = tt_message_handler( msg );
        am_handling = 0;
        if ((tt_ptr_error( handler ) == TT_OK) && (handler != 0)) {
                am_handling = 1;
        }
        tt_free( handler );
        return am_handling;
}
Exemplo n.º 30
0
void tt_dns_destroy_ntv(IN ares_channel ch)
{
    __dskt_t *dskt = (__dskt_t *)ch->sock_create_cb_data;
    int n = __DSKT_NUM(ch);

    // ares_destroy() need access dskt array as it would close
    // all sockets. so ares_destroy() must be called before
    // __dskt_destroy()
    ares_destroy(ch);

    if (dskt != NULL) {
        int i;
        for (i = 0; i < n; ++i) {
            // no matter whether the dskt is in reading or writing
            // as this function is generally called when io poller
            // thread is terminated, __do_read/write/connect won't
            // be called
            __dskt_destroy(&dskt[i]);
        }

        tt_free(dskt);
    }
}