http://gimel.esc.cam.ac.uk/james/rpld/src/rpld-1.5.tar.gz
[rpld.git] / rpld_conf.y
index 8acaab9..b8239c2 100644 (file)
@@ -2,9 +2,9 @@
 *     rpld - an IBM style RIPL server            *
 *************************************************/
 
-/* Copyright (c) 1999, James McKenzie.
+/* Copyright (c) 1999,2000, James McKenzie.
  *                      All rights reserved
- * Copyright (c) 1998, Christopher Lightfoot.
+ * Copyright (c) 1998,2000, Christopher Lightfoot.
  *                      All rights reserved
  *
  * By using this file, you agree to the terms and conditions set
  *     YACC grammar for RPLD conf file parser
  *
  * $Log: rpld_conf.y,v $
- * Revision 1.3  1999/09/26 10:46:56  root
+ * Revision 1.7  2000/07/23 19:14:19  root
+ * #
+ *
+ * Revision 1.6  2000/07/17 11:59:45  root
+ * #
+ *
+ * Revision 1.5  2000/07/17 10:43:34  root
+ * #
+ *
+ * Revision 1.4  2000/07/16 14:05:28  root
+ * #
+ *
+ * Revision 1.3  2000/07/16 13:18:10  root
+ * #
+ *
+ * Revision 1.1  2000/07/16 13:16:33  root
  * #
  *
  * Revision 1.2  1999/09/13 11:17:35  root
  * Revision 1.1  1999/09/13 11:04:13  root
  * \#
  *
+ * Revision 1.10  1999/09/12 19:45:03  chris
+ * *** empty log message ***
+ *
+ * Revision 1.9  1999/09/12 19:14:07  chris
+ * Error messages now report name of last token scanned, instead of current yytext.
+ *
+ * Revision 1.8  1999/09/12 17:39:01  chris
+ * Configuration file now correctly builds structures; various minor problems fixed.
+ *
+ * Revision 1.7  1999/09/12 04:21:29  chris
+ * Wrote back-end to parser.
+ *
+ * Revision 1.6  1999/09/12 03:27:35  chris
+ * Added better error reporting.
+ *
+ * Revision 1.5  1999/09/12 01:05:00  chris
+ * Supports detecting start and end of blocks.
+ *
+ * Revision 1.4  1999/09/12 00:58:02  chris
+ * Added named block syntax.
+ *
+ * Revision 1.3  1999/09/11 19:00:51  chris
+ * Added support for nested blocks.
+ *
+ * Revision 1.2  1999/09/11 18:53:41  chris
+ * Added a comment to say what the file does.
+ *
+ *
  */
 
 %{
 
-static char rcsid[]="$Id: rpld_conf.y,v 1.3 1999/09/26 10:46:56 root Exp root $";
+static char rcsid[]="$Id: rpld_conf.y,v 1.7 2000/07/23 19:14:19 root Exp $";
 
 #include "project.h"
 
@@ -123,6 +166,8 @@ struct clientinfo
        // optional
        int have_framesize;
        int have_blocksize;
+       int have_pacing;
+       int have_nospew;
 };
 
 struct clfileinfo
@@ -175,6 +220,7 @@ void process_thing(THING thing, char *name, int type, YYSTYPE *pvalue)
 
                                pc->blocklen=MY_BLOCK_LEN;
                                pc->framelen=MY_FRAME_LEN;
+                               pc->pacing=MY_PACING;
                                
                                state = HOSTBLOCK;
                                break;
@@ -250,7 +296,12 @@ void process_thing(THING thing, char *name, int type, YYSTYPE *pvalue)
                        THROW_ERROR("Unknown directive");
                } else if (state == HOSTBLOCK) {
                        // no host assertions ATM
-                       THROW_ERROR("Unknown directive");
+                       if (strsame(name,"nospew")) {
+                               if (ci.have_pacing) THROW_ERROR("Directive nospew incompatible with pacing ");
+                               if (ci.have_nospew) THROW_ERROR("Repeated directive");
+                               ci.have_nospew=1;
+                               pc->nospew++;
+                       } else THROW_ERROR("Unknown directive");
                } else if (state == FILEBLOCK) {
                        if (strsame(name,"linux")) {
                                if (!cfi.have_path) THROW_ERROR("A path to a
@@ -261,7 +312,7 @@ valid kernel must precede linux");
                                cfi.have_offset=1;
                                cfi.have_length=1;
                                ci.have_run_addr=1;
-                       } else{
+                       }else{
                        THROW_ERROR("Unknown directive");
                        }
                } else THROW_ERROR("Unknown directive");
@@ -314,6 +365,13 @@ valid kernel must precede linux");
                                pc->framelen = pvalue->number;
                                ci.have_framesize = 1;
                        }
+                       else if (strsame(name,"pacing")) {
+                               if (type != NUMBER) THROW_ERROR("Directive must be followed by an integer ");
+                               if (ci.have_nospew) THROW_ERROR("Directive pacing incompatible with nospew ");
+                               if (ci.have_pacing) THROW_ERROR("Repeated directive");
+                               pc->pacing = pvalue->number;
+                               ci.have_pacing =1;
+                       }
                        else THROW_ERROR("Unknown directive");
                } else if (state == FILEBLOCK) {
                        // path