mad_status MADIMPENTRY( TypeToString )( mad_radix radix, const mad_type_info *mti, const void *data, char *buff, size_t *buff_size_p ) { mad_status ms; const mad_type_info *new_mti; unsigned_16 temp[4]; switch( mti->b.handler_code ) { case AXPT_F_FLOAT: new_mti = TypeArray[AXPT_FLOAT].u.mti; break; case AXPT_G_FLOAT: case AXPT_D_FLOAT: new_mti = TypeArray[AXPT_DOUBLE].u.mti; break; default: return( MS_UNSUPPORTED ); } ms = DoConvert( mti, data, new_mti, &temp ); if( ms != MS_OK ) return( ms ); return( MCTypeToString( radix, new_mti, temp, buff, buff_size_p ) ); }
static unsigned MechDo( unsigned select, unsigned parm ) { unsigned long size; unsigned result = 0; DIPHDL( type, th ); dip_type_info info; mad_type_info mti; switch( select ) { case 0: DoAssign(); break; case 1: DoMul(); break; case 2: DoDiv(); break; case 3: DoMod(); break; case 4: DoMinus(); break; case 5: DoShift(); break; case 6: DoAnd(); break; case 7: DoXor(); break; case 8: DoOr(); break; case 9: DoAddr(); break; case 10: ClassToTypeInfo( parm, &info ); DoPoints( info.kind ); break; case 11: DoField(); break; case 12: DoCall( Num, parm ); break; case 13: DoConvert(); break; case 14: DoPlus(); break; case 15: MakeAddr(); break; case 16: result = TstEQ( parm ); break; case 17: result = TstLT( parm ); break; case 18: result = TstTrue( parm ); break; case 19: result = TstExist( parm ); break; case 20: size = ExprSP->info.size; PopEntry(); PushNum( size ); break; case 21: TypeBase( ExprSP->th, th, NULL, NULL ); PopEntry(); PushType( th ); break; case 22: GetMADTypeDefault( MTK_ADDRESS, &mti ); size = (mti.b.bits - mti.a.seg.bits) / BITS_PER_BYTE; if( parm ) { size += sizeof( addr_seg ); TypePointer( ExprSP->th, TM_FAR, size, th ); } else { TypePointer( ExprSP->th, TM_NEAR, size, th ); } PopEntry(); PushType( th ); break; case 23: result = UserType( th ); if( result ) { PopEntry(); PushType( th ); } break; case 24: DoMakeComplex(); break; case 25: DoStringConcat(); break; case 26: DoLConvert(); break; case 27: DoPlusScaled(); break; case 28: DoMinusScaled(); break; case 29: DoPoints( TI_KIND_EXTRACT( parm ) ); break; case 30: info.kind = TK_POINTER; info.size = TI_SIZE_EXTRACT( parm ); info.modifier = TI_MOD_EXTRACT( parm ); FillInDefaults( &info ); TypePointer( ExprSP->th, info.modifier, info.size, th ); PopEntry(); PushType( th ); break; case 31: if( parm ) { /* file scope */ if( ExprSP->flags & SF_NAME ) { ExprSP->v.li.file_scope = TRUE; } else { Error( ERR_LOC, LIT( ERR_WANT_NAME ) ); } } else { /* in a namespace */ DoScope(); } break; } return( result ); }
//______________________________________________________________________________ void MainWindow::init() { //initialisation of the gui //recall objects from .ui file and connect them with user functions ui_ConvertButton = this->findChild<QCommandLinkButton*>("ConvertButton"); ui_ExitButton = this->findChild<QCommandLinkButton*>("ExitButton"); ui_OutputButton = this->findChild<QCommandLinkButton*>("OutputButton"); connect(ui_ConvertButton, SIGNAL(clicked()), this, SLOT(DoConvert())); connect(ui_ExitButton, SIGNAL(clicked()), this, SLOT(DoExit())); connect(ui_OutputButton, SIGNAL(clicked()), this, SLOT(DoOutput())); ui_actionExit = this->findChild<QAction*>("actionExit"); ui_actionLoad = this->findChild<QAction*>("actionLoad"); ui_actionSave = this->findChild<QAction*>("actionSave"); connect(ui_actionExit, SIGNAL(triggered()), this, SLOT(DoExit())); connect(ui_actionSave, SIGNAL(triggered()), this, SLOT(DoSave())); connect(ui_actionLoad, SIGNAL(triggered()), this, SLOT(DoLoad())); ui_EmaxSpinBox = this->findChild<QSpinBox*>("EmaxSpinBox"); ui_BinSizeSpinBox = this->findChild<QSpinBox*>("BinSizeSpinBox"); ui_ASpinBox = this->findChild<QSpinBox*>("ASpinBox"); ui_ZSpinBox = this->findChild<QSpinBox*>("ZSpinBox"); ui_SpinParitySpinBox = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox"); ui_SpinParitySpinBox_2 = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_2"); ui_SpinParitySpinBox_n1 = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n1"); ui_SpinParitySpinBox_n2 = this->findChild<QDoubleSpinBox*>("SpinParitySpinBox_n2"); ui_TorASpinBox_1 = this->findChild<QDoubleSpinBox*>("TorASpinBox_1"); ui_TorASpinBox_2 = this->findChild<QDoubleSpinBox*>("TorASpinBox_2"); ui_PairSpinBox = this->findChild<QDoubleSpinBox*>("PairSpinBox"); ui_ParityBox = this->findChild<QDoubleSpinBox*>("ParityBox"); ui_E1doubleSpinBox_1 = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_1"); ui_E1doubleSpinBox_2 = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_2"); ui_E1doubleSpinBox_3 = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_3"); ui_E1doubleSpinBox_4 = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_4"); ui_E1doubleSpinBox_5 = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_5"); ui_E1doubleSpinBox_6 = this->findChild<QDoubleSpinBox*>("E1doubleSpinBox_6"); ui_M1doubleSpinBox_1 = this->findChild<QDoubleSpinBox*>("M1doubleSpinBox_1"); ui_OutputLabel = this->findChild<QLabel*>("OutputLabel"); ui_TorALabel_1 = this->findChild<QLabel*>("TorALabel_1"); ui_TorALabel_2 = this->findChild<QLabel*>("TorALabel_2"); ui_EmaxLabel = this->findChild<QLabel*>("EmaxLabel"); ui_E1label_1 = this->findChild<QLabel*>("E1Label_1"); ui_E1label_2 = this->findChild<QLabel*>("E1Label_2"); ui_E1label_3 = this->findChild<QLabel*>("E1Label_3"); ui_E1label_4 = this->findChild<QLabel*>("E1Label_4"); ui_E1label_5 = this->findChild<QLabel*>("E1Label_5"); ui_E1label_6 = this->findChild<QLabel*>("E1Label_6"); ui_M1label_1 = this->findChild<QLabel*>("M1Label_1"); ui_M1label_2 = this->findChild<QLabel*>("M1Label_2"); ui_Levellabel = this->findChild<QLabel*>("Levellabel"); ui_Spectrumlabel = this->findChild<QLabel*>("SpectrumLabel"); ui_progressbar = this->findChild<QProgressBar*>("progressBar"); ui_E1pushButton = this->findChild<QPushButton*>("E1pushButton"); connect(ui_E1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile1())); ui_M1pushButton = this->findChild<QPushButton*>("M1pushButton"); connect(ui_M1pushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile2())); ui_LevelpushButton = this->findChild<QPushButton*>("LevelpushButton"); connect(ui_LevelpushButton, SIGNAL(clicked()),this,SLOT(DoSelectfile3())); ui_LevelpushButton_2 = this->findChild<QPushButton*>("LevelpushButton_2"); connect(ui_LevelpushButton_2, SIGNAL(clicked()),this,SLOT(Clear())); ui_SpectrumButton = this->findChild<QPushButton*>("SpectrumButton"); connect(ui_SpectrumButton, SIGNAL(clicked()),this,SLOT(DoSelectfile4())); ui_DensityEnergyComboBox = this->findChild<QComboBox*>("DensityEnergyComboBox"); connect(ui_DensityEnergyComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoModel())); ui_ReactionComboBox = this->findChild<QComboBox*>("ReactionComboBox"); connect(ui_ReactionComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoEmax())); ui_E1StrengthComboBox = this->findChild<QComboBox*>("E1StrengthComboBox"); connect(ui_E1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoE1())); ui_M1StrengthComboBox = this->findChild<QComboBox*>("M1StrengthComboBox"); connect(ui_M1StrengthComboBox,SIGNAL(currentIndexChanged(int)) ,this,SLOT(DoM1())); ui_E1pushButton->hide(); ui_E1label_6->hide(); ui_E1doubleSpinBox_3->hide(); ui_E1doubleSpinBox_4->hide(); ui_E1doubleSpinBox_5->hide(); ui_E1doubleSpinBox_6->hide(); ui_M1label_1->hide(); ui_M1label_2->hide(); ui_M1doubleSpinBox_1->hide(); ui_M1pushButton->hide(); ui_Spectrumlabel->hide(); ui_SpectrumButton->hide(); }
mad_status MADIMPENTRY( TypeConvert )( const mad_type_info *in_mti, const void *in_d, const mad_type_info *out_mti, void *out_d, addr_seg seg ) { /* unused parameters */ (void)seg; return( DoConvert( in_mti, in_d, out_mti, out_d ) ); }
void DoMove(short dest, short src) { short rsrc; int sflag, type; enum inst mov; sflag = STflag[src-1]; if (IS_CONST(sflag)) { type = FLAG2PTYPE(sflag); rsrc = GetReg(type); /* * FIXME: need to add const_init for each floating point const, by this way * we can have a placeholder for that const in stack. We should/will create * the placeholder whenever user uses a floating point const, but until it's * upto user to manage it correctly. * Don't need any place-holder for the value 0.0. we can use FZERO LIL * inst for that. It won't maintain the load->Arith->store structure of LIL. * Need to check whether it creates any problem in later transformation!!! */ #if 0 if (IS_CONST(sflag) && (type == T_INT) && SToff[src-1].i == 0) InsNewInst(NULL, NULL, NULL, XOR, -rsrc, -rsrc, -rsrc); else { if (type == T_INT) mov = MOV; else if (type == T_FLOAT) mov = FMOV; else { assert(type == T_DOUBLE); mov = FMOVD; } InsNewInst(NULL, NULL, NULL, mov, -rsrc, src, 0); } LocalStore(dest, rsrc); #else if (FLAG2TYPE(STflag[dest-1]) != FLAG2TYPE(sflag)) fko_error(__LINE__, "Conversions of constant not yet supported"); if (type == T_INT) { if (SToff[src-1].i == 0) InsNewInst(NULL, NULL, NULL, XOR, -rsrc, -rsrc, -rsrc); else { mov = MOV; InsNewInst(NULL, NULL, NULL, mov, -rsrc, src, 0); } } else if (type == T_FLOAT) { if (SToff[src-1].f == 0.0) InsNewInst(NULL, NULL, NULL, FZERO, -rsrc, 0, 0); else fko_error(__LINE__, "Floating point const other than zero must be defined before"); } else if (type == T_DOUBLE) { if (SToff[src-1].d == 0.0) InsNewInst(NULL, NULL, NULL, FZEROD, -rsrc, 0, 0); else fko_error(__LINE__, "Floating point const other than zero must be defined before"); } else fko_error(__LINE__, "unsupported constant!"); LocalStore(dest, rsrc); #endif } else if (FLAG2TYPE(STflag[dest-1]) == FLAG2TYPE(sflag)) { rsrc = LocalLoad(src); LocalStore(dest, rsrc); } else DoConvert(dest, src); GetReg(-1); }
static ssl_value MechDo( unsigned select, ssl_value parm ) { unsigned long size; ssl_value result; DIPHDL( type, th ); dig_type_info ti; mad_type_info mti; result = 0; switch( select ) { case 0: DoAssign(); break; case 1: DoMul(); break; case 2: DoDiv(); break; case 3: DoMod(); break; case 4: DoMinus(); break; case 5: DoShift(); break; case 6: DoAnd(); break; case 7: DoXor(); break; case 8: DoOr(); break; case 9: DoAddr(); break; case 10: ClassToTypeInfo( parm, &ti ); DoPoints( ti.kind ); break; case 11: DoField(); break; case 12: DoCall( Num, SSL2BOOL( parm ) ); break; case 13: DoConvert(); break; case 14: DoPlus(); break; case 15: MakeAddr(); break; case 16: result = ( TstEQ( SSL2INT( parm ) ) != 0 ); break; case 17: result = ( TstLT( SSL2INT( parm ) ) != 0 ); break; case 18: result = ( TstTrue( SSL2INT( parm ) ) != 0 ); break; case 19: result = ( TstExist( SSL2INT( parm ) ) != 0 ); break; case 20: size = ExprSP->ti.size; PopEntry(); PushNum( size ); break; case 21: DIPTypeBase( ExprSP->th, th, NULL, NULL ); PopEntry(); PushType( th ); break; case 22: GetMADTypeDefault( MTK_ADDRESS, &mti ); size = BITS2BYTES( mti.b.bits - mti.a.seg.bits ); if( parm ) { size += sizeof( addr_seg ); DIPTypePointer( ExprSP->th, TM_FAR, size, th ); } else { DIPTypePointer( ExprSP->th, TM_NEAR, size, th ); } PopEntry(); PushType( th ); break; case 23: result = UserType( th ); if( result ) { PopEntry(); PushType( th ); } break; case 24: DoMakeComplex(); break; case 25: DoStringConcat(); break; case 26: DoLConvert(); break; case 27: DoPlusScaled(); break; case 28: DoMinusScaled(); break; case 29: DoPoints( TI_KIND_EXTRACT( parm ) ); break; case 30: ti.kind = TK_POINTER; ti.size = TI_SIZE_EXTRACT( parm ); ti.modifier = TI_MOD_EXTRACT( parm ); ti.deref = false; FillInDefaults( &ti ); DIPTypePointer( ExprSP->th, ti.modifier, ti.size, th ); PopEntry(); PushType( th ); break; case 31: if( SSL2BOOL( parm ) ) { /* file scope */ if( ExprSP->flags & SF_NAME ) { ExprSP->v.li.file_scope = true; } else { Error( ERR_LOC, LIT_ENG( ERR_WANT_NAME ) ); } } else { /* in a namespace */ DoScope(); } break; } return( result ); }
void ConvertTrans(uint8 *pSrc, uint8 *pDest, uint32 uTransColor) { uint32 iSrcColor = DoConvert(pSrc); if (iSrcColor != uTransColor) DEST_32 = iSrcColor; }
void Convert(uint8 *pSrc, uint8 *pDest) { DEST_32 = DoConvert(pSrc); }