Download An example

Transcript
AP P E N D I X D : C O M P L E T E S Y S T E M S O U R C E C O D E
APPLICATION
indexing
description: "The root class for the medical DB project.";
author: "Sam Lightstone";
date: "$Date: $";
revision: "$Revision: $"
class APPLICATION
create
make
feature
make is
-- allocate app with n states and m
-- possible choices, instantiate transition and
-- state arrays, then traverse the state transitions
-- until the exit state is traversed.
local
m: INTEGER;
db_name: STRING
do
io.putstring (intro_text);
db_name := "";
io.new_line;
io.new_line;
io.putstring ("%N%NThis program requires a connection to a relation database.");
io.putstring ("%NPlease enter the name of the database you expect MHDCS to connect to:%N ");
io.readline;
db_name := clone (io.laststring);
create patient_data_repository.make (db_name);
if not patient_data_repository.connected_ok then
db_problems := true;
io.putstring ("%NUnable to connect to the specified database.");
io.putstring ("%NThe database may not exist, or may be locked by another
application.");
io.putstring ("%NPlease try again later.")
elseif not patient_data_repository.tables_conform then
db_problems := true;
io.putstring ("%NThe database tables do not conform the required specification.");
io.putstring ("%NPlease contact the database administrator for help.")
end;
create home_panel.make (patient_data_repository);
create new_event_panel.make (patient_data_repository);
create query_panel.make (patient_data_repository);
create all_users_panel.make (patient_data_repository);
create overview_panel.make (patient_data_repository);
create panel_transitions.make (max_state, max_panel_choices);
61