home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / misc / volume3 / pcmail / part06 / screen.h < prev    next >
Encoding:
C/C++ Source or Header  |  1989-02-03  |  3.9 KB  |  120 lines

  1. /*++
  2. /* NAME
  3. /*    screen
  4. /* SUMMARY
  5. /*    structure of mail shell command windows
  6. /* PROJECT
  7. /*    pc-mail
  8. /* PACKAGE
  9. /*    mailsh
  10. /* SYNOPSIS
  11. /*    #include "screen.h"
  12. /* DESCRIPTION
  13. /*    The data structures in this file are used by the interactive shell to 
  14. /*    define what a screen looks like, and what commands the user can give.
  15. /*
  16. /*    For each screen, one has to define a table of (selector, command name, 
  17. /*    help string, and function pointer) tuples.
  18. /*    The command names are listed in the top window. If the user enters
  19. /*    the type of input specified by the selector, the associated function
  20. /*    is called. A null function pointer means go back to the calling screen. 
  21. /*
  22. /*    The table is terminated with a null selector entry; its help 
  23. /*    string is displayed in the bottom window (as a prompt), and the 
  24. /*    associated function is invoked upon entry of the screen.
  25. /*
  26. /*    The return value of an action function determines what happens next.
  27. /*    An action function can signal an error condition, that the screen
  28. /*    needs to be redrawn, and whether the calling screen should terminate.
  29. /*
  30. /*    User input can be of various forms: single-character, string or
  31. /*    escape/enter.
  32. /*
  33. /*    In case of single-character input the selector fields should contain 
  34. /*    for each key the (upper case) key code,
  35. /*    a label that is displayed at the top of the screen, and a help
  36. /*    text that explains the key's function. 
  37. /*
  38. /*    In case of string input the associated function is called with the 
  39. /*    string input as argument. If that function returns an error status the
  40. /*    text in the help field is printed in the error window and the 
  41. /*    user is given another chance.
  42. /*
  43. /*    In case of escape/enter the interpreter invokes the action function when
  44. /*    the user presses enter, and does nothing when escape is pressed. 
  45. /* .nf
  46.  
  47. /* /* there is a Screen structure for each command for each screen */
  48.  
  49. typedef struct {
  50.     short key;            /* type of input */
  51.     char *name;            /* key label (for top window) */
  52.     int  (*action)();        /* action when command is selected */
  53.     char *help;            /* explanation (for H command) */
  54. } Screen;
  55.  
  56. /* /* action function return masks */
  57.  
  58. #define    S_BREAK        1    /* return immediately after action */
  59. #define    S_REDRAW    2    /* redraw screen */
  60. #define    S_ERROR        4    /* action failed */
  61.  
  62. /* /* input types: ordinary character keys are encoded as themselves */
  63.  
  64. #define    BS    '\010'
  65. #define    ENTER    '\015'
  66. #define    ESC    '\033'
  67. #define    DEL    '\177'
  68.  
  69. #define    ANY    256        /* press any key */
  70. #define    UP    257        /* up-arrow key */
  71. #define    DOWN    258        /* down-arrow key */
  72. #define    LEFT    259        /* left-arrow key */
  73. #define    RIGHT    260        /* right-arrow key */
  74. #define    PGUP    261        /* page-up */
  75. #define    PGDN    262        /* page-down */
  76. #define    STRING    263        /* string input, ESC to quit */
  77. #define    ESCCR    264        /* CR to confirm, ESC to quit */
  78.  
  79. #define    iskey(key)    (key > 0 && key < STRING)
  80.  
  81. /* /* system-dependent function-key labels */
  82.  
  83. #ifdef unix
  84. #   define PgUp    "F1"
  85. #   define PgDn "F2"
  86. #endif
  87.  
  88. #ifdef MSDOS
  89. #   define PgUp "PgUp"
  90. #   define PgDn "PgDn"
  91. #endif
  92.  
  93. /* /* often-used strings and messages */
  94.  
  95. extern char initscreen[];    /* Return to initial screen */
  96. extern char int_error[];    /* The program is confused */
  97. extern char pageup[];        /* Move screen one page upwards */
  98. extern char pagedn[];        /* Move screen one page downwards */
  99. extern char csrup[];        /* Move cursor upwards */
  100. extern char csrdn[];        /* Move cursor downwards */
  101. extern char getsummary[];    /* Press ESC to cancel.. */
  102. extern char printcurr[];    /* Print current message */
  103. extern char delcurr[];        /* Delete current message */
  104. extern char *m_msgread[];    /* Cannot read that message */
  105. /* SEE ALSO
  106. /*    screen(3)    screen table implementation
  107. /*    kbdinp(3)    screen table interpreter
  108. /* AUTHOR(S)
  109. /*    W.Z. Venema
  110. /*    Eindhoven University of Technology
  111. /*    Department of Mathematics and Computer Science
  112. /*    Den Dolech 2, P.O. Box 513, 5600 MB Eindhoven, The Netherlands
  113. /* CREATION DATE
  114. /*    Wed Apr  1 21:14:53 GMT+1:00 1987
  115. /* LAST MODIFICATION
  116. /*    Mon Apr  4 23:49:07 MET 1988
  117. /* VERSION/RELEASE
  118. /*    1.3
  119. /*--*/
  120.