adding new experimental header files
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345
diff --git a/include/freetype/ftsysio.h b/include/freetype/ftsysio.h
new file mode 100644
index 0000000..da24662
--- /dev/null
+++ b/include/freetype/ftsysio.h
@@ -0,0 +1,69 @@
+#ifndef __FT_SYSTEM_IO_H__
+#define __FT_SYSTEM_IO_H__
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECT_H
+
+FT_BEGIN_HEADER
+
+ /* handle to a FT_Stream object */
+ typedef struct FT_StreamRec_* FT_Stream;
+
+ /* handle to the FT_Stream class */
+ typedef const struct FT_Stream_ClassRec_* FT_Stream_Class;
+
+ /* a method used to read data from a stream into a buffer */
+ typedef FT_ULong (*FT_Stream_ReadFunc)( FT_Stream stream,
+ FT_Byte* buffer,
+ FT_ULong size );
+
+ /* a method used to seek to a new position within a stream */
+ /* position is always relative to the start */
+ typedef FT_Error (*FT_Stream_SeekFunc)( FT_Stream stream,
+ FT_ULong pos );
+
+ /* the stream class structure + some useful macros */
+ typedef struct FT_Stream_ClassRec_
+ {
+ FT_ClassRec clazz;
+ FT_Stream_ReadFunc stream_read;
+ FT_Stream_SeekFunc stream_seek;
+
+ } FT_Stream_ClassRec;
+
+#define FT_STREAM_CLASS(x) ((FT_Stream_Class)(x))
+
+#define FT_STREAM_CLASS__READ(x) FT_STREAM_CLASS(x)->stream_read
+#define FT_STREAM_CLASS__SEEK(x) FT_STREAM_CLASS(x)->stream_seek;
+
+ /* the base FT_Stream object structure */
+ typedef struct FT_StreamRec_
+ {
+ FT_ObjectRec object;
+ FT_ULong size;
+ FT_ULong pos;
+ const FT_Byte* base;
+ const FT_Byte* cursor;
+ const FT_Byte* limit;
+
+ } FT_StreamRec;
+
+ /* some useful macros */
+#define FT_STREAM(x) ((FT_Stream)(x))
+#define FT_STREAM_P(x) ((FT_Stream*)(x))
+
+#define FT_STREAM__READ(x) FT_STREAM_CLASS__READ(FT_OBJECT__CLASS(x))
+#define FT_STREAM__SEEK(x) FT_STREAM_CLASS__SEEK(FT_OBJECT__CLASS(x))
+
+#define FT_STREAM_IS_BASED(x) ( FT_STREAM(x)->base != NULL )
+
+
+
+#if 0
+#endif
+
+ /* */
+
+FT_END_HEADER
+
+#endif /* __FT_SYSTEM_STREAM_H__ */
diff --git a/include/freetype/ftsysmem.h b/include/freetype/ftsysmem.h
new file mode 100644
index 0000000..cf58e8a
--- /dev/null
+++ b/include/freetype/ftsysmem.h
@@ -0,0 +1,67 @@
+#ifndef __FT_SYSTEM_MEMORY_H__
+#define __FT_SYSTEM_MEMORY_H__
+
+#include <ft2build.h>
+
+FT_BEGIN_HEADER
+
+ /* handle to memory structure */
+ typedef struct FT_MemoryRec_* FT_Memory;
+
+ /* a function used to allocate a new block of memory from a heap */
+ typedef FT_Pointer (*FT_Memory_AllocFunc)( FT_ULong size,
+ FT_Memory memory );
+
+ /* a function used to free a block of memory */
+ typedef void (*FT_Memory_FreeFunc) ( FT_Pointer block,
+ FT_Memory memory );
+
+ /* a function used to reallocate a given memory block to a new size */
+ typedef FT_Pointer (*FT_Memory_ReallocFunc)( FT_Pointer block,
+ FT_ULong new_size,
+ FT_ULong cur_size,
+ FT_Memory memory );
+
+ /* a function called to allocate a new structure of 'size' bytes that */
+ /* will be used for a new FT_Memory object.. */
+ /* */
+ typedef FT_Pointer (*FT_Memory_CreateFunc)( FT_UInt size,
+ FT_Pointer init_data );
+
+ /* a function used to destroy a FT_Memory object */
+ typedef void (*FT_Memory_DestroyFunc)( FT_Memory memory );
+
+ /* a structure holding the functions used to describe a given FT_Memory */
+ /* implementation.. */
+ /* */
+ typedef struct FT_Memory_FuncsRec_
+ {
+ FT_Memory_AllocFunc mem_alloc;
+ FT_Memory_FreeFunc mem_free;
+ FT_Memory_ReallocFunc mem_realloc;
+ FT_Memory_CreateFunc mem_create;
+ FT_Memory_DestroyFunc mem_destroy;
+
+ } FT_Memory_FuncsRec, *FT_Memory_Funcs;
+
+
+ /* a function used to create a new custom FT_Memory object */
+ /* */
+ FT_BASE_DEF( FT_Memory )
+ ft_memory_new( FT_Memory_Funcs mem_funcs,
+ FT_Pointer mem_init_data );
+
+ /* a function used to destroy a custom FT_Memory object */
+ FT_BASE_DEF( void )
+ ft_memory_destroy( FT_Memory memory );
+
+ /* a pointer to the default memory functions used by FreeType in a */
+ /* given build. By default, uses the ISO C malloc/free/realloc */
+ /* */
+ FT_APIVAR( const FT_MemoryFuncs ) ft_memory_funcs_default;
+
+/* */
+
+FT_END_HEADER
+
+#endif /* __FT_SYSTEM_MEMORY_H__ */
diff --git a/include/freetype/internal/ftexcept.h b/include/freetype/internal/ftexcept.h
new file mode 100644
index 0000000..36f1713
--- /dev/null
+++ b/include/freetype/internal/ftexcept.h
@@ -0,0 +1,83 @@
+#ifndef __FT_EXCEPT_H__
+#define __FT_EXCEPT_H__
+
+#include <ft2build.h>
+#include FT_INTERNAL_OBJECTS_H
+
+FT_BEGIN_HEADER
+
+ typedef struct FT_XHandlerRec_* FT_XHandler;
+
+ typedef struct FT_XHandlerRec_
+ {
+ FT_XHandler previous;
+ ft_jmp_buf jump_buffer;
+ volatile FT_Error error;
+ FT_Pointer cleanup;
+
+ } FT_XHandlerRec;
+
+
+ typedef void (*FT_CleanupFunc)( FT_Pointer item,
+ FT_Pointer item_data );
+
+
+/* the size of a cleanup chunk in bytes is FT_CLEANUP_CHUNK_SIZE*12 + 4 */
+/* this must be a small power of 2 whenever possible.. */
+/* */
+/* with a value of 5, we have a byte size of 64 bytes per chunk.. */
+/* */
+#define FT_CLEANUP_CHUNK_SIZE 5
+
+
+
+ typedef struct FT_CleanupItemRec_
+ {
+ FT_Pointer item;
+ FT_CleanupFunc item_func;
+ FT_Pointer item_data;
+
+ } FT_CleanupItemRec;
+
+ typedef struct FT_CleanupChunkRec_* FT_CleanupChunk;
+
+ typedef struct FT_CleanupChunkRec_
+ {
+ FT_CleanupChunk link;
+ FT_CleanupItemRec items[ FT_CLEANUP_CHUNK_SIZE ];
+
+ } FT_CleanupChunkRec;
+
+
+ typedef struct FT_CleanupStackRec_
+ {
+ FT_CleanupItem top;
+ FT_CleanupChunk chunk;
+ FT_Memory memory;
+
+ } FT_CleanupStackRec, *FT_CleanupStack;
+
+
+ FT_BASE_DEF( void )
+ ft_cleanup_stack_push( FT_CleanupStack stack,
+ FT_Pointer item,
+ FT_CleanupFunc item_func,
+ FT_Pointer item_data );
+
+ FT_BASE_DEF( void )
+ ft_cleanup_stack_pop( FT_CleanupStack stack,
+ FT_Int destroy );
+
+ FT_BASE_DEF( FT_Pointer )
+ ft_cleanup_stack_peek( FT_CleanupStack stack );
+
+ FT_BASE_DEF( void )
+ ft_xhandler_enter( FT_XHandler xhandler,
+ FT_Memory memory );
+
+ FT_BASE_DEF( void )
+ ft_xhandler_exit( FT_XHandler xhandler );
+
+FT_END_HEADER
+
+#endif /* __FT_EXCEPT_H__ */
diff --git a/include/freetype/internal/ftobject.h b/include/freetype/internal/ftobject.h
new file mode 100644
index 0000000..d830ccd
--- /dev/null
+++ b/include/freetype/internal/ftobject.h
@@ -0,0 +1,102 @@
+#ifndef __FT_OBJECT_H__
+#define __FT_OBJECT_H__
+
+#include <ft2build.h>
+#include FT_FREETYPE_H
+
+FT_BEGIN_HEADER
+
+ typedef struct FT_ObjectRec_* FT_Object;
+
+ typedef const struct FT_ClassRec_* FT_Class;
+
+ typedef const struct FT_TypeRec_* FT_Type;
+
+ typedef struct FT_ObjectRec_
+ {
+ FT_Class clazz;
+ FT_Int ref_count;
+
+ } FT_ObjectRec;
+
+#define FT_OBJECT(x) ((FT_Object)(x))
+#define FT_OBJECT_P(x) ((FT_Object*)(x))
+
+#define FT_OBJECT__CLASS(x) FT_OBJECT(x)->clazz
+#define FT_OBJECT__REF_COUNT(x) FT_OBJECT(x)->ref_count
+#define FT_OBJECT__MEMORY(x) FT_CLASS__MEMORY(FT_OBJECT(x)->clazz)
+#define FT_OBJECT__LIBRARY(x) FT_CLASS__LIBRARY(FT_OBJECT(x)->clazz)
+
+ typedef void (*FT_Object_InitFunc)( FT_Object object,
+ FT_Pointer init_data );
+
+ typedef void (*FT_Object_DoneFunc)( FT_Object object );
+
+ typedef void (*FT_Object_CopyFunc)( FT_Object target,
+ FT_Object source );
+
+ typedef struct FT_ClassRec_
+ {
+ FT_ObjectRec object;
+ FT_UInt32 magic;
+ FT_Type type;
+ FT_Memory memory;
+ FT_Library library;
+ FT_Pointer info;
+ FT_Pointer data;
+
+ FT_UInt obj_size;
+ FT_Object_InitFunc obj_init;
+ FT_Object_DoneFunc obj_done;
+ FT_Object_CopyFunc obj_copy;
+
+ } FT_ClassRec;
+
+#define FT_CLASS(x) ((FT_Class)(x))
+#define FT_CLASS_P(x) ((FT_Class*)(x))
+
+#define FT_CLASS__MEMORY(x) FT_CLASS(x)->memory
+#define FT_CLASS__LIBRARY(x) FT_CLASS(x)->library
+#define FT_CLASS__MAGIC(x) FT_CLASS(x)->magic
+#define FT_CLASS__TYPE(x) FT_CLASS(x)->type
+#define FT_CLASS__DATA(x) FT_CLASS(x)->data
+#define FT_CLASS__INFO(x) FT_CLASS(x)->info
+
+ typedef struct FT_TypeRec_
+ {
+ const char* name;
+ FT_Type super;
+
+ FT_UInt class_size;
+ FT_Object_InitFunc class_init;
+ FT_Object_DoneFunc class_done;
+
+ FT_UInt obj_size;
+ FT_Object_InitFunc obj_init;
+ FT_Object_DoneFunc obj_done;
+ FT_Object_CopyFunc obj_copy;
+
+ } FT_TypeRec;
+
+#define FT_TYPE(x) ((FT_Type)(x))
+
+
+ /* check that a handle points to a valid object */
+ FT_BASE_DEF( FT_Int )
+ ft_object_check( FT_Pointer obj );
+
+
+ /* check that an object is of a given class */
+ FT_BASE_DEF( FT_Int )
+ ft_object_is_a( FT_Pointer obj,
+ FT_Class clazz );
+
+
+ FT_BASE_DEF( FT_Object )
+ ft_object_new( FT_Class clazz,
+ FT_Pointer init_data );
+
+
+FT_END_HEADER
+
+#endif /* __FT_OBJECT_H__ */