00001
00002 #include <limits.h>
00003
00004 #include "api.h"
00005
00006 #define MAXINT INT_MAX
00007 #define MININT INT_MIN
00008
00009 #define HEAD 2*sizeof(int)
00010
00011 #define SIZE(p) ((int *)(p))[-1]
00012 #define SET_SIZE(p, n) ((int *)(p))[-1] = n
00013 #define CAPACITY(p) ((int *)(p))[-2]
00014
00015 struct among
00016 { int s_size;
00017 const symbol * s;
00018 int substring_i;
00019 int result;
00020 int (* function)(struct SN_env *);
00021 };
00022
00023 extern symbol * create_s(void);
00024 extern void lose_s(symbol * p);
00025
00026 extern int skip_utf8(const symbol * p, int c, int lb, int l, int n);
00027
00028 extern int in_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00029 extern int in_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00030 extern int out_grouping_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00031 extern int out_grouping_b_U(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00032
00033 extern int in_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00034 extern int in_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00035 extern int out_grouping(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00036 extern int out_grouping_b(struct SN_env * z, const unsigned char * s, int min, int max, int repeat);
00037
00038 extern int eq_s(struct SN_env * z, int s_size, const symbol * s);
00039 extern int eq_s_b(struct SN_env * z, int s_size, const symbol * s);
00040 extern int eq_v(struct SN_env * z, const symbol * p);
00041 extern int eq_v_b(struct SN_env * z, const symbol * p);
00042
00043 extern int find_among(struct SN_env * z, const struct among * v, int v_size);
00044 extern int find_among_b(struct SN_env * z, const struct among * v, int v_size);
00045
00046 extern int replace_s(struct SN_env * z, int c_bra, int c_ket, int s_size, const symbol * s, int * adjustment);
00047 extern int slice_from_s(struct SN_env * z, int s_size, const symbol * s);
00048 extern int slice_from_v(struct SN_env * z, const symbol * p);
00049 extern int slice_del(struct SN_env * z);
00050
00051 extern int insert_s(struct SN_env * z, int bra, int ket, int s_size, const symbol * s);
00052 extern int insert_v(struct SN_env * z, int bra, int ket, const symbol * p);
00053
00054 extern symbol * slice_to(struct SN_env * z, symbol * p);
00055 extern symbol * assign_to(struct SN_env * z, symbol * p);
00056
00057 extern void debug(struct SN_env * z, int number, int line_count);
00058