|
|
|
@ -1,3 +1,31 @@ |
|
|
|
|
/***************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* ftsystem.c */ |
|
|
|
|
/* */ |
|
|
|
|
/* Amiga-specific FreeType low-level system interface (body). */ |
|
|
|
|
/* */ |
|
|
|
|
/* Copyright 1996-2001, 2002 by */ |
|
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
|
|
|
|
/* */ |
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */ |
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */ |
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
|
|
|
|
/* this file you indicate that you have read the license and */ |
|
|
|
|
/* understand and accept it fully. */ |
|
|
|
|
/* */ |
|
|
|
|
/***************************************************************************/ |
|
|
|
|
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* This file contains the Amiga interface used by FreeType to access */ |
|
|
|
|
/* low-level, i.e. memory management, i/o access as well as thread */ |
|
|
|
|
/* synchronisation. */ |
|
|
|
|
/* */ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Maintained by Detlef Würkner <TetiSoft@apg.lahn.de>
|
|
|
|
|
|
|
|
|
|
// TetiSoft: Modified to avoid fopen() fclose() fread() fseek() ftell()
|
|
|
|
|
// malloc() realloc() and free() which can't be used in an amiga
|
|
|
|
|
// shared run-time library linked with libinit.o
|
|
|
|
@ -22,79 +50,62 @@ |
|
|
|
|
/* TetiSoft: Missing in alib_protos.h, see amiga.lib autodoc
|
|
|
|
|
* (These amiga.lib functions work under AmigaOS V33 and up) |
|
|
|
|
*/ |
|
|
|
|
extern APTR __asm AsmCreatePool(register __d0 ULONG memFlags, |
|
|
|
|
register __d1 ULONG puddleSize, |
|
|
|
|
register __d2 ULONG threshSize, |
|
|
|
|
register __a6 struct ExecBase *SysBase); |
|
|
|
|
|
|
|
|
|
extern VOID __asm AsmDeletePool(register __a0 APTR poolHeader, |
|
|
|
|
register __a6 struct ExecBase *SysBase); |
|
|
|
|
|
|
|
|
|
extern APTR __asm AsmAllocPooled(register __a0 APTR poolHeader, |
|
|
|
|
register __d0 ULONG memSize, |
|
|
|
|
register __a6 struct ExecBase *SysBase); |
|
|
|
|
|
|
|
|
|
extern VOID __asm AsmFreePooled(register __a0 APTR poolHeader, |
|
|
|
|
register __a1 APTR memory, |
|
|
|
|
register __d0 ULONG memSize, |
|
|
|
|
register __a6 struct ExecBase *SysBase); |
|
|
|
|
extern APTR __asm |
|
|
|
|
AsmCreatePool( register __d0 ULONG memFlags, |
|
|
|
|
register __d1 ULONG puddleSize, |
|
|
|
|
register __d2 ULONG threshSize, |
|
|
|
|
register __a6 struct ExecBase* SysBase ); |
|
|
|
|
|
|
|
|
|
extern VOID __asm |
|
|
|
|
AsmDeletePool( register __a0 APTR poolHeader, |
|
|
|
|
register __a6 struct ExecBase* SysBase ); |
|
|
|
|
|
|
|
|
|
extern APTR __asm |
|
|
|
|
AsmAllocPooled( register __a0 APTR poolHeader, |
|
|
|
|
register __d0 ULONG memSize, |
|
|
|
|
register __a6 struct ExecBase* SysBase ); |
|
|
|
|
|
|
|
|
|
extern VOID __asm |
|
|
|
|
AsmFreePooled( register __a0 APTR poolHeader, |
|
|
|
|
register __a1 APTR memory, |
|
|
|
|
register __d0 ULONG memSize, |
|
|
|
|
register __a6 struct ExecBase* SysBase); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TetiSoft: C implementation of AllocVecPooled (see autodoc exec/AllocPooled)
|
|
|
|
|
APTR AllocVecPooled(APTR poolHeader, ULONG memSize) |
|
|
|
|
APTR |
|
|
|
|
AllocVecPooled( APTR poolHeader, |
|
|
|
|
ULONG memSize ) |
|
|
|
|
{ |
|
|
|
|
ULONG newSize = memSize + sizeof(ULONG); |
|
|
|
|
ULONG newSize = memSize + sizeof ( ULONG ); |
|
|
|
|
#ifdef __GNUC__ |
|
|
|
|
ULONG *mem = AllocPooled(poolHeader, newSize); |
|
|
|
|
ULONG *mem = AllocPooled( poolHeader, newSize ); |
|
|
|
|
#else |
|
|
|
|
ULONG *mem = AsmAllocPooled(poolHeader, newSize, SysBase); |
|
|
|
|
ULONG *mem = AsmAllocPooled( poolHeader, newSize, SysBase ); |
|
|
|
|
#endif |
|
|
|
|
|
|
|
|
|
if (!mem) |
|
|
|
|
return NULL; |
|
|
|
|
*mem = newSize; |
|
|
|
|
return mem + 1; |
|
|
|
|
if ( !mem ) |
|
|
|
|
return NULL; |
|
|
|
|
*mem = newSize; |
|
|
|
|
return mem + 1; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// TetiSoft: C implementation of FreeVecPooled (see autodoc exec/AllocPooled)
|
|
|
|
|
void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
void |
|
|
|
|
FreeVecPooled( APTR poolHeader, |
|
|
|
|
APTR memory ) |
|
|
|
|
{ |
|
|
|
|
ULONG *realmem = (ULONG *)memory - 1; |
|
|
|
|
ULONG *realmem = (ULONG *)memory - 1; |
|
|
|
|
|
|
|
|
|
#ifdef __GNUC__ |
|
|
|
|
FreePooled(poolHeader, realmem, *realmem); |
|
|
|
|
FreePooled( poolHeader, realmem, *realmem ); |
|
|
|
|
#else |
|
|
|
|
AsmFreePooled(poolHeader, realmem, *realmem, SysBase); |
|
|
|
|
AsmFreePooled( poolHeader, realmem, *realmem, SysBase ); |
|
|
|
|
#endif |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
/***************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* ftsystem.c */ |
|
|
|
|
/* */ |
|
|
|
|
/* ANSI-specific FreeType low-level system interface (body). */ |
|
|
|
|
/* */ |
|
|
|
|
/* Copyright 1996-2001 by */ |
|
|
|
|
/* David Turner, Robert Wilhelm, and Werner Lemberg. */ |
|
|
|
|
/* */ |
|
|
|
|
/* This file is part of the FreeType project, and may only be used, */ |
|
|
|
|
/* modified, and distributed under the terms of the FreeType project */ |
|
|
|
|
/* license, LICENSE.TXT. By continuing to use, modify, or distribute */ |
|
|
|
|
/* this file you indicate that you have read the license and */ |
|
|
|
|
/* understand and accept it fully. */ |
|
|
|
|
/* */ |
|
|
|
|
/***************************************************************************/ |
|
|
|
|
|
|
|
|
|
/*************************************************************************/ |
|
|
|
|
/* */ |
|
|
|
|
/* This file contains the default interface used by FreeType to access */ |
|
|
|
|
/* low-level, i.e. memory management, i/o access as well as thread */ |
|
|
|
|
/* synchronisation. It can be replaced by user-specific routines if */ |
|
|
|
|
/* necessary. */ |
|
|
|
|
/* */ |
|
|
|
|
/*************************************************************************/ |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <ft2build.h> |
|
|
|
|
#include FT_CONFIG_CONFIG_H |
|
|
|
@ -203,9 +214,9 @@ void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
/* The memory release function. */ |
|
|
|
|
/* */ |
|
|
|
|
/* <Input> */ |
|
|
|
|
/* memory :: A pointer to the memory object. */ |
|
|
|
|
/* memory :: A pointer to the memory object. */ |
|
|
|
|
/* */ |
|
|
|
|
/* block :: The address of block in memory to be freed. */ |
|
|
|
|
/* block :: The address of block in memory to be freed. */ |
|
|
|
|
/* */ |
|
|
|
|
FT_CALLBACK_DEF( void ) |
|
|
|
|
ft_free( FT_Memory memory, |
|
|
|
@ -237,7 +248,7 @@ void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
|
|
|
|
|
/* We use the macro STREAM_FILE for convenience to extract the */ |
|
|
|
|
/* system-specific stream handle from a given FreeType stream object */ |
|
|
|
|
//#define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
|
|
|
|
|
// #define STREAM_FILE( stream ) ( (FILE*)stream->descriptor.pointer )
|
|
|
|
|
#define STREAM_FILE( stream ) ( (BPTR)stream->descriptor.pointer ) // TetiSoft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -310,9 +321,9 @@ void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
FT_Stream_Open( FT_Stream stream, |
|
|
|
|
const char* filepathname ) |
|
|
|
|
{ |
|
|
|
|
// FILE* file;
|
|
|
|
|
BPTR file; // TetiSoft
|
|
|
|
|
struct FileInfoBlock *fib; // TetiSoft
|
|
|
|
|
// FILE* file;
|
|
|
|
|
BPTR file; // TetiSoft
|
|
|
|
|
struct FileInfoBlock* fib; // TetiSoft
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if ( !stream ) |
|
|
|
@ -340,9 +351,9 @@ void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
|
|
|
|
|
return FT_Err_Cannot_Open_Resource; |
|
|
|
|
} |
|
|
|
|
if (!( ExamineFH ( file, fib ))) |
|
|
|
|
if ( !( ExamineFH( file, fib ) ) ) |
|
|
|
|
{ |
|
|
|
|
FreeDosObject(DOS_FIB, fib); |
|
|
|
|
FreeDosObject( DOS_FIB, fib ); |
|
|
|
|
Close ( file ); |
|
|
|
|
FT_ERROR(( "FT_Stream_Open:" )); |
|
|
|
|
FT_ERROR(( " could not open `%s'\n", filepathname )); |
|
|
|
@ -350,7 +361,7 @@ void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
return FT_Err_Cannot_Open_Resource; |
|
|
|
|
} |
|
|
|
|
stream->size = fib->fib_Size; |
|
|
|
|
FreeDosObject(DOS_FIB, fib); |
|
|
|
|
FreeDosObject( DOS_FIB, fib ); |
|
|
|
|
|
|
|
|
|
// stream->descriptor.pointer = file;
|
|
|
|
|
stream->descriptor.pointer = (void *)file; |
|
|
|
@ -369,7 +380,6 @@ void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#ifdef FT_DEBUG_MEMORY |
|
|
|
|
|
|
|
|
|
extern FT_Int |
|
|
|
@ -393,15 +403,15 @@ void FreeVecPooled(APTR poolHeader, APTR memory) |
|
|
|
|
memory = (FT_Memory)AllocVec( sizeof ( *memory ), MEMF_PUBLIC ); |
|
|
|
|
if ( memory ) |
|
|
|
|
{ |
|
|
|
|
// memory->user = 0;
|
|
|
|
|
// memory->user = 0;
|
|
|
|
|
#ifdef __GNUC__ |
|
|
|
|
memory->user = CreatePool ( MEMF_PUBLIC, 2048, 2048 ); |
|
|
|
|
memory->user = CreatePool( MEMF_PUBLIC, 2048, 2048 ); |
|
|
|
|
#else |
|
|
|
|
memory->user = AsmCreatePool ( MEMF_PUBLIC, 2048, 2048, SysBase ); |
|
|
|
|
memory->user = AsmCreatePool( MEMF_PUBLIC, 2048, 2048, SysBase ); |
|
|
|
|
#endif |
|
|
|
|
if ( memory->user == NULL ) |
|
|
|
|
{ |
|
|
|
|
FreeVec ( memory ); |
|
|
|
|
FreeVec( memory ); |
|
|
|
|
memory = NULL; |
|
|
|
|
} |
|
|
|
|
else |
|
|
|
|