ext/ox/ox.h in ox-2.0.0 vs ext/ox/ox.h in ox-2.0.1
- old
+ new
@@ -57,15 +57,18 @@
#endif
#endif
#include "cache.h"
+#include "err.h"
+#include "type.h"
+#include "attr.h"
+#include "helper.h"
+
#define raise_error(msg, xml, current) _ox_raise_error(msg, xml, current, __FILE__, __LINE__)
#define MAX_TEXT_LEN 4096
-#define MAX_ATTRS 1024
-#define MAX_DEPTH 1024
#define SILENT 0
#define TRACE 1
#define DEBUG 2
@@ -113,50 +116,10 @@
GenMode = 'g',
LimMode = 'l',
NoMode = 0
} LoadMode;
-typedef enum {
- NoCode = 0,
- ArrayCode = 'a',
- String64Code = 'b', /* base64 encoded String */
- ClassCode = 'c',
- Symbol64Code = 'd', /* base64 encoded Symbol */
- DateCode = 'D',
- ExceptionCode = 'e',
- FloatCode = 'f',
- RegexpCode = 'g',
- HashCode = 'h',
- FixnumCode = 'i',
- BignumCode = 'j',
- KeyCode = 'k', /* indicates the value is a hash key, kind of a hack */
- RationalCode = 'l',
- SymbolCode = 'm',
- FalseClassCode = 'n',
- ObjectCode = 'o',
- RefCode = 'p',
- RangeCode = 'r',
- StringCode = 's',
- TimeCode = 't',
- StructCode = 'u',
- ComplexCode = 'v',
- RawCode = 'x',
- TrueClassCode = 'y',
- NilClassCode = 'z',
-} Type;
-
-typedef struct _Attr {
- const char *name;
- const char *value;
-} *Attr;
-
-typedef struct _Helper {
- ID var; /* Object var ID */
- VALUE obj; /* object created or Qundef if not appropriate */
- Type type; /* type of object in obj */
-} *Helper;
-
typedef struct _PInfo *PInfo;
typedef struct _ParseCallbacks {
void (*instruct)(PInfo pi, const char *target, Attr attrs, const char *content);
void (*add_doctype)(PInfo pi, const char *docType);
@@ -195,23 +158,23 @@
#endif
} *Options;
/* parse information structure */
struct _PInfo {
- struct _Helper helpers[MAX_DEPTH];
- Helper h; /* current helper or 0 if not set */
+ struct _HelperStack helpers;
+ struct _Err err;
char *str; /* buffer being read from */
char *s; /* current position in buffer */
VALUE obj;
ParseCallbacks pcb;
CircArray circ_array;
unsigned long id; /* set for text types when cirs_array is set */
Options options;
char last; /* last character read, rarely set */
};
-extern VALUE ox_parse(char *xml, ParseCallbacks pcb, char **endp, Options options);
+extern VALUE ox_parse(char *xml, ParseCallbacks pcb, char **endp, Options options, Err err);
extern void _ox_raise_error(const char *msg, const char *xml, const char *current, const char* file, int line);
extern void ox_sax_define(void);
extern char* ox_write_obj_to_str(VALUE obj, Options copts);
@@ -226,10 +189,11 @@
extern ID ox_at_id;
extern ID ox_at_line_id;
extern ID ox_at_value_id;
extern ID ox_attr_id;
extern ID ox_attr_value_id;
+extern ID ox_attrs_done_id;
extern ID ox_attributes_id;
extern ID ox_beg_id;
extern ID ox_cdata_id;
extern ID ox_comment_id;
extern ID ox_den_id;
@@ -271,14 +235,12 @@
extern VALUE ox_utf8_encoding;
#else
extern void *ox_utf8_encoding;
#endif
-extern VALUE ox_arg_error_class;
extern VALUE ox_date_class;
extern VALUE ox_empty_string;
extern VALUE ox_encoding_sym;
-extern VALUE ox_parse_error_class;
extern VALUE ox_stringio_class;
extern VALUE ox_struct_class;
extern VALUE ox_time_class;
extern VALUE ox_zero_fixnum;