/[gcl]/gcl/o/bind.c
ViewVC logotype

Diff of /gcl/o/bind.c

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

revision 1.5 by camm, Tue Sep 24 19:01:45 2002 UTC revision 1.6 by camm, Wed Oct 16 03:24:02 2002 UTC
# Line 227  KEYWORD: Line 227  KEYWORD:
227                  if (type_of(x) == t_cons) {                  if (type_of(x) == t_cons) {
228                          if (type_of(x->c.c_car) == t_cons) {                          if (type_of(x->c.c_car) == t_cons) {
229                                  if (!keywordp(x->c.c_car->c.c_car))                                  if (!keywordp(x->c.c_car->c.c_car))
230                                          FEerror("~S is not a keyword.",                                    /* FIXME better message */
231                                                  1, x->c.c_car->c.c_car);                                          FEunexpected_keyword(x->c.c_car->c.c_car);
232                                  vs_push(x->c.c_car->c.c_car);                                  vs_push(x->c.c_car->c.c_car);
233                                  if (endp(x->c.c_car->c.c_cdr))                                  if (endp(x->c.c_car->c.c_cdr))
234                                          illegal_lambda();                                          illegal_lambda();
# Line 437  SEARCH_DECLARE: Line 437  SEARCH_DECLARE:
437          if (key_flag) {          if (key_flag) {
438                  i = narg - nreq - nopt;                  i = narg - nreq - nopt;
439                  if (i >= 0 && i%2 != 0)                  if (i >= 0 && i%2 != 0)
440                          FEerror("Keyword values are missing.", 0);                    /* FIXME better message */
441                      FEunexpected_keyword(Cnil);
442                  other_keys_appeared = FALSE;                  other_keys_appeared = FALSE;
443                  for (i = nreq + nopt;  i < narg;  i += 2) {                  for (i = nreq + nopt;  i < narg;  i += 2) {
444                          if (!keywordp(base[i]))                          if (!keywordp(base[i]))
445                                  FEerror("~S is not a keyword.",                                  FEunexpected_keyword(base[i]);
                                         1, base[i]);  
446                          if (base[i] == sKallow_other_keys &&                          if (base[i] == sKallow_other_keys &&
447                              base[i+1] != Cnil)                              base[i+1] != Cnil)
448                                  allow_other_keys_flag = TRUE;                                  allow_other_keys_flag = TRUE;
# Line 464  SEARCH_DECLARE: Line 464  SEARCH_DECLARE:
464                          continue;                          continue;
465                  }                  }
466                  if (other_keys_appeared && !allow_other_keys_flag)                  if (other_keys_appeared && !allow_other_keys_flag)
467                          FEerror("Other-keys are not allowed.", 0);                    /* FIXME better message */
468                      FEunexpected_keyword(Ct);
469          }          }
470          for (i = 0;  i < nkey;  i++)          for (i = 0;  i < nkey;  i++)
471                  if (keyword[i].key_svar_val != Cnil) {                  if (keyword[i].key_svar_val != Cnil) {
# Line 728  parse_key(object *base, bool rest, bool Line 729  parse_key(object *base, bool rest, bool
729                  return;                  return;
730          }          }
731          if (narg%2 != 0)          if (narg%2 != 0)
732                  FEerror("Odd number of arguments for keywords.", 0);            /* FIXME better message */
733              FEunexpected_keyword(Cnil);
734          if (narg == 2) {          if (narg == 2) {
735                  k = base[0];                  k = base[0];
736                  if (!keywordp(k))                  if (!keywordp(k))
737                          FEerror("~S is not a keyword.", 1, k);                    FEunexpected_keyword(k);
738                  if (k == sKallow_other_keys && base[1] != Cnil)                  if (k == sKallow_other_keys && base[1] != Cnil)
739                          allow_other_keys = TRUE;                          allow_other_keys = TRUE;
740                  temporary = base[1];                  temporary = base[1];
# Line 758  parse_key(object *base, bool rest, bool Line 760  parse_key(object *base, bool rest, bool
760                          base[-1] = make_cons(k, temporary);                          base[-1] = make_cons(k, temporary);
761                  }                  }
762                  if (other_key != OBJNULL && !allow_other_keys)                  if (other_key != OBJNULL && !allow_other_keys)
763                          FEerror("The keyword ~S is not allowed.",1,other_key);                          FEunexpected_keyword(other_key);
764                  return;                  return;
765          }          }
766          va_start(ap,n);          va_start(ap,n);
# Line 804  parse_key(object *base, bool rest, bool Line 806  parse_key(object *base, bool rest, bool
806          }          }
807          va_end(ap);          va_end(ap);
808          if (error_flag == NOT_KEYWORD)          if (error_flag == NOT_KEYWORD)
809                  FEerror("~S is not a keyword.", 1, other_key);            FEunexpected_keyword(other_key);
810          if (other_key != OBJNULL && !allow_other_keys)          if (other_key != OBJNULL && !allow_other_keys)
811                  FEerror("The keyword ~S is not allowed.", 1, other_key);            FEunexpected_keyword(other_key);
812  }  }
813    
814  void  void
# Line 821  check_other_key(object l, int n, ...) Line 823  check_other_key(object l, int n, ...)
823          for (;  !endp(l);  l = l->c.c_cdr->c.c_cdr) {          for (;  !endp(l);  l = l->c.c_cdr->c.c_cdr) {
824                  k = l->c.c_car;                  k = l->c.c_car;
825                  if (!keywordp(k))                  if (!keywordp(k))
826                          FEerror("~S is not a keyword.", 1, k);                    FEunexpected_keyword(k);
827                  if (endp(l->c.c_cdr))                  if (endp(l->c.c_cdr))
828                          FEerror("Odd number of arguments for keywords.", 0);                    /* FIXME better message */
829                      FEunexpected_keyword(Cnil);
830                  if (k == sKallow_other_keys && l->c.c_cdr->c.c_car != Cnil) {                  if (k == sKallow_other_keys && l->c.c_cdr->c.c_car != Cnil) {
831                          allow_other_keys = TRUE;                          allow_other_keys = TRUE;
832                  } else {                  } else {
# Line 838  check_other_key(object l, int n, ...) Line 841  check_other_key(object l, int n, ...)
841                  }                  }
842          }          }
843          if (other_key != OBJNULL && !allow_other_keys)          if (other_key != OBJNULL && !allow_other_keys)
844                  FEerror("The keyword ~S is not allowed or is duplicated.",            FEunexpected_keyword(other_key);
                         1, other_key);  
845  }  }
846    
847    
# Line 893  parse_key_new(int n, object *base, struc Line 895  parse_key_new(int n, object *base, struc
895             m -= 2;}             m -= 2;}
896          if (allow) n = n -2 ; else goto error;}          if (allow) n = n -2 ; else goto error;}
897     }     }
898    if (n!=0) FEerror("Odd number of keys",0);    /* FIXME better message */
899      if (n!=0) FEunexpected_keyword(Cnil);
900    return 0;    return 0;
901   error:   error:
902    FEerror("Unrecognized key ~a",1,k);    FEunexpected_keyword(k);
903    return -1;    return -1;
904  }}}  }}}
905    
# Line 948  parse_key_rest(object rest, int n, objec Line 951  parse_key_rest(object rest, int n, objec
951          if (allow) n = n -2 ; else goto error;}          if (allow) n = n -2 ; else goto error;}
952    
953     }     }
954    if (n!=0) FEerror("Odd number of keys",0);    /* FIXME better message */
955      if (n!=0) FEunexpected_keyword(Cnil);
956    return 0;    return 0;
957   error:   error:
958    FEerror("Unrecognized key ~a",1,k);    FEunexpected_keyword(k);
959    return -1;    return -1;
960  }}}  }}}
961    

Legend:
Removed from v.1.5  
changed lines
  Added in v.1.6

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