本文整理汇总了C++中print_attributes函数的典型用法代码示例。如果您正苦于以下问题:C++ print_attributes函数的具体用法?C++ print_attributes怎么用?C++ print_attributes使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了print_attributes函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: handlefunction
int handlefunction(astree node, FILE* outfile){
astree type = node->first;
astree ident = node->first->first;
astree param = node->first->next->first;
bitset_t newattrs = bitlookup(type->symbol);
node->attrs = newattrs;
cstring funcname = peek_stringtable(ident->lexinfo);
sym_noderef lookup = search_sym_table(ident,gident_tbl);
if (lookup != NULL){
if (lookup->attributes & ATTR_PROTOTYPE){
//found previous func declaration, it's a prototype
if (lookup->attributes == ((newattrs | ATTR_PROTOTYPE))){
if(paramcheck(param,lookup->nextparam,funcname)){
return 1;
}
} else {
print_attributes(stdout,(ATTR_PROTOTYPE + ATTR_BOOL));
eprintf("\n");
print_attributes(stdout,(newattrs|ATTR_PROTOTYPE));
eprintf("\n");
//func declaration does not match prototype's type
eprintf(
"prototype's type does not match function declaration %s\n",
funcname);
}
} else {
//found previous func declaration, it's not a prototype
eprintf(
"redeclaring function %s at line %d\n",
peek_stringtable(ident->lexinfo),ident->linenr-1);
eprintf(
"(previously declared at line %d)\n",lookup->linenr-1);
return 1;
}
} else {
ident->attrs = ATTR_FUNCTION | bitlookup(type->symbol);
sym_noderef temp = intern_sym_table(ident,gident_tbl,outfile);
push_block(gblock_stk);
for(;param != NULL; param = param->next){
param->first->attrs = bitlookup(param->symbol) | ATTR_PARAM;
param->first->blocknr = gblock_stk->top->blocknr;
temp->nextparam =
intern_sym_table(param->first,gident_tbl,outfile);
temp = temp->nextparam;
}
pop_idents(gident_tbl,gblock_stk->top->blocknr);
pop_block(gblock_stk);
}
return 0;
}
示例2: trace
// This method is called while executing the raw bytecodes, so none of
// the adjustments that BytecodeStream performs applies.
void trace(methodHandle method, address bcp, uintptr_t tos, uintptr_t tos2) {
MutexLocker ml(BytecodeTrace_lock);
ResourceMark rm;
if (_current_method != method()) {
// Note 1: This code will not work as expected with true MT/MP.
// Need an explicit lock or a different solution.
tty->cr();
tty->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
method->print_name(tty);
tty->cr();
_current_method = method();
}
Bytecodes::Code code;
if (is_wide()) {
// bcp wasn't advanced if previous bytecode was _wide.
code = Bytecodes::cast(*(bcp+1));
} else {
code = Bytecodes::cast(*bcp);
}
int bci = bcp - method->code_base();
tty->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
if (Verbose) {
tty->print("%8d %4d " INTPTR_FORMAT " " INTPTR_FORMAT " %s",
BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code));
} else {
tty->print("%8d %4d %s",
BytecodeCounter::counter_value(), bci, Bytecodes::name(code));
}
_next_pc = is_wide() ? bcp+2 : bcp+1;
print_attributes(code, bci);
// Set is_wide for the next one, since the caller of this doesn't skip
// the next bytecode.
_is_wide = (code == Bytecodes::_wide);
}
示例3: print_element_node
inline OutIt print_element_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
assert(node->type() == node_element);
// Print element name and attributes, if any
if (!(flags & print_no_indenting)) {
//out = fill_chars(out, indent, Ch('\t'));
out = fill_chars(out, indent, Ch(' '));
out = fill_chars(out, indent, Ch(' '));
}
*out = Ch('<'), ++out;
out = copy_chars(node->name(), node->name() + node->name_size(), out);
out = print_attributes(out, node);
// If node is childless
if (node->value_size() == 0 && !node->first_node())
{
// Print childless node tag ending
*out = Ch('/'), ++out;
*out = Ch('>'), ++out;
}
else
{
// Print normal node tag ending
*out = Ch('>'), ++out;
// Test if node contains a single data node only (and no other nodes)
xml_node<Ch> *child = node->first_node();
if (!child)
{
// If node has no children, only print its value without indenting
out = copy_and_expand_chars(node->value(), node->value() + node->value_size(), Ch(0), out);
}
else if (child->next_sibling() == 0 && child->type() == node_data)
{
// If node has a sole data child, only print its value without indenting
out = copy_and_expand_chars(child->value(), child->value() + child->value_size(), Ch(0), out);
}
else
{
// Print all children with full indenting
if (!(flags & print_no_indenting))
*out = Ch('\n'), ++out;
out = print_children(out, node, flags, indent + 1);
if (!(flags & print_no_indenting)) {
//out = fill_chars(out, indent, Ch('\t'));
out = fill_chars(out, indent, Ch(' '));
out = fill_chars(out, indent, Ch(' '));
}
}
// Print node end
*out = Ch('<'), ++out;
*out = Ch('/'), ++out;
out = copy_chars(node->name(), node->name() + node->name_size(), out);
*out = Ch('>'), ++out;
}
return out;
}
示例4: old_main
int old_main (int argc, char** argv)
{
IDeckLinkIterator* deckLinkIterator;
IDeckLink* deckLink;
int numDevices = 0;
HRESULT result;
// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL)
{
fprintf(stderr, "A DeckLink iterator could not be created. The DeckLink drivers may not be installed.\n");
return 1;
}
// Enumerate all cards in this system
while (deckLinkIterator->Next(&deckLink) == S_OK)
{
char * deviceNameString = NULL;
// Increment the total number of DeckLink cards found
numDevices++;
if (numDevices > 1)
printf("\n\n");
// *** Print the model name of the DeckLink card
result = deckLink->GetModelName((const char **) &deviceNameString);
if (result == S_OK)
{
printf("=============== %s ===============\n\n", deviceNameString);
free(deviceNameString);
}
print_attributes(deckLink);
// ** List the video output display modes supported by the card
print_output_modes(deckLink);
// ** List the video input display modes supported by the card
print_input_modes(deckLink);
// ** List the input and output capabilities of the card
print_capabilities(deckLink);
// Release the IDeckLink instance when we've finished with it to prevent leaks
deckLink->Release();
}
deckLinkIterator->Release();
// If no DeckLink cards were found in the system, inform the user
if (numDevices == 0)
printf("No Blackmagic Design devices were found.\n");
printf("\n");
return 0;
}
示例5: print_unit
void print_unit(unit *unit) {
printf("type %d, state %s, vector (%f, %f, %f)\n",
unit->type,
((state *)unit->state->value)->name,
x(unit->position),
y(unit->position),
z(unit->position));
printf("\t");
print_attributes(unit->attributes);
printf("\t");
print_weapons(unit->weapons);
}
示例6: CreateDeckLinkIteratorInstance
vector<ofVideoDevice> ofxBlackmagicGrabber::listDevices() {
IDeckLinkIterator* deckLinkIterator;
IDeckLink* deckLink;
int numDevices = 0;
HRESULT result;
vector<ofVideoDevice> devices;
// Create an IDeckLinkIterator object to enumerate all DeckLink cards in the system
deckLinkIterator = CreateDeckLinkIteratorInstance();
if (deckLinkIterator == NULL){
ofLogError(LOG_NAME) << "A DeckLink iterator could not be created. The DeckLink drivers may not be installed.";
}
// Enumerate all cards in this system
while (deckLinkIterator->Next(&deckLink) == S_OK){
CFStringRef deviceNameString;
// Increment the total number of DeckLink cards found
numDevices++;
if (numDevices > 1)
printf("\n\n");
// *** Print the model name of the DeckLink card
result = deckLink->GetModelName(&deviceNameString);
if (result == S_OK)
{
printf("=============== %s ===============\n\n", deviceNameString);
// free(deviceNameString);
}
print_attributes(deckLink);
// ** List the video output display modes supported by the card
print_output_modes(deckLink);
// ** List the input and output capabilities of the card
print_capabilities(deckLink);
// Release the IDeckLink instance when we've finished with it to prevent leaks
deckLink->Release();
}
deckLinkIterator->Release();
// If no DeckLink cards were found in the system, inform the user
if (numDevices == 0)
ofLogError(LOG_NAME) << "No Blackmagic Design devices were found.";
return devices;
}
示例7: print_model
/***********************************************************************//**
* @brief Print model information
***************************************************************************/
std::string GModelSky::print_model(void) const
{
// Initialise result string
std::string result;
// Determine number of parameters per type
int n_spatial = (m_spatial != NULL) ? m_spatial->size() : 0;
int n_spectral = (m_spectral != NULL) ? m_spectral->size() : 0;
int n_temporal = (m_temporal != NULL) ? m_temporal->size() : 0;
// Append attributes
result.append(print_attributes());
// Append model type
result.append("\n"+parformat("Model type"));
if (n_spatial > 0) {
result.append("\""+spatial()->type()+"\"");
if (n_spectral > 0 || n_temporal > 0) {
result.append(" * ");
}
}
if (n_spectral > 0) {
result.append("\""+spectral()->type()+"\"");
if (n_temporal > 0) {
result.append(" * ");
}
}
if (n_temporal > 0) {
result.append("\""+temporal()->type()+"\"");
}
// Append parameters
result.append("\n"+parformat("Number of parameters")+str(size()));
result.append("\n"+parformat("Number of spatial par's")+str(n_spatial));
for (int i = 0; i < n_spatial; ++i) {
result.append("\n"+(*spatial())[i].print());
}
result.append("\n"+parformat("Number of spectral par's")+str(n_spectral));
for (int i = 0; i < n_spectral; ++i) {
result.append("\n"+(*spectral())[i].print());
}
result.append("\n"+parformat("Number of temporal par's")+str(n_temporal));
for (int i = 0; i < n_temporal; ++i) {
result.append("\n"+(*temporal())[i].print());
}
// Return result
return result;
}
示例8: C_FindObjectsInit
CK_RV
C_FindObjectsInit(CK_SESSION_HANDLE hSession,
CK_ATTRIBUTE_PTR pTemplate,
CK_ULONG ulCount)
{
struct session_state *state;
st_logf("FindObjectsInit\n");
INIT_CONTEXT();
VERIFY_SESSION_HANDLE(hSession, &state);
if (state->find.next_object != -1) {
application_error("application didn't do C_FindObjectsFinal\n");
find_object_final(state);
}
if (ulCount) {
CK_ULONG i;
print_attributes(pTemplate, ulCount);
state->find.attributes =
calloc(1, ulCount * sizeof(state->find.attributes[0]));
if (state->find.attributes == NULL)
return CKR_DEVICE_MEMORY;
for (i = 0; i < ulCount; i++) {
state->find.attributes[i].pValue =
malloc(pTemplate[i].ulValueLen);
if (state->find.attributes[i].pValue == NULL) {
find_object_final(state);
return CKR_DEVICE_MEMORY;
}
memcpy(state->find.attributes[i].pValue,
pTemplate[i].pValue, pTemplate[i].ulValueLen);
state->find.attributes[i].type = pTemplate[i].type;
state->find.attributes[i].ulValueLen = pTemplate[i].ulValueLen;
}
state->find.num_attributes = ulCount;
state->find.next_object = 0;
} else {
st_logf("find all objects\n");
state->find.attributes = NULL;
state->find.num_attributes = 0;
state->find.next_object = 0;
}
return CKR_OK;
}
示例9: print_element
static void
print_element (scew_element *element, unsigned int indent)
{
XML_Char const *contents = NULL;
scew_list *list = NULL;
if (element == NULL)
{
return;
}
/* Prints the starting element tag with its attributes. */
print_indent (indent);
scew_printf (_XT("<%s"), scew_element_name (element));
print_attributes (element);
scew_printf (_XT(">"));
contents = scew_element_contents (element);
if (contents == NULL)
{
scew_printf (_XT("\n"));
}
/**
* Call print_element function again for each child of the current
* element.
*/
list = scew_element_children (element);
while (list != NULL)
{
scew_element *child = scew_list_data (list);
print_element (child, indent + 1);
list = scew_list_next (list);
}
/* Prints element's content. */
if (contents != NULL)
{
scew_printf (_XT("%s"), contents);
}
else
{
print_indent (indent);
}
/* Prints the closing element tag. */
scew_printf (_XT("</%s>\n"), scew_element_name (element));
}
示例10: setw
ostream &auth_attr_addr::print(ostream &os, uint32 level, const uint32 indent, const char *name ) const {
os << setw(level*indent) << "";
if ( name )
os << name << " = ";
os << "[" << ie_name << ": xtype = "<<(int)x_type<<", subtype = "<<(int)sub_type<<", attribute_body : { \n";
os << setw((level+1)*indent) << "";
print_attributes(os);
os <<"\n"<<setw(level*indent) << "";
os << "}]";
return os;
}
示例11: print_ClassFile
void print_ClassFile(ClassFile* class_file_ptr){
printf("\n\nMagic: %.8x\n\n", class_file_ptr->magic);
printf("Minor Version: %.4x\n", class_file_ptr->minor_version);
printf("Major Version: %.4x\n\n", class_file_ptr->major_version);
printConstantPoolTable(class_file_ptr->constant_pool_count, class_file_ptr->constant_pool);
print_interface(class_file_ptr->interfaces, class_file_ptr->interfaces_count, class_file_ptr->constant_pool);
printField(class_file_ptr->constant_pool, class_file_ptr->fields, class_file_ptr->fields_count);
print_Methods(class_file_ptr, class_file_ptr->constant_pool);
print_attributes(class_file_ptr->attributes, class_file_ptr->attributes_count, class_file_ptr->constant_pool);
}
示例12: dump_inst
void dump_inst(const xed_inst_t* p) {
unsigned int j;
printf("%s ", xed_iclass_enum_t2str(xed_inst_iclass(p)));
printf("%s ", xed_iform_enum_t2str(xed_inst_iform_enum(p)));
printf("%s ", xed_category_enum_t2str(xed_inst_category(p)));
printf("%s ", xed_extension_enum_t2str(xed_inst_extension(p)));
printf("%s ", xed_isa_set_enum_t2str(xed_inst_isa_set(p)));
print_attributes(p);
printf("%2u ", xed_inst_noperands(p));
printf("\n");
for(j=0;j<xed_inst_noperands(p);j++) {
printf("\t%u ", j);
dump_operand(xed_inst_operand(p,j));
printf("\n");
}
}
示例13: trace
void trace(methodOop method, address bcp, uintptr_t tos, uintptr_t tos2) {
#ifndef PRODUCT
MutexLocker ml(BytecodeTrace_lock);
if (_current_method != method) {
// Note 1: This code will not work as expected with true MT/MP.
// Need an explicit lock or a different solution.
ResourceMark rm;
tty->cr();
tty->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
method->print_name(tty);
tty->cr();
_current_method = method;
}
if (Verbose) {
const char* format;
switch (Bytecodes::length_at(bcp)) {
case 1: format = "%x %02x " ; break;
case 2: format = "%x %02x %02x " ; break;
case 3: format = "%x %02x %02x %02x "; break;
default: format = "%x %02x %02x %02x .."; break;
}
tty->print(format, bcp, *bcp, *(bcp+1), *(bcp+2));
}
Bytecodes::Code code;
if (_previous_bytecode == Bytecodes::_wide) {
code = Bytecodes::cast(*(bcp+1));
} else {
code = Bytecodes::cast(*bcp);
}
int bci = bcp - method->code_base();
const char* format = _previous_bytecode == Bytecodes::_wide ? Bytecodes::wide_format(code) : Bytecodes::format(code);
tty->print("[%d] ", (int) Thread::current()->osthread()->thread_id());
if (Verbose) {
tty->print("%8d %4d 0x%016lx 0x%016lx %s",
BytecodeCounter::counter_value(), bci, tos, tos2, Bytecodes::name(code));
} else {
tty->print("%8d %4d %s",
BytecodeCounter::counter_value(), bci, Bytecodes::name(code));
}
print_attributes(bcp, bci, format);
tty->cr();
_previous_bytecode = code;
#endif
}
示例14: trace
// Used for methodOop::print_codes(). The input bcp comes from
// BytecodeStream, which will skip wide bytecodes.
void trace(methodHandle method, address bcp, outputStream* st) {
_current_method = method();
ResourceMark rm;
Bytecodes::Code code = Bytecodes::code_at(bcp);
// Set is_wide
_is_wide = (code == Bytecodes::_wide);
if (is_wide()) {
code = Bytecodes::code_at(bcp+1);
}
int bci = bcp - method->code_base();
// Print bytecode index and name
if (is_wide()) {
st->print("%d %s_w", bci, Bytecodes::name(code));
} else {
st->print("%d %s", bci, Bytecodes::name(code));
}
_next_pc = is_wide() ? bcp+2 : bcp+1;
print_attributes(code, bci, st);
bytecode_epilog(bci, st);
}
示例15: print_declaration_node
inline OutIt print_declaration_node(OutIt out, const xml_node<Ch> *node, int flags, int indent)
{
// Print declaration start
if (!(flags & print_no_indenting))
out = fill_chars(out, indent, Ch('\t'));
*out = Ch('<'), ++out;
*out = Ch('?'), ++out;
*out = Ch('x'), ++out;
*out = Ch('m'), ++out;
*out = Ch('l'), ++out;
// Print attributes
out = print_attributes(out, node, flags);
// Print declaration end
*out = Ch('?'), ++out;
*out = Ch('>'), ++out;
return out;
}