home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-05 | 141.7 KB | 4,441 lines |
- $MACRO_FILE MECOM;
- {******************************************************************************
- MULTI-EDIT MACRO FILE MECOM
-
- COM - The communications module main macro.
- COM_DATE_TIME - Places the time and date on the MECOM status line.
- COM_HELP - Calls the help for the com module.
- COM_MAIN_MENU - The top level menu for MECOM.
- COM_SETUP_MENU - The MECOM setup menu.
- COM_PHONE_MENU - The phone main menu.
- COM_OTHER_MENU - The "OTHER" menu.
- COM_FILE_MENU - The file download, upload, and log file menu.
- COM_SCREEN_MENU - The screen menu
- COM_DIR_SHELL - Enter DOS shell from MECOM.
- COM_ERROR - Error handling routines for MECOM.
- COM_OPEN_PORT - Opens a com port.
- COM_FILE - File uploading, downloading and log file.
- COM_XFER_BEEP - Beeping for file transfers.
- COM_LOG_ERROR - Log file and ASCII upload error routines.
- COM_QUIT - Exit prompt for MECOM
- COM_ASCII_DOWN - ASCII download
- COM_ASCII_UP - ASCII upload
- COM_PROTO_MENU - Creates a menu of transfer protocols
- COM_SETUP - Installation and setup for MECOM.
- COM_SETUP_PORT - A small menu routine for port specific setup. Used by COM_SETUP.
- COM_PHONE - Phone dialing and hang up.
- COM_SEND_BREAK - Sends a break condition to the com port.
- COM_DUMB - Dumb terminal emulation
- COM_ANSI - ANSI terminal emulation
- COM_INIT - Gets data from MECOM.DB
- COM_WAIT_FOR_STR - Waits for a string or set of strings from the com port.
- COM_SEND_STR - Sends a string to the com port.
- COM_CONNECT_WAIT - Waits for a connection after dialing.
- COM_CURSOR_OFF - Turns the cursor off.
- COM_CURSOR_ON - Turns the cursor on.
- COM_SCREEN_DUMP - Sends the current screen to a file or printer.
- COM_SEND_MSG - Creates a window to edit a message to send to the com port.
- COM_VIEW_FILE - Creates a window to view/edit a file.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- $MACRO COM TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM
-
- Description: The comunications module main macro.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- def_str(tstr);
- def_int(error, jx, port_num,X1,Y1,X2,Y2,Menu_Choice,Active_Window,Menu_Y,
- Changes_Made,Duplex,Dest_Bs,Baud,Parity,Data_Bits,Timer_Handle,
- Stop_Bits,Logging,T_Mode);
- def_char( ch ,Bs_Char);
-
-
- Set_Global_Int('COM_NO_STAT',0);
- Set_Global_Int('Temp_EMS_Stat',EMS_Stat);
- T_Mode := Mode;
- Mode := Term;
- Set_Global_Int('Temp_fkey_row',fkey_row);
- Set_Global_Int('Temp_status_row',status_row);
- Set_Global_Int('Temp_Message_Row',Message_Row);
- Set_Global_Int('MENU_LEVEL',Global_Int('MENU_LEVEL') + 1);
- Set_Global_Int('COM_MENU_LEVEL',Global_Int('MENU_LEVEL'));
- Set_Global_Int('COM_Box_Count',Box_Count);
- status_row := 0;
- fkey_row := 0;
- Message_Row := 0;
- Refresh := False;
- Menu_Y := 2;
- Undo_Stat := False;
-
- Return_Str := '';
- Active_Window := Cur_Window;
- {If we've run MECOM before since ME was started. All these globals should have
- values, and therefore it is not neccessary to get them from disk.}
- IF ((Global_Str('COM_ASCII_PARAMS') = '') or
- (Global_Str('COM_LINE_PARAMS') = '') or
- (Global_Str('COM_TERMINAL_PARAMS') = '') or
- (Global_Str('COM_MODEM_PARAMS') = '') or
- (Global_Str('COM_SCREEN_PARAMS') = '') or
- (Global_Str('COM_COLOR_PARAMS') = '') or
- (Global_Str('COM_BOX_PARAMS') = '') or
- (Global_Str('COM_GENERAL_PARAMS') = '')) THEN
- RM('MECOM^COM_INIT');
- END;
-
- IF (Global_Int('COM_DEFAULT_COLORS')) THEN
- {If someone used the /B or /C on the command line, default the colors}
- Set_Global_Str('Com_Color_Params','/COLOR=/F=15/B=0');
- Set_Global_Int('COM_DEFAULT_COLORS',0);
- END;
- IF (Global_Int('Com_Port_Open')) THEN
- Call SET_PORT;
- ELSE
- Call INIT_PORT;
- END;
- Call SET_TERM;
- Text_Color_Vp := Parse_Int('/F=',Global_Str('Com_Color_Params')) +
- (Parse_Int('/B=',Global_Str('Com_Color_Params')) shl 4);
- IF (Parse_Int('/FS=',Global_Str('Com_Screen_Params')) = True) THEN
- Call FULL_SCREEN;
- ELSE
- Call MAKE_COM_BOX;
- END;
-
- Write_VP('Multi-Edit Communications Module Version 1.10|13|10');
- Set_Global_Int('Com_Cursor_Pos',WhereX_VP or (WhereY_Vp shl $08));
- Set_Global_Int('Com_Logging',False);
- Logging := False;
- Set_Global_Int('Com_ASCII_Download',False);
- Set_Global_Str('Com_Log_Str','');
- Set_Global_Int('Com_First_Log',True);
- Set_Global_Str('Com_Log_File',Parse_Str('/LF=',Global_Str('Com_General_Params')));
- Timer_Handle := set_timer_event('MECOM^COM_DATE_TIME', 18, Term);
-
- IF (Global_Int('Com_Port_Open') = False) THEN
- RM('MECOM^COM_OPEN_PORT /P=0');
- ELSE
- RM('MECOM^COM_OPEN_PORT');
- END;
-
- IF (Global_Int('Com_Port_Open')) THEN
- Port_Num := Global_Int('Com_Port_Num');
- ELSE
- Port_Num := 0;
- END;
-
- Menu_Choice := 1;
-
- MAIN_LOOP:
- Call WRITE_STATUS;
- RM('MECOM^COM_' + Parse_Str('/T=',Global_Str('Com_Terminal_Params')));
-
- Jx := Inq_Key(Key1,Key2,TERM,TStr);
- IF (Jx = 1) THEN
- MOUSE_MACRO:
- Set_Global_Int('COM_CHANGES_MADE',0);
- Return_Str := '';
- RM(TStr);
- IF (Error_Level) THEN
- RM('MEERROR');
- END;
- IF (Parse_Int('/QUIT=',Return_Str)) THEN
- goto exit;
- END;
- IF (Global_Int('COM_CHANGES_MADE') <> 0) THEN
- IF ((Global_Int('COM_CHANGES_MADE') and $04) <> 0) THEN
- {Terminal}
- Call SET_TERM;
- END;
- IF ((Global_Int('COM_CHANGES_MADE') and $08) <> 0) THEN
- {Port}
- Call SET_PORT;
- END;
- IF ((Global_Int('COM_CHANGES_MADE') and $10) <> 0) THEN
- IF (Parse_Int('/FS=',Global_Str('Com_Screen_Params'))) THEN
- Call FULL_SCREEN;
- ELSE
- Kill_Box;
- Return_Str := '/DRC=1';
- Goto MAKE_NEW_BOX;
- END;
- END;
- END;
- IF (Parse_Int('/BOX=',Return_Str) = -1) THEN
- MAKE_NEW_SCREEN:
- Call FULL_SCREEN;
- END;
- IF (Parse_Int('/BOX=',Return_Str) = 1) THEN
- MAKE_NEW_BOX:
- Jx := Cur_Window;
- Switch_Window(Active_Window);
- Fkey_Row := Global_Int('Temp_Fkey_Row');
- Status_Row := Global_Int('Temp_Status_Row');
- Message_Row := Global_Int('Temp_Message_Row');
- Refresh := True;
- New_Screen;
- Refresh := False;
- Switch_Window(Jx);
- Fkey_Row := 0;
- Status_Row := 0;
- Message_Row := 0;
- Call MAKE_COM_BOX;
- END;
- IF (Parse_Int('/CLS=',Return_Str)) THEN
- Call CLEAR_SCREEN;
- END;
- Jx := XPos('/WRITE=',Return_Str,1);
- IF (Jx) THEN
- RM('MECOM^COM_' + Parse_Str('/T=',Global_Str('Com_Terminal_Params')) +
- ' /DO=' + Parse_Str('/WRITE=',Return_Str));
- END;
-
- {This is for running a macro after dialing a phone number.}
- Jx := XPos('/PM=',Return_Str,1);
- IF (Jx) THEN
- RM(Copy(Return_Str,Jx + 4,255));
- IF (Error_Level) THEN
- RM('MEERROR');
- END;
- END;
- Goto MAIN_LOOP;
- ELSE
- IF (Key1 = 0) THEN
- IF (Key2 = 250) THEN
- IF (Mou_Last_Y = Global_Int('COM_STATUS_ROW')) THEN
- {
- These mouse zones are defined for the following status line. Any mods to the
- status line format will require changes to the zone boundries, and the
- ASCII UPLOADING message in COM_ASCII_UP.
- HELP <F1> │MENU <F2> │COM2 2400 8 1 N│LOG CLOSED│ANSI │01-17-90 03:38pm
- }
- IF ((Mou_Last_X > 0) and (Mou_Last_X < 13)) THEN
- TStr := 'MECOM^COM_HELP';
- Goto MOUSE_MACRO;
- END;
- IF ((Mou_Last_X > 13) and (Mou_Last_X < 26)) THEN
- TStr := 'MECOM^COM_MAIN_MENU';
- Goto MOUSE_MACRO;
- END;
- IF ((Mou_Last_X > 26) and (Mou_Last_X < 43)) THEN
- TStr := 'MECOM^COM_SETUP /TP=4';
- Goto MOUSE_MACRO;
- END;
- IF ((Mou_Last_X > 43) and (Mou_Last_X < 54)) THEN
- TStr := 'MECOM^COM_FILE /TP=3';
- Goto MOUSE_MACRO;
- END;
- IF ((Mou_Last_X > 54) and (Mou_Last_X < 63)) THEN
- TStr := 'MECOM^COM_SETUP /TP=3';
- Goto MOUSE_MACRO;
- END;
- ELSIF global_int('COM_MENU_BAR') AND (mou_last_y = (Global_Int('COM_STATUS_ROW') + 1)) AND
- (mou_last_X < 45) THEN
- push_key(key1,key2);
- TStr := 'MECOM^COM_MAIN_MENU';
- Goto MOUSE_MACRO;
- END;
- END;
- END;
- END;
- goto main_loop;
-
- {********************************** SUBROUTINES ******************************}
- CLEAR_SCREEN:
- Clr_Vp;
- Set_Global_Int('Com_Cursor_Pos',$101);
- RET;
-
- MAKE_COM_BOX:
- Kill_Box;
- IF (Parse_Int('/X1=',Global_Str('Com_Box_Params')) < 1) THEN
- Return_Str := '/X1=';
- RM('USERIN^CHNGPARM /G=Com_Box_Params/P=' + '1');
- END;
- IF (Parse_Int('/Y1=',Global_Str('Com_Box_Params')) < 2) THEN
- Return_Str := '/Y1=';
- RM('USERIN^CHNGPARM /G=Com_Box_Params/P=' + '2');
- END;
- IF (Parse_Int('/X2=',Global_Str('Com_Box_Params')) > Screen_Width) THEN
- Return_Str := '/X2=';
- RM('USERIN^CHNGPARM /G=Com_Box_Params/P=' + Str(Screen_Width));
- END;
- IF (Parse_Int('/Y2=',Global_Str('Com_Box_Params')) > (Screen_Length - 1)) THEN
- Return_Str := '/Y2=';
- RM('USERIN^CHNGPARM /G=Com_Box_Params/P=' + Str(Screen_Length));
- END;
- X1 := Parse_Int('/X1=',Global_Str('Com_Box_Params'));
- Y1 := Parse_Int('/Y1=',Global_Str('Com_Box_Params'));
- X2 := Parse_Int('/X2=',Global_Str('Com_Box_Params'));
- Y2 := Parse_Int('/Y2=',Global_Str('Com_Box_Params'));
- Set_Global_Str('Com_Cur_Scrn_Params','/X1=' + Str(X1) + '/Y1=' + Str(Y1) +
- '/X2=' + Str(X2) + '/Y2=' + Str(Y2));
- Put_Box(X1,Y1,X2,Y2,0,Text_Color_Vp,
- 'MULTI-EDIT COMMUNICATIONS MODULE',False);
-
- Set_Vp(X1 + 1,Y1 + 1,X2 - 1,Y2 - 1);
-
- Call CLEAR_SCREEN;
- Draw_Char(32,1,Global_Int('Temp_status_row'),Stat1_Color,80);
- Draw_Char(32,1,Global_Int('Temp_Fkey_row'),Fnum_Color,80);
- IF (Parse_Int('/SR=',Global_Str('Com_Screen_Params'))) THEN
- Set_Global_Int('COM_STATUS_ROW',Screen_Length);
- ELSE
- Set_Global_Int('COM_STATUS_ROW',1);
- END;
- Set_Global_Int('Com_Full_Screen',False);
- RET;
-
- FULL_SCREEN:
- Kill_Box;
- X1 := 0;
- Y1 := (Parse_Int('/SR=',Global_Str('Com_Screen_Params')) = 0) + global_int('COM_MENU_BAR');
- X2 := Screen_Width + 1;
- Y2 := (Screen_Length + 1) - Parse_Int('/SR=',Global_Str('Com_Screen_Params'));
- Set_Global_Str('Com_Cur_Scrn_Params','/X1=' + Str(X1) + '/Y1=' + Str(Y1) +
- '/X2=' + Str(X2) + '/Y2=' + Str(Y2));
- Set_Vp(X1 + 1,Y1 + 1,X2 - 1,Y2 - 1);
- Draw_Char(32,1,Global_Int('Temp_status_row'),Stat1_Color,80);
- Draw_Char(32,1,Global_Int('Temp_Fkey_row'),Fnum_Color,80);
- IF (Parse_Int('/SR=',Global_Str('Com_Screen_Params'))) THEN
- Set_Global_Int('COM_STATUS_ROW',Screen_Length);
- ELSE
- Set_Global_Int('COM_STATUS_ROW',1);
- END;
-
- Call CLEAR_SCREEN;
- Set_Global_Int('Com_Full_Screen',True);
- RET;
-
- SET_TERM:
- Duplex := Parse_Int('/D=',Global_Str('Com_Terminal_Params'));
- Vp_Bs := Parse_Int('/BT=',Global_Str('Com_Terminal_Params'));
- Vp_Wrap := Parse_Int('/W=',Global_Str('Com_Terminal_Params'));
- Vp_Lf := Parse_Int('/CI=',Global_Str('Com_Terminal_Params'));
- Bs_Char := Char(Parse_Int('/BK=',Global_Str('Com_Terminal_Params')));
- RET;
-
- SET_PORT:
- Baud := Parse_Int('/B=',Global_Str('Com_Cur_Line_Params'));
- Parity := Parse_Int('/P=',Global_Str('Com_Cur_Line_Params'));
- Data_Bits := Parse_Int('/D=',Global_Str('Com_Cur_Line_Params'));
- Stop_Bits := Parse_Int('/S=',Global_Str('Com_Cur_Line_Params'));
- RET;
-
- INIT_PORT:
- Set_Global_Int('Com_Port_Num',Parse_Int('/C=',Global_Str('Com_Line_Params')));
- Baud := Parse_Int('/B=',Global_Str('Com_Line_Params'));
- Parity := Parse_Int('/P=',Global_Str('Com_Line_Params'));
- Data_Bits := Parse_Int('/D=',Global_Str('Com_Line_Params'));
- Stop_Bits := Parse_Int('/S=',Global_Str('Com_Line_Params'));
- Set_Global_Str('Com_Cur_Line_Params',
- '/C=' + Str(Global_Int('Com_Port_Num')) +
- '/B=' + Str(Baud) +
- '/P=' + Str(Parity) +
- '/D=' + Str(Data_Bits) +
- '/S=' + Str(Stop_Bits)
- );
- RET;
-
-
- def_int( stat_row );
- WRITE_STATUS:
- {If any mods are made to the format of the status line, you must follow through
- with mods to the mouse zones and to the position that the date and time gets
- written in COM_DATE_TIME.
- Also, the ASCII UPLOADING message in COM_ASCII_UP.
- }
- stat_row := Global_Int('COM_STATUS_ROW');
- TStr := 'HELP ' + Copy(Global_Str('!COM_HELP') + ' ',1,7) + '│MENU ' +
- Copy(Global_Str('!COM_MENU') + ' ',1,7) + '│COM' +
- Str(Global_Int('Com_Port_Num')) + ' ';
- IF (Global_Int('Com_Port_Open')) THEN
- TStr := TStr +
- Copy(' 110 300 450 600 1200 2400 4800 960019200',
- (Baud * 5) + 1,5) + ' ' +
- Str(Data_Bits + 5) + ' ' +
- Str(Stop_Bits + 1) + ' ' +
- Copy('NOE', Parity + 1,1);
- ELSE
- TStr := TStr + 'CLOSED ';
- END;
- TStr := TStr + '│LOG ' + Copy('CLOSEDOPEN ',
- (Global_Int('Com_Logging') * 6) + 1,6) + '│' +
- Copy(Parse_Str('/T=',Global_Str('Com_Terminal_Params')) + ' ',1,8) +
- '│' + Date + ' ' + STR_DEL(TIME,6,3) + ' ';
-
-
- WRITE(TStr,1,stat_row,0,Stat2_Color);
- IF (Global_Int('Com_ASCII_Download')) THEN
- WRITE(' ASCII DOWNLOADING ',43,Global_Int('COM_STATUS_ROW'),0,Working_Color);
- END;
-
- IF global_int('COM_MENU_BAR') THEN
- ++stat_Row;
- Draw_Char(32, 1, stat_row, m_t_color, screen_width );
- Write('File Phone Setup Display Message-editor Quit', 1, stat_row, 0, m_t_color );
- Draw_Char( 70, 1, stat_row, m_s_color, 1 );
- Draw_Char( 80, 6, stat_row, m_s_color, 1 );
- Draw_Char( 83, 12, stat_row, m_s_color,1 );
- Draw_Char( 68, 18, stat_row, m_s_color,1 );
- Draw_Char( 77, 26, stat_row, m_s_color,1 );
- Draw_Char( 81, 41, stat_row, m_s_color,1 );
- --stat_row;
- END;
- RET;
-
- {*****************************************************************************}
-
- error_exit:
-
- exit:
- {This kills the box from the QUIT menu}
- Kill_Box;
-
- IF (Global_Int('Com_Full_Screen') = False) THEN
- Kill_Box;
- END;
- Set_Vp(1,1,Screen_Width,Screen_Length);
- IF (Global_Int('Com_Logging')) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 241;
- RM('COM_LOG_ERROR');
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- END;
- Error := S_Close_File(Global_Int('Com_Log_Handle'));
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- END;
- Set_Global_Int('Com_Logging',False);
- END;
- IF (Global_Int('Com_ASCII_Download')) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_ASCII_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 241;
- RM('COM_LOG_ERROR /A=1');
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- END;
- Error := S_Close_File(Global_Int('Com_ASCII_Handle'));
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- END;
- Set_Global_Int('Com_ASCII_Download',False);
- END;
- Set_Global_Str('Com_Log_Str','');
- Switch_Window(Active_Window);
- {dump all non-transient macros}
-
- UNLOAD_MACRO('COM_DUMB');
- UNLOAD_MACRO('COM_ANSI');
-
- Refresh := True;
- status_row := Global_Int('Temp_status_row');
- fkey_row := Global_Int('Temp_fkey_row');
- Message_Row := Global_Int('Temp_Message_Row');
- {The new timer event system}
- kill_timer_event(Timer_Handle);
- Mode := T_Mode;
-
- {Get rid of most com related globals}
- Set_Global_Int('COM_FULL_SCREEN',0);
- Set_Global_Int('COM_FIRST_LOG',0);
- Set_Global_Int('TEMP_MESSAGE_ROW',0);
- Set_Global_Int('TEMP_STATUS_ROW',0);
- Set_Global_Int('TEMP_FKEY_ROW',0);
- Set_Global_Int('TEMP_EMS_STAT',0);
- Set_Global_Str('Com_Cur_Scrn_Params','');
- Set_Global_Str('COM_LOG_FILE','');
- Set_Global_Int('COM_MENU_LEVEL',0);
- new_screen;
- Undo_Stat := True;
- Set_Global_Int('MENU_LEVEL',Global_Int('MENU_LEVEL') - 1);
- {
- IF (Box_Count <> Global_Int('COM_Box_Count')) THEN
- Beep;
- Make_Message('Box_Count=' + Str(Box_Count) + ' COM_Box_Count=' + Str(Global_Int('COM_Box_Count')));
- Read_Key;
- END;
- }
- END_MACRO;
-
- $MACRO COM_DATE_TIME;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_DATE_TIME
-
- Description: Updates the date and time on the MECOM staus line. Intended to
- be run via the timer event system.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {
- WRITE('Box_Count=' + Str(Box_Count) + ' COM_Box_Count=' + Str(Global_Int('COM_Box_Count')) + ' ',1,Global_Int('COM_STATUS_ROW'),0,Stat2_Color);
- }
- IF ((Global_Int('COM_NO_STAT') = 0) and
- (Global_Int('MENU_LEVEL') <= Global_Int('COM_MENU_LEVEL'))) THEN
- WRITE(Date + ' ' + STR_DEL(TIME,6,3),64,Global_Int('COM_STATUS_ROW'),0,Stat2_Color);
- END;
- END_MACRO;
-
- $MACRO COM_HELP TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_HELP
-
- Description: The comunications help.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(T_No_Stat);
- T_No_Stat := Global_Int('COM_NO_STAT');
- Set_Global_Int('COM_NO_STAT',True);
- Help('MECOM^QR');
- Set_Global_Int('COM_NO_STAT',T_No_Stat);
- END_MACRO;
-
- $MACRO COM_MAIN_MENU;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_MAIN_MENU
-
- Description: The comunications module top level menu.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Create_Global_Str('COMSTR_1','/H=MECOM^FIL/M=MECOM^COM_FILE_MENU');
- Create_Global_Str('XCOMSTR_1','File');
- Create_Global_Str('COMSTR_2','/H=MECOM^PHON/M=MECOM^COM_PHONE_MENU');
- Create_Global_Str('XCOMSTR_2','Phone');
- Create_Global_Str('COMSTR_3','/H=MECOM^SET/M=MECOM^COM_SETUP_MENU');
- Create_Global_Str('XCOMSTR_3','Setup');
- Create_Global_Str('COMSTR_4','/H=MECOM^SCR/M=MECOM^COM_SCREEN_MENU');
- Create_Global_Str('XCOMSTR_4','Display');
- Create_Global_Str('COMSTR_5','/H=MECOM^ME/S=2/M=MECOM^COM_SEND_MSG');
- Create_Global_Str('XCOMSTR_5','Message-editor');
- Create_Global_Str('COMSTR_6','/H=MECOM^QUI/M=MECOM^COM_QUIT');
- Create_Global_Str('XCOMSTR_6','Quit');
-
- RM('USERIN^TOPMENU /M=XCOMSTR_/G=COMSTR_/#=6/X=1/S=1/L=COMMUNICATIONS MAIN MENU/Y=2/GCLR=1/B=' + str(global_int('COM_MENU_BAR')));
-
- END_MACRO;
-
- $MACRO COM_SETUP_MENU;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SETUP_MENU
-
- Description: The comunications module installation and setup menu.
-
- Parameters:
- /X= The upper left corner X coordinate of the menu box.
- /Y= The upper left corner Y coordinate of the menu box.
- /BK= Kill box when done, used when calling from a keystroke.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Set_Global_Int('COM_CHANGES_MADE',0);
- Create_Global_Str('COMSETSTR_1','/H=MECOM^SETGEN/M=MECOM^COM_SETUP /TP=1');
- Create_Global_Str('XCOMSETSTR_1','General(file names, etc.)... ^' + global_str('!COM_SM_KEY1'));
- Create_Global_Str('COMSETSTR_2','/H=MECOM^SETMOD/M=MECOM^COM_SETUP /TP=2');
- Create_Global_Str('XCOMSETSTR_2','Modem... ^' + global_str('!COM_SM_KEY2'));
- Create_Global_Str('COMSETSTR_3','/H=MECOM^SETTER/M=MECOM^COM_SETUP /TP=3');
- Create_Global_Str('XCOMSETSTR_3','Terminal... ^' + global_str('!COM_SM_KEY3'));
- Create_Global_Str('COMSETSTR_4','/H=MECOM^SETPOR/M=MECOM^COM_SETUP /TP=4');
- Create_Global_Str('XCOMSETSTR_4','com Port settings(baud rate, etc.)... ^' + global_str('!COM_SM_KEY4'));
- Create_Global_Str('COMSETSTR_5','/H=MECOM^SETSCR/M=MECOM^COM_SETUP /TP=5');
- Create_Global_Str('XCOMSETSTR_5','Screen... ^' + global_str('!COM_SM_KEY5'));
- Create_Global_Str('COMSETSTR_6','');
- Create_Global_Str('XCOMSETSTR_6','|254');
- Create_Global_Str('COMSETSTR_7','/H=MECOM^SETDNL/M=MECOM^COM_SETUP /TP=6');
- Create_Global_Str('XCOMSETSTR_7','Download Protocols... ^' + global_str('!COM_SM_KEY7'));
- Create_Global_Str('COMSETSTR_8','/H=MECOM^SETUPL/M=MECOM^COM_SETUP /TP=7');
- Create_Global_Str('XCOMSETSTR_8','Upload Protocols... ^' + global_str('!COM_SM_KEY8'));
- Create_Global_Str('COMSETSTR_9','/H=MECOM^SETASC/M=MECOM^COM_SETUP /TP=8');
- Create_Global_Str('XCOMSETSTR_9','asCii transfer... ^' + global_str('!COM_SM_KEY9'));
- Create_Global_Str('COMSETSTR_10','');
- Create_Global_Str('XCOMSETSTR_10','|254');
- Create_Global_Str('COMSETSTR_11','/H=MECOM^SETSAV/S=2/M=MECOM^COM_SETUP /TP=10');
- Create_Global_Str('XCOMSETSTR_11','saVe setup ^' + global_str('!COM_SM_KEY11'));
-
- RM('USERIN^SUBMENU /M=XCOMSETSTR_/G=COMSETSTR_/#=11/S=1/L=SETUP/BC=1/GCLR=1/X='
- + Parse_Str('/X=',MParm_Str) + ' /Y=' + Parse_Str('/Y=',MParm_Str));
-
- IF ((Parse_Int('/BK=',MParm_Str) = True) and (Return_Int = 9)) THEN
- Kill_Box;
- END;
- END_MACRO;
-
- $MACRO COM_PHONE_MENU;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_PHONE_MENU
-
- Description: The comunications module menu for dialing, etc.
-
- Parameters:
- /X= The upper left corner X coordinate of the menu box.
- /Y= The upper left corner Y coordinate of the menu box.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Create_Global_Str('COMPHONESTR_1','/H=MECOM^PHONAUT/M=MECOM^COM_PHONE /TP=1');
- Create_Global_Str('XCOMPHONESTR_1','autoDial directory... ^' + global_str('!COM_PM_KEY1'));
- Create_Global_Str('COMPHONESTR_2','/H=MECOM^PHONMAN/M=MECOM^COM_PHONE /TP=2');
- Create_Global_Str('XCOMPHONESTR_2','Manual dialing... ^' + global_str('!COM_PM_KEY2'));
- Create_Global_Str('COMPHONESTR_3','/H=MECOM^PHONRED/S=2/M=MECOM^COM_PHONE /TP=4');
- Create_Global_Str('XCOMPHONESTR_3','Redial last dialed number ^' + global_str('!COM_PM_KEY3'));
- Create_Global_Str('COMPHONESTR_4','');
- Create_Global_Str('XCOMPHONESTR_4','|254');
- Create_Global_Str('COMPHONESTR_5','/H=MECOM^PHONHAN/S=2/M=MECOM^COM_PHONE /TP=3');
- Create_Global_Str('XCOMPHONESTR_5','Hang up ^' + global_str('!COM_PM_KEY5'));
- Create_Global_Str('COMPHONESTR_6','/H=MECOM^BREAK/S=2/M=MECOM^COM_SEND_BREAK');
- Create_Global_Str('XCOMPHONESTR_6','send a Break ^' + global_str('!COM_PM_KEY6'));
-
- RM('USERIN^SUBMENU /M=XCOMPHONESTR_/G=COMPHONESTR_/#=6/S=1/BC=1/L=PHONE/X='
- + Parse_Str('/X=',MParm_Str) + '/GCLR=1/Y=' + Parse_Str('/Y=',MParm_Str));
-
- END_MACRO;
-
- $MACRO COM_FILE_MENU;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_FILE_MENU
-
- Description: The comunications module menu for file functions.
-
- Parameters:
- /X= The upper left corner X coordinate of the menu box.
- /Y= The upper left corner Y coordinate of the menu box.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(log,choices);
- Log := Global_Int('Com_Logging') = True;
-
- Create_Global_Str('COMFILESTR_1','/H=MECOM^FILDOW/S=2/M=MECOM^COM_FILE /TP=1/KB=1');
- Create_Global_Str('XCOMFILESTR_1','Download... ^' + global_str('!COM_FM_KEY1'));
- Create_Global_Str('COMFILESTR_2','/H=MECOM^FILUPL/S=2/M=MECOM^COM_FILE /TP=2/KB=1');
- Create_Global_Str('XCOMFILESTR_2','Upload... ^' + global_str('!COM_FM_KEY2'));
- Create_Global_Str('COMFILESTR_3','');
- Create_Global_Str('XCOMFILESTR_3','|254');
- Create_Global_Str('COMFILESTR_4','/H=MECOM^FILLOG/M=MECOM^COM_FILE /TP=3/S=' + Str(Log * 2));
- Create_Global_Str('XCOMFILESTR_4',Copy(Copy('closeopen',(not(Log) * 5) + 1,5) + ' Log file... ',1,18) + '^' + global_str('!COM_FM_KEY4'));
- IF (Log) THEN
- Create_Global_Str('COMFILESTR_5','/H=MECOM^FILVIE/M=MECOM^COM_VIEW_FILE /LOG=1');
- Create_Global_Str('XCOMFILESTR_5','view/Edit log ^' + global_str('!COM_FM_KEY5'));
- Choices := 6;
- ELSE
- Choices := 5;
- END;
- Create_Global_Str('COMFILESTR_' + Str(Choices),'/H=MECOM^FILVIE/M=MECOM^COM_VIEW_FILE');
- Create_Global_Str('XCOMFILESTR_' + Str(Choices),'View/edit file... ^' + global_str('!COM_FM_KEY6'));
- ++Choices;
- Create_Global_Str('COMFILESTR_' + Str(Choices),'');
- Create_Global_Str('XCOMFILESTR_' + Str(Choices),'|254');
- ++Choices;
- Create_Global_Str('COMFILESTR_' + Str(Choices),'/H=MECOM^DOS/S=1/M=MECOM^COM_DIR_SHELL');
- Create_Global_Str('XCOMFILESTR_' + Str(Choices),'dos Shell ^' + global_str('!COM_FM_KEY8'));
- ++Choices;
- Create_Global_Str('COMFILESTR_' + Str(Choices),'/H=MECOM^QUI/M=MECOM^COM_QUIT');
- Create_Global_Str('XCOMFILESTR_' + Str(Choices),'Exit... ^' + global_str('!COM_FM_KEY9'));
-
- RM('USERIN^SUBMENU /M=XCOMFILESTR_/G=COMFILESTR_/#=' + Str(Choices) + '/S=1/BC=1/L=FILE/X='
- + Parse_Str('/X=',MParm_Str) + '/GCLR=1/Y=' + Parse_Str('/Y=',MParm_Str));
-
- END_MACRO;
-
- $MACRO COM_SCREEN_MENU;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SCREEN_MENU
-
- Description: The comunications module menu for screen functions.
-
- Parameters:
- /X= The upper left corner X coordinate of the menu box.
- /Y= The upper left corner Y coordinate of the menu box.
- /C= Clear screen. Don't invoke menu.
- Returns:
- Return_Str contains special parameters interpreted by the
- communications main macro to invoke certain actions.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- IF (Parse_Int('/C=',MParm_Str)) THEN
- Goto CLEAR_SCREEN;
- END;
-
- Def_Int(X1,Y1,X2,Y2);
- Create_Global_Str('COMSCRSTR_1','/H=MECOM^SCRBOX');
- Create_Global_Str('XCOMSCRSTR_1','Box ^' + global_str('!COM_DM_KEY1'));
- Create_Global_Str('COMSCRSTR_2','/H=MECOM^SCRFUL');
- Create_Global_Str('XCOMSCRSTR_2','Full screen ^' + global_str('!COM_DM_KEY2'));
- Create_Global_Str('COMSCRSTR_3','');
- Create_Global_Str('XCOMSCRSTR_3','|254');
- Create_Global_Str('COMSCRSTR_4','/H=MECOM^SCRCLE');
- Create_Global_Str('XCOMSCRSTR_4','Clear ^' + global_str('!COM_DM_KEY4'));
- Create_Global_Str('COMSCRSTR_5','/H=MECOM^DUMP/S=2/M=MECOM^COM_SCREEN_DUMP');
- Create_Global_Str('XCOMSCRSTR_5','Screen dump... ^' + global_str('!COM_DM_KEY5'));
-
- RM('USERIN^SUBMENU /M=XCOMSCRSTR_/G=COMSCRSTR_/#=5/S=1/BC=1/L=DISPLAY/X='
- + Parse_Str('/X=',MParm_Str) + '/GCLR=1/Y=' + Parse_Str('/Y=',MParm_Str));
-
- IF ((Return_Int = 2) and
- (Global_Int('Com_Full_Screen') = False)) THEN
- Return_Str := '/CLS=1/BOX=-1';
- END;
- IF ((Return_Int = 1) and
- (Global_Int('Com_Full_Screen') = True)) THEN
- Return_Str := '/CLS=1/BOX=1';
- END;
- IF (Return_Int = 3) THEN
- CLEAR_SCREEN:
- Text_Color_Vp := Parse_Int('/F=',Global_Str('Com_Color_Params')) or
- (Parse_Int('/B=',Global_Str('Com_Color_Params')) shl 4);
-
- IF (Parse_Int('/C=',MParm_Str) = 0) THEN
- Kill_Box;
- Kill_Box;
- END;
- Return_Str := '/CLS=1';
- END;
-
- END_MACRO;
-
- $MACRO COM_DIR_SHELL TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_DIR_SHELL
-
- Description: The comunications module call to the DOS shell.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Refresh := true;
- fkey_row := Global_Int('Temp_fkey_row');
- {
- Message_Row := Global_Int('Temp_Message_Row');
- }
- {run DIRSHELL as normal except disallow file loading}
- RM('DIRSHELL /S=1');
- fkey_row := 0;
- {
- Message_Row := 0;
- }
- Set_Vp(Parse_Int('/X1=',Global_Str('Com_Cur_Scrn_Params')) + 1,
- Parse_Int('/Y1=',Global_Str('Com_Cur_Scrn_Params')) + 1,
- Parse_Int('/X2=',Global_Str('Com_Cur_Scrn_Params')) - 1,
- Parse_Int('/Y2=',Global_Str('Com_Cur_Scrn_Params')) - 1);
- Text_Color_Vp := Parse_Int('/F=',Global_Str('Com_Color_Params')) +
- (Parse_Int('/B=',Global_Str('Com_Color_Params')) shl 4);
- refresh := false;
- END_MACRO;
-
- $MACRO COM_ERROR TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_ERROR
-
- Description: The comunications module error message handler.
-
- Parameters:
- Return_Int - the error code.
-
- Returns:
- Return_Str contains the error message.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Return_Str := '#' + Str(Return_Int);
-
- IF (Return_Int = 2) THEN
- Return_Str := 'Invalid COM port number';
- END;
- IF (Return_Int = 3) THEN
- Return_Str := 'COM port not open';
- END;
- IF (Return_Int = 6) THEN
- Return_Str := 'No serial port found';
- END;
- IF (Return_Int = 7) THEN
- Return_Str := 'Output queue full';
- END;
- IF (Return_Int = 9) THEN
- Return_Str := 'Com port already open';
- END;
- IF (Return_Int = 10) THEN
- Return_Str := 'Input queue is empty';
- END;
- IF (Return_Int = 52) THEN
- Return_Str := 'Invalid XMODEM parameter';
- END;
- IF (Return_Int = 53) THEN
- Return_Str := 'Unexpected control character';
- END;
- IF (Return_Int = 54) THEN
- Return_Str := 'Wrong packet number received';
- END;
- IF (Return_Int = 60) THEN
- Return_Str := 'No startup SOH received';
- END;
- IF (Return_Int = 61) THEN
- Return_Str := 'Incomplete packet received';
- END;
- IF (Return_Int = 62) THEN
- Return_Str := 'Overrun error or break received';
- END;
- IF (Return_Int = 63) THEN
- Return_Str := 'Checksum or CRC failed';
- END;
- IF (Return_Int = 64) THEN
- Return_Str := 'Remote aborted transfer';
- END;
- IF (Return_Int = 65) THEN
- Return_Str := 'Local aborted transfer';
- END;
- IF (Return_Int = 70) THEN
- Return_Str := 'Cannot open file';
- END;
- IF (Return_Int = 71) THEN
- Return_Str := 'Error writing to file';
- END;
- IF (Return_Int = 72) THEN
- Return_Str := 'Cannot close file';
- END;
- IF (Return_Int = 80) THEN
- Return_Str := 'No startup signal received';
- END;
- IF (Return_Int = 81) THEN
- Return_Str := 'Wrong startup character received';
- END;
- IF (Return_Int = 82) THEN
- Return_Str := 'Packet acknowledgement failure';
- END;
- IF (Return_Int = 83) THEN
- Return_Str := 'Receiver rejected last packet';
- END;
- IF (Return_Int = 84) THEN
- Return_Str := 'Final ACK not received';
- END;
- IF (Return_Int = 85) THEN
- Return_Str := 'Time out waiting for final ACK';
- END;
- IF (Return_Int = 86) THEN
- Return_Str := 'Unable to drain input or output queue';
- END;
- IF (Return_Int = 90) THEN
- Return_Str := 'Cannot open file';
- END;
- IF (Return_Int = 91) THEN
- Return_Str := 'Error reading file';
- END;
- IF (Return_Int = 92) THEN
- Return_Str := 'Cannot close file';
- END;
- IF (Return_Int = 200) THEN
- Return_Str := 'Not true YMODEM-Batch, try XMODEM-1K';
- END;
- END_MACRO;
-
- $MACRO COM_OPEN_PORT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_OPEN_PORT
-
- Description: The comunications module macro to open and initialize a com port.
-
- Parameters:
- /P= the port that is currently open. If no port is open, or you
- don't want the currently open port to be closed, set this to 0.
-
- NOTE: All other parameters are derived from Global_Str('COM_LINE_PARAMS').
-
- Returns:
- If successful, it will set the following global variables:
- Global_Int('Com_Port_Num') = /C=
- Global_Int('Com_Port_Open') = True
- If unsuccessful, it will set:
- Global_Int('Com_Port_Open') = False
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(Port_Num,Error,Jx,Already_Open);
- Def_Str(Line_Params);
-
- Line_Params := Global_Str('Com_Line_Params');
- port_num := Parse_Int('/C=',Line_Params);
-
- IF (Parse_Int('/P=',MParm_Str)) THEN
- error := close_com(Parse_Int('/P=',MParm_Str));
- END;
-
- error := open_com( port_num, Parse_Int('/IB=',Line_Params),
- Parse_Int('/OB=',Line_Params),
- Parse_Int('/I' + Str(Port_Num) + '=',Line_Params),
- Parse_Int('/A' + Str(Port_Num) + '=',Line_Params));
-
- Already_Open := (Error = 9);
- if ((error <> 0) and (Error <> 9)) then
- {Error 9 means com port is already open, so don't generate an error message for
- that.}
- Set_Global_Int('Com_Port_Open',False);
- Error_Level := 6000 + Error;
- RM('MEERROR /EM=Error opening port ' + str(port_num));
- Goto EXIT;
- ELSE
- Set_Global_Int('Com_Port_Num',Port_Num);
- Set_Global_Int('Com_Port_Open',True);
- end;
- error := set_com( port_num, 1,Parse_Int('/B=',Line_Params));
- error := set_com( port_num, 2,Parse_Int('/P=',Line_Params));
- error := set_com( port_num, 3,Parse_Int('/D=',Line_Params));
- error := set_com( port_num, 4,Parse_Int('/S=',Line_Params));
- error := set_com( port_num, 5,Parse_Int('/XON=',Line_Params));
- error := set_com( port_num, 6,Parse_Int('/XON=',Line_Params));
- error := set_com( port_num, 9,Parse_Int('/CTS=',Line_Params));
- error := set_com( port_num, 12,Parse_Int('/DTR=',Line_Params) or (Parse_Int('/RTS=',Line_Params) shl 1));
- error := set_com( port_num, 13,Parse_Int('/DTR=',Line_Params) or (Parse_Int('/RTS=',Line_Params) shl 1));
- error := set_com( port_num, 14,0);
- error := set_com( port_num, 15,0);
- IF (Already_Open) THEN
- error := write_com(port_num,'|17', jx);
- END;
- IF (Parse_Int('/T' + Str(Port_Num) + '=',Line_Params)) THEN
- IF (Global_Int('Com_Modem' + Str(Port_Num) + '_Init') = 0) THEN
- error := write_com(port_num,Parse_Str('/I=',Global_Str('Com_Modem_Params')) + '|13', jx);
- Set_Global_Int('Com_Modem' + Str(Port_Num) + '_Init',True);
- END;
- END;
-
- EXIT:
- END_MACRO;
-
- $MACRO COM_FILE TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_FILE
-
- Description: The comunications module macro for uploading, downloading, and
- dealing with the log file.
-
- Parameters:
- /MY= The upper Y coordinate for the menu box. Defaults to 3.
- /TP=
- 1 = download a file
- 2 = upload a file
- 3 = open/close log file
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(Menu_Y,Type,Error,Port_Num,Cursor_X,Temp_Cursor_X,Temp_Cursor_Y,
- Proto_Choice,logging,Active_Window);
- Def_Str(Protocol[20],Tstr,Error_Msg,Xfer_Direction[4],Command_Line,XFer_File[40]);
-
- Proto_Choice := Parse_Int('/KB=',MParm_Str);
- WHILE (Proto_Choice) DO
- Kill_Box;
- --Proto_Choice;
- END;
- Def_Char(T_Char);
- port_num := global_int('COM_PORT_NUM');
- XFer_File := '';
- Temp_Cursor_X := WhereX;
- Temp_Cursor_Y := WhereY;
- Menu_Y := Parse_Int('MY=',MParm_Str);
- IF (Menu_Y < 1) THEN
- Menu_Y := 3;
- END;
-
- {Look for special parameters}
- Type := Parse_Int('/TP=',MParm_Str);
- IF ((Type = 1) or (Type = 2)) THEN
- RM('MECOM^COM_PROTO_MENU /LO=2/X=15/Y=' + Str(Menu_Y + 2 + Type)
- + '/DU=' + Str(Type - 1));
- IF (Return_Int > 0) THEN
- IF (Type = 1) THEN
- Return_Str := '';
- Xfer_Direction := 'DOWN';
- ELSE
- Return_Str := Parse_Str('/UP=',Global_Str('Com_General_Params'));
- Xfer_Direction := 'UP';
- END;
- TStr := Global_Str('COM_PROTOCOL');
- IF (Parse_Int('PF=',Tstr) < 2) THEN
- {If no prompting for filename is configured, skip over that.}
- Return_Str := '';
- Goto SKIP_PROMPT;
- END;
- IF (Parse_Int('PF=',Tstr) = 2) THEN
- SINGLE_PROMPT:
- RM('USERIN^QUERYBOX /C=15/W=40/T=FILE TO ' + Xfer_Direction +
- 'LOAD/F2=Dir /L=' + Str(Menu_Y + 2 + Type));
-
- IF (Return_Int = 0) THEN
- Goto ABORT_XFER;
- END;
- IF (Return_Int = -1) THEN
- refresh := true;
- fkey_row := Global_Int('Temp_fkey_row');
- {
- Message_Row := Global_Int('Temp_Message_Row');
- }
- RM('DIRSHELL /S=1');
- fkey_row := 0;
- {
- Message_Row := 0;
- }
- refresh := false;
- If Return_Str <> '' THEN
- Goto SINGLE_PROMPT;
- END;
- END;
- END;
- IF (Parse_Int('PF=',Tstr) = 3) THEN
- Active_Window := Window_Id;
- Create_Window;
- Return_Str := 'MEXFER.LST';
- RM('Makeuserpath');
- File_Name := Return_Str;
- Xfer_File := Return_Str;
- File_Changed := False;
-
- Set_Global_Str('@XFER_EV!','/T=Dos Shell/KC=<F2>/W=13/K1=0/K2=60/R=100/MACRO=MECOM^COM_DIR_SHELL');
- RM('USERIN^EDITWINDOW /X=9/T=CREATE A LIST OF FILES TO UPLOAD/Y='
- + Str(Menu_Y + 2 + Type) + '/W=40/L=10/EV1=@XFER_EV!');
-
- IF (File_Changed = False) THEN
- Delete_Window;
- IF (Switch_Win_Id(Active_Window)) THEN
- END;
- Goto ABORT_XFER;
- END;
- RM('VERIFY /X=9/T=Continue transfer?');
- IF return_int = 0 THEN
- goto abort_xfer;
- END;
- {DSZ requires a CR/LF at EOF}
- Eof;
- TEXT('|13|10');
- Save_File;
-
- Error := Error_Level;
- Delete_Window;
- IF (Switch_Win_Id(Active_Window)) THEN
- END;
- IF (Error) THEN
- Error_Level := Error;
- RM('MEERROR');
- Goto ABORT_XFER;
- END;
- END;
- SKIP_PROMPT:
- Command_Line := Parse_Str('CL=',TStr);
- IF (Command_Line <> '') THEN
- IF (XPos(' ',Command_Line,1) = 0) THEN
- Command_Line := Command_Line + ' ';
- END;
- T_Char := Char(Parse_Int('IC=',TStr));
- IF (T_Char <> '|0') THEN
- error := write_com(Port_Num,T_Char,Proto_Choice);
- END;
-
- RM(Command_Line + '/DIR=' + Xfer_Direction + '/X=' +
- Str(Temp_Cursor_X) + '/Y=' + Str(Temp_Cursor_Y) + '/PRO=' +
- Parse_Str('PN=',Tstr) + '/FN=' + Return_Str + '/BATCH=' +
- Xfer_File);
- IF (Error_Level) THEN
- RM('MEERROR');
- END;
- END;
- ABORT_XFER:
- Tstr := Global_Str('Com_Cur_Scrn_Params');
- Set_Vp(Parse_Int('/X1=',Tstr) + 1,
- Parse_Int('/Y1=',Tstr) + 1,
- Parse_Int('/X2=',Tstr) - 1,
- Parse_Int('/Y2=',Tstr) - 1);
- Text_Color_Vp := Parse_Int('/F=',Global_Str('Com_Color_Params')) +
- (Parse_Int('/B=',Global_Str('Com_Color_Params')) shl 4);
- END;
- END;
-
- IF (Type = 3) THEN
- Logging := Global_Int('COM_LOGGING');
- IF (logging = 0) THEN
- COM_LOG_PROMPT:
- Return_Str := Global_Str('Com_Log_File');
- RM('USERIN^QUERYBOX /C=16/W=40/ML=80/H=MECOM^FILLOG/T=LOG FILE NAME/L=' + Str(Menu_Y + 7));
- IF (RETURN_INT) THEN
- IF (Return_Str = '') THEN
- Beep;
- Goto COM_LOG_PROMPT;
- END;
- IF (File_Exists(Return_Str)) THEN
- RM('USERIN^XMENU /B=1/T=1/X=16/Y=' + Str(Menu_Y + 7) + '/S=1/L=LOG FILE EXISTS' +
- '/M=Append(MECOM^FILLOG)Overwrite()aBort()');
- IF ((Return_Int < 1) or (Return_Int = 3)) THEN
- Goto ABORT_LOG_OPEN;
- END;
- IF (Return_Int = 1) THEN
- Error := S_Open_File(Return_Str,1,Proto_Choice);
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG_OPEN;
- END;
- Error := S_Move_File_Ptr(Proto_Choice,2,0);
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG_OPEN;
- END;
- Goto APPEND_LOG;
- END;
- IF (Return_Int = 2) THEN
- Goto NEW_LOG;
- END;
- ELSE
- NEW_LOG:
- Error := S_Create_File(Return_Str,Proto_Choice);
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG_OPEN;
- END;
- END;
- APPEND_LOG:
- Set_Global_Int('Com_Log_Handle',Proto_Choice);
- {If we are presently ASCII downloading, dump what's in the log buffer to the
- ASCII file before initializing to null}
- IF (Global_Int('Com_ASCII_Download')) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Proto_Choice);
- IF (Return_Int > Proto_Choice) THEN
- Return_Int := 241;
- RM('COM_LOG_ERROR /A=1');
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- END;
- END;
-
- Set_Global_Str('Com_Log_Str','');
- Set_Global_Str('Com_Log_File',Return_Str);
- Set_Global_Int('Com_Logging',True);
- Set_Global_Int('Com_First_Log',False);
- Goto EXIT;
- ELSE
- ABORT_LOG_OPEN:
- Goto EXIT;
- END;
- END;
- IF (Logging) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Proto_Choice);
- IF (Return_Int > Proto_Choice) THEN
- Return_Int := 241;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG_CLOSE;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG_CLOSE;
- END;
- Error := S_Close_File(Global_Int('Com_Log_Handle'));
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- END;
- ABORT_LOG_CLOSE:
- Set_Global_Int('Com_Logging',False);
- END;
- END;
- Goto EXIT;
-
- EXIT:
- END_MACRO;
-
- $MACRO COM_XFER_BEEP TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_XFER_BEEP
-
- Description: Called by any file transfer macro. Determines if the "Beep on
- uploads and downloads" option is enabled and beeps if it is.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- IF (Parse_Int('/A=',Global_Str('Com_General_Params')) <> 0) THEN
- RM('MEERROR^BEEPS /C=2/D=500/F=250/P=250');
- END;
- END_MACRO;
-
- $MACRO COM_LOG_ERROR TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_LOG_ERROR
-
- Description: An error handler for disk I/O errors relating the log or ASCII
- downloads.
-
- Parameters:
- /A= If 1 then error message will be for ASCII upload else for
- Log.
- Return_Int = the error number.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- IF (Parse_Int('/A=',MParm_Str)) THEN
- Return_Str := 'ASCII Upload';
- IF (S_Close_File(Global_Int('Com_ASCII_Handle'))) THEN END;
- Set_Global_Int('Com_ASCII_Download',False);
- ELSE
- Return_Str := 'Log';
- IF (S_Close_File(Global_Int('Com_Log_Handle'))) THEN END;
- Set_Global_Int('Com_Logging',False);
- END;
- Set_Global_Str('Com_Log_Str','');
- Error_Level := Return_Int;
- IF (Return_Int = 241) THEN
- RM('MEERROR /EM=' + Copy('ASCII UploadLog',((Parse_Int('/A=',MParm_Str) = 0) * 12) + 1,12) + ' file disk full error. File has been closed.');
- ELSE
- RM('MEERROR /EM=' + Copy('ASCII UploadLog',((Parse_Int('/A=',MParm_Str) = 0) * 12) + 1,12) + ' file disk error #' + str(3000 + Return_Int) + '. File has been closed.');
- END;
-
- END_MACRO;
-
- $MACRO COM_QUIT TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_QUIT
-
- Description: The comunications module quit prompt.
-
- Parameters:
- /X= The upper left corner X coordinate of the menu box.
- /Y= The upper left corner Y coordinate of the menu box.
-
- Returns:
- Return_Str = '/QUIT=1' if <ESC> is not pressed. This return_Str is
- to tell the com main program to exit the com module.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(T_Int,Port_Num);
-
- Return_Str := '';
- Create_Global_Str('COMQUITSTR_1','/H=MECOM^QUI');
- Create_Global_Str('XCOMQUITSTR_1','Yes');
- Create_Global_Str('COMQUITSTR_2','');
- Create_Global_Str('XCOMQUITSTR_2','No');
-
- RM('USERIN^SUBMENU /M=XCOMQUITSTR_/G=COMQUITSTR_/#=2/S=1/L=CLOSE COM PORT?/X='
- + Parse_Str('/X=',MParm_Str) + '/GCLR=1/Y=' + Parse_Str('/Y=',MParm_Str));
-
- IF (Return_Int) THEN
- Port_Num := Global_Int('Com_port_num');
- IF (Return_Int = 1) THEN
- T_Int := (close_com(Port_Num));
- ELSE
- {If port is to remain open, Send XOFF}
- T_Int := (write_com(port_num,'|19',T_Int));
- IF (Parse_Int('/T' + Str(Port_Num) + '=',Global_Str('Com_Line_Params')) = 0) THEN
- {If this is not connected to a modem, drop DTR}
- T_Int := set_com(port_num, 13,Parse_Int('/RTS=',Global_Str('Com_Line_Params')) shl 1);
- END;
- END;
- IF (Return_Int > 0) THEN
- Return_Str := '/QUIT=1';
- END;
- Set_Global_Int('Com_Port_Open',(Return_Int <> 1));
- END;
- END_MACRO;
-
- $MACRO COM_ASCII_DOWN TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_ASCII_DOWN
-
- Description: The comunications module ASCII download macro.
-
- Parameters:
- /QUIT= If 1, then terminate the download. If 0, then begin.
- /APPEND= If 1, then append the file rather than overwrite.
- /OVERWRITE= Unconditionally overwrites without prompting.
- Return_Str= The file name.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(ASCII_Handle,Error,Bytes_Written);
-
- {We are going use the log file buffer, so if it is active, save and flush.}
- IF (Global_Int('Com_Logging')) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Bytes_Written);
- IF (Return_Int > Bytes_Written) THEN
- Return_Int := 241;
- RM('COM_LOG_ERROR');
- Goto EXIT;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto EXIT;
- END;
- END;
- IF (Parse_Int('/QUIT=',MParm_Str)) THEN
- IF (Global_Int('Com_ASCII_Download')) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_ASCII_Handle'),Bytes_Written);
- IF (Return_Int > Bytes_Written) THEN
- Return_Int := 241;
- RM('COM_LOG_ERROR /A=1');
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- END;
- Error := S_Close_File(Global_Int('Com_ASCII_Handle'));
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- END;
- Set_Global_Int('Com_ASCII_Handle',0);
- Set_Global_Int('Com_ASCII_Download',False);
- Set_Global_Str('COM_ASCII_FILENAME','');
- END;
- {If they pressed the ASCII download terminate key, but were not downloading, pass
- the keystroke to the com port if it is a meaningful keystroke}
- IF (Key1 <> 0) THEN
- error := write_com(Global_int('Com_Port_Num'),Char(Key1),Bytes_Written);
- END;
-
- Goto EXIT;
- END;
- IF (File_Exists(Return_Str)) THEN
- IF (Parse_Int('/APPEND=',MParm_Str)) THEN
- Error := S_Open_File(Return_Str,1,Ascii_Handle);
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- Goto EXIT;
- END;
- Error := S_Move_File_Ptr(ASCII_Handle,2,0);
- Goto APPEND;
- ELSIF (Parse_Int('/OVERWRITE=',MParm_Str) = False) THEN
- RM('userin^VERIFY /L=10/C=10/H=MECOM^FILLOG/T=The file ' + Caps(Truncate_Path(Return_Str)) + ' already exists. Overwrite?');
- IF (Return_Int <> 1) THEN
- Goto EXIT;
- END;
- END;
- END;
- Error := S_Create_File(Return_Str,ASCII_Handle);
- APPEND:
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- Goto EXIT;
- END;
-
- Set_Global_Int('Com_ASCII_Handle',ASCII_Handle);
- Set_Global_Int('Com_ASCII_Download',True);
- Set_Global_Str('COM_ASCII_FILENAME',Return_Str);
-
- EXIT:
- Set_Global_Str('Com_Log_Str','');
- Return_Int := 100;
-
- END_MACRO;
-
- $MACRO COM_ASCII_UP TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_ASCII_UP
-
- Description: The comunications module ASCII upload macro.
-
- Parameters:
- /X= The X coordinate for the cursor to be positioned during the
- upload.
- /X= The Y coordinate for the cursor.
-
- /FN= The file name to upload.
-
- Returns:
- Return_Int = Error level if an error occurred.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(Timeout_Count,Port_Num,Error,Jx,Carriage_Return,Line_Feed,Pace_Char,
- Line_Pacing,Char_Pacing,Expand_Blanks,Echo,Added_LF,Out_Pointer);
- Def_Int(Buf_Length,CR_Pos,Pointer,File_Handle);
- Def_Str(File_Buf[2048],F_Name,Line_Out[2048],In_Buf,Term_Mac[25]);
- Def_Char(Ch, In_Ch);
-
- {Variables for special elapsed time code
- Def_Int(Start_Minutes,Start_Seconds,End_Minutes,End_Seconds);
- }
- WRITE(' ASCII UPLOADING ',44,Global_Int('COM_STATUS_ROW'),0,Working_Color);
- GotoXY(Parse_Int('/X=',MParm_Str),Parse_Int('/Y=',MParm_Str));
- Port_Num := Global_int('Com_Port_Num');
- Carriage_Return := Parse_Int('/CU=',Global_Str('Com_Ascii_Params'));
- Line_Feed := Parse_Int('/LU=',Global_Str('Com_Ascii_Params'));
- Line_Pacing := Parse_Int('/LP=',Global_Str('Com_Ascii_Params')) * 10;
- Pace_Char := Parse_Int('/PC=',Global_Str('Com_Ascii_Params'));
- Char_Pacing := Parse_Int('/CP=',Global_Str('Com_Ascii_Params'));
- Expand_Blanks := Parse_Int('/S=',Global_Str('Com_Ascii_Params'));
- Echo := Parse_Int('/E=',Global_Str('Com_Ascii_Params'));
- In_Buf := '';
- Term_Mac := 'MECOM^COM_' + Parse_Str('/T=',Global_Str('Com_Terminal_Params'))
- + ' /DO=';
-
- IF (S_Open_File(Parse_Str('/FN=',MParm_Str),0,File_Handle)) THEN
- Return_Int := 3;
- Goto OPEN_ERROR;
- END;
- {special development code for calculating elapsed time
- If ((Val(Start_Minutes,Copy(Time,4,2))) and (Val(Start_Seconds,Copy(Time,7,2)))) Then
- End;
- }
- MORE_FILE:
- IF (S_Read_Bytes(File_Buf,File_Handle,2048)) THEN
- Return_Int := 3;
- Goto ABORT;
- END;
- Buf_Length := Svl(File_Buf);
-
- Call PARSE_BUF;
-
- IF (Buf_Length = 2048) THEN
- Goto MORE_FILE;
- END;
- Goto DONE;
-
- PARSE_BUF:
- Pointer := 1;
-
- MORE_LINES:
- CR_Pos := XPos('|13',File_Buf,Pointer);
- IF (Cr_Pos = 0) THEN
- CR_Pos := Buf_Length;
- ELSE
- IF (XPos('|10',File_Buf,Cr_Pos) = (Cr_Pos + 1)) THEN
- ++Cr_Pos;
- END;
- END;
-
- Line_Out := Copy(File_Buf,Pointer,Cr_Pos - Pointer + 1);
-
- IF (Expand_Blanks) THEN
- {If this is a blank line, then expand it if Expand_Blanks is turned on}
- IF (Str_Char(Line_Out,1) = '|13') THEN
- Line_Out := ' ' + Line_Out;
- END;
- END;
-
- {If any filtering needs to be done, do it.}
- Added_Lf := 0;
- IF (Carriage_Return > 0) THEN
- FILTER_CR:
- Jx := XPos('|13',Line_Out,1);
- IF (Jx) THEN
- IF (Carriage_Return = 2) THEN
- {Strip CR}
- Line_Out := Str_Del(Line_Out,Jx,1);
- Goto FILTER_CR;
- END;
- IF (Carriage_Return = 1) THEN
- {Add a LF}
- Line_Out := Line_Out + '|10';
- {Use this as a flag to indicate to the LF filtering not to process}
- Added_Lf := SVL(Line_Out);
- END;
- END;
- END;
- IF (Line_Feed > 0) THEN
- FILTER_LF:
- Jx := XPos('|10',Line_Out,1);
- IF (Jx > Added_Lf) THEN
- IF (Line_Feed = 2) THEN
- {Strip LF}
- Line_Out := Str_Del(Line_Out,Jx,1);
- Goto FILTER_LF;
- END;
- IF (Line_Feed = 1) THEN
- {Add CR}
- Line_Out := Str_Ins('|13',Line_Out,Jx + 1);
- END;
- END;
- END;
-
- IF (Echo) THEN
- RM(Term_Mac + Line_Out);
- END;
-
- IF (Char_Pacing > 0) THEN
- Call SEND_CHARS;
- ELSE
- SEND_LINE:
- error := write_com(port_num,Line_Out,Jx);
- IF (Check_Key) THEN
- IF (Key1 = 27) THEN
- Return_Int := 1;
- Goto ABORT;
- END;
- END;
- IF (Jx < Svl(Line_Out)) THEN
- {If the whole line didn't get sent, try sending the remainder of the line}
- Line_Out := Copy(Line_Out,Jx + 1,2048);
- Goto SEND_LINE;
- END;
- END;
-
- LINE_SENT:
- Delay(Char_Pacing);
- Call CHECK_FOR_REMOTE;
- Pointer := Cr_Pos + 1;
- Delay(Line_Pacing);
- IF (Pace_Char) THEN
- Call CHECK_FOR_PACE_CHAR;
- ELSE
- Call CHECK_FOR_REMOTE;
- END;
-
- IF (Pointer < Buf_Length) THEN
- Goto MORE_LINES;
- END;
- RET;
-
- SEND_CHARS:
- Out_Pointer := 0;
- WHILE (Out_Pointer < Svl(Line_Out)) DO
- ++Out_Pointer;
- CHAR_AGAIN:
- error := write_com(port_num,Copy(Line_Out,Out_Pointer,1),Jx);
- IF (Check_Key) THEN
- IF (Key1 = 27) THEN
- Return_Int := 1;
- Goto ABORT;
- END;
- END;
- Delay(Char_Pacing);
- Call CHECK_FOR_REMOTE;
- IF (Jx = 0) THEN
- Goto CHAR_AGAIN;
- END;
- END;
- Ret;
-
- CHECK_FOR_REMOTE:
- WHILE (read_com(port_num, In_Ch) = 0) DO
- IF (Svl(In_Buf) > 253) THEN
- RM(Term_Mac + In_Buf);
- In_Buf := In_Ch;
- ELSE
- In_Buf := In_Buf + In_Ch;
- END;
- Delay(Char_Pacing);
- END;
- IF (Svl(In_Buf)) THEN
- RM(Term_Mac + In_Buf);
- END;
- In_Buf := '';
- RET;
-
- CHECK_FOR_PACE_CHAR:
-
- WAIT:
- IF (Check_Key) THEN
- IF (Key1 = 27) THEN
- Return_Int := 1;
- Goto ABORT;
- END;
- END;
- IF (read_com(port_num, In_Ch) = 0) THEN
- IF (In_Ch = Char(Pace_Char)) THEN
- IF (Svl(In_Buf)) THEN
- RM(Term_Mac + In_Buf);
- END;
- In_Buf := '';
- Ret;
- ELSE
- IF (Svl(In_Buf) > 253) THEN
- RM(Term_Mac + In_Buf);
- In_Buf := In_Ch;
- ELSE
- In_Buf := In_Buf + In_Ch;
- END;
- END;
- END;
- Goto WAIT;
-
- DONE:
- {special development code to determine elapsed time
- If ((Val(End_Minutes,Copy(Time,4,2))) and (Val(End_Seconds,Copy(Time,7,2)))) Then
- End;
- If (Start_Seconds > End_Seconds) Then
- End_Seconds := End_Seconds + 60;
- --End_Minutes;
- End;
- If (Start_Minutes > End_Minutes) Then
- End_Minutes := End_Minutes + 60;
- End;
- Write_VP('Elapsed time ' + Str(End_Minutes - Start_Minutes) + ':' + Str(End_Seconds - Start_Seconds) + '|13|10');
- Read_Key;
- }
- Call CHECK_FOR_REMOTE;
- Return_Int := False;
-
- ABORT:
- {Close the file}
- Error := S_Close_File(File_Handle);
-
- OPEN_ERROR:
- IF (Return_Int) THEN
- Error_Level := Return_Int;
- RM('MEERROR /EM=ASCII upload error ' + str(Error_Level));
- END;
-
- Return_Str := '/DRC=1';
- END_MACRO;
-
- $MACRO COM_PROTO_MENU;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_PROTO_MENU
-
- Description: This macro creates a special menu of file transfer protocols.
-
- Parameters:
- /X= The upper left corner X coordinate of the menu box.
- /Y= The upper left corner Y coordinate of the menu box.
- /DU= If 0 then download. If 1 then upload.
- /LO= List only. If 1, just bring up the menu. Don't allow
- editing of menu choices.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(X,Y);
- Def_Str(Direction[8]);
-
- Direction := Copy('DOWNLOADUPLOAD',(Parse_Int('/DU=',MParm_Str) * 8) + 1,8);
- X := Parse_Int('/X=',MParm_Str);
- IF (X = 0) THEN
- X := 3;
- END;
- Y := Parse_Int('/Y=',MParm_Str);
- IF (Y = 0) THEN
- Y := 3;
- END;
-
- RM('USERIN^DB /GLO=COM_PROTOCOL/LO=' + Parse_Str('/LO=',MParm_Str) +
- '/PRE=PROTO/NOALPHA=1/NDF=1/ENC=1/X=' + Str(X) + '/F=MECOM.DB' +
- '/Y=' + Str(Y) + '/DPT=' + Direction + '.DB/LT=' +
- Direction + ' PROTOCOLS/HPT=DOWNLOAD.DB/DT=' + Direction +
- ' PROTOCOL MACRO SETUP/H=MECOM^SETDNL');
-
- IF (Return_Int = 0) THEN
- Set_Global_Str('COM_PROTOCOL','');
- END;
-
- EXIT:
-
- END_MACRO;
-
- $MACRO COM_SETUP TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SETUP
-
- Description: The comunications module installation and setup macro.
-
- Parameters:
- /X= The upper left corner X coordinate reference point.
- /Y= The upper left corner Y coordinate reference point.
- /TP=
- 1 - General parameters
- 2 - modem parameters
- 3 - terminal parameters
- 4 - line parameters
- 5 - screen parameters
- 6 - download protocols
- 7 - upload protocols
- 8 - Ascii parameters
- 10 - save setup
-
- Returns:
- Global_Int('COM_CHANGES_MADE')
- If not 0 then parse out the following bits:
- Bit 0 = changed general parameters
- Bit 1 = changed modem parameters
- Bit 2 = changed terminal parameters
- Bit 3 = changed port parameters
- Bit 4 = changed screen parameters
- Bit 5 = changed ascii parameters
- Return_Int
- Only useful to SUBMENU. Tells whether or not to kill all the
- boxes.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- def_str(X_Str[2],Y_Str[2],B_Str[10],Direction[8],G_Str,H_Str[30],MStr);
- def_int(jx,Sub_Choice,Menu_X,Menu_Y,T_Fore,T_Back,Changes_Made,Type,Start_Line,Search_Amount);
-
- Menu_X := Parse_Int('/X=',MParm_Str);
- Menu_Y := Parse_Int('/Y=',MParm_Str);
- IF (Menu_X < 1) THEN
- Menu_X := 1;
- END;
- IF (Menu_Y < 9) THEN
- Menu_Y := 9;
- END;
-
- Type := Parse_Int('/TP=',MParm_Str);
- X_Str := Str(Menu_X);
- Y_Str := Str(Menu_Y + Type - 8);
-
- Changes_Made := Global_Int('COM_CHANGES_MADE');
-
- {If we don't have a window for the MECOM.DB, create one.}
- IF (Switch_Win_Id(Global_Int('Com_Init_Window')) = 0) THEN
- Switch_Window(Window_Count);
- Create_Window;
- Set_Global_Int('Com_Init_Window',Window_ID);
- return_str := 'MECOM.DB';
- RM('MakeUserPath /DF=1');
- Load_File(Return_Str);
- {If this file is empty, abort this sucker!}
- IF (At_Eof) THEN
- Error_Level := 3002;
- RM('MEERROR /EM=CAN''T FIND: ' + Return_Str + ', OR FILE IS EMPTY! ABORTING MECOM SETUP. PLEASE EXIT MECOM AND CORRECT THIS PROBLEM.');
- Goto EXIT;
- END;
- {Find the page title INITCOM.ME or create if not there}
- IF (Search_Fwd('|12INITCOM.ME',0) = 0) THEN
- Eof;
- IF (C_Col > 1) THEN
- Down;
- END;
- Put_Line('|12INITCOM.ME');
- END;
- {Save the beginning position}
- Start_Line := C_Line;
- Eol;
- {Find the next page title or EOF}
- IF (Search_Fwd('|12',0) = 0) THEN
- Eof;
- IF (C_Col > 1) THEN
- Down;
- END;
- END;
- Search_Amount := C_Line - Start_Line;
- ELSE
- Start_Line := Parse_Int('/SL=',Global_Str('COM_INIT_WINDOW'));
- Search_Amount := Parse_Int('/SA=',Global_Str('COM_INIT_WINDOW'));
- END;
- window_attr := $81;
-
- IF (Type = 1) THEN
- Call SETUP_GENERAL;
- END;
- IF (Type = 2) THEN
- Call SETUP_MODEM;
- END;
- IF (Type = 3) THEN
- Call SETUP_TERMINAL;
- END;
- IF (Type = 4) THEN
- Call SETUP_PORT;
- END;
- IF (Type = 5) THEN
- Call SETUP_SCREEN;
- END;
- IF ((Type = 6) or (Type = 7)) THEN
- Direction := Copy('DOWNLOADUPLOAD',((Type - 6) * 8) + 1,8);
- Call SETUP_PROTOCOL;
- END;
- IF (Type = 8) THEN
- Call SETUP_ASCII;
- END;
- IF (Type = 10) THEN
- Call SAVE_SETUP;
- END;
- Goto EXIT;
- {********************************** SUBROUTINES ******************************}
- SETUP_GENERAL:
- G_Str := Global_Str('Com_General_Params');
- Set_Global_Str('ISTR_1',Parse_Str('/DP=',G_Str));
- Set_Global_Str('IPARM_1','/C=1/L=1/W=44/H=MECOM^SETGEN/T=Download path ');
- Set_Global_Str('ISTR_2',Parse_Str('/UP=',G_Str));
- Set_Global_Str('IPARM_2','/C=1/L=2/W=44/H=MECOM^SETGEN/T=Upload path ');
- Set_Global_Str('ISTR_3',Parse_Str('/LF=',G_Str));
- Set_Global_Str('IPARM_3','/C=1/L=3/W=44/ML=80/H=MECOM^SETGEN/T=Log File ');
- Set_Global_Str('ISTR_4','/T=On/F=Off');
- Set_Global_Int('IINT_4',Parse_Int('/A=',G_Str));
- Set_Global_Str('IPARM_4','/C=1/L=4/W=3/H=MECOM^SETGEN/TP=5/T=Beep on downloads and uploads ');
- Set_Global_Str('ISTR_5','/T=On/F=Off');
- Set_Global_Int('IINT_5',Parse_Int('/VWW=',G_Str));
- Set_Global_Str('IPARM_5','/C=1/L=5/W=3/H=MECOM^SETGEN/TP=5/T=Word wrap in file viewer ');
- Set_Global_Int('IINT_6',Parse_Int('/VRM=',G_Str));
- Set_Global_Str('IPARM_6','/TP=1/C=1/L=6/W=4/H=MECOM^SETGEN/T=Right margin for file viewer ');
- Set_Global_Str('ISTR_7','/T=On/F=Off');
- Set_Global_Int('IINT_7',Parse_Int('/MWW=',G_Str));
- Set_Global_Str('IPARM_7','/C=1/L=7/W=3/H=MECOM^SETGEN/TP=5/T=Word wrap in message editor ');
- Set_Global_Int('IINT_8',Parse_Int('/MRM=',G_Str));
- Set_Global_Str('IPARM_8','/TP=1/C=1/L=8/W=4/H=MECOM^SETGEN/T=Right margin for message editor');
-
- RM( 'USERIN^DATA_IN /A=2/#=8/S=1/X=3/T=GENERAL SETUP/X=' + X_Str +
- '/Y=' + Y_Str);
-
- IF (Return_Int) THEN
- Changes_Made := Changes_Made or $01;
- {be sure trailing '\' is included on D/L and U/L path}
- IF (Global_Str('ISTR_1') <> '') THEN
- IF (Copy(Global_Str('ISTR_1'),Length(Global_Str('ISTR_1')),1) <> '\') THEN
- Set_Global_Str('ISTR_1',Global_Str('ISTR_1') + '\');
- END;
- END;
- IF (Global_Str('ISTR_2') <> '') THEN
- IF (Copy(Global_Str('ISTR_2'),Length(Global_Str('ISTR_2')),1) <> '\') THEN
- Set_Global_Str('ISTR_2',Global_Str('ISTR_2') + '\');
- END;
- END;
- Set_Global_Str('Com_General_Params','/GENERAL=' +
- '/DP=' + Caps(Global_Str('ISTR_1')) +
- '/UP=' + Caps(Global_Str('ISTR_2')) +
- '/LF=' + Caps(Global_Str('ISTR_3')) +
- '/A=' + Str(Global_Int('IINT_4')) +
- '/VWW=' + Str(Global_Int('IINT_5')) +
- '/VRM=' + Str(Global_Int('IINT_6')) +
- '/MWW=' + Str(Global_Int('IINT_7')) +
- '/MRM=' + Str(Global_Int('IINT_8'))
- );
- END;
- Ret;
-
- SETUP_MODEM:
- G_Str := Global_Str('Com_Modem_Params');
- Set_Global_Str('ISTR_1',Parse_Str('/XP=',G_Str));
- Set_Global_Str('IPARM_1','/C=1/L=1/W=1/H=MECOM^SETMOD/T=2 second pause substitute character ');
- Set_Global_Str('ISTR_2',Parse_Str('/XC=',G_Str));
- Set_Global_Str('IPARM_2','/C=1/L=2/W=1/H=MECOM^SETMOD/T=Carriage return substitute character');
- Set_Global_Str('ISTR_3',Parse_Str('/XT=',G_Str));
- Set_Global_Str('IPARM_3','/C=1/L=3/W=1/H=MECOM^SETMOD/T=Control substitute character ');
- Set_Global_Str('ISTR_4',Parse_Str('/XE=',G_Str));
- Set_Global_Str('IPARM_4','/C=1/L=4/W=1/H=MECOM^SETMOD/T=Escape substitute character ');
- Set_Global_Str('ISTR_5',Parse_Str('/I=',G_Str));
- Set_Global_Str('IPARM_5','/C=1/L=5/W=37/H=MECOM^SETMOD/T=Modem initialization command ');
- Set_Global_Str('ISTR_6',Parse_Str('/DC=',G_Str));
- Set_Global_Str('IPARM_6','/C=1/L=6/W=37/H=MECOM^SETMOD/T=Dialing command prefix ');
- Set_Global_Str('ISTR_7',Parse_Str('/DS=',G_Str));
- Set_Global_Str('IPARM_7','/C=1/L=7/W=37/H=MECOM^SETMOD/T=Dialing command suffix ');
- Set_Global_Str('ISTR_8',Parse_Str('/H=',G_Str));
- Set_Global_Str('IPARM_8','/C=1/L=8/W=37/H=MECOM^SETMOD/T=Hangup command ');
- Set_Global_Str('ISTR_9','/F=Send hangup command/T=Drop DTR');
- Set_Global_Int('IINT_9',Parse_Int('/HM=',G_Str));
- Set_Global_Str('IPARM_9','/TP=5/C=1/L=9/W=19/H=MECOM^SETMOD/T=Hangup method ');
- Set_Global_Int('IINT_10',Parse_Int('/RT=',G_Str));
- Set_Global_Str('IPARM_10','/TP=1/C=1/L=10/W=2/H=MECOM^SETMOD/T=Redial timeout ');
- Set_Global_Int('IINT_11',Parse_Int('/RP=',G_Str));
- Set_Global_Str('IPARM_11','/TP=1/C=1/L=11/W=2/H=MECOM^SETMOD/T=Redial pause ');
- Set_Global_Str('ISTR_12',Parse_Str('/CS=',G_Str));
- Set_Global_Str('IPARM_12','/C=1/L=12/W=37/H=MECOM^SETMOD/T=Modem connect response ');
- Set_Global_Str('ISTR_13',Parse_Str('/NC1=',G_Str));
- Set_Global_Str('IPARM_13','/C=1/L=13/W=37/H=MECOM^SETMOD/T=Modem no connect response 1 ');
- Set_Global_Str('ISTR_14',Parse_Str('/NC2=',G_Str));
- Set_Global_Str('IPARM_14','/C=1/L=14/W=37/H=MECOM^SETMOD/T=Modem no connect response 2 ');
- Set_Global_Str('ISTR_15',Parse_Str('/NC3=',G_Str));
- Set_Global_Str('IPARM_15','/C=1/L=15/W=37/H=MECOM^SETMOD/T=Modem no connect response 3 ');
- Set_Global_Str('ISTR_16',Parse_Str('/NC4=',G_Str));
- Set_Global_Str('IPARM_16','/C=1/L=16/W=37/H=MECOM^SETMOD/T=Modem no connect response 4 ');
-
- RM( 'USERIN^DATA_IN /A=2/#=16/S=1/T=MODEM SETUP/X=' + X_Str +
- '/Y=' + Y_Str);
-
-
- IF (Return_Int) THEN
- Changes_Made := Changes_Made or $02;
- Set_Global_Str('Com_Modem_Params','/MODEM=' +
- '/XP=' + Caps(Global_Str('ISTR_1') +
- '/XC=' + Global_Str('ISTR_2') +
- '/XT=' + Global_Str('ISTR_3') +
- '/XE=' + Global_Str('ISTR_4') +
- '/I=' + Global_Str('ISTR_5') +
- '/DC=' + Global_Str('ISTR_6') +
- '/DS=' + Global_Str('ISTR_7') +
- '/H=' + Global_Str('ISTR_8') +
- '/HM=' + Str(Global_Int('IINT_9')) +
- '/RT=' + Str(Global_Int('IINT_10')) +
- '/RP=' + Str(Global_Int('IINT_11')) +
- '/CS=' + Global_Str('ISTR_12') +
- '/NC1=' + Global_Str('ISTR_13') +
- '/NC2=' + Global_Str('ISTR_14') +
- '/NC3=' + Global_Str('ISTR_15') +
- '/NC4=' + Global_Str('ISTR_16'))
- );
- END;
- Ret;
-
- SETUP_TERMINAL:
- G_Str := Global_Str('Com_Terminal_Params');
- Set_Global_Str('ISTR_1','Dumb(MECOM^SETTER)Ansi()');
- Set_Global_Int('IINT_1',((XPos(Parse_Str('/T=',
- G_Str),'DUMB ANSI ',1) / 8) + 1));
- Set_Global_Str('IPARM_1','/TP=3/C=1/L=1/W=8/H=MECOM^SETTER/T=Terminal emulation ');
- Set_Global_Str('ISTR_2','/F=Full/T=Half');
- Set_Global_Int('IINT_2',Parse_Int('/D=',G_Str));
- Set_Global_Str('IPARM_2','/TP=5/C=1/L=2/W=4/H=MECOM^SETTER/T=Duplex ');
- Set_Global_Str('ISTR_3','/T=Cr-Lf/F=Cr');
- Set_Global_Int('IINT_3',Parse_Int('/CI=',G_Str));
- Set_Global_Str('IPARM_3','/TP=5/C=1/L=3/W=5/H=MECOM^SETTER/T=Incoming CR= ');
- Set_Global_Str('ISTR_4','/T=Cr-Lf/F=Cr');
- Set_Global_Int('IINT_4',Parse_Int('/CO=',G_Str));
- Set_Global_Str('IPARM_4','/TP=5/C=1/L=4/W=5/H=MECOM^SETTER/T=Outgoing CR= ');
- Set_Global_Str('ISTR_5','/T=Destructive/F=Non-destructive');
- Set_Global_Int('IINT_5',Parse_Int('/BT=',G_Str));
- Set_Global_Str('IPARM_5','/TP=5/C=1/L=5/W=15/H=MECOM^SETTER/T=Backspace ');
- Set_Global_Int('IINT_6',Parse_Int('/BK=',G_Str));
- Set_Global_Str('IPARM_6','/TP=1/C=1/L=6/W=3/H=MECOM^SETTER/T=ASCII code of outgoing BS= ');
- Set_Global_Str('ISTR_7','/T=On/F=Off');
- Set_Global_Int('IINT_7',Parse_Int('/W=',G_Str));
- Set_Global_Str('IPARM_7','/TP=5/C=1/L=7/W=3/H=MECOM^SETTER/T=Line wrap ');
- Set_Global_Int('IINT_8',Parse_Int('/BL=',G_Str));
- Set_Global_Str('IPARM_8','/TP=1/C=1/L=8/W=2/H=MECOM^SETTER/T=Break duration in clock tics=');
- {This scrolling stuff is for when we get scroll defeat enabled in VP routines}
- Set_Global_Str('ISTR_9','/T=On/F=Off');
- Set_Global_Int('IINT_9',Parse_Int('/S=',G_Str));
- Set_Global_Str('IPARM_9','/TP=5/C=1/L=8/W=3/H=MECOM^SETTER/T=Scroll ');
- RM( 'USERIN^DATA_IN /A=2/#=8/S=1/T=TERMINAL SETUP/X=' + X_Str +
- '/Y=' + Y_Str);
-
-
- IF (Return_Int) THEN
- Changes_Made := Changes_Made or $04;
- Set_Global_Str('Com_Terminal_Params','/TERMINAL=' +
- '/T=' + Remove_Space(Copy('DUMB ANSI ',((Global_Int('IINT_1') - 1) * 8) + 1,8)) +
- '/D=' + Str(Global_Int('IINT_2')) +
- '/CI=' + Str(Global_Int('IINT_3')) +
- '/CO=' + Str(Global_Int('IINT_4')) +
- '/BT=' + Str(Global_Int('IINT_5')) +
- '/BK=' + Str(Global_Int('IINT_6')) +
- '/W=' + Str(Global_Int('IINT_7')) +
- '/BL=' + Str(Global_Int('IINT_8'))
- );
- END;
- Ret;
-
- SETUP_PORT:
- G_Str := Global_Str('Com_Line_Params');
- Set_Global_Str( 'ISTR_1','1(MECOM^SETPOR)2()3()4()5()6()7()8()');
- Set_Global_Int( 'IINT_1',Parse_Int('/C=',G_Str));
- Set_Global_Str( 'IPARM_1','/C=11/L=1/W=1/H=MECOM^SETPOR/TP=3/T=Active com port ');
- Set_Global_Str( 'ISTR_2',
- '110(MECOM^SETPOR)300()450()600()1200()2400()4800()9600()19200()');
- Set_Global_Int( 'IINT_2',Parse_Int('/B=',G_Str) + 1);
- Set_Global_Str( 'IPARM_2','/C=11/L=2/W=5/H=MECOM^SETPOR/TP=3/T=Baud rate ');
- Set_Global_Str( 'ISTR_3','None(MECOM^SETPOR)Odd()Even()');
- Set_Global_Int( 'IINT_3',Parse_Int('/P=',G_Str) + 1);
- Set_Global_Str( 'IPARM_3','/C=11/L=3/W=4/H=MECOM^SETPOR/TP=3/T=Parity ');
- Set_Global_Str( 'ISTR_4','5(MECOM^SETPOR)6()7()8()');
- Set_Global_Int( 'IINT_4',Parse_Int('/D=',G_Str) + 1);
- Set_Global_Str( 'IPARM_4','/C=11/L=4/W=1/H=MECOM^SETPOR/TP=3/T=Data bits ');
- Set_Global_Str( 'ISTR_5','/T=2/F=1');
- Set_Global_Int( 'IINT_5',Parse_Int('/S=',G_Str));
- Set_Global_Str( 'IPARM_5','/C=11/L=5/W=1/H=MECOM^SETPOR/TP=5/T=Stop bits ');
- Set_Global_Int('IINT_6',Parse_Int('/IB=',G_Str));
- Set_Global_Str('IPARM_6','/TP=1/C=11/L=6/W=4/H=MECOM^SETPOR/T=Input buffer size ');
- Set_Global_Int('IINT_7',Parse_Int('/OB=',G_Str));
- Set_Global_Str('IPARM_7','/TP=1/C=11/L=7/W=4/H=MECOM^SETPOR/T=Output buffer size');
- Set_Global_Str('ISTR_8','/T=On/F=Off');
- Set_Global_Int('IINT_8',Parse_Int('/XON=',G_Str));
- Set_Global_Str('IPARM_8','/TP=5/C=11/L=8/W=3/H=MECOM^SETPOR/T=Xon-Xoff ');
- Set_Global_Str('ISTR_9','/T=On/F=Off');
- Set_Global_Int('IINT_9',Parse_Int('/CTS=',G_Str));
- Set_Global_Str('IPARM_9','/TP=5/C=11/L=9/W=3/H=MECOM^SETPOR/T=Require CTS ');
- Set_Global_Str('ISTR_10','/T=On/F=Off');
- Set_Global_Int('IINT_10',Parse_Int('/DTR=',G_Str));
- Set_Global_Str('IPARM_10','/TP=5/C=11/L=10/W=3/H=MECOM^SETPOR/T=DTR enable ');
- Set_Global_Str('ISTR_11','/T=On/F=Off');
- Set_Global_Int('IINT_11',Parse_Int('/RTS=',G_Str));
- Set_Global_Str('IPARM_11','/TP=5/C=11/L=11/W=3/H=MECOM^SETPOR/T=RTS enable ');
- Set_Global_Str('ISTR_12','Setup port addresses, interrupts, and types');
- Set_Global_Str('IPARM_12','/TP=8/C=0/L=12/W=43/H=MECOM^SETPOR/T=/M=COM_SETUP_PORT');
-
- {We must initialize the addresses, etc even if we aren't using them}
- RM('COM_SETUP_PORT /I=1');
-
- RM( 'USERIN^DATA_IN /A=2/#=12/S=1/T=PORT SETUP/X=' + X_Str +
- '/Y=' + Str(Menu_Y - 6));
-
- IF (Return_Int) THEN
- Jx := Parse_Int('/C=',Global_Str('Com_Line_Params'));
- Changes_Made := Changes_Made or $08;
- Set_Global_Str('Com_Line_Params','/LINE=' +
- '/C=' + Str(Global_Int('IINT_1')) +
- '/B=' + Str(Global_Int('IINT_2') - 1) +
- '/P=' + Str(Global_Int('IINT_3') - 1) +
- '/D=' + Str(Global_Int('IINT_4') - 1) +
- '/S=' + Str(Global_Int('IINT_5')) +
- '/IB=' + Str(Global_Int('IINT_6')) +
- '/OB=' + Str(Global_Int('IINT_7')) +
- '/XON=' + Str(Global_Int('IINT_8')) +
- '/CTS=' + Str(Global_Int('IINT_9')) +
- '/DTR=' + Str(Global_Int('IINT_10')) +
- '/RTS=' + Str(Global_Int('IINT_11')) +
-
- '/A1=' + Str(Global_Int('AIINT_1')) +
- '/I1=' + Str(Global_Int('AIINT_2')) +
- '/T1=' + Str(Global_Int('AIINT_3')) +
- '/A2=' + Str(Global_Int('AIINT_4')) +
- '/I2=' + Str(Global_Int('AIINT_5')) +
- '/T2=' + Str(Global_Int('AIINT_6')) +
- '/A3=' + Str(Global_Int('AIINT_7')) +
- '/I3=' + Str(Global_Int('AIINT_8')) +
- '/T3=' + Str(Global_Int('AIINT_9')) +
- '/A4=' + Str(Global_Int('AIINT_10')) +
- '/I4=' + Str(Global_Int('AIINT_11')) +
- '/T4=' + Str(Global_Int('AIINT_12')) +
- '/A5=' + Str(Global_Int('AIINT_13')) +
- '/I5=' + Str(Global_Int('AIINT_14')) +
- '/T5=' + Str(Global_Int('AIINT_15')) +
- '/A6=' + Str(Global_Int('AIINT_16')) +
- '/I6=' + Str(Global_Int('AIINT_17')) +
- '/T6=' + Str(Global_Int('AIINT_18')) +
- '/A7=' + Str(Global_Int('AIINT_19')) +
- '/I7=' + Str(Global_Int('AIINT_20')) +
- '/T7=' + Str(Global_Int('AIINT_21')) +
- '/A8=' + Str(Global_Int('AIINT_22')) +
- '/I8=' + Str(Global_Int('AIINT_23')) +
- '/T8=' + Str(Global_Int('AIINT_24'))
- );
-
- Set_Global_Str('Com_Cur_Line_Params',
- '/C=' + Str(Global_Int('IINT_1')) +
- '/B=' + Str(Global_Int('IINT_2') - 1) +
- '/P=' + Str(Global_Int('IINT_3') - 1) +
- '/D=' + Str(Global_Int('IINT_4') - 1) +
- '/S=' + Str(Global_Int('IINT_5'))
- );
- RM('MECOM^COM_OPEN_PORT /P=' + Str(Jx));
-
- END;
-
- RET;
-
- SETUP_SCREEN:
- Sub_Choice := 1;
- B_Str := '';
-
- SCREEN_MENU:
- Create_Global_Str('COMSCREENSTR_1','/H=MECOM^SETSCRCOL');
- Create_Global_Str('XCOMSCREENSTR_1','Colors');
- Create_Global_Str('COMSCREENSTR_2','/H=MECOM^SETSCRBOX');
- Create_Global_Str('XCOMSCREENSTR_2','Box size');
- Create_Global_Str('COMSCREENSTR_3','/H=MECOM^SETSCRSCR');
- Create_Global_Str('XCOMSCREENSTR_3','Full screen ^' + Copy('OffOn ',
- (Parse_Int('/FS=',Global_Str('Com_Screen_Params')) * 3) + 1,3));
- Create_Global_Str('COMSCREENSTR_4','/H=MECOM^SETSCRSTA');
- Create_Global_Str('XCOMSCREENSTR_4','Status line ^' + Copy('Top Bottom',
- (Parse_Int('/SR=',Global_Str('Com_Screen_Params')) * 6) + 1,6));
-
- RM('USERIN^SUBMENU /M=XCOMSCREENSTR_/G=COMSCREENSTR_/#=4/L=SETUP SCREEN/S=' +
- Str(Sub_Choice) + '/X=' + X_Str + '/GCLR=1/Y=' + Str(Menu_Y - 3) + B_Str);
- Sub_Choice := Return_Int;
- IF (Sub_Choice > 0) THEN
- B_Str := '/B=1/BO=1';
- IF (Sub_Choice = 1) THEN
- COLOR_MENU:
- Menu_X := 4;
- T_Fore := Parse_Int('/F=',Global_Str('Com_Color_Params'));
- T_Back := Parse_Int('/B=',Global_Str('Com_Color_Params'));
- {Create the menu with box}
- Put_Box(Menu_X,Menu_Y - 1,Menu_X + 34,Menu_Y + 4,0,M_B_Color,'COLORS',true);
-
- COLOR_LOOP:
- write(' to change foreground color ',Menu_X + 1,Menu_Y,0,(T_Back shl 4) or (T_Fore and $0F));
- write('|27|26 to change background color. ',Menu_X + 1,Menu_Y + 1,0,(T_Back shl 4) or (T_Fore and $0F));
- write('<ENTER> to accept, <ESC> aborts',Menu_X + 1,Menu_Y + 2,0,(T_Back shl 4) or (T_Fore and $0F));
-
- Read_Key;
- Jx := Inq_Key(Key1,Key2,TERM,MStr);
- IF ((Jx = 1) and (MStr = 'MECOM^COM_HELP')) THEN
- Help('MECOM^SETSCRCOL');
- END;
- IF (Key1 = 27) THEN
- Goto COLOR_EXIT;
- END;
- IF (Key1 = 13) THEN
- Text_Color_Vp := T_Fore or (T_Back shl 4);
- Set_Global_Str('Com_Color_Params','/COLOR=' +
- '/F=' + Str(T_Fore and $0F) +
- '/B=' + Str(T_Back and $0F)
- );
- Goto COLOR_EXIT;
- END;
- IF (Key1 = 0) THEN
- IF (Key2 = 72) THEN
- Changes_Made := Changes_Made or $10;
- --T_Fore;
- END;
- IF (Key2 = 80) THEN
- Changes_Made := Changes_Made or $10;
- ++T_Fore;
- END;
- IF (Key2 = 75) THEN
- Changes_Made := Changes_Made or $10;
- --T_Back;
- END;
- IF (Key2 = 77) THEN
- Changes_Made := Changes_Made or $10;
- ++T_Back;
- END;
- END;
- Goto Color_LOOP;
-
- COLOR_EXIT:
- Kill_Box;
- END;
- IF (Sub_Choice = 2) THEN
- Message_Row := 1;
- Save_Box(1,1,80,Screen_Length);
- G_Str := Global_Str('Com_Box_Params');
- RM('WINDOW^MOVE_WIN /K=1/MX1=0/MY1=' + Parse_Str('/SR=',Global_Str('Com_Screen_Params')) +
- '/MX2=' + Str(Screen_Width + 1) +
- '/MY2=' + Str(Screen_Length - 1 + Parse_Int('/SR=',Global_Str('Com_Screen_Params'))) +
- '/X1=' + Parse_Str('/X1=',G_Str) +
- '/Y1=' + Parse_Str('/Y1=',G_Str) +
- '/X2=' + Parse_Str('/X2=',G_Str) +
- '/Y2=' + Parse_Str('/Y2=',G_Str));
- Kill_Box;
- IF (Return_Int) THEN
- Changes_Made := Changes_Made or $10;
- Set_Global_Str('Com_Box_Params','/BOX=' +
- '/X1=' + Parse_Str('/X1=',Return_Str) +
- '/Y1=' + Parse_Str('/Y1=',Return_Str) +
- '/X2=' + Parse_Str('/X2=',Return_Str) +
- '/Y2=' + Parse_Str('/Y2=',Return_Str)
- );
- END;
- Message_Row := 0;
- END;
- IF (Sub_Choice = 3) THEN
- Set_Global_Str('Com_Screen_Params','/SCREEN=/FS=' +
- Str(Not(Parse_Int('/FS=',Global_Str('Com_Screen_Params')))) +
- '/SR=' + Parse_Str('/SR=',Global_Str('Com_Screen_Params'))
- );
- Changes_Made := Changes_Made or $10;
- END;
- IF (Sub_Choice = 4) THEN
- Set_Global_Str('Com_Screen_Params','/SCREEN=/FS=' +
- Parse_Str('/FS=',Global_Str('Com_Screen_Params')) +
- '/SR=' + Str(Not(Parse_Int('/SR=',Global_Str('Com_Screen_Params'))))
- );
- Changes_Made := Changes_Made or $10;
- END;
- Goto SCREEN_MENU;
- END;
- IF (B_Str <> '') THEN
- Kill_Box;
- END;
-
- RET;
-
- SETUP_PROTOCOL:
- Sub_Choice := Type - 6;
- RM('MECOM^COM_PROTO_MENU /LO=0/X=3/Y=' + Str(Menu_Y - 4 + Sub_Choice) + '/DU=' + Str(Sub_Choice));
- RET;
-
- SETUP_ASCII:
- G_Str := Global_Str('Com_Ascii_Params');
- Set_Global_Str('ISTR_1','/T=On/F=Off');
- Set_Global_Int('IINT_1',Parse_Int('/E=',G_Str));
- Set_Global_Str('IPARM_1','/TP=5/C=1/L=1/W=3/H=MECOM^SETASC/T=Local echo ');
- Set_Global_Str('ISTR_2','/T=On/F=Off');
- Set_Global_Int('IINT_2',Parse_Int('/S=',G_Str));
- Set_Global_Str('IPARM_2','/TP=5/C=1/L=2/W=3/H=MECOM^SETASC/T=Add space character to blank lines');
- Set_Global_Int('IINT_3',Parse_Int('/PC=',G_Str));
- Set_Global_Str('IPARM_3','/TP=1/C=1/L=3/W=3/H=MECOM^SETASC/T=ASCII code of pace character ');
- Set_Global_Int('IINT_4',Parse_Int('/CP=',G_Str));
- Set_Global_Str('IPARM_4','/TP=1/C=1/L=4/W=2/H=MECOM^SETASC/T=Character pacing(in milliseconds) ');
- Set_Global_Int('IINT_5',Parse_Int('/LP=',G_Str));
- Set_Global_Str('IPARM_5','/TP=1/C=1/L=5/W=2/H=MECOM^SETASC/T=Line pacing(in 100ths of a second)');
- Set_Global_Str('ISTR_6','Cr(MECOM^SETASC)cr-Lf()Strip()');
- Set_Global_Int('IINT_6',Parse_Int('/CU=',G_Str) + 1);
- Set_Global_Str('IPARM_6','/TP=3/C=1/L=6/W=5/H=MECOM^SETASC/T=Upload CR= ');
- Set_Global_Str('ISTR_7','Lf(MECOM^SETASC)Cr-lf()Strip()');
- Set_Global_Int('IINT_7',Parse_Int('/LU=',G_Str) + 1);
- Set_Global_Str('IPARM_7','/TP=3/C=1/L=7/W=5/H=MECOM^SETASC/T=Upload LF= ');
- Set_Global_Str('ISTR_8','Cr(MECOM^SETASC)cr-Lf()Strip()');
- Set_Global_Int('IINT_8',Parse_Int('/CD=',G_Str) + 1);
- Set_Global_Str('IPARM_8','/TP=3/C=1/L=8/W=5/H=MECOM^SETASC/T=Download CR= ');
- Set_Global_Str('ISTR_9','Lf(MECOM^SETASC)Cr-lf()Strip()');
- Set_Global_Int('IINT_9',Parse_Int('/LD=',G_Str) + 1);
- Set_Global_Str('IPARM_9','/TP=3/C=1/L=9/W=5/H=MECOM^SETASC/T=Download LF= ');
-
- RM( 'USERIN^DATA_IN /A=2/#=9/S=1/T=ASCII TRANSFER SETUP/X=' + X_Str +
- '/Y=' + Y_Str);
-
-
- IF (Return_Int) THEN
- Changes_Made := Changes_Made or $20;
- Set_Global_Str('Com_Ascii_Params','/ASCII=' +
- '/E=' + Str(Global_Int('IINT_1')) +
- '/S=' + Str(Global_Int('IINT_2')) +
- '/PC=' + Str(Global_Int('IINT_3')) +
- '/CP=' + Str(Global_Int('IINT_4')) +
- '/LP=' + Str(Global_Int('IINT_5')) +
- '/CU=' + Str(Global_Int('IINT_6') - 1) +
- '/LU=' + Str(Global_Int('IINT_7') - 1) +
- '/CD=' + Str(Global_Int('IINT_8') - 1) +
- '/LD=' + Str(Global_Int('IINT_9') - 1)
- );
- END;
- RET;
-
- SAVE_SETUP:
- IF (Switch_Win_Id(Global_Int('Com_Init_Window'))) THEN
- Tof;
-
- G_Str := 'General';
- Call UPDATE_LINE;
-
- G_Str := 'Box';
- Call UPDATE_LINE;
-
- G_Str := 'Color';
- Call UPDATE_LINE;
-
- G_Str := 'Screen';
- Call UPDATE_LINE;
-
- G_Str := 'Modem';
- Call UPDATE_LINE;
-
- G_Str := 'Terminal';
- Call UPDATE_LINE;
-
- G_Str := 'Line';
- Call UPDATE_LINE;
-
- G_Str := 'ASCII';
- Call UPDATE_LINE;
- Save_File;
- END;
- Update_Status_Line;
- RET;
-
- UPDATE_LINE:
- Goto_Line(Start_Line);
- IF (Search_Fwd('/' + G_Str + '=',Search_Amount) = False) THEN
- Eol;
- ++Search_Amount;
- Insert_Mode := True;
- Cr;
- END;
- Put_Line(Global_Str('COM_' + G_Str + '_PARAMS'));
- RET;
-
- {*****************************************************************************}
-
- EXIT:
- Set_Global_Int('COM_CHANGES_MADE',Changes_Made);
- IF (Type = 10) THEN
- Return_Int := 100;
- ELSE
- Return_Int := 0;
- END;
- {Deallocate global variables used for DATA_IN and SUBMENU}
- Jx := 0;
-
- WHILE (Jx < 33) DO
- Set_Global_Str( 'ISTR_' + Str(Jx),'');
- Set_Global_Int( 'IINT_' + Str(Jx),0);
- Set_Global_Str( 'IPARM_' + Str(Jx),'');
- ++Jx;
- END;
- Jx := 0;
-
- WHILE (Jx < 24) DO
- Set_Global_Str( 'ISTRA_' + Str(Jx),'');
- Set_Global_Int( 'IINTA_' + Str(Jx),0);
- Set_Global_Str( 'IPARMA_' + Str(Jx),'');
- ++Jx;
- END;
- Jx := 1;
- WHILE (Jx < 4) DO
- Set_Global_Str('COMSCREENSTR_' + Str(Jx),'');
- Set_Global_Str('XCOMSCREENSTR_' + Str(Jx),'');
- ++Jx;
- END;
- END_MACRO;
-
-
- $MACRO COM_SETUP_PORT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SETUP_PORT
-
- Description: This macro is the port address, interrupt, and type menu called
- from COM_SETUP. This macro is not intended to be called from anything but
- COM_SETUP.
-
- Parameters:
- /I= If 1, initialize the globals only, don't show the menu.
- /X=, /Y= The upper left hand X and Y coordinates.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(Menu_X,Menu_Y);
- Menu_X := Parse_Int('/X=',MParm_Str);
- Menu_Y := Parse_Int('/Y=',MParm_Str);
- Return_Str := Global_Str('Com_Line_Params');
- Set_Global_Int('AIINT_1',Parse_Int('/A1=',Return_Str));
- Set_Global_Str('AIPARM_1','/TP=4/C=1/L=1/W=4/H=MECOM^SETPOR/T=COM1 address');
- Set_Global_Int('AIINT_2',Parse_Int('/I1=',Return_Str));
- Set_Global_Str('AIPARM_2','/TP=1/C=20/L=1/W=3/H=MECOM^SETPOR/T=COM1 interrupt');
- Set_Global_Str('AISTR_3','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_3',Parse_Int('/T1=',Return_Str));
- Set_Global_Str('AIPARM_3','/TP=5/C=39/L=1/W=6/H=MECOM^SETPOR/T=COM1 connection');
- Set_Global_Int('AIINT_4',Parse_Int('/A2=',Return_Str));
- Set_Global_Str('AIPARM_4','/TP=4/C=1/L=2/W=4/H=MECOM^SETPOR/T=COM2 address');
- Set_Global_Int('AIINT_5',Parse_Int('/I2=',Return_Str));
- Set_Global_Str('AIPARM_5','/TP=1/C=20/L=2/W=3/H=MECOM^SETPOR/T=COM2 interrupt');
- Set_Global_Str('AISTR_6','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_6',Parse_Int('/T2=',Return_Str));
- Set_Global_Str('AIPARM_6','/TP=5/C=39/L=2/W=6/H=MECOM^SETPOR/T=COM2 connection');
- Set_Global_Int('AIINT_7',Parse_Int('/A3=',Return_Str));
- Set_Global_Str('AIPARM_7','/TP=4/C=1/L=3/W=4/H=MECOM^SETPOR/T=COM3 address');
- Set_Global_Int('AIINT_8',Parse_Int('/I3=',Return_Str));
- Set_Global_Str('AIPARM_8','/TP=1/C=20/L=3/W=3/H=MECOM^SETPOR/T=COM3 interrupt');
- Set_Global_Str('AISTR_9','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_9',Parse_Int('/T3=',Return_Str));
- Set_Global_Str('AIPARM_9','/TP=5/C=39/L=3/W=6/H=MECOM^SETPOR/T=COM3 connection');
- Set_Global_Int('AIINT_10',Parse_Int('/A4=',Return_Str));
- Set_Global_Str('AIPARM_10','/TP=4/C=1/L=4/W=4/H=MECOM^SETPOR/T=COM4 address');
- Set_Global_Int('AIINT_11',Parse_Int('/I4=',Return_Str));
- Set_Global_Str('AIPARM_11','/TP=1/C=20/L=4/W=3/H=MECOM^SETPOR/T=COM4 interrupt');
- Set_Global_Str('AISTR_12','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_12',Parse_Int('/T4=',Return_Str));
- Set_Global_Str('AIPARM_12','/TP=5/C=39/L=4/W=6/H=MECOM^SETPOR/T=COM4 connection');
- Set_Global_Int('AIINT_13',Parse_Int('/A5=',Return_Str));
- Set_Global_Str('AIPARM_13','/TP=4/C=1/L=5/W=4/H=MECOM^SETPOR/T=COM5 address');
- Set_Global_Int('AIINT_14',Parse_Int('/I5=',Return_Str));
- Set_Global_Str('AIPARM_14','/TP=1/C=20/L=5/W=3/H=MECOM^SETPOR/T=COM5 interrupt');
- Set_Global_Str('AISTR_15','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_15',Parse_Int('/T5=',Return_Str));
- Set_Global_Str('AIPARM_15','/TP=5/C=39/L=5/W=6/H=MECOM^SETPOR/T=COM5 connection');
- Set_Global_Int('AIINT_16',Parse_Int('/A6=',Return_Str));
- Set_Global_Str('AIPARM_16','/TP=4/C=1/L=6/W=4/H=MECOM^SETPOR/T=COM6 address');
- Set_Global_Int('AIINT_17',Parse_Int('/I6=',Return_Str));
- Set_Global_Str('AIPARM_17','/TP=1/C=20/L=6/W=3/H=MECOM^SETPOR/T=COM6 interrupt');
- Set_Global_Str('AISTR_18','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_18',Parse_Int('/T6=',Return_Str));
- Set_Global_Str('AIPARM_18','/TP=5/C=39/L=6/W=6/H=MECOM^SETPOR/T=COM6 connection');
- Set_Global_Int('AIINT_19',Parse_Int('/A7=',Return_Str));
- Set_Global_Str('AIPARM_19','/TP=4/C=1/L=7/W=4/H=MECOM^SETPOR/T=COM7 address');
- Set_Global_Int('AIINT_20',Parse_Int('/I7=',Return_Str));
- Set_Global_Str('AIPARM_20','/TP=1/C=20/L=7/W=3/H=MECOM^SETPOR/T=COM7 interrupt');
- Set_Global_Str('AISTR_21','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_21',Parse_Int('/T7=',Return_Str));
- Set_Global_Str('AIPARM_21','/TP=5/C=39/L=7/W=6/H=MECOM^SETPOR/T=COM7 connection');
- Set_Global_Int('AIINT_22',Parse_Int('/A8=',Return_Str));
- Set_Global_Str('AIPARM_22','/TP=4/C=1/L=8/W=4/H=MECOM^SETPOR/T=COM8 address');
- Set_Global_Int('AIINT_23',Parse_Int('/I8=',Return_Str));
- Set_Global_Str('AIPARM_23','/TP=1/C=20/L=8/W=3/H=MECOM^SETPOR/T=COM8 interrupt');
- Set_Global_Str('AISTR_24','/T=Modem/F=Direct');
- Set_Global_Int('AIINT_24',Parse_Int('/T7=',Return_Str));
- Set_Global_Str('AIPARM_24','/TP=5/C=39/L=8/W=6/H=MECOM^SETPOR/T=COM8 connection');
- {If we simply want to initialize the globals, then don't do the DATA_IN}
- IF (Parse_Int('/I=',MParm_Str)) THEN
- Goto EXIT;
- END;
-
- RM('DATA_IN /PRE=A/A=2/#=24/S=1/T=PORT SETUP/X=' + Str(Menu_X + 1) +
- '/Y=' + Str(Menu_Y + 1));
- EXIT:
- Return_Str := 'Setup port addresses, interrupts, and types';
- END_MACRO;
-
- $MACRO COM_PHONE TRANS;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_PHONE
-
- Description: The comunications module phone dialing and hang up macro.
-
- Parameters:
- /MY= The Y coordinate reference point for making boxes.
- /TP=
- 1 autodial menu
- 2 manual dial menu
- 3 hangup
- 4 redial menu
-
- Returns:
- Return_Int (only meaningful for redial)
- 1 = successful
- 0 = not successful
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {
- This macro is the phone menu including the phone dialing list for the
- communications module
- /N=/#=/B=/P=/D=/S=/E=/M=
- Parameters:
- /TP= 1 Go directly to autodial menu
- /TP= 2 Go directly to manual dial menu
- /TP= 3 Go directly to hangup
- /TP= 4 Go directly to redial menu
- }
- Def_Int(Active_Window,DIAL_Window,Jx,Jy,Temp_Reg_Exp_Stat,Temp_Integer,
- Menu_Index,Temp_Insert_Mode,Menu_Choice,Error,Port_Num,Redial_Count,
- Menu_Y,Type,Response_Length,Terminator_Index,T_Start,T_Stop);
- Def_Str(Temp_Char);
- Def_Str(Temp_String,Modem_Response,Macro,Terminator_Chars,MStr);
-
- port_num := global_int('COM_PORT_NUM');
-
- {determine how much is the longest expected connect/no connect modem response}
- Response_Length := Length(Parse_Str('/CS=',Global_Str('Com_Modem_Params')));
- Jx := 0;
- WHILE (Jx < 5) DO
- ++Jx;
- Temp_Integer := Length(Parse_Str('/NC' + Str(Jx) + '=',Global_Str('Com_Modem_Params')));
- IF (Temp_Integer > Response_Length) THEN
- Response_Length := Temp_Integer;
- END;
- END;
-
- IF (Response_Length = 0) THEN
- Response_Length := 10;
- END;
- Macro := '';
- Menu_Y := Parse_Int('/MY=',MParm_Str);
- IF (Menu_Y = 0) THEN
- Menu_Y := 2;
- END;
- Menu_Index := 0;
- DIAL_Window := 0;
- Temp_Reg_Exp_Stat := Reg_Exp_Stat;
- Reg_Exp_Stat := False;
- Temp_Insert_Mode := Insert_Mode;
- Insert_Mode := True;
- Active_Window := Cur_Window;
- {Look for special parameters}
- Type := Parse_Int('/TP=',MParm_Str);
- IF (Type = 1) THEN
- Goto AUTODIAL;
- END;
- IF (Type = 2) THEN
- Goto MANUALDIAL;
- END;
- IF (Type = 3) THEN
- Return_Int := True;
- Call HANG_UP;
- Goto EXIT;
- END;
- IF (Type = 4) THEN
- Goto DO_REDIAL;
- END;
-
- Goto EXIT;
-
- IF (Menu_Choice = 1) THEN
- {Auto dial menu}
- AUTODIAL:
- Set_Global_Str('PHONDS','N=28#=14');
- RM('USERIN^DB /F=MECOM.DB/GLO=PHONE/LO=2/PRE=PHON/NOALPHA=1/ENC=0/DPT=' +
- 'PHONELST.DB/NDF=1/LT=Autodial Directory. <ENTER> to dial./X=9/Y=' +
- Str(Menu_Y + 4) + '/DT=AUTODIAL SETUP/H=MECOM^PHONAUT/DS=PHONDS/2TOP=1');
- IF (RETURN_INT) THEN
- MStr := Global_Str('PHONE');
- Temp_String := Parse_Str('#=',MStr);
- Macro := Parse_Str('M=',MStr);
- if (Temp_String <> '') then
- {Set up the com port to the setttings in the phone list}
- Jx := Parse_Int('B=',Mstr);
- IF (Jx > 0) THEN
- --Jx;
- END;
- Jy := Parse_Int('P=',Mstr);
- IF (Jy > 0) THEN
- --Jy;
- END;
- Temp_Integer := Parse_Int('D=',Mstr);
- IF (Temp_Integer > 0) THEN
- --Temp_Integer;
- END;
-
- Terminator_Chars := '/B=' + Str(Jx) + '/P=' + Str(Jy) +
- '/D=' + Str(Temp_Integer) + '/S=' + Str(Parse_Int('S=',MStr));
-
- Set_Global_Str('Com_Cur_Line_Params',
- '/C=' + Parse_Str('/C=',Global_Str('Com_Cur_Line_Params')) +
- Terminator_Chars);
-
- error := set_com( port_num, 1,Parse_Int('/B=',Terminator_Chars));
- error := set_com( port_num, 2,Parse_Int('/P=',Terminator_Chars));
- error := set_com( port_num, 3,Parse_Int('/D=',Terminator_Chars));
- error := set_com( port_num, 4,Parse_Int('/S=',Terminator_Chars));
-
- MANUAL_DIAL:
- Return_Str := Parse_Str('/DC=',Global_Str('Com_Modem_Params')) + Temp_String;
- Call WRITE_TO_PORT;
- Return_Str := Parse_Str('/DS=',Global_Str('Com_Modem_Params'));
- Call WRITE_TO_PORT;
- Set_Global_Str('Com_Last_Dialed_#',Temp_String);
- Set_Global_Str('Com_Last_Dialed_Macro',Macro);
- IF (Type = 1) THEN
- Set_Global_Int('COM_CHANGES_MADE',Global_Int('COM_CHANGES_MADE') or $08);
- Return_Str := '/WRITE=Dialing ' + Parse_Str('N=',Global_Str('PHONE')) +
- '|13|10';
- ELSE
- Return_Str := '';
- END;
- IF (Macro <> '') THEN
- Return_Str := Return_Str + '/PM=' + Macro;
- END;
- end;
- Goto EXIT;
- ELSE
- Goto ESCAPE_EXIT;
- END;
- END;
-
- IF (Menu_Choice = 2) THEN
- MANUALDIAL:
- {Manual dialing}
- Return_Str := '';
-
- RM('USERIN^QUERYBOX /C=9/W=40/H=MECOM^PHONMAN/P=Number to dial:/T=MANUAL DIALING/L=' + Str(Menu_Y + 5));
- IF ((Return_Int <> 0) and (Return_Str <> '')) THEN
- Temp_String := Return_Str;
- Macro := '';
- Goto MANUAL_DIAL;
- END;
- Goto ESCAPE_EXIT;
- END;
-
- IF (Menu_Choice = 3) THEN
- {Hang up the phone}
- Return_Int := False;
- Call HANG_UP;
- Goto ESCAPE_EXIT;
- END;
-
- IF (Menu_Choice = 4) THEN
- {redial }
- DO_REDIAL:
- Redial_Count := 0;
- IF (Global_Str('Com_Last_Dialed_#') = '') THEN
- Return_Str := '';
- RM('USERIN^QUERYBOX /C=9/W=40/P=Number to dial:/T=REDIAL/L=' + Str(Menu_Y + 7));
- IF (Return_Int) THEN
- Set_Global_Str('Com_Last_Dialed_#',Return_Str);
- Set_Global_Str('Com_Last_Dialed_Macro','');
- ELSE
- Goto ESCAPE_EXIT;
- END;
- END;
- Put_Box(9,Menu_Y + 7,60,Menu_Y + 14,0,M_B_Color,'AUTOMATIC REDIAL',True);
- Write('<F2>=change parameters. <ESC>=abort.',13,Menu_Y + 13,0,M_S_Color);
- Redial_Count := 0;
-
- REDIAL_CHANGE:
- Write('Number: ' + Global_Str('Com_Last_Dialed_#'),10,Menu_Y + 8,0,M_S_Color);
- Write('Number of tries: 0',10,Menu_Y + 9,0,M_S_Color);
- Write('Elapsed time: 0' + ' seconds of: ' + Parse_Str('/RT=',
- Global_Str('Com_Modem_Params')) + ' ',10,Menu_Y + 10,0,M_S_Color);
- Write('Delay before redial time: 0' + ' seconds of: ' + Parse_Str('/RP=',
- Global_Str('Com_Modem_Params')),10,Menu_Y + 11,0,M_S_Color);
- Write('Last modem response: ',10,Menu_Y + 12,0,M_S_Color);
-
- REDIAL:
- Write('0 ',24,Menu_Y + 10,0,M_S_Color);
- Write(Str(Redial_Count),27,Menu_Y + 9,0,M_S_Color);
- Return_Str := Parse_Str('/DC=',Global_Str('Com_Modem_Params')) +
- Global_Str('Com_Last_Dialed_#');
- Call WRITE_TO_PORT;
- Return_Str := Parse_Str('/DS=',Global_Str('Com_Modem_Params'));
- Call WRITE_TO_PORT;
- {This is just to clear the incoming port buffer}
- Delay(100);
- Terminator_Chars := '';
- Return_Int := 255;
- Call GET_MODEM_RESPONSE;
- Temp_Integer := Val(T_Start,Copy(Time,7,2));
-
- TIMEOUT_LOOP:
- Temp_Integer := Val(T_Stop,Copy(Time,7,2));
- IF (T_Start > T_Stop) THEN
- T_Stop := T_Stop + 60;
- END;
- IF (read_com_till(port_num,1,'',Temp_Char,
- Terminator_Index) = 0) Then
- Return_Int := Response_Length;
- Terminator_Chars := '';
- Delay(500);
- Call GET_MODEM_RESPONSE;
-
- Temp_Integer := XPos(Parse_Str('/CS=',Global_Str('Com_Modem_Params')),
- Modem_Response,1);
-
- IF (Temp_Integer) THEN
- {Save any remaining stuff after the connect response into a global so that it
- can be dealt with later if needed.}
- Set_Global_Str('Com_Leftovers',Copy(Modem_Response,Temp_Integer +
- Length(Parse_Str('/CS=',Global_Str('Com_Modem_Params'))) + 2,255));
- Return_Int := True;
- Kill_Box;
- IF (Global_Str('Com_Last_Dialed_Macro') <> '') THEN
- Return_Str := '/PM=' + Global_Str('Com_Last_Dialed_Macro');
- {We are adding a special parameter "/AC=" to the macro command to indicate to
- the macro that we are Already Connected. If there are already parameters in
- this macro command, we will not put in the space delimter.}
- IF (XPos(' ',Return_Str,1) = 0) THEN
- Return_Str := Return_Str + ' ';
- END;
- Return_Str := Return_Str + '/AC=1';
- END;
- Goto EXIT;
- ELSE
- {Check if it is any of the defined modem no connect responses}
- Jx := 1;
- CHECK_NO_CONNECT:
- Return_Str := Parse_Str('/NC' + Str(Jx) + '=',Global_Str('Com_Modem_Params'));
- IF (Return_Str <> '') THEN
- Temp_Integer := XPos(Return_Str,Modem_Response,1);
- IF ((Temp_Integer = 0) and (Jx < 4)) THEN
- ++Jx;
- Goto CHECK_NO_CONNECT;
- END;
- END;
- {Clean up the modem response so it can be displayed}
- {Remove any CR or LF}
- REMOVE_CR:
- Jx := XPos('|13',Modem_Response,1);
- IF (Jx) THEN
- Modem_Response := Str_Del(Modem_Response,Jx,1);
- Goto REMOVE_CR;
- END;
- REMOVE_LF:
- Jx := XPos('|10',Modem_Response,1);
- IF (Jx) THEN
- Modem_Response := Str_Del(Modem_Response,Jx,1);
- Goto REMOVE_LF;
- END;
- Modem_Response := Copy(Modem_Response + ' ',1,22);
- {If we got one of the no connect modem responses, then hang up, otherwise
- display, but ignore the modem response}
- IF (Temp_Integer) THEN
- Goto REDIAL_HANG_UP;
- END;
- Goto TIMEOUT_LOOP;
- END;
- END;
- Write(Str(T_Stop - T_Start),24,Menu_Y + 10,0,M_S_Color);
- IF (Check_Key) THEN
- IF (Key1 = 27) THEN
- Goto ABORT_REDIAL;
- END;
- Jx := Inq_Key(Key1,Key2,TERM,MStr);
- IF ((Jx = 1) and (MStr = 'MECOM^COM_HELP')) THEN
- Help('MECOM^PHONRED');
- END;
- IF ((Key1 = 0) and (Key2 = 60)) THEN
- Set_Global_Int('IINT_1',Parse_Int('/RT=',Global_Str('Com_Modem_Params')));
- Set_Global_Str('IPARM_1','/TP=1/C=1/L=1/W=2/H=MECOM^PHONRED/T=Redial timeout ');
- Set_Global_Int('IINT_2',Parse_Int('/RP=',Global_Str('Com_Modem_Params')));
- Set_Global_Str('IPARM_2','/TP=1/C=1/L=2/W=2/H=MECOM^PHONRED/T=Redial pause ');
-
- RM( 'USERIN^DATA_IN /A=2/#=2/S=1/X=10/T=REDIAL PARAMS/Y=' + Str(Menu_Y + 13));
-
- IF (Return_Int) THEN
- Return_Str := '/RT=';
- RM('USERIN^CHNGPARM /G=Com_Modem_Params/P=' + Str(Global_Int('IINT_1')));
- Return_Str := '/RP=';
- RM('CHNGPARM /G=Com_Modem_Params/P=' + Str(Global_Int('IINT_2')));
- END;
-
- Set_Global_Str('IPARM_0','');
- Set_Global_Int('IINT_1',0);
- Set_Global_Str('IPARM_1','');
- Set_Global_Int('IINT_2',0);
- Set_Global_Str('IPARM_2','');
- Goto REDIAL_CHANGE;
- END;
- END;
- IF ((T_Stop - T_Start) >= Parse_Int('/RT=',Global_Str('Com_Modem_Params'))) THEN
- Modem_Response := 'TIMEOUT ';
- Goto REDIAL_HANG_UP;
- END;
- Goto TIMEOUT_LOOP;
-
- REDIAL_HANG_UP:
- Write(Modem_Response,31,Menu_Y + 12,0,M_S_Color);
- Call HANG_UP;
- {This is just to clear the incoming port buffer}
- Return_Int := 255;
- Terminator_Chars := '';
- Call GET_MODEM_RESPONSE;
- Write('0 ',36,Menu_Y + 11,0,M_S_Color);
- Temp_Integer := Val(T_Start,Copy(Time,7,2));
-
- DELAY_LOOP:
- Temp_Integer := Val(T_Stop,Copy(Time,7,2));
- IF (T_Start > T_Stop) THEN
- T_Stop := T_Stop + 60;
- END;
- Write(Str(T_Stop - T_Start),36,Menu_Y + 11,0,M_S_Color);
- IF (Check_Key) THEN
- IF (Key1 = 27) THEN
- Goto ABORT_REDIAL;
- END;
- END;
- IF ((T_Stop - T_Start) >= Parse_Int('/RP=',Global_Str('Com_Modem_Params'))) THEN
- ++Redial_Count
- Goto REDIAL;
- END;
- Goto DELAY_LOOP;
- ABORT_REDIAL:
- Return_Str := '';
- Call HANG_UP;
- Kill_Box;
- END;
-
- Goto EXIT;
-
-
- {********************************** SUBROUTINES ******************************}
- HANG_UP:
- Put_Box(9,Menu_Y + 6,22,Menu_Y + 9,0,M_B_Color,'',True);
- Write('Hanging up',10,Menu_Y + 7,0,Working_Color);
- IF (Parse_Int('/HM=',Global_Str('Com_Modem_Params'))) THEN
- {Drop DTR method}
- Error := set_com(port_num,13,Parse_Int('/RTS=',Global_Str('Com_Line_Params')) shl 1);
- Delay(200);
- error := set_com(port_num,13,Parse_Int('/DTR=',Global_Str('Com_Line_Params'))
- or (Parse_Int('/RTS=',Global_Str('Com_Line_Params')) shl 1));
- ELSE
- {Send modem string method}
- Return_Str := Parse_Str('/H=',Global_Str('Com_Modem_Params'));
- Call WRITE_TO_PORT;
- END;
- Kill_Box;
- RET;
-
- GET_MODEM_RESPONSE:
- Modem_Response := Temp_Char;
-
- MORE_RESPONSE:
- Delay(50);
- Error := read_com_till(port_num,Return_Int * 2,Terminator_Chars,
- Temp_Char,Terminator_Index);
- Modem_Response := Modem_Response + Temp_Char;
- IF (Error = 0) THEN
- IF ((Terminator_Index = 0) and (Svl(Modem_Response) < Return_Int)) THEN
- Goto MORE_RESPONSE;
- END;
- END;
- RET;
-
- WRITE_TO_PORT:
- {This routine checks for the presence of any of the special modem translate
- characters and replaces them with the proper character for output to the modem
- then outputs the string to the modem}
- {Check for carriage return char}
- Temp_Char := Parse_Str('/XC=',Global_Str('Com_Modem_Params'));
- IF (Temp_Char <> '|0') THEN
- CHECK_FOR_CR:
- Return_Int := XPos(Temp_Char,Return_Str,1);
- IF (Return_Int) THEN
- Return_Str := Copy(Return_Str,1,Return_Int - 1) + '|13' +
- Copy(Return_Str,Return_Int + 1,254);
- Goto CHECK_FOR_CR;
- END;
- END;
- {Check for control character}
- Temp_Char := Parse_Str('/XT=',Global_Str('Com_Modem_Params'));
- IF (Temp_Char <> '|0') THEN
- CHECK_FOR_CTRL:
- Return_Int := XPos(Temp_Char,Return_Str,1);
- IF (Return_Int) THEN
- Return_Str := Copy(Return_Str,1,Return_Int - 1) +
- Char(Ascii(Copy(Return_Str,Return_Int + 1,1)) - 64) +
- Copy(Return_Str,Return_Int + 2,254);
- Goto CHECK_FOR_CTRL;
- END;
- END;
- {Check for escape character}
- Temp_Char := Parse_Str('/XE=',Global_Str('Com_Modem_Params'));
- IF (Temp_Char <> '|0') THEN
- CHECK_FOR_ESC:
- Return_Int := XPos(Temp_Char,Return_Str,1);
- IF (Return_Int) THEN
- Return_Str := Copy(Return_Str,1,Return_Int - 1) + '|27' +
- Copy(Return_Str,Return_Int + 1,254);
- Goto CHECK_FOR_ESC;
- END;
- END;
- {Check for 2 second delay char}
- Temp_Char := Parse_Str('/XP=',Global_Str('Com_Modem_Params'));
- IF (Temp_Char <> '|0') THEN
- CHECK_FOR_DELAY:
- Return_Int := XPos(Temp_Char,Return_Str,1);
- IF (Return_Int) THEN
- error := write_com(port_num,Copy(Return_Str,1,Return_Int - 1), jx);
- Delay(2000);
- IF (Length(Return_Str) > Return_Int) THEN
- Return_Str := Copy(Return_Str,Return_Int + 1,254);
- Goto CHECK_FOR_DELAY;
- ELSE
- RET;
- END;
- END;
- END;
- error := write_com(port_num,Return_Str, jx);
- RET;
- CLEAN_GLOBALS:
- {Deallocate variables used for DATA_IN}
- Jx := 0;
- WHILE (Jx < 9) DO
- Set_Global_Str( 'ISTR_' + Str(Jx),'');
- Set_Global_Int( 'IINT_' + Str(Jx),0);
- Set_Global_Str( 'IPARM_' + Str(Jx),'');
- ++Jx;
- END;
- RET;
- {*****************************************************************************}
-
- ESCAPE_EXIT:
- Return_Int := False;
- Goto SKIP_EXIT;
-
- EXIT:
- Return_Int := True;
- SKIP_EXIT:
- Call CLEAN_GLOBALS;
- IF (DIAL_Window) THEN
- Switch_Window(DIAL_Window);
- IF (File_Changed) THEN
- Save_File;
- Update_Status_Line;
- END;
- Delete_Window;
- END;
- Switch_Window(Active_Window);
- Reg_Exp_Stat := Temp_Reg_Exp_Stat;
- Insert_Mode := Temp_Insert_Mode;
- END_MACRO;
-
- $MACRO COM_SEND_BREAK;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SEND_BREAK
-
- Description: Invokes a break condition on the currently active com port.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(Error);
- Error := Send_Break(Global_Int('COM_PORT_NUM'),
- Parse_Int('/BL=',Global_Str('COM_TERMINAL_PARAMS')));
- IF (Error) THEN
- Error_Level := 6000 + Error;
- RM('MEERROR /EM=Error sending break signal.');
- END;
- END_MACRO;
-
- $MACRO COM_DUMB;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_DUMB
-
- Description: The comunications module dumb terminal emulation.
-
- Parameters:
- /DO= A string to send to be processed by the terminal emulator.
- If present, the emulator will simply process and display
- the string and will not attempt to read any characters
- from the com port. Useful in logon scripts. This is NOT
- the normal mode of operation.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {
- This macro writes data to the terminal box from the comport in dumb terminal
- emulation.
- }
- Def_Int(Port_Num,Max_X,Max_Y,Scroll,Wrap,Terminator_Index,Error,Temp_Integer,
- I_S_Length,Logging,ASCII_Download,Jx,Duplex,CR_LF_Out,Display_Only);
- Def_Str(Input_String[25],Terminators[3],Display_Only_Str,MStr);
- Def_Char(Ch,Bs_Char);
-
-
- Port_Num := Global_int('Com_Port_Num');
- Display_Only := XPos('/DO=',MParm_Str,1);
- IF (Display_Only) THEN
- Display_Only_Str := Copy(MParm_Str,Display_Only + 4,255);
- END;
- Bs_Char := Char(Parse_Int('/BK=',Global_Str('Com_Terminal_Params')));
- CR_LF_Out := Parse_Int('/CO=',Global_Str('Com_Terminal_Params'));
- Duplex := Parse_Int('/D=',Global_Str('Com_Terminal_Params'));
- Logging := Global_Int('Com_Logging');
- ASCII_Download := Global_Int('Com_ASCII_Download');
- GotoXY_Vp((Global_Int('Com_Cursor_Pos') and $FF),
- (Global_Int('Com_Cursor_Pos') shr $08));
-
- GET_STRING:
- IF (Display_Only) THEN
- IF (Display_Only_Str = '') THEN
- Goto EXIT;
- END;
- Error := 20;
- Temp_Integer := 1;
- Terminator_Index := 0;
- WHILE (Temp_Integer < 4) DO
- Jx := XPos(Copy('|8|10|13',Temp_Integer,1),Display_Only_Str,1);
- IF (Jx > 0) THEN
- IF (Jx < Error) THEN
- Error := Jx;
- Terminator_Index := Temp_Integer;
- END;
- END;
- ++Temp_Integer;
- END;
- Input_String := Copy(Display_Only_Str,1,Error);
- Display_Only_Str := Str_Del(Display_Only_Str,1,Error);
- ELSE
- Error := read_com_till(port_num, 20,'|8|10|13',Input_String,Terminator_Index);
- END;
- I_S_Length := SVL(Input_String);
- IF (I_S_Length) THEN
- {If there is nothing special about this chunk of chars, just write it so as to
- be as fast as possible.}
- IF ((Logging) or (ASCII_Download)) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- IF ((Return_Int + Svl(Input_String)) > 512) THEN
- IF (Logging) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG;
- END;
- END;
- IF (ASCII_Download) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_ASCII_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG;
- END;
- END;
-
- Set_Global_Str('Com_Log_Str','');
- END;
-
- IF (Terminator_Index = 1) THEN
- {Back space}
- Set_Global_Str('Com_Log_Str',Copy(Global_Str('Com_Log_Str'),1,Length(Global_Str('Com_Log_Str')) - 1) + Copy(Input_String,1,Svl(Input_String) - 1));
- ELSE
- Set_Global_Str('Com_Log_Str',Global_Str('Com_Log_Str') + Input_String);
- END;
- ABORT_LOG:
- END;
- Write_VP(Input_String);
- END;
-
- IF (Check_Key) THEN
- Jx := Inq_Key(Key1,Key2,TERM,MStr);
- IF ((Jx = 1) and (MStr <> '')) THEN
- Goto EXIT;
- ELSIF (Key1 = 0) THEN
- IF (Key2 = 250) THEN
- Goto EXIT;
- END;
- ELSE
- SEND_KEY:
- Ch := Char(Key1);
- IF (Key1 = 8) THEN
- Ch := Bs_Char;
- END;
-
- TRY_AGAIN:
- error := write_com(port_num,Ch,Jx);
- IF (Error = 7) THEN
- Delay(10);
- Goto TRY_AGAIN;
- END;
- {if CR xlation is CR/LF then send the LF}
-
- IF (Ch = '|13') THEN
- IF (Cr_Lf_Out = 1) THEN
- LF_AGAIN:
- error := write_com(port_num,'|10',Jx);
- IF (Error = 7) THEN
- Delay(10);
- Goto LF_AGAIN;
- END;
- END;
- END;
-
- IF (Duplex) THEN
- WRITE_TO_SCREEN:
- Write_Vp(Ch);
- DO_LOG:
- IF ((Logging = True) or (ASCII_Download = True)) THEN
- IF (Duplex) THEN
- IF (Ch = Bs_Char) THEN
- {Back space}
- Set_Global_Str('Com_Log_Str',Copy(Global_Str('Com_Log_Str'),1,Length(Global_Str('Com_Log_Str')) - 1));
- ELSE
- Set_Global_Str('Com_Log_Str',Global_Str('Com_Log_Str') + Ch);
- END;
- Return_Int := Length(Global_Str('Com_Log_Str'));
- IF (Return_Int > 512) THEN
- IF (Logging) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG2;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG2;
- END;
- END;
- IF (ASCII_Download) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_ASCII_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG2;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG2;
- END;
- END;
- Set_Global_Str('Com_Log_Str','');
- END;
- END;
- END;
- ABORT_LOG2:
- END;
- IF (Check_Key) THEN
- Goto SEND_KEY;
- END;
- END;
- END;
- Goto GET_STRING;
-
- EXIT:
- Set_Global_Int('Com_Cursor_Pos',WhereX_VP or (WhereY_Vp shl $08));
- END_MACRO;
-
- $MACRO COM_ANSI;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_ANSI
-
- Description: The comunications module ANSI terminal emulation.
-
- Parameters:
- /DO= A string to send to be processed by the terminal emulator.
- If present, the emulator will simply process and display
- the string and will not attempt to read any characters
- from the com port. Useful in logon scripts. This is NOT
- the normal mode of operation.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {
- This macro writes data to the terminal box from the comport in ANSI terminal
- emulation.
- }
- Def_Int(Port_Num,Sequence_Type,Sequence_Index,Param_Int,Parm_Count,Tries,
- Max_X,Max_Y,Scroll,key_wait,Terminator_Index,Error,
- I_S_Length,Logging,Partial,Try_Count,Temp_Integer,Jx,ASCII_Download,
- Cr_Lf_Out,Duplex,Display_Only);
- Def_Str(Ch[254],Input_String,Display_Only_Str,MStr);
- Def_Str(Temp_String,Sequence_Param);
- Def_Char(BS_Char);
-
- Bs_Char := Char(Parse_Int('/BK=',Global_Str('Com_Terminal_Params')));
- Display_Only := XPos('/DO=',MParm_Str,1);
- IF (Display_Only) THEN
- Display_Only_Str := Copy(MParm_Str,Display_Only + 4,255);
- END;
- CR_LF_Out := Parse_Int('/CO=',Global_Str('Com_Terminal_Params'));
- Duplex := Parse_Int('/D=',Global_Str('Com_Terminal_Params'));
- Port_Num := Global_int('Com_Port_Num');
- Logging := Global_Int('Com_logging');
- ASCII_Download := Global_Int('Com_ASCII_Download');
- GotoXY_Vp((Global_Int('Com_Cursor_Pos') and $FF),
- (Global_Int('Com_Cursor_Pos') shr $08));
-
- Partial := Global_Str('Partial_Sequence') <> '';
- IF (Partial) THEN
- Temp_String := Global_Str('Partial_Sequence');
- Goto ESCAPE_SEQUENCE;
- END;
-
-
- Set_Global_Str('Partial_Sequence','');
-
-
- GET_STRING:
- IF (Display_Only) THEN
- IF (Display_Only_Str = '') THEN
- Goto EXIT;
- END;
- Error := 20;
- Temp_Integer := 1;
- Terminator_Index := 0;
- WHILE (Temp_Integer < 6) DO
- Jx := XPos(Copy('|8|10|13|27|12',Temp_Integer,1),Display_Only_Str,1);
- IF (Jx > 0) THEN
- IF (Jx < Error) THEN
- Error := Jx;
- Terminator_Index := Temp_Integer;
- END;
- END;
- ++Temp_Integer;
- END;
-
- Input_String := Copy(Display_Only_Str,1,Error);
- Display_Only_Str := Str_Del(Display_Only_Str,1,Error);
- ELSE
- Error := read_com_till(port_num, 20,'|8|10|13|27|12',Input_String,Terminator_Index);
- END;
- I_S_Length := SVL(Input_String);
- IF (I_S_Length) THEN
- {If there is nothing special about this chunk of chars, just write it so as to
- be as fast as possible.}
- IF (Terminator_Index > 3) THEN
- Input_String := Copy(Input_String,1,I_S_Length - 1);
- End;
- IF ((Logging) or (ASCII_Download)) THEN
- Return_Int := Length(Global_Str('Com_Log_Str'));
- IF ((Return_Int + Svl(Input_String)) > 512) THEN
- IF (Logging) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG;
- END;
- END;
- IF (ASCII_Download) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_ASCII_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG;
- END;
- END;
-
- Set_Global_Str('Com_Log_Str','');
- END;
-
- IF (Terminator_Index = 1) THEN
- {Back space}
- Set_Global_Str('Com_Log_Str',Copy(Global_Str('Com_Log_Str'),1,Length(Global_Str('Com_Log_Str')) - 1) + Copy(Input_String,1,Svl(Input_String) - 1));
- ELSE
- Set_Global_Str('Com_Log_Str',Global_Str('Com_Log_Str') + Input_String);
- END;
- ABORT_LOG:
- END;
-
- Write_VP(Input_String);
- {Process a form feed character by clearing the screen}
- IF (Terminator_Index = 5) THEN
- Clr_Vp;
- END;
- IF (Terminator_Index = 4) THEN
- ESCAPE_SEQUENCE:
- Call DECODE_SEQUENCE;
- IF (Partial) THEN
- Set_Global_Str('Partial_Sequence',Temp_String);
- Goto EXIT;
- END;
- END;
- END;
-
- IF (Check_Key) THEN
- Jx := Inq_Key(Key1,Key2,TERM,MStr);
- IF ((Jx = 1) and (MStr <> '')) THEN
- Goto EXIT;
- ELSIF (Key1 = 0) THEN
- IF (Key2 = 250) THEN
- Goto EXIT;
- END;
- ELSE
- SEND_KEY:
- Ch := Char(Key1);
- IF (Key1 = 8) THEN
- Ch := Bs_Char;
- END;
-
- TRY_AGAIN:
- error := write_com(port_num,Ch,Jx);
- IF (Error = 7) THEN
- Delay(10);
- Goto TRY_AGAIN;
- END;
- {if CR xlation is CR/LF then send the LF}
-
- IF (Ch = '|13') THEN
- IF (Cr_Lf_Out = 1) THEN
- LF_AGAIN:
- error := write_com(port_num,'|10',Jx);
- IF (Error = 7) THEN
- Delay(10);
- Goto LF_AGAIN;
- END;
- END;
- END;
-
- IF (Duplex) THEN
- WRITE_TO_SCREEN:
- Write_Vp(Ch);
- DO_LOG:
- IF ((Logging = True) or (ASCII_Download = True)) THEN
- IF (Duplex) THEN
- IF (Ch = Bs_Char) THEN
- {Back space}
- Set_Global_Str('Com_Log_Str',Copy(Global_Str('Com_Log_Str'),1,Length(Global_Str('Com_Log_Str')) - 1));
- ELSE
- Set_Global_Str('Com_Log_Str',Global_Str('Com_Log_Str') + Ch);
- END;
- Return_Int := Length(Global_Str('Com_Log_Str'));
- IF (Return_Int > 512) THEN
- IF (Logging) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG2;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT_LOG2;
- END;
- END;
- IF (ASCII_Download) THEN
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_ASCII_Handle'),Jx);
- IF (Return_Int > Jx) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG2;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR /A=1');
- Goto ABORT_LOG2;
- END;
- END;
- Set_Global_Str('Com_Log_Str','');
- END;
- END;
- END;
- ABORT_LOG2:
- END;
- IF (Check_Key) THEN
- Goto SEND_KEY;
- END;
- END;
- END;
- Goto GET_STRING;
-
-
- {********************************** SUBROUTINES ******************************}
- DECODE_SEQUENCE:
- {This routine decodes ANSI escape sequences}
- IF (Partial = False) THEN
- Temp_String := '';
- END;
- Partial := False;
- Try_Count := 0;
-
- READ_AGAIN:
- ++Try_Count;
- IF (Display_Only) THEN
- IF (Display_Only_Str = '') THEN
- Goto EXIT;
- END;
- Error := 254;
- Temp_Integer := 1;
- Terminator_Index := 0;
- WHILE (Temp_Integer < 15) DO
- Jx := XPos(Copy('HFmhlABCDnJsuK',Temp_Integer,1),Display_Only_Str,1);
- IF (Jx > 0) THEN
- IF (Jx < Error) THEN
- Error := Jx;
- Terminator_Index := Temp_Integer;
- END;
- END;
- ++Temp_Integer;
- END;
- Input_String := Copy(Display_Only_Str,1,Error);
- Display_Only_Str := Str_Del(Display_Only_Str,1,Error);
- ELSE
- Error := read_com_till(port_num, 254,'HFmhlABCDnJsuK', Input_String,Terminator_Index);
- END;
- I_S_Length := SVL(Input_String);
- Temp_String := Temp_String + Input_String;
- IF (I_S_Length = 0) THEN
- IF ((Check_Key = True) or (Display_Only = True)) THEN
- Partial := True;
- Ret;
- ELSE
- Goto READ_AGAIN;
- END;
- END;
- IF (Terminator_Index = 0) THEN
- IF (Check_Key) THEN
- Partial := True;
- Ret;
- ELSE
- IF (SVL(Temp_String) > 200) THEN
- Input_String := Temp_String;
- Ret;
- END;
- Goto READ_AGAIN;
- END;
- END;
- IF (Copy(Temp_String,1,1) <> '[') THEN
- Input_String := Temp_String;
- Ret;
- END;
- Input_String := '';
- IF (Terminator_Index > 9) THEN
- IF (Terminator_Index = 10) THEN
- {Device status report. Don't know how to do this one.}
- END;
- IF (Terminator_Index = 11) THEN
- {Erase display}
- Sequence_Index := 1;
- Call GET_SEQUENCE_PARAM;
- IF (Param_Int < 1) THEN
- {Erase from cursor to bottom of screen, don't move cursor.}
- Error := Parse_Int('/X2=',Global_Str('Com_Cur_Scrn_Params')) -
- Parse_Int('/X1=',Global_Str('Com_Cur_Scrn_Params')) - 1;
- {
- Draw_Char(32,WhereX_Vp,whereY_vp,
- ((Text_Color_VP and $F) or (Text_Back_Vp shl 4)),
- Error - WhereX_Vp + 1);
- }
- Temp_Integer := Wherey;
- Draw_Char(32,WhereX,whereY,
- ((Text_Color_VP and $F) or (Text_Back_Vp shl 4)),
- Error - WhereX_Vp + 1);
- {
- Temp_Integer := Wherey_vp;
- }
- Jx := Parse_Int('/Y2=',Global_Str('Com_Cur_Scrn_Params')) - 1;
- Tries := Parse_Int('/X1=',Global_Str('Com_Cur_Scrn_Params')) + 1;
-
- WHILE (Temp_Integer < Jx) DO
- ++Temp_Integer;
- Draw_Char(32,Tries,Temp_Integer,
- ((Text_Color_VP and $F) or (Text_Back_Vp shl 4)),Error);
- END;
- ELSIF (Param_Int = 2) THEN
- {Erase entire display.}
- Clr_Vp;
- END;
- END;
- IF (Terminator_Index = 12) THEN
- {Save Cursor}
- Set_Global_Int('Com_Temp_Cursor',(Wherex_Vp) or (WhereY_VP shl $08));
- END;
- IF (Terminator_Index = 13) THEN
- {Restore cursor}
- GotoXY_Vp(Global_Int('Com_Temp_Cursor') and $FF,Global_Int('Com_Temp_Cursor') shr $08);
- END;
- IF (Terminator_Index = 14) THEN
- {Erase line}
- Draw_Char(32,WhereX,whereY,
- ((Text_Color_VP and $F) or (Text_Back_Vp shl 4)),
- (Parse_Int('/X2=',Global_Str('Com_Cur_Scrn_Params')) -
- Parse_Int('/X1=',Global_Str('Com_Cur_Scrn_Params'))) -
- WhereX_Vp);
-
- {
- Draw_Char(32,WhereX_Vp,whereY_vp,
- ((Text_Color_VP and $F) or (Text_Back_Vp shl 4)),
- (Parse_Int('/X2=',Global_Str('Com_Cur_Scrn_Params')) -
- Parse_Int('/X1=',Global_Str('Com_Cur_Scrn_Params'))) -
- WhereX_Vp);
- }
- END;
- END;
- Sequence_Index := 1;
- IF (Terminator_Index > 5) THEN
- Call GET_SEQUENCE_PARAM;
- IF (Param_Int = -1) THEN
- Param_Int := 1;
- END;
- IF (Terminator_Index = 6) THEN
- {Cursor up}
- GotoXY_VP(WhereX_VP,WhereY_VP - Param_Int);
- END;
- IF (Terminator_Index = 7) THEN
- {Cursor down}
- GotoXY_VP(WhereX_VP,WhereY_VP + Param_Int);
- END;
- IF (Terminator_Index = 8) THEN
- {Cursor right}
- GotoXY_VP(WhereX_VP + Param_Int,WhereY_VP);
- END;
- IF (Terminator_Index = 9) THEN
- {Cursor left}
- GotoXY_VP(WhereX_VP - Param_Int,WhereY_VP);
- END;
- Ret;
- END;
- IF (Terminator_Index < 3) THEN
- {Cusor_Position}
- Call GET_SEQUENCE_PARAM;
- IF (Param_Int < 1) THEN
- Param_Int := 1;
- END;
- Temp_Integer := Param_Int;
- Call GET_SEQUENCE_PARAM;
- IF (Param_Int < 1) THEN
- Param_Int := 1;
- END;
- GotoXY_Vp(Param_Int,Temp_Integer);
- END;
- IF (Terminator_Index = 3) THEN
- {Set graphics rendition.}
- GRAPHICS_PARAMS:
- Call GET_SEQUENCE_PARAM;
- IF (Param_Int > -1) THEN
- IF (Param_Int = 0) THEN
- {all attributes off. I think this means bold, underline, etc. off but
- colors remain.}
- Text_Color_VP := Text_Color_Vp and $77;
- {on monochrome screens, if foreground color is blue or underline, we need to
- change it to white.}
- IF (XPos(Char(Video_Card),'|1|3|6|7|9',1)) THEN
- IF ((Text_Color_Vp and $7) = Blue) THEN
- Text_Color_Vp := (Text_Color_Vp and $70) or $7;
- END;
- END;
- END;
- IF (Param_Int = 1) THEN
- {Bold on}
- Text_Color_VP := Text_Color_VP or $8;
- END;
- IF (Param_Int = 2) THEN
- {Faint on}
- Text_Color_VP := Text_Color_VP and $F7;
- END;
- IF (Param_Int = 3) THEN
- {Italic on. sorry, can't do this one}
- END;
- IF ((Param_Int = 5) or (Param_Int = 6)) THEN
- {Blink}
- Text_Color_VP := Text_Color_VP or $80;
- END;
- IF (Param_Int = 7) THEN
- {Reverse video}
- Text_Color_VP :=
- (Text_Color_VP and $8) or ((Text_Color_VP shr 4) and $7) or
- ((((Text_Color_Vp and $80) shr 4) or (Text_Color_Vp and $7)) shl 4);
- END;
- IF (Param_Int = 8) THEN
- {Concealed on I presume this means both foreground and background are the same}
- Text_Color_VP :=
- (Text_Color_VP and $8) or ((Text_Color_VP shr 4) and $7) or
- (Text_Color_Vp and $F0);
- END;
-
- {30 - 47 are change colors. We mask all but bold and blink bits then OR with
- color so we won't cancell out previous bold or blink attributes.}
- IF (Param_Int = 30) THEN
- {Black foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or Black;
- END;
- IF (Param_Int = 31) THEN
- {Red foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or Red;
- END;
- IF (Param_Int = 32) THEN
- {Green foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or Green;
- END;
- IF (Param_Int = 33) THEN
- {Yellow foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or Brown;
- END;
- IF (Param_Int = 34) THEN
- {Blue foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or Blue;
- END;
- IF (Param_Int = 35) THEN
- {Magenta foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or Magenta;
- END;
- IF (Param_Int = 36) THEN
- {Cyan foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or Cyan;
- END;
- IF (Param_Int = 37) THEN
- {White foreground}
- Text_Color_VP := (Text_Color_VP and $F8) or LightGray;
- END;
- IF (Param_Int = 40) THEN
- {Black background}
- Text_Color_VP := (Text_Color_VP and $8F) or (Black shl 4);
- END;
- IF (Param_Int = 41) THEN
- {Red background}
- Text_Color_VP := (Text_Color_VP and $8F) or (Black shl 4);
- END;
- IF (Param_Int = 42) THEN
- {Green background}
- Text_Color_VP := (Text_Color_VP and $8F) or (green shl 4);
- END;
- IF (Param_Int = 43) THEN
- {Yellow background}
- Text_Color_VP := (Text_Color_VP and $8F) or (brown shl 4);
- END;
- IF (Param_Int = 44) THEN
- {Blue background}
- Text_Color_VP := (Text_Color_VP and $8F) or (blue shl 4);
- END;
- IF (Param_Int = 45) THEN
- {Magenta background}
- Text_Color_VP := (Text_Color_VP and $8F) or (magenta shl 4);
- END;
- IF (Param_Int = 46) THEN
- {Cyan background}
- Text_Color_VP := (Text_Color_VP and $8F) or (cyan shl 4);
- END;
- IF (Param_Int = 47) THEN
- {White background}
- Text_Color_VP := (Text_Color_VP and $8F) or (lightgray shl 4);
- END;
- IF (Param_Int = 48) THEN
- {Subscript background}
- END;
- IF (Param_Int = 49) THEN
- {Superscript background}
- END;
- Goto GRAPHICS_PARAMS;
- END;
- Ret;
- END;
- IF (Terminator_Index = 4) THEN
- {Set mode. Don't really know how to do this.}
- END;
- IF (Terminator_Index = 5) THEN
- {Reset mode. Don't really know how to do this.}
- END;
- RET;
-
- GET_SEQUENCE_PARAM:
- ++Sequence_Index;
- Sequence_Param := '';
- WHILE (XPos(Copy(Temp_String,Sequence_Index,1),'0123456789',1)) DO
- Sequence_Param := Sequence_Param + Copy(Temp_String,Sequence_Index,1);
- ++Sequence_Index;
- END;
- IF (Sequence_Param = '') THEN
- Goto NO_GOOD;
- END;
- Return_Int := Val(Param_Int,Sequence_Param);
- IF (Return_Int) THEN
- NO_GOOD:
- Param_Int := -1;
- END;
- RET;
- {*****************************************************************************}
-
- EXIT:
- Set_Global_Int('Com_Cursor_Pos',WhereX_VP or (WhereY_Vp shl $08));
- END_MACRO;
-
- $MACRO COM_INIT DUMP;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_INIT
-
- Description: The comunications module initialization routine. Creates a
- window to load the file 'MECOM.DB' and gets all the initialization parameters
- and stores them into global variables. If the file or any part of the file is
- not found, then defaults will be assigned.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {
- Set_Global_Str('Com_General_Params','/GENERAL=/DP=/UP=/LF=MECOM.LOG/A=1/VWW=0/VRM=0/MWW=0/MRM=0');
- Set_Global_Str('Com_Box_Params','/BOX=/X1=10/Y1=5/X2=77/Y2=23');
- Set_Global_Str('Com_Color_Params','/COLOR=/F=15/B=0');
- Set_Global_Str('Com_Screen_Params','/SCREEN=/FS=1/SR=0');
- Set_Global_Str('Com_Modem_Params','/MODEM=/XP=~/XC=!/XT=^/XE=||/I=ATE1 M1 V1 X1/H=~+++~ATH0!/DS=!/DC=ATDT/CS=CONNECT/HM=1/NC1=BUSY/NC2=VOICE/NC3=NO CARRIER/NC4=/RT=30/RP=2');
- Set_Global_Str('Com_Terminal_Params','/TERMINAL=/T=DUMB/D=0/CI=0/CO=0/BT=1/BK=8/W=0/BL=2');
- Set_Global_Str('Com_Line_Params','/LINE=/C=3/B=4/P=0/D=3/S=0/IB=2000/OB=200/XON=0/CTS=0/DTR=0/RTS=0/A1=1016/I1=4/T1=0/A2=760/I2=3/T2=0/A3=1000/I3=4/T3=0/A4=744/I4=3/T4=0/A5=16928/I5=3/T5=0/A6=16936/I6=3/T6=0/A7=21024/I7=3/T7=0/A8=21032/I8=3/T8=0');
- Set_Global_Str('Com_Ascii_Params','/ASCII=/E=0/S=0/PC=0/CP=15/LP=10/CU=0/LU=2/CD=0/LD=0');
-
- This one is no longer used. These parameters are now associated with the
- autodial phone list.
- Set_Global_Str('Com_Logon_Params','/LOGON=/F=/L=/P=');
- }
- Def_Int(Start_Line,Search_Amount,Jx);
-
- return_str := 'MECOM.DB';
- RM('MakeUserPath /DF=1');
- Return_Str := Caps(Fexpand(Return_Str));
- IF (Not(Switch_File(Return_Str))) THEN
- Switch_Window(Window_Count);
- Create_Window;
- file_name := Return_Str;
- Load_File(File_Name);
- File_Changed := False;
- END;
-
- window_attr := $81;
- Set_Global_Int('Com_Init_Window',Window_Id);
- Tof;
-
- {If this file is empty, don't continue}
- IF (At_Eof) THEN
- Error_Level := 3002;
- RM('MEERROR /EM=CAN''T FIND: ' + Return_Str + ', OR FILE IS EMPTY! ABORTING MECOM INITIALIZATON. PLEASE EXIT MECOM AND CORRECT THIS PROBLEM.');
- Goto EXIT;
- END;
- {Find the page title INITCOM.ME or create if not there}
- IF (Search_Fwd('|12INITCOM.ME',0) = 0) THEN
- Eof;
- IF (C_Col > 1) THEN
- Down;
- END;
- Put_Line('|12INITCOM.ME');
- END;
- {Save the beginning position}
- Start_Line := C_Line;
- Eol;
- {Find the next page title or EOF}
- IF (Search_Fwd('|12',0) = 0) THEN
- Eof;
- IF (C_Col > 1) THEN
- Down;
- END;
- END;
-
- Search_Amount := C_Line - Start_Line;
-
- Error_Level := 0;
- Update_Status_Line;
-
- Return_Str := '/GENERAL=/DP=/UP=/LF=MECOM.LOG/A=1/VWW=0/VRM=0/MWW=0/MRM=0';
- Call RETRIEVE_DATA;
-
- Return_Str := '/BOX=/X1=10/Y1=5/X2=77/Y2=23';
- Call RETRIEVE_DATA;
-
- Return_Str := '/COLOR=/F=15/B=0';
- Call RETRIEVE_DATA;
-
- Return_Str := '/SCREEN=/FS=1/SR=0';
- Call RETRIEVE_DATA;
-
- Return_Str := '/MODEM=/XP=~/XC=!/XT=^/XE=||/I=ATE1 M1 V1 X1/H=~+++~ATH0!/DS=!/DC=ATDT/CS=CONNECT/HM=1/NC1=BUSY/NC2=VOICE/NC3=NO CARRIER/NC4=/RT=30/RP=2';
- Call RETRIEVE_DATA;
-
- Return_Str := '/TERMINAL=/T=DUMB/D=0/CI=0/CO=0/BT=1/BK=8/W=0/BL=2';
- Call RETRIEVE_DATA;
-
- Return_Str := '/LINE=/C=3/B=4/P=0/D=3/S=0/IB=2000/OB=200/XON=0/CTS=0/DTR=0/RTS=0/A1=1016/I1=4/T1=0/A2=760/I2=3/T2=0/A3=1000/I3=4/T3=0/A4=744/I4=3/T4=0/A5=16928/I5=3/T5=0/A6=16936/I6=3/T6=0/A7=21024/I7=3/T7=0/A8=21032/I8=3/T8=0';
- Call RETRIEVE_DATA;
-
- Return_Str := '/ASCII=/E=0/S=0/PC=0/CP=15/LP=10/CU=0/LU=2/CD=0/LD=0';
- Call RETRIEVE_DATA;
-
- GOTO EXIT;
-
- RETRIEVE_DATA:
- Jx := XPos('=',Return_Str,2);
- Goto_Line(Start_Line);
- IF (Search_Fwd(Copy(Return_Str,1,Jx),Search_Amount)) THEN
- Set_Global_Str('Com_' + Copy(Return_Str,2,Jx - 2) + '_Params',Get_Line);
- ELSE
- Set_Global_Str('Com_' + Copy(Return_Str,2,Jx - 2) + '_Params',Return_Str);
- Eol;
- ++Search_Amount;
- Insert_Mode := True;
- Cr;
- Put_Line(Return_Str);
- END;
- RET;
-
- EXIT:
- {save info about this window for future reference}
- Set_Global_Str('COM_INIT_WINDOW','/WI=' + Str(Window_Id) + '/SL=' +
- Str(Start_Line) + '/SA=' + Str(Search_Amount));
- {If we had to put any stuff in this file, save it.}
- IF (File_Changed) THEN
- Save_File;
- END;
-
- END_MACRO;
-
- $MACRO COM_WAIT_FOR_STR;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_WAIT_FOR_STR
-
- Description: A comunications module macro. Waits until a specified string
- or one of a set of strings is received from the com port or the
- specified timeout occurs. All characters recieved during this
- macro will be sent to the terminal emulator and are subject to
- being interpreted and displayed.
-
- Parameters:
- /S1= - /Snn= The desired string(s). If there is more than one,
- it will wait for the first occurance of any of them.
- /T= If 0, timeout is infinite. If > 0 number of seconds.
- /EI= Echo interval. The time base is PC clock ticks, or 18.2 ticks
- per second. Characters will continue to accumulate in a 200 byte
- buffer until the buffer is full, or the echo interval has lapsed.
- The contents of the buffer are then sent to the terminal emulator
- macro for displaying on the screen. The longer the interval, the
- more characters can be potentially recieved before timeout
- occurs. The shorter the interval, the smoother the echo of
- characters to the screen. The reason for this trade-off is
- because of the overhead of calling the terminal emulator to
- display the accumulated characters. The default is 9, or
- approximately 1/2 second.
-
- Returns:
-
- Return_Int > 0 Successful, nn = number corresponding to /Snn=.
- Return_Int = 0 timeout
- Return_Int = -1 User aborted by pressing <ESC>
- Return_Int = -2 Invalid parameters. I.e, timeout is infinite,
- and there are no strings to wait for. Obviously,
- this would cause an infinite loop.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Str(Display_Str,Match_Str,Mac_Str[30]);
- Def_Int(Error,Port_Num,End_Time,Timeout,Matching,Return_Code,Echo_Interval,Echo_End,
- String_Count,Match_Index);
- Def_Char(Ch);
-
- String_Count := 0;
- GET_STRINGS:
- Display_Str := Parse_Str('/S' + Str(String_Count + 1) + '=',MParm_Str);
- IF (Display_Str <> '') THEN
- ++String_Count;
- Set_Global_Str('COM_MATCH_STR' + Str(String_Count),Caps(Display_Str));
- Goto GET_STRINGS;
- END;
-
- Timeout := Parse_Int('/T=',MParm_Str);
- IF (Timeout < 1) THEN
- Timeout := 0;
- END;
- {We will not allow an infinite timeout when there is no string to wait for}
- IF (Timeout = 0) THEN
- IF (String_Count = 0) THEN
- Return_Code := -2;
- Goto ABORT;
- END;
- END;
-
- port_num := global_int('COM_PORT_NUM');
- Mac_Str := 'MECOM^COM_' + Parse_Str('/T=',Global_Str('Com_Terminal_Params')) +
- ' /DO=';
- Return_Str := Caps(Return_Str);
- Display_Str := '';
- Match_Str := '';
- Matching := False;
-
- Echo_Interval := Parse_Int('/EI=',Mparm_Str);
- IF (Echo_Interval < 1) THEN
- Echo_Interval := 9;
- END;
-
- Echo_End := MemP($46C) + Echo_Interval;
- End_Time := Echo_End + Int_R(Real_I(Timeout) * 18.2);
- match_index := 1;
-
- WAIT_LOOP:
-
- Error := read_com(port_num,Ch);
- IF (Error = 0) THEN
- Display_Str := Display_Str + Ch;
- IF (Matching) THEN
- Match_Str := Match_Str + Caps(CH);
- IF (Match_Str <> Copy(Global_Str('COM_MATCH_STR' + Str(Match_Index)),
- 1,Svl(Match_Str))) THEN
- {Check to see if any of the other strings match before giving up}
- IF (String_Count > 1) THEN
- Match_Index := 1;
- LOOK_FOR_OTHER_MATCH:
- IF (Match_Str = Copy(Global_Str('COM_MATCH_STR' + Str(Match_Index)),
- 1,Svl(Match_Str))) THEN
- Goto NEW_MATCH;
- END;
- IF (Match_Index < String_Count) THEN
- ++Match_Index;
- Goto LOOK_FOR_OTHER_MATCH;
- END;
- END;
- Matching := False;
- Goto NEW_MATCH;
- END;
- IF (Svl(Match_Str) = Length(Global_Str('COM_MATCH_STR' + Str(Match_Index)))) THEN
- Return_Code := Match_Index;
- Goto EXIT;
- END;
- ELSE
- Match_Index := 1;
- CHECK_MATCH_BEGIN:
- IF (Caps(Ch) = Copy(Global_Str('COM_MATCH_STR' + Str(Match_Index)),1,1))
- THEN
- Match_Str := Caps(Ch);
- Matching := True;
- ELSE
- IF (Match_Index < String_Count) THEN
- ++Match_Index;
- Goto CHECK_MATCH_BEGIN;
- END;
- END;
- END;
- END;
- NEW_MATCH:
- IF (Timeout) THEN
- IF (MemP($46C) >= End_Time) THEN
- Return_Code := 0;
- Goto EXIT;
- END;
- END;
- IF ((Svl(Display_Str) > 200) or (MemP($46C) >= Echo_End)) THEN
- Echo_End := MemP($46C) + Echo_Interval;
- {
- Beep;
- Write('[' + Match_Str + '] ',1,1,0,Error_Color);
- }
- RM(Mac_Str + Display_Str);
- Display_Str := '';
- END;
- IF (Key1 = 27) THEN
- Goto EXIT;
- END;
- Check_Key;
- IF (Key1 = 27) THEN
- Return_Code := -1;
- Goto ABORT;
- END;
- Goto WAIT_LOOP;
-
- EXIT:
- IF (Display_Str <> '') THEN
- RM(Mac_Str + Display_Str);
- END;
- ABORT:
- WHILE (String_Count) DO
- Set_Global_Str('COM_MATCH_STR' + Str(String_Count),'');
- --String_Count;
- END;
-
- Return_Int := Return_Code;
- END_MACRO;
-
- $MACRO COM_SEND_STR;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SEND_STR
-
- Description: A comunications module macro. Sends the specified string
- to the com port.
-
- Parameters:
- Return_Str = Desired string.
- /T= If 0, timeout is infinite. If > 0 number of seconds.
- /CP= Character pacing or delay between characters. Only needed if
- remote is slow.
-
- Returns:
-
- Return_Int = 1 Successful, string sent.
- Return_Int = 0 timeout
- Return_Int = -1 aborted by the user pressing <ESC>
-
- Return_Str = string sent (can be useful in case of timeout to
- determine if part of the string was sent).
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(Error,Port_Num,End_Time,Timeout,Pointer,jx,Char_Pacing);
-
- Timeout := Parse_Int('/T=',MParm_Str);
- IF (Timeout < 1) THEN
- Timeout := 0;
- END;
- port_num := global_int('COM_PORT_NUM');
- Char_Pacing := Parse_Int('/CP=',MParm_Str);
-
- Pointer := 0;
- End_Time := MemP($46C) + Int_R(Real_I(Timeout) * 18.2);
-
- SEND_LOOP:
- ++Pointer;
- RETRY:
- If (Check_Key) THEN
- IF (Key1 = 27) THEN
- Return_Int := -1;
- Goto EXIT;
- END;
- END;
-
- Delay(Char_Pacing);
- Error := Write_com(port_num,Copy(Return_Str,Pointer,1),Jx);
- IF (Pointer >= Length(Return_Str)) THEN
- Return_Int := 1;
- Goto EXIT;
- END;
- IF (Timeout) THEN
- IF (MemP($46C) >= End_Time) THEN
- --Pointer;
- Return_Int := 0;
- Goto EXIT;
- END;
- END;
- IF ((Error = 0) and (Jx = 1)) THEN
- Goto SEND_LOOP;
- ELSE
- Goto RETRY;
- END;
-
- EXIT:
-
- Return_Str := Copy(Return_Str,1,Pointer);
- END_MACRO;
-
- $MACRO COM_CONNECT_WAIT;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_CONNECT_WAIT
-
- Description: A comunications module macro. Waits for a connection for a user
- specified time. Will exit upon timeout or connect, whichever occurs first. If
- timeout, then it will hang up. Places a box on the screen to alert user of
- elapsed time.
-
- Parameters:
- /AC= If 1, indicates that we have already made a connection.
- Currently, only used when autoredial has already made the
- connection.
-
- Returns:
- Return_Int = 0 timeout
- Return_Int = 1 connection established
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(Terminator_Index,Temp_Integer,Result_Code,port_num,Box_X,Box_Y);
- Def_Str(Modem_Response,Temp_Char);
-
- Result_Code := False;
- Box_X := 26;
- Box_Y := 12;
- Clr_Vp;
- Set_Global_Int('Com_Cursor_Pos',$101);
- port_num := global_int('COM_PORT_NUM');
- IF (Parse_Int('/AC=',MParm_Str)) THEN
- Return_Int := True;
- Goto ALREADY_CONNECTED;
- END;
-
- {Use predefined redial timeout spec as a timeout here}
- Temp_Integer := Parse_Int('/RT=',Global_Str('Com_Modem_Params'));
- Put_Box(Box_X,Box_Y,Box_X + 28,Box_Y + 3,0,M_B_Color,'WAITING FOR CONNECT',True);
- Write('Press <ESC> to hang up',Box_X + 3,Box_Y + 2,0,M_B_Color);
- WAIT_FOR_CONNECT:
- IF (Check_Key) THEN
- IF (Key1 = 27) THEN
- Goto EXIT;
- END;
- END;
- Write(Str(Temp_Integer) + ' of ' +
- Parse_Str('/RT=',Global_Str('Com_Modem_Params')) + ' seconds. ',Box_X + 3,
- Box_Y + 1,0,M_B_Color);
- IF (read_com_till(port_num,1,'',Modem_Response,
- Terminator_Index) = 0) Then
- {This one should be the connect or no connect string}
-
- MORE_RESPONSE:
- Delay(50);
- IF (read_com_till(port_num,80,'|10|13',
- Temp_Char,Terminator_Index) = 0) THEN
- Modem_Response := Modem_Response + Temp_Char;
- IF ((Terminator_Index = 0) and (Svl(Modem_Response) < 80)) THEN
- Goto MORE_RESPONSE;
- END;
- END;
- IF (XPos(Parse_Str('/CS=',Global_Str('Com_Modem_Params')),Modem_Response,1)) THEN
- Result_Code := True;
- Goto EXIT;
- END;
- Goto NOT_CONNECTED;
- ELSE
- NOT_CONNECTED:
- IF (Temp_Integer = 0) THEN
- Goto EXIT;
- END;
- Delay(1000);
- --Temp_Integer;
- Goto WAIT_FOR_CONNECT;
- END;
-
- EXIT:
- Kill_Box;
- IF (Result_Code = 0) THEN
- {If unsuccessful, hang up}
- RM('MECOM^COM_PHONE /TP=3');
- END;
- Return_Int := Result_Code;
- ALREADY_CONNECTED:
- END_MACRO;
-
- $MACRO COM_CURSOR_OFF;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_CURSOR_OFF
-
- Description: A comunications module macro. Turns the cursor off.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {Use the BIOS interrupt $10}
- R_AX := $0100;
- R_CX := $2000;
- Intr($10);
- END_MACRO;
-
- $MACRO COM_CURSOR_ON;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: CURSOR_ON
-
- Description: A comunications module macro. Turns the cursor on.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- {Any reference to the system variable INSERT_MODE will reset the cursor}
- INSERT_MODE := INSERT_MODE;
- END_MACRO;
-
- $MACRO COM_SCREEN_DUMP;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SCREEN_DUMP
-
- Description: A comunications module macro. Captures the terminal screen to
- a file or device.
-
- Parameters:
- /MY= The Y coordinate to reference the prompt box to.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(Line_Counter,Column_Counter,Active_Page,Old_x,old_y,Menu_Y,Handle,
- Error);
- Def_Str(T_Str,Sstr[10]);
- Menu_Y := Parse_Int('MY=',MParm_Str);
- IF (Menu_Y < 1) THEN
- Menu_Y := 3;
- END;
-
- sstr := ' /S=1';
- Return_Str := 'MECOM.SCR';
-
- PROMPT:
- RM('USERIN^QUERYBOX /C=16/W=12/H=MECOM^*/T=SCREEN CAPTURE FILE NAME/L=' + Str(Menu_Y + 7));
- IF (RETURN_INT) THEN
- IF (Return_Str = '') THEN
- Beep;
- Goto PROMPT;
- END;
-
- IF (File_Exists(Return_Str)) THEN
- {Check to see if the file is a device like a printer. If so, don't bother
- with the menu that follows.}
- Error := S_Open_File(Return_Str,1,Handle);
- IF (Error) THEN
- Error_Level := 3000 + Error;
- RM('MEERROR');
- Goto EXIT;
- END;
- R_AX := $4400;
- R_BX := Handle;
- Intr($21);
- IF (R_Flags and $01) THEN
- Error_Level := 3000 + R_AX;
- RM('MEERROR');
- Goto ABORT;
- END;
- Line_Counter := R_DX;
- Error := S_Close_File(handle);
- IF (Error) THEN
- Error_Level := 3000 + Error;
- RM('MEERROR');
- Goto EXIT;
- END;
- IF (Line_Counter and $80) THEN
- Goto NEW_FILE;
- END;
- RM('USERIN^XMENU /B=1/T=1/X=16/Y=' + Str(Menu_Y + 7) +
- '/S=1/L=SCREEN CAPTURE FILE EXISTS' +
- '/M=Append(MECOM^*)Overwrite()aBort()');
- IF ((Return_Int < 1) or (Return_Int = 3)) THEN
- Goto EXIT;
- END;
- IF (Return_Int = 1) THEN
- Error := S_Open_File(Return_Str,1,Handle);
- IF (Error) THEN
- Error_Level := 3000 + Error;
- RM('MEERROR');
- Goto EXIT;
- END;
- Error := S_Move_File_Ptr(Handle,2,0);
- IF (Error) THEN
- Error_Level := 3000 + Error;
- RM('MEERROR');
- Goto ABORT;
- END;
- Goto APPEND_FILE;
- END;
- IF (Return_Int = 2) THEN
- Goto NEW_FILE;
- END;
- ELSE
- NEW_FILE:
- Error := S_Create_File(Return_Str,Handle);
- IF (Error) THEN
- Error_Level := 3000 + Error;
- RM('MEERROR');
- Goto EXIT;
- END;
- END;
- ELSE
- Goto EXIT;
- END;
- APPEND_FILE:
-
- old_x := WhereX_vp;
- old_y := whereY_vp;
- Line_Counter := 0;
- Column_Counter := 0;
- T_Str := '';
- R_AX := $0F00;
- Intr($10);
- Active_Page := R_BX;
-
- WHILE (Line_Counter < Screen_Length) DO
- ++Line_Counter;
- Column_Counter := 0;
- T_Str := '';
-
- {Get the screen a line at a time}
- WHILE (Column_Counter < Screen_Width) DO
- ++Column_Counter;
- {Get the character at the cursor}
- GotoXY_VP(Column_Counter,Line_Counter);
- R_AX := $0800;
- R_BX := Active_Page;
- Intr($10);
- T_Str := T_Str + Char(R_AX and $FF);
- END;
-
- {Send line to file or device}
- Return_Str := t_str + '|13|10';
- RM('MEUTIL3^PRINTSTR' + sstr + '/H=' + Str(Handle));
- sstr := ' ';
- IF (Error_Level) THEN
- RM('MEERROR');
- Goto ABORT;
- END;
- END;
-
- Gotoxy_vp(old_x,old_y);
-
- ABORT:
-
- Error := S_Close_File(handle);
-
- EXIT:
-
- END_MACRO;
-
- $MACRO COM_SEND_MSG;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_SEND_MSG
-
- Description: A comunications module macro. Creates a window to edit a message
- to send to the com port. Very useful if you don't like the EMail
- editing system on the BBS you're using. Both spell checking and
- search are enabled.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
- Def_Int(Active_Window,Wrap,Margin);
-
- Active_Window := Window_Id;
- Create_Window;
- File_Name := 'MECOM.MSG';
- File_Changed := False;
- Wrap := Parse_Int('/MWW=',Global_Str('COM_GENERAL_PARAMS'));
- Margin := Parse_Int('/MRM=',Global_Str('COM_GENERAL_PARAMS'));
-
- {The macro EDITWINDOW provides the editor like interface}
- RM('USERIN^EDITWINDOW /H=MECOM^ME/X=1/SE=1/RM=74/SP=1/T=CREATE A MESSAGE TO SEND TO THE COM PORT/Y='
- + Str(Min_Window_Row) + '/W=' + Str(Screen_Width) + '/L=' +
- Str(Max_Window_Row - Min_Window_Row - 2) + '/WW=' + Str(Wrap) + '/RM=' +
- Str(Margin));
- IF (File_Changed) THEN
- RM('userin^VERIFY /H=MECOM^ME/L=10/C=10/S=2/H=MECOM^*/T=SEND THIS MESSAGE TO THE COM PORT?');
- IF (Return_Int) THEN
- Tof;
- WHILE (Not(At_Eof)) DO
- {Send each line to the com port adding EOL terminator, character pacing, and
- blank line expansion as configured by user}
- IF ((Get_Line = '') and
- (Parse_Int('/S=',Global_Str('Com_Ascii_Params')) > 0)) THEN
- Return_Str := ' ';
- ELSE
- Return_Str := '';
- END;
- Return_Str := Return_Str + Get_Line + Copy('|13|10',1,Parse_Int('/CO=',
- Global_Str('COM_TERMINAL_PARAMS')) + 1);
-
- RM('MECOM^COM_SEND_STR /T=10/CP=' + Parse_Str('/CP=',Global_Str('Com_Ascii_Params')));
- {Look and see if there are any incomming characters to display}
- RM('MECOM^COM_WAIT_FOR_STR /T=1/EI=9');
- Down;
- END;
- END;
- END;
-
- Delete_Window;
- IF (Switch_Win_Id(Active_Window)) THEN END;
- END_MACRO;
-
- $MACRO COM_VIEW_FILE;
- {*******************************MULTI-EDIT MACRO*******************************
-
- Name: COM_VIEW_FILE
-
- Description: A comunications module macro. Creates a window to view and edit
- a file or the currently active log. In the case of the log, it
- can serve as an enhanced "scroll back" feature.
-
- (C) Copyright 1990 by American Cybernetics, Inc.
- ******************************************************************************}
-
- Def_Int(Active_Window,View_Window,Log_Handle,Bytes_Written,Error,Menu_Y,
- Viewing_Log,TBC,Already_Viewed,Wrap,Margin);
- Def_Str(F_Name[40]);
-
- Menu_Y := Parse_Int('MY=',MParm_Str);
- Viewing_Log := False;
- TBC := Box_Count;
- View_Window := 0;
- Wrap := Parse_Int('/VWW=',Global_Str('COM_GENERAL_PARAMS'));
- Margin := Parse_Int('/VRM=',Global_Str('COM_GENERAL_PARAMS'));
-
- IF ((Global_Int('Com_Logging') = True) and
- (Parse_Int('/LOG=',MParm_Str) = True)) THEN
- {Need to close the log file so we can load it into the window.}
- Error := S_Write_Bytes(Global_Str('Com_Log_Str'),Global_Int('Com_Log_Handle'),Bytes_Written);
- IF (Bytes_Written < Length(Global_Str('Com_Log_Str'))) THEN
- Return_Int := 3241;
- RM('COM_LOG_ERROR');
- Goto ABORT;
- END;
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT;
- END;
- Error := S_Close_File(Global_Int('Com_Log_Handle'));
- IF (Error) THEN
- Return_Int := Error;
- RM('COM_LOG_ERROR');
- Goto ABORT;
- END;
- Set_Global_Int('Com_Logging',False);
- Set_Global_Str('Com_Log_Str','');
- Viewing_Log := True;
- {Word wrap is probably not desirable when viewing the log}
- Wrap := 0;
- Margin := 0;
- END;
-
-
- Active_Window := Window_Id;
- Create_Window;
- View_Window := Window_Id;
-
-
- {Load the file.}
- IF (Viewing_Log) THEN
- Return_Str := Global_Str('COM_LOG_FILE');
- ELSE
- Return_Str := '';
- LOAD_PROMPT:
- RM('USERIN^QUERYBOX /H=MECOM^FILVIE/C=16/W=40/T=FILE TO VIEW/F2=Dir /L=' +
- Str(Menu_Y + 9 + (Global_Int('Com_LOGGING') * 3)));
-
- IF (Return_Int = 0) THEN
- Goto ABORT;
- END;
- IF (Return_Int = -1) THEN
- refresh := true;
- fkey_row := Global_Int('Temp_fkey_row');
- {
- Message_Row := Global_Int('Temp_Message_Row');
- }
- RM('DIRSHELL /S=1');
- fkey_row := 0;
- {
- Message_Row := 0;
- }
- Set_Vp(Parse_Int('/X1=',Global_Str('Com_Cur_Scrn_Params')) + 1,
- Parse_Int('/Y1=',Global_Str('Com_Cur_Scrn_Params')) + 1,
- Parse_Int('/X2=',Global_Str('Com_Cur_Scrn_Params')) - 1,
- Parse_Int('/Y2=',Global_Str('Com_Cur_Scrn_Params')) - 1);
- Text_Color_Vp := Parse_Int('/F=',Global_Str('Com_Color_Params')) +
- (Parse_Int('/B=',Global_Str('Com_Color_Params')) shl 4);
- refresh := false;
- If Return_Str <> '' THEN
- Goto LOAD_PROMPT;
- END;
- END;
- END;
-
- Load_File(Return_Str);
- IF (Error_Level) THEN
- RM('MEERROR');
- Error_Level := 0;
- Return_Str := '';
- Goto LOAD_PROMPT;
- END;
- F_Name := Caps(Return_Str);
- IF (Viewing_Log) THEN
- Eof;
- Goto_Col(1);
- END;
- Already_Viewed := False;
- VIEW_FILE:
- RM('USERIN^EDITWINDOW /H=MECOM^FILVIE/X=1/CC=1/SE=1/NK=1/Y=' + Str(Min_Window_Row) + '/W=' +
- Str(Screen_Width) + '/L=' + Str(Max_Window_Row - Min_Window_Row - 2) +
- '/NB=' + Str(Already_Viewed) + '/WW=' + Str(Wrap) + '/RM=' + Str(Margin) +
- '/T=VIEWING' + copy(' LOG ',1,(Viewing_Log * 4) + 1) + 'FILE: ' + F_Name);
- Already_Viewed := True;
- {If they altered the file, give them a chance to save.}
- Read_Only := False;
- RM('WINDOW^DELWIN /BC=' + Str(Box_Count));
- IF (Return_Int = 0) THEN
- {If they said don't exit yet, put em back into the editwindow}
- Goto VIEW_FILE;
- END;
-
- IF (Viewing_Log) THEN
- {Now, reopen the log for append and move the file pointer.}
- Error := S_Open_File(Global_Str('COM_LOG_FILE'),1,Log_Handle);
- IF (Error) THEN
- Return_Int := Error;
- RM('MECOM^COM_LOG_ERROR');
- Goto ABORT;
-
- END;
- Error := S_Move_File_Ptr(Log_Handle,2,0);
- IF (Error) THEN
- Return_Int := Error;
- RM('MECOM^COM_LOG_ERROR');
- Goto ABORT;
- END;
-
- {Set the log handle global to new handle.}
- Set_Global_Int('Com_LOG_Handle',Log_Handle);
- Set_Global_Int('Com_LOGGING',True);
-
- END;
-
- ABORT:
- IF (Switch_Win_Id(View_Window)) THEN
- Read_Only := False;
- Delete_Window;
- END;
- IF (Switch_Win_Id(Active_Window)) THEN END;
- EXIT:
- {Kill any remaining boxes made during the running of this macro}
- WHILE (Box_Count > TBC) DO
- Kill_Box;
- END;
- END_MACRO;
-