Example #1
0
/* IScanner */
static inline int ParseSection(struct IParse *parse, struct ISettings *settings)
{
	ParseComment(parse);
	ParseSkip(parse);

	int code = ParsePeek(parse, 0);
	if (!(code == '[')) {
		return 0;
	}

	ParseRead(parse); /* [ */
	ParseSkip(parse);

	/* Section Name */
	char name[MAX_NAME];
	if (!ParseName(parse, name, MAX_NAME)) {
		return 0;
	}

	ParseSkip(parse);
	code = ParsePeek(parse, 0);
	if (!(code == ']')) {
		return 0;
	}

	ParseRead(parse); /* "]" */

	HSECTION section = NULL;
	if (!(section = CreateSection(settings, name))) {
		return 0;
	}

	while (ParseValue(parse, section));
	return 1;
}
Example #2
0
/* IScanner */
static inline int ParseValue(struct IParse *parse, struct ISection *section)
{
	ParseComment(parse);
	ParseSkip(parse);

	/* Value Name */
	char name[MAX_NAME];
	if (!ParseName(parse, name, MAX_NAME)) {
		return 0;
	}

	ParseSkip(parse);
	int code = ParsePeek(parse, 0);
	if (!(code == '=')) {
		return 0;
	}

	ParseRead(parse); /* = */
	ParseSkip(parse);

	/* Value Data */
	char data[MAX_VALUE];
	if (!ParseData(parse, data, MAX_VALUE)) {
		return 0;	
	}

	AddSectionString(section, name, data);
	return 1;
}
Example #3
0
FileEntry::FileEntry(const char *path, time_t s, time_t d, const char *skip)
{
    file = path;
    start_time = s;
    duration = d;
    ParseSkip(skip);
}
Example #4
0
/* IScanner */
static inline int ParseCommentLine(struct IParse *parse)
{
	ParseSkip(parse);
	if (!IsComment(parse)) {
		return 0;
	}

	int code = 0;
	while ((code = ParseRead(parse)) != -1) {
		if (IsNewline(code)) {
			return 1;
		}
	}
	return 1;
}