📄 u_cvar.c
字号:
if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"NAMED Read"); if (req_ptr->resp_err) /* Check for error */ list_err_info (req_ptr); /* print reason if so */ else /* NO error, info is available */ {/* The Read VM has provided 'readvars_req_info' for request information.*//* This will allow printing the variable name and response data. */ req = (READVARS_REQ_INFO *) req_ptr->req_info_ptr; varlist = (MV_VARDESC *) (req + 1); rsp_ptr = (READ_RESP_INFO *) req_ptr->resp_info_ptr; ar_list = rsp_ptr->acc_rslt_list; printf ("\n Number of Variables : %d", req->num_of_vars); for (i = 0; i < req->num_of_vars; i++) { GOTOLINE (16); printf (" Named Variable %3d)", i+1); print_objname (&varlist->name); if (ar_list->acc_rslt_tag == ACC_RSLT_SUCCESS) { /* successful read, print data */ type = ms_find_named_type_obj (&varlist->type,0); if (type) print_arb_data (varlist->data, type, SD_FALSE, SD_FALSE, NULL ); else printf ("\n Could not find type"); } else { /* unsuccessful, print failure */ print_objname (&varlist->type); printf ("\n Failed, code = %d", ar_list->failure); } varlist++; /* point to next variable */ ar_list++; /* point to next access result */ if (i < req->num_of_vars-1) { GOTOLINE (23); printf (" Press return to continue, x to exit"); ch = get_a_char (); if (ch == 'x' || ch == 'X') i = req->num_of_vars; /* exit selected */ CLEARSCR; } } } conf_info_wait (); } (*sfun)(req_ptr); /* call to internal tracking fun *//* When any virtual machine request is complete. the user should call *//* 'ms_clr_mvreq' to free up any buffers reserved for the request. */ ms_clr_mvreq (req_ptr); /* clear the VM command info */ /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MV READ VARIABLES *//************************************************************************//* This user defined function is called when a Virtual Machine read req *//* is complete. The parameter 'req_ptr' is a pointer to the request *//* control structure that was selected when the request was made. The *//* structure now contains the results of the operation, and if OK, the *//* response data (in local representation) is available in the selected *//* buffer/location *//************************************************************************/#if MMS_MV_RDVARS_EN & REQ_ENST_VOID u_mv_read_vars_conf (MMSREQ_PEND *req_ptr) {READ_RESP_INFO *rsp_ptr;MV_READ_REQ_INFO *varlist;ST_INT i, line, ch;ST_INT num_var; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"NAMED Read"); if (req_ptr->resp_err) /* Check for error */ list_err_info (req_ptr); /* print reason if so */ else /* NO error, info is available */ { rsp_ptr = (READ_RESP_INFO *) req_ptr->resp_info_ptr; if (rsp_ptr->va_spec_pres) { print_vaspec (&rsp_ptr->va_spec); wait_key (); CLEARSCR; } else printf ("\n Variable Access Specification : Not Present ");/* The 'req_info_ptr' points to the 'mv_read_req_info' array which has *//* all information required to interpret the response data *//* To determine the number of variables returned, we need to look at *//* the primitive response information. */ varlist = (MV_READ_REQ_INFO *) req_ptr->req_info_ptr; num_var = rsp_ptr->num_of_acc_result; printf ("\n Number of Variables : %d", num_var); for (i = 0; i < num_var; i++) { if (req_ptr->cs.cs_pres) { GOTOLINE (19); printf (" Variable %3d)", i+1); } else { GOTOLINE (17); printf (" Variable %3d)", i+1); } if (varlist->o.result == ACC_RSLT_SUCCESS) { if (varlist->i.type != NULL) /* Not typeless */ { print_arb_data (varlist->i.data_ptr, varlist->i.type, varlist->i.alt_acc_pres, varlist->i.alt_acc_data_packed, &(varlist->i.alt_acc)); } else /* Typeless read */ { ms_process_arb_data(varlist->o.data_ptr_out, varlist->o.rt_out, varlist->o.num_rt, SD_FALSE, SD_FALSE, NULL, &arb_print_ctrl); chk_free (varlist->o.rt_out); chk_free (varlist->o.data_ptr_out); } if (varlist->i.alt_acc_pres == SD_TRUE) { chk_free(varlist->i.alt_acc.aa); /* came from ms_adl_to_aa */ } } else /* unsuccessful, print failure */ printf ("\n Failed, code = %d", varlist->o.err_code); varlist++; /* point to next variable */ if (i < num_var-1) { GOTOLINE (23);#if defined (_WINDOWS) printf ("\n");#endif printf (" Do you want to see remaining Access Results (y,n) (default = y) : "); ch = get_a_char (); if (ch == 'n' || ch == 'N') { i = num_var; /* exit selected */ break; } if (req_ptr->cs.cs_pres) for (line = 19; line < 24; line++) /* clear display lines */ CLEARLINE (line); else for (line = 17; line < 24; line++) /* clear display lines */ CLEARLINE (line); } } } conf_info_wait (); } (*sfun)(req_ptr); /* call to internal tracking fun *//* When any virtual machine request is complete. the user should call *//* 'ms_clr_mvreq' to free up any buffers reserved for the request. */ ms_clr_mvreq (req_ptr); /* clear the VM command info */ /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MP READ *//************************************************************************/#if MMS_READ_EN & REQ_ENST_VOID u_mp_read_conf (MMSREQ_PEND *req_ptr) {READ_RESP_INFO *rsp_ptr;ACCESS_RESULT *ar_ptr;register j; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Variable Read"); if (req_ptr->resp_err) list_err_info (req_ptr); else { rsp_ptr = (READ_RESP_INFO *) req_ptr->resp_info_ptr; if (rsp_ptr->va_spec_pres) print_vaspec (&rsp_ptr->va_spec); else printf ("\n Variable Access Specification : Not Present "); ar_ptr = rsp_ptr->acc_rslt_list; printf ("\n Number of Access Results = %d ",rsp_ptr->num_of_acc_result); for (j = 0; j < rsp_ptr->num_of_acc_result; j++) { printf ("\n Result %3d) ", j+1); if (ar_ptr->acc_rslt_tag == ACC_RSLT_FAILURE) printf ("Failure : %d ", ar_ptr->failure); else { printf ("Success : "); list_bytes (ar_ptr->va_data.data,ar_ptr->va_data.len); } ar_ptr++; } } conf_info_wait (); } resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MV WRITE *//************************************************************************/#if MMS_MV_WRITE_EN & REQ_ENST_VOID u_mv_write_conf (MMSREQ_PEND *req_ptr) {WRITE_REQ_INFO *req;VARIABLE_LIST *varlist;WRITE_RESP_INFO *rsp_ptr;WRITE_RESULT *rslt_ptr;ST_INT i, line, ch; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"Named Write"); if (req_ptr->resp_err) list_err_info (req_ptr); else { req = (WRITE_REQ_INFO *) req_ptr->req_info_ptr; varlist = (VARIABLE_LIST *) (req + 1); rsp_ptr = (WRITE_RESP_INFO *) req_ptr->resp_info_ptr; rslt_ptr = (WRITE_RESULT *) (rsp_ptr + 1); printf ("\n Number of Write Results : %d", rsp_ptr->num_of_result); for (i = 0; i < rsp_ptr->num_of_result; i++) { CLEARLINE (16); printf (" Named Variable %3d)", i+1); print_objname (&varlist->var_spec.vs.name); if (rslt_ptr->resp_tag == WR_RSLT_SUCCESS) printf ("\n Write Result : Success"); else printf ("\n Write Result : Failure, code = %d", rslt_ptr->failure); varlist++; /* point to next variable */ rslt_ptr++; /* point to next write result */ if (i < rsp_ptr->num_of_result-1) { GOTOLINE (23); printf (" Press return to continue, x to exit"); ch = get_a_char (); if (ch == 'x' || ch == 'X') i = rsp_ptr->num_of_result; /* exit selected */ for (line = 16; line < 24; line++) /* clear display lines */ CLEARLINE (line); } } } conf_info_wait (); } (*sfun)(req_ptr); /* call to internal tracking fun */ ms_clr_mvreq (req_ptr); /* clear the VM command info */ /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif/************************************************************************//* MV WRITE VARIABLES *//************************************************************************/#if MMS_MV_WRVARS_EN & REQ_ENST_VOID u_mv_write_vars_conf (MMSREQ_PEND *req_ptr) {WRITE_REQ_INFO *req;WRITE_RESP_INFO *rsp_ptr;WRITE_RESULT *rslt_ptr;ST_INT i, line, ch; if (mms_debug_sel & MMS_LOG_USR_CONF) { conf_info_print (req_ptr,"VM GENERAL Write"); if (req_ptr->resp_err) list_err_info (req_ptr); else { req = (WRITE_REQ_INFO *) req_ptr->req_info_ptr; rsp_ptr = (WRITE_RESP_INFO *) req_ptr->resp_info_ptr; rslt_ptr = (WRITE_RESULT *) (rsp_ptr + 1); printf ("\n Number of Write Results : %d", rsp_ptr->num_of_result); for (i = 0; i < rsp_ptr->num_of_result; i++) { if (req_ptr->cs.cs_pres) { GOTOLINE (18); if (rslt_ptr->resp_tag == WR_RSLT_SUCCESS) printf (" Write Result %d : Success",i); else printf (" Write Result %d : Failure, code = %d", i, rslt_ptr->failure); } else { GOTOLINE (16); if (rslt_ptr->resp_tag == WR_RSLT_SUCCESS) printf (" Write Result %d : Success",i); else printf (" Write Result %d : Failure, code = %d", i, rslt_ptr->failure); } rslt_ptr++; /* point to next write result */ if (i < rsp_ptr->num_of_result-1) { GOTOLINE (23); printf (" Press return to continue, x to exit"); ch = get_a_char (); if (ch == 'x' || ch == 'X') i = rsp_ptr->num_of_result; /* exit selected */ if (req_ptr->cs.cs_pres) { for (line = 18; line < 24; line++) /* clear display lines */ CLEARLINE (line); } else { for (line = 16; line < 24; line++) /* clear display lines */ CLEARLINE (line); } } } } conf_info_wait (); } (*sfun)(req_ptr); /* call to internal tracking fun */ ms_clr_mvreq (req_ptr); /* clear the VM command info */ /* take care of continuous send var */ resp_rcvd = 1; /* set response received flag */ rep_count++; /* increment number of reps counter */ }#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -