1 /* Copyright (C) 1995, 1996 Tom Lord
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU Library General Public License as published by
5 * the Free Software Foundation; either version 2, or (at your option)
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU Library General Public License for more details.
13 * You should have received a copy of the GNU Library General Public License
14 * along with this software; see the file COPYING. If not, write to
15 * the Free Software Foundation, 59 Temple Place - Suite 330,
16 * Boston, MA 02111-1307, USA.
28 int rx_basic_unfaniverse_delay
= RX_DEFAULT_NFA_DELAY
;
29 static struct rx_unfaniverse
* rx_basic_uv
= 0;
38 rx_basic_uv
= rx_make_unfaniverse (rx_basic_unfaniverse_delay
);
39 return (rx_basic_uv
? 0 : -1);
44 struct rx_unfaniverse
*
45 rx_basic_unfaniverse (void)
47 struct rx_unfaniverse
*
48 rx_basic_unfaniverse ()
51 if (init_basic_once ())
57 static char * silly_hack
= 0;
61 rx_basic_make_solutions (struct rx_registers
* regs
, struct rexp_node
* expression
, struct rexp_node
** subexps
, int start
, int end
, struct rx_context_rules
* rules
, const unsigned char * str
)
64 rx_basic_make_solutions (regs
, expression
, subexps
, start
, end
, rules
, str
)
65 struct rx_registers
* regs
;
66 struct rexp_node
* expression
;
67 struct rexp_node
** subexps
;
70 struct rx_context_rules
* rules
;
71 const unsigned char * str
;
74 struct rx_str_closure
* closure
;
75 if (init_basic_once ())
76 return 0; /* bogus but rare */
78 && (expression
->len
>= 0)
79 && (expression
->len
!= (end
- start
)))
80 return &rx_no_solutions
;
83 closure
= (struct rx_str_closure
*)silly_hack
;
87 closure
= (struct rx_str_closure
*)malloc (sizeof (*closure
));
92 closure
->rules
= *rules
;
93 return rx_make_solutions (regs
, rx_basic_uv
, expression
, subexps
, 256,
94 start
, end
, rx_str_vmfn
, rx_str_contextfn
,
102 rx_basic_free_solutions (struct rx_solutions
* solns
)
105 rx_basic_free_solutions (solns
)
106 struct rx_solutions
* solns
;
109 if (solns
== &rx_no_solutions
)
113 silly_hack
= (char *)solns
->closure
;
115 free (solns
->closure
);
117 rx_free_solutions (solns
);