Exemple #1
0
/**
 * This function does the preparsing and issues the art fetching requests
 */
static void *Thread( void *data )
{
    playlist_preparser_t *p_preparser = data;
    vlc_object_t *obj = p_preparser->object;

    for( ;; )
    {
        input_item_t *p_current;

        /* */
        vlc_mutex_lock( &p_preparser->lock );
        if( p_preparser->i_waiting > 0 )
        {
            p_current = p_preparser->pp_waiting[0];
            REMOVE_ELEM( p_preparser->pp_waiting, p_preparser->i_waiting, 0 );
        }
        else
        {
            p_current = NULL;
            p_preparser->b_live = false;
            vlc_cond_signal( &p_preparser->wait );
        }
        vlc_mutex_unlock( &p_preparser->lock );

        if( !p_current )
            break;

        Preparse( obj, p_current );

        Art( p_preparser, p_current );
        vlc_gc_decref(p_current);
    }
    return NULL;
}
Exemple #2
0
/**
 * This function does the preparsing and issues the art fetching requests
 */
static void *Thread( void *data )
{
    playlist_preparser_t *p_preparser = data;
    playlist_t *p_playlist = p_preparser->p_playlist;

    for( ;; )
    {
        input_item_t *p_current;

        /* */
        vlc_mutex_lock( &p_preparser->lock );
        if( p_preparser->i_waiting > 0 )
        {
            p_current = p_preparser->pp_waiting[0];
            REMOVE_ELEM( p_preparser->pp_waiting, p_preparser->i_waiting, 0 );
        }
        else
        {
            p_current = NULL;
            p_preparser->b_live = false;
        }
        vlc_mutex_unlock( &p_preparser->lock );

        if( !p_current )
            break;

        Preparse( p_playlist, p_current );

        Art( p_preparser, p_current );
    }
    return NULL;
}
void C4ScriptHost::MakeScript()
{
	// clear prev
	Script.Clear();

	// create script
	if (stringTable)
	{
		stringTable->ReplaceStrings(ComponentHost.GetDataBuf(), Script);
	}
	else
	{
		Script.Ref(ComponentHost.GetDataBuf());
	}

	// preparse script
	Preparse();
}
bool C4ScriptHost::LoadData(const char *szFilename, const char *szData, class C4LangStringTable *pLocalTable)
{
	// String Table
	if (stringTable != pLocalTable)
	{
		if (stringTable) stringTable->DelRef();
		stringTable = pLocalTable;
		if (stringTable) stringTable->AddRef();
	}
	ScriptName.Copy(szFilename);

	StdStrBuf tempScript;
	tempScript.Copy(szData);

	Script.Clear();
	if(stringTable)
		stringTable->ReplaceStrings(tempScript, Script);
	else
		Script.Take(tempScript);

	Preparse();
	return true;
}
Exemple #5
0
/**
 * This function does the preparsing and issues the art fetching requests
 */
static void *Thread( void *data )
{
    playlist_preparser_t *p_preparser = data;

    for( ;; )
    {
        input_item_t *p_current;
        input_item_meta_request_option_t i_options;

        /* */
        vlc_mutex_lock( &p_preparser->lock );
        if( p_preparser->i_waiting > 0 )
        {
            preparser_entry_t *p_entry = p_preparser->pp_waiting[0];
            p_current = p_entry->p_item;
            i_options = p_entry->i_options;
            free( p_entry );
            REMOVE_ELEM( p_preparser->pp_waiting, p_preparser->i_waiting, 0 );
        }
        else
        {
            p_current = NULL;
            p_preparser->b_live = false;
            vlc_cond_signal( &p_preparser->wait );
        }
        vlc_mutex_unlock( &p_preparser->lock );

        if( !p_current )
            break;

        Preparse( p_preparser, p_current, i_options );

        Art( p_preparser, p_current );
        vlc_gc_decref(p_current);
    }
    return NULL;
}
Exemple #6
0
bool slFileObj::Load() {
	Reset();
	ScenePtr = mScene;

	FILE*  infile = fopen(mFilename, "r");
	FileLineNumber = 0;

	if (!infile) {
		fprintf(stderr, "LoadObjFile: Unable to open file: %s\n", mFilename);
		return false;
	}

	char inbuffer[1026];
	while (true) {
		if (!fgets(inbuffer, 1026, infile)) {
			fclose(infile);
			PrintCmdNotSupportedErrors(stderr);
			return true;
		}

		FileLineNumber++;

		char*  findStart = Preparse(inbuffer);
		if (findStart == 0 || (*findStart) == '#') {
			continue;	//Ignore if a comment or a blank line
		}

		bool parseErrorOccurred = false;

		char theCommand[17];
		int scanCode = sscanf(inbuffer, "%16s", theCommand);
		if (scanCode != 1) {
			parseErrorOccurred = true;
		}

		int cmdNum = GetCommandNumber(theCommand);
		if (cmdNum == -1) {
			AddUnsupportedCmd(theCommand);
			continue;
		}

		char*  args = ScanForSecondField(findStart);
		bool ok = true;
		switch (cmdNum) {
			case 0: //'v' command
				{
					vec4*  vertData = Vertices.Add();
					ok = ReadVectorR4Hg(args, vertData);
				}
				break;
			case 1: //"vt" command
				{
					vec2*  texData = TextureCoords.Add();
					ok = ReadTexCoords(args, texData);
				}
				break;
			case 2: //The 'f' command
				{
					ok = ProcessFace(args , mDefaultMat);
				}
				break;
			case 3: //'l' command
				UnsupportedLines();
				break;
			default:
				parseErrorOccurred = true;
				break;
		}

		if (!ok) {
			parseErrorOccurred = true;
		}
	}
}