Example #1
0
void
FreeMenuList(struct MenuSpecial *ms)
{
	struct MenuItem *item, *next, *stop, *special = ms->ms_Item;
	APTR parent = ms->ms_Parent;
	UBYTE  type = ms->ms_Type;

	if (!parent || !special)
		return;

	stop = special->NextItem;

	if (type == MST_FIRSTITEM) {
		item = ((struct Menu *)parent)->FirstItem;
		((struct Menu *)parent)->FirstItem = special;
	} else if (type == MST_FIRSTSUBITEM) {
		item = ((struct MenuItem *)parent)->SubItem;
		((struct MenuItem *)parent)->SubItem = special;
	} else {
		item = ((struct MenuItem *)parent)->NextItem;
		((struct MenuItem *)parent)->NextItem = special;
	}

	for (;item != stop; item = next) {
		next = item->NextItem;

		if (item->Flags & ITEMTEXT) {
			FreeString(((struct IntuiText *)item->ItemFill)->IText);
			FreePooled(pool, item->ItemFill, sizeof(struct IntuiText));
		}
		FreePooled(pool, item, sizeof(struct SpecialMenuItem));
	}
}
Example #2
0
void FreeLine(struct line_node* line, struct InstData *data)
{
  ENTER();

  // we make sure the line is not references by other
  // structures as well such as the global blockinfo structure.
  if(data->blockinfo.startline == line)
  {
    if(line->next)
      data->blockinfo.startline = line->next;
    else
    {
      data->blockinfo.startline = NULL;
      data->blockinfo.enabled = FALSE;
    }
  }

  if(data->blockinfo.stopline == line)
  {
    if(line->previous)
      data->blockinfo.stopline = line->previous;
    else
    {
      data->blockinfo.stopline = NULL;
      data->blockinfo.enabled = FALSE;
    }
  }

  // lets use FreePooled to free the memory of the line
  FreePooled(data->mypool, line, sizeof(struct line_node));

  LEAVE();
}
Example #3
0
	AROS_UFH4(void, AsmFreePooled,

/*  SYNOPSIS */
	AROS_UFHA(APTR,  poolHeader, A0),
	AROS_UFHA(APTR,  Memory    , A1),
	AROS_UFHA(ULONG, MemSize   , D0),
	AROS_UFHA(struct ExecBase *, SysBase, A6))

/*  FUNCTION

    INPUTS

    RESULT

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO

    INTERNALS

    HISTORY

*****************************************************************************/
{
    AROS_USERFUNC_INIT
    FreePooled(poolHeader,Memory,MemSize);
    AROS_USERFUNC_EXIT
} /* AsmFreePooled */
ULONG PUBLIC IFFStreamHook(REG(a0, struct Hook *h), REG(a2, struct IFFHandle *iff), REG(a1, struct IFFStreamCmd *sc))
{
  struct IFFStreamHookData *is = h->h_Data;

  switch(sc->sc_Command)
  {
    case IFFCMD_INIT:
      if (!is)
        return(-1L);

      is->is_Position = 0;
      break;
    case IFFCMD_CLEANUP:
      break;
    case IFFCMD_READ:
      CopyMem(is->is_Buffer+is->is_Position,sc->sc_Buf,sc->sc_NBytes);
      is->is_Position += sc->sc_NBytes;
      break;
    case IFFCMD_WRITE:
      if (is->is_Position+sc->sc_NBytes > is->is_Size)
      {
        APTR  temp;
        ULONG size = is->is_Size;

        for(;sc->sc_NBytes+is->is_Position > size;size += BUFFERSIZE);

        if (is->is_Pool)
          temp = AllocPooled(is->is_Pool,size);
        else
          temp = AllocMem(size,0L);

        if (!temp)
          return(-1);

        if (is->is_Buffer)
        {
          if (is->is_Position)
            CopyMem(is->is_Buffer,temp,is->is_Position);

          if (is->is_Pool)
            FreePooled(is->is_Pool,is->is_Buffer,is->is_Size);
          else
            FreeMem(is->is_Buffer,is->is_Size);

          is->is_Buffer = temp;
          is->is_Size = size;
        }
      }
      CopyMem(sc->sc_Buf,is->is_Buffer+is->is_Position,sc->sc_NBytes);
      is->is_Position += sc->sc_NBytes;
      break;
    case IFFCMD_SEEK:
      is->is_Position += sc->sc_NBytes;
      break;
  }
  if (is->is_Position < 0 || is->is_Position > is->is_Size)
    return(-1L);

  return(0L);
}
Example #5
0
void freeVecPooled(APTR pool,APTR mem)
{
  ENTER();

  FreePooled(pool,(LONG *)mem - 1,*((LONG *)mem - 1));

  LEAVE();
}
Example #6
0
/* C implementation of FreeVecPooled (see autodoc exec/AllocPooled) */
void
Free_VecPooled( APTR  poolHeader,
                APTR  memory )
{
  ULONG  *realmem = (ULONG *)memory - 1;

  FreePooled( poolHeader, realmem, *realmem );
}
Example #7
0
void ami_misc_itempool_free(APTR pool, APTR item, int size)
{
#ifdef __amigaos4__
	ItemPoolFree(pool, item);
#else
	FreePooled(pool, item, size);
#endif
}
Example #8
0
void PM_FreeVecPooled(APTR mem)
{
#if defined(__AROS__) || defined(__MORPHOS__)
	ULONG *p = (ULONG *)mem;
	p--;
	FreePooled(MemPool, p, *p);
#else	
	FreeVec(mem);
#endif
}
Example #9
0
// TetiSoft: C implementation of FreeVecPooled (see autodoc exec/AllocPooled)
void
FreeVecPooled( APTR  poolHeader,
               APTR  memory )
{
  ULONG  *realmem = (ULONG *)memory - 1;

#ifdef __GNUC__
  FreePooled( poolHeader, realmem, *realmem );
#else
 AsmFreePooled( poolHeader, realmem, *realmem, SysBase );
#endif
}
Example #10
0
VOID MyFreePooled(APTR pool, APTR mem)
{
  ULONG *memptr, length;

  ENTER();

  memptr = &((ULONG *)mem)[-1];
  length = *memptr;

  FreePooled(pool, memptr, length);

  LEAVE();
}
Example #11
0
STATIC struct Image *ImageDupPooled(APTR pool, struct Image *src)
{
    struct Image *dest;

    if (!src) return NULL;

    dest = (struct Image*)AllocPooled(pool,sizeof(struct Image));
    if (dest)
    {
	int data_size = 0;
	int plane_size;
	int i;
	int plane_pick = src->PlanePick;

	*dest = *src;
	dest->NextImage = NULL;

	/* Calc the size all used planes */
	plane_size = RASSIZE(src->Width,src->Height);
	for (i=0;i<8;i++)
	{
	    if (plane_pick & 1) data_size += plane_size;
	    plane_pick >>= 1;
	}

	if ((dest->ImageData = AllocPooled(pool,data_size)))
	{
	    memcpy(dest->ImageData,src->ImageData,data_size);
#ifdef OUTPUT_DATA
	    kprintf("plane_pick = %ld\n",src->PlanePick);
	    kprintf("width = %ld\n",src->Width);
	    kprintf("height = %ld\n",src->Height);

	    for (i=0;i<data_size;i++)
	    {
		kprintf("0x%02lx,",((unsigned char*)src->ImageData)[i]);
		if (i%16 == 15) kprintf("\n");
	    }
	     kprintf("\n");
#endif
	    return dest;
	}

	/* Something failed so we fail also */
	FreePooled(pool,dest,sizeof(struct Image));
    }
    return NULL;
}
Example #12
0
	void free (

/*  SYNOPSIS */
	void * memory)

/*  FUNCTION
	Return memory allocated with malloc() or a similar function to the
	system.

    INPUTS
	memory - The result of the previous call to malloc(), etc. or
		NULL.

    RESULT
	None.

    NOTES
        This function must not be used in a shared library or in a threaded
	application.

    EXAMPLE

    BUGS

    SEE ALSO
	malloc()

    INTERNALS

******************************************************************************/
{
    if (memory)
    {
	unsigned char *mem;
	size_t         size;

        mem = ((UBYTE *)memory) - AROS_ALIGN(sizeof(size_t));

        size = *((size_t *) mem);
        if (size == MEMALIGN_MAGIC)
            free(((void **) mem)[-1]);
        else {
            size += AROS_ALIGN(sizeof(size_t));
	    FreePooled (__startup_mempool, mem, size);
        }
    }

} /* free */
Example #13
0
PINT SetString(struct Handler *handler, TEXT **field, const TEXT *new_str)
{
   LONG error = 0;
   UPINT size;
   TEXT *str_copy = NULL, *old_str;
   PINT block_diff = 0;

   /* Allocate new string */

   size = StrSize(new_str);
   if(size > 1)
   {
      str_copy = AllocPooled(handler->muddy_pool, size);
      if(str_copy != NULL)
      {
         CopyMem(new_str, str_copy, size);
      }
      else
         error = ERROR_DISK_FULL;
   }
   else
      size = 0;

   if(error == 0)
   {
      /* Deallocate old string */

      if(size > 0)
         block_diff = MEMBLOCKS(size);
      old_str = *field;
      if(old_str != NULL)
      {
         size = StrSize(old_str);
         FreePooled(handler->muddy_pool, old_str, size);
         block_diff -= MEMBLOCKS(size);
      }

      /* Store new string */

      *field = str_copy;
   }

   /* Store error and return difference in block utilisation */

   SetIoErr(error);
   return block_diff;
}
Example #14
0
	int fclose (

/*  SYNOPSIS */
	FILE * stream)

/*  FUNCTION
	Closes a stream.

    INPUTS
	stream - Stream to close.

    RESULT
	Upon successful completion 0 is returned. Otherwise, EOF is
	returned and the global variable errno is set to indicate the
	error. In either case no further access to the stream is possible.

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO
	fopen(), open(), close()

    INTERNALS

******************************************************************************/
{
    struct PosixCIntBase *PosixCBase =
        (struct PosixCIntBase *)__aros_getbase_PosixCBase();
    FILENODE * fn;

    if (close(stream->fd) == -1)
    	return EOF;

    fn = FILE2FILENODE (stream);
    Remove ((struct Node *)fn);

    FreePooled(PosixCBase->internalpool, fn, sizeof(FILENODE));

    return 0;
} /* fclose */
Example #15
0
int main()
{
    struct timeval  tv_start, 
                    tv_end;
    int             count   = 100000000;
    double          elapsed = 0.0;
    int             i;
    APTR            pool;
    APTR            memory;
    
    pool = CreatePool(MEMF_ANY, 4 * 100, 100);
    AllocPooled(pool, 100); // Avoid bad behaviour of FreePooled()
    
    gettimeofday(&tv_start, NULL);
    
    for(i = 0; i < count; i++)
    {    
        memory = AllocPooled(pool, 100);
        if (memory) FreePooled(pool, memory, 100);
    }
    
    gettimeofday(&tv_end, NULL);
    
    DeletePool(pool);
    
    elapsed = ((double)(((tv_end.tv_sec * 1000000) + tv_end.tv_usec) 
            - ((tv_start.tv_sec * 1000000) + tv_start.tv_usec)))/1000000.;
    
    printf
    (
        "Elapsed time:           %f seconds\n"
        "Number of allocations:  %d\n"
        "Allocations per second: %f\n"
        "Seconds per allocation: %f\n",
        elapsed, count, (double) count / elapsed, (double) elapsed / count
    );
   
    return 0;
}
Example #16
0
/*
 *	See if the mouse is located on a hyperlink and,
 *	if so, run it.
 */
BOOL RunHyperlink( LPCLASSDATA lpcd )
{
	/*
	 *	Get the hyperlink at the current mouse
	 *	position.
	 */
	TCHAR *pszLink = GetHyperlink( lpcd );
 
  // Modified by Stephan (2005-05-28)
	if ( pszLink )
	{
    // If it is not a URL
    if (!_tcsnicmp(pszLink, _T("c:\\"), 3) || !_tcsnicmp(pszLink, _T("d:\\"), 3) || 
        !_tcsnicmp(pszLink, _T("\\\\"), 2) || !_tcsnicmp(pszLink, _T("%"), 1))
    {
      TCHAR szAliasFolder[MAX_PATH], szPath[MAX_PATH];
      TCHAR szModuleFileName[MAX_PATH];
      TCHAR szExecParams[MAX_PATH];
      LPTSTR pszLinkNoAlias = pszLink;

      // Resolve aliases
      szAliasFolder[0] = 0;
      if (!_tcsnicmp(pszLink, _T("%WINDIR%"), 8))
      {
        GetWindowsDirectory(szAliasFolder, MAX_PATH);
        pszLinkNoAlias += 8;
      }
	  else if (!_tcsnicmp(pszLink, _T("C:\\Program Files (x86)\\Common"), 29))
	  {
		  _tcscpy(szAliasFolder, _T("c:\\Program Files (x86)\\Common Files"));
		  pszLinkNoAlias += 29;
	  }
	  else if (!_tcsnicmp(pszLink, _T("C:\\Program Files\\Common"), 23))
	  {
		  _tcscpy(szAliasFolder, _T("c:\\Program Files\\Common Files"));
		  pszLinkNoAlias += 23;
	  }
      else if (!_tcsnicmp(pszLink, _T("%ProgramFilesDir%"), 17))
      {
        if (GetSystemDefaultLangID() & 0x07)   // German
          _tcscpy(szAliasFolder, _T("c:\\Programme"));
        else
          _tcscpy(szAliasFolder, _T("c:\\Program Files"));
        pszLinkNoAlias += 17;
      }
      else if (!_tcsnicmp(pszLink, _T("%temp%"), 6))
      {
        GetTempPath(MAX_PATH, szAliasFolder);
        pszLinkNoAlias += 6;
      }

      // Remove :line at the end
      if (_tcschr(pszLinkNoAlias, _T(':')) != _tcsrchr(pszLinkNoAlias, _T(':')))
      {
        LPTSTR lpszSemicolon = _tcsrchr(pszLinkNoAlias, _T(':'));
        if (lpszSemicolon)
          lpszSemicolon[0] = _T('\0');
      }
      

      _stprintf(szPath, _T("%s%s"), szAliasFolder, pszLinkNoAlias);

      GetModuleFileName(NULL, szModuleFileName, MAX_PATH);
      _stprintf(szExecParams, _T("-hyperlink \"%s\""), szPath);
      
	    if (( int )ShellExecute( GetDesktopWindow(), NULL, szModuleFileName, szExecParams, 
			    NULL, SW_SHOWNORMAL ) <= 32 )
			{
		    OkIOError( lpcd, lpcd->hWnd, _T( "%s" ), szPath );
			}
    }
    // Execute URL
    else
    {
		  if (( int )ShellExecute( GetDesktopWindow(), 
				  NULL, 
				  pszLink, 
				  NULL, 
				  NULL, 
				  SW_SHOWNORMAL ) <= 32 )
			  OkIOError( lpcd, lpcd->hWnd, _T( "%s" ), pszLink );
    }

		/*
		 *	Release the url buffer.
		 */
		FreePooled( lpcd->pMemPool, pszLink );
		return TRUE;
	}
	/*
	 *	No hyperlink or memory failure...
	 */
	return FALSE;
}
Example #17
0
	void LibFreePooled (

/*  SYNOPSIS */
	APTR  pool,
	APTR  memory,
	ULONG memSize)

/*  FUNCTION

    INPUTS

    RESULT

    NOTES

    EXAMPLE

    BUGS

    SEE ALSO

    INTERNALS

    HISTORY
	06.12.96 digulla Created after original from libnix

******************************************************************************/
{
#   define poolHeader ((POOL *)pool)
    if (SysBase->LibNode.lib_Version >= 39)
    {
	FreePooled (poolHeader, memory, memSize);
	return;
    }

    if (poolHeader!=NULL && memory!=NULL)
    {
	ULONG size,
	    * puddle = (ULONG *)((struct MinNode *)memory - 1) - 1;

	if (poolHeader->ThreshSize>memSize)
	{
	    struct MemHeader * a = (struct MemHeader *)&poolHeader->PuddleList.mlh_Head;

	    for(;;)
	    {
		a = (struct MemHeader *)a->mh_Node.ln_Succ;

		if (a->mh_Node.ln_Succ == NULL)
		    return;

		if (a->mh_Node.ln_Type && memory >= a->mh_Lower
		    && memory < a->mh_Upper
		)
		    break;
	    }

	    Deallocate (a, memory, memSize);

	    if (a->mh_Free != poolHeader->PuddleSize)
		return;

	    puddle = (ULONG *)&a->mh_Node;
	}

	Remove ((struct Node *)puddle);

	size = *--puddle;
	FreeMem (puddle, size);
    }
} /* LibFreePooled */
Example #18
0
IPTR Ascii__DTM_ASYNCLAYOUT(Class *cl, Object *o, struct gpLayout *gpl)
{
    struct DTSpecialInfo 	*si = (struct DTSpecialInfo *) G (o)->SpecialInfo;
    struct AsciiData 		*data = INST_DATA (cl, o);
    ULONG 			visible = 0, total = 0;
    struct RastPort 		trp;
    ULONG 			hunit = 1;
    ULONG 			bsig = 0;

    /* Switches */
    BOOL 			linefeed = FALSE;
    BOOL 			newseg = FALSE;
    BOOL 			abort = FALSE;

    /* Attributes obtained from super-class */
    struct TextAttr 		*tattr;
    struct TextFont 		*font;
    struct List 		*linelist;
    struct IBox 		*domain;
    IPTR 			wrap = FALSE;
    IPTR 			bufferlen;
    STRPTR 			buffer;
    STRPTR 			title;

    /* Line information */
    ULONG 			num, offset, swidth;
    ULONG 			anchor = 0, newanchor;
    ULONG 			style = FS_NORMAL;
    struct Line 		*line;
    ULONG 			yoffset = 0;
    ULONG			linelength, max_linelength = 0;
    UBYTE 			fgpen = 1;
    UBYTE 			bgpen = 0;
    ULONG 			tabspace;
    ULONG 			numtabs;
    ULONG 			i;

    ULONG 			nomwidth, nomheight;

    D(bug("AsciiDataType_AsyncLayout\n"));
    
    /* Get all the attributes that we are going to need for a successful layout */
    if (GetDTAttrs (o, DTA_TextAttr	, (IPTR) &tattr		,
                       DTA_TextFont	, (IPTR) &font		,
                       DTA_Domain	, (IPTR) &domain	,
                       DTA_ObjName	, (IPTR) &title		,
                       TDTA_Buffer	, (IPTR) &buffer	,
                       TDTA_BufferLen	, (IPTR) &bufferlen	,
                       TDTA_LineList	, (IPTR) &linelist	,
                       TDTA_WordWrap	, (IPTR) &wrap		,
                       TAG_DONE) == 8)
    {
        D(bug("AsciiDataType_AsyncLayout: Got all attrs\n"));

        /* Lock the global object data so that nobody else can manipulate it */
        ObtainSemaphore (&(si->si_Lock));

        /* Make sure we have a buffer */
        if (buffer)
        {
	    D(bug("AsciiDataType_AsyncLayout: Got buffer\n"));
	    
            /* Initialize the temporary RastPort */
            InitRastPort (&trp);
            SetFont (&trp, font);

    	    D(bug("AsciiDataType_AsyncLayout: Temp RastPort initialized\n"));

            /* Calculate the nominal size */
            nomheight = (ULONG) (24 * font->tf_YSize);
            nomwidth  = (ULONG) (80 * font->tf_XSize);

	    /* Calculate the tab space */
	    tabspace = font->tf_XSize * 8;

            /* We only need to perform layout if we are doing word wrap, or this
             * is the initial layout call */

    	    D(bug("AsciiDataType_AsyncLayout: Checking if layout is needed\n"));
	    
            if (wrap || gpl->gpl_Initial)
            {
		D(bug("AsciiDataType_AsyncLayout: Layout IS needed. Freeing old LineList\n"));
		
                /* Delete the old line list */
                while ((line = (struct Line *) RemHead (linelist)))
                    FreePooled (data->Pool, line, sizeof (struct Line));

    		D(bug("AsciiDataType_AsyncLayout. Old LineList freed\n"));

                /* Step through the text buffer */
                for (i = offset = num = numtabs = 0;
                     (i < bufferlen) && (bsig == 0) && !abort;
                     i++)
                {
                    /* Convert DOS and Mac line endings */
                    if (buffer[i] == '\r')
                    {
                        if (buffer[i + 1] == '\n')
                              i++;
                        else
                            buffer[i] = '\n';
                    }

		    /* Check for end of line */
		    if (buffer[i] == '\n')
		    {
			newseg = linefeed = TRUE;
			newanchor = i + 1;
		    }
		    /* Check for end of page */
		    else if (buffer[i] == 12)
		    {
			newseg = linefeed = TRUE;
			newanchor = i + 1;
		    }
		    /* Check for tab */
		    else if (buffer[i] == '\t')
		    {
			/* See if we need to terminate a line segment */
			if ((numtabs == 0) && num)
			{
			    newseg = TRUE;
			}
			numtabs++;
		    }
		    else
		    {
			/* See if we have any TABs that we need to finish out */
			if (numtabs)
			{
			    offset += (((offset / tabspace) + 1) * tabspace) - offset;
			    num = numtabs = 0;
			    anchor = i;
			}

			/* Compute the width of the line. */
			swidth = TextLength(&trp, &buffer[anchor], num + 1);
			num++;
		    }

    	    	    if (i == bufferlen - 1) newseg = TRUE;
		    
		    /* Time for a new text segment yet? */
		    if (newseg)
		    {
			/* Allocate a new line segment from our memory pool */
			if ((line = AllocPooled(data->Pool, sizeof(struct Line))))
			{
			    swidth = TextLength(&trp, &buffer[anchor], num);
			    line->ln_Text = &buffer[anchor];
			    line->ln_TextLen = num;
			    line->ln_XOffset = offset;
			    line->ln_YOffset = yoffset + font->tf_Baseline;
			    line->ln_Width = swidth;
			    line->ln_Height = font->tf_YSize;
			    line->ln_Flags = (linefeed) ? LNF_LF : 0;
			    line->ln_FgPen = fgpen;
			    line->ln_BgPen = bgpen;
			    line->ln_Style = style;
			    line->ln_Data = NULL;

			    linelength = line->ln_Width + line->ln_XOffset;
			    if (linelength > max_linelength)
			    {
			    	max_linelength = linelength;
			    }
			    			    
			    /* Add the line to the list */
			    AddTail(linelist, (struct Node *) line);

			    /* Increment the line count */
			    if (linefeed)
			    {
				yoffset += font->tf_YSize;
				offset = 0;
				total++;
			    }
			    else
			    {
				/* Increment the offset */
				offset += swidth;
			    }
			}
			else
			{
			    abort = TRUE;
			}

			/* Clear the variables */
			newseg = linefeed = FALSE;
			anchor = newanchor;
			num = 0;

                        /* Check to see if layout has been aborted */
                        bsig = CheckSignal (SIGBREAKF_CTRL_C);
			
                    } /* if (newseg) */
		    
                }

		/*
		 * check for last line
		 */

		D(bug("AsciiDataType_AsyncLayout: end textloop, anchor %ld\n",anchor));

#if 0
		if (buffer[anchor])
		{
			linefeed=TRUE;
			D(bug("AsciiDataType_AsyncLayout: add last line <%s>\n",
				&buffer[anchor]));
			/* Allocate a new line segment from our memory pool */
			if ((line = AllocPooled(data->Pool, sizeof(struct Line))))
			{
			    swidth = TextLength(&trp, &buffer[anchor], num);
			    line->ln_Text = &buffer[anchor];
			    line->ln_TextLen = num;
			    line->ln_XOffset = offset;
			    line->ln_YOffset = yoffset + font->tf_Baseline;
			    line->ln_Width = swidth;
			    line->ln_Height = font->tf_YSize;
			    line->ln_Flags = (linefeed) ? LNF_LF : 0;
			    line->ln_FgPen = fgpen;
			    line->ln_BgPen = bgpen;
			    line->ln_Style = style;
			    line->ln_Data = NULL;

			    linelength = line->ln_Width + line->ln_XOffset;
			    if (linelength > max_linelength)
			    {
				max_linelength = linelength;
			    }
			    			    
			    /* Add the line to the list */
			    AddTail(linelist, (struct Node *) line);

			    /* Increment the line count */
			    if (linefeed)
			    {
				yoffset += font->tf_YSize;
				offset = 0;
				total++;
			    }
			    else
			    {
				/* Increment the offset */
				offset += swidth;
			    }
			}
			else
			{
			    abort = TRUE;
			}
		}
#endif
		
            } /* if (wrap || gpl->gpl_Initial) */
            else
            {
                /* No layout to perform */
                total  = si->si_TotVert;
		max_linelength = si->si_TotHoriz * si->si_HorizUnit;
            }
	    
	    DeinitRastPort(&trp);
	    
        } /* if (buffer) */

        /* Compute the lines and columns type information */
        si->si_VertUnit  = font->tf_YSize;
        si->si_VisVert   = visible = domain->Height / si->si_VertUnit;
        si->si_TotVert   = total;

/*        si->si_HorizUnit = hunit = 1;
        si->si_VisHoriz  = (LONG) domain->Width / hunit;
        si->si_TotHoriz  = domain->Width;*/
	
	si->si_HorizUnit = hunit = font->tf_XSize;
	si->si_VisHoriz  = domain->Width / hunit;
	si->si_TotHoriz  = max_linelength / hunit;
								   
        /* Release the global data lock */
        ReleaseSemaphore (&si->si_Lock);

        /* Were we aborted? */
        if (bsig == 0)
        {
            /* Not aborted, so tell the world of our newest attributes */
            NotifyAttrChanges (o, gpl->gpl_GInfo, 0,
                               GA_ID		, G(o)->GadgetID,

                               DTA_VisibleVert	, visible				,
                               DTA_TotalVert	, total					,
                               DTA_NominalVert	, nomheight				,
                               DTA_VertUnit	, font->tf_YSize			,
                            /* DTA_TopVert   	, si->si_TopVert                        , */

                               DTA_VisibleHoriz	, (domain->Width / hunit)		,
                               DTA_TotalHoriz	, max_linelength / hunit		,
                               DTA_NominalHoriz	, nomwidth				,
                               DTA_HorizUnit	, hunit					,
    	    	    	       DTA_TopHoriz 	, si->si_TopHoriz   	    	    	,
			       
                               DTA_Title	, (IPTR)title				,
                               DTA_Busy		, FALSE					,
                               DTA_Sync		, TRUE					,
                               TAG_DONE);
        } /* if (bsig == 0) */
		
    } /* if GetDTAttrs(... */

    D(bug("AsciiDataType_AsyncLayout: Done. Returning %d\n", total));
    
    return (IPTR)total;
}
Example #19
0
void AtomFree(AtomPoolT *atomPool, PtrT atom) {
  FreePooled(atomPool->pool, atom, atomPool->atomSize);
}
Example #20
0
void operator delete(void *ptr)
{
	size_t sz = *--(size_t *&)ptr;

	FreePooled(MemPool, ptr, sz);
}