summaryrefslogtreecommitdiff
path: root/src/base
diff options
context:
space:
mode:
authorDavid Turner <david@freetype.org>1999-12-29 00:22:24 +0000
committerDavid Turner <david@freetype.org>1999-12-29 00:22:24 +0000
commit10effdf61e6ee3d35394acf58e7cdc7121798b36 (patch)
treece91b42da3252fb4f47b0bf30e1257ba4f0bf52f /src/base
parentf8bf6e2bc95e6458d5f6eec561a982df4e571e54 (diff)
Added the rules files `module.mk' to "sfnt", "truetype" and "type1" to
reflect the new modules/drivers list management performed through the file `freetype2/config/modules.mk' Changed the driver header files to reflect the new modules/drivers list management. We get rid, at last, of the infamous pre-processor tricks used to build the list at compile time. `src/base/ftinit.c' is also modified to reflect the changes..
Diffstat (limited to 'src/base')
-rw-r--r--src/base/ftdriver.h62
-rw-r--r--src/base/ftinit.c61
2 files changed, 18 insertions, 105 deletions
diff --git a/src/base/ftdriver.h b/src/base/ftdriver.h
index 04cf7480..fe24f464 100644
--- a/src/base/ftdriver.h
+++ b/src/base/ftdriver.h
@@ -573,68 +573,6 @@
} FT_DriverInterface;
-
-
- /*************************************************************************/
- /* */
- /* <Struct> */
- /* FT_DriverChain */
- /* */
- /* <Description> */
- /* A very structure used exclusively by "ftinit.c" in the function */
- /* FT_Add_Default_Drivers. This function is in charge of loading the */
- /* set of "default" font drivers into each new library object. */
- /* */
- /* The set itself is determined at _compile_ time through various */
- /* macro definitions. */
- /* */
- /* <Fields> */
- /* next :: pointer to next element in driver list chain */
- /* interface :: pointer to the driver's interface */
- /* */
- typedef struct FT_DriverChain_ FT_DriverChain;
-
- struct FT_DriverChain_
- {
- const FT_DriverChain* next;
- const FT_DriverInterface* interface;
- };
-
-
-/*************************************************************************
- *
- * Here is a template of the code that should appear in each
- * font driver's _interface_ file (the one included by "ftinit.c").
- *
- * It is used to build, at compile time, a simple linked list of
- * the interfaces of the drivers which have been #included in
- * "ftinit.c". See the source code of the latter file for details
- *
- * (Note that this is only required when you want your driver included
- * in the set of default drivers loaded by FT_Init_FreeType. Other
- * drivers can still be added manually at runtime with FT_Add_Driver.
- *
- * {
- * #ifdef FTINIT_DRIVER_CHAIN
- *
- * static
- * const FT_DriverChain ftinit_<FORMAT>_driver_chain =
- * {
- * FT_INIT_LAST_DRIVER_CHAIN,
- * &<FORMAT>_driver_interface
- * };
- *
- * #undef FT_INIT_LAST_DRIVER_CHAIN
- * #define FT_INIT_LAST_DRIVER_CHAIN &ftinit_<FORMAT>_driver_chain
- *
- * #endif
- * }
- *
- * replace <FORMAT> with your driver's prefix
- *
- *************************************************************************/
-
-
#endif /* FTDRIVER_H */
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index ca754aed..56f41f60 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -48,47 +48,25 @@
************************************************************************/
#include <ftobjs.h>
-#include <ftdriver.h>
#include <ftconfig.h>
#include <ftdebug.h>
+#include <ftdriver.h>
#undef FT_COMPONENT
#define FT_COMPONENT trace_init
- /*************************************************************************/
- /* */
- /* The macros FT_SUPPORT_xxxx are defined by Makefile.lib when this file */
- /* is compiled. They come from a make variable called FTINIT_MACROS */
- /* which is updated by each driver Makefile. */
- /* */
- /* This means that when a driver isn't part of the build, ftinit.o */
- /* won't try to reference it. */
- /* */
- /*************************************************************************/
-
-#define FTINIT_DRIVER_CHAIN
-#define FT_INIT_LAST_DRIVER_CHAIN ((FT_DriverChain*) 0)
-
- /* Include the SFNT driver interface if needed */
-
-#ifdef FT_SUPPORT_SFNT
-#include "sfdriver.h"
-#endif
-
- /* Include the TrueType driver interface if needed */
-
-#ifdef FT_SUPPORT_TRUETYPE
-#include "ttdriver.h"
-#endif
-
-
- /* Include the Type1 driver interface if needed */
-
-#ifdef FT_SUPPORT_TYPE1
-#include "t1driver.h"
-#endif
+#undef FT_DRIVER
+#define FT_DRIVER(x) extern FT_DriverInterface x;
+#include <ftmodule.h>
+#undef FT_DRIVER
+#define FT_DRIVER(x) &x,
+static
+const FT_DriverInterface* ft_default_drivers[] = {
+#include <ftmodule.h>
+ 0
+};
/*************************************************************************/
/* */
@@ -104,23 +82,20 @@
EXPORT_FUNC
void FT_Default_Drivers( FT_Library library )
{
- FT_Error error;
- const FT_DriverChain* chain = FT_INIT_LAST_DRIVER_CHAIN;
+ FT_Error error;
+ const FT_DriverInterface* *cur;
- while (chain)
+ cur = ft_default_drivers;
+ while (*cur)
{
- error = FT_Add_Driver( library, chain->interface );
-
+ error = FT_Add_Driver( library, *cur );
/* notify errors, but don't stop */
if (error)
{
FT_ERROR(( "FT.Default_Drivers: cannot install `%s', error = %x\n",
- chain->interface->driver_name,
- error ));
+ (*cur)->driver_name, error ));
}
-
- chain = chain->next;
- error = 0; /* clear error */
+ cur++;
}
}