Ejemplo n.º 1
0
XMLDocument::~XMLDocument()
{
    scope->unregisterPointer(document);
    scope->removeId(id);
    if (document)
    {
        openDocs.remove(this);
        if (openDocs.size() == 0 && XMLValidation::getOpenValidationFiles().size() == 0)
        {
            resetScope();
        }
        xmlFreeDoc(document);
    }

#ifdef SCILAB_DEBUG_XML
    for (std::set<XMLObject *>::const_iterator i = XMLObject::pointers.begin(), e = XMLObject::pointers.end(); i != e; ++i)
    {
        XMLObject * p = *i;
        if (p != this)
        {
            std::cout << "Stay = " << (void*)p << ":" << typeid(*p).name() << std::endl;
        }
    }
#endif
}
Ejemplo n.º 2
0
void Scope::refreshScope() {
  if( paused ) return;
  if( !isVisible() ) return;

  if( !shmReader.valid() )
  {
    resetScope();
  }

  unsigned int frames;
  if( shmReader.pull( frames ) )
  {
    emptyFrames = 0;
    float* data = shmReader.data();
    for( unsigned int j = 0; j < 2; ++j )
    {
      unsigned int offset = shmReader.max_frames() * j;
      for( unsigned int i = 0; i < 4096 - frames; ++i )
      {
        sample[j][i] = sample[j][i+frames];
      }

      for( unsigned int i = 0; i < frames; ++i )
      {
        sample[j][4096-frames+i] = data[i+offset];
      }
    }
    for( auto scope : panels )
    {
      scope->refresh();
    }
  } else
  {
    ++emptyFrames;
    if( emptyFrames > 10 )
    {
      resetScope();
      emptyFrames = 0;
    }
  }
}
Ejemplo n.º 3
0
XMLValidationRelaxNG::~XMLValidationRelaxNG()
{
    scope->unregisterPointer(validationFile);
    scope->removeId(id);
    if (validationFile)
    {
        xmlRelaxNGFree((xmlRelaxNG *) validationFile);
        openValidationFiles.remove(this);
        if (openValidationFiles.size() == 0 && XMLDocument::getOpenDocuments().size() == 0)
        {
            resetScope();
        }
    }

    if (errorBuffer)
    {
        delete errorBuffer;

        errorBuffer = 0;
    }
}
Ejemplo n.º 4
0
/*
 * Rust is very liberal with nesting, so this function is used pretty much for any block
 */
static void parseBlock (lexerState *lexer, boolean delim, int kind, vString *scope)
{
	int level = 1;
	if (delim)
	{
		if (lexer->cur_token != '{')
			return;
		advanceToken(lexer, TRUE);
	}
	while (lexer->cur_token != TOKEN_EOF)
	{
		if (lexer->cur_token == TOKEN_IDENT)
		{
			size_t old_scope_len = vStringLength(scope);
			if (strcmp(lexer->token_str->buffer, "fn") == 0)
			{
				parseFn(lexer, scope, kind);
			}
			else if(strcmp(lexer->token_str->buffer, "mod") == 0)
			{
				parseMod(lexer, scope, kind);
			}
			else if(strcmp(lexer->token_str->buffer, "static") == 0)
			{
				parseStatic(lexer, scope, kind);
			}
			else if(strcmp(lexer->token_str->buffer, "trait") == 0)
			{
				parseTrait(lexer, scope, kind);
			}
			else if(strcmp(lexer->token_str->buffer, "type") == 0)
			{
				parseType(lexer, scope, kind);
			}
			else if(strcmp(lexer->token_str->buffer, "impl") == 0)
			{
				parseImpl(lexer, scope, kind);
			}
			else if(strcmp(lexer->token_str->buffer, "struct") == 0)
			{
				parseStructOrEnum(lexer, scope, kind, TRUE);
			}
			else if(strcmp(lexer->token_str->buffer, "enum") == 0)
			{
				parseStructOrEnum(lexer, scope, kind, FALSE);
			}
			else if(strcmp(lexer->token_str->buffer, "macro_rules") == 0)
			{
				parseMacroRules(lexer, scope, kind);
			}
			else
			{
				advanceToken(lexer, TRUE);
				if (lexer->cur_token == '!')
				{
					skipMacro(lexer);
				}
			}
			resetScope(scope, old_scope_len);
		}
		else if (lexer->cur_token == '{')
		{
			level++;
			advanceToken(lexer, TRUE);
		}
		else if (lexer->cur_token == '}')
		{
			level--;
			advanceToken(lexer, TRUE);
		}
		else if (lexer->cur_token == '\'')
		{
			/* Skip over the 'static lifetime, as it confuses the static parser above */
			advanceToken(lexer, TRUE);
			if (lexer->cur_token == TOKEN_IDENT && strcmp(lexer->token_str->buffer, "static") == 0)
				advanceToken(lexer, TRUE);
		}
		else
		{
			advanceToken(lexer, TRUE);
		}
		if (delim && level <= 0)
			break;
	}
}