Beispiel #1
0
void CSegment::Read (CFile& cf)
{
#if DBG
if (Index () == nDbgSeg)
	nDbgSeg = nDbgSeg;
#endif
if (gameStates.app.bD2XLevel) {
	m_owner = cf.ReadByte ();
	m_group = cf.ReadByte ();
	}
else {
	m_owner = -1;
	m_group = -1;
	}

ubyte flags = bNewFileFormat ? cf.ReadByte () : 0x7f;

if (gameData.segs.nLevelVersion == 5) { // d2 SHAREWARE level
	ReadType (cf, flags);
	ReadVerts (cf);
	ReadChildren (cf, flags);
	}
else {
	ReadChildren (cf, flags);
	ReadVerts (cf);
	if (gameData.segs.nLevelVersion <= 1) { // descent 1 level
		ReadType (cf, flags);
		}
	}
m_objects = -1;

if (gameData.segs.nLevelVersion <= 5) // descent 1 thru d2 SHAREWARE level
	m_xAvgSegLight	= fix (cf.ReadShort ()) << 4;

// Read the walls as a 6 byte array
flags = bNewFileFormat ? cf.ReadByte () : 0x3f;

int i;

for (i = 0; i < MAX_SIDES_PER_SEGMENT; i++)
	m_sides [i].ReadWallNum (cf, (flags & (1 << i)) != 0);

ushort sideVerts [4];

for (i = 0; i < MAX_SIDES_PER_SEGMENT; i++) {
	::GetCorners (Index (), i, sideVerts);
	m_sides [i].Read (cf, sideVerts, m_children [i] == -1);
	}
}
//-----------------------------------------------------------------------------------------------
bool ResourceStream::ReadBool()
{
	ReadPastWhitespaceAndComments();
	if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
	{
		unsigned char asByte;
		ReadType( asByte );
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadBool at offset %d, value was %d\n", m_currentReadOffset, asByte );
		return( asByte != 0 );
	}

	char nextChar = ReadCharDirectly();
	if( nextChar == 'f' )
	{
		ReadExpectedToken( "alse" );
		return false;
	}
	else if( nextChar == 't' )
	{
		ReadExpectedToken( "rue" );
		return true;
	}
	else
	{
		{ int q = 5; } //JAZZ_ERROR( "ResourceStream::ReadBool", Stringf( "Expected either \"true\" or \"false\" (lower case), found illegal character '%c'.", nextChar ) );
	}
}
// Read a string
//
void CConnexionSocket::ReadType( CString& Str )
{
	short	Len;
	ReadType( Len );

	char* Buf = (char*) malloc(Len+1);
	if( Buf==NULL )
	{
		CString Str;
		Str.Format( _T("La tentative d'allouer %i octets à échouée"), Len );
		AfxMessageBox( Str );
		return;
	}
	memcpy( Buf, m_BufferReceive, Len );
	Buf[Len] = 0;

	Str = Buf;

	char* BufferTemp = (char*) malloc( m_BufferReceiveSize-Len );
	memcpy( BufferTemp, &m_BufferReceive[Len], m_BufferReceiveSize-Len );
	free( m_BufferReceive );
	m_BufferReceive = BufferTemp;
	m_BufferReceiveSize -= Len;
	free( Buf );
}
//-----------------------------------------------------------------------------------------------
AABB2 ResourceStream::ReadAABB2()
{
	AABB2 returnValue;

	if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
	{
		ReadType( returnValue );
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadAABB2 at offset %d, value was (%g,%g),(%g,%g)\n", m_currentReadOffset, returnValue.mins.x, returnValue.mins.y, returnValue.maxs.x, returnValue.maxs.y );
		return returnValue;
	}

	ReadExpectedToken( "AABB2" );
	ReadExpectedToken( '[' );
	ReadExpectedToken( '(' );
	returnValue.mins.x = ReadFloat();
	ReadExpectedToken( ',' );
	returnValue.mins.y = ReadFloat();
	ReadExpectedToken( ')' );
	ReadExpectedToken( ',' );
	ReadExpectedToken( '(' );
	returnValue.maxs.x = ReadFloat();
	ReadExpectedToken( ',' );
	returnValue.maxs.y = ReadFloat();
	ReadExpectedToken( ')' );
	ReadExpectedToken( ']' );

	return returnValue;
}
//-----------------------------------------------------------------------------------------------
void ResourceStream::SetFormatTypeBasedOnBufferContents()
{
	// DEBUGGING - { int q = 5; } //ConsolePrintf( "ResourceStream::SetFormatTypeBasedOnBufferContents() called for RS \"%s\".\n", m_jazzPath..c_str() );

	//const int numBytesToPrint = MinInt( m_dataBytesAvailable, 12 );
	//{ int q = 5; } //ConsolePrintf( "RS appears to have %d bytes in it; the first %d are:\n", m_dataBytesAvailable, numBytesToPrint );
	//for( int i = 0; i < numBytesToPrint; ++ i )
	//{
	//	unsigned char thisByte = m_startOfData[ i ];
	//	{ int q = 5; } //ConsolePrintf( "0x%02x ", thisByte );
	//}
	//{ int q = 5; } //ConsolePrintf( "End of first-%d-bytes list.\n", numBytesToPrint );

	// Check if the file is at least 4 bytes in size (minimum size for binary format)
	if( m_dataBytesAvailable < 4 )
	{
		m_internalFormat = RESOURCE_STREAM_FORMAT_TEXT_VERBOSE;
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "RS is shorter than 4 bytes, assuming format TEXT (assuming TEXT_VERBOSE)\n" );
		return;
	}

	// Check if the Binary header/marker is present
	unsigned int headerMarker;
	memcpy( &headerMarker, m_startOfData, sizeof( headerMarker ) );
	if( headerMarker == RESOURCE_STREAM_BINARY_HEADER )
	{
		m_internalFormat = RESOURCE_STREAM_FORMAT_BINARY;
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "RS appears to be BINARY; about to read binary format primer dword\n" );
		ReadType( headerMarker );
		return;
	}

	m_internalFormat = RESOURCE_STREAM_FORMAT_TEXT_VERBOSE;
	// DEBUGGING - { int q = 5; } //ConsolePrintf( "RS appears to be TEXT; assuming TEXT_VERBOSE\n" );
}
// Read a message
//
void CConnexionSocket::ReadAMessage( CString IP, int Port )
{
	short	MessageId;
	int		Len;

	ReadType( MessageId );
	ReadType( Len );

	switch( MessageId )
	{
	case SMI_TOSERVER_SEARCH_SERVER:
		break;
	default:
		{
			char a;
			for( int i=0; i<Len; i++ )
				ReadType( a );
		}
	}
}
//-----------------------------------------------------------------------------------------------
double ResourceStream::ReadDouble()
{
	if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
	{
		double returnValue;
		ReadType( returnValue );
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadFloat at offset %d, value was %.15Lf\n", m_currentReadOffset, returnValue );
		return returnValue;
	}

	double asDouble = ReadTextNumber();
	return asDouble;
}
//-----------------------------------------------------------------------------------------------
unsigned char ResourceStream::ReadByte()
{
	if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
	{
		unsigned char returnValue;
		ReadType( returnValue );
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadByte at offset %d, value was 0x%02x\n", m_currentReadOffset, returnValue );
		return returnValue;
	}

	double asDouble = ReadTextNumber();
	return (unsigned char) asDouble;
}
//-----------------------------------------------------------------------------------------------
char ResourceStream::ReadChar()
{
	if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
	{
		char returnValue;
		ReadType( returnValue );
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadChar at offset %d, value was %d, or '%c' (0x%02x)\n", m_currentReadOffset, returnValue, returnValue, returnValue );
		return returnValue;
	}

	// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadChar() called...\n" );
	double asDouble = ReadTextNumber();
	// DEBUGGING - { int q = 5; } //ConsolePrintf( "Read text number as double %.15Lf (%g), converting to char 0x%02x\n", asDouble, asDouble, (char) asDouble );
	return (char) asDouble;
}
//-----------------------------------------------------------------------------------------------
IntVector2 ResourceStream::ReadIntVector2()
{
	IntVector2 returnValue;

	if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
	{
		ReadType( returnValue );
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadIntVector2 at offset %d, value was (%d,%d)\n", m_currentReadOffset, returnValue.x, returnValue.y );
		return returnValue;
	}

	ReadExpectedToken( "IntVector2" );
	ReadExpectedToken( '(' );
	returnValue.x = ReadInt();
	ReadExpectedToken( ',' );
	returnValue.y = ReadInt();
	ReadExpectedToken( ')' );

	return returnValue;
}
//-----------------------------------------------------------------------------------------------
Rgba ResourceStream::ReadRgba()
{
	Rgba returnValue;

	if( m_internalFormat == RESOURCE_STREAM_FORMAT_BINARY )
	{
		ReadType( returnValue );
		// DEBUGGING - { int q = 5; } //ConsolePrintf( "ReadRgba at offset %d, value was (%d,%d,%d,%d)\n", m_currentReadOffset, returnValue.r, returnValue.g, returnValue.b, returnValue.a );
		return returnValue;
	}

	ReadExpectedToken( "Rgba" );
	ReadExpectedToken( '(' );
	returnValue.r = ReadByte();
	ReadExpectedToken( ',' );
	returnValue.g = ReadByte();
	ReadExpectedToken( ',' );
	returnValue.b = ReadByte();
	ReadExpectedToken( ',' );
	returnValue.a = ReadByte();
	ReadExpectedToken( ')' );

	return returnValue;
}
Beispiel #12
0
static int ParseManifest( addons_finder_t *p_finder, addon_entry_t *p_entry,
                          const char *psz_tempfile, stream_t *p_stream )
{
    int i_num_entries_created = 0;
    const char *p_node;
    int i_current_node_type;

    /* attr */
    const char *attr, *value;

    /* temp reading */
    const char *psz_filename = NULL;
    int i_filetype = -1;

    xml_reader_t *p_xml_reader = xml_ReaderCreate( p_finder, p_stream );
    if( !p_xml_reader ) return 0;

    if( xml_ReaderNextNode( p_xml_reader, &p_node ) != XML_READER_STARTELEM )
    {
        msg_Err( p_finder, "invalid xml file" );
        goto end;
    }

    if ( strcmp( p_node, "videolan") )
    {
        msg_Err( p_finder, "unsupported XML data format" );
        goto end;
    }

    while( (i_current_node_type = xml_ReaderNextNode( p_xml_reader, &p_node )) > 0 )
    {
        switch( i_current_node_type )
        {
        case XML_READER_STARTELEM:
        {
            BINDNODE("resource", psz_filename, TYPE_STRING)
            data_pointer.e_type = TYPE_NONE;

            /*
             * Manifests are not allowed to update addons properties
             * such as uuid, score, downloads, ...
             * On the other hand, repo API must not set files directly.
             */

            if ( ! strcmp( p_node, "resource" ) )
            {
                while( (attr = xml_ReaderNextAttr( p_xml_reader, &value )) )
                {
                    if ( !strcmp( attr, "type" ) )
                    {
                        i_filetype = ReadType( value );
                    }
                }
            }
            else if ( ! strcmp( p_node, "addon" ) )
            {
                while( (attr = xml_ReaderNextAttr( p_xml_reader, &value )) )
                {
                    if ( !strcmp( attr, "type" ) )
                    {
                        p_entry->e_type = ReadType( value );
                    }
                }
            }

            break;
        }
        case XML_READER_TEXT:
            if ( data_pointer.e_type == TYPE_NONE || !p_entry ) break;
            if ( data_pointer.e_type == TYPE_STRING )
                *data_pointer.u_data.ppsz = strdup( p_node );
            else
            if ( data_pointer.e_type == TYPE_LONG )
                *data_pointer.u_data.pl = atol( p_node );
            else
            if ( data_pointer.e_type == TYPE_INTEGER )
                *data_pointer.u_data.pi = atoi( p_node );
            break;

        case XML_READER_ENDELEM:

            if ( ! strcmp( p_node, "resource" ) )
            {
                if ( psz_filename && i_filetype >= 0 )
                {
                    addon_file_t *p_file = malloc( sizeof(addon_file_t) );
                    p_file->e_filetype = i_filetype;
                    p_file->psz_filename = strdup( psz_filename );
                    if ( asprintf( & p_file->psz_download_uri, "unzip://%s!/%s",
                                   psz_tempfile, psz_filename  ) > 0 )
                    {
                        ARRAY_APPEND( p_entry->files, p_file );
                        msg_Dbg( p_finder, "manifest lists file %s extractable from %s",
                                 psz_filename, p_file->psz_download_uri );
                        i_num_entries_created++;
                    }
                    else
                    {
                        free( p_file->psz_filename );
                        free( p_file );
                    }
                }
                /* reset temp */
                psz_filename = NULL;
                i_filetype = -1;
            }

            data_pointer.e_type = TYPE_NONE;
            break;

        default:
            break;
        }
    }

end:
   xml_ReaderDelete( p_xml_reader );
   return i_num_entries_created;
}
Beispiel #13
0
static int ParseCategoriesInfo( addons_finder_t *p_finder, stream_t *p_stream )
{
    int i_num_entries_created = 0;

    const char *p_node;
    const char *attr, *value;
    int i_current_node_type;
    addon_entry_t *p_entry = NULL;

    xml_reader_t *p_xml_reader = xml_ReaderCreate( p_finder, p_stream );
    if( !p_xml_reader ) return 0;

    if( xml_ReaderNextNode( p_xml_reader, &p_node ) != XML_READER_STARTELEM )
    {
        msg_Err( p_finder, "invalid xml file" );
        goto end;
    }

    if ( strcmp( p_node, "videolan") )
    {
        msg_Err( p_finder, "unsupported XML data format" );
        goto end;
    }

    while( (i_current_node_type = xml_ReaderNextNode( p_xml_reader, &p_node )) > 0 )
    {
        switch( i_current_node_type )
        {
        case XML_READER_STARTELEM:
        {
            if ( ! strcmp( p_node, "addon" ) )
            {
                if ( p_entry ) /* Unclosed tag */
                    addon_entry_Release( p_entry );
                p_entry = addon_entry_New();
                p_entry->psz_source_module = strdup( ADDONS_MODULE_SHORTCUT );
                p_entry->e_flags = ADDON_MANAGEABLE;
                p_entry->e_state = ADDON_NOTINSTALLED;

                while( (attr = xml_ReaderNextAttr( p_xml_reader, &value )) )
                {
                    if ( !strcmp( attr, "type" ) )
                    {
                        p_entry->e_type = ReadType( value );
                    }
                    else if ( !strcmp( attr, "id" ) )
                    {
                        addons_uuid_read( value, & p_entry->uuid );
                    }
                    else if ( !strcmp( attr, "downloads" ) )
                    {
                        p_entry->i_downloads = atoi( value );
                    }
                    else if ( !strcmp( attr, "score" ) )
                    {
                        p_entry->i_score = atol( value );
                    }
                    else if ( !strcmp( attr, "version" ) )
                    {
                        p_entry->psz_version = strdup( value );
                    }
                }

                break;
            }
            if ( !p_entry ) break;

            BINDNODE("name", p_entry->psz_name, TYPE_STRING)
            BINDNODE("archive", p_entry->psz_archive_uri, TYPE_STRING)
            BINDNODE("summary", p_entry->psz_summary, TYPE_STRING)
            BINDNODE("description", p_entry->psz_description, TYPE_STRING)
            BINDNODE("image", p_entry->psz_image_data, TYPE_STRING)
            BINDNODE("creator", p_entry->psz_author, TYPE_STRING)
            BINDNODE("sourceurl", p_entry->psz_source_uri, TYPE_STRING)
            data_pointer.e_type = TYPE_NONE;

            break;
        }
        case XML_READER_TEXT:
            if ( data_pointer.e_type == TYPE_NONE || !p_entry ) break;
            if ( data_pointer.e_type == TYPE_STRING )
                *data_pointer.u_data.ppsz = strdup( p_node );
            else
            if ( data_pointer.e_type == TYPE_LONG )
                *data_pointer.u_data.pl = atol( p_node );
            else
            if ( data_pointer.e_type == TYPE_INTEGER )
                *data_pointer.u_data.pi = atoi( p_node );
            break;

        case XML_READER_ENDELEM:
            if ( !p_entry ) break;
            if ( ! strcmp( p_node, "addon" ) )
            {
                /* then append entry */
                ARRAY_APPEND( p_finder->entries, p_entry );
                p_entry = NULL;
                i_num_entries_created++;
            }

            data_pointer.e_type = TYPE_NONE;
            break;

        default:
            break;
        }
    }

end:
   if ( p_entry ) /* Unclosed tag */
       addon_entry_Release( p_entry );
   xml_ReaderDelete( p_xml_reader );
   return i_num_entries_created;
}
Beispiel #14
0
void PHPSourceFile::OnFunction()
{
    // read the next token
    phpLexerToken token;
    if(!NextToken(token)) {
        return;
    }

    bool funcReturnRef = false;
    if(token.type == '&') {
        funcReturnRef = true;
        if(!NextToken(token)) {
            return;
        }
    }

    PHPEntityFunction* func(NULL);
    int funcDepth(0);
    if(token.type == kPHP_T_IDENTIFIER) {
        // the function name
        func = new PHPEntityFunction();
        func->SetFullName(token.text);
        func->SetLine(token.lineNumber);

    } else if(token.type == '(') {
        funcDepth = 1; // Since we already consumed the open brace
        // anonymous function
        func = new PHPEntityFunction();
        func->SetLine(token.lineNumber);
    }

    if(!func) return;
    PHPEntityBase::Ptr_t funcPtr(func);
    if(funcReturnRef) {
        funcPtr->SetFlag(kFunc_ReturnReference);
    }

    // add the function to the current scope
    CurrentScope()->AddChild(funcPtr);

    // Set the function as the current scope
    m_scopes.push_back(funcPtr);

    // update function attributes
    ParseFunctionSignature(funcDepth);
    func->SetFlags(LookBackForFunctionFlags());
    if(LookBackTokensContains(kPHP_T_ABSTRACT) || // The 'abstract modifier was found for this this function
        (funcPtr->Parent() && funcPtr->Parent()->Is(kEntityTypeClass) &&
            funcPtr->Parent()->Cast<PHPEntityClass>()->IsInterface())) // We are inside an interface
    {
        // Mark this function as an abstract function
        func->SetFlags(func->GetFlags() | kFunc_Abstract);
    }

    if(func->HasFlag(kFunc_Abstract)) {
        // an abstract function - it has no body
        if(!ConsumeUntil(';')) {
            // could not locate the function delimiter, remove it from the stack
            // we probably reached EOF here
            m_scopes.pop_back();
        }

    } else {
        if(!NextToken(token)) return;
        if(token.type == ':') {
            // PHP 7 signature type
            // function foobar(...) : RETURN_TYPE
            wxString returnValuetype = ReadType();
            if(returnValuetype.IsEmpty()) return; // parse error
            func->SetReturnValue(returnValuetype);

        } else {
            // untake the token and place it back on the "unget" list
            UngetToken(token);
        }

        if(ReadUntilFound('{', token)) {
            // found the function body starting point
            if(IsParseFunctionBody()) {
                ParseFunctionBody();
            } else {
                // Consume the function body
                ConsumeFunctionBody();
            }
        } else {
            // could not locate the open brace!
            // remove this function from the stack
            m_scopes.pop_back();
        }
    }

    // Remove the current function from the scope list
    if(!m_reachedEOF) {
        m_scopes.pop_back();
    }
    m_lookBackTokens.clear();
}
static int LoadCatalog( addons_finder_t *p_finder )
{
    char *psz_path;
    char * psz_userdir = config_GetUserDir( VLC_DATA_DIR );
    if ( !psz_userdir ) return VLC_ENOMEM;

    if ( asprintf( &psz_path, "%s%s", psz_userdir, ADDONS_CATALOG ) < 1 )
    {
        free( psz_userdir );
        return VLC_ENOMEM;
    }
    free( psz_userdir );

    addon_entry_t *p_entry = NULL;
    const char *p_node;
    int i_current_node_type;
    int i_ret = VLC_SUCCESS;

    /* attr */
    const char *attr, *value;

    /* temp reading */
    char *psz_filename = NULL;
    int i_filetype = -1;

    struct stat stat_;
    if ( vlc_stat( psz_path, &stat_ ) )
    {
        free( psz_path );
        return VLC_EGENERIC;
    }

    char *psz_catalog_uri = vlc_path2uri( psz_path, "file" );
    free( psz_path );
    if ( !psz_catalog_uri )
        return VLC_EGENERIC;

    stream_t *p_stream = stream_UrlNew( p_finder, psz_catalog_uri );
    free( psz_catalog_uri );
    if (! p_stream ) return VLC_EGENERIC;

    xml_reader_t *p_xml_reader = xml_ReaderCreate( p_finder, p_stream );
    if( !p_xml_reader )
    {
        stream_Delete( p_stream );
        return VLC_EGENERIC;
    }

    if( xml_ReaderNextNode( p_xml_reader, &p_node ) != XML_READER_STARTELEM )
    {
        msg_Err( p_finder, "invalid catalog" );
        i_ret = VLC_EGENERIC;
        goto end;
    }

    if ( strcmp( p_node, "videolan") )
    {
        msg_Err( p_finder, "unsupported catalog data format" );
        i_ret = VLC_EGENERIC;
        goto end;
    }

    while( (i_current_node_type = xml_ReaderNextNode( p_xml_reader, &p_node )) > 0 )
    {
        switch( i_current_node_type )
        {
        case XML_READER_STARTELEM:
        {
            if ( ! strcmp( p_node, "addon" ) )
            {
                if ( p_entry ) /* ?!? Unclosed tag */
                    addon_entry_Release( p_entry );

                p_entry = addon_entry_New();
                //p_entry->psz_source_module = strdup( ADDONS_MODULE_SHORTCUT );
                p_entry->e_flags = ADDON_MANAGEABLE;
                p_entry->e_state = ADDON_INSTALLED;

                while( (attr = xml_ReaderNextAttr( p_xml_reader, &value )) )
                {
                    if ( !strcmp( attr, "type" ) )
                    {
                        p_entry->e_type = ReadType( value );
                    }
                    else if ( !strcmp( attr, "id" ) )
                    {
                        addons_uuid_read( value, & p_entry->uuid );
                    }
                    else if ( !strcmp( attr, "downloads" ) )
                    {
                        p_entry->i_downloads = atoi( value );
                        if ( p_entry->i_downloads < 0 )
                            p_entry->i_downloads = 0;
                    }
                    else if ( !strcmp( attr, "score" ) )
                    {
                        p_entry->i_score = atoi( value );
                        if ( p_entry->i_score < 0 )
                            p_entry->i_score = 0;
                        else if ( p_entry->i_score > ADDON_MAX_SCORE )
                            p_entry->i_score = ADDON_MAX_SCORE;
                    }
                    else if ( !strcmp( attr, "source" ) )
                    {
                        p_entry->psz_source_module = strdup( value );
                    }
                    else if ( !strcmp( attr, "version" ) )
                    {
                        p_entry->psz_version = strdup( value );
                    }
                }

                break;
            }
            if ( !p_entry ) break;

            BINDNODE("name", p_entry->psz_name, TYPE_STRING)
            BINDNODE("archive", p_entry->psz_archive_uri, TYPE_STRING)
            BINDNODE("summary", p_entry->psz_summary, TYPE_STRING)
            BINDNODE("description", p_entry->psz_description, TYPE_STRING)
            BINDNODE("image", p_entry->psz_image_data, TYPE_STRING)
            BINDNODE("resource", psz_filename, TYPE_STRING)
            BINDNODE("creator", p_entry->psz_author, TYPE_STRING)
            BINDNODE("sourceurl", p_entry->psz_source_uri, TYPE_STRING)
            data_pointer.e_type = TYPE_NONE;

            if ( ! strcmp( p_node, "resource" ) )
            {
                while( (attr = xml_ReaderNextAttr( p_xml_reader, &value )) )
                {
                    if ( !strcmp( attr, "type" ) )
                    {
                        i_filetype = ReadType( value );
                    }
                }
            }

            break;
        }
        case XML_READER_TEXT:
            if ( data_pointer.e_type == TYPE_NONE || !p_entry ) break;
            if ( data_pointer.e_type == TYPE_STRING )
                *data_pointer.u_data.ppsz = strdup( p_node );
            else
            if ( data_pointer.e_type == TYPE_LONG )
                *data_pointer.u_data.pl = atol( p_node );
            else
            if ( data_pointer.e_type == TYPE_INTEGER )
                *data_pointer.u_data.pi = atoi( p_node );
            break;

        case XML_READER_ENDELEM:
            if ( !p_entry ) break;

            if ( ! strcmp( p_node, "addon" ) )
            {
                /* then append entry */
                ARRAY_APPEND( p_finder->entries, p_entry );
                p_entry = NULL;
            }

            if ( ! strcmp( p_node, "resource" ) )
            {
                if ( p_entry && psz_filename && i_filetype >= 0 )
                {
                    addon_file_t *p_file = malloc( sizeof(addon_file_t) );
                    p_file->e_filetype = i_filetype;
                    p_file->psz_filename = psz_filename;
                    p_file->psz_download_uri = NULL;
                    ARRAY_APPEND( p_entry->files, p_file );
                }
                /* reset temp */
                psz_filename = NULL;
                i_filetype = -1;
            }

            data_pointer.e_type = TYPE_NONE;
            break;

        default:
            break;
        }
    }

end:
   if ( p_entry ) /* ?!? Unclosed tag */
       addon_entry_Release( p_entry );
   xml_ReaderDelete( p_xml_reader );
   stream_Delete( p_stream );
   return i_ret;
}
Beispiel #16
0
//---------------------------------------------------------------------------
BOOL TConfDlg::LoadConfig(const AnsiString &File) {
	HANDLE file;
    DWORD type, fileversion;
    HostData *actData;
    char PlgName[30]="NONE",*N = PlgName;
    int i;
    bool ignoreContext=false;

    file = CreateFileA(File.c_str(),GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,
                     FILE_FLAG_SEQUENTIAL_SCAN,0);
    if(file == INVALID_HANDLE_VALUE) {
  	    Application->MessageBox("Cannot open file!","Error",MB_OK|MB_ICONERROR);
	    return FALSE;
    }
    type = ReadType(file);
    if(type != MAGIC) {
    	CloseHandle(file);
        Application->MessageBox("Invalid file format!",
                                "Error",MB_OK|MB_ICONERROR);
        return FALSE;
    }
    fileversion = ReadType(file);
    if(fileversion != FILE_VERSION) {

        i = Application->MessageBox("Wrong file version! Try anyway?","Error",MB_YESNO|MB_ICONERROR);
        if (i == ID_NO)  {
          CloseHandle(file);
          return FALSE;
          }
    }

    // This should not happen...
    while(SelectedBox->Items->Count) {
       	RemoveSelHost(0,true);
    }
    for(i=0;i<LastList->Count;++i) {
    	delete LastList->Objects[i];
        LastList->Objects[i] = 0;
    }
    LastList->Clear();

    actData = &GlobalConfig;
    FreeProcData(actData);
    SetHostAccount(actData,0);

	do {
    	type = ReadType(file);
        switch(type) {
        case TYPE_CONFIG: ReadConfigData(file,actData,fileversion);
                            if(ignoreContext) FreeContext(actData);
        					break;
		case TYPE_ACCOUNT: ReadAccount(file,actData);
        					
         					break;
        case TYPE_ACCOUNT_ENCRYPTED: ReadAccountEncrypted(file,actData); break;
		case TYPE_HOST: actData = 0;
                        ReadHost(file,&actData);
                        if(actData) {
                        	CopyStateData(actData,(*Servers)[actData->Name]);
                        	LastList->AddObject(actData->Name,new CHostRef(actData));
                        }
                        break;
        case TYPE_PLUGIN: ReadString(file,&N);
        			      if(!PluginManager.SetActualPlugin(PlgName))
                          	ignoreContext = true;
                          break;

		case TYPE_VERSION:
        case TYPE_GLOBAL:
		case TYPE_NONE:
        default: break;
        }
    } while(type != TYPE_NONE);
    CloseHandle(file);
    return TRUE;
}
Beispiel #17
0
bool SignatureReader::ReadType(byte type)
{
    /*
    Type ::= ( BOOLEAN | CHAR | I1 | U1 | U2 | U2 | I4 | U4 | I8 | U8 | R4 | R8 | I | U |
                    | VALUETYPE TypeDefOrRefEncoded
                    | CLASS TypeDefOrRefEncoded
                    | STRING 
                    | OBJECT
                    | PTR CustomMod* VOID
                    | PTR CustomMod* Type
                    | FNPTR MethodDefSig
                    | FNPTR MethodRefSig
                    | ARRAY Type ArrayShape
                    | SZARRAY CustomMod* Type
                    | GENERICINST (CLASS | VALUETYPE) TypeDefOrRefEncoded GenArgCount Type *
                    | VAR Number
                    | MVAR Number
    */

	switch (type) {
		case ELEMENT_TYPE_VOID:
			this->output << L"void";
			break;
		case ELEMENT_TYPE_BOOLEAN:
			this->output << L"bool";
			break;
		case ELEMENT_TYPE_CHAR:
			this->output << L"char"; 
			break;
		case ELEMENT_TYPE_I:
			this->output << L"IntPtr";
			break;
		case ELEMENT_TYPE_U:
			this->output << L"UIntPtr";
			break;
		case ELEMENT_TYPE_I1:
			this->output << L"sbyte"; 
			break;
		case ELEMENT_TYPE_U1:
			this->output << L"byte"; 
			break;
		case ELEMENT_TYPE_I2:
			this->output << L"short"; 
			break;
		case ELEMENT_TYPE_U2:
			this->output << L"ushort"; 
			break;
		case ELEMENT_TYPE_I4:
			this->output << L"int"; 
			break;
		case ELEMENT_TYPE_U4:
			this->output << L"uint"; 
			break;
		case ELEMENT_TYPE_I8:
			this->output << L"long"; 
			break;
		case ELEMENT_TYPE_U8:
			this->output << L"ulong"; 
			break;
		case ELEMENT_TYPE_R4:
			this->output << L"float"; 
			break;
		case ELEMENT_TYPE_R8:
			this->output << L"double"; 
			break;
		case ELEMENT_TYPE_STRING:
			this->output << L"string"; 
			break;
		case ELEMENT_TYPE_OBJECT:
			this->output << L"object";
			break;
		case ELEMENT_TYPE_CLASS:
		case ELEMENT_TYPE_VALUETYPE:
			mdToken token;
			WCHAR zName[1024];
			ULONG length;
			CorSigUncompressToken(this->data, &token);
			HRESULT	hr;
			hr = this->metaData->GetTypeRefProps(token, nullptr, zName, 1024, &length);
			hr = this->metaData->GetTypeDefProps(token, zName, 1024, &length, nullptr, nullptr);
			if (SUCCEEDED(hr) && length > 0)
				AppendEscapedString(zName);
			else {
				hr = this->metaData->GetTypeRefProps(token, nullptr, zName, 1024, &length);
				hr = this->metaData->GetTypeDefProps(token, zName, 1024, &length, nullptr, nullptr);
				if (SUCCEEDED(hr) && length > 0)
					AppendEscapedString(zName);
				else
					this->output << L"?";
			}
			int tmp2;
			if (!this->ReadCompressedInt(&tmp2))
				return false;
			break;
		case ELEMENT_TYPE_ARRAY:
		case ELEMENT_TYPE_SZARRAY:
			this->ReadArrayType(type);
			break;
		case ELEMENT_TYPE_CMOD_OPT:
		case ELEMENT_TYPE_CMOD_REQD:
			this->output << L"cmod";
			break;
		case ELEMENT_TYPE_FNPTR:
			this->output << L"fnptr";
			break;
		case ELEMENT_TYPE_PTR:
			if (!this->ReadByte(&type))
				return false;
			while (type == ELEMENT_TYPE_CMOD_OPT || type == ELEMENT_TYPE_CMOD_REQD) {
				int tmp2;

				if (!this->ReadCompressedInt(&tmp2))
					return false;

				if (!this->ReadByte(&type))
					return false;
			}

			ReadType(type);
			this->output << L"*";
			break;
		case ELEMENT_TYPE_GENERICINST:
			if (!this->ReadByte(&type))
				return false;
			CorSigUncompressToken(this->data, &token);
			// don't ask me why this is necessary, but it doesn't work without either line of these.
			hr = this->metaData->GetTypeRefProps(token, nullptr, zName, 1024, &length);
			hr = this->metaData->GetTypeDefProps(token, zName, 1024, &length, nullptr, nullptr);
			if (SUCCEEDED(hr) && length > 0)
				AppendEscapedString(zName);
			else
				this->output << L"?";
			if (!this->ReadCompressedInt(&tmp2))
				return false;
			this->output << L"<";
			int genArgCount;
			if (!this->ReadCompressedInt(&genArgCount))
				return false;
			for (int i = 0; i < genArgCount; i++) {
				if (!this->ReadByte(&type))
					return false;
				this->ReadType(type);
				if ((i + 1) < genArgCount)
					this->output << L",";
			}
			this->output << L">";
			break;
		case ELEMENT_TYPE_MVAR: // print "!!number"
			this->output << L"!";
		case ELEMENT_TYPE_VAR: // print "!number"
			this->output << L"!"; 
			int number;
			if (!this->ReadCompressedInt(&number))
				return false;
			this->output << number;
			break;
		default:
			this->output << L"?";
			break;
	}

	return true;
}
Beispiel #18
0
bool SignatureReader::ReadMethodDefSig(byte head)
{
	// MethodDefSig ::= [[HASTHIS] [EXPLICITTHIS]] (DEFAULT|VARARG|GENERIC GenParamCount) ParamCount RetType Param*

	int genericParamCount = 0;
	int paramCount = 0;

	if (head & SIG_GENERIC) {
		if (!this->ReadCompressedInt(&genericParamCount))
			return false;
	}

	if (!this->ReadCompressedInt(&paramCount))
		return false;
	
	// Read Return Type
	// RetType ::= CustomMod* ( VOID | TYPEDBYREF | [BYREF] Type )

	byte type;

	if (!this->ReadByte(&type))
		return false;
	
	for (;;) {
		if (type != ELEMENT_TYPE_CMOD_OPT && type != ELEMENT_TYPE_CMOD_REQD)
			break;

		int tmp;

		if (!this->ReadCompressedInt(&tmp)) return false;

		if (!this->ReadByte(&type)) return false;
	}

	switch (type) {
		case ELEMENT_TYPE_VOID:
			this->output << L"void";
			break;
		case ELEMENT_TYPE_TYPEDBYREF:
			// ignore
			break;
		case ELEMENT_TYPE_BYREF:
			// ignore
			if (!this->ReadByte(&type))
				return false;
		default:
			ReadType(type);
	}
	
	// Append Name
	
	this->output << L" ";
	this->output << '"';
	this->output << fullName;
	this->output << '"';
	this->output << L" ";

	// Read Parameters
	// Param ::= CustomMod* ( TYPEDBYREF | [BYREF] Type )

	for (int i = 0; i < paramCount; i++) {
		if (!this->ReadByte(&type))
			return false;
		
		while (type == ELEMENT_TYPE_CMOD_OPT || type == ELEMENT_TYPE_CMOD_REQD) {
			int tmp2;

			if (!this->ReadCompressedInt(&tmp2))
				return false;

			if (!this->ReadByte(&type))
				return false;
		}
		
		mdParamDef paramDef;

		WCHAR paramName[256];
		ULONG pSequence, pchName, pcchValue;
		DWORD pdwAttr, pdwCPlusTypeFlag;
		UVCP_CONSTANT ppValue;

		if (!FAILED(this->metaData->GetParamForMethodIndex(this->methodDefiniton, i + 1, &paramDef))) {
			if (!FAILED(this->metaData->GetParamProps(paramDef, &this->methodDefiniton, &pSequence, paramName, 256, &pchName, &pdwAttr, &pdwCPlusTypeFlag, &ppValue, &pcchValue))) {
				this->output << '"';
				switch (type) {
					case ELEMENT_TYPE_TYPEDBYREF:
						// ignore
						break;
					case ELEMENT_TYPE_BYREF:
						if (!this->ReadByte(&type))
							return false;
						if ((pdwAttr & 0x2) !=  0) // if Bit 1 == 1 -> out
							this->output << L"out";
						else
							this->output << L"ref";
						this->output << L" ";
					default:
						ReadType(type);
				}
				
				this->output << L" ";
				AppendEscapedString(paramName);
				this->output << '"';
			}
		}

		if (i < paramCount - 1)
			this->output << L" ";
	}

	return true;
}
Beispiel #19
0
void PHPSourceFile::ParseFunctionSignature(int startingDepth)
{
    phpLexerToken token;
    if(startingDepth == 0) {
        // loop until we find the open brace
        while(NextToken(token)) {
            if(token.type == '(') {
                ++startingDepth;
                break;
            }
        }
        if(startingDepth == 0) return;
    }

    // at this point the 'depth' is 1, as we already read the open brace
    int depth = 1;
    wxString typeHint;
    wxString defaultValue;
    PHPEntityVariable* var(NULL);
    bool collectingDefaultValue = false;
    while(NextToken(token)) {
        switch(token.type) {
        case kPHP_T_VARIABLE:
            if(!var) {
                // var can be non null if we are parsing PHP-7 function arguments
                // with type-hinting
                var = new PHPEntityVariable();
            }

            var->SetFullName(token.text);
            var->SetLine(token.lineNumber);
            var->SetFilename(m_filename);
            // Mark this variable as function argument
            var->SetFlag(kVar_FunctionArg);
            if(typeHint.EndsWith("&")) {
                var->SetIsReference(true);
                typeHint.RemoveLast();
            }
            var->SetTypeHint(MakeIdentifierAbsolute(typeHint));
            break;
        case '(':
            depth++;
            if(collectingDefaultValue) {
                defaultValue << "(";
            }
            break;
        case ')':
            depth--;
            // if the depth goes under 1 - we are done
            if(depth < 1) {
                if(var) {
                    var->SetDefaultValue(defaultValue);
                    CurrentScope()->AddChild(PHPEntityBase::Ptr_t(var));
                }
                return;

            } else if(depth) {
                defaultValue << token.text;
            }
            break;
        case '=':
            // default value
            collectingDefaultValue = true;
            break;
        case ',':
            if(var) {
                var->SetDefaultValue(defaultValue);
                CurrentScope()->AddChild(PHPEntityBase::Ptr_t(var));
            }
            var = NULL;
            typeHint.Clear();
            defaultValue.Clear();
            collectingDefaultValue = false;
            break;
        case kPHP_T_IDENTIFIER:
            if(!var) {
                // PHP-7 type hinting function arguments
                var = new PHPEntityVariable();
                UngetToken(token);
                typeHint = ReadType();
                if(!typeHint.IsEmpty()) {
                    break;
                }
            }
        // all "else" cases simply fall into the default case
        default:
            if(collectingDefaultValue) {
                defaultValue << token.text;
            } else {
                typeHint << token.text;
            }
            break;
        }
    }
}
Beispiel #20
0
bool CBotVar::RestoreState(FILE* pf, CBotVar* &pVar)
{
    unsigned short        w, wi, prv, st;
    float        ww;
    CBotString    name, s;

    delete pVar;

                pVar    = NULL;
    CBotVar*    pNew    = NULL;
    CBotVar*    pPrev    = NULL;

    while ( true )            // retrieves a list
    {
        if (!ReadWord(pf, w)) return false;                        // private or type?
        if ( w == 0 ) return true;

        CBotString defnum;
        if ( w == 200 )
        {
            if (!ReadString(pf, defnum)) return false;            // number with identifier
            if (!ReadWord(pf, w)) return false;                    // type
        }

        prv = 100; st = 0;
        if ( w >= 100 )
        {
            prv = w;
            if (!ReadWord(pf, st)) return false;                // static
            if (!ReadWord(pf, w)) return false;                    // type
        }

        if ( w == CBotTypClass ) w = CBotTypIntrinsic;            // necessarily intrinsic

        if (!ReadWord(pf, wi)) return false;                    // init ?

        if (!ReadString(pf, name)) return false;                // variable name

        CBotToken token(name, CBotString());

        switch (w)
        {
        case CBotTypInt:
        case CBotTypBoolean:
            pNew = CBotVar::Create(&token, w);                        // creates a variable
            if (!ReadWord(pf, w)) return false;
            pNew->SetValInt(static_cast<short>(w), defnum);
            break;
        case CBotTypFloat:
            pNew = CBotVar::Create(&token, w);                        // creates a variable
            if (!ReadFloat(pf, ww)) return false;
            pNew->SetValFloat(ww);
            break;
        case CBotTypString:
            pNew = CBotVar::Create(&token, w);                        // creates a variable
            if (!ReadString(pf, s)) return false;
            pNew->SetValString(s);
            break;

        // returns an intrinsic object or element of an array
        case CBotTypIntrinsic:
        case CBotTypArrayBody:
            {
                CBotTypResult    r;
                long            id;
                if (!ReadType(pf, r))  return false;                // complete type
                if (!ReadLong(pf, id) ) return false;

//                if (!ReadString(pf, s)) return false;
                {
                    CBotVar* p = NULL;
                    if ( id ) p = CBotVarClass::Find(id) ;

                    pNew = new CBotVarClass(&token, r);                // directly creates an instance
                                                                    // attention cptuse = 0
                    if ( !RestoreState(pf, (static_cast<CBotVarClass*>(pNew))->m_pVar)) return false;
                    pNew->SetIdent(id);

                    if ( p != NULL )
                    {
                        delete pNew;
                        pNew = p;            // resume known element 
                    }
                }
            }
            break;

        case CBotTypPointer:
        case CBotTypNullPointer:
            if (!ReadString(pf, s)) return false;
            {
                pNew = CBotVar::Create(&token, CBotTypResult(w, s));// creates a variable
//                CBotVarClass* p = NULL;
                long id;
                ReadLong(pf, id);
//                if ( id ) p = CBotVarClass::Find(id);        // found the instance (made by RestoreInstance)

                // returns a copy of the original instance
                CBotVar* pInstance = NULL;
                if ( !CBotVar::RestoreState( pf, pInstance ) ) return false;
                (static_cast<CBotVarPointer*>(pNew))->SetPointer( pInstance );            // and point over

//                if ( p != NULL ) (static_cast<CBotVarPointer*>(pNew))->SetPointer( p );    // rather this one

            }
            break;

        case CBotTypArrayPointer:
            {
                CBotTypResult    r;
                if (!ReadType(pf, r))  return false;

                pNew = CBotVar::Create(&token, r);                        // creates a variable

                // returns a copy of the original instance
                CBotVar* pInstance = NULL;
                if ( !CBotVar::RestoreState( pf, pInstance ) ) return false;
                (static_cast<CBotVarPointer*>(pNew))->SetPointer( pInstance );            // and point over
            }
            break;
        default:
            ASM_TRAP();
        }

        if ( pPrev != NULL ) pPrev->m_next = pNew;
        if ( pVar == NULL  ) pVar = pNew;

        pNew->m_binit = wi;        //        pNew->SetInit(wi);
        pNew->SetStatic(st);
        pNew->SetPrivate(prv-100);
        pPrev = pNew;
    }
    return true;
}
Beispiel #21
0
cAppli_C3DC::cAppli_C3DC(int argc,char ** argv,bool DoMerge) :
    cAppliWithSetImage  (argc-2,argv+2,TheFlagDev16BGray|TheFlagAcceptProblem),
    mTuning             (MPD_MM()),
    mPurge              (true),
    mPlyCoul            (true),
    mMergeOut           ("C3DC.ply"),
    mSzNorm             (3),
    mDS                 (1.0),
    mZoomF              (1),
    mDoMerge            (DoMerge),
    mMMIN               (0),
    mUseGpu	       (false),
    mArgSupEpip         (""),
    mDebugMMByP         (false)
{


#if(ELISE_QT_VERSION >= 4)

    if (MMVisualMode)
    {
        QApplication app(argc, argv);

        LArgMain LAM;
        LAM << EAMC(mStrType,"Mode",eSAM_None,ListOfVal(eNbTypeMMByP));

        std::vector <cMMSpecArg> aVA = LAM.ExportMMSpec();

        cMMSpecArg aArg = aVA[0];

        list<string> liste_valeur_enum = listPossibleValues(aArg);

        QStringList items;
        list<string>::iterator it=liste_valeur_enum.begin();
        for (; it != liste_valeur_enum.end(); ++it)
            items << QString((*it).c_str());

        setStyleSheet(app);

        bool ok = false;
        int  defaultItem = 0;

        if(argc > 1)
            defaultItem = items.indexOf(QString(argv[1]));

        QInputDialog myDialog;
        QString item = myDialog.getItem(NULL, app.applicationName(),
                                        QString (aArg.Comment().c_str()), items, defaultItem, false, &ok);

        if (ok && !item.isEmpty())
            mStrType = item.toStdString();
        else
            return;

        ReadType(mStrType);
    }
    else
    {
        ELISE_ASSERT(argc >= 2,"Not enough arg");
        ReadType(argv[1]);
    }
#else
    ELISE_ASSERT(argc >= 2,"Not enough arg");
    ReadType(argv[1]);
#endif

    ElInitArgMain
    (
        argc,argv,
        LArgMain()  << EAMC(mStrType,"Type in enumerated values", eSAM_None,ListOfVal(eNbTypeMMByP))
        << EAMC(mEASF.mFullName,"Full Name (Dir+Pattern)", eSAM_IsPatFile)
        << EAMC(mOriFull,"Orientation", eSAM_IsExistDirOri),
        LArgMain()
        << EAM(mMasq3D,"Masq3D",true,"3D masq for point selection",eSAM_IsExistFileRP)
        << EAM(mMergeOut,"Out",true,"final result (Def=C3DC.ply)")
        << EAM(mSzNorm,"SzNorm",true,"Sz of param for normal evaluation (<=0 if none, Def=2 means 5x5) ")
        << EAM(mPlyCoul,"PlyCoul",true,"Colour in ply ? (Def = true)")
        << EAM(mTuning,"Tuning",true,"Will disappear one day ...",eSAM_InternalUse)
        << EAM(mPurge,"Purge",true,"Purge result, (Def=true)")
        << EAM(mDS,"DownScale",true,"DownScale of Final result, Def depends on mode")
        << EAM(mZoomF,"ZoomF",true,"Zoom final, Def depends on mode",eSAM_IsPowerOf2)
        << EAM(mUseGpu,"UseGpu",false,"Use cuda (Def=false)")
        << EAM(mDefCor,"DefCor",true,"Def correlation, context depend")
        << EAM(mZReg,"ZReg",true,"Regularisation, context depend")
        << EAM(mFilePair,"FilePair",true,"Explicit pairs of images (as in Tapioca)", eSAM_IsExistFileRP)
        << EAM(mDebugMMByP,"DebugMMByP",true,"Debug MMByPair ...")
    );

    if (MMVisualMode) return;

    if (!EAMIsInit(&mDS))
    {
        // if (mType==eQuickMac) mDS = 2.0;
    }
    if (!EAMIsInit(&mZoomF))
    {
        if (mType==eBigMac)   mZoomF = 2;
        if (mType==eMicMac)   mZoomF = 4;
        if (mType==eQuickMac) mZoomF = 8;
        if (mType==eStatue)   mZoomF = 2;
        if (mType==eForest)   mZoomF = 4;
    }

    if (EAMIsInit(&mDefCor)) mArgSupEpip +=  " DefCor=" + ToString(mDefCor);
    if (EAMIsInit(&mZReg)) mArgSupEpip +=  " ZReg=" + ToString(mZReg);

    if (! EAMIsInit(&mMergeOut)) mMergeOut = "C3DC_"+ mStrType + ".ply";

    mStrImOri0  =  BLANK + QUOTE(mEASF.mFullName) +  BLANK + Ori() + BLANK;
    mStrImOriApSec = BLANK +  DirAndPatFileMMByP() +  BLANK + Ori() + BLANK;
    mArgMasq3D = "";
    if (EAMIsInit(&mMasq3D))
        mArgMasq3D = std::string(" Masq3D=" + mMasq3D + BLANK) ;


    //=====================================

    mBaseComMMByP =    MM3dBinFile("MMByP ")
                       +  BLANK + mStrType
                       +  mStrImOri0
                       +  mArgMasq3D
                       +  " UseGpu=" + ToString(mUseGpu);
    if (mDebugMMByP)
        mBaseComMMByP = mBaseComMMByP + " DebugMMByP=true";

    if (EAMIsInit(&mFilePair))
        mBaseComMMByP  += " FilePair=" + mFilePair;


    //=====================================
    mBaseComEnv =      MM3dBinFile("TestLib MMEnvlop ")
                       +  mStrImOriApSec
                       +  std::string(" 16 ")  + ToString(mZoomF) + " "
                       +  mArgMasq3D
                       +  std::string(" AutoPurge=") + ToString(mPurge)
                       +  " Out=" + mStrType
                       ;

    /*
    if (mTuning)
    {
       mBaseComEnv = mBaseComEnv + " DoPlyDS=true";
    }
    */

    //=====================================

    mComMerge =      MM3dBinFile("TestLib  MergeCloud ")
                     +  mStrImOri0 + " ModeMerge=" + mStrType
                     +  " DownScale=" +ToString(mDS)
                     ;

    if (mSzNorm>=0)
    {
        mComMerge = mComMerge + " SzNorm=" + ToString(1+2*mSzNorm);
    }

    mComMerge +=  " PlyCoul=" + ToString(mPlyCoul);

    mMMIN = cMMByImNM::ForGlobMerge(Dir(),mDS,mStrType);

    //=====================================

    std::string aDirFusMM = mMMIN->FullDir();

    mComCatPly =  MM3dBinFile("MergePly ") + QUOTE( aDirFusMM + ".*Merge.*ply") + " Out="  + mMergeOut;

    mStrZ0ZF = " Zoom0=" + ToString(mZoomF) + " ZoomF=" + ToString(mZoomF);
    mMMIN->SetOriOfEtat(mOri);
}