Delete trailing whitespace at end of lines.
[pspp-builds.git] / src / libpspp / getl.c
index 4a320960226d8f2db2c7ec4c43bef6a931b1376d..5a6a38d6c2b5113c4332ab1085b5548b69f04034 100644 (file)
@@ -1,6 +1,5 @@
 /* PSPP - computes sample statistics.
    Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
-   Written by Ben Pfaff <blp@gnu.org>.
 
    This program is free software; you can redistribute it and/or
    modify it under the terms of the GNU General Public License as
@@ -18,7 +17,6 @@
    02110-1301, USA. */
 
 #include <stdlib.h>
-
 #include <config.h>
 
 #include "getl.h"
 #include <libpspp/version.h>
 #include <libpspp/alloc.h>
 
-#include <data/file-name.h>
-
 struct getl_source
   {
     struct getl_source *included_from; /* File that this is nested inside. */
     struct getl_source *includes;      /* File nested inside this file. */
-    
+
     struct ll  ll;   /* Element in the sources list */
 
     struct getl_interface *interface;
   };
 
-struct source_stream 
+struct source_stream
   {
     struct ll_list sources ;  /* List of source files. */
 
@@ -62,12 +58,16 @@ current_source (const struct source_stream *ss)
 
 /* Initialize getl. */
 struct source_stream *
-create_source_stream (void)
+create_source_stream (const char *initial_include_path)
 {
   struct source_stream *ss = xzalloc (sizeof (*ss));
   ll_init (&ss->sources);
+#if 0
   ds_init_cstr (&ss->the_include_path,
                 fn_getenv_default ("STAT_INCLUDE_PATH", include_path));
+#endif
+  ds_init_cstr (&ss->the_include_path, initial_include_path);
+
   return ss;
 }
 
@@ -90,7 +90,7 @@ getl_add_include_dir (struct source_stream *ss, const char *path)
 
 /* Appends source S to the list of source files. */
 void
-getl_append_source (struct source_stream *ss, struct getl_interface *i) 
+getl_append_source (struct source_stream *ss, struct getl_interface *i)
 {
   struct getl_source *s = xzalloc (sizeof ( struct getl_source ));
 
@@ -101,7 +101,7 @@ getl_append_source (struct source_stream *ss, struct getl_interface *i)
 
 /* Nests source S within the current source file. */
 void
-getl_include_source (struct source_stream *ss, struct getl_interface *i) 
+getl_include_source (struct source_stream *ss, struct getl_interface *i)
 {
   struct getl_source *current = current_source (ss);
   struct getl_source *s = xzalloc (sizeof ( struct getl_source ));
@@ -115,14 +115,14 @@ getl_include_source (struct source_stream *ss, struct getl_interface *i)
   ll_push_head (&ss->sources, &s->ll);
 }
 
-/* Closes the current source, and move  the current source to the 
+/* Closes the current source, and move  the current source to the
    next file in the chain. */
 static void
 close_source (struct source_stream *ss)
 {
   struct getl_source *s = current_source (ss);
 
-  if ( s->interface->close ) 
+  if ( s->interface->close )
     s->interface->close (s->interface);
 
   ll_pop_head (&ss->sources);
@@ -136,13 +136,13 @@ close_source (struct source_stream *ss)
 /* Closes all sources until an interactive source is
    encountered. */
 void
-getl_abort_noninteractive (struct source_stream *ss) 
+getl_abort_noninteractive (struct source_stream *ss)
 {
   while ( ! ll_is_empty (&ss->sources))
     {
       const struct getl_source *s = current_source (ss);
-      
-      if ( !s->interface->interactive (s->interface) ) 
+
+      if ( !s->interface->interactive (s->interface) )
        close_source (ss);
     }
 }
@@ -150,17 +150,17 @@ getl_abort_noninteractive (struct source_stream *ss)
 /* Returns true if the current source is interactive,
    false otherwise. */
 bool
-getl_is_interactive (const struct source_stream *ss) 
+getl_is_interactive (const struct source_stream *ss)
 {
   const struct getl_source *s = current_source (ss);
 
-  if (ll_is_empty (&ss->sources) ) 
+  if (ll_is_empty (&ss->sources) )
     return false;
 
   return s->interface->interactive (s->interface);
 }
 
-/* Returns the name of the current source, or NULL if there is no 
+/* Returns the name of the current source, or NULL if there is no
    current source */
 const char *
 getl_source_name (const struct source_stream *ss)
@@ -170,7 +170,7 @@ getl_source_name (const struct source_stream *ss)
   if ( ll_is_empty (&ss->sources) )
     return NULL;
 
-  if ( ! s->interface->name ) 
+  if ( ! s->interface->name )
     return NULL;
 
   return s->interface->name (s->interface);