1 |
786 |
skrzyp |
// ####ECOSHOSTGPLCOPYRIGHTBEGIN####
|
2 |
|
|
// -------------------------------------------
|
3 |
|
|
// This file is part of the eCos host tools.
|
4 |
|
|
// Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
5 |
|
|
//
|
6 |
|
|
// This program is free software; you can redistribute it and/or modify
|
7 |
|
|
// it under the terms of the GNU General Public License as published by
|
8 |
|
|
// the Free Software Foundation; either version 2 or (at your option) any
|
9 |
|
|
// later version.
|
10 |
|
|
//
|
11 |
|
|
// This program is distributed in the hope that it will be useful, but
|
12 |
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
13 |
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
14 |
|
|
// General Public License for more details.
|
15 |
|
|
//
|
16 |
|
|
// You should have received a copy of the GNU General Public License
|
17 |
|
|
// along with this program; if not, write to the
|
18 |
|
|
// Free Software Foundation, Inc., 51 Franklin Street,
|
19 |
|
|
// Fifth Floor, Boston, MA 02110-1301, USA.
|
20 |
|
|
// -------------------------------------------
|
21 |
|
|
// ####ECOSHOSTGPLCOPYRIGHTEND####
|
22 |
|
|
// ConfigToolDoc.h
|
23 |
|
|
//
|
24 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
25 |
|
|
//===========================================================================
|
26 |
|
|
//#####DESCRIPTIONBEGIN####
|
27 |
|
|
//
|
28 |
|
|
// Author(s): sdf
|
29 |
|
|
// Contact(s): sdf
|
30 |
|
|
// Date: 1998/08/11
|
31 |
|
|
// Version: 0.01
|
32 |
|
|
// Purpose:
|
33 |
|
|
// Description: interface of the CConfigToolDoc class
|
34 |
|
|
// Requires:
|
35 |
|
|
// Provides:
|
36 |
|
|
// See also:
|
37 |
|
|
// Known bugs:
|
38 |
|
|
// Usage:
|
39 |
|
|
//
|
40 |
|
|
//####DESCRIPTIONEND####
|
41 |
|
|
//
|
42 |
|
|
//===========================================================================
|
43 |
|
|
|
44 |
|
|
#if !defined(AFX_ConfigToolDOC_H__A4845246_05EE_11D2_80BE_00A0C949ADAC__INCLUDED_)
|
45 |
|
|
#define AFX_ConfigToolDOC_H__A4845246_05EE_11D2_80BE_00A0C949ADAC__INCLUDED_
|
46 |
|
|
|
47 |
|
|
#if _MSC_VER >= 1000
|
48 |
|
|
#pragma once
|
49 |
|
|
#endif // _MSC_VER >= 1000
|
50 |
|
|
|
51 |
|
|
#define INCLUDEFILE <string>
|
52 |
|
|
#include "IncludeSTL.h"
|
53 |
|
|
#define INCLUDEFILE "cdl.hxx"
|
54 |
|
|
#include "IncludeSTL.h"
|
55 |
|
|
|
56 |
|
|
#include "memmap.h" // for mem_map
|
57 |
|
|
|
58 |
|
|
#include "ConfigTool.h"
|
59 |
|
|
#include "FileName.h"
|
60 |
|
|
|
61 |
|
|
class CConfigItem;
|
62 |
|
|
|
63 |
|
|
#ifdef PLUGIN
|
64 |
|
|
class CProject;
|
65 |
|
|
class CProjectManager;
|
66 |
|
|
class Project;
|
67 |
|
|
class CConfigToolDoc {
|
68 |
|
|
private:
|
69 |
|
|
static LPCTSTR CALLBACK GetFn (void *pObj) { return (LPCTSTR)*(CString *)pObj; }
|
70 |
|
|
static void CALLBACK PutFn (void *pObj,LPCTSTR psz) { *(CString *)pObj=psz; }
|
71 |
|
|
#else
|
72 |
|
|
class CConfigToolDoc : public CDocument {
|
73 |
|
|
protected:
|
74 |
|
|
DECLARE_DYNCREATE(CConfigToolDoc)
|
75 |
|
|
#endif
|
76 |
|
|
|
77 |
|
|
// Attributes
|
78 |
|
|
public:
|
79 |
|
|
static void CdlParseErrorHandler (std::string message);
|
80 |
|
|
static void CdlParseWarningHandler (std::string message);
|
81 |
|
|
|
82 |
|
|
// ctors and dtors: public for benefit of plugin case
|
83 |
|
|
CConfigToolDoc();
|
84 |
|
|
virtual ~CConfigToolDoc();
|
85 |
|
|
|
86 |
|
|
void RegenerateData();
|
87 |
|
|
|
88 |
|
|
// Hints.
|
89 |
|
|
// These are mostly relevant to the properties view, which will generally ignore them unless
|
90 |
|
|
// the pHint matches what it is currently displaying (i.e. the last SelChanged message)
|
91 |
|
|
enum {SelChanged=1,IntFormatChanged=2,ValueChanged=3, Clear=4, AllSaved=6, NameFormatChanged=7, ExternallyChanged=8, MemLayoutChanged=9};
|
92 |
|
|
|
93 |
|
|
enum {Never=0, Immediate=1, Deferred=2, SuggestFixes=4};
|
94 |
|
|
int m_nRuleChecking; // OR of above values
|
95 |
|
|
|
96 |
|
|
// Configuration items
|
97 |
|
|
CConfigItem * FirstItem(){return ItemCount()==0?NULL:Item(0);}
|
98 |
|
|
CConfigItem *Item(int nIndex){ return (CConfigItem *)m_arItem[nIndex];}
|
99 |
|
|
int ItemCount(){ return m_arItem.GetSize();}
|
100 |
|
|
|
101 |
|
|
void SelectTemplate (std::string NewTemplate, std::string NewTemplateVersion);
|
102 |
|
|
void SelectHardware (std::string NewTemplate);
|
103 |
|
|
|
104 |
|
|
void SelectPackages ();
|
105 |
|
|
CString GetPackageName (const CString & strAlias);
|
106 |
|
|
|
107 |
|
|
// MLT-related
|
108 |
|
|
mem_map MemoryMap;
|
109 |
|
|
CString strSelectedSection;
|
110 |
|
|
CString strSelectedRegion;
|
111 |
|
|
bool SwitchMemoryLayout (BOOL bNewTargetPlatform);
|
112 |
|
|
bool SaveMemoryMap();
|
113 |
|
|
|
114 |
|
|
const CFileName BuildTree() const { return m_strBuildTree; }
|
115 |
|
|
const CFileName InstallTree() const { return m_strInstallTree; }
|
116 |
|
|
const CFileName HeadersDir() const { return InstallTree()+_T("include"); }
|
117 |
|
|
const CFileName ObjectDir() const { return BuildTree()+_T("obj"); }
|
118 |
|
|
const CFileName MLTDir ();
|
119 |
|
|
const CFileName DocBase() const { return Repository()+_T("doc"); }
|
120 |
|
|
|
121 |
|
|
void SetBuildTree (LPCTSTR pszBuild) { m_strBuildTree=pszBuild; }
|
122 |
|
|
void SetInstallTree (LPCTSTR pszInstall) { m_strInstallTree=pszInstall; }
|
123 |
|
|
|
124 |
|
|
void UpdateFailingRuleCount();
|
125 |
|
|
bool GetRunPlatform (CString &strTarget);
|
126 |
|
|
|
127 |
|
|
bool SetEnabled (CConfigItem &ti, bool bEnabled, CdlTransaction transaction=NULL);
|
128 |
|
|
bool SetValue(CConfigItem &ti,ItemIntegerType nValue, CdlTransaction transaction=NULL);
|
129 |
|
|
bool SetValue(CConfigItem &ti,const CString &strValue, CdlTransaction transaction=NULL);
|
130 |
|
|
bool SetValue (CConfigItem &ti, double dValue, CdlTransaction transaction=NULL);
|
131 |
|
|
CString GetDefaultHardware ();
|
132 |
|
|
|
133 |
|
|
CString m_strFind;
|
134 |
|
|
int m_nFindFlags;
|
135 |
|
|
WhereType m_nFindWhere;
|
136 |
|
|
|
137 |
|
|
bool m_bAutoExpand;
|
138 |
|
|
bool m_bMacroNames;
|
139 |
|
|
bool m_bHex;
|
140 |
|
|
|
141 |
|
|
bool ShowURL (LPCTSTR pszURL);
|
142 |
|
|
static const CFileName &DefaultExternalBrowser ();
|
143 |
|
|
|
144 |
|
|
// Absolute path name to root of respository - parent of PackagesDir below
|
145 |
|
|
const CFileName Repository() const { return m_strRepository; }
|
146 |
|
|
void SetRepository(LPCTSTR pszRepository) { m_strRepository=CFileName(pszRepository); }
|
147 |
|
|
|
148 |
|
|
// Absolute path name to "packages" directory - i.e. the one under the repository
|
149 |
|
|
// named "packages" in a delivery or "ecc" in CVS:
|
150 |
|
|
const CFileName PackagesDir() const { return m_strPackagesDir; }
|
151 |
|
|
|
152 |
|
|
CConfigItem * Find (const CString &strWhat,WhereType where=InMacro);
|
153 |
|
|
CConfigItem * Find (CdlValuable v);
|
154 |
|
|
|
155 |
|
|
const CFileName CurrentLinkerScript();
|
156 |
|
|
const CString CurrentStartup();
|
157 |
|
|
const CString CurrentTestingIdentifier();
|
158 |
|
|
const CString CurrentPlatform();
|
159 |
|
|
const CString CurrentMemoryLayout ();
|
160 |
|
|
CFileName m_strMemoryLayoutFolder;
|
161 |
|
|
CFileName m_strLinkerScriptFolder;
|
162 |
|
|
const CFileName CurrentPlatformPackageFolder();
|
163 |
|
|
bool OpenRepository(LPCTSTR pszRepository=NULL,bool bPromptInitially=false);
|
164 |
|
|
void CloseRepository();
|
165 |
|
|
CdlPackagesDatabase GetCdlPkgData () { return m_CdlPkgData; }
|
166 |
|
|
CdlConfiguration GetCdlConfig () { return m_CdlConfig; }
|
167 |
|
|
CdlInterpreter GetCdlInterpreter() { return m_CdlInterp; }
|
168 |
|
|
std::string GetTemplateVersion() { return m_template_version; }
|
169 |
|
|
|
170 |
|
|
bool UpdateBuildInfo(bool bFirstTime=false);
|
171 |
|
|
CdlBuildInfo &BuildInfo() { return m_BuildInfo; }
|
172 |
|
|
|
173 |
|
|
enum GlobalConflictOutcome {OK,Cancel,NotDone};
|
174 |
|
|
GlobalConflictOutcome ResolveGlobalConflicts(CPtrArray *parConflictsOfInterest=NULL);
|
175 |
|
|
|
176 |
|
|
bool CheckConflictsBeforeSave();
|
177 |
|
|
int GetTestExeNames (CFileNameArray &ar,CFileNameArray &arTestsMissing);
|
178 |
|
|
BOOL IsModified();
|
179 |
|
|
void SetPathName( LPCTSTR pszPath, BOOL bAddToMRU = TRUE );
|
180 |
|
|
static bool ShowHtmlHelp(LPCTSTR pszURL);
|
181 |
|
|
static const CString HTMLHelpLinkFileName(); // the full path to "link2.htm"
|
182 |
|
|
|
183 |
|
|
protected:
|
184 |
|
|
void AddAllItems ();
|
185 |
|
|
void RemoveAllItems();
|
186 |
|
|
void LogConflicts (const std::list<CdlConflict> & conflicts);
|
187 |
|
|
void ShowSectionProperties();
|
188 |
|
|
void ShowRegionProperties();
|
189 |
|
|
void ErrorBox (UINT, UINT);
|
190 |
|
|
|
191 |
|
|
void EnableCallbacks (bool bEnable=true);
|
192 |
|
|
|
193 |
|
|
CdlPackagesDatabase m_CdlPkgData;
|
194 |
|
|
CdlInterpreter m_CdlInterp;
|
195 |
|
|
CdlConfiguration m_CdlConfig;
|
196 |
|
|
std::string m_template_version;
|
197 |
|
|
static void CdlTransactionHandler (const CdlTransactionCallback & data);
|
198 |
|
|
static CdlInferenceCallbackResult CdlInferenceHandler (CdlTransaction data);
|
199 |
|
|
static CdlInferenceCallbackResult CdlGlobalInferenceHandler(CdlTransaction data);
|
200 |
|
|
static void CdlLoadErrorHandler(std::string message);
|
201 |
|
|
static void CdlLoadWarningHandler(std::string message);
|
202 |
|
|
static CFileName m_strDefaultExternalBrowser;
|
203 |
|
|
CdlBuildInfo m_BuildInfo;
|
204 |
|
|
CFileName m_strBuildTree;
|
205 |
|
|
CFileName m_strInstallTree;
|
206 |
|
|
bool CopyMLTFiles();
|
207 |
|
|
CFileName m_strRepository;
|
208 |
|
|
bool m_bRepositoryOpen;
|
209 |
|
|
|
210 |
|
|
CPtrArray m_arItem;
|
211 |
|
|
|
212 |
|
|
bool NewMemoryLayout (const CString &strPrefix);
|
213 |
|
|
CFileName m_strPackagesDir;
|
214 |
|
|
void CheckRadios();
|
215 |
|
|
|
216 |
|
|
// CDL interface
|
217 |
|
|
void AddContents (const CdlContainer container, CConfigItem * pParent);
|
218 |
|
|
CConfigItem * AddItem (const CdlUserVisible visible, CConfigItem * pParent);
|
219 |
|
|
CString m_strCdlErrorMessage;
|
220 |
|
|
bool OpenRepository (const CFileName strNewRepository,CdlPackagesDatabase &NewCdlPkgData,CdlInterpreter &NewCdlInterp,CdlConfiguration &NewCdlConfig,CFileName &strNewPackagesDir);
|
221 |
|
|
bool GenerateHeaders();
|
222 |
|
|
|
223 |
|
|
// This data supports communication information to the failing rules dialog invoked by CdlGlobalInferenceHandler():
|
224 |
|
|
GlobalConflictOutcome m_ConflictsOutcome;
|
225 |
|
|
CPtrArray m_arConflictsOfInterest; // used by CRulesView::OnResolve
|
226 |
|
|
|
227 |
|
|
bool QualifyDocURL(CString &strURL);
|
228 |
|
|
|
229 |
|
|
#ifdef PLUGIN
|
230 |
|
|
protected:
|
231 |
|
|
CProject * m_peCosProject;
|
232 |
|
|
|
233 |
|
|
public:
|
234 |
|
|
bool CreateTestProjects();
|
235 |
|
|
CProjectManager *m_pm; // A pointer so as to reduce dependencies on this header file
|
236 |
|
|
void SeteCosProject(CProject *peCosProject){m_peCosProject=peCosProject; }
|
237 |
|
|
CProject *eCosProject(){return m_peCosProject; }
|
238 |
|
|
// Here are the declarations that make us look like a CDocument-derived class:
|
239 |
|
|
public:
|
240 |
|
|
bool UnloadPackage (CConfigItem *pItem);
|
241 |
|
|
void OnMLTNewRegion();
|
242 |
|
|
void OnMLTNewSection();
|
243 |
|
|
void OnMLTDelete();
|
244 |
|
|
void OnMLTProperties();
|
245 |
|
|
void OnFileExport();
|
246 |
|
|
void OnFileImport();
|
247 |
|
|
|
248 |
|
|
// Making the class look as if it is derived from CDocument:
|
249 |
|
|
BOOL OnNewDocument();
|
250 |
|
|
BOOL OnOpenDocument(LPCTSTR lpszPathName);
|
251 |
|
|
void OnCloseDocument();
|
252 |
|
|
BOOL OnSaveDocument(LPCTSTR lpszPathName);
|
253 |
|
|
void DeleteContents();
|
254 |
|
|
void SetModifiedFlag( BOOL bModified = TRUE ) { m_bModified=bModified; }
|
255 |
|
|
void UpdateAllViews( CView* pSender, LPARAM lHint = 0L, CObject* pHint = NULL );
|
256 |
|
|
const CString& GetPathName( ) const { return m_strPathName; }
|
257 |
|
|
|
258 |
|
|
bool PostOpenDocument();
|
259 |
|
|
protected:
|
260 |
|
|
CString m_strPathName;
|
261 |
|
|
BOOL m_bModified;
|
262 |
|
|
#else
|
263 |
|
|
//{{AFX_VIRTUAL(CConfigToolDoc)
|
264 |
|
|
public:
|
265 |
|
|
virtual BOOL OnNewDocument();
|
266 |
|
|
virtual void Serialize(CArchive& ar);
|
267 |
|
|
virtual BOOL OnOpenDocument(LPCTSTR lpszPathName);
|
268 |
|
|
virtual void OnCloseDocument();
|
269 |
|
|
virtual BOOL OnSaveDocument(LPCTSTR lpszPathName);
|
270 |
|
|
virtual void DeleteContents();
|
271 |
|
|
protected:
|
272 |
|
|
// virtual BOOL SaveModified();
|
273 |
|
|
//}}AFX_VIRTUAL
|
274 |
|
|
public:
|
275 |
|
|
// Standlone-specific:
|
276 |
|
|
void RunTests();
|
277 |
|
|
enum BrowserType { Internal, AssociatedExternal, CustomExternal };
|
278 |
|
|
BOOL Reload();
|
279 |
|
|
CStringArray m_arstrUserToolPaths;
|
280 |
|
|
bool m_bUseCustomViewer;
|
281 |
|
|
bool m_bUseExternalBrowser;
|
282 |
|
|
CString m_strBrowser;
|
283 |
|
|
CFileName m_strViewer;
|
284 |
|
|
BrowserType m_eUseCustomBrowser;
|
285 |
|
|
const CString CurrentTargetPrefix();
|
286 |
|
|
int GetCompilationCount(LPCTSTR psz);
|
287 |
|
|
|
288 |
|
|
protected:
|
289 |
|
|
|
290 |
|
|
CString m_strBufferedLogMessages;
|
291 |
|
|
// Access to header files:
|
292 |
|
|
#ifdef _DEBUG
|
293 |
|
|
virtual void AssertValid() const;
|
294 |
|
|
virtual void Dump(CDumpContext& dc) const;
|
295 |
|
|
#endif
|
296 |
|
|
public:
|
297 |
|
|
void SetModifiedFlag (BOOL bModified = TRUE) { CDocument::SetModifiedFlag (bModified); UpdateFrameCounts (); }
|
298 |
|
|
// void SetTitle(LPCTSTR lpszTitle);
|
299 |
|
|
|
300 |
|
|
void SaveProfileSettings();
|
301 |
|
|
void LoadProfileSettings();
|
302 |
|
|
//{{AFX_MSG(CConfigToolDoc)
|
303 |
|
|
afx_msg void OnBuildConfigure();
|
304 |
|
|
afx_msg void OnConfigurationRepository();
|
305 |
|
|
afx_msg void OnBuildTemplates();
|
306 |
|
|
afx_msg void OnBuildPackages();
|
307 |
|
|
afx_msg void OnMLTNewRegion();
|
308 |
|
|
afx_msg void OnMLTNewSection();
|
309 |
|
|
afx_msg void OnMLTDelete();
|
310 |
|
|
afx_msg void OnMLTProperties();
|
311 |
|
|
afx_msg void OnUpdateEditDelete(CCmdUI* pCmdUI);
|
312 |
|
|
afx_msg void OnUpdateEditNewSection(CCmdUI* pCmdUI);
|
313 |
|
|
afx_msg void OnUpdateEditProperties(CCmdUI* pCmdUI);
|
314 |
|
|
afx_msg void OnToolsAdministration();
|
315 |
|
|
afx_msg void OnFileExport();
|
316 |
|
|
afx_msg void OnFileImport();
|
317 |
|
|
//}}AFX_MSG
|
318 |
|
|
DECLARE_MESSAGE_MAP()
|
319 |
|
|
#endif
|
320 |
|
|
};
|
321 |
|
|
|
322 |
|
|
/////////////////////////////////////////////////////////////////////////////
|
323 |
|
|
|
324 |
|
|
//{{AFX_INSERT_LOCATION}}
|
325 |
|
|
// Microsoft Developer Studio will insert additional declarations immediately before the previous line.
|
326 |
|
|
|
327 |
|
|
#endif // !defined(AFX_ConfigToolDOC_H__A4845246_05EE_11D2_80BE_00A0C949ADAC__INCLUDED_)
|