Warning: Attempt to read property "date" on null in /usr/local/www/websvn.planix.org/blame.php on line 247

Warning: Attempt to read property "msg" on null in /usr/local/www/websvn.planix.org/blame.php on line 247
WebSVN – planix.SVN – Blame – /os/branches/feature_tlsv12/sys/src/ape/lib/regexp/regaux.c – Rev 2

Subversion Repositories planix.SVN

Rev

Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <stdlib.h>
2
#include <stdio.h>
3
#include "regexp.h"
4
#include "regcomp.h"
5
 
6
/*
7
 *	Machine state
8
 */
9
Relist*	_relist[2];
10
Relist*	_reliste[2];
11
int	_relistsize = LISTINCREMENT;
12
 
13
/*
14
 *  save a new match in mp
15
 */
16
extern void
17
_renewmatch(Resub *mp, int ms, Resublist *sp)
18
{
19
	int i;
20
 
21
	if(mp==0 || ms<=0)
22
		return;
23
	if(mp[0].s.sp==0 || sp->m[0].s.sp<mp[0].s.sp ||
24
	   (sp->m[0].s.sp==mp[0].s.sp && sp->m[0].e.ep>mp[0].e.ep)){
25
		for(i=0; i<ms && i<NSUBEXP; i++)
26
			mp[i] = sp->m[i];
27
		for(; i<ms; i++)
28
			mp[i].s.sp = mp[i].e.ep = 0;
29
	}
30
}
31
 
32
/*
33
 * Note optimization in _renewthread:
34
 * 	*lp must be pending when _renewthread called; if *l has been looked
35
 *		at already, the optimization is a bug.
36
 */
37
extern Relist*
38
_renewthread(Relist *lp,	/* _relist to add to */
39
	Reinst *ip,	/* instruction to add */
40
	Resublist *sep)	/* pointers to subexpressions */
41
{
42
	Relist *p;
43
 
44
	for(p=lp; p->inst; p++){
45
		if(p->inst == ip){
46
			if((sep)->m[0].s.sp < p->se.m[0].s.sp)
47
				p->se = *sep;
48
			return 0;
49
		}
50
	}
51
	p->inst = ip;
52
	p->se = *sep;
53
	(++p)->inst = 0;
54
	return p;
55
}
56