Formatting; adding some tracing code.
diff --git a/src/base/ftdebug.c b/src/base/ftdebug.c
index dae2277..5fb000b 100644
--- a/src/base/ftdebug.c
+++ b/src/base/ftdebug.c
@@ -16,6 +16,31 @@
 /***************************************************************************/
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* This component contains various macros and functions used to ease the */
+  /* debugging of the FreeType engine.  Its main purpose is in assertion   */
+  /* checking, tracing, and error detection.                               */
+  /*                                                                       */
+  /* There are now three debugging modes:                                  */
+  /*                                                                       */
+  /* - trace mode                                                          */
+  /*                                                                       */
+  /*   Error and trace messages are sent to the log file (which can be the */
+  /*   standard error output).                                             */
+  /*                                                                       */
+  /* - error mode                                                          */
+  /*                                                                       */
+  /*   Only error messages are generated.                                  */
+  /*                                                                       */
+  /* - release mode:                                                       */
+  /*                                                                       */
+  /*   No error message is sent or generated.  The code is free from any   */
+  /*   debugging parts.                                                    */
+  /*                                                                       */
+  /*************************************************************************/
+
+
 #include <freetype/internal/ftdebug.h>
 
 #ifdef FT_DEBUG_LEVEL_TRACE
diff --git a/src/base/ftextend.c b/src/base/ftextend.c
index 550bf30..24d8b0e 100644
--- a/src/base/ftextend.c
+++ b/src/base/ftextend.c
@@ -27,7 +27,13 @@
 
 #include <freetype/internal/ftextend.h>
 
-/* required by the tracing mode */
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
+  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
+  /* messages during execution.                                            */
+  /*                                                                       */
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_extend
 
@@ -71,6 +77,8 @@
     registry->cur_offset     = 0;
     driver->extensions       = registry;
 
+    FT_TRACE2(( "FT_Init_Extensions: success" ));
+
     return FT_Err_Ok;
   }
 
@@ -144,6 +152,9 @@
 
       registry->num_extensions++;
       registry->cur_offset += ( cur->size + FT_ALIGNMENT-1 ) & -FT_ALIGNMENT;
+
+      FT_TRACE1(( "FT_Register_Extension: `%s' successfully registered",
+                  cur->id ));
     }
 
     return FT_Err_Ok;
@@ -192,12 +203,17 @@
         if ( strcmp( cur->id, extension_id ) == 0 )
         {
           *extension_interface = cur->interface;
+
+          FT_TRACE1(( "FT_Get_Extension: got `%s'", extension_id ));
+
           return (void*)((char*)face->extensions + cur->offset);
         }
     }
 
     /* could not find the extension id */
 
+    FT_ERROR(( "FT_Get_Extension: couldn't find `%s'", extension_id ));
+
     *extension_interface = 0;
 
     return 0;
diff --git a/src/base/ftinit.c b/src/base/ftinit.c
index c24a9c7..1c3ace6 100644
--- a/src/base/ftinit.c
+++ b/src/base/ftinit.c
@@ -42,6 +42,13 @@
 #include <freetype/internal/ftdebug.h>
 #include <freetype/internal/ftdriver.h>
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
+  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
+  /* messages during execution.                                            */
+  /*                                                                       */
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_init
 
diff --git a/src/base/ftstream.c b/src/base/ftstream.c
index e8d5b06..6f57347 100644
--- a/src/base/ftstream.c
+++ b/src/base/ftstream.c
@@ -19,6 +19,13 @@
 #include <freetype/internal/ftstream.h>
 #include <freetype/internal/ftdebug.h>
 
+
+  /*************************************************************************/
+  /*                                                                       */
+  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
+  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
+  /* messages during execution.                                            */
+  /*                                                                       */
 #undef  FT_COMPONENT
 #define FT_COMPONENT  trace_stream
 
diff --git a/src/base/ftsystem.c b/src/base/ftsystem.c
index bf02b11..f51a504 100644
--- a/src/base/ftsystem.c
+++ b/src/base/ftsystem.c
@@ -1,6 +1,6 @@
 /***************************************************************************/
 /*                                                                         */
-/*  ftsystem.h                                                             */
+/*  ftsystem.c                                                             */
 /*                                                                         */
 /*    ANSI-specific FreeType low-level system interface (body).            */
 /*                                                                         */
@@ -26,6 +26,7 @@
 
 
 #include <freetype/config/ftconfig.h>
+#include <freetype/internal/ftdebug.h>
 #include <freetype/ftsystem.h>
 #include <freetype/fterrors.h>
 #include <freetype/fttypes.h>
@@ -137,6 +138,17 @@
   /*************************************************************************/
 
 
+  /*************************************************************************/
+  /*                                                                       */
+  /* The macro FT_COMPONENT is used in trace mode.  It is an implicit      */
+  /* parameter of the FT_TRACE() and FT_ERROR() macros, used to print/log  */
+  /* messages during execution.                                            */
+  /*                                                                       */
+#undef  FT_COMPONENT
+#define FT_COMPONENT  trace_io
+
+  /* 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 )
 
 
@@ -155,6 +167,10 @@
   void  ft_close_stream( FT_Stream  stream )
   {
     fclose( STREAM_FILE( stream ) );
+
+    stream->descriptor.pointer = NULL;
+    stream->size               = 0;
+    stream->base               = 0;
   }
 
 
@@ -220,18 +236,28 @@
 
     file = fopen( filepathname, "rb" );
     if ( !file )
+    {
+      FT_ERROR(( "FT_New_Stream:" ));
+      FT_ERROR(( " could not open `%s'\n", filepathname ));
+
       return FT_Err_Cannot_Open_Resource;
+    }
 
     fseek( file, 0, SEEK_END );
     stream->size = ftell( file );
     fseek( file, 0, SEEK_SET );
 
     stream->descriptor.pointer = file;
+    stream->pathname.pointer   = (char*)filepathname;
     stream->pos                = 0;
 
     stream->read  = ft_io_stream;
     stream->close = ft_close_stream;
 
+    FT_TRACE1(( "FT_New_Stream:" ));
+    FT_TRACE1(( " opened `%s' (%d bytes) successfully\n",
+                filepathname, stream->size ));
+
     return FT_Err_Ok;
   }