Addded some method functions to the ODR type.
[yaz-moved-to-github.git] / odr / odr_cons.c
index 043bb76..f85d817 100644 (file)
@@ -4,20 +4,30 @@
  * Sebastian Hammer, Adam Dickmeiss
  *
  * $Log: odr_cons.c,v $
- * Revision 1.1  1995-02-02 16:21:53  quinn
+ * Revision 1.5  1995-02-10 18:57:25  quinn
+ * More in the way of error-checking.
+ *
+ * Revision 1.4  1995/02/10  15:55:29  quinn
+ * Bug fixes, mostly.
+ *
+ * Revision 1.3  1995/02/09  15:51:48  quinn
+ * Works better now.
+ *
+ * Revision 1.2  1995/02/07  17:52:59  quinn
+ * A damn mess, but now things work, I think.
+ *
+ * Revision 1.1  1995/02/02  16:21:53  quinn
  * First kick.
  *
  */
 
 #include <odr.h>
 
-int odr_constructed_begin(ODR o, void *p, int class, int tag, int opt)
+int odr_constructed_begin(ODR o, void *p, int class, int tag)
 {
     int res;
     int cons = 1;
 
-    if (o->direction == ODR_ENCODE && !*(char*)p)
-       return opt;
     if (o->t_class < 0)
     {
        o->t_class = class;
@@ -26,7 +36,7 @@ int odr_constructed_begin(ODR o, void *p, int class, int tag, int opt)
     if ((res = ber_tag(o, p, o->t_class, o->t_tag, &cons)) < 0)
        return 0;
     if (!res || !cons)
-       return opt;
+       return 0;
 
     o->stack[++(o->stackp)].lenb = o->bp;
     if (o->direction == ODR_ENCODE || o->direction == ODR_PRINT)
@@ -49,6 +59,16 @@ int odr_constructed_begin(ODR o, void *p, int class, int tag, int opt)
     return 1;
 }
 
+int odr_constructed_more(ODR o)
+{
+    if (o->stackp < 0)
+       return 0;
+    if (o->stack[o->stackp].len >= 0)
+       return o->bp - o->stack[o->stackp].base < o->stack[o->stackp].len;
+    else
+       return (!(*o->bp == 0 && *(o->bp + 1) == 0));
+}
+
 int odr_constructed_end(ODR o)
 {
     int res;