Exemplo n.º 1
0
BOOL IsFixedPalette(Chunk_With_Children * parent)
{
	if (parent)
	{
		List<Chunk *> plist;
		parent->lookup_child("PRSETPAL",plist);
		
		LIF<Chunk *> plit(&plist);
		for (; !plit.done(); plit.next())
		{
			for (LIF<Preset_Palette> findconst(&((Preset_Palette_Chunk *)plit())->pplist); !findconst.done(); findconst.next())
			{
				if (findconst().flags & PrePalFlag_Reserved)
				{
					return TRUE;
				}
			}
		}
		parent->lookup_child("SETPALST",plist);
		for (plit = LIF<Chunk *> (&plist); !plit.done(); plit.next())
		{
			for (LIF<Preset_Palette> findconst(&((Preset_Palette_Store_Chunk *)plit())->pplist); !findconst.done(); findconst.next())
			{
				if (findconst().flags & PrePalFlag_Reserved)
				{
					return TRUE;
				}
			}
		}
	}
	return FALSE;
}
Exemplo n.º 2
0
void FixedPalette_Outdated(Chunk_With_Children * parent)
{
	if (parent)
	{
		List<Chunk *> plist;
		parent->lookup_child("PRSETPAL",plist);
		for (LIF<Chunk *> plit(&plist); !plit.done(); plit.next())
		{
			for (LIF<Preset_Palette> findconst(&((Preset_Palette_Chunk *)plit())->pplist); !findconst.done(); findconst.next())
			{
				Preset_Palette temp = findconst();
				if (temp.flags & PrePalFlag_Reserved)
				{
					temp.flags &= ~PrePalFlag_UpToDate;
					findconst.change_current(temp);
				}
			}
		}
	}
}
Exemplo n.º 3
0
/*
 * Get the next token, printing out any directive that are encountered.
 */
void
get_token (token *tokp)
{
  int commenting;

  if (pushed)
    {
      pushed = 0;
      *tokp = lasttok;
      return;
    }
  commenting = 0;
  for (;;)
    {
      if (*where == 0)
	{
	  for (;;)
	    {
	      if (!fgets (curline, MAXLINESIZE, fin))
		{
		  tokp->kind = TOK_EOF;
		  *curline = 0;
		  where = curline;
		  return;
		}
	      linenum++;
	      if (commenting)
		{
		  break;
		}
	      else if (cppline (curline))
		{
		  docppline (curline, &linenum,
			     &infilename);
		}
	      else if (directive (curline))
		{
		  printdirective (curline);
		}
	      else
		{
		  break;
		}
	    }
	  where = curline;
	}
      else if (isspace (*where))
	{
	  while (isspace (*where))
	    {
	      where++;		/* eat */
	    }
	}
      else if (commenting)
	{
	  for (where++; *where; where++)
	    {
	      if (endcomment (where))
		{
		  where++;
		  commenting--;
		  break;
		}
	    }
	}
      else if (startcomment (where))
	{
	  where += 2;
	  commenting++;
	}
      else
	{
	  break;
	}
    }

  /*
   * 'where' is not whitespace, comment or directive Must be a token!
   */
  switch (*where)
    {
    case ':':
      tokp->kind = TOK_COLON;
      where++;
      break;
    case ';':
      tokp->kind = TOK_SEMICOLON;
      where++;
      break;
    case ',':
      tokp->kind = TOK_COMMA;
      where++;
      break;
    case '=':
      tokp->kind = TOK_EQUAL;
      where++;
      break;
    case '*':
      tokp->kind = TOK_STAR;
      where++;
      break;
    case '[':
      tokp->kind = TOK_LBRACKET;
      where++;
      break;
    case ']':
      tokp->kind = TOK_RBRACKET;
      where++;
      break;
    case '{':
      tokp->kind = TOK_LBRACE;
      where++;
      break;
    case '}':
      tokp->kind = TOK_RBRACE;
      where++;
      break;
    case '(':
      tokp->kind = TOK_LPAREN;
      where++;
      break;
    case ')':
      tokp->kind = TOK_RPAREN;
      where++;
      break;
    case '<':
      tokp->kind = TOK_LANGLE;
      where++;
      break;
    case '>':
      tokp->kind = TOK_RANGLE;
      where++;
      break;

    case '"':
      tokp->kind = TOK_STRCONST;
      findstrconst (&where, &tokp->str);
      break;
    case '\'':
      tokp->kind = TOK_CHARCONST;
      findchrconst (&where, &tokp->str);
      break;

    case '-':
    case '0':
    case '1':
    case '2':
    case '3':
    case '4':
    case '5':
    case '6':
    case '7':
    case '8':
    case '9':
      tokp->kind = TOK_IDENT;
      findconst (&where, &tokp->str);
      break;

    default:
      if (!(isalpha (*where) || *where == '_'))
	{
	  char buf[100];
	  char *p;

	  s_print (buf, ("illegal character in file: "));
	  p = buf + strlen (buf);
	  if (isprint (*where))
	    {
	      s_print (p, "%c", *where);
	    }
	  else
	    {
	      s_print (p, "%d", *where);
	    }
	  error (buf);
	}
      findkind (&where, tokp);
      break;
    }
}