Component specifications for Talker

These descriptions were extracted directly from the Teamwwork CASE model ING_message_log_4


NAME:
Add_msg_to_display

TITLE:
No Title

PARAMETERS:
Text_tag : data_in
Stamped_msg : data_in

LOCALS:


GLOBALS:
Display_line : data_out

BODY:
Append Stamped_msg to the display.
Tag it with Text_tag to get the right colours.


NAME:
After_noon

TITLE:
No Title

PARAMETERS:
Ms_until_noon : data_out

LOCALS:


GLOBALS:


BODY:
Calculate and return the number of milliseconds from
now until noon.



NAME:
Beeper

TITLE:
Sound the audible alarm

PARAMETERS:


LOCALS:


GLOBALS:
Enable_audible_alarm : control_in

BODY:
If Enable_audible_alarm is "TRUE":
  Write the BEL character to the command terminal.
Schedule this procedure to run again after 1s.


NAME:
Change_log_file

TITLE:
No Title

PARAMETERS:
Filter_level : data_in

LOCALS:


GLOBALS:
Msg_log : data_inout
Log_file_name : data_out

BODY:
Choose the name of the new log-file:
  Append Filter_level to "/var/log/talker.".
Return if the new file is not readable.
Call Delete_old_msgs.
Close the old log file on Msg_log; ignore errors.
Open the new log file, using tailfin as a filter.
Store the file name in Log_file_name.
Arrange for Read_new_msg to be called whenever
 Msg_log is readable.


NAME:
Close_log

TITLE:
No Title

PARAMETERS:
MSG_LOG : data_in

LOCALS:


GLOBALS:
Stamped_msg : data_out

BODY:
Call Timestamp().
Compose a Stamped_msg thus:
  Timestamp + " B talk_log_server: The log was closed.\n".
Write Stamped_msg to MSG_LOG.
Close MSG_LOG.


NAME:
Delete_old_msgs

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:
Display_line : data_out

BODY:
Remove all the messages from the display:
  Delete from the start of line 2 to the end.
  Don't delete line 1 (that's the key for the tags,
   not a message).


NAME:
Do_mute

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:
Enable_audible_alarm : control_out

BODY:
Set Enable_audible_alarm to FALSE.


NAME:
Do_quash

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:


BODY:
Delete all the text in the alarm box.
Iconify the alarm box.


NAME:
Flasher

TITLE:
No Title

PARAMETERS:
Widget : data_in
C1 : data_in
C2 : data_in

LOCALS:


GLOBALS:


BODY:
Set the background of the alarm box to $C1.
Schedule this procedure to run again after 1s,
 with C1 and C2 transposed.


NAME:
Init_alarms

TITLE:
Initialize the alarm module

PARAMETERS:


LOCALS:


GLOBALS:


BODY:
Create the alarm box, making the text empty.
Include a button marked Acknowledge which calls
 Do_quash, Do_mute, Send_quash and Send_mute when pressed.
Include a button marked Quiet! which calls
 Do_mute and Send_mute when pressed.
Call Flasher, specifying red and white for C1 and C2.
Call Do_mute.
Call Beeper.


NAME:
Init_log

TITLE:
No Title

PARAMETERS:
Widget : data_out

LOCALS:


GLOBALS:
Log_file_name : data_in

BODY:
Create a panel to display the name of the log file;
 link this directly to Log_file_name.
Call Reopen_log.
Return the widget-name of the panel.


NAME:
Init_menus

TITLE:
No Title

PARAMETERS:
Widget : data_out

LOCALS:


GLOBALS:


BODY:
Create a menubar.
In the menubar:
  Create the menus File, Font and Filtering.
In the File menu:
  Create the Exit command.
In the Font menu:
  Create commands calling Set_font for various sizes.
In the Filtering menu:
  Create a command calling Change_log_file debug.
  Create a command calling Change_log_file info.
  Create a command calling Change_log_file notice.
Return the name of the menubar widget.


NAME:
Init_text

TITLE:
No Title

PARAMETERS:
Widget : data_out

LOCALS:


GLOBALS:
Text_tag : data_out

BODY:
Create a text widget in a frame, with scrollbars.
Create text tags with colour attributes as follows:
  Alarm: black text on red background.
  Highlight: black text on orange background.
  Normal: black text on white background.
  Debug: black text on blue background.
Create a key to these colours:
  Make the key the first line of text.
  Include a string with each of the tags.
Return the name of the frame widget.


NAME:
Raise_alarm

TITLE:
Generate an alarm dialogue

PARAMETERS:
Stamped_msg : data_in

LOCALS:


GLOBALS:
Enable_audible_alarm : control_out
Stamped_msg : data_out

BODY:
Add Stamped_msg to the text in the alarm box.
Set Enable_audible_alarm to TRUE.
Deiconify the alarm box.


NAME:
Read_new_msg

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:
Msg_log : data_in

BODY:
Read a Stamped_msg from Msg_log.
If Stamped_msg contains ALARM or ALERT:
  Set Text_tag to Alarm.
  Call Raise_alarm.
Else if Stamped_msg contains NOTICE or WARNING:
  Set Text_tag to Highlight.
Else if Stamped_msg contains INFO:
  Set Text_tag to Normal.
Else if Stamped_msg contains DEBUG:
  Set Text_tag to Debug.
Else if Stamped_msg contains QUIET:
  Set Text_tag to Alarm.
  Call Do_mute.
Else if Stamped_msg contains QUASH:
  Set Text_tag to Alarm.
  Call Do_quash.
Else:
  Set Text_tag to Normal.
Call Add_msg_to_display.  


NAME:
Reopen_log

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:


BODY:
Call Change_log_file with Filter_level set to info.
Schedule Reopen_log to run after the interval returned
 by After_noon (i.e. just after 1200hrs).


NAME:
Send_mute

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:


BODY:
Send the message "QUIET!" to syslogd.


NAME:
Send_quash

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:


BODY:
Send the message "QUASH" to syslogd.


NAME:
Set_font

TITLE:
No Title

PARAMETERS:
Point_size : data_in

LOCALS:


GLOBALS:
Font : data_out

BODY:
Find a fonmt that is available in Point_size;
 failing that, use the "fixed font at the default size".
Set the font in the Text_widget.


NAME:
talker_main

TITLE:
No Title

PARAMETERS:


LOCALS:


GLOBALS:


BODY:
Set the window and icon decoration for the main window.
Call Init_menus and pack the widget it returns.
Call Init_text and pack the widget it returns.
Call Init_log and pack the widget it returns.
Call init alarms.