本文整理汇总了C++中process函数的典型用法代码示例。如果您正苦于以下问题:C++ process函数的具体用法?C++ process怎么用?C++ process使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了process函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: F847126
//.........这里部分代码省略.........
des2src(tSavdtl.bill_no,rPack->sphone); //票据号码
if(strlen(tSavdtl.bill_no)<1)
{
*pRetCode=E_INPUT_BILLNO;
goto L_RETU;
}
tSavdtl.card_no=tCard.card_id; //卡号
des2src(tSavdtl.oper_no,rPack->scust_limit); //操作员
tSavdtl.seqno=tradeserial.serial_no; //流水号
des2src(tSavdtl.tx_date,logicdate); //发生日期
des2src(tSavdtl.tx_time,systime); //发生时间
tSavdtl.cnt=1; //票据数量
tSavdtl.bill_type=type; //票据类型
tSavdtl.tx_code=tradeserial.serial_type; //交易码
ret=DB_t_tif_savdtl_add(&tSavdtl);
if(ret)
{
if(DB_REPEAT==ret)
*pRetCode = E_DB_SAVDTL_E;
else
*pRetCode = E_DB_SAVDTL_I;
goto L_RETU;
}
break;
default:
*pRetCode=E_TXCODE_NOT_EXIST;
goto L_RETU;
}
des2src(IA.sArrInActno[0],tAccount.account_id); //帐户
IA.iCardNo=tCard.card_id;
IA.iFeeType=tCustomer.fee_type;
//调用入账子模块
ret=process(&IA,&tradeserial);
if(ret)
{
*pRetCode=ret;
writelog(LOG_ERR,"process ret[%d]",ret);
goto L_RETU;
}
sprintf(out_pack->vsmess,"流水号:%d 卡号:%d ",IA.iSerialNo,IA.iCardNo);
for(i=1;i<=IA.iOutTxTypeCnt;i++)
{
switch(IA.iArrOutTxType[i])
{
case TXTYPE_TOLL_DEPOSIT:
case TXTYPE_TOLL_DEPOSIT_BILL:
case TXTYPE_TOLL_DEPOSIT_FUNDBOOK:
case TXTYPE_DEDUCT_DEPOSIT:
case TXTYPE_RETURN_DEPOSIT:
tradeserial.deposit_fee=IA.dArrOutAmt[i];
break;
case TXTYPE_PRE_TOLL_BOARD:
case TXTYPE_PRE_TOLL_BOARD_BILL:
case TXTYPE_PRE_TOLL_BOARD_FUNDBOOK:
case TXTYPE_TOLL_BOARD:
case TXTYPE_DEDUCT_BOARD:
case TXTYPE_RETURN_BOARD:
case TXTYPE_RETURN_BOARD_BILL:
case TXTYPE_RETURN_BOARD_FUNDBOOK:
tradeserial.boardfee=IA.dArrOutAmt[i];
break;
case TXTYPE_TOLL_CHARGE:
case TXTYPE_TOLL_CHARGE_BILL:
case TXTYPE_TOLL_CHARGE_FUNDBOOK:
tradeserial.in_fee=IA.dArrOutAmt[i];
开发者ID:nykma,项目名称:ykt4sungard,代码行数:67,代码来源:F847126.c
示例2: process
// returns true if there was new data
bool FileWatch::update()
{
process();
return data.size() > 0;
}
开发者ID:jgavert,项目名称:Unvoid,代码行数:6,代码来源:filewatch.cpp
示例3: process
void ui_menu_input::handle()
{
input_item_data *seqchangeditem = nullptr;
const ui_menu_event *menu_event;
int invalidate = false;
/* process the menu */
menu_event = process((pollingitem != nullptr) ? UI_MENU_PROCESS_NOKEYS : 0);
/* if we are polling, handle as a special case */
if (pollingitem != nullptr)
{
input_item_data *item = pollingitem;
/* if UI_CANCEL is pressed, abort */
if (ui_input_pressed(machine(), IPT_UI_CANCEL))
{
pollingitem = nullptr;
record_next = false;
toggle_none_default(item->seq, starting_seq, *item->defseq);
seqchangeditem = item;
}
/* poll again; if finished, update the sequence */
if (machine().input().seq_poll())
{
pollingitem = nullptr;
record_next = true;
item->seq = machine().input().seq_poll_final();
seqchangeditem = item;
}
}
/* otherwise, handle the events */
else if (menu_event != nullptr && menu_event->itemref != nullptr)
{
input_item_data *item = (input_item_data *)menu_event->itemref;
switch (menu_event->iptkey)
{
/* an item was selected: begin polling */
case IPT_UI_SELECT:
pollingitem = item;
last_sortorder = item->sortorder;
starting_seq = item->seq;
machine().input().seq_poll_start((item->type == INPUT_TYPE_ANALOG) ? ITEM_CLASS_ABSOLUTE : ITEM_CLASS_SWITCH, record_next ? &item->seq : nullptr);
invalidate = true;
break;
/* if the clear key was pressed, reset the selected item */
case IPT_UI_CLEAR:
toggle_none_default(item->seq, item->seq, *item->defseq);
record_next = false;
seqchangeditem = item;
break;
}
/* if the selection changed, reset the "record next" flag */
if (item->sortorder != last_sortorder)
record_next = false;
last_sortorder = item->sortorder;
}
/* if the sequence changed, update it */
if (seqchangeditem != nullptr)
{
update_input(seqchangeditem);
/* invalidate the menu to force an update */
invalidate = true;
}
/* if the menu is invalidated, clear it now */
if (invalidate)
{
pollingref = nullptr;
if (pollingitem != nullptr)
{
pollingref = pollingitem->ref;
pollingseq = pollingitem->seqtype;
}
reset(UI_MENU_RESET_REMEMBER_POSITION);
}
}
开发者ID:toughkidcst,项目名称:mame,代码行数:83,代码来源:inputmap.cpp
示例4: Process
Vector Process(const Vector &input) {
assert(input.rows() == numInputs);
NetworkContext ctx;
return process(input, ctx);
}
开发者ID:osushkov,项目名称:vectornn,代码行数:6,代码来源:Network.cpp
示例5: signalCompletion
void OscapScannerRemoteSsh::evaluate()
{
if (mDryRun)
{
signalCompletion(mCancelRequested);
return;
}
ensureConnected();
if (mCancelRequested)
{
signalCompletion(true);
return;
}
emit infoMessage(QObject::tr("Querying capabilities on remote machine..."));
{
SshSyncProcess proc(mSshConnection, this);
proc.setCommand(SCAP_WORKBENCH_REMOTE_OSCAP_PATH);
proc.setArguments(QStringList("--v"));
proc.setCancelRequestSource(&mCancelRequested);
proc.run();
if (proc.getExitCode() != 0)
{
emit errorMessage(
QObject::tr("Failed to query capabilities of oscap on local machine.\n"
"Diagnostic info:\n%1").arg(proc.getDiagnosticInfo())
);
mCancelRequested = true;
signalCompletion(mCancelRequested);
return;
}
mCapabilities.parse(proc.getStdOutContents());
}
if (!checkPrerequisites())
{
mCancelRequested = true;
signalCompletion(mCancelRequested);
return;
}
QStringList baseArgs;
baseArgs.append("-o"); baseArgs.append(QString("ControlPath=%1").arg(mSshConnection._getMasterSocket()));
baseArgs.append(mTarget);
QString diagnosticInfo;
emit infoMessage(QObject::tr("Copying input data to remote target..."));
const QString inputFile = copyInputFileOver();
const QString tailoringFile = mSession->hasTailoring() ?
copyFileOver(mSession->getTailoringFilePath()) : QString();
if (mCancelRequested)
{
signalCompletion(true);
return;
}
const QString reportFile = createRemoteTemporaryFile();
const QString resultFile = createRemoteTemporaryFile();
const QString arfFile = createRemoteTemporaryFile();
const QString workingDir = createRemoteTemporaryDirectory();
// TODO: We could be leaking any of the temporary files at this point!
if (mCancelRequested)
{
signalCompletion(true);
return;
}
QStringList args;
if (mScannerMode == SM_OFFLINE_REMEDIATION)
{
args = buildOfflineRemediationArgs(inputFile,
resultFile,
reportFile,
arfFile);
}
else
{
args = buildEvaluationArgs(inputFile,
tailoringFile,
resultFile,
reportFile,
arfFile,
mScannerMode == SM_SCAN_ONLINE_REMEDIATION);
}
const QString sshCmd = args.join(" ");
emit infoMessage(QObject::tr("Starting the remote process..."));
//.........这里部分代码省略.........
开发者ID:alexander-manley,项目名称:scap-workbench,代码行数:101,代码来源:OscapScannerRemoteSsh.cpp
示例6: F847104
//.........这里部分代码省略.........
*pRetCode = E_DB_ACCOUNT_U;
}
DB_t_aif_account_free_lock_c0();
ret = getNewUniqNo(KEYTYPE_TRADESERIAL,&dSerialNo); //获得最大流水号
if(ret)
{
*pRetCode=ret;
goto L_RETU;
}
tradeserial.serial_no=D2I(dSerialNo);
tradeserial.serial_type=TXCODE_CHANGE_CARD;
tradeserial.card_id=tCard.card_id; //新卡号
des2src(tradeserial.showid,tCard.showid); //显示卡号
strcpy(IA.sArrInActno[0],tAccount.account_id); //账号
IA.dArrInAmt[0]=tradeserial.trade_fee; //交易金额
IA.iUseCardFlag=USE_CARD_TYPE_ONLINE; //联机交易
IA.dInCardBala=tAccount.cur_freebala; //入卡值
IA.iTxCnt=1;
IA.iCardNo=tCard.card_id;
IA.iFeeType=tCustomer.fee_type;
IA.iArrInFeeSwitch[0]=rPack->lvol0;
IA.iArrInFeeSwitch[1]=rPack->lvol1;
IA.iArrInFeeSwitch[2]=rPack->lvol2;
IA.iArrInFeeSwitch[3]=rPack->lvol3;
IA.iArrInFeeSwitch[4]=rPack->lvol4;
IA.iArrInFeeSwitch[5]=rPack->lvol5;
IA.iArrInFeeSwitch[6]=rPack->lvol6;
IA.iArrInFeeSwitch[7]=rPack->lvol7;
IA.iArrInFeeSwitch[8]=rPack->lvol8;
IA.iArrInFeeSwitch[9]=rPack->lvol9;
IA.iArrInFeeSwitch[10]=rPack->lvol10;
ret=process(&IA,&tradeserial);
if(ret)
{
writelog(LOG_ERR,"process ret[%d]",ret);
*pRetCode=ret;
goto L_RETU;
}
sprintf(out_pack->vsmess,"流水号:%d 卡号:%d ",IA.iSerialNo,IA.iCardNo);
for(i=1;i<=IA.iOutTxTypeCnt;i++)
{
switch(IA.iArrOutTxType[i])
{
case TXTYPE_TOLL_DEPOSIT:
case TXTYPE_DEDUCT_DEPOSIT:
case TXTYPE_RETURN_DEPOSIT:
tradeserial.deposit_fee=IA.dArrOutAmt[i];
break;
case TXTYPE_PRE_TOLL_BOARD:
case TXTYPE_TOLL_BOARD:
case TXTYPE_DEDUCT_BOARD:
case TXTYPE_RETURN_BOARD:
tradeserial.boardfee=IA.dArrOutAmt[i];
break;
case TXTYPE_TOLL_CHARGE:
tradeserial.in_fee=IA.dArrOutAmt[i];
break;
case TXTYPE_TOLL_CARDCOST:
tradeserial.cost_fee=IA.dArrOutAmt[i];
break;
default:
break;
}
if(amtcmp(IA.dArrOutAmt[i],0)!=0)
开发者ID:nykma,项目名称:ykt4sungard,代码行数:67,代码来源:F847104.cpp
示例7:
BOOL CScriptEffector::Process (SPPInfo &pp)
{
return (!!process(&pp));
}
开发者ID:OLR-xray,项目名称:OLR-3.0,代码行数:4,代码来源:script_effector.cpp
示例8: process
void process(std::vector<Entity>& entities) {
for(Entity& e : entities) process(e);
}
开发者ID:respu,项目名称:microecs,代码行数:3,代码来源:ecs.hpp
示例9: main
int main(int argc, char* const* argv) {
pst_item *item = NULL;
pst_desc_tree *d_ptr;
char *temp = NULL; //temporary char pointer
int c;
char *d_log = NULL;
while ((c = getopt(argc, argv, "d:hV"))!= -1) {
switch (c) {
case 'd':
d_log = optarg;
break;
case 'h':
usage(argv[0]);
exit(0);
break;
case 'V':
version();
exit(0);
break;
default:
usage(argv[0]);
exit(1);
break;
}
}
#ifdef DEBUG_ALL
// force a log file
if (!d_log) d_log = "lspst.log";
#endif // defined DEBUG_ALL
DEBUG_INIT(d_log, NULL);
DEBUG_ENT("main");
if (argc <= optind) {
usage(argv[0]);
exit(2);
}
// Open PST file
if (pst_open(&pstfile, argv[optind], NULL)) DIE(("Error opening File\n"));
// Load PST index
if (pst_load_index(&pstfile)) DIE(("Index Error\n"));
pst_load_extended_attributes(&pstfile);
d_ptr = pstfile.d_head; // first record is main record
item = pst_parse_item(&pstfile, d_ptr, NULL);
if (!item || !item->message_store) {
DEBUG_RET();
DIE(("Could not get root record\n"));
}
// default the file_as to the same as the main filename if it doesn't exist
if (!item->file_as.str) {
if (!(temp = strrchr(argv[1], '/')))
if (!(temp = strrchr(argv[1], '\\')))
temp = argv[1];
else
temp++; // get past the "\\"
else
temp++; // get past the "/"
item->file_as.str = strdup(temp);
item->file_as.is_utf8 = 1;
}
d_ptr = pst_getTopOfFolders(&pstfile, item);
if (!d_ptr) DIE(("Top of folders record not found. Cannot continue\n"));
process(item, d_ptr->child); // do the childred of TOPF
pst_freeItem(item);
pst_close(&pstfile);
DEBUG_RET();
return 0;
}
开发者ID:mhorbul,项目名称:libpst,代码行数:77,代码来源:lspst.c
示例10: process
void process(pst_item *outeritem, pst_desc_tree *d_ptr)
{
struct file_ll ff;
pst_item *item = NULL;
char *result = NULL;
size_t resultlen = 0;
DEBUG_ENT("process");
memset(&ff, 0, sizeof(ff));
create_enter_dir(&ff, outeritem);
while (d_ptr) {
if (!d_ptr->desc) {
DEBUG_WARN(("ERROR item's desc record is NULL\n"));
ff.skip_count++;
}
else {
DEBUG_INFO(("Desc Email ID %"PRIx64" [d_ptr->d_id = %"PRIx64"]\n", d_ptr->desc->i_id, d_ptr->d_id));
item = pst_parse_item(&pstfile, d_ptr, NULL);
DEBUG_INFO(("About to process item @ %p.\n", item));
if (item) {
if (item->message_store) {
// there should only be one message_store, and we have already done it
DIE(("A second message_store has been found. Sorry, this must be an error.\n"));
}
if (item->folder && d_ptr->child) {
// if this is a folder, we want to recurse into it
pst_convert_utf8(item, &item->file_as);
printf("Folder \"%s\"\n", item->file_as.str);
process(item, d_ptr->child);
} else if (item->contact && (item->type == PST_TYPE_CONTACT)) {
if (!ff.type) ff.type = item->type;
// Process Contact item
if (ff.type != PST_TYPE_CONTACT) {
DEBUG_INFO(("I have a contact, but the folder isn't a contacts folder. Processing anyway\n"));
}
printf("Contact");
if (item->contact->fullname.str)
printf("\t%s", pst_rfc2426_escape(item->contact->fullname.str, &result, &resultlen));
printf("\n");
} else if (item->email && ((item->type == PST_TYPE_NOTE) || (item->type == PST_TYPE_SCHEDULE) || (item->type == PST_TYPE_REPORT))) {
if (!ff.type) ff.type = item->type;
// Process Email item
if ((ff.type != PST_TYPE_NOTE) && (ff.type != PST_TYPE_SCHEDULE) && (ff.type != PST_TYPE_REPORT)) {
DEBUG_INFO(("I have an email, but the folder isn't an email folder. Processing anyway\n"));
}
printf("Email");
if (item->email->outlook_sender_name.str)
printf("\tFrom: %s", item->email->outlook_sender_name.str);
if (item->subject.str)
printf("\tSubject: %s", item->subject.str);
printf("\n");
} else if (item->journal && (item->type == PST_TYPE_JOURNAL)) {
if (!ff.type) ff.type = item->type;
// Process Journal item
if (ff.type != PST_TYPE_JOURNAL) {
DEBUG_INFO(("I have a journal entry, but folder isn't specified as a journal type. Processing...\n"));
}
if (item->subject.str)
printf("Journal\t%s\n", pst_rfc2426_escape(item->subject.str, &result, &resultlen));
} else if (item->appointment && (item->type == PST_TYPE_APPOINTMENT)) {
char time_buffer[30];
if (!ff.type) ff.type = item->type;
// Process Calendar Appointment item
DEBUG_INFO(("Processing Appointment Entry\n"));
if (ff.type != PST_TYPE_APPOINTMENT) {
DEBUG_INFO(("I have an appointment, but folder isn't specified as an appointment type. Processing...\n"));
}
printf("Appointment");
if (item->subject.str)
printf("\tSUMMARY: %s", pst_rfc2426_escape(item->subject.str, &result, &resultlen));
if (item->appointment->start)
printf("\tSTART: %s", pst_rfc2445_datetime_format(item->appointment->start, sizeof(time_buffer), time_buffer));
if (item->appointment->end)
printf("\tEND: %s", pst_rfc2445_datetime_format(item->appointment->end, sizeof(time_buffer), time_buffer));
printf("\tALL DAY: %s", (item->appointment->all_day==1 ? "Yes" : "No"));
printf("\n");
} else {
ff.skip_count++;
DEBUG_INFO(("Unknown item type. %i. Ascii1=\"%s\"\n",
item->type, item->ascii_type));
}
pst_freeItem(item);
} else {
ff.skip_count++;
DEBUG_INFO(("A NULL item was seen\n"));
}
}
d_ptr = d_ptr->next;
}
close_enter_dir(&ff);
if (result) free(result);
DEBUG_RET();
//.........这里部分代码省略.........
开发者ID:mhorbul,项目名称:libpst,代码行数:101,代码来源:lspst.c
示例11: main
int
main(int argc, char *argv[])
{
int c, fflag;
char *temp_arg;
(void) setlocale(LC_ALL, "");
#ifndef TEXT_DOMAIN
#define TEXT_DOMAIN "SYS_TEST"
#endif
(void) textdomain(TEXT_DOMAIN);
fflag = 0;
inplace = NULL;
while ((c = getopt_long(argc, argv, "EI::ae:f:i::lnr", lopts, NULL)) !=
-1)
switch (c) {
case 'r': /* Gnu sed compat */
case 'E':
rflags = REG_EXTENDED;
break;
case 'I':
if (optarg != NULL)
inplace = optarg;
else
inplace = "";
ispan = 1; /* span across input files */
break;
case 'a':
aflag = 1;
break;
case 'e':
eflag = 1;
if (asprintf(&temp_arg, "%s\n", optarg) < 1)
err(1, "asprintf");
add_compunit(CU_STRING, temp_arg);
break;
case 'f':
fflag = 1;
add_compunit(CU_FILE, optarg);
break;
case 'i':
if (optarg != NULL)
inplace = optarg;
else
inplace = "";
ispan = 0; /* don't span across input files */
break;
case 'l':
/* On SunOS, setlinebuf "returns no useful value */
(void) setlinebuf(stdout);
break;
case 'n':
nflag = 1;
break;
default:
case '?':
usage();
}
argc -= optind;
argv += optind;
/* First usage case; script is the first arg */
if (!eflag && !fflag && *argv) {
add_compunit(CU_STRING, *argv);
argv++;
}
compile();
/* Continue with first and start second usage */
if (*argv)
for (; *argv; argv++)
add_file(*argv);
else
add_file(NULL);
process();
cfclose(prog, NULL);
if (fclose(stdout))
err(1, "stdout");
return (rval);
}
开发者ID:jasonbking,项目名称:illumos-gate,代码行数:84,代码来源:main.c
示例12: process
static int
process(const char *file)
{
char *cp;
int c;
char fname[BUFSIZ];
FILE *soee;
int isfile;
if (!strcmp(file, STDIN_NAME)) {
soee = stdin;
} else {
soee = fopen(file, "r");
if (soee == NULL) {
warn("%s", file);
return(-1);
}
}
for (;;) {
c = getc(soee);
if (c == EOF)
break;
if (c != '.')
goto simple;
c = getc(soee);
if (c != 's') {
putchar('.');
goto simple;
}
c = getc(soee);
if (c != 'o') {
printf(".s");
goto simple;
}
do
c = getc(soee);
while (c == ' ' || c == '\t');
cp = fname;
isfile = 0;
for (;;) {
switch (c) {
case ' ':
case '\t':
case '\n':
case EOF:
goto donename;
default:
*cp++ = c;
c = getc(soee);
isfile++;
continue;
}
}
donename:
if (cp == fname) {
printf(".so");
goto simple;
}
*cp = 0;
if (process(fname) < 0)
if (isfile)
printf(".so %s\n", fname);
continue;
simple:
if (c == EOF)
break;
putchar(c);
if (c != '\n') {
c = getc(soee);
goto simple;
}
}
if (soee != stdin) {
fclose(soee);
}
return(0);
}
开发者ID:AhmadTux,项目名称:DragonFlyBSD,代码行数:79,代码来源:soelim.c
示例13: DS2ASSERT
void Thread::updateState(DEBUG_EVENT const &de) {
DS2ASSERT(de.dwThreadId == _tid);
switch (de.dwDebugEventCode) {
case EXCEPTION_DEBUG_EVENT:
_state = kStopped;
_trap.event = StopInfo::kEventTrap;
_trap.reason = StopInfo::kReasonNone;
break;
case LOAD_DLL_DEBUG_EVENT: {
ErrorCode error;
std::wstring name = L"<NONAME>";
ProcessInfo pi;
error = process()->getInfo(pi);
if (error != kSuccess)
goto noname;
if (de.u.LoadDll.lpImageName == nullptr)
goto noname;
uint64_t ptr = 0;
error = process()->readMemory(
reinterpret_cast<uint64_t>(de.u.LoadDll.lpImageName), &ptr,
pi.pointerSize);
if (error != kSuccess)
goto noname;
if (ptr == 0)
goto noname;
// It seems like all strings passed by the kernel here are guaranteed to be
// unicode.
DS2ASSERT(de.u.LoadDll.fUnicode);
name.clear();
wchar_t c;
do {
error = process()->readMemory(ptr, &c, sizeof(c));
if (error != kSuccess)
break;
name.append(1, c);
ptr += sizeof(c);
} while (c != '\0');
noname:
DS2LOG(Debug, "new DLL loaded: %s",
Host::Platform::WideToNarrowString(name).c_str());
if (de.u.LoadDll.hFile != NULL)
CloseHandle(de.u.LoadDll.hFile);
}
case UNLOAD_DLL_DEBUG_EVENT:
case OUTPUT_DEBUG_STRING_EVENT:
_state = kStopped;
_trap.event = StopInfo::kEventNone;
_trap.reason = StopInfo::kReasonNone;
break;
default:
DS2BUG("unknown debug event code: %d", de.dwDebugEventCode);
}
}
开发者ID:tritao,项目名称:ds2,代码行数:66,代码来源:Thread.cpp
示例14: main
int main(int argc, const char * argv[])
{
const char * hex = "0123456789abcdef";
self = basename((char*)argv[0]);
for (int ai = 1; ai < argc; ai++) {
const char * src = argv[ai];
display_mode[ai] = NULL;
if (!strcmp(argv[ai], "--loop")) {
bus = 4;
msg[0].addr = 0x55;
msg_count = 1;
while (1) {
process();
sleep(1);
}
}
while (*src) {
char c = *src++;
switch (c) {
case '=': {
if (process() > 0)
display();
bus = 0;
while (isdigit(*src))
bus = (bus * 10) + (*src++ - '0');
} break;
case '@': {
if (process() > 0)
display();
address = 0;
while (isxdigit(*src))
address = (address << 4) | (int)(strchr(hex, tolower(*src++)) - hex);
// printf("Set address to 0x%2x\n", address);
} break;
case 'w': {
msg[msg_count].addr = address;
msg[msg_count].flags = 0;
msg[msg_count].len = 0;
msg[msg_count].buf = write_ptr;
while (isxdigit(src[0]) && isxdigit(src[1])) {
uint8_t byte = ((strchr(hex, tolower(src[0])) - hex) << 4) |
(int)(strchr(hex, tolower(src[1])) - hex);
src += 2;
*write_ptr++ = byte;
msg[msg_count].len++;
}
if (msg[msg_count].len) {
// printf("Write %d bytes : ", msg[msg_count].len);
// for (int i = 0; i < msg[msg_count].len; i++)
// printf("%02x", msg[msg_count].buf[i]);
// printf("\n");
msg_count++;
} else {
fprintf(stderr, "%s: Warning '%s' won't write anything\n", self, argv[ai]);
}
} break;
case 'r': {
msg[msg_count].addr = address;
msg[msg_count].flags = I2C_M_RD;
msg[msg_count].len = 0;
msg[msg_count].buf = write_ptr;
display_mode[msg_count] = src; // keep it around for display
int count = 0;
while (*src) {
switch (*src) {
case '0' ... '9' :
count = (count*10) + (*src++ - '0');
break;
case 'b':
count = count ? count : 1;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
src++;
break;
case 's':
count = count ? count * 2 : 2;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
src++;
break;
case 't': // temperature
count = 2;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
src++;
break;
case 'l':
count = count ? count * 4 : 4;
msg[msg_count].len += count;
write_ptr += count;
count = 0;
//.........这里部分代码省略.........
开发者ID:Xalior,项目名称:minifs,代码行数:101,代码来源:i2ctalk.c
示例15: main
//.........这里部分代码省略.........
exit(1);
else
flog(LOG_WARNING, "Insecure file permissions, but continuing anyway");
}
/* if we know how to do it, check whether forwarding is enabled */
if (check_ip6_forwarding()) {
if (get_debuglevel() == 0) {
flog(LOG_ERR, "IPv6 forwarding seems to be disabled, exiting");
exit(1);
}
else
flog(LOG_WARNING, "IPv6 forwarding seems to be disabled, but continuing anyway.");
}
#endif
/* parse config file */
if (readin_config(conf_file) < 0)
exit(1);
/* FIXME: not atomic if pidfile is on an NFS mounted volume */
if ((fd = open(pidfile, O_CREAT|O_EXCL|O_WRONLY, 0644)) < 0)
{
flog(LOG_ERR, "another radvd seems to be already running, terminating");
exit(1);
}
/*
* okay, config file is read in, socket and stuff is setup, so
* lets fork now...
*/
#if 0 //brcm
if (get_debuglevel() == 0) {
/* Detach from controlling terminal */
if (daemon(0, 0) < 0)
perror("daemon");
/* close old logfiles, including stderr */
log_close();
/* reopen logfiles, but don't log to stderr unless explicitly requested */
if (log_method == L_STDERR_SYSLOG)
log_method = L_SYSLOG;
if (log_open(log_method, pname, logfile, facility) < 0)
exit(1);
}
#endif
/*
* config signal handlers, also make sure ALRM isn't blocked and raise a warning if so
* (some stupid scripts/pppd appears to do this...)
*/
sigemptyset(&nset);
sigaddset(&nset, SIGALRM);
sigprocmask(SIG_UNBLOCK, &nset, &oset);
if (sigismember(&oset, SIGALRM))
flog(LOG_WARNING, "SIGALRM has been unblocked. Your startup environment might be wrong.");
signal(SIGHUP, sighup_handler);
signal(SIGTERM, sigterm_handler);
signal(SIGINT, sigint_handler);
snprintf(pidstr, sizeof(pidstr), "%d\n", getpid());
write(fd, pidstr, strlen(pidstr));
close(fd);
config_interface();
kickoff_adverts();
/* enter loop */
for (;;)
{
int len, hoplimit;
struct sockaddr_in6 rcv_addr;
struct in6_pktinfo *pkt_info = NULL;
len = recv_rs_ra(sock, msg, &rcv_addr, &pkt_info, &hoplimit);
if (len > 0)
process(sock, IfaceList, msg, len,
&rcv_addr, pkt_info, hoplimit);
if (sigterm_received || sigint_received) {
stop_adverts();
break;
}
if (sighup_received)
{
reload_config();
sighup_received = 0;
}
}
unlink(pidfile);
exit(0);
}
开发者ID:tch-opensrc,项目名称:TC72XX_LxG1.0.10mp5_OpenSrc,代码行数:101,代码来源:radvd.c
示例16: Q_Q
bool EventDispatcherEPollPrivate::processEvents(QEventLoop::ProcessEventsFlags flags)
{
Q_Q(EventDispatcherEPoll);
const bool exclude_notifiers = (flags & QEventLoop::ExcludeSocketNotifiers);
const bool exclude_timers = (flags & QEventLoop::X11ExcludeTimers);
exclude_notifiers && disableSocketNotifiers(true);
exclude_timers && disableTimers(true);
m_interrupt = false;
Q_EMIT q->awake();
bool result = q->hasPendingEvents();
QCoreApplication::sendPostedEvents();
bool can_wait =
!m_interrupt
&& (flags & QEventLoop::WaitForMoreEvents)
&& !result
;
int n_events = 0;
if (!m_interrupt) {
int timeout = 0;
if (!exclude_timers && !m_zero_timers.isEmpty()) {
QVector<ZeroTimer*> timers;
auto it = m_zero_timers.constBegin();
while (it != m_zero_timers.constEnd()) {
ZeroTimer *data = it.value();
data->ref();
timers.push_back(data);
++it;
}
for (ZeroTimer *data : timers) {
if (data->canProcess() && data->active) {
data->active = false;
QTimerEvent event(data->timerId);
QCoreApplication::sendEvent(data->object, &event);
result = true;
if (!data->active) {
data->active = true;
}
}
data->deref();
}
}
if (can_wait && !result) {
Q_EMIT q->aboutToBlock();
timeout = -1;
}
struct epoll_event events[10024];
do {
n_events = epoll_wait(m_epoll_fd, events, 10024, timeout);
} while (Q_UNLIKELY(-1 == n_events && errno == EINTR));
for (int i = 0; i < n_events; ++i) {
struct epoll_event &e = events[i];
auto data = static_cast<EpollAbastractEvent*>(e.data.ptr);
data->ref();
}
for (int i = 0; i < n_events; ++i) {
struct epoll_event &e = events[i];
auto data = static_cast<EpollAbastractEvent*>(e.data.ptr);
if (data->canProcess()) {
data->process(e.events);
}
data->deref();
}
}
exclude_notifiers && disableSocketNotifiers(false);
exclude_timers && disableTimers(false);
return result || n_events > 0;
}
开发者ID:cutelyst,项目名称:cutelyst,代码行数:87,代码来源:eventdispatcher_epoll_p.cpp
示例17: memset
//-----------------------------------------------------------------------------------------
void tf3Synth::processReplacing (eF32 **inputs, eF32 **outputs, long sampleFrames)
{
memset (outputs[0], 0, sampleFrames * sizeof (eF32));
memset (outputs[1], 0, sampleFrames * sizeof (eF32));
process (inputs, outputs, sampleFrames);
}
开发者ID:DX94,项目名称:Enigma-Studio-3,代码行数:7,代码来源:tf3synth.cpp
示例18: do_modify
//.........这里部分代码省略.........
mod = new ModifyDialog ( parent , nsigs , signals ) ;
if (mod->Execute() == IDOK) {
if (mod->parm_type == ID_PRED_CENTER) {
if (mod->parm_undo)
type = ID_PRED_UNDO_CENTER ;
else if (mod->parm_median)
type = ID_PRED_MEDIAN_CENTER ;
else
type = ID_PRED_CENTER ;
strcpy ( rest , mod->source_name ) ;
}
else if (mod->parm_type == ID_PRED_DETREND) {
if (mod->parm_undo)
type = ID_PRED_UNDO_DETREND ;
else
type = ID_PRED_DETREND ;
strcpy ( rest , mod->source_name ) ;
}
else if (mod->parm_type == ID_PRED_OFFSET) {
if (mod->parm_undo) {
type = ID_PRED_UNDO_OFFSET ;
strcpy ( rest , mod->source_name ) ;
}
else {
type = ID_PRED_OFFSET ;
sprintf ( rest , "%lf %s", mod->parm_offset, mod->source_name ) ;
}
}
else if (mod->parm_type == ID_PRED_SCALE) {
if (mod->parm_undo) {
type = ID_PRED_UNDO_SCALE ;
strcpy ( rest , mod->source_name ) ;
}
else {
type = ID_PRED_SCALE ;
sprintf ( rest , "%lf %s", mod->parm_scale, mod->source_name ) ;
}
}
else if (mod->parm_type == ID_PRED_STANDARDIZE) {
if (mod->parm_undo)
type = ID_PRED_UNDO_STANDARDIZE ;
else
type = ID_PRED_STANDARDIZE ;
strcpy ( rest , mod->source_name ) ;
}
else if (mod->parm_type == ID_PRED_DIFFERENCE) {
if (mod->parm_undo) {
type = ID_PRED_UNDO_DIFFERENCE ;
strcpy ( rest , mod->source_name ) ;
}
else {
type = ID_PRED_DIFFERENCE ;
sprintf ( rest , "%d %s", mod->parm_diff, mod->source_name ) ;
}
}
else if (mod->parm_type == ID_PRED_SEASONAL_DIFFERENCE) {
if (mod->parm_undo) {
type = ID_PRED_UNDO_SEASONAL_DIFFERENCE ;
strcpy ( rest , mod->source_name ) ;
}
else {
type = ID_PRED_SEASONAL_DIFFERENCE ;
sprintf ( rest , "%d %s", mod->parm_seasonal, mod->source_name ) ;
}
}
else if (mod->parm_type == ID_PRED_LOG) {
type = ID_PRED_LOG ;
strcpy ( rest , mod->source_name ) ;
}
else if (mod->parm_type == ID_PRED_EXP) {
type = ID_PRED_EXP ;
strcpy ( rest , mod->source_name ) ;
}
else if (mod->parm_type == ID_PRED_INTEGRATE) {
type = ID_PRED_INTEGRATE ;
sprintf ( rest , "%d %s", mod->parm_integrate, mod->source_name ) ;
}
if (mod->parm_undo && strlen ( mod->per_name )) {
strcat ( rest , " PER " ) ;
strcat ( rest , mod->per_name ) ;
}
if (process ( type , rest , NULL , error , NULL ) < 0 )
parent->MessageBox ( error , "ERROR" ) ;
}
delete mod ;
}
开发者ID:abishekahluwaila,项目名称:read,代码行数:101,代码来源:MODIFY.CPP
示例19: myswprintf
int SingleMode::SinglePlayThread(void* param) {
const wchar_t* name = mainGame->lstSinglePlayList->getListItem(mainGame->lstSinglePlayList->getSelected());
wchar_t fname[256];
myswprintf(fname, L"./single/%ls", name);
char fname2[256];
size_t slen = BufferIO::EncodeUTF8(fname, fname2);
mtrandom rnd;
time_t seed = time(0);
rnd.reset(seed);
set_card_reader((card_reader)DataManager::CardReader);
set_message_handler((message_handler)MessageHandler);
pduel = create_duel(rnd.rand());
set_player_info(pduel, 0, 8000, 5, 1);
set_player_info(pduel, 1, 8000, 5, 1);
mainGame->dInfo.lp[0] = 8000;
mainGame->dInfo.lp[1] = 8000;
myswprintf(mainGame->dInfo.strLP[0], L"%d", mainGame->dInfo.lp[0]);
myswprintf(mainGame->dInfo.strLP[1], L"%d", mainGame->dInfo.lp[1]);
BufferIO::CopyWStr(mainGame->ebNickName->getText(), mainGame->dInfo.hostname, 20);
mainGame->dInfo.clientname[0] = 0;
mainGame->dInfo.turn = 0;
mainGame->dInfo.strTurn[0] = 0;
if(!preload_script(pduel, fname2, slen)) {
end_duel(pduel);
return 0;
}
mainGame->gMutex.Lock();
mainGame->HideElement(mainGame->wSinglePlay);
mainGame->wCardImg->setVisible(true);
mainGame->wInfos->setVisible(true);
mainGame->btnLeaveGame->setVisible(true);
mainGame->btnLeaveGame->setText(dataManager.GetSysString(1210));
mainGame->stName->setText(L"");
mainGame->stInfo->setText(L"");
mainGame->stDataInfo->setText(L"");
mainGame->stText->setText(L"");
mainGame->scrCardText->setVisible(false);
mainGame->wPhase->setVisible(true);
mainGame->dField.panel = 0;
mainGame->dField.hovered_card = 0;
mainGame->dField.clicked_card = 0;
mainGame->dField.Clear();
mainGame->dInfo.isFirst = true;
mainGame->dInfo.isStarted = true;
mainGame->dInfo.isSingleMode = true;
mainGame->device->setEventReceiver(&mainGame->dField);
mainGame->gMutex.Unlock();
start_duel(pduel, 0);
char engineBuffer[0x1000];
is_closing = false;
is_continuing = true;
int len = 0;
while (is_continuing) {
int result = process(pduel);
len = result & 0xffff;
/* int flag = result >> 16; */
if (len > 0) {
get_message(pduel, (byte*)engineBuffer);
is_continuing = SinglePlayAnalyze(engineBuffer, len);
}
}
end_duel(pduel);
if(!is_closing) {
mainGame->gMutex.Lock();
mainGame->dInfo.isStarted = false;
mainGame->dInfo.isSingleMode = false;
mainGame->gMutex.Unlock();
mainGame->closeDoneSignal.Reset();
mainGame->closeSignal.Set();
mainGame->closeDoneSignal.Wait();
mainGame->gMutex.Lock();
mainGame->ShowElement(mainGame->wSinglePlay);
mainGame->device->setEventReceiver(&mainGame->menuHandler);
mainGame->gMutex.Unlock();
}
return 0;
}
开发者ID:jschlemm,项目名称:ygopro,代码行数:77,代码来源:single_mode.cpp
示例20: LOG
bool CHttpServer::run()
{
LOG(INFO) + "Start HTTP server";
if (!init())
return false;
m_active = true;
RHODESAPP().notifyLocalServerStarted();
for(;;)
{
RAWTRACE("Waiting for connections...");
#ifndef RHO_NO_RUBY_API
if (rho_ruby_is_started())
rho_ruby_start_threadidle();
#endif
fd_set readfds;
FD_ZERO(&readfds);
FD_SET(m_listener, &readfds);
timeval tv = {0,0};
unsigned long nTimeout = RHODESAPP().getTimer().getNextTimeout();
tv.tv_sec = nTimeout/1000;
tv.tv_usec = (nTimeout - tv.tv_sec*1000)*1000;
int ret = select(m_listener+1, &readfds, NULL, NULL, (tv.tv_sec == 0 && tv.tv_usec == 0 ? 0 : &tv) );
#ifndef RHO_NO_RUBY_API
if (rho_ruby_is_started())
rho_ruby_stop_threadidle();
#endif
bool bProcessed = false;
if (ret > 0)
{
if (FD_ISSET(m_listener, &readfds))
{
//RAWTRACE("Be
|
请发表评论