📄 gpr_data_type_print_fns.c
字号:
free(tmp); tmp = tmp2; } if (ORTE_GPR_NOTIFY_ADD_ENTRY & sub->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_ADD_ENTRY", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_NOTIFY_DEL_ENTRY & sub->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_DEL_ENTRY", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_NOTIFY_PRE_EXISTING & sub->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_PRE_EXISTING", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_NOTIFY_STARTS_AFTER_TRIG & sub->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_STARTS_AFTER_TRIG", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_NOTIFY_DELETE_AFTER_TRIG & sub->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_NOTIFY_DELETE_AFTER_TRIG", tmp, prefx); free(tmp); tmp = tmp2; } } /* indent another level for values */ asprintf(&pfx, "%s\t", prefx); for (j=0; j < sub->cnt; j++) { if (ORTE_SUCCESS != (rc = orte_gpr_base_print_gpr_value(&tmp2, pfx, (orte_gpr_value_t*)(sub->values[j]), ORTE_GPR_VALUE))) { ORTE_ERROR_LOG(rc); free(tmp); free(pfx); return rc; } asprintf(&tmp3, "%s\n%s", tmp, tmp2); free(tmp); free(tmp2); tmp = tmp3; } /* put results in final location */ *output = tmp; return ORTE_SUCCESS;}/* TRIGGER */int orte_gpr_base_print_trigger(char **output, char *prefix, orte_gpr_trigger_t *trig, orte_data_type_t type){ int rc; char *tmp, *tmp2, *tmp3, *pfx, *prefx; orte_std_cntr_t j; /* set default result */ *output = NULL; /* deal with NULL prefix */ if (NULL == prefix) asprintf(&prefx, " "); else prefx = prefix; if (NULL == trig->name) { asprintf(&tmp, "%sTrigger - NO NAME\tid: %lu", prefx, (unsigned long) trig->id); } else { asprintf(&tmp, "%sTrigger - Name: %s\tid: %lu", prefx, trig->name, (unsigned long) trig->id); } asprintf(&tmp2, "%s\n%s\tAction flags:", tmp, prefx); free(tmp); tmp = tmp2; if (0x00 == trig->action) { asprintf(&tmp2, "%s\n%s\t\tNONE\n", tmp, prefx); free(tmp); tmp = tmp2; } else { if (ORTE_GPR_TRIG_INCLUDE_TRIG_CNTRS & trig->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_INCLUDE_TRIG_CNTRS", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_TRIG_ONE_SHOT & trig->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_ONE_SHOT", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_TRIG_ROUTE_DATA_THRU_ME & trig->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_ROUTE_DATA_THRU_ME", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_TRIG_AT_LEVEL & trig->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_AT_LEVEL", tmp, prefx); free(tmp); tmp = tmp2; } if (ORTE_GPR_TRIG_CMP_LEVELS & trig->action) { asprintf(&tmp2, "%s\n%s\t\tORTE_GPR_TRIG_CMP_LEVELS", tmp, prefx); free(tmp); tmp = tmp2; } } /* indent another level for values */ asprintf(&pfx, "%s\t", prefx); for (j=0; j < trig->cnt; j++) { if (ORTE_SUCCESS != (rc = orte_gpr_base_print_gpr_value(&tmp2, pfx, (orte_gpr_value_t*)(trig->values[j]), ORTE_GPR_VALUE))) { ORTE_ERROR_LOG(rc); free(tmp); free(pfx); return rc; } asprintf(&tmp3, "%s\n%s", tmp, tmp2); free(tmp); free(tmp2); tmp = tmp3; } /* put results in final location */ *output = tmp; return ORTE_SUCCESS;}/* NOTIFY DATA */int orte_gpr_base_print_notify_data(char **output, char *prefix, orte_gpr_notify_data_t *data, orte_data_type_t type){ char *tmp, *tmp2, *tmp3, *pfx, *prefx; orte_std_cntr_t i, j; orte_gpr_value_t **values; int rc; /* set default result */ *output = NULL; /* deal with NULL prefix */ if (NULL == prefix) asprintf(&prefx, " "); else prefx = prefix; if (NULL != data->target) { asprintf(&tmp, "%sNotify Data: %lu values going to subscription target %s", prefx, (unsigned long) data->cnt, data->target); } else { asprintf(&tmp, "%sNotify Data: %lu values going to subscription num %lu", prefx, (unsigned long) data->cnt, (unsigned long) data->id); } values = (orte_gpr_value_t**)(data->values)->addr; if (0 < data->cnt) { /* indent another level for values */ asprintf(&pfx, "%s\t", prefx); for (i=0, j=0; j < data->cnt && i < (data->values)->size; i++) { if (NULL != values[i]) { j++; if (ORTE_SUCCESS != (rc = orte_gpr_base_print_gpr_value(&tmp2, pfx, (orte_gpr_value_t*)values[i], ORTE_GPR_VALUE))) { ORTE_ERROR_LOG(rc); free(tmp); return rc; } asprintf(&tmp3, "%s\n%s", tmp, tmp2); free(tmp2); tmp = tmp3; } } } /* put results in final location */ *output = tmp; return ORTE_SUCCESS;}/* NOTIFY MSG */int orte_gpr_base_print_notify_msg(char **output, char *prefix, orte_gpr_notify_message_t *msg, orte_data_type_t type){ char *tmp, *tmp2, *tmp3, *pfx, *prefx; orte_std_cntr_t i, j; orte_gpr_notify_data_t **data; int rc; /* set default result */ *output = NULL; /* deal with NULL prefix */ if (NULL == prefix) asprintf(&prefx, " "); else prefx = prefix; if (ORTE_GPR_TRIGGER_MSG == msg->msg_type) { asprintf(&tmp, "%sTRIGGER message", prefx); } else if (ORTE_GPR_SUBSCRIPTION_MSG == msg->msg_type) { asprintf(&tmp, "%sSUBSCRIPTION message", prefx); } if (NULL == msg->target) { asprintf(&tmp2, "%s\n%s\tTrigger target: NULL", tmp, prefx); } else { asprintf(&tmp2, "%s\n%s\tTrigger target: %s", tmp, prefx, msg->target); } free(tmp); asprintf(&tmp, "%s\n%s\tTrigger id: %lu", tmp2, prefx, (unsigned long)msg->id); free(tmp2); asprintf(&tmp2, "%s\n%s\t%lu Notify data structures in message", tmp2, prefx, (unsigned long) msg->cnt); free(tmp); tmp = tmp2; if (0 < msg->cnt) { /* indent another level for notify data */ asprintf(&pfx, "%s\t", prefx); data = (orte_gpr_notify_data_t**)(msg->data)->addr; for (i=0, j=0; j < msg->cnt && i < (msg->data)->size; i++) { if (NULL != data[i]) { j++; if (ORTE_SUCCESS != (rc = orte_gpr_base_print_notify_data(&tmp2, pfx, (orte_gpr_notify_data_t*)data[i], ORTE_GPR_NOTIFY_DATA))) { ORTE_ERROR_LOG(rc); free(tmp); return rc; } asprintf(&tmp3, "%s\n%s", tmp, tmp2); free(tmp2); tmp = tmp3; } } } /* put results in final location */ *output = tmp; return ORTE_SUCCESS;}static void orte_gpr_base_quick_print(char **output, char *type_name, char *prefix, void *src, orte_std_cntr_t src_size){ char *prefx; uint8_t *ui8; uint16_t *ui16; uint32_t *ui32;#ifdef HAVE_INT64_T uint64_t *ui64;#endif /* deal with NULL prefix */ if (NULL == prefix) asprintf(&prefx, " "); else prefx = prefix; switch(src_size) { case 1: ui8 = (uint8_t*)src; asprintf(output, "%sData type: %s\tValue: %d", prefx, type_name, (int) *ui8); break; case 2: ui16 = (uint16_t*)src; asprintf(output, "%sData type: %s\tValue: %d", prefx, type_name, (int) *ui16); break; case 4: ui32 = (uint32_t*)src; asprintf(output, "%sData type: %s\tValue: %lu", prefx, type_name, (unsigned long) *ui32); break;#ifdef HAVE_INT64_T case 8: ui64 = (uint64_t*)src; asprintf(output, "%sData type: %s\tValue: %lu", prefx, type_name, (unsigned long) *ui64); break;#endif default: return; } return;}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -