CHANCONS.DEF 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. DEFINITION MODULE ChanConsts;
  2. (* Common types and values for device open requests and results *)
  3. (* Device modules may allow combinations of the following flags to be given
  4. when a channel is opened. An open procedure may not accept or honor all
  5. combinations. *)
  6. TYPE
  7. ChanFlags = (
  8. readFlag,
  9. (* input operations are requested/available *)
  10. writeFlag,
  11. (* output operations are requested/available *)
  12. oldFlag,
  13. (* a file may/must/did exist before the channel
  14. was opened *)
  15. textFlag,
  16. (* text operations are requested/available *)
  17. rawFlag,
  18. (* raw operations are requested/available *)
  19. interactiveFlag,
  20. (* interactive use is requested/available *)
  21. echoFlag
  22. (* echoing by interactive device on removal of
  23. characters from input stream requested/applies *)
  24. );
  25. FlagSet = SET OF ChanFlags;
  26. (* Singleton values of FlagSet, to allow for example, read+write. *)
  27. CONST
  28. read = FlagSet{readFlag};
  29. (* input operations are requested/available *)
  30. write = FlagSet{writeFlag};
  31. (* output operations are requested/available *)
  32. old = FlagSet{oldFlag};
  33. (* a file may/must/did exist before the channel
  34. was opened *)
  35. text = FlagSet{textFlag};
  36. (* text operations are requested/available *)
  37. raw = FlagSet{rawFlag};
  38. (* raw operations are requested/available *)
  39. interactive = FlagSet{interactiveFlag};
  40. (* interactive use is requested/available *)
  41. echo = FlagSet{echoFlag};
  42. (* echoing by interactive device on removal of
  43. characters from input stream requested/applies *)
  44. (* Possible results of open requests: *)
  45. TYPE
  46. OpenResults = (
  47. opened,
  48. (* the open succeeded as requested *)
  49. wrongNameFormat,
  50. (* given name is in the wrong format for the implementation *)
  51. wrongFlags,
  52. (* given flahs include a value that does not apply to the device *)
  53. tooManyOpen,
  54. (* this device cannot support any more open channels *)
  55. outOfChans,
  56. (* no more channels can be allocated *)
  57. wrongPermissions,
  58. (* file or directory permissions do not allow request *)
  59. noRoomOnDevice,
  60. (* storage limits on the device prevent the open *)
  61. noSuchFile,
  62. (* a needed file does not exist *)
  63. fileExists,
  64. (* a file of the given name already exists when a new one is
  65. required *)
  66. wrongFileType,
  67. (* the file is of the wrong type to support the required operations *)
  68. noTextOperations,
  69. (* text operations have been requested but are not supported *)
  70. noRawOperations,
  71. (* raw operations have been requested but are not supported *)
  72. noMixedOperations,
  73. (* text and binary operations have been requested but they are
  74. not supported in combination *)
  75. alreadyOpen,
  76. (* the source/destination is already open for operations not supported
  77. in combination with the requested operations *)
  78. otherProblem
  79. (* open failed for some other reason *)
  80. );
  81. END ChanConsts.