📄 mmsajou.c
字号:
/************************************************************************//* SISCO SOFTWARE MODULE HEADER *****************************************//************************************************************************//* (c) Copyright Systems Integration Specialists Company, Inc., *//* 1986 - 2002, All Rights Reserved. *//* *//* MODULE NAME : mmsajou.c *//* PRODUCT(S) : MMSEASE *//* *//* MODULE DESCRIPTION : *//* This module contains functions to initiate the MMS journal *//* management services. These functions are called from the *//* mainloop (check_key). *//* *//* GLOBAL FUNCTIONS DEFINED IN THIS MODULE : *//* *//* MODIFICATION LOG : *//* Date Who Rev Comments *//* -------- --- ------ ------------------------------------------- *//* 01/31/02 EJV 02 Changed BTOD6 day to 6210 (1/1/2001) *//* 08/15/97 MDE 01 BTOD handling changes *//* 04/15/97 DSF 7.00 MMSEASE 7.0 release. See MODL70.DOC for *//* history. *//************************************************************************/#include "glbtypes.h"#include "sysincs.h"#if (SYSTEM_SEL & (MSOFT))#include <conio.h>#endif#include "mms_usr.h"#include "mms_pjou.h"#include "mmsop_en.h"#include "userdefs.h"#include "fkeydefs.h"#include "gvaldefs.h"#ifdef PSOS_SYSTEM#include <prepc.h>#endif/************************************************************************//* For debug version, use a static pointer to avoid duplication of *//* __FILE__ strings. *//************************************************************************/#ifdef DEBUG_SISCOstatic ST_CHAR *thisFileName = __FILE__;#endif/************************************************************************//* do_jread *//* create and send a read journal request *//************************************************************************/ST_VOID do_jread (ST_VOID) {#if MMS_JREAD_EN & REQ_ENJREAD_REQ_INFO *req_info;ST_CHAR **vi_ptr;ST_CHAR *inp_str;ST_INT chan;ST_INT num;ST_BOOLEAN data_entered, done;ST_CHAR temp[100];ST_INT len, tot_len; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } req_info = (JREAD_REQ_INFO *) dest_buffer; vi_ptr = (ST_CHAR **) (req_info + 1); inp_str = (dest_buffer + 8192); tot_len = 0; printf (" Enter Journal Name :\n"); data_entered = get_objname (&req_info->jou_name); if (data_entered) { req_info->range_start_pres = SD_FALSE; printf (" (0:starting time, 1:starting entry) "); printf ("\n Enter Range Start Specification (O) : "); if (intget (&num)) { if (num == 0) { req_info->range_start_pres = SD_TRUE; req_info->start_tag = num; req_info->start_time.form = MMS_BTOD6; req_info->start_time.ms = 12345; req_info->start_time.day = 6210; /* 1/1/2001 */ } if (num == 1) { printf (" Enter Starting Entry : (R) "); if (len = input_hex ((ST_UCHAR *)temp, 100)) { if ((tot_len += len) < 2048) { memcpy (inp_str, temp, len); req_info->range_start_pres = SD_TRUE; req_info->start_tag = num; req_info->start_entry = (ST_UCHAR *)inp_str; req_info->start_entry_len = len; inp_str += len; } else { req_info->range_start_pres = SD_FALSE; wait_msg ("\n Total Data too long, entry was lost "); } } } } } if (data_entered) { req_info->range_stop_pres = SD_FALSE; printf (" (0:ending time, 1:number of entries) "); printf ("\n Enter Range Stop Specification (O) : "); if (intget (&num)) { if (num == 0) { req_info->range_stop_pres = SD_TRUE; req_info->stop_tag = num; req_info->end_time.form = MMS_BTOD6; req_info->end_time.ms = 12345; req_info->end_time.day = 6210; /* 1/1/2001 */ } if (num == 1) { req_info->range_stop_pres = SD_TRUE; req_info->stop_tag = num; req_info->num_of_entries = 0; printf (" Enter Number of Entries : (R) "); if (intget (&num)) req_info->num_of_entries = (ST_INT) num; } } } if (data_entered) { req_info->list_of_var_pres = SD_FALSE; req_info->num_of_var = 0; done = SD_FALSE; while (!done) { printf (" Enter Variable %d (O) : ", req_info->num_of_var+1); if (strget (temp)) { len = strlen (temp) + 1; if ((tot_len += len) < 2048) { strcpy (inp_str, temp); *vi_ptr = inp_str; vi_ptr++; req_info->num_of_var++; inp_str += len; } else wait_msg ("\n Total Data too long, entry was lost "); } else done = SD_TRUE; } if (req_info->num_of_var > 0) req_info->list_of_var_pres = SD_TRUE; } if (data_entered) { req_info->sa_entry_pres = SD_FALSE; req_info->time_spec.form = MMS_BTOD6; req_info->time_spec.ms = 12345; req_info->time_spec.day = 6210; /* 1/1/2001 */ printf (" Enter Start After Entry Specification (O) : "); if (len = input_hex ((ST_UCHAR *)temp, 100)) { if ((tot_len += len) < 2048) { memcpy (inp_str, temp, len); req_info->sa_entry_pres = SD_TRUE; req_info->entry_spec = (ST_UCHAR *)inp_str; req_info->entry_spec_len = len; inp_str += len; } else wait_msg ("\n Total Data too long, entry was lost "); } } if (data_entered) { if (!mp_jread (chan, req_info)) print_req_error (); if (num_reps) /* if this an auto repeat - */ { if (start_cont ()) /* wait for 1st to complete */ return; num_outstanding = 1; while (rep_count < num_reps) /* if enough done - */ { if (!mp_jread (chan, req_info)) break; num_outstanding++; if (cont_serve ()) /* if user hit a key */ return; } cont_done (); /* display results */ } } else wait_msg ("\n Must enter all required information "); (*menu_set_fun) ();#endif }/************************************************************************//* do_jwrite *//* create and send a write journal request *//************************************************************************/ST_VOID do_jwrite (ST_VOID) {#if MMS_JWRITE_EN & REQ_ENJWRITE_REQ_INFO *req_info;ENTRY_CONTENT *ec_ptr;VAR_INFO *vi_ptr;ST_INT chan;ST_BOOLEAN data_entered, vi_entered;ST_BOOLEAN done, vi_done;ST_INT num;ST_INT len, tot_len;ST_CHAR temp [100];ST_CHAR *inp_str; if (!get_chan (&chan)) { (*menu_set_fun) (); return; } req_info = (JWRITE_REQ_INFO *) dest_buffer; inp_str = (dest_buffer + 8192); printf (" Enter Journal Name :\n"); data_entered = get_objname (&req_info->jou_name); if (data_entered) { /* get entry contents from operator */ tot_len = 0; ec_ptr = (ENTRY_CONTENT *) (req_info + 1); req_info->num_of_jou_entry = 0; done = SD_FALSE; while (!done) { if (ask ("\n Enter Entry Content (y, n)? ",0)) { ec_ptr->occur_time.form = MMS_BTOD6; ec_ptr->occur_time.ms = 12345; ec_ptr->occur_time.day = 6210; /* 1/1/2001 */ printf (" Enter Additional Detail (O) : "); if (len = input_hex ((ST_UCHAR *)temp, 100)) { if ((tot_len += len) < 2048) { memcpy (inp_str, temp, len); ec_ptr->addl_detail_pres = SD_TRUE; ec_ptr->addl_detail = (ST_UCHAR *)inp_str; ec_ptr->addl_detail_len = len; inp_str += (len + 1); } else { ec_ptr->addl_detail_pres = SD_FALSE; wait_msg ("\n Total Data too long, entry was lost "); } } else ec_ptr->addl_detail_pres = SD_FALSE; printf (" Enter Entry Form (2-3) (default = 2, data) : "); ec_ptr->entry_form_tag = 2; if (intget (&num) && (num == 3)) ec_ptr->entry_form_tag = num; if (ec_ptr->entry_form_tag == 2) /* if DATA */ { ec_ptr->ef.data.event_pres = SD_FALSE; if (ask (" Send Event ? ",0)) { printf (" Enter Event Condition Name :\n"); if (get_objname (&ec_ptr->ef.data.evcon_name)) { ec_ptr->ef.data.event_pres = SD_TRUE; printf (" Enter Current State (0-2) (default = 0, disabled) : "); ec_ptr->ef.data.cur_state = 0; if (intget (&num)) { if ((num >= 0) && (num <= 2)) ec_ptr->ef.data.cur_state = num; } } } ec_ptr->ef.data.list_of_var_pres = SD_FALSE; ec_ptr->ef.data.num_of_var = 0; vi_ptr = (VAR_INFO *) (ec_ptr + 1); vi_done = SD_FALSE; printf (" Enter List Of Variables -\n"); while (!vi_done) { printf (" Enter Variable Tag (O) : "); if (vi_entered = strget (temp)) { len = strlen (temp) + 1; if ((tot_len += len) < 2048)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -