本文整理汇总了C++中Fmt函数的典型用法代码示例。如果您正苦于以下问题:C++ Fmt函数的具体用法?C++ Fmt怎么用?C++ Fmt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了Fmt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: das1602_Create
void das1602_Create (MCCdevPtr dev)
{
int i;
char name[50];
das1602Ptr das = malloc(sizeof(das1602Type));
dev->device = das;
das->panel = 0;
for(i = 0; i < 8; i++)
{
//portPtr create_Port(*dev, *name, type, direction, GetReading, channel, range)
Fmt (name, "PCI-DAS1602 analog in %i", i);
das->Achannels[i] = create_Port(dev, name, ANALOGUE, IN_PORT, ReadAnalogue, i, BIP10VOLTS);
das->Achannels[i]->control = 0;
}
for(i = 0; i < 2; i++)
{
//portPtr create_Port(*dev, *name, type, direction, GetReading, SetLevel, channel, range)
Fmt (name, "PCI-DAS1602 analog out %i", i);
das->Achannels[i+8] = create_Port(dev, name, ANALOGUE, OUT_PORT, ReadAnalogueOut, SetAnalogue, i, BIP10VOLTS);
das->Achannels[i+8]->port.analogueIOport.IO.source->max = 10;
das->Achannels[i+8]->port.analogueIOport.IO.source->min = -10;
das->Achannels[i+8]->port.analogueIOport.IO.source->ranges.temprange[0] = range_Create(10, -10, 0.000305);
}
das->Achannels[0]->menuitem_id = DASMENU_MEAS_IN_0;
das->Achannels[1]->menuitem_id = DASMENU_MEAS_IN_1;
das->Achannels[2]->menuitem_id = DASMENU_MEAS_IN_2;
das->Achannels[3]->menuitem_id = DASMENU_MEAS_IN_3;
das->Achannels[4]->menuitem_id = DASMENU_MEAS_IN_4;
das->Achannels[5]->menuitem_id = DASMENU_MEAS_IN_5;
das->Achannels[6]->menuitem_id = DASMENU_MEAS_IN_6;
das->Achannels[7]->menuitem_id = DASMENU_MEAS_IN_7;
}
示例2: DataFileSaveAsCallback
int DataFileSaveAsCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
char path[300], path1[300], path2[300], name[300];
int i, filestatus; char *date, mon[10], day[10], yr[10];
if (event == EVENT_COMMIT) {
Fmt (name, "%s<%s.%i", dataFile.name, dataFile.ext);
filestatus = FileSelectPopup (dataFile.dir, name, "",
"Save As [file extension must be a #!]:",
VAL_OK_BUTTON, 0, 0, 1, 1, path);
switch (filestatus) {
case VAL_EXISTING_FILE_SELECTED:
MessagePopup ("Save As Message", "Cannot select duplicate file paths");
break;
case VAL_NEW_FILE_SELECTED:
Fmt (path1, path);
while (Scan(path1, "%s>%s[xdt92]%s", path2) == 2)
Fmt (path1, path2);
Scan (path2, "%s>%s[t46]", dataFile.name);
i = Scan (path2, "%s>%s[xdt46]%i[b2]", &dataFile.ext);
if (i != 2)
MessagePopup ("File name error",
"File extension must be a number..."
"extension ignored");
Fmt (path1, path);
i = FindPattern (path1, 0, StringLength (path1), path2, 0, 0);
CopyString (dataFile.dir, 0, path1, 0, i-1);
acquire_UpdateDataFileInfo();
break;
}
}
return 0;
}
示例3: DoClipCallback
int DoClipCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
int i;
double min, max;
channelPtr chan, newchan;
if (event == EVENT_COMMIT)
{
GetCtrlVal (panel, CLIP_CHANNELS, &i);
GetCtrlVal (panel, CLIP_MIN, &min);
GetCtrlVal (panel, CLIP_MAX, &max);
chan = channellist_GetItem (i);
newchan = channel_Create();
if (newchan && channel_AllocMem (newchan, chan->pts) &&
(Clip (chan->readings, chan->pts, max, min, newchan->readings) == NoErr))
{
Fmt (newchan->label, "%s (clipped)", chan->label);
Fmt (newchan->note, "%s\n%s\nmin = %f[e2p3]\nmax = %f[e2p3]\n",
chan->note, newchan->label, min, max);
channellist_AddChannel (newchan);
return 1;
}
MessagePopup ("Clip Channel Message", "Error clipping channel--function voided");
if (newchan)
{
if (newchan->readings) free (newchan->readings);
free (newchan);
}
}
return 0;
}
示例4: k213_GetErrorStatus
static void k213_GetErrorStatus (gpibioPtr dev)
{
int error, s;
char e_msg[256], *s_msg, rsp[256];
gpibio_Out (dev, "E?");
gpibio_In (dev, rsp);
Scan (rsp, "%s>E%i", &error);
switch (error) {
case 1: MessagePopup ("Keithley 213 Message", "ERROR: Unrecognized command"); break;
case 2: MessagePopup ("Keithley 213 Message", "ERROR: Invalid command parameter"); break;
case 3: MessagePopup ("Keithley 213 Message", "ERROR: Command conflict"); break;
case 4: MessagePopup ("Keithley 213 Message", "ERROR: Calibration switch not closed"); break;
case 5:
gpibio_Out (dev, "S?");
gpibio_In (dev, rsp);
Scan (rsp, "%s>S%i", &s);
Fmt (e_msg, "ERROR: Non-volatile RAM error, system defaults or calibration may be lost.");
if (s) s_msg = "User programmed defaults are still valid";
else s_msg = "Factory defaults are in use, user programmed defaults were lost";
Fmt (e_msg, "%s[a]<\n%s", s_msg);
MessagePopup ("Keithley 213 Message", e_msg);
break;
}
}
示例5: DoDecimateCallback
int DoDecimateCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
int i, dfact, ave;
channelPtr chan, newchan;
if (event == EVENT_COMMIT)
{
GetCtrlVal (panel, DECIMATE_CHANNELS, &i);
GetCtrlVal (panel, DECIMATE_DFACT, &dfact);
GetCtrlVal (panel, DECIMATE_AVE, &ave);
chan = channellist_GetItem (i);
newchan = channel_Create();
if (newchan && channel_AllocMem (newchan, (int)(chan->pts/dfact)) &&
(Decimate (chan->readings, chan->pts, dfact, ave, newchan->readings) == NoErr))
{
Fmt (newchan->label, "%s (decimated)", chan->label);
Fmt (newchan->note, "%s\n%s\ndfact = %i\nave = %i\n",
chan->note, newchan->label, dfact, ave);
channellist_AddChannel (newchan);
return 1;
}
MessagePopup ("Decimate Channel Message", "Error decimating channel--function voided");
if (newchan)
{
if (newchan->readings) free (newchan->readings);
free (newchan);
}
}
return 0;
}
示例6: SR844RefCallback
int SR844RefCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
gpibioPtr dev = callbackData;
double r;
char cmd[256];
switch (control) {
case SR844_REF_FREQ:
if (event == EVENT_VAL_CHANGED) {
GetCtrlVal (panel, control, &r);
Fmt (cmd, "FREQ%f", r);
gpibio_Out (dev, cmd);
r = sr844_GetDoubleVal (dev, "FREQ?");
SetCtrlVal (panel, control, r);
SetCtrlAttribute (panel, control, ATTR_INCR_VALUE, r/10);
}
break;
case SR844_REF_PHASE:
if (event == EVENT_VAL_CHANGED) {
GetCtrlVal (panel, control, &r);
Fmt (cmd, "PHAS%f", r);
gpibio_Out (dev, cmd);
SetCtrlVal (panel, control, sr844_GetDoubleVal(dev, "PHAS?"));
}
break;
}
return 0;
}
示例7: usb1208ls_Init
void usb1208ls_Init(void)
{
MCCdevTypePtr devType = malloc(sizeof(MCCdevTypeItem));
MCCdevTypePtr devType_alt = malloc(sizeof(MCCdevTypeItem));
if(utilG.acq.status != ACQ_NONE)
{
util_ChangeInitMessage ("usb-usb1208...");
if(devType)
{
Fmt(devType->id, PMD1208LS_ID);
Fmt(devType->label, "usb-1208ls");
devType->CreateDevice = usb1208ls_Create;
devType->RemoveDevice = usb1208ls_Remove;
devType->OperateDevice = usb1208lsOperate;
devType->UpdateReadings = usb1208ls_UpdateReadings;
devType->SaveDevice = usb1208ls_Save;
devType->LoadDevice = usb1208ls_Load;
boards_DevTypeList_AddDev(devType);
}
if(devType_alt)
{
Fmt(devType_alt->id, PMD1208LS_ID_ALT);
Fmt(devType_alt->label, "usb-1208ls");
devType_alt->CreateDevice = devType->CreateDevice;
devType_alt->RemoveDevice = devType->RemoveDevice;
devType_alt->OperateDevice = devType->OperateDevice;
devType_alt->UpdateReadings = devType->UpdateReadings;
devType_alt->SaveDevice = devType->SaveDevice;
devType_alt->LoadDevice = devType->LoadDevice;
boards_DevTypeList_AddDev(devType_alt);
}
}
}
示例8: InverseCallback
void InverseCallback(int menubar, int menuItem, void *callbackData, int panel)
{
channelPtr chan, newchan;
int pt, err;
chan = channellist_GetSelection();
err = FALSE;
newchan = channel_Create();
if (newchan && channel_AllocMem (newchan, chan->pts))
{
for (pt = 0; pt < chan->pts; pt++)
{
if (chan->readings[pt] != 0.0)
newchan->readings[pt] = 1/chan->readings[pt];
else {err = TRUE; break;}
}
if (!err)
{
Fmt (newchan->label, "%s<1 / (%s)", chan->label);
Fmt (newchan->note, "%s\n%s\n", chan->note, newchan->label);
channellist_AddChannel (newchan);
}
else {free (newchan->readings); free (newchan); newchan = NULL;}
}
else err = TRUE;
if (err)
{
MessagePopup ("Inverse Function Message", "Channel readings include 0.0 - function voided");
if (newchan) free (newchan);
}
}
示例9: WriteString
/**
* @brief Generate simple xml report header.
*/
void DirCmpReport::GenerateXmlHeader()
{
WriteString(_T("")); // @todo xml declaration
WriteString(_T("<WinMergeDiffReport version=\"1\">\n"));
WriteString(Fmt(_T("<left>%s</left>\n"), m_rootPaths.GetLeft().c_str()));
WriteString(Fmt(_T("<right>%s</right>\n"), m_rootPaths.GetRight().c_str()));
WriteString(Fmt(_T("<time>%s</time>\n"), GetCurrentTimeString().c_str()));
// Add column headers
const CString rowEl = _T("column_name");
WriteString(BeginEl(rowEl));
for (int currCol = 0; currCol < m_nColumns; currCol++)
{
TCHAR columnName[160]; // Assuming max col header will never be > 160
LVCOLUMN lvc;
lvc.mask = LVCF_TEXT;
lvc.pszText = &columnName[0];
lvc.cchTextMax = countof(columnName);
const CString colEl = m_colRegKeys[currCol];
if (m_pList->GetColumn(currCol, &lvc))
{
WriteString(BeginEl(colEl));
WriteString(lvc.pszText);
WriteString(EndEl(colEl));
}
}
WriteString(EndEl(rowEl) + _T("\n"));
}
示例10: k2400_Load
static void k2400_Load (gpibioPtr dev)
{
char cmd[256];
double r;
int i;
k2400Ptr smu;
sourcePtr src;
if (dev){
smu = dev->device;
src = smu->source;
}
else smu = k2400_Create (NULL);
/* if (dev) k2400_Out (dev, "N0X");*/
ScanFile (fileHandle.analysis, "%s>Sense : %i%s[dw1]", &smu->sense);
if (dev) {Fmt (cmd, ":SYSTem:RSENse %i", smu->sense); k2400_Out (dev, cmd, 0);}
ScanFile (fileHandle.analysis, "%s>Source : %i, %i%s[dw1]",
&smu->src.current, &smu->src.delay);
if (dev) {
if(smu->src.current)
{
k2400_Out(dev, ":SOURce:FUNCtion:MODE CURRent", .07);
k2400_Out(dev, ":SENSe:FUNCtion \"VOLTage\"", .07);
}
else
{
k2400_Out(dev, ":SOURce:FUNCtion:MODE VOLTage", .07);
k2400_Out(dev, ":SENSe:FUNCtion \"CURRent\"", .07);
}
smu->source->sourceOn = 0;
Fmt (cmd, ":SOURce:DELay:AUTO %i", smu->src.delay);
k2400_Out (dev, cmd, 0);
}
smu->src.rangeV = 0;
smu->src.rangeC = 0;/*AUTO*/
smu->source->min = -110.0;
smu->source->max = 110.0;
k2400_Out(dev,":OUTPut:STATe?",0);
k2400_In(dev,cmd);
Scan(cmd, "%i", &smu->source->sourceOn);
source_Load (dev, smu->source);
ScanFile (fileHandle.analysis, "%s>Measure : %f, %i, %i, %f\0",
&r, &smu->meas.range, &smu->meas.filter, &smu->meas.inttime);
if (dev) {
Fmt (cmd, "SENSe:CURRent:NPLCycles %f", smu->meas.inttime);
k2400_Out (dev, cmd, 0);
Fmt (cmd, "SENSe:AVERage:COUNt %i", smu->meas.filter);
k2400_Out (dev, cmd, 0);
}
acqchan_Load (dev, smu->measure);
if (!dev) k2400_Remove (smu);
}
示例11: SR844ControlCallback
int SR844ControlCallback(int panel, int control, int event, void *callbackData, int eventData1, int eventData2)
{
int i;
char cmd[256], rsp[256];
gpibioPtr dev;
sr844Ptr lia;
dev = callbackData;
switch (control) {
case SR844_CTRL_TC:
if (event == EVENT_COMMIT) {
GetCtrlVal (panel, control, &i);
Fmt (cmd, "OFLT%i", i);
sr844_CheckClear(dev);
gpibio_Out (dev, cmd);
}
break;
case SR844_CTRL_SENS:
if (event == EVENT_COMMIT) {
GetCtrlVal (panel, control, &i);
Fmt (cmd, "SENS%i", i);
sr844_CheckClear(dev);
gpibio_Out (dev, cmd);
}
break;
case SR844_CTRL_AUTOSENSE:
if (event == EVENT_COMMIT) {
lia = dev->device;
GetCtrlVal (panel, control, &lia->autosens);
sr844_CheckClear(dev);
if(lia->autosens)
{
GetCtrlVal (panel, SR844_CTRL_SENS, &i);
Fmt (cmd, "SENS%i", i);
gpibio_Out (dev, cmd);
}
}
break;
case SR844_CTRL_FILTSLOPE:
if (event == EVENT_COMMIT) {
GetCtrlVal (panel, control, &i);
Fmt (cmd, "OFSL%i", i);
sr844_CheckClear(dev);
gpibio_Out (dev, cmd);
}
break;
case SR844_CTRL_1MO50O:
if(event == EVENT_COMMIT)
{
GetCtrlVal (panel, control, &i);
Fmt (cmd, "INPZ%i", i);
sr844_CheckClear(dev);
gpibio_Out (dev, cmd);
}
break;
}
return 0;
}
示例12: chanfunc_CalcStatistics
static void chanfunc_CalcStatistics (channelPtr chan)
{
double mean, std_dev, variance, rms, moment, median, mode, min, max;
int err, order, min_i, max_i, intervals;
char newnote[256];
Fmt (chanfunc.note, "");
err = MaxMin1D (chan->readings, chan->pts, &max, &max_i, &min, &min_i);
SetInputMode (chanfunc.p, STATISTICS_MIN, !err);
SetCtrlVal (chanfunc.p, STATISTICS_MIN, min);
SetInputMode (chanfunc.p, STATISTICS_MAX, !err);
SetCtrlVal (chanfunc.p, STATISTICS_MAX, max);
if (err == NoErr)
{
Fmt (chanfunc.note, "%s<Min: %f[e2p5]\n", min);
Fmt (chanfunc.note, "%s[a]<Max: %f[e2p5]\n", max);
}
err = Mean (chan->readings, chan->pts, &mean);
SetInputMode (chanfunc.p, STATISTICS_MEAN, !err);
SetCtrlVal (chanfunc.p, STATISTICS_MEAN, mean);
if (err == NoErr) Fmt (chanfunc.note, "%s[a]<Mean: %f[e2p5]\n", mean);
err = StdDev (chan->readings, chan->pts, &mean, &std_dev);
SetInputMode (chanfunc.p, STATISTICS_STDDEV, !err);
SetCtrlVal (chanfunc.p, STATISTICS_STDDEV, std_dev);
if (err == NoErr) Fmt (chanfunc.note, "%s[a]<StdDev: %f[e2p5]\n", std_dev);
err = Variance (chan->readings, chan->pts, &mean, &variance);
SetInputMode (chanfunc.p, STATISTICS_VAR, !err);
SetCtrlVal (chanfunc.p, STATISTICS_VAR, variance);
if (err == NoErr) Fmt (chanfunc.note, "%s[a]<Variance: %f[e2p5]\n", variance);
err = RMS (chan->readings, chan->pts, &rms);
SetInputMode (chanfunc.p, STATISTICS_RMS, !err);
SetCtrlVal (chanfunc.p, STATISTICS_RMS, rms);
if (err == NoErr) Fmt (chanfunc.note, "%s[a]<RMS: %f[e2p5]\n", rms);
GetCtrlVal (chanfunc.p, STATISTICS_ORDER, &order);
err = Moment (chan->readings, chan->pts, order, &moment);
SetInputMode (chanfunc.p, STATISTICS_MOMENT, !err);
SetInputMode (chanfunc.p, STATISTICS_ORDER, !err);
SetCtrlVal (chanfunc.p, STATISTICS_MOMENT, moment);
if (err == NoErr) Fmt (chanfunc.note, "%s[a]<Moment: %f[e2p5] (order: %i)\n", moment, order);
err = Median (chan->readings, chan->pts, &median);
SetInputMode (chanfunc.p, STATISTICS_MEDIAN, !err);
SetCtrlVal (chanfunc.p, STATISTICS_MEDIAN, median);
if (err == NoErr) Fmt (chanfunc.note, "%s[a]<Median: %f[e2p5]\n", median);
GetCtrlVal (chanfunc.p, STATISTICS_INTERVAL, &intervals);
err = Mode (chan->readings, chan->pts, min, max, intervals, &mode);
SetInputMode (chanfunc.p, STATISTICS_INTERVAL, !err);
SetInputMode (chanfunc.p, STATISTICS_MODE, !err);
SetCtrlVal (chanfunc.p, STATISTICS_INTERVAL, intervals);
SetCtrlVal (chanfunc.p, STATISTICS_MODE, mode);
if (err == NoErr) Fmt (chanfunc.note, "%s[a]<Mode: %f[e2p5] (intervals: %i)\n", mode, intervals);
}
示例13: mouth_Error
int CVIFUNC mouth_Error (const char message[], dnaByte abortQ,
dnaByte forceErrorQ)
{
int status,err;
long count;
char mouthMessage[80]={0};
#if VERBOSE > 0
if (forceErrorQ) {
FmtOut ("%s\n", message);
Beep();
Breakpoint();
ScanIn ("%s", mouthMessage); // Wait for enter to be pressed
if (abortQ) abort();
return -1;
}
status = ThreadIbsta ();
if (status & ERR) { // ERR is defined in gpib.h
err=ThreadIberr();
count = ThreadIbcntl();
FmtOut ("%s\n", message);
FmtOut ("status %d error %d count %d\n", status,err,count);
FmtOut ("Library error so Abort always requested.\n");
FmtOut ("Reminder: Did you turn on the SRS? to GPIB ID #19?\n");
Beep();
Breakpoint();
ScanIn ("%s", mouthMessage); // Wait for enter to be pressed
if (abortQ) abort();
return -1;
}
#else
if (forceErrorQ) {
Beep();
MessagePopup ("Mouth Error", message);
Breakpoint();
if (abortQ) abort();
return -1;
}
status = ThreadIbsta ();
if (status & ERR) {
err=ThreadIberr();
count = ThreadIbcntl();
Fmt (mouthMessage, "%s<%s\n", message);
Fmt (mouthMessage, "%s[a]<status %d error %d count %d\n", status,err,count);
if (abortQ)
Fmt (mouthMessage, "%s[a]<Software Error and Abort has been requested.\n");
Fmt (mouthMessage, "%s[a]<Reminder: Did you turn on the SRS? to GPIB ID #19?\n");
Beep();
MessagePopup ("Mouth Error", mouthMessage);
Breakpoint();
// if (abortQ) abort();
return -1;
}
#endif
return 0;
}
示例14: acquire_DataFileMakePath
void acquire_DataFileMakePath (void)
{
char name[300], ext[10];
Fmt (ext, "%s<%f[p3]", (double)dataFile.ext/1000);
CopyBytes (ext, 0, ext, 1, 5);
Fmt(name, "%s<%s%s", dataFile.name, ext);
MakePathname(dataFile.dir, name, dataFile.path);
}
示例15: k2400_SetLevel
static void k2400_SetLevel (sourcePtr src)
{
char cmd[256];
gpibioPtr dev = src->acqchan->dev;
if(k2400_GetMode(dev))
Fmt(cmd, ":SOURce:CURRent:LEVel %f", src->biaslevel); /* trigger new source value */
else
Fmt(cmd, ":SOURce:VOLTage:LEVel %f", src->biaslevel);
k2400_Out (dev, cmd, .02);
util_Delay (src->segments[src->seg]->delay);
}