From: Adam Dickmeiss Date: Thu, 25 Jul 2002 13:20:20 +0000 (+0000) Subject: Added private ODR header X-Git-Tag: YAZ.1.8.8~8 X-Git-Url: http://lists.indexdata.dk/?a=commitdiff_plain;h=a67cc28231d95548fda7d7b9626b0ead7eb0f13f;p=yaz-moved-to-github.git Added private ODR header --- diff --git a/odr/odr-priv.h b/odr/odr-priv.h new file mode 100644 index 0000000..5a5ca1a --- /dev/null +++ b/odr/odr-priv.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 1995-2002, Index Data. + * + * Permission to use, copy, modify, distribute, and sell this software and + * its documentation, in whole or in part, for any purpose, is hereby granted, + * provided that: + * + * 1. This copyright and permission notice appear in all copies of the + * software and its documentation. Notices of copyright or attribution + * which appear at the beginning of any file must remain unchanged. + * + * 2. The name of Index Data or the individual authors may not be used to + * endorse or promote products derived from this software without specific + * prior written permission. + * + * THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTY OF ANY KIND, + * EXPRESS, IMPLIED, OR OTHERWISE, INCLUDING WITHOUT LIMITATION, ANY + * WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. + * IN NO EVENT SHALL INDEX DATA BE LIABLE FOR ANY SPECIAL, INCIDENTAL, + * INDIRECT OR CONSEQUENTIAL DAMAGES OF ANY KIND, OR ANY DAMAGES + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER OR + * NOT ADVISED OF THE POSSIBILITY OF DAMAGE, AND ON ANY THEORY OF + * LIABILITY, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE + * OF THIS SOFTWARE. + * + * $Id: odr-priv.h,v 1.1 2002-07-25 13:20:20 adam Exp $ + */ + +#ifndef ODR_PRIV_H + +#define ODR_PRIV_H + +#if HAVE_ICONV_H +#include +#endif + +#include + +struct Odr_ber_tag { /* used to be statics in ber_tag... */ + int lclass; + int ltag; + int br; + int lcons; +}; + +struct Odr_private { + /* stack for constructed types */ +#define ODR_MAX_STACK 50 + int stackp; /* top of stack (-1 == initial state) */ + odr_constack stack[ODR_MAX_STACK]; + + struct Odr_ber_tag odr_ber_tag; +#if HAVE_ICONV_H + iconv_t iconv_handle; +#endif +}; + +/* Private macro. + * write a single character at the current position - grow buffer if + * necessary. + * (no, we're not usually this anal about our macros, but this baby is + * next to unreadable without some indentation :) + */ +#define odr_putc(o, c) \ +( \ + ( \ + (o)->pos < (o)->size ? \ + ( \ + (o)->buf[(o)->pos++] = (c), \ + 0 \ + ) : \ + ( \ + odr_grow_block((o), 1) == 0 ? \ + ( \ + (o)->buf[(o)->pos++] = (c), \ + 0 \ + ) : \ + ( \ + (o)->error = OSPACE, \ + -1 \ + ) \ + ) \ + ) == 0 ? \ + ( \ + (o)->pos > (o)->top ? \ + ( \ + (o)->top = (o)->pos, \ + 0 \ + ) : \ + 0 \ + ) : \ + -1 \ +) + +#endif