Ejemplo n.º 1
0
LogVarSet
ConstraintTree::singletons (void)
{
  LogVarSet singletons;
  for (size_t i = 0; i < logVars_.size(); i++) {
    if (isSingleton (logVars_[i])) {
      singletons.insert (logVars_[i]);
    }
  }  
  return singletons;
}
Ejemplo n.º 2
0
int onList(char* type)
{
	char c,
		line[1000] = {0};
	int i = 0, end_list = 0, index;

	// check if it is really list
	line[i++] = '*';	// '*' is missing in recognizing char in main.c, so we add it.
	c = fgetc(input);
	while( c != '\n' && c != EOF )
	{	// read the line
		line[i++] = c;
		line[i] = '\0';
		c = fgetc(input);
	}
	i = 0;

	c = fgetc(input);
	if( c == '*' )
	{
		fprintf(output, "<%s>\n<li>", type);
		i = 1;	// ommit '*' in first char
	}

	while( line[i] != '\0' )
	{
		index = isSingleton(line[i], 3);
		if( index != -1 )
		{
			onSingleton(index);
		}
		else
		{
			fprintf(output, "%c", line[i]);
		}
		i++;
	}
	fprintf(output, "\n");

	if( c != '*' )
	{
		return 1;	// that isn't list;
	}

	do {
		c = fgetc(input);
		if( c == '\n' )
		{
			c = fgetc(input);
			if( c == '*' )
			{
				fprintf(output, "</li>\n<li>");
			}
			else if( c == '\n' )
			{
				end_list = 1;
				fprintf(output, "</li>\n");
			}
			else
			{
				fprintf(output, "%c\n", c);
			}
		}
		else if( (index = isSingleton(c, 3) ) != -1 )
		{
			onSingleton(index);
		}
		else
		{
			fprintf(output, "%c", c);
		}
	} while(end_list == 0 && c != EOF);

	fprintf(output, "</%s>\n", type);

	return 0;
}