Exemple #1
0
MyMoneyMoney ReportAccount::baseCurrencyPrice(const QDate& date, bool exactDate) const
{
  // Note that whether or not the user chooses to convert to base currency, all the values
  // for a given account/category are converted to the currency for THAT account/category
  // The "Convert to base currency" tells the report to convert from the account/category
  // currency to the file's base currency.
  //
  // An example where this matters is if Category 'C' and account 'U' are in USD, but
  // Account 'J' is in JPY.  Say there are two transactions, one is US$100 from U to C,
  // the other is JPY10,000 from J to C.  Given a JPY price of USD$0.01, this means
  // C will show a balance of $200 NO MATTER WHAT the user chooses for 'convert to base
  // currency.  This confused me for a while, which is why I wrote this comment.
  //    --acejones

  DEBUG_ENTER(Q_FUNC_INFO);

  MyMoneyMoney result(1, 1);
  MyMoneyFile* file = MyMoneyFile::instance();

  if (isForeignCurrency()) {
    result = foreignCurrencyPrice(file->baseCurrency().id(), date, exactDate);
  }

  return result;
}
Exemple #2
0
int terminateBuffer(gralloc_module_t const* module,
		private_handle_t* hnd)
{
	DEBUG_ENTER();
	/*
	* If the buffer has been mapped during a lock operation, it's time
	* to un-map it. It's an error to be here with a locked buffer.
	*/

	LOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
		"[terminate] handle %p still locked (state=%08x)",
		hnd, hnd->lockState);

	if (hnd->lockState & private_handle_t::LOCK_STATE_MAPPED) {
		// this buffer was mapped, unmap it now
		if (hnd->flags & private_handle_t::PRIV_FLAGS_USES_PMEM) {
			if (hnd->pid != getpid()) {
				// ... unless it's a "master" pmem buffer, that is a buffer
				// mapped in the process it's been allocated.
				// (see gralloc_alloc_buffer())
				gralloc_unmap(module, hnd);
			}
		} else {
			gralloc_unmap(module, hnd);
		}
	}

	DEBUG_LEAVE();
	return 0;
}
Exemple #3
0
DIR *opendir(const char *name) { /* Open a directory */
  DIR *pDir = NULL;
  size_t lName;
  unsigned attr;
  char *pszWildCards = "\\*.*";
  char *pszCopy;
  DEBUG_ENTER(("opendir(\"%s\");\n", name));
  lName = strlen(name);
  if (lName == 0) {
opendir_noent:
    errno = ENOENT;
opendir_failed:
    if (!_sys_errlist[ENOTDIR][0]) _sys_errlist[ENOTDIR] = "Not a directory"; /* Workaround for the missing entry in MSVC list */
    if (pDir) free(pDir);
    DEBUG_LEAVE(("return NULL; // errno=%d - %s\n", errno, strerror(errno)));
    return NULL;
  }
  pDir = (DIR *)malloc(sizeof(DIR) + lName + 5); /* + 5 for wildcards suffix */
  if (!pDir) goto opendir_failed;
  /* Work on a copy of the directory name */
  pszCopy = (char *)(pDir + 1);
  strcpy(pszCopy, name);
  /* First change: Except for the root, Remove the trailing \s, which confuses get_file_attributes() */
  while ((lName > 1) && (name[lName-1] == '\\') && (name[lName-2] != ':')) pszCopy[--lName] = '\0';
  if (get_file_attributes(pszCopy, &attr)) goto opendir_noent;
  if (!(attr & _A_SUBDIR)) {
    errno = ENOTDIR;
    goto opendir_failed;
  }
  if (name[lName-1] == '\\') pszWildCards += 1; /* Avoid duplicating the \ */
  strcpy(pszCopy+lName, pszWildCards);
  pDir->first = 1;
  DEBUG_LEAVE(("return 0x%p;\n", pDir));
  return pDir;
}
Exemple #4
0
ReportAccount::ReportAccount(const ReportAccount& copy):
    MyMoneyAccount(copy), m_nameHierarchy(copy.m_nameHierarchy)
{
  // NOTE: I implemented the copy constructor solely for debugging reasons

  DEBUG_ENTER(Q_FUNC_INFO);
}
Exemple #5
0
ReportAccount::ReportAccount(const MyMoneyAccount& account):
    MyMoneyAccount(account)
{
  DEBUG_ENTER(Q_FUNC_INFO);
  DEBUG_OUTPUT(QString("Account %1").arg(account.id()));
  calculateAccountHierarchy();
}
Exemple #6
0
void ReportAccount::calculateAccountHierarchy()
{
  DEBUG_ENTER(Q_FUNC_INFO);

  MyMoneyFile* file = MyMoneyFile::instance();
  QString resultid = id();
  QString parentid = parentAccountId();

#ifdef DEBUG_HIDE_SENSITIVE
  m_nameHierarchy.prepend(file->account(resultid).id());
#else
  m_nameHierarchy.prepend(file->account(resultid).name());
#endif
  while (!parentid.isEmpty() && !file->isStandardAccount(parentid)) {
    // take on the identity of our parent
    resultid = parentid;

    // and try again
    parentid = file->account(resultid).parentAccountId();
#ifdef DEBUG_HIDE_SENSITIVE
    m_nameHierarchy.prepend(file->account(resultid).id());
#else
    m_nameHierarchy.prepend(file->account(resultid).name());
#endif
  }
}
Exemple #7
0
int srchnext(fileinfo *pInfo) { /* Search next matching file */
  union REGS inreg;
  union REGS outreg;

  DEBUG_ENTER(("srchnext(0x%p);\n", pInfo));

  /* Make sure the DTA is assigned before calling DOS functions 4E and 4F */
  put_dta((char *)pInfo);

  inreg.h.ah = 0x4f;

  do {
    intdos(&inreg, &outreg);

    if (CF & outreg.x.cflag) {
      DEBUG_LEAVE(("return %d; // DOS error code\n", outreg.x.ax));
      return(outreg.x.ax);
    }
  } while ((!strncmp(previousFI.fiFileName, pInfo->fiFileName, sizeof(previousFI)))
           && REPORT_WORKAROUND(("// Skipped one duplicate entry\n")));

  previousFI = *pInfo; /* Save it for the workaround for the VMWare player bug */

  DEBUG_LEAVE(("return 0;  // Success\n"));
  return 0;
}
Exemple #8
0
ReportAccount::ReportAccount(const QString& accountid):
    MyMoneyAccount(MyMoneyFile::instance()->account(accountid))
{
  DEBUG_ENTER(Q_FUNC_INFO);
  DEBUG_OUTPUT(QString("Account %1").arg(accountid));
  calculateAccountHierarchy();
}
Exemple #9
0
static int gralloc_map(gralloc_module_t const* module,
		buffer_handle_t handle,
		void** vaddr)
{
	DEBUG_ENTER();
	private_handle_t* hnd = (private_handle_t*)handle;
	if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
		size_t size = hnd->size;
#if PMEM_HACK
		size += hnd->offset;
#endif
		void* mappedAddress = mmap(0, size,
					PROT_READ|PROT_WRITE, MAP_SHARED, hnd->fd, 0);
		if (mappedAddress == MAP_FAILED) {
			LOGE("Could not mmap handle %p, fd=%d (%s)",
			handle, hnd->fd, strerror(errno));
			hnd->base = 0;
			return -errno;
		}
		hnd->base = intptr_t(mappedAddress) + hnd->offset;
		//LOGD("gralloc_map() succeeded fd=%d, off=%d, size=%d, vaddr=%p",
		//        hnd->fd, hnd->offset, hnd->size, mappedAddress);
	}
	*vaddr = (void*)hnd->base;
	DEBUG_LEAVE();
	return 0;
}
Exemple #10
0
int gralloc_unregister_buffer(gralloc_module_t const* module,
			buffer_handle_t handle)
{
	DEBUG_ENTER();
	if (private_handle_t::validate(handle) < 0)
		return -EINVAL;

	/*
	* If the buffer has been mapped during a lock operation, it's time
	* to un-map it. It's an error to be here with a locked buffer.
	* NOTE: the framebuffer is handled differently and is never unmapped.
	*/

	private_handle_t* hnd = (private_handle_t*)handle;

	LOGE_IF(hnd->lockState & private_handle_t::LOCK_STATE_READ_MASK,
		"[unregister] handle %p still locked (state=%08x)",
		hnd, hnd->lockState);

	// never unmap buffers that were created in this process
	if (hnd->pid != getpid()) {
		if (hnd->lockState & private_handle_t::LOCK_STATE_MAPPED) {
			gralloc_unmap(module, handle);
		}
		hnd->base = 0;
		hnd->lockState  = 0;
		hnd->writeOwner = 0;
	}
	DEBUG_LEAVE();
	return 0;
}
Exemple #11
0
int srch1st(char *pszFile, uint16_t wAttr, fileinfo *pInfo) { /* Search first matching file */
  union REGS inreg;
  union REGS outreg;
  struct SREGS sregs;

  DEBUG_ENTER(("srch1st(\"%s\", 0x%04X, 0x%p);\n", pszFile, wAttr, pInfo));

  /* Make sure the DTA is assigned before calling DOS functions 4E and 4F */
  put_dta((char *)pInfo);

  inreg.h.ah = 0x4e;
  inreg.x.cx = wAttr;
  inreg.x.dx = OFFSET_OF(pszFile);
  sregs.ds = SEGMENT_OF(pszFile);

  intdosx(&inreg, &outreg, &sregs);

  if (CF & outreg.x.cflag) {
    DEBUG_LEAVE(("return %d; // DOS error code\n", outreg.x.ax));
    return (int)(outreg.x.ax);
  }

  previousFI = *pInfo; /* Save it for the workaround for the VMWare player bug */

  DEBUG_LEAVE(("return 0;  // Success\n"));
  return 0;
}
void calculateExonViewHighlightBoxBorders(GtkWidget *exonView)
{
    DEBUG_ENTER("calculateExonViewHighlightBoxBorders");

    ExonViewProperties *properties = exonViewGetProperties(exonView);
    BlxViewContext *bc = bigPictureGetContext(properties->bigPicture);

    /* Get the big picture display range in dna coords */
    IntRange bpRange;
    convertDisplayRangeToDnaRange(bigPictureGetDisplayRange(properties->bigPicture), bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &bpRange);

    /* Get the detail view display range in dna coords */
    IntRange dvRange;
    GtkWidget *detailView = bigPictureGetDetailView(properties->bigPicture);
    convertDisplayRangeToDnaRange(detailViewGetDisplayRange(detailView), bc->seqType, bc->numFrames, bc->displayRev, &bc->refSeqRange, &dvRange);

    /* Calculate how many pixels from the left edge of the widget to the first base in the range. */
    const int x1 = convertBaseIdxToRectPos(dvRange.min, &properties->exonViewRect, &bpRange, TRUE, bc->displayRev, TRUE);
    const int x2 = convertBaseIdxToRectPos(dvRange.max + 1, &properties->exonViewRect, &bpRange, TRUE, bc->displayRev, TRUE);

    properties->highlightRect.x = min(x1, x2);
    properties->highlightRect.y = 0;

    properties->highlightRect.width = abs(x1 - x2);
    properties->highlightRect.height = exonView->allocation.height;

    DEBUG_EXIT("calculateExonViewHighlightBoxBorders returning");
}
Exemple #13
0
MyMoneyMoney ReportAccount::deepCurrencyPrice(const QDate& date, bool exactDate) const
{
  DEBUG_ENTER(Q_FUNC_INFO);

  MyMoneyMoney result(1, 1);
  MyMoneyFile* file = MyMoneyFile::instance();

  MyMoneySecurity undersecurity = file->security(currencyId());
  if (! undersecurity.isCurrency()) {
    const MyMoneyPrice &price = file->price(undersecurity.id(), undersecurity.tradingCurrency(), date, exactDate);
    if (price.isValid()) {
      result = price.rate(undersecurity.tradingCurrency());

      DEBUG_OUTPUT(QString("Converting under %1 to deep %2, price on %3 is %4")
                   .arg(undersecurity.name())
                   .arg(file->security(undersecurity.tradingCurrency()).name())
                   .arg(date.toString())
                   .arg(result.toDouble()));
    } else {
      DEBUG_OUTPUT(QString("No price to convert under %1 to deep %2 on %3")
                   .arg(undersecurity.name())
                   .arg(file->security(undersecurity.tradingCurrency()).name())
                   .arg(date.toString()));
      result = MyMoneyMoney();
    }
  }

  return result;
}
Exemple #14
0
int gralloc_register_buffer(gralloc_module_t const* module,
			buffer_handle_t handle)
{
	DEBUG_ENTER();
	if (private_handle_t::validate(handle) < 0)
		return -EINVAL;

	// In this implementation, we don't need to do anything here

	/* NOTE: we need to initialize the buffer as not mapped/not locked
	* because it shouldn't when this function is called the first time
	* in a new process. Ideally these flags shouldn't be part of the
	* handle, but instead maintained in the kernel or at least
	* out-of-line
	*/

	// if this handle was created in this process, then we keep it as is.
	private_handle_t* hnd = (private_handle_t*)handle;
	if (hnd->pid != getpid()) {
		hnd->base = 0;
		hnd->lockState  = 0;
		hnd->writeOwner = 0;
	}
	DEBUG_LEAVE();
	return 0;
}
Exemple #15
0
static cio_err_t on_server_close(cio_handle_t* h, cio_dispatcher_t* d, void* p)
{
  DEBUG_ENTER();

  close_tcp_socket(h->fd);

  return CIO_ERR_SUCCESS;
}
static void onSizeAllocateExonView(GtkWidget *exonView, GtkAllocation *allocation, gpointer data)
{
    DEBUG_ENTER("onSizeAllocateExonView");

    calculateExonViewBorders(exonView);

    DEBUG_EXIT("onSizeAllocateExonView returning");
}
void calculateExonViewHeight(GtkWidget *exonView)
{
    DEBUG_ENTER("calculateExonViewHeight");

    ExonViewProperties *properties = exonViewGetProperties(exonView);

    BigPictureProperties *bpProperties = bigPictureGetProperties(properties->bigPicture);
    const IntRange* const displayRange = &bpProperties->displayRange;

    BlxViewContext *bc = blxWindowGetContext(bpProperties->blxWindow);

    /* Calculate the height based on how many exon lines will actually be drawn */
    int numExons = 0;
    int maxExons = properties->expanded ? UNSET_INT : 1; /* unset means no limit */

    /* Loop through all sequences */
    GList *seqItem = bc->matchSeqs;

    for ( ; seqItem; seqItem = seqItem->next)
    {
        /* Loop through all msps */
        const BlxSequence *seq = (BlxSequence*)(seqItem->data);
        GList *mspItem = seq->mspList;

        for ( ; mspItem; mspItem = mspItem->next)
        {
            const MSP *msp = (const MSP*)(mspItem->data);

            if (showMspInExonView(msp, properties->currentStrand, bc))
            {
                const IntRange* const mspDisplayRange = mspGetDisplayRange(msp);

                if (rangesOverlap(mspDisplayRange, displayRange))
                {
                    ++numExons;
                    break; /* break inner loop and move to next sequence */
                }
            }
        }

        /* Break after we've found the maximum number of lines, if a max is specified */
        if (maxExons != UNSET_INT && numExons >= maxExons)
        {
            break;
        }
    }

    const int newHeight = (numExons * (properties->exonHeight + properties->yPad)) + (2 * properties->yPad);

    if (newHeight != properties->exonViewRect.height)
    {
        DEBUG_OUT("Setting new height = %d\n", newHeight);
        properties->exonViewRect.height = newHeight;
        gtk_widget_set_size_request(exonView, -1, properties->exonViewRect.height);
    }

    DEBUG_EXIT("calculateExonViewHeight returning");
}
DWORD WINAPI GetLongPathNameU(LPCTSTR lpShortName, LPTSTR lpBuf, DWORD nBufferLength) {
  WCHAR *pwszShortName = NULL;
  WCHAR *pwBuf = NULL;
  int n;
  int lResult;
  int lName = lstrlen(lpShortName);
  int lNameNul = lName + 1;
  int lwBuf = lNameNul + MAX_PATH; /* In most cases, the long path will be shorter than MAX_PATH. If not, the buffer will be extended below. */

  DEBUG_ENTER(("GetLongPathNameU(\"%s\", %p, %d);\n", lpShortName, lpBuf, nBufferLength));

  pwszShortName = MultiByteToNewWidePath(CP_UTF8, lpShortName);
  if (!pwszShortName) {
out_of_mem:
    RETURN_INT_COMMENT(0, ("Not enough memory\n"));
  }

realloc_wBuf:
  pwBuf = GlobalAlloc(GMEM_FIXED, sizeof(WCHAR) * lwBuf);
  if (!pwBuf) {
    free(pwszShortName);
    goto out_of_mem;
  }
  lResult = (int)GetLongPathNameW(pwszShortName, pwBuf, lwBuf);
  if (lResult > lwBuf) { /* In the possible but unlikely case that the result does not fit in pwBuf, */
    GlobalFree(pwBuf);	  /* then extend the buffer and retry. */
    lwBuf = lResult;
    goto realloc_wBuf;
  }
  free(pwszShortName);	 /* We won't need this buffer anymore */
  if (!lResult) {
    GlobalFree(pwBuf);
    RETURN_INT_COMMENT(0, ("GetLongPathNameW() failed\n"));
  }

  /* nRead = UnicodeToBytes(pwStr, len, buf, bufsize); */
  n = WideCharToMultiByte(CP_UTF8,		/* CodePage, (CP_ACP, CP_OEMCP, CP_UTF8, ...) */
			  0,			/* dwFlags, */
			  pwBuf,		/* lpWideCharStr, */
			  lResult + 1,		/* cchWideChar, */
			  lpBuf,		/* lpMultiByteStr, */
			  (int)nBufferLength,	/* cbMultiByte, */
			  NULL,			/* lpDefaultChar, */
			  NULL			/* lpUsedDefaultChar */
			  );
  GlobalFree(pwBuf);
  if (!n) RETURN_INT_COMMENT(0, ("Failed to convert the Long name from Unicode\n"));
  n -= 1; /* Do not count the final NUL */

  /* Remove the long pathname \\?\ prefix, if it was not there before */
  if ((!strncmp(lpBuf, "\\\\?\\", 4)) && strncmp(lpShortName, "\\\\?\\", 4)) {
    n = TrimLongPathPrefix(lpBuf);
  }

  RETURN_INT_COMMENT(n, ("\"%s\"\n", lpBuf));
}
Exemple #19
0
EXPORT	INTERFACE	*pp_copy_interface(
	INTERFACE	*intfc)
{
	INTERFACE	*new_intfc;
	boolean		stat;
	boolean		delete_status;

	DEBUG_ENTER(pp_copy_interface)

	new_intfc = copy_interface(intfc);
	stat = (new_intfc != NULL) ? YES : NO;

	if (stat == NO)
	{
	    (void) printf("WARNING in pp_copy_interface(), "
		          "unable to copy interface");
	    if (pp_numnodes() > 1)
		(void) printf(" on processor %d\n",pp_mynode());
	    else
		(void) printf("\n");
	}

	delete_status = YES;
	if (pp_min_status(stat) == NO)
	{
	    if (stat == YES)
	    {
	    	(void) printf("WARNING in pp_copy_interface(), "
		              "unable to copy interface "
		              "on a remote processor\n");
	        delete_status = (delete_interface(new_intfc)) ? YES : NO;
		if (delete_status == NO)
		{
		    screen("ERROR in pp_copy_interface() "
			   "unable to delete interface ");
	            if (pp_numnodes() > 1)
		        screen(" on processor %d\n",pp_mynode());
	            else
		        screen("\n");
		}
	        new_intfc = NULL;
	    }
	}
	if (pp_min_status(delete_status) == NO)
	{
	    if (delete_status == YES)
	    {
	        screen("ERROR in pp_copy_interface(), unable to delete "
		       "interface on a remote processor\n");
	    }
	    clean_up(ERROR);
	}
	DEBUG_LEAVE(pp_copy_interface)
	return new_intfc;
}	/*end pp_copy_interface*/
Exemple #20
0
int fcopy(char *name2, char *name1) {
  FILE *pfs, *pfd;        /* Source & destination file pointers */
  int tocopy;             /* Number of bytes to copy in one pass */
  static char *buffer;    /* Pointer on the intermediate copy buffer */
  int err;

  DEBUG_ENTER(("fcopy(\"%s\", \"%s\");\n", name2, name1));

  if (!buffer) {
    buffer = malloc(BUFFERSIZE);    /* Allocate memory for copying */
    if (!buffer) {
      DEBUG_LEAVE(("return 1; // Out of memory for copy buffer\n"));
      return 1;
    }
  }

  pfs = fopen(name1, "rb");
  if (!pfs) {
    DEBUG_LEAVE(("return 2; // Cannot open source file\n"));
    return 2;
  }

  pfd = fopen(name2, "wb");
  if (!pfd) {
    fclose(pfs);
    DEBUG_LEAVE(("return 3; // Cannot open destination file\n"));
    return 3;
  }

  while ((tocopy = (int)fread(buffer, 1, BUFFERSIZE, pfs))) {
    if (!fwrite(buffer, tocopy, 1, pfd)) {
      fclose(pfs);
      fclose(pfd);
      DEBUG_LEAVE(("return 3; // Cannot write to destination file\n"));
      return 3;
    }
  }

  /* Flush buffers into the destination file, */
  fflush(pfd);
  /* and give the same date than the source file */

  fclose(pfs);
  fclose(pfd);

  /* 2011-05-12 Use an OS-independant method, _after_ closing the files */
  err = copydate(name2, name1);

  DEBUG_LEAVE(("return %d; // Copy successful\n", err));
  return err;
}
Exemple #21
0
static cio_err_t on_server_accept(cio_handle_t* h, cio_dispatcher_t* d, void* p)
{
  socket_fd_t new_fd;
  struct sockaddr_in inaddr;
  socklen_t addrlen;
  cio_handle_t* new_handle;
  cio_err_t err;

  DEBUG_ENTER();

  /* new connection
   */

  addrlen = sizeof(struct sockaddr_in);
  new_fd = accept(h->fd, (struct sockaddr*)&inaddr, &addrlen);
  if (socket_fd_is_invalid(new_fd))
    return CIO_ERR_SUCCESS;

  new_handle = malloc(sizeof(cio_handle_t));
  if (new_handle == NULL)
    {
      close_tcp_socket(new_fd);
      return CIO_ERR_SUCCESS;
    }

  err = cio_handle_init(new_handle,
			new_fd,
			&inaddr,
			on_client_read,
			on_client_write,
			on_client_close,
			p);

  if (cio_err_is_failure(err))
    {
      free(new_handle);
      close_tcp_socket(new_fd);
      return CIO_ERR_SUCCESS;
    }

  err = cio_dispatcher_add_handle(d, new_handle);
  if (cio_err_is_failure(err))
    {
      cio_handle_release(new_handle);
      free(new_handle);
      close_tcp_socket(new_fd);
      return CIO_ERR_SUCCESS;
    }

  return CIO_ERR_SUCCESS;
}
Exemple #22
0
static cio_err_t on_client_write(cio_handle_t* h, cio_dispatcher_t* d, void* p)
{
  int count;

  DEBUG_ENTER();

  count = send(h->fd, h->buf_out.data, cbuf_size(&h->buf_out), 0);
  if (count <= 0)
    return CIO_ERR_CLOSE;

  cbuf_pop_front(&h->buf_out, count);

  return CIO_ERR_SUCCESS;
}
/* This registers callbacks so that the given function is called on the given widget whenever the
 * greyramp changes */
void registerGreyrampCallback(GtkWidget *greyramp, GtkWidget *widget, GtkCallback func)
{
  DEBUG_ENTER("registerGreyrampCallback");

  GreyrampProperties *properties = greyrampGetProperties(greyramp);
  
  CallbackItem *callbackItem = (CallbackItem*)g_malloc(sizeof *callbackItem);
  callbackItem->widget = widget;
  callbackItem->func = func;
  
  properties->callbackItems = g_slist_append(properties->callbackItems, callbackItem);
  
  DEBUG_EXIT("registerGreyrampCallback returning ");
}
static void calculateExonViewBorders(GtkWidget *exonView)
{
    DEBUG_ENTER("calculateExonViewBorders");

    ExonViewProperties *properties = exonViewGetProperties(exonView);
    BigPictureProperties *bigPictureProperties = bigPictureGetProperties(properties->bigPicture);

    /* Calculate the size of the exon view */
    properties->exonViewRect.x = roundNearest(bigPictureProperties->charWidth * (gdouble)bigPictureProperties->leftBorderChars);
    properties->exonViewRect.width = exonView->allocation.width - properties->exonViewRect.x;

    /* Calculate the size of the highlight box */
    calculateExonViewHighlightBoxBorders(exonView);

    DEBUG_EXIT("calculateExonViewBorders returning");
}
Exemple #25
0
EXPORT	INTERFACE *f_zoom_interface(
	INTERFACE	*intfc,
	RECT_GRID	*gr,
	float		*L,	/* Lower coord of clip box */
	float		*U,	/* upper coord of clip box */
	float		**Q)	/* Rotation matrix */
{
	INTERFACE	*zoom_intfc;

	DEBUG_ENTER(f_zoom_interface)
	zoom_intfc = i_zoom_interface(intfc,gr,L,U,Q);
	copy_rect_grid(computational_grid(intfc),gr);
	rotate_and_zoom_rect_grid(computational_grid(zoom_intfc),L,U,Q);
	DEBUG_LEAVE(f_zoom_interface)
	return zoom_intfc;
}		/*end f_zoom_interface*/
Exemple #26
0
int gralloc_unlock(gralloc_module_t const* module,
		buffer_handle_t handle)
{
	DEBUG_ENTER();
	if (private_handle_t::validate(handle) < 0)
		return -EINVAL;

	private_handle_t* hnd = (private_handle_t*)handle;
	int32_t current_value, new_value;

	if (hnd->flags & private_handle_t::PRIV_FLAGS_NEEDS_FLUSH) {
		struct pmem_region region;
		int err;

		region.offset = hnd->offset;
		region.len = hnd->size;
		err = ioctl(hnd->fd, PMEM_CACHE_FLUSH, &region);
	//	LOGE_IF(err < 0, "cannot flush handle %p (offs=%x len=%x)\n",
	//		hnd, hnd->offset, hnd->size);
		hnd->flags &= ~private_handle_t::PRIV_FLAGS_NEEDS_FLUSH;
	}

	do {
		current_value = hnd->lockState;
		new_value = current_value;

		if (current_value & private_handle_t::LOCK_STATE_WRITE) {
			// locked for write
			if (hnd->writeOwner == gettid()) {
				hnd->writeOwner = 0;
				new_value &= ~private_handle_t::LOCK_STATE_WRITE;
			}
		}

		if ((new_value & private_handle_t::LOCK_STATE_READ_MASK) == 0) {
			LOGE("handle %p not locked", handle);
			return -EINVAL;
		}

		new_value--;

	} while (android_atomic_cmpxchg(current_value, new_value,
					(volatile int32_t*)&hnd->lockState));

	DEBUG_LEAVE();
	return 0;
}
Exemple #27
0
ReportAccount ReportAccount::topParent() const
{
  DEBUG_ENTER(Q_FUNC_INFO);

  MyMoneyFile* file = MyMoneyFile::instance();
  QString resultid = id();
  QString parentid = parentAccountId();

  while (!parentid.isEmpty() && !file->isStandardAccount(parentid)) {
    // take on the identity of our parent
    resultid = parentid;

    // and try again
    parentid = file->account(resultid).parentAccountId();
  }

  return ReportAccount(resultid);
}
/* Draw the exon view */
static void drawExonView(GtkWidget *exonView, GdkDrawable *drawable)
{
  DEBUG_ENTER("drawExonView");
  
  ExonViewProperties *properties = exonViewGetProperties(exonView);
  DotterContext *dc = properties->dc;

  GdkGC *gc = gdk_gc_new(drawable);

  /* Set a clip rectangle for drawing the exons and introns (because they are drawn "over the
   * edges" to make sure intron lines have the correct slope etc.) */
  gdk_gc_set_clip_origin(gc, 0, 0);
  gdk_gc_set_clip_rectangle(gc, &properties->exonViewRect);
  
  /* Draw the exons and introns. Since we could have a lot of them in the loop, extract all the
   * info we need now and pass it around so we don't have to look for this stuff each time. */
  
  DrawData drawData = {
    properties->parent,
    drawable,
    gc,
    properties->dc,
    properties->dwc,
    
    &properties->exonViewRect,
    properties->qRange,
    
    properties->yPad,
    properties->horizontal ? properties->exonViewRect.y : properties->exonViewRect.x,
    properties->exonHeight,

    properties->strand,
    properties->horizontal,
    properties->bumped,
    FALSE
  };
  
  /* Loop through all sequences, drawing all msps that are exons/introns */
  GList *seqList = dc->seqList;
  g_list_foreach(seqList, drawExonIntronItem, &drawData);

  g_object_unref(gc);
  DEBUG_EXIT("drawExonView returning ");
}
Exemple #29
0
int chdirM(const char *pszDir, UINT cp) {
  WCHAR *pwszDir;
  BOOL bDone;
  int iErr = 0;

  DEBUG_ENTER(("chdir(\"%s\");\n", pszDir));

  /* Convert the pathname to a unicode string, with the proper extension prefixes if it's longer than 260 bytes */
  pwszDir = MultiByteToNewWidePath(cp, pszDir);
  if (!pwszDir) return -1;

  bDone = SetCurrentDirectoryW(pwszDir);
  if (!bDone) {
    errno = Win32ErrorToErrno();
    iErr = -1;
  }
  free(pwszDir);
  DEBUG_QUIET_LEAVE();
  return iErr;
}
Exemple #30
0
static int gralloc_unmap(gralloc_module_t const* module,
			buffer_handle_t handle)
{
	DEBUG_ENTER();
	private_handle_t* hnd = (private_handle_t*)handle;
	if (!(hnd->flags & private_handle_t::PRIV_FLAGS_FRAMEBUFFER)) {
		void* base = (void*)hnd->base;
		size_t size = hnd->size;
#if PMEM_HACK
		base = (void*)(intptr_t(base) - hnd->offset);
		size += hnd->offset;
#endif
		//LOGD("unmapping from %p, size=%d", base, size);
		if (munmap(base, size) < 0) {
			LOGE("Could not unmap %s", strerror(errno));
		}
	}
	hnd->base = 0;
	DEBUG_LEAVE();
	return 0;
}