home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / simtel / sigm / vols000 / vol085 / menu.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  1984-04-29  |  2.5 KB  |  98 lines

  1. External btree::menu(4);
  2.  
  3. PROCEDURE SIGNON;
  4. VAR    IX : 1..24;
  5. BEGIN
  6.   FOR IX:=1 TO 24 DO WRITELN;
  7.   WRITELN( ' ':15, 'NAME AND ADDRESS ENTRY PROGRAM Version #', vers );
  8.   FOR IX:=1 TO 4 DO WRITELN;
  9. {    SIGNON TEXT GOES HERE    }
  10. END{of SIGNON};
  11.  
  12.  
  13. PROCEDURE MENU;
  14. BEGIN
  15.   WRITELN;
  16.   WRITELN;
  17.   WRITELN( ' ':12, '1  -  INSERT MODE' );
  18.   WRITELN( ' ':12, '2  -  DELETE MODE' );
  19.   WRITELN( ' ':12, '3  -  DISPLAY MODE' );
  20.   WRITELN( ' ':12, '4  -  STORE DATA ON DISC' );
  21.   WRITELN( ' ':12, '5  -  GET DATA FROM DISC' );
  22.   WRITELN( ' ':12, '8  -  INFORMATION' );
  23.   WRITELN( ' ':12, '9  -  TERMINATE' );
  24.   WRITELN;
  25.   CASE Command OF
  26.    '1': WRITELN( 'MODE=INSERT' );
  27.    '2': WRITELN( 'MODE=DELETE' );
  28.    '3': WRITELN( 'MODE=DISPLAY' );
  29.    '4': WRITELN( 'STORE DATA' );
  30.    '5': WRITELN( 'GET DATA' );
  31.    '8': WRITELN( 'INFORMATION' );
  32.   ELSE: WRITELN
  33.   END{CASE}
  34. END{of MENU};
  35.  
  36.  
  37. FUNCTION toupper( ch: CHAR ): CHAR;
  38. BEGIN
  39.   IF ( 'a'<=ch ) AND ( ch<='z' ) THEN ch := CHR(ORD(ch) - 32);
  40.   toupper := ch
  41. END{of toupper};
  42.  
  43.  
  44. PROCEDURE INPUT( txt: dstring; VAR answer: shorty );
  45. BEGIN
  46.   WRITE( txt );
  47.   READLN( answer );
  48. END{of INPUT};
  49.  
  50.  
  51. PROCEDURE LIST;
  52. VAR    ch : CHAR;
  53.     OUTPUT : TEXT;
  54. BEGIN
  55.   WRITELN( 'Output to C(onsole or P(rinter? ' );
  56.   readln( ch );
  57.   con_wanted := ( toupper(ch)='C' );
  58.   tty_wanted := ( toupper(ch)='P' );
  59.   { one or the other but not both }
  60.   if tty_wanted then con_wanted := false;
  61.   if NOT (con_wanted OR tty_wanted) then
  62.     { listing := false }
  63.   else begin
  64.     { listing := true; }
  65.     if con_wanted then REWRITE( 'CON:', OUTPUT );
  66.     if tty_wanted then REWRITE( 'LST:', OUTPUT );
  67.   end;
  68.   WRITELN; WRITELN;
  69.   Inorder( Employee );
  70.   if con_wanted then begin
  71.     writeln;
  72.     WRITE( bell, 'PRESS RETURN TO CONTINUE ' );
  73.     READLN( ch );
  74.   end
  75. END{of LIST}{ CLOSE( OUTPUT ); };
  76. {LIST can be easily altered to allow writing to a disc file
  77. as a third option.  Do not confuse this with the STORE
  78. procedure found in the DISC module.  LIST outputs the file
  79. in key-sort order(Inorder does this).  STORE uses Preorder
  80. which tends to write the file in a more random fashion.
  81. This is done intentionally so that when the file is later
  82. recovered using the FETCH procedure, the B-tree is somewhat
  83. balanced.
  84. }
  85.  
  86. PROCEDURE Help;
  87. begin
  88.   writeln('This is an explanatory section to be developed.');
  89. {I made this option availiable, and placed it in
  90. a separate module so it can be easily amplified
  91. without necessitating a recompilation and
  92. reassembly of the main program and all the other
  93. modules.
  94. rab
  95. }
  96. end;
  97.  .
  98.