source: trunk/third/rx/rx/rx.c @ 10430

Revision 10430, 1.8 KB checked in by ghudson, 27 years ago (diff)
This commit was generated by cvs2svn to compensate for changes in r10429, which included commits to RCS files with non-trunk default branches.
Line 
1/*      Copyright (C) 1995, 1996 Tom Lord
2 *
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)
6 * any later version.
7 *
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.
12 *
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.
17 */
18
19
20
21#include "rx.h"
22#include "rxall.h"
23#include "rxhash.h"
24#include "rxnfa.h"
25#include "rxsuper.h"
26
27
28
29const char rx_version_string[] = "GNU Rx version 1.5";
30
31
32#ifdef __STDC__
33struct rx *
34rx_make_rx (int cset_size)
35#else
36struct rx *
37rx_make_rx (cset_size)
38     int cset_size;
39#endif
40{
41  static int rx_id = 0;
42  struct rx * new_rx;
43  new_rx = (struct rx *)malloc (sizeof (*new_rx));
44  rx_bzero ((char *)new_rx, sizeof (*new_rx));
45  new_rx->rx_id = rx_id++;
46  new_rx->cache = rx_default_cache;
47  new_rx->local_cset_size = cset_size;
48  new_rx->instruction_table = rx_id_instruction_table;
49  new_rx->next_nfa_id = 0;
50  return new_rx;
51}
52
53#ifdef __STDC__
54void
55rx_free_rx (struct rx * rx)
56#else
57void
58rx_free_rx (rx)
59     struct rx * rx;
60#endif
61{
62  if (rx->start_set)
63    rx->start_set->starts_for = 0;
64  rx_free_nfa (rx);
65  free (rx);
66}
67
68
69#ifdef __STDC__
70void
71rx_bzero (char * mem, int size)
72#else
73void
74rx_bzero (mem, size)
75     char * mem;
76     int size;
77#endif
78{
79  while (size)
80    {
81      *mem = 0;
82      ++mem;
83      --size;
84    }
85}
Note: See TracBrowser for help on using the repository browser.