/[anubis]/anubis/src/rcfile.y
ViewVC logotype

Diff of /anubis/src/rcfile.y

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

revision 1.28 by gray, Thu Aug 28 07:22:30 2003 UTC revision 1.29 by gray, Tue Sep 16 13:11:47 2003 UTC
# Line 53  static void rc_stmt_destroy(RC_STMT *); Line 53  static void rc_stmt_destroy(RC_STMT *);
53  static void rc_stmt_list_destroy(RC_STMT *);  static void rc_stmt_list_destroy(RC_STMT *);
54  static void rc_stmt_print(RC_STMT *, int);  static void rc_stmt_print(RC_STMT *, int);
55  static int reg_modifier_add(int *, char *);  static int reg_modifier_add(int *, char *);
56  static int check_kw(char *ident);  static int check_kw(char *ident, int *flags);
57  static int is_prog_allowed();  static int is_prog_allowed();
58    
59  static RC_SECTION *rc_section;  static RC_SECTION *rc_section;
# Line 212  stmt     : /* empty */ EOL Line 212  stmt     : /* empty */ EOL
212    
213  asgn_stmt: keyword arglist  asgn_stmt: keyword arglist
214             {             {
215                     if (!check_kw($1)) {                     int flags;
216                       if (!check_kw($1, &flags)) {
217                             parse_error(_("unknown keyword: %s"), $1);                             parse_error(_("unknown keyword: %s"), $1);
218                             YYERROR;                             YYERROR;
219                     }                     }
# Line 225  asgn_stmt: keyword arglist Line 226  asgn_stmt: keyword arglist
226                                     list_remove($2, s, NULL);                                     list_remove($2, s, NULL);
227                     }                     }
228                     $$->v.asgn.rhs = $2;                     $$->v.asgn.rhs = $2;
229                       $$->v.asgn.flags = flags;
230             }             }
231           ;           ;
232    
# Line 1008  _print_str(void *item, void *data) Line 1010  _print_str(void *item, void *data)
1010          return 0;          return 0;
1011  }  }
1012    
1013    static int
1014    _print_stars(void *item, void *data)
1015    {
1016            int i, len = strlen ((char*)item);
1017            putchar(' ');
1018            for (i = 0; i < len; i++)
1019                    putchar('*');
1020            return 0;
1021    }
1022    
1023  void  void
1024  rc_stmt_print(RC_STMT *stmt, int level)  rc_stmt_print(RC_STMT *stmt, int level)
1025  {  {
# Line 1016  rc_stmt_print(RC_STMT *stmt, int level) Line 1028  rc_stmt_print(RC_STMT *stmt, int level)
1028                  case rc_stmt_asgn:                  case rc_stmt_asgn:
1029                          rc_level_print(level, "ASGN: ");                          rc_level_print(level, "ASGN: ");
1030                          printf("%s =", stmt->v.asgn.lhs);                          printf("%s =", stmt->v.asgn.lhs);
1031                          list_iterate(stmt->v.asgn.rhs, _print_str, NULL);                          list_iterate(stmt->v.asgn.rhs,
1032                                         (stmt->v.asgn.flags & KWF_HIDDEN) ?
1033                                            _print_stars : _print_str, NULL);
1034                          break;                          break;
1035                                                    
1036                  case rc_stmt_cond:                  case rc_stmt_cond:
# Line 1113  rc_secdef_add_child(struct rc_secdef *de Line 1127  rc_secdef_add_child(struct rc_secdef *de
1127  }  }
1128    
1129  struct rc_secdef_child *  struct rc_secdef_child *
1130  rc_child_lookup(struct rc_secdef_child *child, char *str, int method, int *key)  rc_child_lookup(struct rc_secdef_child *child, char *str, int method,
1131                    int *key, int *flags)
1132  {  {
1133          for (; child; child = child->next) {          for (; child; child = child->next) {
1134                  if (child->method & method) {                  if (child->method & method) {
# Line 1121  rc_child_lookup(struct rc_secdef_child * Line 1136  rc_child_lookup(struct rc_secdef_child *
1136                          for (kw = child->kwdef; kw->name; kw++)                          for (kw = child->kwdef; kw->name; kw++)
1137                                  if (strcmp(kw->name, str) == 0) {                                  if (strcmp(kw->name, str) == 0) {
1138                                          *key = kw->tok;                                          *key = kw->tok;
1139                                            if (flags)
1140                                                    *flags = kw->flags;
1141                                          return child;                                          return child;
1142                                  }                                  }
1143                  }                  }
# Line 1220  asgn_eval(struct eval_env *env, RC_ASGN Line 1237  asgn_eval(struct eval_env *env, RC_ASGN
1237  {  {
1238          int key;          int key;
1239          struct rc_secdef_child *p = rc_child_lookup(env->child, asgn->lhs,          struct rc_secdef_child *p = rc_child_lookup(env->child, asgn->lhs,
1240                                                      env->method, &key);                                                      env->method, &key, NULL);
1241          if (!p)          if (!p)
1242                  return;                  return;
1243    
# Line 1454  rc_run_section_list(int method, RC_SECTI Line 1471  rc_run_section_list(int method, RC_SECTI
1471  }  }
1472    
1473  static int  static int
1474  check_kw(char *ident)  check_kw(char *ident, int *flags)
1475  {  {
1476          struct rc_secdef *p = rc_secdef;          struct rc_secdef *p = rc_secdef;
1477          int key;          int key;
1478                    
1479          if (!p)          if (!p)
1480                  p = anubis_find_section("RULE");                  p = anubis_find_section("RULE");
1481          return rc_child_lookup(p->child, ident, CF_ALL, &key) != NULL;          return rc_child_lookup(p->child, ident, CF_ALL, &key, flags) != NULL;
1482  }  }
1483    
1484  static int  static int

Legend:
Removed from v.1.28  
changed lines
  Added in v.1.29

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