blob: 8f23cb188af2b857c02096527b271d585a0eb7a2 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
|
/***************************************************************************
* Copyright (C) 2006 Nicolas Hadacek <hadacek@kde.org> *
* *
* This program is free software; you can redistribute it and/or modify *
* it under the terms of the GNU General Public License as published by *
* the Free Software Foundation; either version 2 of the License, or *
* (at your option) any later version. *
***************************************************************************/
#include "c18.h"
#include <tqdir.h>
#include "c18_compile.h"
#include "c18_config.h"
#include "devices/pic/pic/pic_memory.h"
#include "devices/list/device_list.h"
#include "devices/pic/pic/pic_group.h"
#include "common/global/process.h"
//----------------------------------------------------------------------------
bool C18::Compiler::checkExecutableResult(bool, TQStringList &lines) const
{
return ( lines.count()>0 && lines[0].startsWith("MPLAB C18") );
}
bool C18::Linker::checkExecutableResult(bool, TQStringList &lines) const
{
return ( lines.count()>0 && lines[0].startsWith("MPLINK") );
}
//----------------------------------------------------------------------------
TQValueList<const Device::Data *> C18::Group::getSupportedDevices(const TQString &) const
{
TQValueVector<TQString> devices = Device::lister().group("pic")->supportedDevices();
TQValueList<const Device::Data *> list;
for (uint i=0; i<devices.count(); i++) {
const Device::Data *data = Device::lister().data(devices[i]);
if ( static_cast<const Pic::Data *>(data)->is18Family() ) list.append(data);
}
return list;
}
Compile::Process *C18::Group::processFactory(const Compile::Data &data) const
{
if ( data.category==Tool::Category::Compiler ) return new CompileFile;
Q_ASSERT( data.category==Tool::Category::Linker );
return new Link;
}
PURL::Directory C18::Group::autodetectDirectory(Compile::DirectoryType type, const PURL::Directory &execDir, bool) const
{
TQDir dir(execDir.path());
if ( !dir.cdUp() ) return PURL::Directory();
switch (type.type()) {
case Compile::DirectoryType::LinkerScript:
if ( dir.cd("lkr") ) return dir.path();
break;
case Compile::DirectoryType::Header:
if ( dir.cd("h") ) return dir.path();
break;
case Compile::DirectoryType::Library:
if ( dir.cd("lib") ) return dir.path();
break;
case Compile::DirectoryType::Executable:
case Compile::DirectoryType::Source:
case Compile::DirectoryType::Nb_Types: Q_ASSERT(false); break;
}
return PURL::Directory();
}
Compile::Config *C18::Group::configFactory(::Project *project) const
{
return new Config(project);
}
Tool::Group::BaseData C18::Group::baseFactory(Tool::Category category) const
{
if ( category==Tool::Category::Compiler ) return BaseData(new Compiler, Both);
if ( category==Tool::Category::Linker ) return BaseData(new Linker, Both);
return BaseData();
}
TQString C18::Group::informationText() const
{
return i18n("<qt><a href=\"%1\">C18</a> is a C compiler distributed by Microchip.</qt>").arg("http://www.microchip.com/stellent/idcplg?IdcService=SS_GET_PAGE&nodeId=1406&dDocName=en010014&part=SW006011");
}
|