| 844 | |
| 845 | template <typename TT> |
| 846 | void addConstant ( Module & mod, const string & name, const TT & value ) { |
| 847 | VariablePtr pVar = new Variable(); |
| 848 | pVar->name = name; |
| 849 | pVar->type = new TypeDecl((Type)ToBasicType<TT>::type); |
| 850 | pVar->type->constant = true; |
| 851 | pVar->init = Program::makeConst(LineInfo(),pVar->type,cast<TT>::from(value)); |
| 852 | pVar->init->type = new TypeDecl(*pVar->type); |
| 853 | pVar->init->constexpression = true; |
| 854 | pVar->initStackSize = sizeof(Prologue); |
| 855 | if ( !mod.addVariable(pVar) ) { |
| 856 | DAS_FATAL_ERROR("addVariable(%s) failed in module %s\n", name.c_str(), mod.name.c_str()); |
| 857 | } |
| 858 | } |
| 859 | __forceinline void addConstant ( Module & mod, const string & name, const string & value ) { |
| 860 | VariablePtr pVar = new Variable(); |
| 861 | pVar->name = name; |