pspp-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Directory restructuring


From: Ben Pfaff
Subject: Re: Directory restructuring
Date: Sat, 04 Feb 2006 22:38:20 -0800
User-agent: Gnus/5.110004 (No Gnus v0.4) Emacs/21.4 (gnu/linux)

John Darrington <address@hidden> writes:

> Perhaps you can look at glob.c and at point 6. (above).  I think I can
> do something better with output vs. output/charts.

Here's a patch that should remove glob.c entirely.  It's also
available as:
        http://footstool.stanford.edu/~blp/reorg1.patch
or as a patched tree:
        http://footstool.stanford.edu/~blp/reorg1.tar.gz

Unfortunately I wasn't able to fully test it because your tree
doesn't build for me:

    make[4]: Entering directory `/home/blp/pspp/reorg/_build/src/language/stats'
    gcc -g -O2    ../../../../src/language/lexer/q2c.c   -o 
../../../../src/language/lexer/q2c
    ../../../../src/language/lexer/q2c.c:20:20: error: config.h: No such file 
or directory
    ../../../../src/language/lexer/q2c.c:31:17: error: str.h: No such file or 
directory
    [...]

It's kind of late here, so I'll look at #6 in the morning and, if
necessary, figure out what's going on with q2c.

diff -urpN -X pat reorg.orig/src/Makefile.am reorg/src/Makefile.am
--- reorg.orig/src/Makefile.am  2006-02-02 22:07:02.000000000 -0800
+++ reorg/src/Makefile.am       2006-02-04 22:24:05.000000000 -0800
@@ -37,8 +37,6 @@ CLEANFILES=$(q_sources_c)
 pspp_SOURCES =                                 \
        error.c                                 \
        getl.c                                  \
-       glob.c                                  \
-       glob.h                                  \
        main.c                                  \
        main.h                                  \
 vfm.c \
diff -urpN -X pat reorg.orig/src/data/dictionary.c reorg/src/data/dictionary.c
--- reorg.orig/src/data/dictionary.c    2006-02-01 19:30:54.000000000 -0800
+++ reorg/src/data/dictionary.c 2006-02-04 22:23:07.000000000 -0800
@@ -55,6 +55,9 @@ struct dictionary
     size_t vector_cnt;          /* Number of vectors. */
   };
 
+/* Active file dictionary. */
+struct dictionary *default_dict;
+
 /* Creates and returns a new dictionary. */
 struct dictionary *
 dict_create (void) 
diff -urpN -X pat reorg.orig/src/data/var.h reorg/src/data/var.h
--- reorg.orig/src/data/var.h   2006-01-28 18:41:11.000000000 -0800
+++ reorg/src/data/var.h        2006-02-04 19:58:26.000000000 -0800
@@ -146,10 +146,6 @@ extern struct dictionary *temp_dict;
    temporary. */
 extern size_t temp_trns;
 
-/* If FILTER is active, whether it was executed before or after
-   TEMPORARY. */
-extern int FILTER_before_TEMPORARY;
-
 void cancel_temporary (void);
 
 struct ccase;
diff -urpN -X pat reorg.orig/src/glob.c reorg/src/glob.c
--- reorg.orig/src/glob.c       2006-02-01 19:33:40.000000000 -0800
+++ reorg/src/glob.c    1969-12-31 16:00:00.000000000 -0800
@@ -1,62 +0,0 @@
-/* PSPP - computes sample statistics.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
-   Written by Ben Pfaff <address@hidden>.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
-
-#include <config.h>
-#include "glob.h"
-#include <time.h>
-#include "str.h"
-#include "strftime.h"
-
-/* var.h */
-struct dictionary *default_dict;
-struct expression *process_if_expr;
-
-struct transformation *t_trns;
-size_t n_trns, m_trns, f_trns;
-
-int FILTER_before_TEMPORARY;
-
-/* Functions. */
-
-static void
-get_cur_date (char cur_date[12])
-{
-  time_t now = time (NULL);
-
-  if (now != (time_t) -1) 
-    {
-      struct tm *tm = localtime (&now);
-      if (tm != NULL) 
-        {
-          strftime (cur_date, 12, "%d %b %Y", tm);
-          return;
-        }
-    }
-  strcpy (cur_date, "?? ??? 2???");
-}
-
-const char *
-get_start_date (void)
-{
-  static char start_date[12];
-
-  if (start_date[0] == '\0')
-    get_cur_date (start_date);
-  return start_date; 
-}
diff -urpN -X pat reorg.orig/src/glob.h reorg/src/glob.h
--- reorg.orig/src/glob.h       2006-02-01 19:33:35.000000000 -0800
+++ reorg/src/glob.h    1969-12-31 16:00:00.000000000 -0800
@@ -1,25 +0,0 @@
-/* PSPP - computes sample statistics.
-   Copyright (C) 1997-9, 2000 Free Software Foundation, Inc.
-   Written by Ben Pfaff <address@hidden>.
-
-   This program is free software; you can redistribute it and/or
-   modify it under the terms of the GNU General Public License as
-   published by the Free Software Foundation; either version 2 of the
-   License, or (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful, but
-   WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-   General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-   02110-1301, USA. */
-
-#if !GLOB_H
-#define GLOB_H 1
-
-const char *get_start_date (void);
-
-#endif /* glob.h */
diff -urpN -X pat reorg.orig/src/language/utilities/title.c 
reorg/src/language/utilities/title.c
--- reorg.orig/src/language/utilities/title.c   2006-02-01 19:33:42.000000000 
-0800
+++ reorg/src/language/utilities/title.c        2006-02-04 22:28:15.000000000 
-0800
@@ -24,10 +24,10 @@
 #include "command.h"
 #include "dictionary.h"
 #include "pspp-error.h"
-#include "glob.h"
 #include "lexer.h"
 #include "main.h"
 #include "output.h"
+#include "start-date.h"
 #include "var.h"
 #include "version.h"
 #include "vfm.h"
diff -urpN -X pat reorg.orig/src/language/xforms/sel-if.c 
reorg/src/language/xforms/sel-if.c
--- reorg.orig/src/language/xforms/sel-if.c     2006-02-01 19:33:41.000000000 
-0800
+++ reorg/src/language/xforms/sel-if.c  2006-02-04 22:23:39.000000000 -0800
@@ -111,12 +111,13 @@ cmd_filter (void)
        }
 
       dict_set_filter (default_dict, v);
-
-      FILTER_before_TEMPORARY = !temporary;
     }
 
   return CMD_SUCCESS;
 }
+
+/* Expression on PROCESS IF. */
+struct expression *process_if_expr;
 
 /* Parses the PROCESS IF command. */
 int
diff -urpN -X pat reorg.orig/src/libpspp/Makefile.am 
reorg/src/libpspp/Makefile.am
--- reorg.orig/src/libpspp/Makefile.am  2006-02-02 22:08:01.000000000 -0800
+++ reorg/src/libpspp/Makefile.am       2006-02-04 22:24:21.000000000 -0800
@@ -13,6 +13,7 @@ libpspp_a_SOURCES = \
        magic.c magic.h \
        misc.c misc.h \
        pool.c pool.h \
+       start-date.c start-date.h \
        str.c str.h \
        version.h
 
diff -urpN -X pat reorg.orig/src/libpspp/start-date.c 
reorg/src/libpspp/start-date.c
--- reorg.orig/src/libpspp/start-date.c 1969-12-31 16:00:00.000000000 -0800
+++ reorg/src/libpspp/start-date.c      2006-02-04 19:51:53.000000000 -0800
@@ -0,0 +1,53 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
+   Written by Ben Pfaff <address@hidden>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#include <config.h>
+#include "start-date.h"
+#include <time.h>
+#include "str.h"
+#include "strftime.h"
+
+/* Writes the current date into CUR_DATE in the format DD MMM
+   YYYY. */
+static void
+get_cur_date (char cur_date[12])
+{
+  time_t now = time (NULL);
+  if (now != (time_t) -1) 
+    {
+      struct tm *tm = localtime (&now);
+      if (tm != NULL) 
+        {
+          strftime (cur_date, 12, "%d %b %Y", tm);
+          return;
+        }
+    }
+  strcpy (cur_date, "?? ??? 2???");
+}
+
+/* Returns the date at which PSPP was started, as a string in the
+   format DD MMM YYYY. */
+const char *
+get_start_date (void)
+{
+  static char start_date[12];
+  if (start_date[0] == '\0')
+    get_cur_date (start_date);
+  return start_date; 
+}
diff -urpN -X pat reorg.orig/src/libpspp/start-date.h 
reorg/src/libpspp/start-date.h
--- reorg.orig/src/libpspp/start-date.h 1969-12-31 16:00:00.000000000 -0800
+++ reorg/src/libpspp/start-date.h      2006-02-04 22:28:38.000000000 -0800
@@ -0,0 +1,25 @@
+/* PSPP - computes sample statistics.
+   Copyright (C) 1997-9, 2000, 2006 Free Software Foundation, Inc.
+   Written by Ben Pfaff <address@hidden>.
+
+   This program is free software; you can redistribute it and/or
+   modify it under the terms of the GNU General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful, but
+   WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+   02110-1301, USA. */
+
+#ifndef START_DATE_H
+#define START_DATE_H 1
+
+const char *get_start_date (void);
+
+#endif /* start-date.h */
diff -urpN -X pat reorg.orig/src/output/ascii.c reorg/src/output/ascii.c
--- reorg.orig/src/output/ascii.c       2006-02-01 19:33:39.000000000 -0800
+++ reorg/src/output/ascii.c    2006-02-04 22:28:15.000000000 -0800
@@ -26,11 +26,11 @@
 #include "alloc.h"
 #include "pspp-error.h"
 #include "filename.h"
-#include "glob.h"
 #include "main.h"
 #include "misc.h"
 #include "output.h"
 #include "pool.h"
+#include "start-date.h"
 #include "version.h"
 
 #include "gettext.h"
diff -urpN -X pat reorg.orig/src/output/postscript.c 
reorg/src/output/postscript.c
--- reorg.orig/src/output/postscript.c  2006-02-01 19:33:41.000000000 -0800
+++ reorg/src/output/postscript.c       2006-02-04 22:27:40.000000000 -0800
@@ -40,12 +40,12 @@
 #include "font.h"
 #include "getl.h"
 #include "getline.h"
-#include "glob.h"
 #include "hash.h"
 #include "main.h"
 #include "misc.h"
 #include "output.h"
 #include "som.h"
+#include "start-date.h"
 #include "version.h"
 
 #include "gettext.h"
diff -urpN -X pat reorg.orig/src/vfm.c reorg/src/vfm.c
--- reorg.orig/src/vfm.c        2006-02-02 17:56:29.000000000 -0800
+++ reorg/src/vfm.c     2006-02-04 22:22:50.000000000 -0800
@@ -89,6 +89,10 @@ static int lag_count;                /* Number of case
 static int lag_head;           /* Index where next case will be added. */
 static struct ccase *lag_queue; /* Array of n_lag ccase * elements. */
 
+/* Active transformations. */
+struct transformation *t_trns;
+size_t n_trns, m_trns, f_trns;
+
 static void internal_procedure (int (*proc_func) (struct ccase *, void *),
                                 void *aux);
 static void update_last_vfm_invocation (void);
@@ -445,11 +449,11 @@ close_active_file (void)
 
   /* Cancel TEMPORARY, PROCESS IF, FILTER, N OF CASES, vectors,
      and get rid of all the transformations. */
+  if (dict_get_filter (temp_dict) == NULL)
+    dict_set_filter (default_dict, NULL);
   cancel_temporary ();
   expr_free (process_if_expr);
   process_if_expr = NULL;
-  if (dict_get_filter (default_dict) != NULL && !FILTER_before_TEMPORARY)
-    dict_set_filter (default_dict, NULL);
   dict_set_case_limit (default_dict, 0);
   dict_clear_vectors (default_dict);
   cancel_transformations ();

-- 
"Welcome to the Slippery Slope. Here is your handbasket.
 Say, can you work 70 hours this week?"
--Ron Mansolino




reply via email to

[Prev in Thread] Current Thread [Next in Thread]