www.pudn.com > dialogic_IVR.rar > DISPLAY.CPP
#include#include #include #include #include #include "display.h" #include "answer.h" extern int maxchans; static char version[] = "4.2"; static char dialogic[] = "Dialogic Unix D/xxx Asynchronous Demonstration Program"; /*************************************************************************** * NAME: disp_status(chnum, stringp) * INPUTS: chno - channel number (1 - 12) * stringp - pointer to string to display * DESCRIPTION: display the current activity on the channel in window 2 * (the string pointed to by stringp) using chno as a Y offset *************************************************************************/ void disp_status(int chnum, char *stringp) { char tempStr[256]; #ifdef _DEBUG static FILE *fout = 0; if (!fout) fout = fopen("status.txt", "w"); #endif sprintf(tempStr, "Channel %d: %s", chnum, stringp ); #ifdef _DEBUG fprintf(fout, "%s\n", tempStr); fflush(fout); #endif //MessageBox(NULL, tempStr, "disp_status", MB_OK); return; } /*************************************************************************** * NAME: disp_msg(stringp) * INPUTS: stringp - pointer to string to display. * DESCRIPTION: display the string passed, in the primary message area of win2 *************************************************************************/ void disp_msg(char *stringp) { #ifdef _DEBUG static FILE *fout = 0; if (!fout) fout = fopen("msg.txt", "w"); #endif if (stringp == NULL) { return; } #ifdef _DEBUG fprintf(fout, "%s\n", stringp); fflush(fout); #endif MessageBox(hWnd, stringp, "Error", MB_ICONEXCLAMATION); return; } /*************************************************************************** * NAME: disp_err( chnum, chfd, state ) * DESCRIPTION: This routine prints error information. * INPUTS: chnum - channel number (1 - 12) * chfd - channel descriptor * OUTPUTS: The error code and error message are displayed * CAUTIONS: none. ************************************************************************/ void disp_err( int chnum, int chfd, int state ) { char tempStr[256]; long lasterr = ATDV_LASTERR( chfd ); #ifdef _DEBUG static FILE *fout = 0; if (!fout) fout = fopen("err.txt", "w"); #endif if ( lasterr == EDX_SYSTEM ) { sprintf(tempStr, "Channel %d: SYSTEM ERROR: errno %d, State = %s\n", chnum, dx_fileerrno(), STATE_STR[state]); } else { sprintf(tempStr, "Channel %d: ERROR: lasterr 0x0%x\nState = %s\nDesription: %s", chnum, lasterr, STATE_STR[state], ATDV_ERRMSGP(chfd)); } #ifdef _DEBUG fprintf(fout, "%s\n", tempStr); fflush(fout); #endif MessageBox(hWnd, tempStr, "disp_err", MB_ICONEXCLAMATION); QUIT(17); return; }