00001 /* 00002 * Copyright (c) Members of the EGEE Collaboration. 2004. 00003 * See http://eu-egee.org/partners/ for details on the copyright holders. 00004 * For license conditions see the license file or 00005 * http://eu-egee.org/license.html 00006 */ 00007 00008 /* 00009 * Copyright (c) 2003 EU DataGrid http://www.eu-datagrid.org/ 00010 * 00011 * $Id: pdl_rule.h,v 1.12 2004/10/13 16:37:58 msteenba Exp $ 00012 * 00013 * Copyright (c) 2003 by 00014 * G.M. Venekamp <venekamp@nikhef.nl> 00015 * NIKHEF Amsterdam, the Netherlands 00016 * 00017 * This software is distributed under a BSD-style open source 00018 * licence. For a complete description of the licence take a look 00019 * at: http://eu-datagrid.web.cern.ch/eu-datagrid/license.html 00020 * 00021 */ 00022 00023 00036 #ifndef _PDL_RULE_H 00037 #define _PDL_RULE_H 00038 00039 #include "pdl.h" 00040 00041 00047 typedef struct rule_s { 00048 const char* state; 00049 const char* true_branch; 00050 const char* false_branch; 00051 unsigned int lineno; 00052 struct rule_s* next; 00053 } rule_t; 00054 00055 00059 typedef enum { 00060 STATE, 00061 TRUE_BRANCH, 00062 FALSE_BRANCH 00063 } rule_type_t; 00064 00065 00069 typedef enum { 00070 NO_RECURSION = 0x00, 00071 RECURSION = 0x01, 00072 RECURSION_HANDLED = 0x02 00073 } recursion_t; 00074 00075 00079 typedef enum { 00080 left_side, 00081 right_side 00082 } side_t; 00083 00084 00085 extern rule_t* add_rule(record_t* state, record_t* true_branch, record_t* false_branch); 00086 extern void free_rules(rule_t* rule); 00087 extern const rule_t* find_state(const rule_t* rule, const char* state); 00088 extern void show_rules(const rule_t* rule); 00089 extern void start_new_rules(void); 00090 extern const rule_t* get_top_rule(void); 00091 extern void allow_new_rules(BOOL allow); 00092 extern const rule_t* get_rule(const char* rule, side_t side); 00093 extern void set_top_rule(const rule_t* rule); 00094 extern BOOL check_rule_for_recursion(const rule_t* rule); 00095 extern void reduce_rule(rule_t* rule); 00096 00097 #endif