当前位置: 首页>>代码示例>>C++>>正文


C++ ATTR函数代码示例

本文整理汇总了C++中ATTR函数的典型用法代码示例。如果您正苦于以下问题:C++ ATTR函数的具体用法?C++ ATTR怎么用?C++ ATTR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了ATTR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: ListMgr_Update

int 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,代码来源:listmgr_update.c

示例2: check_executor

static 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,代码来源:checker.c

示例3: recov_resume

static 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,代码来源:rbh_recov.c

示例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,代码来源:listmgr_get.c

示例5: UiDrawBackdrop

VOID
UiDrawBackdrop(VOID)
{
    /* Clear the screen */
    MachVideoClearScreen(ATTR(COLOR_WHITE, COLOR_BLACK));
}
开发者ID:hoangduit,项目名称:reactos,代码行数:6,代码来源:directui.c

示例6: LOG

void 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,代码来源:RespondElement.cpp

示例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,代码来源:acoslmem.c

示例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,代码来源:dm-glob.c

示例9: switch

void 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,代码来源:xmlparser.cpp

示例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,代码来源:ServerSelfbindsSimpleCollection.c

示例11: ATTR

ssize_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,代码来源:debug.c

示例12: op_makewindow

P 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,代码来源:dm9.c

示例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,代码来源:debug.c

示例14: ATTR

void 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,代码来源:XPathDataModel.cpp

示例15: result2attrset

int 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,代码来源:listmgr_common.c


注:本文中的ATTR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。