void netLineFilter(struct lineFile *lf, FILE *f)
/* Do filter one line at a time. */
{
struct hash *nameHash = newHash(0);
char *line, *l;
int d;

while (lineFileNext(lf, &line, NULL))
    {
    d = countLeadingChars(line, ' ');
    l = line + d;
    if (startsWith("fill", l) || startsWith("gap", l))
        {
	struct cnFill *fill = cnFillFromLine(nameHash, lf, l);
	if (filterOne(fill))
	    cnFillWrite(fill, f, d);
	cnFillFree(&fill);
	}
    else
        {
	fprintf(f, "%s\n", line);
	}
    }

hashFree(&nameHash);
}
Пример #2
0
struct cnFill *cnFillRead(struct chainNet *net, struct lineFile *lf)
/* Recursively read in list and children from file. */
{
char *line;
int d, depth = 0;
struct cnFill *fillList = NULL;
struct cnFill *fill = NULL;

for (;;)
    {
    if (!lineFileNextReal(lf, &line))
	break;
    d = countLeadingChars(line, ' ');
    if (fill == NULL)
        depth = d;
    if (d < depth)
	{
	lineFileReuse(lf);
	break;
	}
    if (d > depth)
        {
	lineFileReuse(lf);
	fill->children = cnFillRead(net, lf);
	}
    else
        {
	fill = cnFillFromLine(net->nameHash, lf, line);
	slAddHead(&fillList, fill);
	}
    }
slReverse(&fillList);
return fillList;
}
Пример #3
0
U_32 type_info_get_num_array_dimensions(Type_Info_Handle tih) {
    TypeDesc* td = (TypeDesc*)tih;
    if (td->get_kind() == K_Vector) {
        const String* name = td->get_type_name();
        U_32 res = 0;
        if (name == NULL) {
            res = 1 + type_info_get_num_array_dimensions(td->get_element_type());
        } else {
            res = countLeadingChars(name->bytes, '[');
        }
        assert(res<=255);
        return res;
    }
    return 0;
}