spc-obj.h 4.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * CDE - Common Desktop Environment
  3. *
  4. * Copyright (c) 1993-2012, The Open Group. All rights reserved.
  5. *
  6. * These libraries and programs are free software; you can
  7. * redistribute them and/or modify them under the terms of the GNU
  8. * Lesser General Public License as published by the Free Software
  9. * Foundation; either version 2 of the License, or (at your option)
  10. * any later version.
  11. *
  12. * These libraries and programs are distributed in the hope that
  13. * they will be useful, but WITHOUT ANY WARRANTY; without even the
  14. * implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
  15. * PURPOSE. See the GNU Lesser General Public License for more
  16. * details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public
  19. * License along with these libraries and programs; if not, write
  20. * to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
  21. * Floor, Boston, MA 02110-1301 USA
  22. */
  23. /*
  24. * File: spc-obj.h $XConsortium: spc-obj.h /main/3 1995/10/26 15:43:20 rswiston $
  25. * Language: C
  26. *
  27. * (c) Copyright 1989, Hewlett-Packard Company, all rights reserved.
  28. *
  29. * (c) Copyright 1993, 1994 Hewlett-Packard Company *
  30. * (c) Copyright 1993, 1994 International Business Machines Corp. *
  31. * (c) Copyright 1993, 1994 Sun Microsystems, Inc. *
  32. * (c) Copyright 1993, 1994 Novell, Inc. *
  33. */
  34. #ifndef _spc_obj_h
  35. #define _spc_obj_h
  36. typedef SPC_Channel_Ptr (*SPC_F_open)(SPC_Channel_Ptr, int, XeString);
  37. typedef int (*SPC_F_close)(SPC_Channel_Ptr);
  38. typedef int (*SPC_F_read)(SPC_Channel_Ptr, int, XeString, int);
  39. typedef int (*SPC_F_write)(SPC_Channel_Ptr, XeString, int);
  40. typedef int (*SPC_F_reset)(SPC_Channel_Ptr);
  41. typedef int (*SPC_F_exec_proc)(SPC_Channel_Ptr);
  42. typedef int (*SPC_F_signal)(SPC_Channel_Ptr, int);
  43. typedef int (*SPC_F_attach)(SPC_Channel_Ptr, int);
  44. typedef int (*SPC_F_add_input)(SPC_Channel_Ptr, SbInputHandlerProc, void *);
  45. typedef int (*SPC_F_wait_for_termination)(SPC_Channel_Ptr);
  46. typedef int (*SPC_F_pre_fork)(SPC_Channel_Ptr);
  47. typedef int (*SPC_F_post_fork)(SPC_Channel_Ptr, int);
  48. typedef int (*SPC_F_remove_logfile)(SPC_Channel_Ptr);
  49. /*
  50. **
  51. ** New methods for B.00
  52. **
  53. */
  54. typedef int (*SPC_F_send_eof)(SPC_Channel_Ptr);
  55. typedef int (*SPC_F_set_termio)(SPC_Channel_Ptr, int, int, struct termios *);
  56. #define channel_class_part \
  57. root_class_part \
  58. SPC_F_open open; /* opening a channel */ \
  59. SPC_F_close close; /* close a channel */ \
  60. SPC_F_read read; /* read from a channel */ \
  61. SPC_F_write write; /* write to a channel */ \
  62. SPC_F_reset reset; /* reset io to channel */ \
  63. SPC_F_exec_proc exec_proc; /* execute a subprocess over a channel */ \
  64. SPC_F_signal signal; /* signal a subprocess over a channel */ \
  65. SPC_F_attach attach; /* attach a subprocess to this channel */ \
  66. SPC_F_add_input add_input; /* how to add input callbacks to channel */ \
  67. SbInputCallbackProc input; \
  68. SPC_F_wait_for_termination wait_for_termination; /* wait for subprocess to exit */ \
  69. SPC_F_pre_fork pre_fork; /* setup before a fork */ \
  70. SPC_F_post_fork post_fork; /* setup after a fork */ \
  71. SPC_F_remove_logfile remove_logfile; /* remove log file associated with channel */ \
  72. SPC_F_send_eof send_eof; /* close stdin of subprocess */ \
  73. SPC_F_set_termio set_termio; /* set termio struct for PTY channels */
  74. typedef struct channel_class {
  75. root_clasp base;
  76. channel_class_part
  77. } *channel_clasp;
  78. typedef struct pty_channel_class {
  79. channel_clasp base;
  80. channel_class_part
  81. } *pty_channel_clasp;
  82. typedef struct pipe_channel_class {
  83. channel_clasp base;
  84. channel_class_part
  85. } *pipe_channel_clasp;
  86. typedef struct noio_channel_class {
  87. channel_clasp base;
  88. channel_class_part
  89. } *noio_channel_clasp;
  90. typedef struct remote_channel_class {
  91. channel_clasp base;
  92. channel_class_part
  93. } *remote_channel_clasp;
  94. #define call_parent_method(channel, func, args, result) { \
  95. pipe_channel_clasp parent_class=(pipe_channel_clasp) (channel)->class_ptr; \
  96. result=base_memf(parent_class, func, args); }
  97. /* class definitions */
  98. extern channel_clasp channel_class;
  99. extern pty_channel_clasp pty_channel_class;
  100. extern pipe_channel_clasp pipe_channel_class;
  101. extern noio_channel_clasp noio_channel_class;
  102. extern remote_channel_clasp remote_channel_class;
  103. #endif /* _spc_obj_h */