本文整理汇总了C++中emit函数的典型用法代码示例。如果您正苦于以下问题:C++ emit函数的具体用法?C++ emit怎么用?C++ emit使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了emit函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: switch
void
vec4_tes_visitor::nir_emit_intrinsic(nir_intrinsic_instr *instr)
{
const struct brw_tes_prog_data *tes_prog_data =
(const struct brw_tes_prog_data *) prog_data;
switch (instr->intrinsic) {
case nir_intrinsic_load_tess_coord:
/* gl_TessCoord is part of the payload in g1 channels 0-2 and 4-6. */
emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),
src_reg(brw_vec8_grf(1, 0))));
break;
case nir_intrinsic_load_tess_level_outer:
if (tes_prog_data->domain == BRW_TESS_DOMAIN_ISOLINE) {
emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),
swizzle(src_reg(ATTR, 1, glsl_type::vec4_type),
BRW_SWIZZLE_ZWZW)));
} else {
emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),
swizzle(src_reg(ATTR, 1, glsl_type::vec4_type),
BRW_SWIZZLE_WZYX)));
}
break;
case nir_intrinsic_load_tess_level_inner:
if (tes_prog_data->domain == BRW_TESS_DOMAIN_QUAD) {
emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),
swizzle(src_reg(ATTR, 0, glsl_type::vec4_type),
BRW_SWIZZLE_WZYX)));
} else {
emit(MOV(get_nir_dest(instr->dest, BRW_REGISTER_TYPE_F),
src_reg(ATTR, 1, glsl_type::float_type)));
}
break;
case nir_intrinsic_load_primitive_id:
emit(TES_OPCODE_GET_PRIMITIVE_ID,
get_nir_dest(instr->dest, BRW_REGISTER_TYPE_UD));
break;
case nir_intrinsic_load_input:
case nir_intrinsic_load_per_vertex_input: {
src_reg indirect_offset = get_indirect_offset(instr);
unsigned imm_offset = instr->const_index[0];
src_reg header = input_read_header;
bool is_64bit = nir_dest_bit_size(instr->dest) == 64;
unsigned first_component = nir_intrinsic_component(instr);
if (is_64bit)
first_component /= 2;
if (indirect_offset.file != BAD_FILE) {
header = src_reg(this, glsl_type::uvec4_type);
emit(TES_OPCODE_ADD_INDIRECT_URB_OFFSET, dst_reg(header),
input_read_header, indirect_offset);
} else {
/* Arbitrarily only push up to 24 vec4 slots worth of data,
* which is 12 registers (since each holds 2 vec4 slots).
*/
const unsigned max_push_slots = 24;
if (imm_offset < max_push_slots) {
const glsl_type *src_glsl_type =
is_64bit ? glsl_type::dvec4_type : glsl_type::ivec4_type;
src_reg src = src_reg(ATTR, imm_offset, src_glsl_type);
src.swizzle = BRW_SWZ_COMP_INPUT(first_component);
const brw_reg_type dst_reg_type =
is_64bit ? BRW_REGISTER_TYPE_DF : BRW_REGISTER_TYPE_D;
emit(MOV(get_nir_dest(instr->dest, dst_reg_type), src));
prog_data->urb_read_length =
MAX2(prog_data->urb_read_length,
DIV_ROUND_UP(imm_offset + (is_64bit ? 2 : 1), 2));
break;
}
}
if (!is_64bit) {
dst_reg temp(this, glsl_type::ivec4_type);
vec4_instruction *read =
emit(VEC4_OPCODE_URB_READ, temp, src_reg(header));
read->offset = imm_offset;
read->urb_write_flags = BRW_URB_WRITE_PER_SLOT_OFFSET;
src_reg src = src_reg(temp);
src.swizzle = BRW_SWZ_COMP_INPUT(first_component);
/* Copy to target. We might end up with some funky writemasks landing
* in here, but we really don't want them in the above pseudo-ops.
*/
dst_reg dst = get_nir_dest(instr->dest, BRW_REGISTER_TYPE_D);
dst.writemask = brw_writemask_for_size(instr->num_components);
emit(MOV(dst, src));
} else {
/* For 64-bit we need to load twice as many 32-bit components, and for
* dvec3/4 we need to emit 2 URB Read messages
*/
dst_reg temp(this, glsl_type::dvec4_type);
dst_reg temp_d = retype(temp, BRW_REGISTER_TYPE_D);
vec4_instruction *read =
emit(VEC4_OPCODE_URB_READ, temp_d, src_reg(header));
read->offset = imm_offset;
//.........这里部分代码省略.........
示例2: it
void BaseTrackPlayerImpl::slotFinishLoading(TrackPointer pTrackInfoObject)
{
m_replaygainPending = false;
// Read the tags if required
if (!m_pLoadedTrack->getHeaderParsed()) {
m_pLoadedTrack->parse(false);
}
// m_pLoadedTrack->setPlayedAndUpdatePlaycount(true); // Actually the song is loaded but not played
// Update the BPM and duration values that are stored in ControlObjects
m_pDuration->set(m_pLoadedTrack->getDuration());
m_pBPM->slotSet(m_pLoadedTrack->getBpm());
m_pKey->slotSet(m_pLoadedTrack->getKey());
m_pReplayGain->slotSet(m_pLoadedTrack->getReplayGain());
// Update the PlayerInfo class that is used in EngineShoutcast to replace
// the metadata of a stream
PlayerInfo::instance().setTrackInfo(getGroup(), m_pLoadedTrack);
// Reset the loop points.
m_pLoopInPoint->slotSet(-1);
m_pLoopOutPoint->slotSet(-1);
const QList<Cue*> trackCues = pTrackInfoObject->getCuePoints();
QListIterator<Cue*> it(trackCues);
while (it.hasNext()) {
Cue* pCue = it.next();
if (pCue->getType() == Cue::LOOP) {
int loopStart = pCue->getPosition();
int loopEnd = loopStart + pCue->getLength();
if (loopStart != -1 && loopEnd != -1 && even(loopStart) && even(loopEnd)) {
m_pLoopInPoint->slotSet(loopStart);
m_pLoopOutPoint->slotSet(loopEnd);
break;
}
}
}
if(m_pConfig->getValueString(ConfigKey("[Mixer Profile]", "EqAutoReset"), 0).toInt()) {
if (m_pLowFilter != NULL) {
m_pLowFilter->set(1.0);
}
if (m_pMidFilter != NULL) {
m_pMidFilter->set(1.0);
}
if (m_pHighFilter != NULL) {
m_pHighFilter->set(1.0);
}
if (m_pLowFilterKill != NULL) {
m_pLowFilterKill->set(0.0);
}
if (m_pMidFilterKill != NULL) {
m_pMidFilterKill->set(0.0);
}
if (m_pHighFilterKill != NULL) {
m_pHighFilterKill->set(0.0);
}
m_pPreGain->set(1.0);
}
int reset = m_pConfig->getValueString(ConfigKey(
"[Controls]", "SpeedAutoReset"),
QString("%1").arg(RESET_PITCH)).toInt();
switch (reset) {
case RESET_PITCH_AND_SPEED:
// Note: speed may affect pitch
if (m_pSpeed != NULL) {
m_pSpeed->set(0.0);
}
// Fallthrough intended
case RESET_PITCH:
if (m_pPitchAdjust != NULL) {
m_pPitchAdjust->set(0.0);
}
}
emit(newTrackLoaded(m_pLoadedTrack));
}
示例3: gen_cond
//Generate compare and branch quads
void gen_cond(node* expr, qnode* t, qnode* f) {
//printf("Processing conditional\n");
if(expr->type == BINOP_NODE) {
switch(expr->u.binop.type) {
case LT_OP:
emit(O_CMP, NULL, gen_rvalue(expr->u.binop.left, NULL), gen_rvalue(expr->u.binop.right, NULL));
emit(O_BRLT, NULL, t, f);
return;
case GT_OP:
emit(O_CMP, NULL, gen_rvalue(expr->u.binop.left, NULL), gen_rvalue(expr->u.binop.right, NULL));
emit(O_BRGT, NULL, t, f);
return;
case LTEQ_OP:
emit(O_CMP, NULL, gen_rvalue(expr->u.binop.left, NULL), gen_rvalue(expr->u.binop.right, NULL));
emit(O_BRLE, NULL, t, f);
return;
case GTEQ_OP:
emit(O_CMP, NULL, gen_rvalue(expr->u.binop.left, NULL), gen_rvalue(expr->u.binop.right, NULL));
emit(O_BRGE, NULL, t, f);
return;
case EQEQ_OP:
emit(O_CMP, NULL, gen_rvalue(expr->u.binop.left, NULL), gen_rvalue(expr->u.binop.right, NULL));
emit(O_BREQ, NULL, t, f);
return;
case NOTEQ_OP:
emit(O_CMP, NULL, gen_rvalue(expr->u.binop.left, NULL), gen_rvalue(expr->u.binop.right, NULL));
emit(O_BRNE, NULL, t, f);
return;
case LOGOR_OP: { //short circuit OR
block* temp = currentBlock;
block* bi = bb_newBlock(functionCount, ++blockCount, currentBlock); //intermediate block
currentBlock->next = bi;
t->u.block->prev = bi;
bi->next = t->u.block;
bi->prev = currentBlock;
gen_cond(expr->u.binop.left, t, blockToQnode(bi)); //test left expr
if(currentBlock != temp) {
currentBlock->next = bi;
}
currentBlock = bi;
gen_cond(expr->u.binop.right, t, f); //test right expr
//currentBlock = temp;
return;
}
case LOGAND_OP: { //short circuit AND
block* temp = currentBlock;
block* bi = bb_newBlock(functionCount, ++blockCount, currentBlock); //intermediate block
currentBlock->next = bi;
t->u.block->prev = bi;
bi->next = t->u.block;
bi->prev = currentBlock;
gen_cond(expr->u.binop.left, blockToQnode(bi), f); //test left expr
if(currentBlock != temp) {
currentBlock->next = bi;
}
currentBlock = bi;
gen_cond(expr->u.binop.right, t, f); //test right expr
//currentBlock = temp;
return;
}
default: {
break;
}
}
}
//gen_cond for non-conditional expr
qnode* val = gen_rvalue(expr, NULL);
qnode* zero = qnode_new(Q_CONSTANT);
zero->name = strdup("0");
zero->u.value = 0;
emit(O_CMP, NULL, val, zero);
emit(O_BRNE, NULL, t, f);
}
示例4: emit_decode_nohash
static void emit_decode_nohash(lcmgen_t *lcm, FILE *f, lcm_struct_t *ls)
{
const char* sn = ls->structname->shortname;
if(0 == g_ptr_array_size(ls->members)) {
emit(0, "int %s::_decodeNoHash(const void *, int, int)", sn);
emit(0, "{");
emit(1, "return 0;");
emit(0, "}");
emit(0, "");
return;
}
emit(0, "int %s::_decodeNoHash(const void *buf, int offset, int maxlen)", sn);
emit(0, "{");
emit(1, "int pos = 0, tlen;");
emit(0, "");
for (unsigned int m = 0; m < g_ptr_array_size(ls->members); m++) {
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(ls->members, m);
if (0 == g_ptr_array_size(lm->dimensions) && lcm_is_primitive_type(lm->type->lctypename)) {
if(!strcmp(lm->type->lctypename, "string")) {
emit(1, "int32_t __%s_len__;", lm->membername);
emit(1, "tlen = __int32_t_decode_array(buf, offset + pos, maxlen - pos, &__%s_len__, 1);", lm->membername);
emit(1, "if(tlen < 0) return tlen; else pos += tlen;");
emit(1, "if(__%s_len__ > maxlen - pos) return -1;", lm->membername);
emit(1, "this->%s.assign(((const char*)buf) + offset + pos, __%s_len__ - 1);", lm->membername, lm->membername);
emit(1, "pos += __%s_len__;", lm->membername);
} else {
emit(1, "tlen = __%s_decode_array(buf, offset + pos, maxlen - pos, &this->%s, 1);", lm->type->lctypename, lm->membername);
emit(1, "if(tlen < 0) return tlen; else pos += tlen;");
}
} else {
_decode_recursive(lcm, f, lm, 0);
}
emit(0,"");
}
emit(1, "return pos;");
emit(0, "}");
emit(0, "");
}
示例5: emit_encoded_size_nohash
static void emit_encoded_size_nohash(lcmgen_t *lcm, FILE *f, lcm_struct_t *ls)
{
const char *sn = ls->structname->shortname;
emit(0, "int %s::_getEncodedSizeNoHash() const", sn);
emit(0, "{");
if(0 == g_ptr_array_size(ls->members)) {
emit(1, "return 0;");
emit(0,"}");
emit(0,"");
return;
}
emit(1, "int enc_size = 0;");
for (unsigned int m = 0; m < g_ptr_array_size(ls->members); m++) {
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(ls->members, m);
int ndim = g_ptr_array_size(lm->dimensions);
if(lcm_is_primitive_type(lm->type->lctypename) &&
strcmp(lm->type->lctypename, "string")) {
emit_start(1, "enc_size += ");
for(int n=0; n < ndim - 1; n++) {
lcm_dimension_t *dim = (lcm_dimension_t*) g_ptr_array_index(lm->dimensions, n);
emit_continue("%s%s * ", dim_size_prefix(dim->size), dim->size);
}
if(ndim > 0) {
lcm_dimension_t *dim = (lcm_dimension_t*) g_ptr_array_index(lm->dimensions, ndim - 1);
emit_end("__%s_encoded_array_size(NULL, %s%s);",
lm->type->lctypename, dim_size_prefix(dim->size), dim->size);
} else {
emit_end("__%s_encoded_array_size(NULL, 1);", lm->type->lctypename);
}
} else {
for(int n=0; n < ndim; n++) {
lcm_dimension_t *dim = (lcm_dimension_t*) g_ptr_array_index(lm->dimensions, n);
emit(1+n, "for (int a%d = 0; a%d < %s%s; a%d++) {",
n, n, dim_size_prefix(dim->size), dim->size, n);
}
emit_start(ndim + 1, "enc_size += this->%s", lm->membername);
for(int i=0; i<ndim; i++)
emit_continue("[a%d]", i);
if(!strcmp(lm->type->lctypename, "string")) {
emit_end(".size() + 4 + 1;");
} else {
emit_end("._getEncodedSizeNoHash();");
}
for(int n=ndim-1; n >= 0; n--) {
emit(1 + n, "}");
}
}
}
emit(1, "return enc_size;");
emit(0,"}");
emit(0,"");
}
示例6: emit_compute_hash
static void emit_compute_hash(lcmgen_t *lcm, FILE *f, lcm_struct_t *ls)
{
const char *sn = ls->structname->shortname;
int last_complex_member = -1;
for (unsigned int m = 0; m < g_ptr_array_size(ls->members); m++) {
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(ls->members, m);
if(!lcm_is_primitive_type(lm->type->lctypename))
last_complex_member = m;
}
if(last_complex_member >= 0) {
emit(0, "int64_t %s::_computeHash(const __lcm_hash_ptr *p)", sn);
emit(0, "{");
emit(1, "const __lcm_hash_ptr *fp;");
emit(1, "for(fp = p; fp != NULL; fp = fp->parent)");
emit(2, "if(fp->v == %s::getHash)", sn);
emit(3, "return 0;");
if(g_ptr_array_size(ls->members)) {
emit(1, "const __lcm_hash_ptr cp = { p, (void*)%s::getHash };", sn);
}
emit(0, "");
emit(1, "int64_t hash = 0x%016"PRIx64"LL +", ls->hash);
for (unsigned int m = 0; m <= last_complex_member; m++) {
lcm_member_t *lm = (lcm_member_t *) g_ptr_array_index(ls->members, m);
char* lm_tnc = dots_to_double_colons(lm->type->lctypename);
if(!lcm_is_primitive_type(lm->type->lctypename)) {
emit(2, " %s::_computeHash(&cp)%s",
lm_tnc,
(m == last_complex_member) ? ";" : " +");
}
free(lm_tnc);
}
emit(0, "");
} else {
emit(0, "int64_t %s::_computeHash(const __lcm_hash_ptr *)", sn);
emit(0, "{");
emit(1, "int64_t hash = 0x%016"PRIx64"LL;", ls->hash);
}
emit(1, "return (hash<<1) + ((hash>>63)&1);");
emit(0, "}");
emit(0, "");
}
示例7: emit_encode
static void emit_encode(lcmgen_t *lcm, FILE *f, lcm_struct_t *ls)
{
const char* sn = ls->structname->shortname;
emit(0, "int %s::encode(void *buf, int offset, int maxlen) const", sn);
emit(0, "{");
emit(1, "int pos = 0, tlen;");
emit(1, "int64_t hash = getHash();");
emit(0, "");
emit(1, "tlen = __int64_t_encode_array(buf, offset + pos, maxlen - pos, &hash, 1);");
emit(1, "if(tlen < 0) return tlen; else pos += tlen;");
emit(0, "");
emit(1, "tlen = this->_encodeNoHash(buf, offset + pos, maxlen - pos);");
emit(1, "if (tlen < 0) return tlen; else pos += tlen;");
emit(0, "");
emit(1, "return pos;");
emit(0, "}");
emit(0, "");
}
示例8: activate
void ITunesFeature::activate() {
activate(false);
emit(enableCoverArtDisplay(false));
}
示例9: preload_distance_bands
/***************************************************************************
* Name: preload_distance_bands
*
* Description: pre-load the array which defines all distance bands
* defined in the DB. These are specified in the
* DISTANCE_BANDS table.
*
* Input: connection - dataserver conn.
* Output: none
* Returns: number of rows loaded, or
* -1 on ERROR
* Globals: sDistanceBands
* giNumDistanceBands
* Stored Proc: mps_load_distance_bands
*****************************************************************************/
int preload_distance_bands(Arb_connection *connection)
{
int which;
tiny distance_band_id;
int type_id_usg;
int jurisdiction;
char access_region_origin[szAccessRegion+1];
int element_id;
int min_distance;
int max_distance;
if( arb_setup_results(&proc_mps_load_distance_bands,
ARB_TYPE_INT8, &distance_band_id,
ARB_TYPE_INT32, &type_id_usg,
ARB_TYPE_INT32, &jurisdiction,
ARB_TYPE_STRING, access_region_origin, sizeof(access_region_origin),
ARB_TYPE_INT32, &element_id,
ARB_TYPE_INT32, &min_distance,
ARB_TYPE_INT32, &max_distance,
NO_MORE_ARGS) != SUCCESS)
{
return(-1);
}
if( arb_setup_proc_exec(connection,
&proc_mps_load_distance_bands, SQL_DEFER_EXECUTE,
NO_MORE_ARGS) != SUCCESS)
{
return(-1);
}
which = 0;
while( arb_next_row(connection) == ARB_MORE_DATA )
{
if(which >= giNumDistanceBands)
{
arb_cancel(connection);
emit(ERRLOC, MPS_TOO_MANY_ROWS, "proc_mps_load_distance_bands",
which+1, giNumDistanceBands);
return(-1);
}
sDistanceBands[which].distance_band_id = distance_band_id;
sDistanceBands[which].type_id_usg = type_id_usg;
sDistanceBands[which].jurisdiction = jurisdiction;
strcpy(sDistanceBands[which].access_region_origin,access_region_origin);
sDistanceBands[which].element_id = element_id;
sDistanceBands[which].min_distance = min_distance;
sDistanceBands[which].max_distance = max_distance;
which++;
}
if( arb_query_status(connection) != SUCCESS )
{
arb_cancel(connection);
emit(ERRLOC, MPS_DBERR, "proc_mps_load_distance_bands");
return(-1);
}
emit(ERRLOC, MPS_DIST_BANDS_LOAD, which);
return(which);
}
示例10: preload_state_exclusion
/***************************************************************************
* Name: preload_state_exclusion
*
* Description: preload the array which defines all jurisdictions with either
* state_origin_exclude = true or state_origin_exclude = true
* in USAGE_JURISDICTION table.
*
* Input: connection - dataserver conn.
* Output: none
* Returns: number of rows loaded, or
* -1 on ERROR
* Globals: gsStateExclusion
* giNumStateExclusion
* Stored Proc: mps_load_state_exclusion
*****************************************************************************/
int preload_state_exclusion(Arb_connection *connection)
{
int which;
USAGE_JURISDICTION_STRUCT tmp;
if( arb_setup_results(&proc_mps_load_state_exclusion,
ARB_TYPE_INT32, &(tmp.seqnum),
ARB_TYPE_INT32, &(tmp.type_id_usg),
ARB_TYPE_INT32, &(tmp.element_id),
ARB_TYPE_INT16, &(tmp.rate_class),
ARB_TYPE_INT16, &(tmp.equip_type_code),
ARB_TYPE_INT16, &(tmp.equip_class_code),
ARB_TYPE_INT16, &(tmp.class_of_service_code),
ARB_TYPE_STRING, (tmp.point_origin), szUsagePoint+1,
ARB_TYPE_STRING, (tmp.point_target), szUsagePoint+1,
ARB_TYPE_INT32, &(tmp.point_class_origin),
ARB_TYPE_INT32, &(tmp.point_class_target),
ARB_TYPE_STRING, (tmp.point_region_origin), szPointRegion+1,
ARB_TYPE_STRING, (tmp.point_region_target), szPointRegion+1,
ARB_TYPE_STRING, (tmp.state_origin), szStateAbbr+1,
ARB_TYPE_STRING, (tmp.state_target), szStateAbbr+1,
ARB_TYPE_INT8, &(tmp.state_origin_exclude),
ARB_TYPE_INT8, &(tmp.state_target_exclude),
ARB_TYPE_STRING, (tmp.access_region_origin), szAccessRegion+1,
ARB_TYPE_STRING, (tmp.access_region_target), szAccessRegion+1,
ARB_TYPE_INT32, &(tmp.priority),
ARB_TYPE_INT16, &(tmp.exclude_group),
ARB_TYPE_INT32, &(tmp.jurisdiction),
ARB_TYPE_INT16, &(tmp.country_code_origin),
ARB_TYPE_INT16, &(tmp.country_code_target),
ARB_TYPE_DATELONG,&(tmp.active_dt),
ARB_TYPE_DATELONG,&(tmp.inactive_dt),
ARB_TYPE_INT16, &(tmp.bill_class),
ARB_TYPE_INT8, &(tmp.zone_class),
NO_MORE_ARGS) != SUCCESS )
{
return(-1);
}
if( arb_setup_proc_exec(connection,
&proc_mps_load_state_exclusion, SQL_DEFER_EXECUTE,
NO_MORE_ARGS) != SUCCESS)
{
return(-1);
}
which = 0;
while( arb_next_row(connection) == ARB_MORE_DATA )
{
if( which >= giNumStateExclusion )
{
arb_cancel(connection);
emit(ERRLOC, MPS_TOO_MANY_ROWS, "proc_mps_load_state_exclusion",
which+1, giNumStateExclusion);
return(-1);
}
memcpy((char *)&gsStateExclusion[which], (char *)&tmp,
sizeof(USAGE_JURISDICTION_STRUCT));
which++;
}
if( arb_query_status(connection) != SUCCESS )
{
arb_cancel(connection);
emit(ERRLOC, MPS_DBERR, "proc_mps_load_state_exclusion");
return(-1);
}
emit(ERRLOC, MPS_STATE_EXCLUDE, which);
return(which);
}
示例11: Q_UNUSED
void Button::mousePressedInternal(QMouseEvent* ev, const QPoint& pos) {
Q_UNUSED(ev);
Q_UNUSED(pos);
emit(clicked());
}
示例12: emit
void QgsComposerView::showEvent( QShowEvent* e )
{
emit( composerViewShow( this ) );
e->ignore();
}
示例13: HG_
void HG_(pp_Error) ( const Error* err )
{
const Bool xml = VG_(clo_xml); /* a shorthand, that's all */
if (!xml) {
VG_(umsg)("--------------------------------"
"--------------------------------" "\n");
VG_(umsg)("\n");
}
XError *xe = (XError*)VG_(get_error_extra)(err);
tl_assert(xe);
if (xml)
emit( " <kind>%s</kind>\n", HG_(get_error_name)(err));
switch (VG_(get_error_kind)(err)) {
case XE_Misc: {
tl_assert( HG_(is_sane_Thread)( xe->XE.Misc.thr ) );
if (xml) {
emit( " <xwhat>\n" );
emit( " <text>Thread #%d: %s</text>\n",
(Int)xe->XE.Misc.thr->errmsg_index,
xe->XE.Misc.errstr );
emit( " <hthreadid>%d</hthreadid>\n",
(Int)xe->XE.Misc.thr->errmsg_index );
emit( " </xwhat>\n" );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
if (xe->XE.Misc.auxstr) {
emit(" <auxwhat>%s</auxwhat>\n", xe->XE.Misc.auxstr);
if (xe->XE.Misc.auxctx)
VG_(pp_ExeContext)( xe->XE.Misc.auxctx );
}
} else {
emit( "Thread #%d: %s\n",
(Int)xe->XE.Misc.thr->errmsg_index,
xe->XE.Misc.errstr );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
if (xe->XE.Misc.auxstr) {
emit(" %s\n", xe->XE.Misc.auxstr);
if (xe->XE.Misc.auxctx)
VG_(pp_ExeContext)( xe->XE.Misc.auxctx );
}
}
break;
}
case XE_LockOrder: {
tl_assert( HG_(is_sane_Thread)( xe->XE.LockOrder.thr ) );
if (xml) {
emit( " <xwhat>\n" );
emit( " <text>Thread #%d: lock order \"%p before %p\" "
"violated</text>\n",
(Int)xe->XE.LockOrder.thr->errmsg_index,
(void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr,
(void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr );
emit( " <hthreadid>%d</hthreadid>\n",
(Int)xe->XE.LockOrder.thr->errmsg_index );
emit( " </xwhat>\n" );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
if (xe->XE.LockOrder.shouldbe_earlier_ec
&& xe->XE.LockOrder.shouldbe_later_ec) {
emit( " <auxwhat>Required order was established by "
"acquisition of lock at %p</auxwhat>\n",
(void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr );
VG_(pp_ExeContext)( xe->XE.LockOrder.shouldbe_earlier_ec );
emit( " <auxwhat>followed by a later acquisition "
"of lock at %p</auxwhat>\n",
(void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr );
VG_(pp_ExeContext)( xe->XE.LockOrder.shouldbe_later_ec );
}
announce_LockP ( xe->XE.LockOrder.shouldbe_earlier_lk );
announce_LockP ( xe->XE.LockOrder.shouldbe_later_lk );
} else {
emit( "Thread #%d: lock order \"%p before %p\" violated\n",
(Int)xe->XE.LockOrder.thr->errmsg_index,
(void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr,
(void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr );
emit( "\n" );
emit( "Observed (incorrect) order is: "
"acquisition of lock at %p\n",
(void*)xe->XE.LockOrder.shouldbe_later_lk->guestaddr);
if (xe->XE.LockOrder.actual_earlier_ec) {
VG_(pp_ExeContext)(xe->XE.LockOrder.actual_earlier_ec);
} else {
emit(" (stack unavailable)\n");
}
emit( "\n" );
emit(" followed by a later acquisition of lock at %p\n",
(void*)xe->XE.LockOrder.shouldbe_earlier_lk->guestaddr);
//.........这里部分代码省略.........
示例14: pc_pp_Error
void pc_pp_Error ( const Error* err )
{
const Bool xml = VG_(clo_xml); /* a shorthand, that's all */
XError *xe = (XError*)VG_(get_error_extra)(err);
tl_assert(xe);
if (xml)
emit( " <kind>%s</kind>\n", pc_get_error_name(err));
switch (VG_(get_error_kind)(err)) {
//----------------------------------------------------------
case XE_SorG:
if (xml) {
emit( " <what>Invalid %s of size %ld</what>\n",
xe->XE.SorG.sszB < 0 ? "write" : "read",
Word__abs(xe->XE.SorG.sszB) );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
emit( " <auxwhat>Address %#lx expected vs actual:</auxwhat>\n",
xe->XE.SorG.addr );
emiN( " <auxwhat>Expected: %pS</auxwhat>\n",
&xe->XE.SorG.expect[0] );
emiN( " <auxwhat>Actual: %pS</auxwhat>\n",
&xe->XE.SorG.actual[0] );
} else {
emit( "Invalid %s of size %ld\n",
xe->XE.SorG.sszB < 0 ? "write" : "read",
Word__abs(xe->XE.SorG.sszB) );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
emit( " Address %#lx expected vs actual:\n", xe->XE.SorG.addr );
emit( " Expected: %s\n", &xe->XE.SorG.expect[0] );
emit( " Actual: %s\n", &xe->XE.SorG.actual[0] );
if (xe->XE.SorG.delta[0] != 0)
emit(" Actual: is %s Expected\n", &xe->XE.SorG.delta[0]);
}
break;
//----------------------------------------------------------
case XE_Heap: {
const HChar *place, *legit, *how_invalid;
Addr a = xe->XE.Heap.addr;
Seg* vseg = xe->XE.Heap.vseg;
tl_assert(is_known_segment(vseg) || NONPTR == vseg);
if (NONPTR == vseg) {
// Access via a non-pointer
if (xml) {
emit( " <what>Invalid %s of size %ld</what>\n",
readwrite(xe->XE.Heap.sszB),
Word__abs(xe->XE.Heap.sszB) );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
emit( " <auxwhat>Address %#lx is not derived from "
"any known block</auxwhat>\n", a );
} else {
emit( "Invalid %s of size %ld\n",
readwrite(xe->XE.Heap.sszB),
Word__abs(xe->XE.Heap.sszB) );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
emit( " Address %#lx is not derived from "
"any known block\n", a );
}
} else {
// Access via a pointer, but outside its range.
Int cmp;
UWord miss_size;
Seg__cmp(vseg, a, &cmp, &miss_size);
if (cmp < 0) place = "before";
else if (cmp == 0) place = "inside";
else place = "after";
how_invalid = ( ( Seg__is_freed(vseg) && 0 != cmp )
? "Doubly-invalid" : "Invalid" );
legit = ( Seg__is_freed(vseg) ? "once-" : "" );
if (xml) {
emit( " <what>%s %s of size %ld</what>\n",
how_invalid,
readwrite(xe->XE.Heap.sszB),
Word__abs(xe->XE.Heap.sszB) );
VG_(pp_ExeContext)( VG_(get_error_where)(err) );
emit( " <auxwhat>Address %#lx is %lu bytes %s "
"the accessing pointer's</auxwhat>\n",
a, miss_size, place );
//.........这里部分代码省略.........
示例15: while
bool ARMEventTreat::ProcessEachCollectable(KTKvectorIterator<IKEBarmCollectableHdl> collectableIterator,
ARMTreatStrategy* pTreatStrat,
ARMCollectorStrategy* pCollectorStrat,
ARMScenarioStrategy* pEventScenarioStrat,
KTKautoPtr<KTKexception> & pError)
{
KTKvariant scenarioId, collectorId;
ARMHistoryLog* hl = ARMHistoryLog::GetARMHistoryLog(_armEntitiesFactory ,pError);
Arb_connection * pConn=_dbConnectionCust;
// for each collectable
char trans_name[100] ="processCollectable";
KTKvariant presentFlag,warnFlag;
bool transStatus = false; // status of the transaction
while(collectableIterator.More())
{
IKEBarmCollectableHdl collectable = *collectableIterator++;
KTKvariant accountNo = collectable->GetAccountNo();
//CAMqa89374
//KTKvariant balance = collectable->GetArmBalanceDue();
int balance;
Arb_numeric bal = collectable->GetArmBalanceDue();
arb_numeric_to_int(&bal,&balance);
//CAMqa89374
arb_begin_tran(pConn,trans_name);
emit( ARMMOD, ARM_EVENT_TREAT_START_EACH_ACCT , collectable->GetAccountNo().AsInt(), collectable->GetBillRefNo().AsInt(),
collectable->GetBillRefResets().AsInt(), collectable->GetOpenItemId().AsInt() );
transStatus = pEventScenarioStrat->GetExtEventScenarioId(collectable,
_strategyValueMap[ARMEventTreat::STRAT_GET_EXT_EVENT_SCENARIO],
scenarioId,
pError);
if (transStatus)
{
transStatus = pEventScenarioStrat->SetScenarioId(collectable,
scenarioId,
pError);
}
if (transStatus)
{
if (_strategyValueMap[ARMTreat::STRAT_GET_COLLECTOR] == 1)
{
transStatus = pCollectorStrat->CheckCollectorId(scenarioId,
accountNo,
collectorId,
presentFlag,
warnFlag,
pError);
if (warnFlag.AsInt() == 1)
emit (ARMMOD, ARM_INVALID_SCENARIO, accountNo.AsInt(), collectorId.AsInt(), scenarioId.AsInt());
}
}
if (transStatus)
{
if ((_strategyValueMap[ARMTreat::STRAT_GET_COLLECTOR] != 1) || ((_strategyValueMap[ARMTreat::STRAT_GET_COLLECTOR
] == 1) && (presentFlag.AsInt() == 0)))
{
transStatus = pCollectorStrat->GetCollectorId(scenarioId,
_strategyValueMap[ARMTreat::STRAT_GET_COLLECTOR],
collectorId,
pError);
}
}
if (transStatus)
{
transStatus = pCollectorStrat->SetCollectorId(collectable,
collectorId,
pError);
}
if (transStatus)
{
transStatus = pTreatStrat->ArmCollectableSave(collectable, pError);
}
if (transStatus)
{
pTreatStrat->MakeEventQueue(collectable->GetCollectableId(),
collectable->GetCollectableServ(),
pError);
}
if (!transStatus)
{
emit( ARMMOD, ARM_EVENT_TREAT_FAIL ,accountNo.AsInt() , collectable->GetBillRefNo().AsInt() ,
collectable->GetBillRefResets().AsInt(), collectable->GetOpenItemId().AsInt());
arb_rollback_tran(pConn,trans_name);
KTKstring scenId = "";
KTKstring collId = "";
_ctrlRpt->ControlReportDetail(false, collectable, &scenId, &collId, pError);
if(!hl->RegisterOccurance(pError, MSTONE_FAIL_EVENTTREAT, collectable))
//.........这里部分代码省略.........