Home | History | Annotate | Download | only in Script
      1 //===- OutputFormatCmd.cpp ------------------------------------------------===//
      2 //
      3 //                     The MCLinker Project
      4 //
      5 // This file is distributed under the University of Illinois Open Source
      6 // License. See LICENSE.TXT for details.
      7 //
      8 //===----------------------------------------------------------------------===//
      9 #include <mcld/Script/OutputFormatCmd.h>
     10 #include <mcld/Support/raw_ostream.h>
     11 
     12 using namespace mcld;
     13 
     14 //===----------------------------------------------------------------------===//
     15 // OutputFormatCmd
     16 //===----------------------------------------------------------------------===//
     17 OutputFormatCmd::OutputFormatCmd(const std::string& pFormat)
     18   : ScriptCommand(ScriptCommand::OUTPUT_FORMAT)
     19 {
     20   m_FormatList.push_back(pFormat);
     21 }
     22 
     23 OutputFormatCmd::OutputFormatCmd(const std::string& pDefault,
     24                                  const std::string& pBig,
     25                                  const std::string& pLittle)
     26   : ScriptCommand(ScriptCommand::OUTPUT_FORMAT)
     27 {
     28   m_FormatList.push_back(pDefault);
     29   m_FormatList.push_back(pBig);
     30   m_FormatList.push_back(pLittle);
     31 }
     32 
     33 OutputFormatCmd::~OutputFormatCmd()
     34 {
     35 }
     36 
     37 void OutputFormatCmd::dump() const
     38 {
     39   mcld::outs() << "OUTPUT_FORMAT ( ";
     40   assert(m_FormatList.size() == 1 || m_FormatList.size() == 3);
     41   for (size_t i = 0; i < m_FormatList.size(); ++i) {
     42     if (i != 0)
     43       mcld::outs() << " , ";
     44     mcld::outs() << m_FormatList[i];
     45   }
     46   mcld::outs() << " )\n";
     47 }
     48 
     49 void OutputFormatCmd::activate(Module& pModule)
     50 {
     51   // TODO
     52 }
     53 
     54