pspp-cvs
[Top][All Lists]
Advanced

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

[Pspp-cvs] Changes to pspp/src/command.c


From: John Darrington
Subject: [Pspp-cvs] Changes to pspp/src/command.c
Date: Mon, 07 Mar 2005 23:56:45 -0500

Index: pspp/src/command.c
diff -u pspp/src/command.c:1.19 pspp/src/command.c:1.20
--- pspp/src/command.c:1.19     Sat Feb  5 12:42:57 2005
+++ pspp/src/command.c  Tue Mar  8 04:56:43 2005
@@ -27,6 +27,7 @@
 #include "alloc.h"
 #include "dictionary.h"
 #include "error.h"
+#include "glob.h"
 #include "getline.h"
 #include "lexer.h"
 #include "main.h"
@@ -63,20 +64,24 @@
     int (*func) (void);                /* Function to call. */
     int skip_entire_name;       /* If zero, we don't skip the
                                    final token in the command name. */
+    short debug;                /* Set if this cmd available only in test 
mode*/
   };
 
 /* Define the command array. */
 #define DEFCMD(NAME, T1, T2, T3, T4, FUNC)             \
-       {NAME, {T1, T2, T3, T4}, FUNC, 1},
+       {NAME, {T1, T2, T3, T4}, FUNC, 1, 0},
+#define DBGCMD(NAME, T1, T2, T3, T4, FUNC)             \
+       {NAME, {T1, T2, T3, T4}, FUNC, 1, 1},
 #define SPCCMD(NAME, T1, T2, T3, T4, FUNC)             \
-       {NAME, {T1, T2, T3, T4}, FUNC, 0},
+       {NAME, {T1, T2, T3, T4}, FUNC, 0, 0},
 #define UNIMPL(NAME, T1, T2, T3, T4)                   \
-       {NAME, {T1, T2, T3, T4}, NULL, 1},
+       {NAME, {T1, T2, T3, T4}, NULL, 1, 0},
 static const struct command commands[] = 
   {
 #include "command.def"
   };
 #undef DEFCMD
+#undef DBGCMD
 #undef UNIMPL
 
 
@@ -99,7 +104,7 @@
 
       cmd = &commands[state + skip];
   
-      if ( cmd->transition[pgm_state] == STATE_ERROR ) 
+      if ( cmd->transition[pgm_state] == STATE_ERROR || ( cmd->debug  &&  ! 
test_mode ) ) 
        {
          skip++; 
          continue;
@@ -543,6 +548,8 @@
             {
               if (command->skip_entire_name)
                 lex_get ();
+             if ( command->debug & !test_mode ) 
+               goto error;
               free_words (words, word_cnt);
               return command;
             }
@@ -586,10 +593,14 @@
           free (words[word_cnt]);
         }
 
+      if ( command->debug && !test_mode ) 
+       goto error;
+
       free_words (words, word_cnt);
       return command;
     }
 
+error:
   unknown_command_error (words, word_cnt);
   free_words (words, word_cnt);
   return NULL;




reply via email to

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