void parse_file(TextCursor cursor, int min_length, 
                std::set<std::string>& schemas)
{
    int uri_length, i = 0, pos;
    while(!cursor.eof())
    {
        try
        {
            TextCursor stop_cursor(parse_uri(cursor));
            if (schemas.size() > 0)
            {
                std::string scheme = get_scheme(cursor);
                if(schemas.count(scheme) == 0)
                    throw ParseError();
            }
            uri_length = stop_cursor.get_offset() - cursor.get_offset();
            char uri[uri_length + 1];
            pos = cursor.get_offset();
            cursor.gets(uri_length, uri);
            if(uri_length >= min_length)
            {
                save_uri(i++, uri, pos);
                printf("%4d %s\n", pos, uri);
                cursor = stop_cursor;
            }
        }
        catch(ParseError)
        {
            cursor.get();
        }
    }
}
Beispiel #2
0
void PlaybackEngine::run()
{
	start_lock->unlock();

	do
	{
// Wait for current command to finish
		que->output_lock->lock("PlaybackEngine::run");

		wait_render_engine();


// Read the new command
		que->input_lock->lock("PlaybackEngine::run");
		if(done) return;

		command->copy_from(&que->command);
		que->command.reset();
		que->input_lock->unlock();

//printf("PlaybackEngine::run 1 %d\n", command->command);


		switch(command->command)
		{
// Parameter change only
			case COMMAND_NONE:
//				command->command = last_command;
				perform_change();
				break;

			case PAUSE:
				init_cursor();
				pause_lock->lock("PlaybackEngine::run");
				stop_cursor();
				break;

			case STOP:
// No changing
				break;

			case CURRENT_FRAME:
				last_command = command->command;
				perform_change();
				arm_render_engine();
// Dispatch the command
				start_render_engine();
				break;

			default:
				last_command = command->command;
				is_playing_back = 1;
 				if(command->command == SINGLE_FRAME_FWD ||
					command->command == SINGLE_FRAME_REWIND)
				{
 					command->playbackstart = get_tracking_position();
				}

				perform_change();
				arm_render_engine();

// Start tracking after arming so the tracking position doesn't change.
// The tracking for a single frame command occurs during PAUSE
				init_tracking();

// Dispatch the command
				start_render_engine();
				break;
		}


//printf("PlaybackEngine::run 100\n");
	}while(!done);
}
Beispiel #3
0
void PlaybackEngine::stop_tracking()
{
	tracking_active = 0;
	stop_cursor();
	tracking_done->unlock();
}