summaryrefslogtreecommitdiff
path: root/Build/source/libs/freetype/freetype-1.5/test/fterror.c
diff options
context:
space:
mode:
authorPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-20 07:45:16 +0000
committerPeter Breitenlohner <peb@mppmu.mpg.de>2009-03-20 07:45:16 +0000
commit9c241c5d2d9413361d32567876c35b2b9e2754c9 (patch)
tree754aab0f779c0c574897fb6bd6f67f9d722c9ac2 /Build/source/libs/freetype/freetype-1.5/test/fterror.c
parent207e0fee56e671a0913674ee3f71701bb9d84768 (diff)
new build system
git-svn-id: svn://tug.org/texlive/trunk@12446 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/libs/freetype/freetype-1.5/test/fterror.c')
-rw-r--r--Build/source/libs/freetype/freetype-1.5/test/fterror.c107
1 files changed, 107 insertions, 0 deletions
diff --git a/Build/source/libs/freetype/freetype-1.5/test/fterror.c b/Build/source/libs/freetype/freetype-1.5/test/fterror.c
new file mode 100644
index 00000000000..017654d562a
--- /dev/null
+++ b/Build/source/libs/freetype/freetype-1.5/test/fterror.c
@@ -0,0 +1,107 @@
+/****************************************************************************/
+/* */
+/* The FreeType project -- a free and portable quality TrueType renderer. */
+/* */
+/* Copyright 1996-2002 by E. Dieterich, A.Leca, */
+/* D. Turner, R.Wilhelm, and W. Lemberg */
+/* */
+/* fterror: test TT_ErrToString18 functionality. */
+/* */
+/* This program dumps locale-sensitive error messages. */
+/* */
+/****************************************************************************/
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include "freetype.h"
+#include "ftxerr18.h"
+
+/*
+ * Basically, an external program using FreeType shouldn't depend on an
+ * internal file of the FreeType library, especially not on ft_conf.h -- but
+ * to avoid another configure script which tests for the existence of the
+ * i18n stuff we include ft_conf.h here since we can be sure that our test
+ * programs use the same configuration options as the library itself.
+ */
+
+#include "ft_conf.h"
+
+
+#ifdef HAVE_LIBINTL_H
+
+#ifdef HAVE_LOCALE_H
+#include <locale.h>
+#endif
+
+#include <libintl.h>
+
+#else /* HAVE_LIBINTL_H */
+
+#define gettext( x ) ( x )
+
+#endif /* HAVE_LIBINTL_H */
+
+
+ static void
+ Usage( void )
+ {
+ fprintf(stderr, gettext( "fterror: test TT_ErrToString18 functionality\n\n" ) );
+ fprintf(stderr, gettext( " with an optional numerical argument, dumps the associated message.\n\n" ) );
+ exit( EXIT_FAILURE );
+ }
+
+
+ int
+ main( int argc, char** argv )
+ {
+#ifdef HAVE_LIBINTL_H
+ char* domain;
+
+
+ setlocale( LC_ALL, "" );
+ bindtextdomain( "freetype", LOCALEDIR );
+ domain = textdomain( "freetype" );
+#endif
+
+ if( argc <= 1 )
+ {
+ int i;
+#if 0
+ printf( "domain: %s\n", domain = textdomain( "" ) );
+#endif
+ printf( gettext( "Start of fterror.\n" ) );
+
+ for ( i = 0; i < 10; i++ )
+ printf( "Code: %i, %s\n", i, TT_ErrToString18( i ) );
+
+#if 0
+ printf( "domain: %s\n", domain = textdomain( "" ) );
+#endif
+ printf( gettext( "End of fterror.\n" ) );
+ }
+ else
+ {
+ int arg;
+ unsigned long cod;
+ char *end;
+
+
+ for ( arg = 1; arg < argc; ++arg )
+ {
+ cod = strtoul(argv[arg], &end, 0);
+
+ if( *end != '\0' || cod < 0 )
+ Usage();
+ printf( gettext( "Freetype error code 0x%04lX (%lu): %s\n" ),
+ cod, cod, TT_ErrToString18( cod ) );
+ }
+ }
+
+ exit( EXIT_SUCCESS ); /* for safety reasons */
+
+ return 0; /* never reached */
+ }
+
+
+/* End */