Reformatted.
[chise/xemacs-chise.git.1] / src / concord.c
index 06dc3b5..6d8c212 100644 (file)
@@ -1,5 +1,5 @@
 /* XEmacs routines to deal with CONCORD.
-   Copyright (C) 2005,2006 MORIOKA Tomohiko
+   Copyright (C) 2005,2006,2008 MORIOKA Tomohiko
 
 This file is part of XEmacs.
 
@@ -718,6 +718,7 @@ Store a VALUE of OBJECT's FEATURE.
   Bufbyte *name_str;
 
   CHECK_CONCORD_OBJECT (object);
+  CHECK_SYMBOL (feature);
   name = symbol_name (XSYMBOL (feature));
   name_str = string_data (name);
   if ( NILP (concord_object_put (object, feature, value)) )
@@ -894,7 +895,7 @@ func_for_each_object (CONCORD_String object_id,
                      CONCORD_Feature feature,
                      CONCORD_String value)
 {
-  struct gcpro gcpro1, gcpro2, gcpro3;
+  struct gcpro gcpro1, gcpro2;
   Lisp_Object obj, val, ret;
 
 #if 0
@@ -911,7 +912,6 @@ func_for_each_object (CONCORD_String object_id,
   obj = Fconcord_make_object (for_each_object_closure->genre,
                              obj,
                              for_each_object_closure->ds);
-  UNGCPRO;
 #if 0
   val = read_from_c_string (CONCORD_String_data (value),
                            CONCORD_String_size (value) );
@@ -922,7 +922,8 @@ func_for_each_object (CONCORD_String object_id,
                                  Qfile_name),
                                 Qnil, Qnil));
 #endif
-  GCPRO3 (obj, val, ret);
+  UNGCPRO;
+  GCPRO2 (obj, val);
   ret = call2 (for_each_object_closure->function, obj, val);
   UNGCPRO;
   for_each_object_closure->ret = ret;
@@ -1000,6 +1001,23 @@ concord_name_validate (Lisp_Object keyword, Lisp_Object value,
 }
 
 static int
+concord_id_validate (Lisp_Object keyword, Lisp_Object value,
+                    Error_behavior errb)
+{
+  if (ERRB_EQ (errb, ERROR_ME))
+    {
+      /* CHECK_SYMBOL (value); */
+      if ( INTP (value) || CHARP (value) || SYMBOLP (value) )
+       ;
+      else
+       dead_wrong_type_argument (Qsymbolp, value);
+      return 1;
+    }
+
+  return INTP (value) || CHARP (value) || SYMBOLP (value);
+}
+
+static int
 concord_object_validate (Lisp_Object data, Error_behavior errb)
 {
   struct gcpro gcpro1, gcpro2, gcpro3;
@@ -1107,7 +1125,7 @@ structure_type_create_concord (void)
                              concord_object_instantiate);
 
   define_structure_type_keyword (st, Qgenre, concord_name_validate);
-  define_structure_type_keyword (st, Q_id, concord_name_validate);
+  define_structure_type_keyword (st, Q_id, concord_id_validate);
 }
 
 void