这篇教程C++ ATTR函数代码示例写得很实用,希望能帮到您。
本文整理汇总了C++中ATTR函数的典型用法代码示例。如果您正苦于以下问题:C++ ATTR函数的具体用法?C++ ATTR怎么用?C++ ATTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。 在下文中一共展示了ATTR函数的29个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。 示例1: ListMgr_Updateint ListMgr_Update( lmgr_t * p_mgr, const entry_id_t * p_id, const attr_set_t * p_update_set ){ int rc, main_count, annex_count; char query[4096]; char fields[4096]; char annex_fields[4096]; DEF_PK(pk); int nb_tables = 0; /* read only fields in info mask? */ if ( readonly_attr_set & p_update_set->attr_mask ) { DisplayLog( LVL_MAJOR, LISTMGR_TAG, "Error: trying to update read only values: attr_mask=%#x", readonly_attr_set & p_update_set->attr_mask ); return DB_INVALID_ARG; } rc = entry_id2pk( p_mgr, p_id, FALSE, PTR_PK(pk) ); if (rc) return rc; /* check how many tables are to be updated */ if ( main_fields( p_update_set->attr_mask ) ) { main_count = attrset2updatelist( p_mgr, fields, p_update_set, T_MAIN, FALSE ); if ( main_count < 0 ) return -main_count; if ( main_count > 0 ) nb_tables++; } else main_count = 0; if ( annex_table && annex_fields( p_update_set->attr_mask ) ) { annex_count = attrset2updatelist( p_mgr, annex_fields, p_update_set, T_ANNEX, FALSE ); if ( annex_count < 0 ) return -annex_count; if ( annex_count > 0 ) nb_tables++; } else annex_count = 0; if ( stripe_fields( p_update_set->attr_mask ) ) nb_tables += 2; /* if only 1 table is impacted, switch to autocommit mode */ if ( nb_tables > 1 ) { /* @todo in the case of sqlite, we may want to do periodic commit * instead of systematic one. */ rc = lmgr_begin( p_mgr ); if ( rc ) return rc; } /* update main table */ if ( main_count > 0 ) { sprintf( query, "UPDATE " MAIN_TABLE " SET %s WHERE id="DPK, fields, pk ); rc = db_exec_sql( &p_mgr->conn, query, NULL ); if ( rc ) goto rollback; } /* update annex table (if any) */ if ( annex_count > 0 ) { sprintf( query, "UPDATE " ANNEX_TABLE " SET %s WHERE id="DPK, annex_fields, pk ); rc = db_exec_sql( &p_mgr->conn, query, NULL ); if ( rc ) goto rollback; } /* insert new stripe info if provided (and eventually remove previous values) */ if ( ATTR_MASK_TEST( p_update_set, stripe_info ) ) { rc = insert_stripe_info( p_mgr, pk, VALID(p_id), &ATTR( p_update_set, stripe_info ), ATTR_MASK_TEST( p_update_set, stripe_items ) ? &ATTR( p_update_set, stripe_items ) : NULL, TRUE ); if ( rc ) goto rollback; } if ( nb_tables > 1 ) return lmgr_commit( p_mgr ); else return DB_SUCCESS; rollback: lmgr_rollback( p_mgr ); return rc;}
开发者ID:bringhurst,项目名称:robinhood,代码行数:97,
示例2: check_executorstatic int check_executor(struct sm_instance *smi, const char *implements, const policy_action_t *action, /* arguments for the action : */ const entry_id_t *p_id, attr_set_t *p_attrs, const action_params_t *params, post_action_e *what_after, db_cb_func_t db_cb_fn, void *db_cb_arg){ int rc = 0; time_t t; bool use_str = false; GString *out = NULL; *what_after = PA_UPDATE; /* Run the action. * Functions (defined in modules): * o As input, a function action should use 'output' attribute to compare * the result of the last execution. * o As output, a function action can store its result to 'output' * attribute. * Commands: * o As input, a command can retrieve the last output by using '{output}' * placeholder. * o As output, output will be set as the contents of stdout * (truncated to 255 char). */ out = g_string_new(""); rc = action_helper(action, "check", p_id, p_attrs, params, smi, out, what_after, db_cb_fn, db_cb_arg); /* update the value of last_check */ t = time(NULL); set_uint_info(smi, p_attrs, ATTR_LAST_CHECK, (unsigned int)t); /* depending on the action status, update the value of last_success */ if (rc == 0) { set_status_attr(smi, p_attrs, check_status2str(STATUS_OK)); set_uint_info(smi, p_attrs, ATTR_LAST_SUCCESS, (unsigned int)t); /* set output if the action was a successful command */ if (action->type == ACTION_COMMAND) { int rc2; DisplayLog(LVL_DEBUG, "check_exec", "check command output='%s'", out->str); rc2 = set_sm_info(smi, p_attrs, ATTR_OUTPUT, out->str); if (rc2 == 0) /* str is now owner by p_attrs */ use_str = true; } } else { set_status_attr(smi, p_attrs, check_status2str(STATUS_FAILED)); DisplayLog(LVL_EVENT, "check_exec", "check command FAILED on: " DFID_NOBRACE " (%s)", PFID(p_id), ATTR(p_attrs, fullpath)); } g_string_free(out, use_str ? FALSE : TRUE); return rc;}
开发者ID:cea-hpc,项目名称:robinhood,代码行数:62,
示例3: recov_resumestatic int recov_resume(int retry_errors){ struct lmgr_iterator_t *it; int rc, st; entry_id_t id, new_id; attr_set_t attrs, new_attrs; char buff[128]; /* TODO iter opt */ it = ListMgr_RecovResume(&lmgr, path_filter, retry_errors, NULL); if (it == NULL) { fprintf(stderr, "ERROR: cannot get the list of entries to be recovered/n"); return -1; } attrs.attr_mask = RECOV_ATTR_MASK; while (!terminate && ((rc = ListMgr_RecovGetNext(it, &id, &attrs, NULL)) != DB_END_OF_LIST)) { if (rc) { fprintf(stderr, "ERROR %d getting entry from recovery table/n", rc); ListMgr_CloseIterator(it); return rc; } FormatFileSize(buff, 128, ATTR(&attrs, size)); if (ATTR_MASK_TEST(&attrs, fullpath)) printf("Restoring %s (%s)...", ATTR(&attrs, fullpath), buff); else printf("Restoring " DFID " (%s)...", PFID(&id), buff); /* TODO process entries asynchronously, in parallel, in separate * threads */ st = rbhext_recover(&id, &attrs, &new_id, &new_attrs, NULL); if ((st == RS_FILE_OK) || (st == RS_FILE_EMPTY) || (st == RS_NON_FILE) || (st == RS_FILE_DELTA)) { /* don't insert readonly attrs */ new_attrs.attr_mask &= ~readonly_attr_set; /* insert the entry in the database, and update recovery status */ rc = ListMgr_Insert(&lmgr, &new_id, &new_attrs, true); if (rc) { fprintf(stderr, "DB insert failure for '%s'/n", ATTR(&new_attrs, fullpath)); st = RS_ERROR; } } /* old id must be used for impacting recovery table */ if (ListMgr_RecovSetState(&lmgr, &id, st)) st = RS_ERROR; switch (st) { case RS_FILE_OK: printf(" OK/n"); break; case RS_FILE_DELTA: printf(" OK (old version)/n"); break; case RS_NON_FILE: printf(" OK (non-file)/n"); break; case RS_FILE_EMPTY: printf(" OK (empty file)/n"); break; case RS_NOBACKUP: printf(" No backup available/n"); break; case RS_ERROR: printf(" FAILED/n"); break; default: printf(" ERROR st=%d, rc=%d/n", st, rc); break; } /* reset mask */ attrs.attr_mask = RECOV_ATTR_MASK; } return 0;}
开发者ID:cea-hpc,项目名称:robinhood,代码行数:86,
示例4: listmgr_get_dirattrs/** retrieve directory attributes (nbr of entries, avg size of entries)*/int listmgr_get_dirattrs( lmgr_t * p_mgr, PK_ARG_T dir_pk, attr_set_t * p_attrs ){ if (ATTR_MASK_TEST( p_attrs, type) && (strcmp( ATTR(p_attrs, type), STR_TYPE_DIR ) != 0)) { DisplayLog( LVL_FULL, LISTMGR_TAG, "Type='%s' != 'dir' => unsetting dirattrs in attr mask", ATTR(p_attrs, type) ); p_attrs->attr_mask &= ~dir_attr_set; return 0; }#ifdef ATTR_INDEX_dircount char query[1024]; result_handle_t result; char *str_info[1]; int rc = 0; int tmp_val; long long tmp_long; /* get child entry count from DNAMES_TABLE */ if (ATTR_MASK_TEST(p_attrs, dircount)) { sprintf( query, "SELECT %s FROM "DNAMES_TABLE" WHERE parent_id="DPK, dirattr2str(ATTR_INDEX_dircount), dir_pk ); rc = db_exec_sql( &p_mgr->conn, query, &result ); if ( rc ) return rc; rc = db_next_record( &p_mgr->conn, &result, str_info, 1 ); if (rc == DB_END_OF_LIST) { ATTR_MASK_UNSET(p_attrs, dircount); rc = DB_SUCCESS; } else if (rc == DB_SUCCESS) { if (str_info[0] == NULL) /* count(*) should at least return 0 */ rc = DB_REQUEST_FAILED; else { tmp_val = str2int(str_info[0]); if (tmp_val != -1) { ATTR_MASK_SET(p_attrs, dircount); ATTR( p_attrs, dircount ) = tmp_val; rc = DB_SUCCESS; } else /* invalid output format */ rc = DB_REQUEST_FAILED; } } db_result_free( &p_mgr->conn, &result ); if (rc) return rc; } /* get avgsize of child entries from MAIN_TABLE */ if (ATTR_MASK_TEST(p_attrs, avgsize)) { sprintf( query, "SELECT %s FROM "MAIN_TABLE" m, "DNAMES_TABLE" d WHERE m.id = d.id and type='file' and d.parent_id="DPK, dirattr2str(ATTR_INDEX_avgsize), dir_pk ); rc = db_exec_sql( &p_mgr->conn, query, &result ); if ( rc ) return rc; rc = db_next_record( &p_mgr->conn, &result, str_info, 1 ); if (rc == DB_END_OF_LIST) ATTR_MASK_UNSET(p_attrs, avgsize); else if (rc == DB_SUCCESS) { if (str_info[0] == NULL) { /* NULL if no entry matches the criteria */ ATTR_MASK_UNSET(p_attrs, avgsize); rc = DB_SUCCESS; } else { tmp_long = str2bigint(str_info[0]); if (tmp_long != -1LL) { ATTR_MASK_SET(p_attrs, avgsize); ATTR( p_attrs, avgsize ) = tmp_long; rc = DB_SUCCESS; } else /* invalid output format */ rc = DB_REQUEST_FAILED; } } db_result_free( &p_mgr->conn, &result ); } return rc;#endif}
开发者ID:karig,项目名称:robinhood,代码行数:96,
示例5: UiDrawBackdropVOIDUiDrawBackdrop(VOID){ /* Clear the screen */ MachVideoClearScreen(ATTR(COLOR_WHITE, COLOR_BLACK));}
开发者ID:hoangduit,项目名称:reactos,代码行数:6,
示例6: LOGvoid RespondElement::enterElement(const Arabica::DOM::Element<std::string>& node) { // try to get the request id if (!HAS_ATTR(node, "to")) { LOG(ERROR) << "Respond element requires to attribute"; return; } if (HAS_ATTR(node, "to") && !_interpreter->getDataModel()) { LOG(ERROR) << "Respond element with to requires datamodel"; return; } std::string requestId = _interpreter->getDataModel().evalAsString(ATTR(node, "to")); // try to get the request object InterpreterHTTPServlet* servlet = _interpreter->getHTTPServlet(); tthread::lock_guard<tthread::recursive_mutex> lock(servlet->getMutex()); if (servlet->getRequests().find(requestId) == servlet->getRequests().end()) { LOG(ERROR) << "No matching HTTP request for respond element"; return; } assert(servlet->getRequests().find(requestId) != servlet->getRequests().end()); HTTPServer::Request httpReq = servlet->getRequests()[requestId]; assert(httpReq.evhttpReq != NULL); HTTPServer::Reply httpReply(httpReq); servlet->getRequests().erase(requestId); // get the status or default to 200 std::string statusStr = (HAS_ATTR(node, "status") ? ATTR(node, "status") : "200"); if (!isNumeric(statusStr.c_str(), 10)) { LOG(ERROR) << "Respond element with non-numeric status " << statusStr; return; } httpReply.status = strTo<int>(statusStr);; // extract the content Arabica::XPath::NodeSet<std::string> contents = InterpreterImpl::filterChildElements(_interpreter->getNameSpaceInfo().getXMLPrefixForNS(getNamespace()) + "content", node); if (contents.size() > 0) { Arabica::DOM::Element<std::string> contentElem = Arabica::DOM::Element<std::string>(contents[0]); if (HAS_ATTR(contentElem, "expr")) { // -- content is evaluated string from datamodel ------ if (_interpreter->getDataModel()) { try { Data contentData = _interpreter->getDataModel().getStringAsData(ATTR(contentElem, "expr")); if (contentData.atom.length() > 0) { httpReply.content = contentData.atom; httpReply.headers["Content-Type"] = "text/plain"; } else if (contentData.binary) { httpReply.content = std::string(contentData.binary.getData(), contentData.binary.getSize()); httpReply.headers["Content-Type"] = contentData.binary.getMimeType(); } else if (contentData.node) { std::stringstream ss; ss << contentData.node; httpReply.content = ss.str();; httpReply.headers["Content-Type"] = "application/xml"; } else { httpReply.content = Data::toJSON(contentData); httpReply.headers["Content-Type"] = "application/json"; } } catch (Event e) { LOG(ERROR) << "Syntax error with expr in content child of Respond element:" << std::endl << e << std::endl; return; } } else { LOG(ERROR) << "content element has expr attribute but no datamodel is specified."; return; } } else if (HAS_ATTR(contentElem, "file") || HAS_ATTR(contentElem, "fileexpr")) { // -- content is from file ------ URL file; if (HAS_ATTR(contentElem, "fileexpr")) { if (_interpreter->getDataModel()) { try { file = "file://" + _interpreter->getDataModel().evalAsString(ATTR(contentElem, "fileexpr")); } catch (Event e) { LOG(ERROR) << "Syntax error with fileexpr in content child of Respond element:" << std::endl << e << std::endl; return; } } } else { file = "file://" + ATTR(contentElem, "fileexpr"); } if (file) { httpReply.content = file.getInContent(); size_t lastDot; if ((lastDot = file.path().find_last_of(".")) != std::string::npos) { std::string extension = file.path().substr(lastDot + 1); std::string mimeType = URL::getMimeType(extension); if (mimeType.length() > 0) { httpReply.headers["Content-Type"] = mimeType; } } } } else if (contents[0].hasChildNodes()) { // -- content embedded as child nodes ------ httpReply.content = contents[0].getFirstChild().getNodeValue(); } else { LOG(ERROR) << "content element does not specify any content."; return; } } // process headers//.........这里部分代码省略.........
开发者ID:sradomski,项目名称:uscxml,代码行数:101,
示例7: AcpiOsWritable/* Check if the address is writeable */BOOLEAN AcpiOsWritable(void* Memory, ACPI_SIZE Length){ for(ACPI_SIZE n = 0; n < Length; n += 0x1000){ page_t* page = get_page((void*)((ACPI_SIZE)Memory + n), 0, current->t_dir); if( page == NULL ) return FALSE; if( page->present == 0 ) return FALSE; if( page->rw == 0 ) return FALSE; } return TRUE;}/* Read physical memory */ACPI_STATUS AcpiOsReadMemory(ACPI_PHYSICAL_ADDRESS Address ATTR((unused)), UINT64* Value ATTR((unused)), UINT32 Width ATTR((unused))){ *Value = 0; syslog(KERN_ERR, "acpi: %s: method not implemented!", __func__); return AE_OK;}/* Write physical memory */ACPI_STATUS AcpiOsWriteMemory(ACPI_PHYSICAL_ADDRESS Address ATTR((unused)), UINT64 Value ATTR((unused)), UINT32 Width ATTR((unused))){ syslog(KERN_ERR, "acpi: %s: method not implemented!", __func__); return AE_OK;
开发者ID:Caleb1994,项目名称:stewieos,代码行数:31,
示例8: op_glob// (pattern) | [ (path)...]P op_glob(void) { glob_t gl; size_t i; B* curr = FREEvm; B* top; P retc = OK; if (o_1 < FLOORopds) return OPDS_UNF; if (TAG(o_1) != (ARRAY|BYTETYPE)) return OPD_CLA; if (curr + ARRAY_SIZE(o_1) + 1 >= CEILvm) return VM_OVF; moveB(VALUE_PTR(o_1), curr, ARRAY_SIZE(o_1)); curr += ARRAY_SIZE(o_1); curr[0] = '/0'; curr = FREEvm; switch (glob((char*) curr, GLOB_BRACE|GLOB_TILDE, NULL, &gl)) { case 0: break; case GLOB_NOMATCH: if (curr + FRAMEBYTES >= CEILvm) return VM_OVF; TAG(curr) = LIST; ATTR(curr) = PARENT; VALUE_PTR(curr) = LIST_CEIL_PTR(curr) = curr + FRAMEBYTES; curr += FRAMEBYTES; moveframe(FREEvm, o_1); FREEvm = curr; return OK; case GLOB_NOSPACE: return MEM_OVF; case GLOB_ABORTED: return errno ? -errno : READ_ERROR; default: return UNKNOWN_ERR; }; if (curr + FRAMEBYTES + FRAMEBYTES * gl.gl_pathc >= CEILvm) goto vm_ovf; TAG(curr) = LIST; ATTR(curr) = PARENT; VALUE_PTR(curr) = curr + FRAMEBYTES; top = LIST_CEIL_PTR(curr) = curr + FRAMEBYTES + FRAMEBYTES * gl.gl_pathc; curr += FRAMEBYTES; for (i = 0; i < gl.gl_pathc; ++i) { size_t len = strlen(gl.gl_pathv[i]); if (top + FRAMEBYTES + DALIGN(len) >= CEILvm) goto vm_ovf; TAG(top) = (ARRAY|BYTETYPE); ATTR(top) = PARENT; VALUE_PTR(top) = top + FRAMEBYTES; ARRAY_SIZE(top) = len; moveframe(top, curr); curr += FRAMEBYTES; top += FRAMEBYTES; moveB((B*) gl.gl_pathv[i], top, len); top += DALIGN(len); } moveframe(FREEvm, o_1); FREEvm = top; goto exit; vm_ovf: retc = VM_OVF; exit: globfree(&gl); return retc;}
开发者ID:apeyser,项目名称:Deuterostome,代码行数:71,
示例9: switchvoid XmlParser::handleStartElement(void){ if (DBG) std::cerr << "StartElement"; if (DBG) std::cerr << ", name: '" << STDR(mXml.name()) << "'" << std::endl; switch (mCurSection) { case IGNORED_SECTION: if (mXml.name() == "chemical_element") { mCurSection = ELEMENT_CONFIG_SECTION; mElement = new Element(); if (!mElement.isNull()) mElement->setProperty( Element::SYMBOL_PROPERTY, ATTR(mXml, symbol, StdString) ); } break; case ELEMENT_CONFIG_SECTION: if (mElement.isNull()) break; if (mXml.name() == "name") { mElement->setProperty( Element::NAME_PROPERTY, ATTR(mXml, val, StdString) ); } else if (mXml.name() == "abundance") { mElement->setProperty( Element::ABUNDANCE_PROPERTY, ATTR(mXml, val, Double) ); } else if (mXml.name() == "atomic_weight") { mElement->setProperty( Element::ATOMIC_MASS_PROPERTY, ATTR(mXml, val, Double) ); } else if (mXml.name() == "nucleons") { mElement->setProperty( Element::NUCLEONS_PROPERTY, ATTR(mXml, val, Int) ); } else if (mXml.name() == "electrons") { mElement->setProperty( Element::ELECTRONS_PROPERTY, ATTR(mXml, val, Int) ); } else if (mXml.name() == "neutron_scattering_length") { mCurSection = NS_L_SECTION; } else if (mXml.name() == "neutron_scattering_cross_section") { mCurSection = NS_C_SECTION; } else if (mXml.name() == "xray_scattering_anomalous_coefficients") { mCurSection = XRAY_COEFFICIENTS_SECTION; } break; case NS_L_SECTION: if (mElement.isNull()) break; if (mXml.name() == "coherent") { mElement->setProperty( Element::NS_L_COHERENT_PROPERTY, complex( ATTR(mXml, re, Double), ATTR(mXml, im, Double) )); } else if (mXml.name() == "incoherent") { mElement->setProperty( Element::NS_L_INCOHERENT_PROPERTY, complex( ATTR(mXml, re, Double), ATTR(mXml, im, Double) )); } break; case NS_C_SECTION: if (mElement.isNull()) break; if (mXml.name() == "coherent") { mElement->setProperty( Element::NS_CS_COHERENT_PROPERTY, ATTR(mXml, re, Double)); } else if (mXml.name() == "incoherent") { mElement->setProperty( Element::NS_CS_INCOHERENT_PROPERTY, ATTR(mXml, re, Double)); } else if (mXml.name() == "total") { mElement->setProperty( Element::NS_CS_TOTAL_PROPERTY, ATTR(mXml, val, Double) ); } else if (mXml.name() == "absorption") { mElement->setProperty( Element::NS_CS_ABSORPTION_PROPERTY, ATTR(mXml, val, Double) ); } break; case XRAY_COEFFICIENTS_SECTION: if (mElement.isNull()) break; if (mXml.name() == "ev") { mElement->addXrayCoefficient( ATTR(mXml, val, Double), ATTR(mXml, fp, Double), ATTR(mXml, fpp, Double) ); }//.........这里部分代码省略.........
开发者ID:BackupTheBerlios,项目名称:qsldcalc-svn,代码行数:101,
示例10: METH// void println(string msg)void METH(s[0], println)(string msg) { printf("%s(count=%d) %s/n", ATTR(header), PRIVATE.count++, msg);}
开发者ID:Mind4SE,项目名称:Optimization-Backend,代码行数:4,
示例11: ATTRssize_t ramster_remote_eph_pages_succ_get;ssize_t ramster_remote_pers_pages_succ_get;ssize_t ramster_remote_eph_pages_unsucc_get;ssize_t ramster_remote_pers_pages_unsucc_get;ssize_t ramster_pers_pages_remote_nomem;ssize_t ramster_remote_objects_flushed;ssize_t ramster_remote_object_flushes_failed;ssize_t ramster_remote_pages_flushed;ssize_t ramster_remote_page_flushes_failed;#define ATTR(x) { .name = #x, .val = &ramster_##x, }static struct debug_entry { const char *name; ssize_t *val;} attrs[] = { ATTR(eph_pages_remoted), ATTR(pers_pages_remoted), ATTR(eph_pages_remote_failed), ATTR(pers_pages_remote_failed), ATTR(remote_eph_pages_succ_get), ATTR(remote_pers_pages_succ_get), ATTR(remote_eph_pages_unsucc_get), ATTR(remote_pers_pages_unsucc_get), ATTR(pers_pages_remote_nomem), ATTR(remote_objects_flushed), ATTR(remote_pages_flushed), ATTR(remote_object_flushes_failed), ATTR(remote_page_flushes_failed), ATTR(foreign_eph_pages), ATTR(foreign_eph_pages_max), ATTR(foreign_pers_pages),
开发者ID:realmz,项目名称:blackfin-linux,代码行数:31,
示例12: op_makewindowP op_makewindow(void){#if X_DISPLAY_MISSING return NO_XWINDOWS;#else static XClassHint classhint = {"d_machine", "d_machine"}; static XWMHints xwmhints = {InputHint, False}; static Atom atom[2]; static Atom opaque; static L32 opaqueval = ~(L32) 0; P retc; W *pxy; B *xyf, *freevm, nstr[31], icstr[13], *pn[1] = { nstr }, *pic[1] = { icstr }; XSetWindowAttributes attr; XTextProperty wname, icname; if (dvtdisplay == NULL) return NO_XWINDOWS; attr.event_mask = (ButtonPressMask | ExposureMask | StructureNotifyMask); attr.override_redirect = False; if (o_3 < FLOORopds) return OPDS_UNF; if (TAG(o_1) != (ARRAY | BYTETYPE)) return OPD_ERR; if (ARRAY_SIZE(o_1) > 12) return RNG_CHK; moveB((B *)VALUE_BASE(o_1),icstr,ARRAY_SIZE(o_1)); icstr[ARRAY_SIZE(o_1)] = '/000'; if (XStringListToTextProperty((char**) pic,1,&icname) == 0) return X_ERR; if (TAG(o_2) != (ARRAY | BYTETYPE)) return OPD_ERR; if (ARRAY_SIZE(o_2) > 30) return RNG_CHK; moveB((B *)VALUE_BASE(o_2),nstr,ARRAY_SIZE(o_2)); nstr[ARRAY_SIZE(o_2)] = '/000'; if (XStringListToTextProperty((char**)pn,1,&wname) == 0) return X_ERR; FREEopds = o_2; freevm = FREEvm; if ((retc = xy(&xyf,&freevm)) != OK) return retc; pxy = (W *)VALUE_BASE(xyf); if (ARRAY_SIZE(xyf) != 4) return RNG_CHK; if (ndvtwindows >= MAXDVTWINDOWS) return RNG_CHK; wid = HXCreateWindow(dvtdisplay, dvtrootwindow, pxy[0], pxy[1], pxy[2], pxy[3], 0, CopyFromParent, InputOutput, CopyFromParent, CWEventMask, &attr); HXSetWMProperties(dvtdisplay, wid, &wname, &icname, NULL, 0, NULL, &xwmhints, &classhint); atom[0] = HXInternAtom(dvtdisplay, "WM_DELETE_WINDOW", False); atom[1] = HXInternAtom(dvtdisplay, "WM_TAKE_FOCUS", False); HXSetWMProtocols(dvtdisplay, wid, atom, 2); opaque = HXInternAtom(dvtdisplay, "_KDE_WM_WINDOW_OPACITY", False); HXChangeProperty(dvtdisplay, wid, opaque, XA_CARDINAL, 32, PropModeReplace, (unsigned char*) &opaqueval, 1); dvtwindows[ndvtwindows++] = wid; TAG(o1) = NUM | LONGBIGTYPE; ATTR(o1) = 0; LONGBIG_VAL(o1) = wid; FREEopds = o2; return OK; #endif}
开发者ID:apeyser,项目名称:Deuterostome,代码行数:66,
示例13: ATTR#include <linux/atomic.h>#include "debug.h"#ifdef CONFIG_ZCACHE_DEBUG#include <linux/debugfs.h>#define ATTR(x) { .name = #x, .val = &zcache_##x, }static struct debug_entry { const char *name; ssize_t *val;} attrs[] = { ATTR(obj_count), ATTR(obj_count_max), ATTR(objnode_count), ATTR(objnode_count_max), ATTR(flush_total), ATTR(flush_found), ATTR(flobj_total), ATTR(flobj_found), ATTR(failed_eph_puts), ATTR(failed_pers_puts), ATTR(failed_getfreepages), ATTR(failed_alloc), ATTR(put_to_flush), ATTR(compress_poor), ATTR(mean_compress_poor), ATTR(eph_ate_tail), ATTR(eph_ate_tail_failed), ATTR(pers_ate_eph), ATTR(pers_ate_eph_failed), ATTR(evicted_eph_zpages), ATTR(evicted_eph_pageframes), ATTR(eph_pageframes), ATTR(eph_pageframes_max), ATTR(eph_zpages), ATTR(eph_zpages_max), ATTR(pers_zpages), ATTR(pers_zpages_max), ATTR(last_active_file_pageframes), ATTR(last_inactive_file_pageframes), ATTR(last_active_anon_pageframes), ATTR(last_inactive_anon_pageframes), ATTR(eph_nonactive_puts_ignored), ATTR(pers_nonactive_puts_ignored),
开发者ID:mbgg,项目名称:linux,代码行数:31,
示例14: ATTRvoid XPathDataModel::assign(const Element<std::string>& assignElem, const Node<std::string>& node, const std::string& content) { std::string location; if (HAS_ATTR(assignElem, "id")) { location = ATTR(assignElem, "id"); } else if (HAS_ATTR(assignElem, "location")) { location = ATTR(assignElem, "location"); } // test 326ff XPathValue<std::string> key = _xpath.evaluate_expr(location, _doc);#ifdef VERBOSE LOG(INFO) << "Key XPath : " << key.asString();#endif#if 0 if (key.type() == NODE_SET) { try { for (size_t i = 0; i < key.asNodeSet().size(); i++) { Node<std::string> node = key.asNodeSet()[i]; if (node == _varResolver.resolveVariable("", "_ioprocessors").asNodeSet()[0]) ERROR_EXECUTION_THROW("Cannot assign _ioProcessors"); if (node == _varResolver.resolveVariable("", "_sessionid").asNodeSet()[0]) ERROR_EXECUTION_THROW("Cannot assign _sessionid"); if (node == _varResolver.resolveVariable("", "_name").asNodeSet()[0]) ERROR_EXECUTION_THROW("Cannot assign _name"); if (node == _varResolver.resolveVariable("", "_event").asNodeSet()[0]) ERROR_EXECUTION_THROW("Cannot assign _event"); } } catch (Event e) {} }#endif NodeSet<std::string> nodeSet; if (node) { Node<std::string> data = node; while (data) { // do not add empty text as a node if (data.getNodeType() == Node_base::TEXT_NODE) { std::string trimmed = data.getNodeValue(); boost::trim(trimmed); if (trimmed.length() == 0) { data = data.getNextSibling(); continue; } } nodeSet.push_back(data); data = data.getNextSibling(); } assign(key, nodeSet, assignElem); } else if (content.length() > 0) { Text<std::string> textNode = _doc.createTextNode(spaceNormalize(content)); nodeSet.push_back(textNode); assign(key, nodeSet, assignElem); } else if (HAS_ATTR(assignElem, "expr")) { XPathValue<std::string> value = _xpath.evaluate_expr(ATTR(assignElem, "expr"), _doc);#ifdef VERBOSE LOG(INFO) << "Value XPath : " << value.asString();#endif assign(key, value, assignElem); } else { LOG(ERROR) << "assign element has no content"; }// std::cout << _datamodel << std::endl;}
开发者ID:juehv,项目名称:uscxml,代码行数:65,
示例15: result2attrsetint result2attrset( table_enum table, char **result_tab, unsigned int res_count, attr_set_t * p_set ){ int i; unsigned int nbfields = 0; db_type_u typeu; int mask = 1; for ( i = 0; i < ATTR_COUNT; i++, mask <<= 1 ) { if ( ( p_set->attr_mask & mask ) && ( MATCH_TABLE( table, i ) ) ) {#ifdef _DEBUG_DB DisplayLog( LVL_FULL, LISTMGR_TAG, "result[%u] = %s", nbfields, result_tab[nbfields] );#endif /* Parse nbfield'th value */ if ( nbfields >= res_count ) { return DB_BUFFER_TOO_SMALL; } if ( (result_tab == NULL) || (result_tab[nbfields] == NULL) ) { p_set->attr_mask &= ~( 1 << i ); nbfields++; continue; } if ( field_infos[i].db_type == DB_STRIPE_INFO ) { if ( result_tab[nbfields] == NULL || result_tab[nbfields+1] == NULL || result_tab[nbfields+2] == NULL ) { p_set->attr_mask &= ~( 1 << i ); nbfields+=3; continue; } ATTR(p_set, stripe_info).stripe_count = atoi( result_tab[nbfields] ); ATTR(p_set, stripe_info).stripe_size = atoi( result_tab[nbfields+1] ); strncpy( ATTR(p_set, stripe_info).pool_name, result_tab[nbfields+2] , MAX_POOL_LEN ); ATTR(p_set, stripe_info).pool_name[MAX_POOL_LEN-1] = 0; /* stripe count, stripe size and pool_name */ nbfields += 3; continue; } else if ( !parsedbtype( result_tab[nbfields], field_infos[i].db_type, &typeu ) ) { DisplayLog( LVL_CRIT, LISTMGR_TAG, "Error: cannot parse field value '%s'", result_tab[nbfields] ); p_set->attr_mask &= ~( 1 << i ); nbfields++; continue; } UNION_GET_VALUE( typeu, field_infos[i].db_type, ( ( char * ) &p_set->attr_values + field_infos[i].offset ) ); nbfields++; } } return 0;}
开发者ID:mjtrangoni,项目名称:robinhood,代码行数:66,
示例16: elementvoid XPathDataModel::assign(const Element<std::string>& key, const NodeSet<std::string>& value, const Element<std::string>& assignElem) { Element<std::string> element(key); if (value.size() == 0 || !value[0]) return; if (false) { } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "firstchild")) { // firstchild: Insert the value specified by 'expr' before all of the children at 'location'. for (size_t i = value.size(); i; i--) { Node<std::string> importedNode = (value[i-1].getOwnerDocument() == _doc ? value[i-1].cloneNode(true) : _doc.importNode(value[i-1], true)); element.insertBefore(importedNode, element.getFirstChild()); } } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "lastchild")) { // lastchild: Insert the value specified by 'expr' after all of the children at 'location'. for (size_t i = 0; i < value.size(); i++) { Node<std::string> importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true)); element.appendChild(importedNode); } } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "previoussibling")) { // previoussibling: Insert the value specified by 'expr' before the // node specified by 'location', keeping the same parent. Node<std::string> parent = element.getParentNode(); if (!parent) ERROR_EXECUTION_THROW("Node has no parent"); for (size_t i = 0; i < value.size(); i++) { Node<std::string> importedNode = (value[i].getOwnerDocument() == _doc ? value[i].cloneNode(true) : _doc.importNode(value[i], true)); parent.insertBefore(importedNode, element); } } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "nextsibling")) { // nextsibling: Insert the value specified by 'expr' after the node // specified by 'location', keeping the same parent. Node<std::string> parent = element.getParentNode(); if (!parent) ERROR_EXECUTION_THROW("Node has no parent"); for (size_t i = value.size(); i; i--) { Node<std::string> importedNode = (value[i-1].getOwnerDocument() == _doc ? value[i-1].cloneNode(true) : _doc.importNode(value[i-1], true)); Node<std::string> nextSibling = element.getNextSibling(); if (nextSibling) { parent.insertBefore(importedNode, element.getNextSibling()); } else { parent.appendChild(importedNode); } } } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "replace")) { // replace: Replace the node specified by 'location' by the value specified by 'expr'. Node<std::string> parent = element.getParentNode(); if (!parent) ERROR_EXECUTION_THROW("Node has no parent"); if (value.size() != 1) ERROR_EXECUTION_THROW("Value not singular"); Node<std::string> importedNode = (value[0].getOwnerDocument() == _doc ? value[0].cloneNode(true) : _doc.importNode(value[0], true)); parent.replaceChild(importedNode, element); } else if (assignElem && HAS_ATTR(assignElem, "type") && iequals(ATTR(assignElem, "type"), "delete")) { // delete: Delete the node specified by 'location'. ('expr' is ignored.). Node<std::string> parent = element.getParentNode(); if (!parent) ERROR_EXECUTION_THROW("Node has no parent"); parent.removeChild(element); } else { // replacechildren: Replace all the children at 'location' with the value specified by 'expr'. while(element.hasChildNodes()) element.removeChild(element.getChildNodes().item(0)); for (size_t i = 0; i < value.size(); i++) { Node<std::string> importedNode = element.getOwnerDocument().importNode(value[i], true); element.appendChild(importedNode); } }}
开发者ID:juehv,项目名称:uscxml,代码行数:70,
示例17: mainint main(void){ LBIG memsetup[5] = { 1000, 100, 20, 10, 200 }; B* startup_dvt; B fromconsoleframe[FRAMEBYTES], *sf; P nb, retc,tnb; B *sysdict, *userdict, *p; int sufd; sysop = _sysop; syserrc = _syserrc; syserrm = _syserrm; createfds(); serialized = TRUE; // no serialize operator/*----------------- SIGNALS that we wish to handle -------------------*//* FPU indigestion is recorded in the numovf flag; we do not wish to be killed by it*/ numovf = FALSE; signal(SIGFPE, SIGFPEhandler);/* The broken pipe signal is ignored, so it cannot kill us; it will pop up in attempts to send on a broken connection*/ signal(SIGPIPE, SIG_IGN);/* We use alarms to time-limit read/write operations on sockets */ timeout = FALSE; signal(SIGALRM, SIGALRMhandler);/* The interrupt signal is produced by the control-c key of the console keyboard, it triggers the execution of 'abort'*/ abortflag = FALSE; signal(SIGINT, SIGINThandler); /*--------------------- set up the tiny D machine ------------------- Not so tiny for the dvt, this should be good for most work*/ if (makeDmemory(memsetup)) dm_error(0, "D memory"); /*----------------- construct frames for use in execution of D code */ makename((B*) "error", errorframe); ATTR(errorframe) = ACTIVE; makename((B*) "fromconsole", fromconsoleframe); ATTR(fromconsoleframe) = ACTIVE; TAG(FREEvm) = STRING; ARRAY_SIZE(FREEvm) = 1024; VALUE_PTR(FREEvm) = FREEvm + FRAMEBYTES; ATTR(FREEvm) = ACTIVE; moveframe(FREEvm, inputframe); FREEvm += FRAMEBYTES + 1024;/* The system dictionary is created in the workspace of the tiny D machine. If the operator 'makeVM' is used to create a large D machine, this larger machine inherits the system dictionary of the tiny machine. We memorize the pointers of the tiny D memory so we can revert to the tiny setup.*/ if ((sysdict = makeopdict((B *)sysop, syserrc, syserrm)) == (B *)(-1L)) dm_error(0,"Cannot make system dictionary"); if ((userdict = makedict(memsetup[4])) == (B *)(-1L)) dm_error(0,"Cannot make user dictionary"); /* The first two dictionaries on the dicts are systemdict and userdict; they are not removable*/ moveframe (sysdict-FRAMEBYTES,FREEdicts); FREEdicts += FRAMEBYTES; moveframe (userdict-FRAMEBYTES,FREEdicts); FREEdicts += FRAMEBYTES; setupdirs(); fprintf(stderr, "Startup dir: %s/n", startup_dir);/*----------- read startup_dvt.d and push on execs ----------*/ startup_dvt = (B*)strcat(strcpy(malloc(strlen((char*)startup_dir) + strlen("/startup_dgen.d") + 1), startup_dir), "/startup_dgen.d"); if ((sufd = open((char*)startup_dvt, O_RDONLY)) == -1) dm_error(errno,"Opening %s", startup_dvt); tnb = 0; sf = FREEvm; p = sf + FRAMEBYTES; TAG(sf) = ARRAY | BYTETYPE; ATTR(sf) = READONLY | ACTIVE | PARENT; VALUE_BASE(sf) = (P)p; while (((nb = read(sufd,p,CEILvm-p)) > 0) && (p <= CEILvm)) { tnb += nb; p += nb; } if (nb == -1) dm_error(errno,"Reading %s", startup_dvt);//.........这里部分代码省略.........
开发者ID:apeyser,项目名称:Deuterostome,代码行数:101,
示例18: ATTRvoidGLLibraryEGL::DumpEGLConfig(EGLConfig cfg){ int attrval; int err;#define ATTR(_x) do { / fGetConfigAttrib(mEGLDisplay, cfg, LOCAL_EGL_##_x, &attrval); / if ((err = fGetError()) != 0x3000) { / printf_stderr(" %s: ERROR (0x%04x)/n", #_x, err); / } else { / printf_stderr(" %s: %d (0x%04x)/n", #_x, attrval, attrval); / } / } while(0) printf_stderr("EGL Config: %d [%p]/n", (int)(intptr_t)cfg, cfg); ATTR(BUFFER_SIZE); ATTR(ALPHA_SIZE); ATTR(BLUE_SIZE); ATTR(GREEN_SIZE); ATTR(RED_SIZE); ATTR(DEPTH_SIZE); ATTR(STENCIL_SIZE); ATTR(CONFIG_CAVEAT); ATTR(CONFIG_ID); ATTR(LEVEL); ATTR(MAX_PBUFFER_HEIGHT); ATTR(MAX_PBUFFER_PIXELS); ATTR(MAX_PBUFFER_WIDTH); ATTR(NATIVE_RENDERABLE); ATTR(NATIVE_VISUAL_ID); ATTR(NATIVE_VISUAL_TYPE); ATTR(PRESERVED_RESOURCES); ATTR(SAMPLES); ATTR(SAMPLE_BUFFERS); ATTR(SURFACE_TYPE); ATTR(TRANSPARENT_TYPE); ATTR(TRANSPARENT_RED_VALUE); ATTR(TRANSPARENT_GREEN_VALUE); ATTR(TRANSPARENT_BLUE_VALUE); ATTR(BIND_TO_TEXTURE_RGB); ATTR(BIND_TO_TEXTURE_RGBA); ATTR(MIN_SWAP_INTERVAL); ATTR(MAX_SWAP_INTERVAL); ATTR(LUMINANCE_SIZE); ATTR(ALPHA_MASK_SIZE); ATTR(COLOR_BUFFER_TYPE); ATTR(RENDERABLE_TYPE); ATTR(CONFORMANT);#undef ATTR}
开发者ID:Pulfer,项目名称:Pale-Moon,代码行数:53,
示例19: MiniTuiDrawMenuVOIDMiniTuiDrawMenu(PUI_MENU_INFO MenuInfo){ ULONG i; // // Draw the backdrop // UiDrawBackdrop(); // // No GUI status bar text, just minimal text. Show the menu header. // UiVtbl.DrawText(0, MenuInfo->Top - 2, MenuInfo->MenuHeader, ATTR(UiMenuFgColor, UiMenuBgColor)); // // Now tell the user how to choose // UiVtbl.DrawText(0, MenuInfo->Bottom + 1, "Use /x18 and /x19 to move the highlight to your choice.", ATTR(UiMenuFgColor, UiMenuBgColor)); UiVtbl.DrawText(0, MenuInfo->Bottom + 2, "Press ENTER to choose.", ATTR(UiMenuFgColor, UiMenuBgColor)); // // And show the menu footer // UiVtbl.DrawText(0, UiScreenHeight - 4, MenuInfo->MenuFooter, ATTR(UiMenuFgColor, UiMenuBgColor)); // // Draw the menu box // TuiDrawMenuBox(MenuInfo); // // Draw each line of the menu // for (i = 0; i < MenuInfo->MenuItemCount; i++) { TuiDrawMenuItem(MenuInfo, i); } // // Display the boot options if needed // if (MenuInfo->ShowBootOptions) { DisplayBootTimeOptions(); } VideoCopyOffScreenBufferToVRAM();}
开发者ID:RPG-7,项目名称:reactos,代码行数:61,
示例20: listmgr_get_by_pk//.........这里部分代码省略......... rc = DB_NOT_EXISTS; if (rc) goto free_res; /* set info from result */ if (main_count) { rc = result2attrset(T_MAIN, result_tab + shift, main_count, p_info); shift += main_count; if (rc) goto free_res; } if (annex_count) { rc = result2attrset(T_ANNEX, result_tab + shift, annex_count, p_info); shift += annex_count; if (rc) goto free_res; } if (name_count) { rc = result2attrset(T_DNAMES, result_tab + shift, name_count, p_info); shift += name_count; if (rc) goto free_res; } db_result_free(&p_mgr->conn, &result); } /* remove stripe info if it is not a file */ if (stripe_fields(p_info->attr_mask) && ATTR_MASK_TEST(p_info, type) && strcmp(ATTR(p_info, type), STR_TYPE_FILE) != 0) { p_info->attr_mask &= ~stripe_attr_set; } /* get stripe info if asked */#ifdef _LUSTRE if (stripe_fields( p_info->attr_mask )) { rc = get_stripe_info( p_mgr, pk, &ATTR( p_info, stripe_info ), ATTR_MASK_TEST( p_info, stripe_items ) ? &ATTR( p_info, stripe_items ) : NULL ); if ( rc == DB_ATTR_MISSING || rc == DB_NOT_EXISTS ) { p_info->attr_mask &= ~ATTR_MASK_stripe_info; if ( ATTR_MASK_TEST( p_info, stripe_items ) ) p_info->attr_mask &= ~ATTR_MASK_stripe_items; } else if ( rc ) return rc; else checkmain = 0; /* entry exists */ }#else /* always clean them */ p_info->attr_mask &= ~(ATTR_MASK_stripe_info | ATTR_MASK_stripe_items);#endif /* special field dircount */ if (dirattr_fields( p_info->attr_mask ))
开发者ID:karig,项目名称:robinhood,代码行数:67,
示例21: list_content/** * List the content of the given id/path list */static int list_content(char ** id_list, int id_count){ wagon_t *ids; int i, rc; attr_set_t root_attrs; entry_id_t root_id; int is_id; rc = get_root_id(&root_id); if (rc) return rc; ids = MemCalloc(id_count, sizeof(wagon_t)); if (!ids) return -ENOMEM; for (i = 0; i < id_count; i++) { is_id = TRUE; /* is it a path or fid? */ if (sscanf(id_list[i], SFID, RFID(&ids[i].id)) != FID_SCAN_CNT) { is_id = FALSE; /* take it as a path */ rc = Path2Id(id_list[i], &ids[i].id); if (!rc) { ids[i].fullname = id_list[i]; if (FINAL_SLASH(ids[i].fullname)) REMOVE_FINAL_SLASH(ids[i].fullname); } } else {#if _HAVE_FID /* Take it as an FID. */ char path[RBH_PATH_MAX]; rc = Lustre_GetFullPath( &ids[i].id, path, sizeof(path)); if (!rc) ids[i].fullname = strdup(path);#endif } if (rc) { DisplayLog(LVL_MAJOR, FIND_TAG, "Invalid parameter: %s: %s", id_list[i], strerror(-rc)); goto out; } /* get root attrs to print it (if it matches program options) */ root_attrs.attr_mask = disp_mask | query_mask; rc = ListMgr_Get(&lmgr, &ids[i].id, &root_attrs); if (rc == 0) dircb(&ids[i], &root_attrs, 1, NULL); else { DisplayLog(LVL_VERB, FIND_TAG, "Notice: no attrs in DB for %s", id_list[i]); if (!is_id) { struct stat st; ATTR_MASK_SET(&root_attrs, fullpath); strcpy(ATTR(&root_attrs, fullpath), id_list[i]); if (lstat(ATTR(&root_attrs, fullpath ), &st) == 0) { PosixStat2EntryAttr(&st, &root_attrs, TRUE); ListMgr_GenerateFields( &root_attrs, disp_mask | query_mask); } } else if (entry_id_equal(&ids[i].id, &root_id)) { /* this is root id */ struct stat st; ATTR_MASK_SET(&root_attrs, fullpath); strcpy(ATTR(&root_attrs, fullpath), config.global_config.fs_path); if (lstat(ATTR(&root_attrs, fullpath ), &st) == 0) { PosixStat2EntryAttr(&st, &root_attrs, TRUE); ListMgr_GenerateFields( &root_attrs, disp_mask | query_mask); } } dircb(&ids[i], &root_attrs, 1, NULL); } rc = rbh_scrub(&lmgr, &ids[i], 1, disp_mask | query_mask, dircb, NULL); }out: /* ids have been processed, free them */ MemFree(ids); return rc;}
开发者ID:fzago-cray,项目名称:robinhood,代码行数:95,
示例22: UiDrawMenuBoxVOIDNTAPIUiDrawMenuBox(IN PUI_MENU_INFO MenuInfo){ CHAR MenuLineText[80], TempString[80]; ULONG i; /* If there is a timeout draw the time remaining */ if (MenuInfo->MenuTimeRemaining >= 0) { /* Copy the integral time text string, and remove the last 2 chars */ strcpy(TempString, UiTimeText); i = strlen(TempString); TempString[i - 2] = 0; /* Display the first part of the string and the remaining time */ strcpy(MenuLineText, TempString); _itoa(MenuInfo->MenuTimeRemaining, TempString, 10); strcat(MenuLineText, TempString); /* Add the last 2 chars */ strcat(MenuLineText, &UiTimeText[i - 2]); /* Display under the menu directly */ UiDrawText(0, MenuInfo->Bottom + 4, MenuLineText, ATTR(UiMenuFgColor, UiMenuBgColor)); } else { /* Erase the timeout string with spaces, and 0-terminate for sure */ for (i=0; i<sizeof(MenuLineText)-1; i++) { MenuLineText[i] = ' '; } MenuLineText[sizeof(MenuLineText)-1] = 0; /* Draw this "empty" string to erase */ UiDrawText(0, MenuInfo->Bottom + 4, MenuLineText, ATTR(UiMenuFgColor, UiMenuBgColor)); } /* Loop each item */ for (i = 0; i < MenuInfo->MenuItemCount; i++) { /* Check if it's a separator */ if (MenuInfo->MenuItemList[i] == NULL) { /* Draw the separator line */ UiDrawText(MenuInfo->Left, MenuInfo->Top + i + 1, "/xC7", ATTR(UiMenuFgColor, UiMenuBgColor)); UiDrawText(MenuInfo->Right, MenuInfo->Top + i + 1, "/xB6", ATTR(UiMenuFgColor, UiMenuBgColor)); } }}
开发者ID:hoangduit,项目名称:reactos,代码行数:63,
示例23: list_bulk/** * Bulk filtering in the DB. */static int list_bulk(void){ attr_set_t root_attrs, attrs; entry_id_t root_id, id; int rc; struct stat st; struct lmgr_iterator_t *it; /* no tranvsersal => no wagon * so we need the path from the DB. */ query_mask |= ATTR_MASK_fullpath; ATTR_MASK_INIT(&root_attrs); rc = get_root_id(&root_id); if (rc) return rc; /* root is not a part of the DB: print it now */ ATTR_MASK_SET(&root_attrs, fullpath); strcpy(ATTR(&root_attrs, fullpath), config.global_config.fs_path); if (lstat(ATTR(&root_attrs, fullpath), &st) == 0) { PosixStat2EntryAttr(&st, &root_attrs, TRUE); ListMgr_GenerateFields(&root_attrs, disp_mask | query_mask); } /* root has no name... */ ATTR_MASK_SET(&root_attrs, name); ATTR(&root_attrs, name)[0] = '/0'; /* match condition on dirs parent */ if (!is_expr || (EntryMatches(&root_id, &root_attrs, &match_expr, NULL) == POLICY_MATCH)) { /* don't display dirs if no_dir is specified */ if (! (prog_options.no_dir && ATTR_MASK_TEST(&root_attrs, type) && !strcasecmp(ATTR(&root_attrs, type), STR_TYPE_DIR))) { wagon_t w; w.id = root_id; w.fullname = ATTR(&root_attrs, fullpath); print_entry(&w, &root_attrs); } } /* list all, including dirs */ it = ListMgr_Iterator(&lmgr, &entry_filter, NULL, NULL); if (!it) { DisplayLog(LVL_MAJOR, FIND_TAG, "ERROR: cannot retrieve entry list from database"); return -1; } attrs.attr_mask = disp_mask | query_mask; while ((rc = ListMgr_GetNext(it, &id, &attrs)) == DB_SUCCESS) { if (!is_expr || (EntryMatches(&id, &attrs, &match_expr, NULL) == POLICY_MATCH)) { /* don't display dirs if no_dir is specified */ if (! (prog_options.no_dir && ATTR_MASK_TEST(&attrs, type) && !strcasecmp(ATTR(&attrs, type), STR_TYPE_DIR))) { wagon_t w; w.id = id; w.fullname = ATTR(&attrs, fullpath); print_entry(&w, &attrs); } /* don't display non dirs is dir_only is specified */ else if (! (prog_options.dir_only && ATTR_MASK_TEST(&attrs, type) && strcasecmp(ATTR(&attrs, type), STR_TYPE_DIR))) { wagon_t w; w.id = id; w.fullname = ATTR(&attrs, fullpath); print_entry(&w, &attrs); } else /* return entry don't match? */ DisplayLog(LVL_DEBUG, FIND_TAG, "Warning: returned DB entry doesn't match filter: %s", ATTR(&attrs, fullpath)); } ListMgr_FreeAttrs(&attrs); /* prepare next call */ attrs.attr_mask = disp_mask | query_mask; } ListMgr_CloseIterator(it); return 0;}
开发者ID:fzago-cray,项目名称:robinhood,代码行数:93,
示例24: CHILDPATH const char * name; const char * graphPath; const char * childPath; const char * dft;};#define CHILDPATH(x) "att[@name='" x "']/@value"#define ATTR(kind, measure, path) { WA ## kind, measure, #kind, path, nullptr, nullptr }#define CHILD(kind, measure, path) { WA ## kind, measure, #kind, CHILDPATH(path), path, nullptr }#define CHILD_D(kind, measure, path, dft) { WA ## kind, measure, #kind, CHILDPATH(path), path, dft }const static WuAttrInfo attrInfo[] = { { WANone, SMeasureNone, "none", nullptr, nullptr, nullptr }, CHILD(Kind, SMeasureEnum, "_kind"), ATTR(Source, SMeasureText, "@source"), ATTR(Target, SMeasureText, "@target"), CHILD_D(SourceIndex, SMeasureText, "_sourceIndex", "0"), CHILD_D(TargetIndex, SMeasureText, "_targetIndex", "0"), ATTR(Label, SMeasureText, "@label"), CHILD(IsDependency, SMeasureBool, "_dependsOn"), CHILD(IsChildGraph, SMeasureBool, "_childGraph"), CHILD(Definition, SMeasureText, "definition"), CHILD(EclName, SMeasureText, "name"), { WAMax, SMeasureNone, nullptr, nullptr, nullptr, nullptr }};MODULE_INIT(INIT_PRIORITY_STANDARD){ static_assert(_elements_in(attrInfo) >= (WAMax-WANone)+1, "Elements missing from attrInfo[]");
开发者ID:fnisswandt,项目名称:HPCC-Platform,代码行数:31,
示例25: print_entrystatic inline void print_entry(const wagon_t *id, const attr_set_t * attrs){#ifdef ATTR_INDEX_status if (prog_options.match_status) { if (ATTR_MASK_TEST(attrs, status) && (ATTR(attrs, status) != prog_options.status)) { /* no match -> no display */ return; } }#endif if (prog_options.ls) { const char * type; char date_str[128]; char mode_str[128]; char uname[LOGIN_NAME_MAX]; char gname[LOGIN_NAME_MAX]; struct passwd *passwd; struct group *group;#ifdef ATTR_INDEX_status const char * status_str = ""; /* add status after type */ if (ATTR_MASK_TEST(attrs, status) && (ATTR(attrs, status) != STATUS_UNKNOWN)) status_str = db_status2str(ATTR(attrs, status), 1); /* 1 for brief */ #define STATUS_FORMAT "%-10s" #define STATUS_VAL ,status_str#else #define STATUS_FORMAT "" #define STATUS_VAL#endif /* type2char */ if (!ATTR_MASK_TEST(attrs, type)) type = "?"; else type = type2char(ATTR(attrs, type)); memset(mode_str, 0, sizeof(mode_str)); mode_string(ATTR(attrs, mode), mode_str); if (!ATTR_MASK_TEST(attrs, last_mod)) strcpy(date_str, ""); else { time_t tt; struct tm stm; tt = ATTR(attrs, last_mod); strftime(date_str, 128, "%Y/%m/%d %T", localtime_r(&tt, &stm)); } /* UID/GID to username/group. */ passwd = GetPwUid(ATTR(attrs, uid)); if (passwd) sprintf(uname, "%-10s", passwd->pw_name); else sprintf(uname, "%10u", ATTR(attrs, uid)); group = GetGrGid(ATTR(attrs, gid)); if (group) sprintf(gname, "%-10s", group->gr_name); else sprintf(gname, "%10u", ATTR(attrs, gid)); if (ATTR_MASK_TEST(attrs, type) && !strcmp(ATTR(attrs, type), STR_TYPE_LINK) && ATTR_MASK_TEST(attrs, link)) /* display: id, type, mode, nlink, (status,) owner, group, size, mtime, path -> link */ printf(DFID" %-4s %s %3u "STATUS_FORMAT"%-10s %-10s %15"PRIu64" %20s %s -> %s/n", PFID(&id->id), type, mode_str, ATTR(attrs, nlink) STATUS_VAL, uname, gname, ATTR(attrs, size), date_str, id->fullname, ATTR(attrs,link)); else /* display all: id, type, mode, nlink, (status,) owner, group, size, mtime, path */ printf(DFID" %-4s %s %3u "STATUS_FORMAT"%-10s %-10s %15"PRIu64" %20s %s/n", PFID(&id->id), type, mode_str, ATTR(attrs, nlink) STATUS_VAL, uname, gname, ATTR(attrs, size), date_str, id->fullname); } else if (prog_options.lsstat) { /* In the worst case scenario, each character will be escaped * to '/xXX'; so the string can be up to 4 time the name * length. */ char escaped_name[4*RBH_NAME_MAX+1]; /* Exclude any file with an uncomplete attributes. */ if ((attrs->attr_mask & LSSTAT_MASK) == LSSTAT_MASK) { printf("[%s,%u,%u,%zu,%lu,%lu,%lu]=%s/n", ATTR(attrs, type), ATTR(attrs, uid), ATTR(attrs, gid), ATTR(attrs, size), ATTR(attrs, ctime), ATTR(attrs, mtime), ATTR(attrs, atime), escape_name(id->fullname, escaped_name)); } else {//.........这里部分代码省略.........
开发者ID:fzago-cray,项目名称:robinhood,代码行数:101,
示例26: LOGvoid PostponeElement::enterElement(const Arabica::DOM::Element<std::string>& node) { if (!_interpreter->getDataModel()) { LOG(ERROR) << "Postpone element requires a datamodel"; return; } // under which condition will we postpone the current event? if (HAS_ATTR(node, "cond")) { std::string cond = ATTR(node, "cond"); try { if (!_interpreter->getDataModel().evalAsBool(cond)) return; } catch (Event e) { LOG(ERROR) << "Syntax error in cond attribute of postpone element:" << std::endl << e << std::endl; return; } } // chaining causes the event to fire if the condition was true since postponing bool chained = false; if (HAS_ATTR(node, "chaining")) { chained = iequals(ATTR(node, "chaining"), "true"); } // when will we refire the event? std::string until; try { if (HAS_ATTR(node, "untilexpr")) { until = _interpreter->getDataModel().evalAsString(ATTR(node, "untilexpr")); } else if (HAS_ATTR(node, "until")) { until = ATTR(node, "until"); } } catch (Event e) { LOG(ERROR) << "Syntax error in postpone element untilexpr:" << std::endl << e << std::endl; return; } if (until.length() == 0) { LOG(ERROR) << "Postpone element requires until or untilexpr attribute "; return; }// LOG(INFO) << until;#if 0 std::string timeoutStr = "0s"; try { if (HAS_ATTR(node, "timeoutexpr")) { timeoutStr = _interpreter->getDataModel().evalAsString(ATTR(node, "timeoutexpr")); } else if (HAS_ATTR(node, "timeout")) { timeoutStr = ATTR(node, "timeout"); } } catch (Event e) { LOG(ERROR) << "Syntax error in postpone element timeoutexpr:" << std::endl << e << std::endl; return; } uint64_t timeout = 0; NumAttr timeoutAttr(timeoutStr); if (iequals(timeoutAttr.unit, "s")) { timeout = strTo<int>(timeoutAttr.value) * 1000; } else if (iequals(timeoutAttr.unit, "ms")) { timeout = strTo<int>(timeoutAttr.value); } if (timeout > 0) { timeout += tthread::chrono::system_clock::now(); }#endif Event currEvent = _interpreter->getCurrentEvent(); Resubmitter::postpone(currEvent, until, 0, chained, _interpreter);}
开发者ID:sradomski,项目名称:uscxml,代码行数:71,
示例27: ENSUREvoid CGUI::Xeromyces_ReadObject(XMBElement Element, CXeromyces* pFile, IGUIObject *pParent, const std::vector<std::pair<CStr, CStr> >& NameSubst, boost::unordered_set<VfsPath>& Paths){ ENSURE(pParent); int i; // Our object we are going to create IGUIObject *object = NULL; XMBAttributeList attributes = Element.GetAttributes(); // Well first of all we need to determine the type CStr type (attributes.GetNamedItem(pFile->GetAttributeID("type"))); if (type.empty()) type = "empty"; // Construct object from specified type // henceforth, we need to do a rollback before aborting. // i.e. releasing this object object = ConstructObject(type); if (!object) { // Report error that object was unsuccessfully loaded LOGERROR(L"GUI: Unrecognized object type /"%hs/"", type.c_str()); return; } // Cache some IDs for element attribute names, to avoid string comparisons #define ELMT(x) int elmt_##x = pFile->GetElementID(#x) #define ATTR(x) int attr_##x = pFile->GetAttributeID(#x) ELMT(object); ELMT(action); ELMT(repeat); ATTR(style); ATTR(type); ATTR(name); ATTR(hotkey); ATTR(z); ATTR(on); ATTR(file); // // Read Style and set defaults // // If the setting "style" is set, try loading that setting. // // Always load default (if it's available) first! // CStr argStyle (attributes.GetNamedItem(attr_style)); if (m_Styles.count("default") == 1) object->LoadStyle(*this, "default"); if (! argStyle.empty()) { // additional check if (m_Styles.count(argStyle) == 0) { LOGERROR(L"GUI: Trying to use style '%hs' that doesn't exist.", argStyle.c_str()); } else object->LoadStyle(*this, argStyle); } // // Read Attributes // bool NameSet = false; bool ManuallySetZ = false; // if z has been manually set, this turn true CStr hotkeyTag; // Now we can iterate all attributes and store for (i=0; i<attributes.Count; ++i) { XMBAttribute attr = attributes.Item(i); // If value is "null", then it is equivalent as never being entered if (CStr(attr.Value) == "null") continue; // Ignore "type" and "style", we've already checked it if (attr.Name == attr_type || attr.Name == attr_style) continue; // Also the name needs some special attention if (attr.Name == attr_name) { CStr name (attr.Value); // Apply the requested substitutions for (size_t j = 0; j < NameSubst.size(); ++j) name.Replace(NameSubst[j].first, NameSubst[j].second); object->SetName(name); NameSet = true; continue; }//.........这里部分代码省略.........
开发者ID:Valvador,项目名称:PyroSpaceFork,代码行数:101,
示例28: recov_liststatic int recov_list(recov_type_e state){ struct lmgr_iterator_t *it; int rc; entry_id_t id; attr_set_t attrs; char buff[128]; recov_status_t st; const char *status; /* TODO iter opt */ it = ListMgr_RecovList(&lmgr, state); if (it == NULL) { fprintf(stderr, "ERROR: cannot get the list of entries/n"); return -1; } attrs.attr_mask = RECOV_ATTR_MASK; printf("%-8s %-15s %-40s %s/n", "type", "state", "path", "size"); while (!terminate && ((rc = ListMgr_RecovGetNext(it, &id, &attrs, &st)) != DB_END_OF_LIST)) { if (rc) { fprintf(stderr, "ERROR %d getting entry from recovery table/n", rc); ListMgr_CloseIterator(it); return rc; } FormatFileSize(buff, 128, ATTR(&attrs, size)); switch (st) { case RS_FILE_OK: status = "done"; break; case RS_FILE_DELTA: status = "done_old_data"; break; case RS_NON_FILE: status = "done_non_file"; break; case RS_FILE_EMPTY: status = "done_empty"; break; case RS_NOBACKUP: status = "done_no_backup"; break; case RS_ERROR: status = "failed"; break; case -1: status = "todo"; break; default: status = "?"; } printf("%-8s %-15s %-40s %s/n", ATTR(&attrs, type), status, ATTR(&attrs, fullpath), buff); /* reset mask */ attrs.attr_mask = RECOV_ATTR_MASK; } return 0;}
开发者ID:cea-hpc,项目名称:robinhood,代码行数:65,
示例29: ListMgr_GetChild/** * Get the list of children of a given parent (or list of parents). * /param parent_list [in] list of parents to get the child of * /param parent_count [in] number of ids in parent list * /param attr_mask [in] required attributes for children * /param child_id_list [out] ptr to array of child ids * /param child_attr_list [out] ptr to array of child attrs * /param child_count [out] number of returned children */int ListMgr_GetChild( lmgr_t * p_mgr, const lmgr_filter_t * p_filter, const wagon_t * parent_list, unsigned int parent_count, int attr_mask, wagon_t ** child_id_list, attr_set_t ** child_attr_list, unsigned int * child_count){ result_handle_t result; char *curr; int filter_main = 0; int filter_annex = 0; int main_attrs = 0; int dnames_attrs = 0; int annex_attrs = 0; char query[4096]; char fieldlist_main[1024] = ""; char fieldlist_dnames[1024] = ""; char fieldlist_annex[1024] = ""; char filter_str_main[1024] = ""; char filter_str_annex[1024] = ""; char tmp[2048]; char *path = NULL; int path_len; char * pc; int rc, i; /* TODO: querying children from several parent cannot work, since * we need to get the paths of the children. Or we could do a * lookup into parent_list to find the right one. In the meantime, * try not to mess up the code. */ if (parent_count != 1) RBH_BUG("cannot get children for several parent simultaneously"); /* always request for name to build fullpath in wagon */ attr_mask |= ATTR_MASK_name; /* request is always on the MAIN table (which contains [parent_id, id] relationship */ /* /!/ possible cases: * - simplest: the fields of the filter and the attributes to be retrieved are in the MAIN table * - harder: the fields of the filter and attributes are in a different table */ /* 1) location of filters */ if ( p_filter ) { char dummy_str[1024]; unsigned int dummy_uint; if (dir_filter(p_mgr, dummy_str, p_filter, &dummy_uint) != FILTERDIR_NONE) { DisplayLog( LVL_MAJOR, LISTMGR_TAG, "Directory filter not supported in %s()", __func__ ); return DB_NOT_SUPPORTED; } else if (func_filter(p_mgr, dummy_str, p_filter, T_MAIN, FALSE, FALSE)) { DisplayLog( LVL_MAJOR, LISTMGR_TAG, "Function filter not supported in %s()", __func__ ); return DB_NOT_SUPPORTED; } /* There is always a filter on T_DNAMES, which is the parent condition. * Look for optional filters: */ filter_main = filter2str( p_mgr, filter_str_main, p_filter, T_MAIN, FALSE, TRUE ); if ( annex_table ) filter_annex = filter2str( p_mgr, filter_str_annex, p_filter, T_ANNEX, FALSE, TRUE ); else filter_annex = 0; /* @TODO to be implemented */#if 0 filter_stripe_info = filter2str( p_mgr, filter_str_stripe_info, p_filter, T_STRIPE_INFO, ( filter_main > 0 ) || ( filter_annex > 0 ), TRUE ); filter_stripe_items = filter2str( p_mgr, filter_str_stripe_items, p_filter, T_STRIPE_ITEMS, ( filter_main > 0 ) || ( filter_annex > 0 ) || ( filter_stripe_info > 0 ), TRUE );#endif } /* 2) location of requested attributes */ if (attr_mask) { /* retrieve source info for generated fields */ add_source_fields_for_gen( &attr_mask ); main_attrs = attrmask2fieldlist( fieldlist_main, attr_mask, T_MAIN, /* leading comma */ TRUE, /* for update */ FALSE,//.........这里部分代码省略.........
开发者ID:karig,项目名称:robinhood,代码行数:101,
注:本文中的ATTR函数示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 C++ ATmatch函数代码示例 C++ ATTOSECONDS_IN_USEC函数代码示例 |