static ULONG set_file_pointer (Tchannel channel, ULONG type, LONG distance) { ULONG fp; if ((CHANNEL_TYPE (channel)) != channel_type_file) OS2_error_system_call (ERROR_INVALID_HANDLE, syscall_dos_set_file_ptr); STD_API_CALL (dos_set_file_ptr, ((CHANNEL_HANDLE (channel)), distance, type, (&fp))); return (fp); }
off_t OS_file_length (Tchannel channel) { FILESTATUS3 buffer; if ((CHANNEL_TYPE (channel)) != channel_type_file) OS2_error_system_call (ERROR_INVALID_HANDLE, syscall_dos_query_file_info); STD_API_CALL (dos_query_file_info, ((CHANNEL_HANDLE (channel)), FIL_STANDARD, (&buffer), (sizeof (buffer)))); return (buffer.cbFile); }
DevChannelMath::DevChannelMath(quint32 chanCoder, QObject *parent) : Channel(chanCoder, parent) { MODBUS_REGISTER_MAP *pModbusRegMap; quint16 chanType, uninNum, moduleIndex, number; chanType = CHANNEL_TYPE(m_chanCoder); //通道类型 uninNum = CHANNEL_UNIT(m_chanCoder); //单元号 moduleIndex = CHANNEL_MODULE(m_chanCoder); //卡槽号 number = CHANNEL_NUM(m_chanCoder) - 1; //通道号 Q_ASSERT(chanType==Channel_Type_Math && uninNum==0 && moduleIndex==0 && number<MAIN_UNIT_MATH_CHAN_NUM_PRE); pModbusRegMap = const_cast<MODBUS_REGISTER_MAP*>(static_cast<MODBUS_REGISTER_MAP const *>(DevShareMem.constData())); m_pData = (float *)&pModbusRegMap->inputReg_MainUnit_Math_Data_Float32[number<<1]; m_pStatus = &pModbusRegMap->inputReg_MainUnit_Math_Status_Int16[number]; m_pConfig = &DevConfigPtr->chanMath[number]; p_calculateData = (float *)&g_originDataMap.inputReg_MainUnit_Math_Data_Float32[number<<1]; p_chanStatus = &g_originDataMap.inputReg_MainUnit_Math_Status_Int16[number]; //表达式初始化 if (m_pConfig->expressConfig.expSwtich) { QByteArray expArray((const char *)m_pConfig->expressConfig.expExpression); if (expArray.isEmpty()) { p_expAnalysis = NULL; } else { p_expAnalysis = new MathExpAnalysis(number+1, expArray); if (p_expAnalysis) { if (!p_expAnalysis->isExpValid()) { delete p_expAnalysis; p_expAnalysis = NULL; } } else { qDebug("Error: Mem alloc Failed[%s]\n", __func__); } } } else { p_expAnalysis = NULL; } m_sampleCount = 0; m_math_DelayUpper = 0; m_math_DelayDowner = 0; }
static Tchannel open_file_noerror (const char * filename, ULONG attr, ULONG flags, unsigned int mode) { HFILE handle; ULONG action; if ((dos_open (((char *) filename), (&handle), (&action), 0, attr, flags, (OS2_OPEN_MODE (mode)), 0)) != NO_ERROR) return (NO_CHANNEL); { Tchannel channel = (OS2_make_channel (handle, mode)); if ((CHANNEL_TYPE (channel)) == channel_type_file) return (channel); OS_channel_close_noerror (channel); return (NO_CHANNEL); } }