vrshoot

diff libs/ft2static/freetype/ftsystem.h @ 0:b2f14e535253

initial commit
author John Tsiombikas <nuclear@member.fsf.org>
date Sat, 01 Feb 2014 19:58:19 +0200
parents
children
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/libs/ft2static/freetype/ftsystem.h	Sat Feb 01 19:58:19 2014 +0200
     1.3 @@ -0,0 +1,347 @@
     1.4 +/***************************************************************************/
     1.5 +/*                                                                         */
     1.6 +/*  ftsystem.h                                                             */
     1.7 +/*                                                                         */
     1.8 +/*    FreeType low-level system interface definition (specification).      */
     1.9 +/*                                                                         */
    1.10 +/*  Copyright 1996-2001, 2002, 2005, 2010 by                               */
    1.11 +/*  David Turner, Robert Wilhelm, and Werner Lemberg.                      */
    1.12 +/*                                                                         */
    1.13 +/*  This file is part of the FreeType project, and may only be used,       */
    1.14 +/*  modified, and distributed under the terms of the FreeType project      */
    1.15 +/*  license, LICENSE.TXT.  By continuing to use, modify, or distribute     */
    1.16 +/*  this file you indicate that you have read the license and              */
    1.17 +/*  understand and accept it fully.                                        */
    1.18 +/*                                                                         */
    1.19 +/***************************************************************************/
    1.20 +
    1.21 +
    1.22 +#ifndef __FTSYSTEM_H__
    1.23 +#define __FTSYSTEM_H__
    1.24 +
    1.25 +
    1.26 +#include <ft2build.h>
    1.27 +
    1.28 +
    1.29 +FT_BEGIN_HEADER
    1.30 +
    1.31 +
    1.32 +  /*************************************************************************/
    1.33 +  /*                                                                       */
    1.34 +  /* <Section>                                                             */
    1.35 +  /*   system_interface                                                    */
    1.36 +  /*                                                                       */
    1.37 +  /* <Title>                                                               */
    1.38 +  /*   System Interface                                                    */
    1.39 +  /*                                                                       */
    1.40 +  /* <Abstract>                                                            */
    1.41 +  /*   How FreeType manages memory and i/o.                                */
    1.42 +  /*                                                                       */
    1.43 +  /* <Description>                                                         */
    1.44 +  /*   This section contains various definitions related to memory         */
    1.45 +  /*   management and i/o access.  You need to understand this             */
    1.46 +  /*   information if you want to use a custom memory manager or you own   */
    1.47 +  /*   i/o streams.                                                        */
    1.48 +  /*                                                                       */
    1.49 +  /*************************************************************************/
    1.50 +
    1.51 +
    1.52 +  /*************************************************************************/
    1.53 +  /*                                                                       */
    1.54 +  /*                  M E M O R Y   M A N A G E M E N T                    */
    1.55 +  /*                                                                       */
    1.56 +  /*************************************************************************/
    1.57 +
    1.58 +
    1.59 +  /*************************************************************************
    1.60 +   *
    1.61 +   * @type:
    1.62 +   *   FT_Memory
    1.63 +   *
    1.64 +   * @description:
    1.65 +   *   A handle to a given memory manager object, defined with an
    1.66 +   *   @FT_MemoryRec structure.
    1.67 +   *
    1.68 +   */
    1.69 +  typedef struct FT_MemoryRec_*  FT_Memory;
    1.70 +
    1.71 +
    1.72 +  /*************************************************************************
    1.73 +   *
    1.74 +   * @functype:
    1.75 +   *   FT_Alloc_Func
    1.76 +   *
    1.77 +   * @description:
    1.78 +   *   A function used to allocate `size' bytes from `memory'.
    1.79 +   *
    1.80 +   * @input:
    1.81 +   *   memory ::
    1.82 +   *     A handle to the source memory manager.
    1.83 +   *
    1.84 +   *   size ::
    1.85 +   *     The size in bytes to allocate.
    1.86 +   *
    1.87 +   * @return:
    1.88 +   *   Address of new memory block.  0~in case of failure.
    1.89 +   *
    1.90 +   */
    1.91 +  typedef void*
    1.92 +  (*FT_Alloc_Func)( FT_Memory  memory,
    1.93 +                    long       size );
    1.94 +
    1.95 +
    1.96 +  /*************************************************************************
    1.97 +   *
    1.98 +   * @functype:
    1.99 +   *   FT_Free_Func
   1.100 +   *
   1.101 +   * @description:
   1.102 +   *   A function used to release a given block of memory.
   1.103 +   *
   1.104 +   * @input:
   1.105 +   *   memory ::
   1.106 +   *     A handle to the source memory manager.
   1.107 +   *
   1.108 +   *   block ::
   1.109 +   *     The address of the target memory block.
   1.110 +   *
   1.111 +   */
   1.112 +  typedef void
   1.113 +  (*FT_Free_Func)( FT_Memory  memory,
   1.114 +                   void*      block );
   1.115 +
   1.116 +
   1.117 +  /*************************************************************************
   1.118 +   *
   1.119 +   * @functype:
   1.120 +   *   FT_Realloc_Func
   1.121 +   *
   1.122 +   * @description:
   1.123 +   *   A function used to re-allocate a given block of memory.
   1.124 +   *
   1.125 +   * @input:
   1.126 +   *   memory ::
   1.127 +   *     A handle to the source memory manager.
   1.128 +   *
   1.129 +   *   cur_size ::
   1.130 +   *     The block's current size in bytes.
   1.131 +   *
   1.132 +   *   new_size ::
   1.133 +   *     The block's requested new size.
   1.134 +   *
   1.135 +   *   block ::
   1.136 +   *     The block's current address.
   1.137 +   *
   1.138 +   * @return:
   1.139 +   *   New block address.  0~in case of memory shortage.
   1.140 +   *
   1.141 +   * @note:
   1.142 +   *   In case of error, the old block must still be available.
   1.143 +   *
   1.144 +   */
   1.145 +  typedef void*
   1.146 +  (*FT_Realloc_Func)( FT_Memory  memory,
   1.147 +                      long       cur_size,
   1.148 +                      long       new_size,
   1.149 +                      void*      block );
   1.150 +
   1.151 +
   1.152 +  /*************************************************************************
   1.153 +   *
   1.154 +   * @struct:
   1.155 +   *   FT_MemoryRec
   1.156 +   *
   1.157 +   * @description:
   1.158 +   *   A structure used to describe a given memory manager to FreeType~2.
   1.159 +   *
   1.160 +   * @fields:
   1.161 +   *   user ::
   1.162 +   *     A generic typeless pointer for user data.
   1.163 +   *
   1.164 +   *   alloc ::
   1.165 +   *     A pointer type to an allocation function.
   1.166 +   *
   1.167 +   *   free ::
   1.168 +   *     A pointer type to an memory freeing function.
   1.169 +   *
   1.170 +   *   realloc ::
   1.171 +   *     A pointer type to a reallocation function.
   1.172 +   *
   1.173 +   */
   1.174 +  struct  FT_MemoryRec_
   1.175 +  {
   1.176 +    void*            user;
   1.177 +    FT_Alloc_Func    alloc;
   1.178 +    FT_Free_Func     free;
   1.179 +    FT_Realloc_Func  realloc;
   1.180 +  };
   1.181 +
   1.182 +
   1.183 +  /*************************************************************************/
   1.184 +  /*                                                                       */
   1.185 +  /*                       I / O   M A N A G E M E N T                     */
   1.186 +  /*                                                                       */
   1.187 +  /*************************************************************************/
   1.188 +
   1.189 +
   1.190 +  /*************************************************************************
   1.191 +   *
   1.192 +   * @type:
   1.193 +   *   FT_Stream
   1.194 +   *
   1.195 +   * @description:
   1.196 +   *   A handle to an input stream.
   1.197 +   *
   1.198 +   */
   1.199 +  typedef struct FT_StreamRec_*  FT_Stream;
   1.200 +
   1.201 +
   1.202 +  /*************************************************************************
   1.203 +   *
   1.204 +   * @struct:
   1.205 +   *   FT_StreamDesc
   1.206 +   *
   1.207 +   * @description:
   1.208 +   *   A union type used to store either a long or a pointer.  This is used
   1.209 +   *   to store a file descriptor or a `FILE*' in an input stream.
   1.210 +   *
   1.211 +   */
   1.212 +  typedef union  FT_StreamDesc_
   1.213 +  {
   1.214 +    long   value;
   1.215 +    void*  pointer;
   1.216 +
   1.217 +  } FT_StreamDesc;
   1.218 +
   1.219 +
   1.220 +  /*************************************************************************
   1.221 +   *
   1.222 +   * @functype:
   1.223 +   *   FT_Stream_IoFunc
   1.224 +   *
   1.225 +   * @description:
   1.226 +   *   A function used to seek and read data from a given input stream.
   1.227 +   *
   1.228 +   * @input:
   1.229 +   *   stream ::
   1.230 +   *     A handle to the source stream.
   1.231 +   *
   1.232 +   *   offset ::
   1.233 +   *     The offset of read in stream (always from start).
   1.234 +   *
   1.235 +   *   buffer ::
   1.236 +   *     The address of the read buffer.
   1.237 +   *
   1.238 +   *   count ::
   1.239 +   *     The number of bytes to read from the stream.
   1.240 +   *
   1.241 +   * @return:
   1.242 +   *   The number of bytes effectively read by the stream.
   1.243 +   *
   1.244 +   * @note:
   1.245 +   *   This function might be called to perform a seek or skip operation
   1.246 +   *   with a `count' of~0.  A non-zero return value then indicates an
   1.247 +   *   error.
   1.248 +   *
   1.249 +   */
   1.250 +  typedef unsigned long
   1.251 +  (*FT_Stream_IoFunc)( FT_Stream       stream,
   1.252 +                       unsigned long   offset,
   1.253 +                       unsigned char*  buffer,
   1.254 +                       unsigned long   count );
   1.255 +
   1.256 +
   1.257 +  /*************************************************************************
   1.258 +   *
   1.259 +   * @functype:
   1.260 +   *   FT_Stream_CloseFunc
   1.261 +   *
   1.262 +   * @description:
   1.263 +   *   A function used to close a given input stream.
   1.264 +   *
   1.265 +   * @input:
   1.266 +   *  stream ::
   1.267 +   *     A handle to the target stream.
   1.268 +   *
   1.269 +   */
   1.270 +  typedef void
   1.271 +  (*FT_Stream_CloseFunc)( FT_Stream  stream );
   1.272 +
   1.273 +
   1.274 +  /*************************************************************************
   1.275 +   *
   1.276 +   * @struct:
   1.277 +   *   FT_StreamRec
   1.278 +   *
   1.279 +   * @description:
   1.280 +   *   A structure used to describe an input stream.
   1.281 +   *
   1.282 +   * @input:
   1.283 +   *   base ::
   1.284 +   *     For memory-based streams, this is the address of the first stream
   1.285 +   *     byte in memory.  This field should always be set to NULL for
   1.286 +   *     disk-based streams.
   1.287 +   *
   1.288 +   *   size ::
   1.289 +   *     The stream size in bytes.
   1.290 +   *
   1.291 +   *   pos ::
   1.292 +   *     The current position within the stream.
   1.293 +   *
   1.294 +   *   descriptor ::
   1.295 +   *     This field is a union that can hold an integer or a pointer.  It is
   1.296 +   *     used by stream implementations to store file descriptors or `FILE*'
   1.297 +   *     pointers.
   1.298 +   *
   1.299 +   *   pathname ::
   1.300 +   *     This field is completely ignored by FreeType.  However, it is often
   1.301 +   *     useful during debugging to use it to store the stream's filename
   1.302 +   *     (where available).
   1.303 +   *
   1.304 +   *   read ::
   1.305 +   *     The stream's input function.
   1.306 +   *
   1.307 +   *   close ::
   1.308 +   *     The stream's close function.
   1.309 +   *
   1.310 +   *   memory ::
   1.311 +   *     The memory manager to use to preload frames.  This is set
   1.312 +   *     internally by FreeType and shouldn't be touched by stream
   1.313 +   *     implementations.
   1.314 +   *
   1.315 +   *   cursor ::
   1.316 +   *     This field is set and used internally by FreeType when parsing
   1.317 +   *     frames.
   1.318 +   *
   1.319 +   *   limit ::
   1.320 +   *     This field is set and used internally by FreeType when parsing
   1.321 +   *     frames.
   1.322 +   *
   1.323 +   */
   1.324 +  typedef struct  FT_StreamRec_
   1.325 +  {
   1.326 +    unsigned char*       base;
   1.327 +    unsigned long        size;
   1.328 +    unsigned long        pos;
   1.329 +
   1.330 +    FT_StreamDesc        descriptor;
   1.331 +    FT_StreamDesc        pathname;
   1.332 +    FT_Stream_IoFunc     read;
   1.333 +    FT_Stream_CloseFunc  close;
   1.334 +
   1.335 +    FT_Memory            memory;
   1.336 +    unsigned char*       cursor;
   1.337 +    unsigned char*       limit;
   1.338 +
   1.339 +  } FT_StreamRec;
   1.340 +
   1.341 +
   1.342 +  /* */
   1.343 +
   1.344 +
   1.345 +FT_END_HEADER
   1.346 +
   1.347 +#endif /* __FTSYSTEM_H__ */
   1.348 +
   1.349 +
   1.350 +/* END */