12345678910111213141516171819202122232425262728293031323334353637 |
- #include <ostream>
- #include <cassert>
- #include "CallConvention.h"
- #include <QtCore/QTextStream>
- CConv *CConv::create(Type v)
- {
- static C_CallingConvention *c_call = nullptr;
- static Pascal_CallingConvention *p_call = nullptr;
- static Unknown_CallingConvention *u_call= nullptr;
- if(nullptr==c_call)
- c_call = new C_CallingConvention;
- if(nullptr==p_call)
- p_call = new Pascal_CallingConvention;
- if(nullptr==u_call)
- u_call = new Unknown_CallingConvention;
- switch(v) {
- case eUnknown: return u_call;
- case eCdecl: return c_call;
- case ePascal: return p_call;
- }
- assert(false);
- return nullptr;
- }
- void C_CallingConvention::writeComments(QTextStream & ostr)
- {
- ostr << " * C calling convention.\n";
- }
- void Pascal_CallingConvention::writeComments(QTextStream & ostr)
- {
- ostr << " * Pascal calling convention.\n";
- }
- void Unknown_CallingConvention::writeComments(QTextStream & ostr)
- {
- ostr << " * Unknown calling convention.\n";
- }
|