X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Fglob.c;h=9cbcc0c6761602a86316f6d538b901b3248e876a;hb=d043fde2b737897e3372670afc47eb648c17624b;hp=db3bda94ac4a7ecb05823d8c0271102b4da52dec;hpb=7b98b3a4f58f6dc5a8e9cbc188b627966d5e652d;p=pspp-builds.git diff --git a/src/glob.c b/src/glob.c index db3bda94..9cbcc0c6 100644 --- a/src/glob.c +++ b/src/glob.c @@ -19,7 +19,7 @@ #include #include "glob.h" -#include +#include "error.h" #include #include @@ -34,15 +34,6 @@ #endif #endif -#if HAVE_LIBTERMCAP -#if HAVE_TERMCAP_H -#include -#else /* !HAVE_TERMCAP_H */ -int tgetent (char *, char *); -int tgetnum (char *); -#endif /* !HAVE_TERMCAP_H */ -#endif /* !HAVE_LIBTERMCAP */ - #if HAVE_LIBHISTORY #if HAVE_READLINE_HISTORY_H #include @@ -79,6 +70,7 @@ extern void stifle_history (); #include "alloc.h" #include "command.h" +#include "dictionary.h" #include "do-ifP.h" #include "error.h" #include "expr.h" @@ -100,8 +92,6 @@ extern void stifle_history (); struct dictionary *default_dict; struct expression *process_if_expr; -struct ccase *temp_case; - struct trns_header **t_trns; int n_trns; int m_trns; @@ -111,9 +101,6 @@ int FILTER_before_TEMPORARY; struct file_handle *default_handle; -void (*read_active_file) (void); -void (*cancel_input_pgm) (void); - struct ctl_stmt *ctl_stack; /* log.h */ @@ -125,9 +112,6 @@ int logging; static void get_date (void); -#if HAVE_LIBTERMCAP -static char term_buffer[16384]; -#endif void init_glob (int argc UNUSED, char **argv) @@ -142,11 +126,8 @@ init_glob (int argc UNUSED, char **argv) textdomain (PACKAGE); #endif /* ENABLE_NLS */ - /* Workable defaults before we determine the real terminal size. */ - set_viewwidth = 79; - set_viewlength = 24; - fn_init (); + fh_init (); getl_initialize (); /* PORTME: If your system/OS has the nasty tendency to halt with a @@ -169,15 +150,10 @@ init_glob (int argc UNUSED, char **argv) /* var.h */ default_dict = dict_create (); - vec_init (&reinit_sysmis); - vec_init (&reinit_blanks); - vec_init (&init_zero); - vec_init (&init_blanks); - last_vfm_invocation = time (NULL); /* lexer.h */ - ds_init (NULL, &tokstr, 64); + ds_init (&tokstr, 64); /* common.h */ { @@ -194,123 +170,29 @@ init_glob (int argc UNUSED, char **argv) cur_proc = NULL; } - /* settings.h */ -#if !USE_INTERNAL_PAGER - { - char *pager; - - pager = getenv ("STAT_PAGER"); - if (!pager) - pager = getenv ("PAGER"); - if (pager) - set_pager = xstrdup (pager); -#if DEFAULT_PAGER - else - set_pager = xstrdup (DEFAULT_PAGER); -#endif /* DEFAULT_PAGER */ - } -#endif /* !USE_INTERNAL_PAGER */ - - set_blanks = SYSMIS; - set_scompression = 1; - set_format.type = FMT_F; - set_format.w = 8; - set_format.d = 2; - set_cpi = 6; - set_lpi = 10; - set_results_file = xstrdup ("pspp.prc"); - set_dprompt = xstrdup (_("data> ")); - - { - int i; - - for (i = 0; i < 5; i++) - { - struct set_cust_currency *cc = &set_cc[i]; - strcpy (cc->buf, "-"); - cc->neg_prefix = cc->buf; - cc->prefix = &cc->buf[1]; - cc->suffix = &cc->buf[1]; - cc->neg_suffix = &cc->buf[1]; - cc->decimal = '.'; - cc->grouping = ','; - } - } - - set_decimal = '.'; - set_grouping = ','; - set_headers = 1; - set_journaling = 1; - set_journal = xstrdup ("pspp.jnl"); - set_messages = 1; - set_mexpand = 1; - set_mprint = 1; - set_mxerrs = 50; - set_mxwarns = 100; - set_printback = 1; - set_undefined = 1; - - set_cprompt = xstrdup (" > "); - set_echo = 0; - set_endcmd = '.'; - set_errorbreak = 0; - set_include = 1; - set_nullline = 1; - set_more = 1; - set_prompt = xstrdup ("PSPP> "); - set_seed = NOT_LONG; - -#if __DJGPP__ || __BORLANDC__ - { - struct text_info ti; - gettextinfo (&ti); - set_viewlength = max (ti.screenheight, 25); - set_viewwidth = max (ti.screenwidth, 79); - } -#elif HAVE_LIBTERMCAP - { - char *termtype; - int success; - - /* This code stolen from termcap.info, though modified. */ - termtype = getenv ("TERM"); - if (!termtype) - msg (FE, _("Specify a terminal type with `setenv TERM '.")); - - success = tgetent (term_buffer, termtype); - if (success <= 0) - { - if (success < 0) - msg (IE, _("Could not access the termcap data base.")); - else - msg (IE, _("Terminal type `%s' is not defined."), termtype); - msg (MM, _("Assuming screen of size 79x25.")); - set_viewlength = 25; - set_viewwidth = 79; - } - else - { - set_viewlength = tgetnum ("li"); - set_viewwidth = tgetnum ("co") - 1; - } - } -#else /* !HAVE_LIBTERMCAP */ - set_viewlength = 25; - set_viewwidth = 79; -#endif /* !HAVE_LIBTERMCAP */ + init_settings(); /* log.h */ logging = 1; logfn = xstrdup ("pspp.log"); logfile = NULL; - /* file-handle.h */ - fh_init_files (); - get_date (); } +void +done_glob(void) +{ + cancel_transformations (); + dict_destroy (default_dict); + free (logfn); + done_settings (); + ds_destroy (&tokstr); + + fh_done(); +} + static void get_date (void) {