예제 #1
0
int
matchrule(				/* check for a match on this rule */
	RULEHD	*rp
)
{
	ID	tmpid;
	int	gotmatch;
	int	i;

	if (rp->qflg & FL(Q_MTL)) {
		if (!matname[0])
			return(0);
		tmpid.number = 0;
		tmpid.name = matname;
		if (!matchid(&tmpid, &idm(rp)[Q_MTL]))
			return(0);
	}
	if (rp->qflg & FL(Q_MAP)) {
		if (!mapname[0])
			return(0);
		tmpid.number = 0;
		tmpid.name = mapname;
		if (!matchid(&tmpid, &idm(rp)[Q_MAP]))
			return(0);
	}
	if (rp->qflg & FL(Q_GRP)) {
		tmpid.number = 0;
		gotmatch = 0;
		for (i = 0; group[i][0]; i++) {
			tmpid.name = group[i];
			gotmatch |= matchid(&tmpid, &idm(rp)[Q_GRP]);
		}
		if (!gotmatch)
			return(0);
	}
	if (rp->qflg & FL(Q_OBJ)) {
		if (!objname[0])
			return(0);
		tmpid.number = 0;
		tmpid.name = objname;
		if (!matchid(&tmpid, &idm(rp)[Q_OBJ]))
			return(0);
	}
	if (rp->qflg & FL(Q_FAC)) {
		tmpid.name = NULL;
		tmpid.number = faceno;
		if (!matchid(&tmpid, &idm(rp)[Q_FAC]))
			return(0);
	}
	return(1);
}
예제 #2
0
파일: ftdi.c 프로젝트: grobe0ba/plan9front
int
ftprobe(Serial *ser)
{
    Usbdev *ud = ser->dev->usb;

    if(matchid(ftinfo, ud->vid, ud->did) == nil)
        return -1;
    ftgettype(ser);
    return 0;
}
예제 #3
0
파일: ra_ps.c 프로젝트: Pizookies/Radiance
static void
parsepaper(		/* determine paper size from name */
	char	*ps
)
{
	static struct psize {char n[12]; float w,h;} p[] = {
		{"envelope", 4.12, 9.5},
		{"executive", 7.25, 10.5},
		{"letter", 8.5, 11.},
		{"lettersmall", 7.68, 10.16},
		{"legal", 8.5, 14.},
		{"monarch", 3.87, 7.5},
		{"statement", 5.5, 8.5},
		{"tabloid", 11., 17.},
		{"A3", 11.69, 16.54},
		{"A4", 8.27, 11.69},
		{"A4small", 7.47, 10.85},
		{"A5", 6.00, 8.27},
		{"A6", 4.13, 6.00},
		{"B4", 10.12, 14.33},
		{"B5", 7.17, 10.12},
		{"C5", 6.38, 9.01},
		{"C6", 4.49, 6.38},
		{"DL", 4.33, 8.66},
		{"hagaki", 3.94, 5.83},
		{"",0.0,0.0} };
	register struct psize	*pp;
	register char	*s = ps;
	double	d;

	if (isdigit(*s)) {		/* check for WWxHH specification */
		width = atof(s);
		while (*s && !isalpha(*s))
			s++;
		d = unit2inch(s);
		height = atof(++s);
		width *= d;
		height *= d;
		if ((width >= 1.) & (height >= 1.))
			return;
	} else				/* check for match to standard size */
		for (pp = p; pp->n[0]; pp++)
			if (matchid(s, pp->n)) {
				width = pp->w;
				height = pp->h;
				return;
			}
	fprintf(stderr, "%s: unknown paper size \"%s\" -- known sizes:\n",
			progname, ps);
	fprintf(stderr, "_Name________Width_Height_(inches)\n");
	for (pp = p; pp->n[0]; pp++)
		fprintf(stderr, "%-11s  %5.2f  %5.2f\n", pp->n, pp->w, pp->h);
	fprintf(stderr, "Or use WWxHH size specification\n");
	exit(1);
}
예제 #4
0
파일: ucons.c 프로젝트: grobe0ba/plan9front
int
uconsprobe(Serial *ser)
{
	Usbdev *ud = ser->dev->usb;
	Cinfo *ip;

	if((ip = matchid(uconsinfo, ud->vid, ud->did)) == nil)
		return -1;
	ser->nifcs = ip->cid;
	return 0;
}
예제 #5
0
void CSGOMatchList::OnMatchList(const CMsgGCCStrike15_v2_MatchList& msg)
{
    std::unique_lock<std::mutex> lock(m_matchMutex);
    exposedProt = msg;
    size_t oldCount = m_matches.size();
    for (auto it = msg.matches().rbegin(); it != msg.matches().rend(); ++it)
    {
        auto oldmatch = std::find_if(m_matches.begin(), m_matches.end(), [it](CDataGCCStrike15_v2_MatchInfo& info)
        {
            return info.matchid() == it->matchid();
        });

        if (oldmatch == m_matches.end())
            m_matches.push_back(*it);
    }
    m_updateComplete = true;
    lock.unlock();
    m_updateCv.notify_all();
}