Developer forums (C::B DEVELOPMENT STRICTLY!) > Development

custom defined Compiler sets

<< < (2/3) > >>

thomas:

--- Quote from: void Compiler::LoadSettings(const wxString& baseKey) ---    m_MasterPath = cfg->Read(tmp + _T("/master_path"), m_MasterPath);
    m_ExtraPaths = GetArrayFromString(cfg->Read(tmp + _T("/extra_paths"), _T("")), _T(";"));
    m_Programs.C = cfg->Read(tmp + _T("/c_compiler"), m_Programs.C);
    m_Programs.CPP = cfg->Read(tmp + _T("/cpp_compiler"), m_Programs.CPP);
    [...]

--- End quote ---

That's probably it. Read is given explicit default values, so if it can't find a value, the default is used.

I'd wait until Yiannis had had a word on it though, because that is probably intentional for some good reason.

kisoft:

--- Quote from: thomas on November 21, 2005, 03:39:56 pm ---
--- Quote from: void Compiler::LoadSettings(const wxString& baseKey) ---    m_MasterPath = cfg->Read(tmp + _T("/master_path"), m_MasterPath);
    m_ExtraPaths = GetArrayFromString(cfg->Read(tmp + _T("/extra_paths"), _T("")), _T(";"));
    m_Programs.C = cfg->Read(tmp + _T("/c_compiler"), m_Programs.C);
    m_Programs.CPP = cfg->Read(tmp + _T("/cpp_compiler"), m_Programs.CPP);
    [...]

--- End quote ---

--- End quote ---

I found a strange thing:

--- Code: ---    ConfigManager* cfg = Manager::Get()->GetConfigManager(_T("compiler"));

    wxString tmp;
    tmp.Printf(_T("%s/set%3.3d"), baseKey.c_str(), (int)m_ID);
    if (!cfg->Exists(tmp + _T("/name")))
        return;

--- End code ---
searched for: "/sets/set256/name" and found it.
And:

--- Code: ---        group.Printf(_T("%s/regex/re%3.3d"), tmp.c_str(), index++);
        if (!cfg->Exists(group))
            break;

--- End code ---
group not exists. Here search for: "/sets/set256/regex/re001" group.
Analogically for all compilers. :o

"Interesting" a next:

The set: "/sets/setXXX" read normally, for ex. "/sets/setXXX/master_path" is OK.
And the set: "/sets/setXXX/..." - is wrongly, for ex. "/sets/setXXX/macros/...", "/sets/setXXX/switches/..."

I look configmanager.cpp too, but while I can't debug CB.  :(

kisoft:
I found this:

Into sdk/configmanager.h

--- Code: ---    /* -----------------------------------------------------------------------------------------------------
    *  Set and unset keys, or test for existence. Note that these functions cannot be used to remove paths

--- End code ---
    *  or test existence of paths (it may be used to implicitely create paths, though).

--- Code: ---    */
    bool Exists(const wxString& name);
    void Set(const wxString& name);
    void UnSet(const wxString& name);

--- End code ---

hmm, test on existence of paths.
I patch compiler.cpp, method LoadSettings:


--- Code: ---        group.Printf(_T("%s/regex/re%3.3d"), tmp.c_str(), index++);
        if (!cfg->Exists(group))
            break;
        else if (!cleared)
        {
            cleared = true;
            m_RegExes.Clear();
        }

--- End code ---
I change to:

--- Code: ---        group.Printf(_T("%s/regex/re%3.3d"), tmp.c_str(), index++);
        if (!cfg->Exists(group+_T("/description")))
            break;
        else if (!cleared)
        {
            cleared = true;
            m_RegExes.Clear();
        }

--- End code ---
After it regex loaded.

But it's wrong way, I think, method Exists, used anywhere.

thomas:
Yes, Exists() is used incorrectly here. It will always return false because it is given a pathname, but it looks for keys.

The config manager has a function EnumerateSubPaths() which returns all direct subpaths in a wxArrayString. This is a lot more convenient and less error-prone than iterating through numbers and checking for existence. It will also work reliably if your subpaths are numbered in a non-continguous manner.

tiwag:

--- Quote from: thomas on November 21, 2005, 03:39:56 pm ---...I'd wait until Yiannis had had a word on it though, because that is probably intentional for some good reason.

--- End quote ---

Any ideas ? what should be the intended behaviour ?
it is not possible to use custom compiler set's whenever the default gcc-defaults are restored after a restart of C::B !

Navigation

[0] Message Index

[#] Next page

[*] Previous page

Go to full version