/[pspp]/pspp/src/command.c
ViewVC logotype

Diff of /pspp/src/command.c

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.19 by jmd, Sat Feb 5 12:42:57 2005 UTC revision 1.20 by jmd, Tue Mar 8 04:56:43 2005 UTC
# Line 27  Line 27 
27  #include "alloc.h"  #include "alloc.h"
28  #include "dictionary.h"  #include "dictionary.h"
29  #include "error.h"  #include "error.h"
30    #include "glob.h"
31  #include "getline.h"  #include "getline.h"
32  #include "lexer.h"  #include "lexer.h"
33  #include "main.h"  #include "main.h"
# Line 63  struct command Line 64  struct command
64      int (*func) (void);         /* Function to call. */      int (*func) (void);         /* Function to call. */
65      int skip_entire_name;       /* If zero, we don't skip the      int skip_entire_name;       /* If zero, we don't skip the
66                                     final token in the command name. */                                     final token in the command name. */
67        short debug;                /* Set if this cmd available only in test mode*/
68    };    };
69    
70  /* Define the command array. */  /* Define the command array. */
71  #define DEFCMD(NAME, T1, T2, T3, T4, FUNC)              \  #define DEFCMD(NAME, T1, T2, T3, T4, FUNC)              \
72          {NAME, {T1, T2, T3, T4}, FUNC, 1},          {NAME, {T1, T2, T3, T4}, FUNC, 1, 0},
73    #define DBGCMD(NAME, T1, T2, T3, T4, FUNC)              \
74            {NAME, {T1, T2, T3, T4}, FUNC, 1, 1},
75  #define SPCCMD(NAME, T1, T2, T3, T4, FUNC)              \  #define SPCCMD(NAME, T1, T2, T3, T4, FUNC)              \
76          {NAME, {T1, T2, T3, T4}, FUNC, 0},          {NAME, {T1, T2, T3, T4}, FUNC, 0, 0},
77  #define UNIMPL(NAME, T1, T2, T3, T4)                    \  #define UNIMPL(NAME, T1, T2, T3, T4)                    \
78          {NAME, {T1, T2, T3, T4}, NULL, 1},          {NAME, {T1, T2, T3, T4}, NULL, 1, 0},
79  static const struct command commands[] =  static const struct command commands[] =
80    {    {
81  #include "command.def"  #include "command.def"
82    };    };
83  #undef DEFCMD  #undef DEFCMD
84    #undef DBGCMD
85  #undef UNIMPL  #undef UNIMPL
86    
87    
# Line 99  pspp_completion_function (const char *te Line 104  pspp_completion_function (const char *te
104    
105        cmd = &commands[state + skip];        cmd = &commands[state + skip];
106        
107        if ( cmd->transition[pgm_state] == STATE_ERROR )        if ( cmd->transition[pgm_state] == STATE_ERROR || ( cmd->debug  &&  ! test_mode ) )
108          {          {
109            skip++;            skip++;
110            continue;            continue;
# Line 543  parse_command_name (void) Line 548  parse_command_name (void)
548              {              {
549                if (command->skip_entire_name)                if (command->skip_entire_name)
550                  lex_get ();                  lex_get ();
551                  if ( command->debug & !test_mode )
552                    goto error;
553                free_words (words, word_cnt);                free_words (words, word_cnt);
554                return command;                return command;
555              }              }
# Line 586  parse_command_name (void) Line 593  parse_command_name (void)
593            free (words[word_cnt]);            free (words[word_cnt]);
594          }          }
595    
596          if ( command->debug && !test_mode )
597            goto error;
598    
599        free_words (words, word_cnt);        free_words (words, word_cnt);
600        return command;        return command;
601      }      }
602    
603    error:
604    unknown_command_error (words, word_cnt);    unknown_command_error (words, word_cnt);
605    free_words (words, word_cnt);    free_words (words, word_cnt);
606    return NULL;    return NULL;

Legend:
Removed from v.1.19  
changed lines
  Added in v.1.20

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26