OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [ecos-2.0/] [tools/] [src/] [tools/] [configtool/] [common/] [win32/] [ConfigToolDoc.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.