本文整理汇总了C++中DBG_PRINT函数的典型用法代码示例。如果您正苦于以下问题:C++ DBG_PRINT函数的具体用法?C++ DBG_PRINT怎么用?C++ DBG_PRINT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBG_PRINT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: card_detect_demo
void card_detect_demo(void)
{
INT8U err;
INT32U msg_id;
INT32S nRet;
card_detect_q = OSQCreate(card_detect_area, 1);
if (card_detect_q == NULL)
while(1);
card_detect_set_cf_callback(cf_card_plug_in_out);
card_detect_set_sdms_callback(sdms_card_plug_in_out);
card_detect_set_usb_h_callback(usb_h_plug_in_out);
card_detect_set_usb_d_callback(usb_d_plug_in_out);
card_detect_init(TYPE_CF|TYPE_SD|TYPE_MS|TYPE_USBH|TYPE_USBD|TYPE_NAND);
if(card_detection(C_CFC))
{
nRet = _devicemount(FS_CF);
if(!nRet)
DBG_PRINT("CF MOUNT Success\r\n");
else
DBG_PRINT("CF MOUNT Fail!!!\r\n");
}
if(card_detection(C_SDC))
{
nRet = _devicemount(FS_SD);
if(!nRet)
DBG_PRINT("SD MOUNT Success\r\n");
else
DBG_PRINT("SD MOUNT Fail!!!\r\n");
}
if(card_detection(C_MSC))
{
nRet = _devicemount(FS_MS);
if(!nRet)
DBG_PRINT("MS MOUNT Success\r\n");
else
DBG_PRINT("MS MOUNT Fail!!!\r\n");
}
if(card_detection(C_USBH))
{
nRet = _devicemount(FS_USBH);
if(!nRet)
DBG_PRINT("USB Host MOUNT Success\r\n");
else
DBG_PRINT("USB Host MOUNT Fail!!!\r\n");
}
if(card_detection(C_USBD))
{
DBG_PRINT("USBD plug in\r\n");
}
if(card_detection(C_NAND))
{
nRet = _devicemount(FS_NAND1);
if(!nRet)
DBG_PRINT("NAND1 MOUNT Success\r\n");
else
DBG_PRINT("NAND1 MOUNT Fail!!!\r\n");
}
if(card_detection(C_XDC))
{
nRet = _devicemount(FS_XD);
if(!nRet)
DBG_PRINT("XD MOUNT Success\r\n");
else
DBG_PRINT("XD MOUNT Fail!!!\r\n");
}
while(1)
{
msg_id = (INT32U) OSQPend(card_detect_q, 0, &err);
switch(msg_id)
{
case CF_PLUG_IN:
cfc_detection();
if(card_detection(C_CFC))
{
nRet = _devicemount(FS_CF);
if(!nRet)
DBG_PRINT("CF PLUG-IN & MOUNT-SUCCESS\r\n");
else
DBG_PRINT("CF PLUG-IN & MOUNT-FAIL!!!\r\n");
}
break;
case CF_PLUG_OUT:
disk_safe_exit(FS_CF);
nRet = _deviceunmount(FS_CF);
if(!nRet)
DBG_PRINT("CF PLUG-OUT & UN-MOUNT-SUCCESS\r\n");
else
DBG_PRINT("CF PLUG-OUT & UN-MOUNT-FAIL!!!\r\n");
break;
case SDMSXD_PLUG_IN:
sdms_detection();
if(card_detection(C_SDC))
{
nRet = _devicemount(FS_SD);
if(!nRet)
//.........这里部分代码省略.........
示例2: memset
UINT8 CClearDepotFunc::ClearDepot(string &strErr)
{
UINT8 ret = SUCCESS;
INT32 tmp, errorcode;
CSysArg cSysArg, *sysArg;
sysArg = &cSysArg;
INT8 sqlbuf[256];
string sqlstr = "";
// memset((void *)sqlbuf,0x00,sizeof(sqlbuf));
// sprintf(sqlbuf, "where SA_ID = %d", SYS_SERIAL_BAUDRATE);
// sysArg->m_filter.append(sqlbuf);
// sysArg->Requery();
// errorcode = sysArg->LoadOneRecord();
// DBG_PRINT(("errorcode= %d",errorcode));
// if (errorcode == SQLITE_OK)
// {
// memset((void *)sqlbuf,0x00,sizeof(sqlbuf));
// sprintf(sqlbuf, "update SYSARG set V_INT = %d where SA_ID = %d;\n",
// sysArg->m_vInt, SYS_SERIAL_BAUDRATE);
// sqlstr += sqlbuf;
// DBG_PRINT(("sqlstr = %s", sqlstr.c_str()));
// }
memset((void *)sqlbuf,0x00,sizeof(sqlbuf));
sprintf(sqlbuf, "where SA_ID = %d", SYS_ZS_PWD);
sysArg->m_filter.append(sqlbuf);
sysArg->Requery();
errorcode = sysArg->LoadOneRecord();
DBG_PRINT(("errorcode= %d",errorcode));
if (errorcode == SQLITE_OK)
{
memset((void *)sqlbuf,0x00,sizeof(sqlbuf));
sprintf(sqlbuf, "update SYSARG set V_TEXT = '%s' where SA_ID = %d;\n",
sysArg->m_vText.c_str(), SYS_ZS_PWD);
sqlstr += sqlbuf;
DBG_PRINT(("sqlstr = %s", sqlstr.c_str()));
}
memset((void *)sqlbuf,0x00,sizeof(sqlbuf));
sprintf(sqlbuf, "where SA_ID = %d", SYS_SKSB_PWD);
sysArg->m_filter.append(sqlbuf);
sysArg->Requery();
errorcode = sysArg->LoadOneRecord();
DBG_PRINT(("errorcode= %d",errorcode));
if (errorcode == SQLITE_OK)
{
memset((void *)sqlbuf,0x00,sizeof(sqlbuf));
sprintf(sqlbuf, "update SYSARG set V_TEXT = '%s' where SA_ID = %d;\n",
sysArg->m_vText.c_str(), SYS_SKSB_PWD);
sqlstr += sqlbuf;
DBG_PRINT(("sqlstr = %s", sqlstr.c_str()));
}
FILE *fp1;
if( (fp1=fopen(SAVEINFO_DIR,"w"))==NULL )
{
fclose(fp1);
strErr = "打开saveinfo.sql文件错误!";
DBG_PRINT((" 打开saveinfo.sql文件错误"));
return FAILURE;
}
INT32 nRealLen = sqlstr.length();
INT32 nLen = 0;
nLen = fwrite(sqlstr.c_str(),1, nRealLen,fp1);
if (nLen!=nRealLen)
{
fclose(fp1);
strErr = "写saveinfo.sql文件错误!";
DBG_PRINT((" 写saveinfo.sql文件错误"));
return FAILURE;
}
fclose(fp1);
//删除数据库文件
system(RM_CMD);
DBG_PRINT((" 删除数据库文件"));
//重建数据库
DBG_PRINT((" 重建数据库"));
string strCmd = SQL_CMD;
string strCmd2 = SAVEINFO_CMD;
DBG_PRINT((" strCmd = %s", strCmd.c_str()));
DBG_PRINT((" strCmd2 = %s", strCmd2.c_str()));
if ( system(strCmd.c_str()) != 0 )
{
strErr = "清库错误!";
return FAILURE;
}
if ( system(strCmd2.c_str()) != 0 )
{
strErr = "写保留信息错误";
return FAILURE;
}
DBG_PRINT((" 清库完成!请重新启动机器"));
return SUCCESS;
//.........这里部分代码省略.........
示例3: java
/*
* java: read java file and pickup tag entries.
*/
void
java(const struct parser_param *param)
{
int c;
int level; /* brace level */
int startclass, startthrows, startequal;
char classname[MAXTOKEN];
char completename[MAXCOMPLETENAME];
int classlevel;
struct {
char *classname;
char *terminate;
int level;
} stack[MAXCLASSSTACK];
const char *interested = "{}=;";
*classname = *completename = 0;
stack[0].classname = completename;
stack[0].terminate = completename;
stack[0].level = 0;
level = classlevel = 0;
startclass = startthrows = startequal = 0;
if (!opentoken(param->file))
die("'%s' cannot open.", param->file);
while ((c = nexttoken(interested, java_reserved_word)) != EOF) {
switch (c) {
case SYMBOL: /* symbol */
for (; c == SYMBOL && peekc(1) == '.'; c = nexttoken(interested, java_reserved_word)) {
PUT(PARSER_REF_SYM, token, lineno, sp);
}
if (c != SYMBOL)
break;
if (startclass || startthrows) {
PUT(PARSER_REF_SYM, token, lineno, sp);
} else if (peekc(0) == '('/* ) */) {
if (level == stack[classlevel].level && !startequal)
/* ignore constructor */
if (strcmp(stack[classlevel].classname, token))
PUT(PARSER_DEF, token, lineno, sp);
if (level > stack[classlevel].level || startequal)
PUT(PARSER_REF_SYM, token, lineno, sp);
} else {
PUT(PARSER_REF_SYM, token, lineno, sp);
}
break;
case '{': /* } */
DBG_PRINT(level, "{"); /* } */
++level;
if (startclass) {
char *p = stack[classlevel].terminate;
char *q = classname;
if (++classlevel >= MAXCLASSSTACK)
die("class stack over flow.[%s]", curfile);
if (classlevel > 1)
*p++ = '.';
stack[classlevel].classname = p;
while (*q)
*p++ = *q++;
stack[classlevel].terminate = p;
stack[classlevel].level = level;
*p++ = 0;
}
startclass = startthrows = 0;
break;
/* { */
case '}':
if (--level < 0) {
if (param->flags & PARSER_WARNING)
warning("missing left '{' (at %d).", lineno); /* } */
level = 0;
}
if (level < stack[classlevel].level)
*(stack[--classlevel].terminate) = 0;
/* { */
DBG_PRINT(level, "}");
break;
case '=':
startequal = 1;
break;
case ';':
startclass = startthrows = startequal = 0;
break;
case JAVA_CLASS:
case JAVA_INTERFACE:
case JAVA_ENUM:
if ((c = nexttoken(interested, java_reserved_word)) == SYMBOL) {
strlimcpy(classname, token, sizeof(classname));
startclass = 1;
PUT(PARSER_DEF, token, lineno, sp);
}
break;
case JAVA_NEW:
case JAVA_INSTANCEOF:
while ((c = nexttoken(interested, java_reserved_word)) == SYMBOL && peekc(1) == '.')
//.........这里部分代码省略.........
示例4: state_handling_init
void state_handling_init(void)
{
INT32S config_load_flag;
StateHandlingQ = OSQCreate(state_handling_q_stack, STATE_HANDLING_QUEUE_MAX);
ApQ = msgQCreate(AP_QUEUE_MAX, AP_QUEUE_MAX, AP_QUEUE_MSG_MAX_LEN);
nvmemory_init();
config_load_flag = ap_state_config_load();
ap_state_resource_init();
ap_state_config_initial(config_load_flag);
#if ENABLE_CHECK_RTC == 1
if (config_load_flag != STATUS_FAIL)
{
ap_state_config_data_time_check();
}
#endif
ap_state_handling_calendar_init();
ap_state_handling_storage_id_set(NO_STORAGE);
{
DISPLAY_ICONSHOW icon = {216, 144, TRANSPARENT_COLOR, 0, 0};
INT32U i, *buff_ptr, color_data, cnt;
INT32U display_frame0;
display_battery_low_frame0 = (INT32U) gp_malloc_align(icon.icon_w * icon.icon_h * 2, 64);
DBG_PRINT("batteryLow_display_buf_addr = 0x%x \r\n",display_frame0);
buff_ptr = (INT32U *) display_battery_low_frame0;
color_data = 0x8C71ul|(0x8C71ul<<16);
cnt = (icon.icon_w * icon.icon_h * 2) >> 2;
for (i=0 ; i<cnt ; i++) {
*buff_ptr++ = color_data;
}
DBG_PRINT("batteryLowshow! \r\n");
{
INT32U size, read_buf;
INT16U logo_fd;
INT8U *zip_buf;
INT32U icon_buffer;
logo_fd = nv_open((INT8U*)"INSERTSDC.GPZP");
if (logo_fd != 0xFFFF) {
size = nv_rs_size_get(logo_fd);
read_buf = (INT32S) gp_malloc(size);
if (!read_buf) {
DBG_PRINT("allocate BACKGROUND.GPZP read buffer fail.[%d]\r\n", size);
}
if (nv_read(logo_fd, (INT32U) read_buf, size)) {
DBG_PRINT("Failed to read icon_buffer resource\r\n");
gp_free((void *) read_buf);
}
zip_buf = (INT8U *)read_buf;
if (gpzp_decode((INT8U *) &zip_buf[4], (INT8U *) display_battery_low_frame0) == STATUS_FAIL) {
DBG_PRINT("Failed to unzip GPZP file\r\n");
gp_free((void *) read_buf);
gp_free((void *) icon_buffer);
read_buf = 0;
icon_buffer = 0;
}
gp_free((void *) read_buf);
}
}
}
DBG_PRINT("state_handling_init OK!\r\n");
}
示例5: mac_cmd_handler
void mac_cmd_handler(mac_cmd_t *cmd, mac_hdr_t *hdr)
{
buffer_t *buf_out;
mac_hdr_t hdr_out;
nwk_nib_t *nib = nwk_nib_get();
DBG_PRINT_SIMONLY("\n<INCOMING>");
debug_dump_mac_cmd(cmd);
switch (cmd->cmd_id)
{
case MAC_ASSOC_REQ:
if (nib->joined)
{
DBG_PRINT_SIMONLY("MAC: MAC Association Request Command Received.\n");
// check to make sure that association is permitted and the src address is the correct mode
if ((pib.assoc_permit) && (hdr->src_addr.mode == LONG_ADDR))
{
mac_assoc_ind_t assoc_args;
assoc_args.capability = cmd->assoc_req.cap_info;
memcpy(&assoc_args.dev_addr, &hdr->src_addr, sizeof(address_t));
mac_assoc_ind(&assoc_args);
}
else
{
mac_assoc_resp_t resp_args;
memcpy(&resp_args.dev_addr, &hdr->src_addr, sizeof(address_t));
resp_args.assoc_short_addr = 0xFFFF;
resp_args.status = MAC_INVALID_PARAMETER;
mac_assoc_resp(&resp_args);
}
}
break;
case MAC_ASSOC_RESP:
if ((pcb.mac_state == MLME_DATA_REQ) || (pcb.mac_state == MLME_ASSOC_REQ))
{
pcb.mac_state = MLME_IDLE;
}
mac_assoc_conf(cmd->assoc_resp.short_addr, cmd->assoc_resp.assoc_status);
break;
case MAC_DATA_REQ:
if (nib->joined)
{
DBG_PRINT("MAC: MAC Data Request Command Received.\n");
mac_indir_data_req_handler(&hdr->src_addr);
}
break;
case MAC_BEACON_REQ:
if (nib->joined)
{
DBG_PRINT("MAC: MAC Beacon Request Command Received.\n");
BUF_ALLOC(buf_out, TX);
mac_gen_beacon_frm(buf_out, &hdr_out);
mac_tx_handler(buf_out, &hdr_out.dest_addr, false, false, hdr_out.dsn, 0);
}
break;
case MAC_ORPHAN_NOT:
if (hdr->src_addr.mode == LONG_ADDR)
{
mac_orphan_ind(hdr->src_addr.long_addr);
}
break;
case MAC_COORD_REALIGN:
// check over the coord realign frame to make sure that the data is what we had previously
if ((cmd->coord_realign.pan_id == pib.pan_id) && (cmd->coord_realign.short_addr == pib.short_addr))
{
if ((pib.coord_addr.mode == SHORT_ADDR) && (cmd->coord_realign.coord_short_addr == pib.coord_addr.short_addr))
{
pcb.coor_realign_rcvd = true;
}
else if ((pib.coord_addr.mode == LONG_ADDR) && (hdr->src_addr.mode == LONG_ADDR) &&
(hdr->src_addr.long_addr == pib.coord_addr.long_addr))
{
pcb.coor_realign_rcvd = true;
}
else
{
return;
}
}
else
{
return;
}
// stop the scan once we get a valid coord realignment command frame
// the scan will end once the channel is beyond the channel range
pcb.curr_scan_channel = MAC_PHY_CHANNEL_OFFSET + MAC_MAX_CHANNELS;
ctimer_stop(&pcb.mlme_tmr);
mac_scan(NULL);
break;
default:
break;
}
}
示例6: rf_process
void rf_process()
{
struct rf_cmd cmd;
UINT32 val32;
UINT8 devId, hostId;
INT8 ret;
if(32 != rcvCmd(&cmd)){
return;
}
switch(cmd.cmd){
case KFISH_CMD_DISCOVER:
if(rf_mode_get() != SLAVE_MODE_WAIT_DISCOVER)
break;
memcpy(&val32, cmd.data, sizeof(UINT32));
if(val32 == 0xffffffff){
DBG_PRINT("devId full\n");
rf_mode_set(SLAVE_MODE_WAIT_DISCOVER);
return;
}
for(devId = 0; devId < 0x20; devId++){
if(((val32 >> devId) & 1) == 0)
break;
}
/* printk("rcv discover from 0x%x->%x \n", cmd.srcId, cmd.destId); */
/* printk("try devid 0x%x plane %d mode %d\n", devId, cmd.rfPlane, rf_mode_get()); */
/* printk("list 0x%lx\n", val32); */
rf_config(cmd.srcId, devId);
cmd.cmd = KFISH_CMD_DISCOVER_ACK;
val32 = val32 | (1 << devId);
memcpy(cmd.data, &val32, sizeof(UINT32));
sndCmd(&cmd);
rf_mode_set(SLAVE_MODE_DISCOVER_GET);
break;
case KFISH_CMD_DEVCONFIRM: /* 4Byte dev status, 1B controlNum */
if(rf_mode_get() != SLAVE_MODE_DISCOVER_GET)
break;
hostId = cmd.srcId;
devId = cmd.destId;
memcpy(&val32, cmd.data, sizeof(UINT32));
val32 |= (1 << devId);
memcpy(cmd.data, &val32, sizeof(UINT32));
cmd.data[4] = __local_ctrl_num; /* control number */
cmd.cmd = KFISH_CMD_DEVCONFIRM_ACK;
rf_mode_set(SLAVE_MODE_NORMAL);
sndCmd(&cmd);
printk("confirmed, use devId 0x%x\n", devId);
if(hostId != EEPROM_get(EEPROM_OFS_HOSTID)){
EEPROM_put(EEPROM_OFS_HOSTID, hostId);
}
if(devId != EEPROM_get(EEPROM_OFS_DEVID)){
EEPROM_put(EEPROM_OFS_RFPLANE, devId);
}
if(0xa9 != EEPROM_get(EEPROM_OFS_RFAVAIL)){
EEPROM_put(EEPROM_OFS_RFAVAIL, 0xa9);
}
break;
default:
ret = uartCmdLocalProcess(&cmd);
if(CMD_PROCESS_ACK == ret){
DBG_PRINT("<cmd 0x%x ctrl:%d data:%x %x %x\n",
cmd.cmd, cmd.ctrlId, cmd.data[0], cmd.data[1], cmd.data[2]
);
sndCmd(&cmd); /* 合法命令,发送应答 */
DBG_PRINT(">cmd 0x%x ctrl %d %x %x %x\n",
cmd.cmd, cmd.ctrlId, cmd.data[0], cmd.data[1], cmd.data[2]
);
}else if(CMD_PROCESS_NO_ACK == ret){ /* 合法命令,但是不用应答 */
}else{ /* 不合法的命令 */
DBG_PRINT("illegal command\n");
DBG_PRINT("\tcmd 0x%x ctrlId %d", cmd.cmd, cmd.ctrlId);
}
break;
}
}
示例7: DBG_START_METH
bool PDFullSpaceSolver::Solve(Number alpha,
Number beta,
const IteratesVector& rhs,
IteratesVector& res,
bool allow_inexact,
bool improve_solution /* = false */)
{
DBG_START_METH("PDFullSpaceSolver::Solve",dbg_verbosity);
DBG_ASSERT(!allow_inexact || !improve_solution);
DBG_ASSERT(!improve_solution || beta==0.);
// Timing of PDSystem solver starts here
IpData().TimingStats().PDSystemSolverTotal().Start();
DBG_PRINT_VECTOR(2, "rhs_x", *rhs.x());
DBG_PRINT_VECTOR(2, "rhs_s", *rhs.s());
DBG_PRINT_VECTOR(2, "rhs_c", *rhs.y_c());
DBG_PRINT_VECTOR(2, "rhs_d", *rhs.y_d());
DBG_PRINT_VECTOR(2, "rhs_zL", *rhs.z_L());
DBG_PRINT_VECTOR(2, "rhs_zU", *rhs.z_U());
DBG_PRINT_VECTOR(2, "rhs_vL", *rhs.v_L());
DBG_PRINT_VECTOR(2, "rhs_vU", *rhs.v_U());
DBG_PRINT_VECTOR(2, "res_x in", *res.x());
DBG_PRINT_VECTOR(2, "res_s in", *res.s());
DBG_PRINT_VECTOR(2, "res_c in", *res.y_c());
DBG_PRINT_VECTOR(2, "res_d in", *res.y_d());
DBG_PRINT_VECTOR(2, "res_zL in", *res.z_L());
DBG_PRINT_VECTOR(2, "res_zU in", *res.z_U());
DBG_PRINT_VECTOR(2, "res_vL in", *res.v_L());
DBG_PRINT_VECTOR(2, "res_vU in", *res.v_U());
// if beta is nonzero, keep a copy of the incoming values in res_ */
SmartPtr<IteratesVector> copy_res;
if (beta != 0.) {
copy_res = res.MakeNewIteratesVectorCopy();
}
// Receive data about matrix
SmartPtr<const Vector> x = IpData().curr()->x();
SmartPtr<const Vector> s = IpData().curr()->s();
SmartPtr<const SymMatrix> W = IpData().W();
SmartPtr<const Matrix> J_c = IpCq().curr_jac_c();
SmartPtr<const Matrix> J_d = IpCq().curr_jac_d();
SmartPtr<const Matrix> Px_L = IpNLP().Px_L();
SmartPtr<const Matrix> Px_U = IpNLP().Px_U();
SmartPtr<const Matrix> Pd_L = IpNLP().Pd_L();
SmartPtr<const Matrix> Pd_U = IpNLP().Pd_U();
SmartPtr<const Vector> z_L = IpData().curr()->z_L();
SmartPtr<const Vector> z_U = IpData().curr()->z_U();
SmartPtr<const Vector> v_L = IpData().curr()->v_L();
SmartPtr<const Vector> v_U = IpData().curr()->v_U();
SmartPtr<const Vector> slack_x_L = IpCq().curr_slack_x_L();
SmartPtr<const Vector> slack_x_U = IpCq().curr_slack_x_U();
SmartPtr<const Vector> slack_s_L = IpCq().curr_slack_s_L();
SmartPtr<const Vector> slack_s_U = IpCq().curr_slack_s_U();
SmartPtr<const Vector> sigma_x = IpCq().curr_sigma_x();
SmartPtr<const Vector> sigma_s = IpCq().curr_sigma_s();
DBG_PRINT_VECTOR(2, "Sigma_x", *sigma_x);
DBG_PRINT_VECTOR(2, "Sigma_s", *sigma_s);
bool done = false;
// The following flag is set to true, if we asked the linear
// solver to improve the quality of the solution in
// the next solve
bool resolve_with_better_quality = false;
// the following flag is set to true, if iterative refinement
// failed and we want to try if a modified system is able to
// remedy that problem by pretending the matrix is singular
bool pretend_singular = false;
bool pretend_singular_last_time = false;
// Beginning of loop for solving the system (including all
// modifications for the linear system to ensure good solution
// quality)
while (!done) {
// if improve_solution is true, we are given already a solution
// from the calling function, so we can skip the first solve
bool solve_retval = true;
if (!improve_solution) {
solve_retval =
SolveOnce(resolve_with_better_quality, pretend_singular,
*W, *J_c, *J_d, *Px_L, *Px_U, *Pd_L, *Pd_U, *z_L, *z_U,
*v_L, *v_U, *slack_x_L, *slack_x_U, *slack_s_L, *slack_s_U,
*sigma_x, *sigma_s, 1., 0., rhs, res);
resolve_with_better_quality = false;
pretend_singular = false;
}
improve_solution = false;
if (!solve_retval) {
// If system seems not to be solvable, we return with false
// and let the calling routine deal with it.
IpData().TimingStats().PDSystemSolverTotal().End();
return false;
}
if (allow_inexact) {
// no safety checks required
if (Jnlst().ProduceOutput(J_MOREDETAILED, J_LINEAR_ALGEBRA)) {
//.........这里部分代码省略.........
示例8: DBG_PRINT
INT32 CFpkj::XmlParse(XMLParse *parse, CInvHead *pInvInfo)
{
UINT8 i = 0;
parse->LocateNodeByName(parse->m_RootElement, "body");
parse->m_parentElement[1] = parse->m_Child;
parse->LocateNodeByName(parse->m_parentElement[1], "input");
parse->m_parentElement[2] = parse->m_Child;
parse->LocateNodeByName(parse->m_parentElement[2], "jqbh");
m_ywxml_gy.m_jqbh = parse->GetText(); //税控收款机编号
DBG_PRINT(("m_ywxml_gy.m_jqbh == %s", m_ywxml_gy.m_jqbh.c_str()));
pInvInfo->m_jqbh = m_ywxml_gy.m_jqbh;
DBG_PRINT(("pInvInfo->m_jqbh == %s", pInvInfo->m_jqbh.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "zskl");
pInvInfo->m_zskl = parse->GetText(); //证书口令
DBG_PRINT(("pInvInfo->m_zskl == %s", pInvInfo->m_zskl.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "xhdwdm");
m_ywxml_gy.m_nsrsbh = parse->GetText();
DBG_PRINT(("m_ywxml_gy.nsrsbh == %s", m_ywxml_gy.m_nsrsbh.c_str()));
pInvInfo->m_xfsh = parse->GetText();
DBG_PRINT(("pInvInfo->m_xfsh == %s", pInvInfo->m_xfsh.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "xhdwmc");
pInvInfo->m_xfmc = parse->GetText();
DBG_PRINT(("pInvInfo->m_xfmc == %s", pInvInfo->m_xfmc.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "sksbbh");
m_ywxml_gy.m_sksbbh = parse->GetText();
DBG_PRINT(("m_ywxml_gy.sksbbh == %s", m_ywxml_gy.m_sksbbh.c_str()));
pInvInfo->m_sksbbh = m_ywxml_gy.m_sksbbh;
DBG_PRINT(("pInvInfo->m_sksbbh == %s", pInvInfo->m_sksbbh.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "sksbkl");
m_ywxml_gy.m_sksbkl = parse->GetText();
DBG_PRINT(("m_ywxml_gy.sksbkl == %s", m_ywxml_gy.m_sksbkl.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "fplxdm");
m_ywxml_gy.m_fplxdm = parse->GetText();
pInvInfo->m_fplxdm = m_ywxml_gy.m_fplxdm;
DBG_PRINT(("m_ywxml_gy.fplxdm == %s", m_ywxml_gy.m_fplxdm.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "kplx");
pInvInfo->m_kplx = (UINT8)atoi(parse->GetText().c_str());
DBG_PRINT(("pInvInfo->m_kplx == %u", pInvInfo->m_kplx));
// parse->LocateNodeByName(parse->m_parentElement[2], "hyfl");
// pInvInfo->m_hyfl = parse->GetText();
// DBG_PRINT(("hyfl== %s", pInvInfo->m_hyfl.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "ghdwdm");
pInvInfo->m_payerCode = parse->GetText();
CJSKMakeInvoice::FilterSpace(pInvInfo->m_payerCode);
if(pInvInfo->m_payerCode == "")
pInvInfo->m_payerCode = "000000000000000";
DBG_PRINT(("pInvInfo->m_payerCode == %s", pInvInfo->m_payerCode.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "ghdwmc");
pInvInfo->m_fkdw = parse->GetText();
CJSKMakeInvoice::FilterSpace(pInvInfo->m_fkdw);
DBG_PRINT(("pInvInfo->m_fkdw == %s", pInvInfo->m_fkdw.c_str()));
parse->LocateNodeByName(parse->m_parentElement[2], "sfxm");
parse->m_parentElement[3] = parse->m_Child;
pInvInfo->m_sphsl = atoi(parse->GetAttr("count").c_str()); //解析XML后得到商品明细行数
DBG_PRINT(("pInvInfo->m_sphsl == %u", pInvInfo->m_sphsl));
CInvDet* pInvDet = NULL;
for (i=0; i<pInvInfo->m_sphsl; i++)
{
pInvDet = pInvDet->GetNewInvDet(); //从静态数组获取一个可用的CInvDet对象
DBG_ASSERT_EXIT((pInvDet != NULL), (" pInvDet == NULL!"));
pInvDet->m_sphxh = i+1;
//得到group节点
parse->LocateNodeByName(parse->m_parentElement[3], "group", i);
parse->m_parentElement[4] = parse->m_Child;
parse->LocateNodeByName(parse->m_parentElement[4], "xm");
pInvDet->m_spmc = parse->GetText();
CJSKMakeInvoice::FilterSpace(pInvDet->m_spmc);
DBG_PRINT(("pInvDet->m_spmc == %s", pInvDet->m_spmc.c_str()));
parse->LocateNodeByName(parse->m_parentElement[4], "dj");
pInvDet->m_dj = atof(parse->GetText().c_str());
DBG_PRINT(("pInvDet->m_dj == %lf", pInvDet->m_dj));
parse->LocateNodeByName(parse->m_parentElement[4], "sl");
pInvDet->m_spsl = atof(parse->GetText().c_str());
DBG_PRINT(("pInvDet->m_spsl == %lf", pInvDet->m_spsl));
parse->LocateNodeByName(parse->m_parentElement[4], "je");
pInvDet->m_je =double2int(atof(parse->GetText().c_str())*SUM_EXTENSION);
//.........这里部分代码省略.........
示例9: RootWindow
/*
* Class: jogamp_nativewindow_x11_X11Lib
* Method: CreateWindow
* Signature: (JJIIIIZZ)J
*/
JNIEXPORT jlong JNICALL Java_jogamp_nativewindow_x11_X11Lib_CreateWindow
(JNIEnv *env, jclass unused, jlong parent, jlong display, jint screen_index, jint visualID, jint width, jint height, jboolean input, jboolean visible)
{
Display * dpy = (Display *)(intptr_t)display;
int scrn_idx = (int)screen_index;
Window root = RootWindow(dpy, scrn_idx);
Window windowParent = (Window) parent;
Window window = 0;
XVisualInfo visualTemplate;
XVisualInfo *pVisualQuery = NULL;
Visual *visual = NULL;
int depth;
XSetWindowAttributes xswa;
unsigned long attrMask;
int n;
Screen* scrn;
if(NULL==dpy) {
NativewindowCommon_FatalError(env, "invalid display connection..");
return 0;
}
if(visualID<0) {
NativewindowCommon_throwNewRuntimeException(env, "invalid VisualID ..");
return 0;
}
NativewindowCommon_x11ErrorHandlerEnable(env, dpy, 0, 1, errorHandlerQuiet, 0);
scrn = ScreenOfDisplay(dpy, scrn_idx);
if(0==windowParent) {
windowParent = root;
}
// try given VisualID on screen
memset(&visualTemplate, 0, sizeof(XVisualInfo));
visualTemplate.screen = scrn_idx;
visualTemplate.visualid = (VisualID)visualID;
pVisualQuery = XGetVisualInfo(dpy, VisualIDMask|VisualScreenMask, &visualTemplate,&n);
if(pVisualQuery!=NULL) {
visual = pVisualQuery->visual;
depth = pVisualQuery->depth;
visualID = (jint)pVisualQuery->visualid;
XFree(pVisualQuery);
pVisualQuery=NULL;
}
DBG_PRINT( "X11: [CreateWindow] trying given (dpy %p, screen %d, visualID: %d, parent %p) found: %p\n", dpy, scrn_idx, (int)visualID, windowParent, visual);
if (visual==NULL)
{
// NativewindowCommon_x11ErrorHandlerEnable(env, dpy, 0, 0, errorHandlerQuiet, 1);
NativewindowCommon_throwNewRuntimeException(env, "could not query Visual by given VisualID, bail out!");
return 0;
}
if(pVisualQuery!=NULL) {
XFree(pVisualQuery);
pVisualQuery=NULL;
}
attrMask = ( CWBackingStore | CWBackingPlanes | CWBackingPixel | CWBackPixmap |
CWBorderPixel | CWColormap | CWOverrideRedirect ) ;
memset(&xswa, 0, sizeof(xswa));
xswa.override_redirect = False; // use the window manager, always
xswa.border_pixel = 0;
xswa.background_pixmap = None;
xswa.backing_store=NotUseful; /* NotUseful, WhenMapped, Always */
xswa.backing_planes=0; /* planes to be preserved if possible */
xswa.backing_pixel=0; /* value to use in restoring planes */
if( input ) {
xswa.event_mask = X11_MOUSE_EVENT_MASK;
xswa.event_mask |= KeyPressMask | KeyReleaseMask ;
}
if( visible ) {
xswa.event_mask |= FocusChangeMask | SubstructureNotifyMask | StructureNotifyMask | ExposureMask ;
}
xswa.colormap = XCreateColormap(dpy,
windowParent,
visual,
AllocNone);
window = XCreateWindow(dpy,
windowParent,
0, 0, // only a hint, WM most likely will override
width, height,
0, // border width
depth,
InputOutput,
visual,
//.........这里部分代码省略.........
示例10: DBG_START_METH
bool StdStepCalculator::Step(DenseVector& delta_u,
IteratesVector& sol)
{
DBG_START_METH("StdStepCalculator::Step", dbg_verbosity);
bool retval = false;
SmartPtr<IteratesVector> delta_u_long = IpData().trial()->MakeNewIteratesVector();
ift_data_->TransMultiply(delta_u, *delta_u_long);
SmartPtr<IteratesVector> r_s = IpData().trial()->MakeNewIteratesVector();
if (kkt_residuals_) {
/* This should be almost zero... */
r_s->Set_x_NonConst(*IpCq().curr_grad_lag_x()->MakeNewCopy());
r_s->Set_s_NonConst(*IpCq().curr_grad_lag_s()->MakeNewCopy());
r_s->Set_y_c_NonConst(*IpCq().curr_c()->MakeNewCopy());
r_s->Set_y_d_NonConst(*IpCq().curr_d_minus_s()->MakeNewCopy());
r_s->Set_z_L_NonConst(*IpCq().curr_compl_x_L()->MakeNewCopy());
r_s->Set_z_U_NonConst(*IpCq().curr_compl_x_U()->MakeNewCopy());
r_s->Set_v_L_NonConst(*IpCq().curr_compl_s_L()->MakeNewCopy());
r_s->Set_v_U_NonConst(*IpCq().curr_compl_s_U()->MakeNewCopy());
r_s->Print(Jnlst(),J_VECTOR,J_USER1,"r_s init");
delta_u.Print(Jnlst(),J_VECTOR,J_USER1,"delta_u init");
DBG_PRINT((dbg_verbosity,"r_s init Nrm2=%23.16e\n", r_s->Asum()));
delta_u_long->Axpy(-1.0, *r_s);
}
backsolver_->Solve(&sol, ConstPtr(delta_u_long));
SmartPtr<IteratesVector> Kr_s;
if (Do_Boundcheck()) {
Kr_s = sol.MakeNewIteratesVectorCopy();
}
sol.Axpy(1.0, *IpData().trial());
if (Do_Boundcheck()) {
DBG_PRINT((dbg_verbosity, "Entering boundcheck"));
// initialize
Index new_du_size =0;
Number* new_du_values;
std::vector<Index> x_bound_violations_idx;
std::vector<Number> x_bound_violations_du;
std::vector<Index> delta_u_sort;
bool bounds_violated;
SmartPtr<DenseVectorSpace> delta_u_space = new DenseVectorSpace(0);
SmartPtr<DenseVector> old_delta_u = new DenseVector(GetRawPtr(delta_u_space));
SmartPtr<DenseVector> new_delta_u;
bounds_violated = BoundCheck(sol, x_bound_violations_idx, x_bound_violations_du);
while (bounds_violated) {
Driver()->data_A()->Print(Jnlst(),J_VECTOR,J_USER1,"data_A_init");
Driver()->data_B()->Print(Jnlst(),J_VECTOR,J_USER1,"data_B_init");
// write new schurdata A
dynamic_cast<IndexSchurData*>(GetRawPtr(Driver()->data_A_nonconst()))->AddData_List(x_bound_violations_idx, delta_u_sort, new_du_size, 1);
// write new schurdata B
dynamic_cast<IndexSchurData*>(GetRawPtr(Driver()->data_B_nonconst()))->AddData_List(x_bound_violations_idx, delta_u_sort, new_du_size, 1);
Driver()->data_A()->Print(Jnlst(),J_VECTOR,J_USER1,"data_A");
Driver()->data_B()->Print(Jnlst(),J_VECTOR,J_USER1,"data_B");
Driver()->SchurBuild();
Driver()->SchurFactorize();
old_delta_u->Print(Jnlst(),J_VECTOR,J_USER1,"old_delta_u");
delta_u_space = NULL; // delete old delta_u space
delta_u_space = new DenseVectorSpace(new_du_size); // create new delta_u space
new_delta_u = new DenseVector(GetRawPtr(ConstPtr(delta_u_space)));
new_du_values = new_delta_u->Values();
IpBlasDcopy(old_delta_u->Dim(), old_delta_u->Values(), 1, new_du_values, 1);
for (UINT i=0; i<x_bound_violations_idx.size(); ++i) {
// printf("i=%d, delta_u_sort[i]=%d, x_bound_viol_du[i]=%f\n", i, delta_u_sort[i], x_bound_violations_du[i]);
new_du_values[delta_u_sort[i]] = x_bound_violations_du[i];
}
SmartPtr<IteratesVector> new_sol = sol.MakeNewIteratesVector();
new_delta_u->Print(Jnlst(),J_VECTOR,J_USER1,"new_delta_u");
// solve with new data_B and delta_u
retval = Driver()->SchurSolve(&sol, ConstPtr(delta_u_long), dynamic_cast<Vector*>(GetRawPtr(new_delta_u)), Kr_s);
sol.Axpy(1.0, *IpData().trial());
x_bound_violations_idx.clear();
x_bound_violations_du.clear();
delta_u_sort.clear();
bounds_violated = BoundCheck(sol, x_bound_violations_idx, x_bound_violations_du);
// copy new vector in old vector ->has to be done becpause otherwise only pointers will be copied and then it makes no sense
old_delta_u = new_delta_u->MakeNewDenseVector();
old_delta_u->Copy(*new_delta_u);
}
}
return retval;
}
示例11: C_family
/**
* @param[in] param source file
* @param[in] type #TYPE_C, #TYPE_YACC, #TYPE_LEX
*/
static void
C_family(const struct parser_param *param, int type)
{
int c, cc;
int savelevel;
int startmacro, startsharp;
const char *interested = "{}=;";
STRBUF *sb = strbuf_open(0);
/*
* yacc file format is like the following.
*
* declarations
* %%
* rules
* %%
* programs
*
*/
int yaccstatus = (type == TYPE_YACC) ? DECLARATIONS : PROGRAMS;
int inC = (type == TYPE_YACC) ? 0 : 1; /* 1 while C source */
level = piflevel = externclevel = 0;
savelevel = -1;
startmacro = startsharp = 0;
if (!opentoken(param->file))
die("'%s' cannot open.", param->file);
cmode = 1; /* allow token like '#xxx' */
crflag = 1; /* require '\n' as a token */
if (type == TYPE_YACC)
ymode = 1; /* allow token like '%xxx' */
while ((cc = nexttoken(interested, c_reserved_word)) != EOF) {
switch (cc) {
case SYMBOL: /* symbol */
if (inC && peekc(0) == '('/* ) */) {
if (param->isnotfunction(token)) {
PUT(PARSER_REF_SYM, token, lineno, sp);
} else if (level > 0 || startmacro) {
PUT(PARSER_REF_SYM, token, lineno, sp);
} else if (level == 0 && !startmacro && !startsharp) {
char arg1[MAXTOKEN], savetok[MAXTOKEN], *saveline;
int savelineno = lineno;
strlimcpy(savetok, token, sizeof(savetok));
strbuf_reset(sb);
strbuf_puts(sb, sp);
saveline = strbuf_value(sb);
arg1[0] = '\0';
/*
* Guile function entry using guile-snarf is like follows:
*
* SCM_DEFINE (scm_list, "list", 0, 0, 1,
* (SCM objs),
* "Return a list containing OBJS, the arguments to `list'.")
* #define FUNC_NAME s_scm_list
* {
* return objs;
* }
* #undef FUNC_NAME
*
* We should assume the first argument as a function name instead of 'SCM_DEFINE'.
*/
if (function_definition(param, arg1)) {
if (!strcmp(savetok, "SCM_DEFINE") && *arg1)
strlimcpy(savetok, arg1, sizeof(savetok));
PUT(PARSER_DEF, savetok, savelineno, saveline);
} else {
PUT(PARSER_REF_SYM, savetok, savelineno, saveline);
}
}
} else {
PUT(PARSER_REF_SYM, token, lineno, sp);
}
break;
case '{': /* } */
DBG_PRINT(level, "{"); /* } */
if (yaccstatus == RULES && level == 0)
inC = 1;
++level;
if ((param->flags & PARSER_BEGIN_BLOCK) && atfirst) {
if ((param->flags & PARSER_WARNING) && level != 1)
warning("forced level 1 block start by '{' at column 0 [+%d %s].", lineno, curfile); /* } */
level = 1;
}
break;
/* { */
case '}':
if (--level < 0) {
if (externclevel > 0)
externclevel--;
else if (param->flags & PARSER_WARNING)
warning("missing left '{' [+%d %s].", lineno, curfile); /* } */
level = 0;
}
if ((param->flags & PARSER_END_BLOCK) && atfirst) {
//.........这里部分代码省略.........
示例12: DBG_START_METH
Index TripletToCSRConverter::InitializeConverter(Index dim, Index nonzeros,
const Index* airn,
const Index* ajcn)
{
DBG_START_METH("TSymLinearSolver::InitializeStructure",
dbg_verbosity);
DBG_ASSERT(dim>0);
DBG_ASSERT(nonzeros>0);
delete[] ia_;
delete[] ja_;
delete[] ipos_first_;
delete[] ipos_double_triplet_;
delete[] ipos_double_compressed_;
dim_ = dim;
nonzeros_triplet_ = nonzeros;
// Create a list with all triplet entries
std::list<TripletEntry> entry_list(nonzeros);
std::list<TripletEntry>::iterator list_iterator = entry_list.begin();
for (Index i=0; i<nonzeros; i++) {
list_iterator->Set(airn[i], ajcn[i], i);
list_iterator++;
}
DBG_ASSERT(list_iterator == entry_list.end());
if (DBG_VERBOSITY()>=2) {
for (Index i=0; i<nonzeros; i++) {
DBG_PRINT((2, "airn[%5d] = %5d acjn[%5d] = %5d\n", i, airn[i], i, ajcn[i]));
}
}
// sort the list
entry_list.sort();
// Now got through the list and compute ipos_ arrays and the
// number of elements in the compressed format
Index* ja_tmp = new Index[nonzeros]; // overestimate memory requirement
Index* rc_tmp = NULL;
if (hf_ == Full_Format) {
rc_tmp = new Index[dim_+1];
}
ia_ = new Index[dim_+1];
Index* ipos_first_tmp = new Index[nonzeros]; // overestimate memory requirement
Index* ipos_double_triplet_tmp = new Index[nonzeros]; // overestimate memory requirement
Index* ipos_double_compressed_tmp = new Index[nonzeros]; // overestimate memory requirement
Index nonzeros_compressed_full = 0;
nonzeros_compressed_ = 0;
Index cur_row = 1;
if (hf_ == Full_Format) {
// Zero row counts
for (Index i=0; i<dim_+1; i++) {
rc_tmp[i] = 0;
}
}
// Take care of possible emply rows
list_iterator = entry_list.begin();
while (cur_row < list_iterator->IRow()) {
ia_[cur_row-1] = 0;
cur_row++;
}
ia_[cur_row-1] = 0;
ja_tmp[0] = list_iterator->JCol();
ipos_first_tmp[0] = list_iterator->PosTriplet();
if (hf_ == Full_Format) {
// Count in both lower and upper triangles. Count diagonal only once.
nonzeros_compressed_full++;
rc_tmp[cur_row-1]++;
if (cur_row!=list_iterator->JCol()) {
nonzeros_compressed_full++;
rc_tmp[list_iterator->JCol()-1]++;
}
}
list_iterator++;
Index idouble = 0;
Index idouble_full = 0;
while (list_iterator != entry_list.end()) {
Index irow = list_iterator->IRow();
Index jcol = list_iterator->JCol();
if (cur_row == irow && ja_tmp[nonzeros_compressed_] == jcol) {
// This element appears repeatedly, add to the double list
ipos_double_triplet_tmp[idouble] = list_iterator->PosTriplet();
ipos_double_compressed_tmp[idouble] = nonzeros_compressed_;
idouble++;
idouble_full++;
if (hf_==Full_Format && irow!=jcol) {
idouble_full++;
}
}
else {
// This is a new element
if (hf_==Full_Format) {
// Count in both lower and upper triangles. Count diagonal only once.
nonzeros_compressed_full++;
//.........这里部分代码省略.........
示例13: get_lcd_extern_dt_data
int get_lcd_extern_dt_data(struct device_node* of_node, struct lcd_extern_config_t *pdata)
{
int err;
int val;
const char *str;
err = of_property_read_string(of_node, "dev_name", &str);
if (err) {
str = "aml_lcd_extern";
printk("warning: get dev_name failed\n");
}
pdata->name = (char *)kmalloc(sizeof(char)*BL_EXT_NAME_LEN_MAX, GFP_KERNEL);
if (pdata->name == NULL) {
printk("[get_lcd_extern_dt_data]: Not enough memory\n");
}
else {
memset(pdata->name, 0, BL_EXT_NAME_LEN_MAX);
strcpy(pdata->name, str);
printk("load bl_extern in dtb: %s\n", pdata->name);
}
err = of_property_read_u32(of_node, "type", &pdata->type);
if (err) {
pdata->type = LCD_EXTERN_MAX;
printk("warning: get type failed, exit\n");
return -1;
}
switch (pdata->type) {
case LCD_EXTERN_I2C:
err = of_property_read_u32(of_node,"i2c_address",&pdata->i2c_addr);
if (err) {
printk("%s warning: get i2c_address failed\n", pdata->name);
pdata->i2c_addr = 0;
}
DBG_PRINT("%s: i2c_address=0x%02x\n", pdata->name, pdata->i2c_addr);
err = of_property_read_string(of_node, "i2c_bus", &str);
if (err) {
printk("%s warning: get i2c_bus failed, use default i2c bus\n", pdata->name);
pdata->i2c_bus = AML_I2C_MASTER_A;
}
else {
if (strncmp(str, "i2c_bus_a", 9) == 0)
pdata->i2c_bus = AML_I2C_MASTER_A;
else if (strncmp(str, "i2c_bus_b", 9) == 0)
pdata->i2c_bus = AML_I2C_MASTER_B;
else if (strncmp(str, "i2c_bus_c", 9) == 0)
pdata->i2c_bus = AML_I2C_MASTER_C;
else if (strncmp(str, "i2c_bus_d", 9) == 0)
pdata->i2c_bus = AML_I2C_MASTER_D;
else if (strncmp(str, "i2c_bus_ao", 10) == 0)
pdata->i2c_bus = AML_I2C_MASTER_AO;
else
pdata->i2c_bus = AML_I2C_MASTER_A;
}
DBG_PRINT("%s: i2c_bus=%s[%d]\n", pdata->name, str, pdata->i2c_bus);
break;
case LCD_EXTERN_SPI:
err = of_property_read_string(of_node,"gpio_spi_cs", &str);
if (err) {
printk("%s warning: get spi gpio_spi_cs failed\n", pdata->name);
pdata->spi_cs = -1;
}
else {
val = amlogic_gpio_name_map_num(str);
if (val > 0) {
err = lcd_extern_gpio_request(val);
if (err) {
printk("faild to alloc spi_cs gpio (%s)!\n", str);
}
pdata->spi_cs = val;
DBG_PRINT("spi_cs gpio = %s(%d)\n", str, pdata->spi_cs);
}
else {
pdata->spi_cs = -1;
}
}
err = of_property_read_string(of_node,"gpio_spi_clk", &str);
if (err) {
printk("%s warning: get spi gpio_spi_clk failed\n", pdata->name);
pdata->spi_clk = -1;
}
else {
val = amlogic_gpio_name_map_num(str);
if (val > 0) {
err = lcd_extern_gpio_request(val);
if (err) {
printk("faild to alloc spi_clk gpio (%s)!\n", str);
}
pdata->spi_clk = val;
DBG_PRINT("spi_clk gpio = %s(%d)\n", str, pdata->spi_clk);
}
else {
pdata->spi_clk = -1;
}
}
err = of_property_read_string(of_node,"gpio_spi_data", &str);
if (err) {
printk("%s warning: get spi gpio_spi_data failed\n", pdata->name);
pdata->spi_data = -1;
}
//.........这里部分代码省略.........
示例14: GenPFrame
/*===========================================================================*
*
* GenPFrame
*
* generate a P-frame from previous frame, adding the result to the
* given bit bucket
*
* RETURNS: frame appended to bb
*
* SIDE EFFECTS: none
*
*===========================================================================*/
void
GenPFrame(BitBucket *bb,
MpegFrame *current,
MpegFrame *prev)
{
extern int **pmvHistogram;
FlatBlock fba[6], fb[6];
Block dec[6];
int32 y_dc_pred, cr_dc_pred, cb_dc_pred;
int x, y;
int motionX = 0, motionY = 0;
int oldMotionX = 0, oldMotionY = 0;
int offsetX, offsetY;
int tempX, tempY;
int motionXrem, motionXquot;
int motionYrem, motionYquot;
int pattern;
int mbAddrInc = 1;
boolean useMotion;
int numIBlocks = 0;
int numPBlocks = 0;
int numSkipped = 0;
int numIBits = 0;
int numPBits = 0;
int totalBits;
int totalFrameBits;
int32 startTime, endTime;
int lastBlockX, lastBlockY;
int lastX, lastY;
int fy, fx;
LumBlock currentBlock;
register int ix, iy;
int mbAddress;
int slicePos;
register int index;
float snr[3], psnr[3];
int QScale;
BlockMV *info;
int bitstreamMode, newQScale;
int rc_blockStart = 0;
boolean overflowChange = FALSE;
int overflowValue = 0;
if (collect_quant) {fprintf(collect_quant_fp, "# P\n");}
if (dct==NULL) AllocDctBlocks();
numFrames++;
totalFrameBits = bb->cumulativeBits;
startTime = time_elapsed();
DBG_PRINT(("Generating pframe\n"));
QScale = GetPQScale();
/* bit allocation for rate control purposes */
bitstreamMode = getRateMode();
if (bitstreamMode == FIXED_RATE) {
targetRateControl(current);
}
Mhead_GenPictureHeader(bb, P_FRAME, current->id, fCodeP);
/* Check for Qscale change */
if (specificsOn) {
/* Set a Qscale for this frame? */
newQScale = SpecLookup(current->id, 0, 0 /* junk */, &info /*junk*/, QScale);
if (newQScale != -1) {
QScale = newQScale;
}
/* Set for slice? */
newQScale = SpecLookup(current->id, 1, 1, &info /*junk*/, QScale);
if (newQScale != -1) {
QScale = newQScale;
}
}
DBG_PRINT(("Slice Header\n"));
Mhead_GenSliceHeader(bb, 1, QScale, NULL, 0);
if ( referenceFrame == DECODED_FRAME ) {
Frame_AllocDecoded(current, TRUE);
} else if ( printSNR ) {
Frame_AllocDecoded(current, FALSE);
}
/* don't do dct on blocks yet */
Frame_AllocBlocks(current);
BlockifyFrame(current);
/* for I-blocks */
//.........这里部分代码省略.........
示例15: Cpp
//.........这里部分代码省略.........
PUT(PARSER_DEF, token, lineno, sp);
if ((c = nexttoken(interested, cpp_reserved_word)) == '=') {
crflag = 1;
break;
}
}
/*
* Namespace block doesn't have any influence on level.
*/
if (c == '{') /* } */ {
namespacelevel++;
} else {
if (param->flags & PARSER_WARNING)
warning("missing namespace block. [+%d %s](0x%x).", lineno, curfile, c);
}
crflag = 1;
break;
case CPP_EXTERN: /* for 'extern "C"/"C++"' */
if (peekc(0) != '"') /* " */
continue; /* If does not start with '"', continue. */
while ((c = nexttoken(interested, cpp_reserved_word)) == '\n')
;
/*
* 'extern "C"/"C++"' block is a kind of namespace block.
* (It doesn't have any influence on level.)
*/
if (c == '{') /* } */
namespacelevel++;
else
pushbacktoken();
break;
case CPP_STRUCT:
case CPP_CLASS:
DBG_PRINT(level, cc == CPP_CLASS ? "class" : "struct");
while ((c = nexttoken(NULL, cpp_reserved_word)) == CPP___ATTRIBUTE__ || c == '\n')
if (c == CPP___ATTRIBUTE__)
process_attribute(param);
if (c == SYMBOL) {
char *saveline;
int savelineno;
do {
if (c == SYMBOL) {
savelineno = lineno;
strbuf_reset(sb);
strbuf_puts(sb, sp);
saveline = strbuf_value(sb);
strlimcpy(classname, token, sizeof(classname));
}
c = nexttoken(NULL, cpp_reserved_word);
if (c == SYMBOL)
PUT(PARSER_REF_SYM, classname, savelineno, saveline);
else if (c == '<') {
int templates = 1;
for (;;) {
c = nexttoken(NULL, cpp_reserved_word);
if (c == SYMBOL)
PUT(PARSER_REF_SYM, token, lineno, sp);
else if (c == '<')
++templates;
else if (c == '>') {
if (--templates == 0)
break;
} else if (c == EOF)
die("failed to parse template [+%d %s].", savelineno, curfile);
}
c = nexttoken(NULL, cpp_reserved_word);