root/ext/termios/termiolib.c

/* [<][>][^][v][top][bottom][index][help] */

DEFINITIONS

This source file includes following definitions.
  1. termiolib_sys_tcgetattr
  2. termiolib_sys_tcsetattr
  3. termiolib_sys_tcsendbreak
  4. termiolib_sys_tcdrain
  5. termiolib_sys_tcflush
  6. termiolib_sys_tcflow
  7. termiolib_sys_tcgetpgrp
  8. termiolib_sys_tcsetpgrp
  9. termiolib_sys_cfgetispeed
  10. termiolib_sys_cfsetispeed
  11. termiolib_sys_cfgetospeed
  12. termiolib_sys_cfsetospeed
  13. termiolib_sys_openpty
  14. termiolib_sys_forkpty
  15. Scm_Init_termiolib

   1 /* Generated by genstub.  Do not edit. */
   2 #include <gauche.h>
   3 #if defined(__CYGWIN__) || defined(__MINGW32__)
   4 #define SCM_CGEN_CONST /*empty*/
   5 #else
   6 #define SCM_CGEN_CONST const
   7 #endif
   8 #include "gauche/termios.h"
   9 #if !defined(__MINGW32__)
  10 static SCM_DEFINE_STRING_CONST(termiolib_TCSANOW__VAR__NAME, "TCSANOW", 7, 7);
  11 static ScmObj termiolib_TCSANOW__VAR = SCM_UNBOUND;
  12 #endif /*!defined(__MINGW32__)*/
  13 #if !defined(__MINGW32__)
  14 static SCM_DEFINE_STRING_CONST(termiolib_TCSADRAIN__VAR__NAME, "TCSADRAIN", 9, 9);
  15 static ScmObj termiolib_TCSADRAIN__VAR = SCM_UNBOUND;
  16 #endif /*!defined(__MINGW32__)*/
  17 #if !defined(__MINGW32__)
  18 static SCM_DEFINE_STRING_CONST(termiolib_TCSAFLUSH__VAR__NAME, "TCSAFLUSH", 9, 9);
  19 static ScmObj termiolib_TCSAFLUSH__VAR = SCM_UNBOUND;
  20 #endif /*!defined(__MINGW32__)*/
  21 #if !defined(__MINGW32__)
  22 static SCM_DEFINE_STRING_CONST(termiolib_TCIFLUSH__VAR__NAME, "TCIFLUSH", 8, 8);
  23 static ScmObj termiolib_TCIFLUSH__VAR = SCM_UNBOUND;
  24 #endif /*!defined(__MINGW32__)*/
  25 #if !defined(__MINGW32__)
  26 static SCM_DEFINE_STRING_CONST(termiolib_TCOFLUSH__VAR__NAME, "TCOFLUSH", 8, 8);
  27 static ScmObj termiolib_TCOFLUSH__VAR = SCM_UNBOUND;
  28 #endif /*!defined(__MINGW32__)*/
  29 #if !defined(__MINGW32__)
  30 static SCM_DEFINE_STRING_CONST(termiolib_TCIOFLUSH__VAR__NAME, "TCIOFLUSH", 9, 9);
  31 static ScmObj termiolib_TCIOFLUSH__VAR = SCM_UNBOUND;
  32 #endif /*!defined(__MINGW32__)*/
  33 #if !defined(__MINGW32__)
  34 static SCM_DEFINE_STRING_CONST(termiolib_TCOOFF__VAR__NAME, "TCOOFF", 6, 6);
  35 static ScmObj termiolib_TCOOFF__VAR = SCM_UNBOUND;
  36 #endif /*!defined(__MINGW32__)*/
  37 #if !defined(__MINGW32__)
  38 static SCM_DEFINE_STRING_CONST(termiolib_TCOON__VAR__NAME, "TCOON", 5, 5);
  39 static ScmObj termiolib_TCOON__VAR = SCM_UNBOUND;
  40 #endif /*!defined(__MINGW32__)*/
  41 #if !defined(__MINGW32__)
  42 static SCM_DEFINE_STRING_CONST(termiolib_TCIOFF__VAR__NAME, "TCIOFF", 6, 6);
  43 static ScmObj termiolib_TCIOFF__VAR = SCM_UNBOUND;
  44 #endif /*!defined(__MINGW32__)*/
  45 #if !defined(__MINGW32__)
  46 static SCM_DEFINE_STRING_CONST(termiolib_TCION__VAR__NAME, "TCION", 5, 5);
  47 static ScmObj termiolib_TCION__VAR = SCM_UNBOUND;
  48 #endif /*!defined(__MINGW32__)*/
  49 #if !defined(__MINGW32__)
  50 static SCM_DEFINE_STRING_CONST(termiolib_B0__VAR__NAME, "B0", 2, 2);
  51 static ScmObj termiolib_B0__VAR = SCM_UNBOUND;
  52 #endif /*!defined(__MINGW32__)*/
  53 #if !defined(__MINGW32__)
  54 static SCM_DEFINE_STRING_CONST(termiolib_B50__VAR__NAME, "B50", 3, 3);
  55 static ScmObj termiolib_B50__VAR = SCM_UNBOUND;
  56 #endif /*!defined(__MINGW32__)*/
  57 #if !defined(__MINGW32__)
  58 static SCM_DEFINE_STRING_CONST(termiolib_B75__VAR__NAME, "B75", 3, 3);
  59 static ScmObj termiolib_B75__VAR = SCM_UNBOUND;
  60 #endif /*!defined(__MINGW32__)*/
  61 #if !defined(__MINGW32__)
  62 static SCM_DEFINE_STRING_CONST(termiolib_B110__VAR__NAME, "B110", 4, 4);
  63 static ScmObj termiolib_B110__VAR = SCM_UNBOUND;
  64 #endif /*!defined(__MINGW32__)*/
  65 #if !defined(__MINGW32__)
  66 static SCM_DEFINE_STRING_CONST(termiolib_B134__VAR__NAME, "B134", 4, 4);
  67 static ScmObj termiolib_B134__VAR = SCM_UNBOUND;
  68 #endif /*!defined(__MINGW32__)*/
  69 #if !defined(__MINGW32__)
  70 static SCM_DEFINE_STRING_CONST(termiolib_B150__VAR__NAME, "B150", 4, 4);
  71 static ScmObj termiolib_B150__VAR = SCM_UNBOUND;
  72 #endif /*!defined(__MINGW32__)*/
  73 #if !defined(__MINGW32__)
  74 static SCM_DEFINE_STRING_CONST(termiolib_B200__VAR__NAME, "B200", 4, 4);
  75 static ScmObj termiolib_B200__VAR = SCM_UNBOUND;
  76 #endif /*!defined(__MINGW32__)*/
  77 #if !defined(__MINGW32__)
  78 static SCM_DEFINE_STRING_CONST(termiolib_B300__VAR__NAME, "B300", 4, 4);
  79 static ScmObj termiolib_B300__VAR = SCM_UNBOUND;
  80 #endif /*!defined(__MINGW32__)*/
  81 #if !defined(__MINGW32__)
  82 static SCM_DEFINE_STRING_CONST(termiolib_B600__VAR__NAME, "B600", 4, 4);
  83 static ScmObj termiolib_B600__VAR = SCM_UNBOUND;
  84 #endif /*!defined(__MINGW32__)*/
  85 #if !defined(__MINGW32__)
  86 static SCM_DEFINE_STRING_CONST(termiolib_B1200__VAR__NAME, "B1200", 5, 5);
  87 static ScmObj termiolib_B1200__VAR = SCM_UNBOUND;
  88 #endif /*!defined(__MINGW32__)*/
  89 #if !defined(__MINGW32__)
  90 static SCM_DEFINE_STRING_CONST(termiolib_B1800__VAR__NAME, "B1800", 5, 5);
  91 static ScmObj termiolib_B1800__VAR = SCM_UNBOUND;
  92 #endif /*!defined(__MINGW32__)*/
  93 #if !defined(__MINGW32__)
  94 static SCM_DEFINE_STRING_CONST(termiolib_B2400__VAR__NAME, "B2400", 5, 5);
  95 static ScmObj termiolib_B2400__VAR = SCM_UNBOUND;
  96 #endif /*!defined(__MINGW32__)*/
  97 #if !defined(__MINGW32__)
  98 static SCM_DEFINE_STRING_CONST(termiolib_B4800__VAR__NAME, "B4800", 5, 5);
  99 static ScmObj termiolib_B4800__VAR = SCM_UNBOUND;
 100 #endif /*!defined(__MINGW32__)*/
 101 #if !defined(__MINGW32__)
 102 static SCM_DEFINE_STRING_CONST(termiolib_B9600__VAR__NAME, "B9600", 5, 5);
 103 static ScmObj termiolib_B9600__VAR = SCM_UNBOUND;
 104 #endif /*!defined(__MINGW32__)*/
 105 #if !defined(__MINGW32__)
 106 static SCM_DEFINE_STRING_CONST(termiolib_B19200__VAR__NAME, "B19200", 6, 6);
 107 static ScmObj termiolib_B19200__VAR = SCM_UNBOUND;
 108 #endif /*!defined(__MINGW32__)*/
 109 #if !defined(__MINGW32__)
 110 static SCM_DEFINE_STRING_CONST(termiolib_B38400__VAR__NAME, "B38400", 6, 6);
 111 static ScmObj termiolib_B38400__VAR = SCM_UNBOUND;
 112 #endif /*!defined(__MINGW32__)*/
 113 #if !defined(__MINGW32__)
 114 static ScmObj termiolib_sys_tcgetattr(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 115 {
 116   ScmObj port_or_fd_scm;
 117   ScmObj port_or_fd;
 118   SCM_ENTER_SUBR("sys-tcgetattr");
 119   port_or_fd_scm = SCM_ARGREF(0);
 120   port_or_fd = (port_or_fd_scm);
 121   {
 122   int fd = Scm_GetPortFd(port_or_fd, TRUE);
 123   ScmSysTermios *term = SCM_SYS_TERMIOS(Scm_MakeSysTermios());
 124   if (tcgetattr(fd, &term->term) < 0) {
 125     Scm_SysError("tcgetattr failed");
 126   }
 127   SCM_RETURN(SCM_OBJ(term));
 128   }
 129 }
 130 
 131 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcgetattr__NAME, "sys-tcgetattr", 13, 13);
 132 static SCM_DEFINE_SUBR(termiolib_sys_tcgetattr__STUB, 1, 0, SCM_OBJ(&termiolib_sys_tcgetattr__NAME), termiolib_sys_tcgetattr, NULL, NULL);
 133 
 134 #endif /*!defined(__MINGW32__)*/
 135 #if !defined(__MINGW32__)
 136 static ScmObj termiolib_sys_tcsetattr(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 137 {
 138   ScmObj port_or_fd_scm;
 139   ScmObj port_or_fd;
 140   ScmObj option_scm;
 141   int option;
 142   ScmObj term_scm;
 143   ScmSysTermios* term;
 144   SCM_ENTER_SUBR("sys-tcsetattr");
 145   port_or_fd_scm = SCM_ARGREF(0);
 146   port_or_fd = (port_or_fd_scm);
 147   option_scm = SCM_ARGREF(1);
 148   if (!SCM_INTP(option_scm)) Scm_Error("small integer required, but got %S", option_scm);
 149   option = SCM_INT_VALUE(option_scm);
 150   term_scm = SCM_ARGREF(2);
 151   if (!SCM_SYS_TERMIOS_P(term_scm)) Scm_Error("<sys-termios> required, but got %S", term_scm);
 152   term = SCM_SYS_TERMIOS(term_scm);
 153   {
 154 int fd = Scm_GetPortFd(port_or_fd, TRUE);
 155 if (tcsetattr(fd, option, &term->term) < 0) {
 156   Scm_SysError("tcsetattr failed");
 157 }
 158 SCM_RETURN(SCM_UNDEFINED);
 159   }
 160 }
 161 
 162 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcsetattr__NAME, "sys-tcsetattr", 13, 13);
 163 static SCM_DEFINE_SUBR(termiolib_sys_tcsetattr__STUB, 3, 0, SCM_OBJ(&termiolib_sys_tcsetattr__NAME), termiolib_sys_tcsetattr, NULL, NULL);
 164 
 165 #endif /*!defined(__MINGW32__)*/
 166 #if !defined(__MINGW32__)
 167 static ScmObj termiolib_sys_tcsendbreak(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 168 {
 169   ScmObj port_or_fd_scm;
 170   ScmObj port_or_fd;
 171   ScmObj duration_scm;
 172   int duration;
 173   SCM_ENTER_SUBR("sys-tcsendbreak");
 174   port_or_fd_scm = SCM_ARGREF(0);
 175   port_or_fd = (port_or_fd_scm);
 176   duration_scm = SCM_ARGREF(1);
 177   if (!SCM_INTP(duration_scm)) Scm_Error("small integer required, but got %S", duration_scm);
 178   duration = SCM_INT_VALUE(duration_scm);
 179   {
 180   int fd = Scm_GetPortFd(port_or_fd, TRUE);
 181   SCM_RETURN(tcsendbreak(fd, duration) < 0 ? SCM_FALSE : SCM_TRUE);
 182   }
 183 }
 184 
 185 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcsendbreak__NAME, "sys-tcsendbreak", 15, 15);
 186 static SCM_DEFINE_SUBR(termiolib_sys_tcsendbreak__STUB, 2, 0, SCM_OBJ(&termiolib_sys_tcsendbreak__NAME), termiolib_sys_tcsendbreak, NULL, NULL);
 187 
 188 #endif /*!defined(__MINGW32__)*/
 189 #if !defined(__MINGW32__)
 190 static ScmObj termiolib_sys_tcdrain(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 191 {
 192   ScmObj port_or_fd_scm;
 193   ScmObj port_or_fd;
 194   SCM_ENTER_SUBR("sys-tcdrain");
 195   port_or_fd_scm = SCM_ARGREF(0);
 196   port_or_fd = (port_or_fd_scm);
 197   {
 198 int fd = Scm_GetPortFd(port_or_fd, TRUE);
 199 if (tcdrain(fd) < 0) Scm_SysError("tcdrain failed");
 200 SCM_RETURN(SCM_UNDEFINED);
 201   }
 202 }
 203 
 204 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcdrain__NAME, "sys-tcdrain", 11, 11);
 205 static SCM_DEFINE_SUBR(termiolib_sys_tcdrain__STUB, 1, 0, SCM_OBJ(&termiolib_sys_tcdrain__NAME), termiolib_sys_tcdrain, NULL, NULL);
 206 
 207 #endif /*!defined(__MINGW32__)*/
 208 #if !defined(__MINGW32__)
 209 static ScmObj termiolib_sys_tcflush(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 210 {
 211   ScmObj port_or_fd_scm;
 212   ScmObj port_or_fd;
 213   ScmObj queue_scm;
 214   int queue;
 215   SCM_ENTER_SUBR("sys-tcflush");
 216   port_or_fd_scm = SCM_ARGREF(0);
 217   port_or_fd = (port_or_fd_scm);
 218   queue_scm = SCM_ARGREF(1);
 219   if (!SCM_EXACTP(queue_scm)) Scm_Error("C integer required, but got %S", queue_scm);
 220   queue = Scm_GetInteger(queue_scm);
 221   {
 222 int fd = Scm_GetPortFd(port_or_fd, TRUE);
 223 if (tcflush(fd, queue) < 0) Scm_SysError("tcflush failed");
 224 SCM_RETURN(SCM_UNDEFINED);
 225   }
 226 }
 227 
 228 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcflush__NAME, "sys-tcflush", 11, 11);
 229 static SCM_DEFINE_SUBR(termiolib_sys_tcflush__STUB, 2, 0, SCM_OBJ(&termiolib_sys_tcflush__NAME), termiolib_sys_tcflush, NULL, NULL);
 230 
 231 #endif /*!defined(__MINGW32__)*/
 232 #if !defined(__MINGW32__)
 233 static ScmObj termiolib_sys_tcflow(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 234 {
 235   ScmObj port_or_fd_scm;
 236   ScmObj port_or_fd;
 237   ScmObj action_scm;
 238   int action;
 239   SCM_ENTER_SUBR("sys-tcflow");
 240   port_or_fd_scm = SCM_ARGREF(0);
 241   port_or_fd = (port_or_fd_scm);
 242   action_scm = SCM_ARGREF(1);
 243   if (!SCM_EXACTP(action_scm)) Scm_Error("C integer required, but got %S", action_scm);
 244   action = Scm_GetInteger(action_scm);
 245   {
 246 int fd = Scm_GetPortFd(port_or_fd, TRUE);
 247 if (tcflow(fd, action) < 0) Scm_SysError("tcflow failed");
 248 SCM_RETURN(SCM_UNDEFINED);
 249   }
 250 }
 251 
 252 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcflow__NAME, "sys-tcflow", 10, 10);
 253 static SCM_DEFINE_SUBR(termiolib_sys_tcflow__STUB, 2, 0, SCM_OBJ(&termiolib_sys_tcflow__NAME), termiolib_sys_tcflow, NULL, NULL);
 254 
 255 #endif /*!defined(__MINGW32__)*/
 256 #if !defined(__MINGW32__)
 257 static ScmObj termiolib_sys_tcgetpgrp(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 258 {
 259   ScmObj port_or_fd_scm;
 260   ScmObj port_or_fd;
 261   SCM_ENTER_SUBR("sys-tcgetpgrp");
 262   port_or_fd_scm = SCM_ARGREF(0);
 263   port_or_fd = (port_or_fd_scm);
 264   {
 265   int fd = Scm_GetPortFd(port_or_fd, TRUE);
 266   pid_t r = tcgetpgrp(fd);
 267   if (r < 0) { Scm_SysError("tcgetpgrp failed"); }
 268   SCM_RETURN(Scm_MakeInteger(r));
 269   }
 270 }
 271 
 272 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcgetpgrp__NAME, "sys-tcgetpgrp", 13, 13);
 273 static SCM_DEFINE_SUBR(termiolib_sys_tcgetpgrp__STUB, 1, 0, SCM_OBJ(&termiolib_sys_tcgetpgrp__NAME), termiolib_sys_tcgetpgrp, NULL, NULL);
 274 
 275 #endif /*!defined(__MINGW32__)*/
 276 #if !defined(__MINGW32__)
 277 static ScmObj termiolib_sys_tcsetpgrp(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 278 {
 279   ScmObj port_or_fd_scm;
 280   ScmObj port_or_fd;
 281   ScmObj pgrp_scm;
 282   int pgrp;
 283   SCM_ENTER_SUBR("sys-tcsetpgrp");
 284   port_or_fd_scm = SCM_ARGREF(0);
 285   port_or_fd = (port_or_fd_scm);
 286   pgrp_scm = SCM_ARGREF(1);
 287   if (!SCM_EXACTP(pgrp_scm)) Scm_Error("C integer required, but got %S", pgrp_scm);
 288   pgrp = Scm_GetInteger(pgrp_scm);
 289   {
 290 int fd = Scm_GetPortFd(port_or_fd, TRUE);
 291 if (tcsetpgrp(fd, pgrp) < 0) Scm_SysError("tcsetpgrp failed");
 292 SCM_RETURN(SCM_UNDEFINED);
 293   }
 294 }
 295 
 296 static SCM_DEFINE_STRING_CONST(termiolib_sys_tcsetpgrp__NAME, "sys-tcsetpgrp", 13, 13);
 297 static SCM_DEFINE_SUBR(termiolib_sys_tcsetpgrp__STUB, 2, 0, SCM_OBJ(&termiolib_sys_tcsetpgrp__NAME), termiolib_sys_tcsetpgrp, NULL, NULL);
 298 
 299 #endif /*!defined(__MINGW32__)*/
 300 #if !defined(__MINGW32__)
 301 static ScmObj termiolib_sys_cfgetispeed(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 302 {
 303   ScmObj term_scm;
 304   ScmSysTermios* term;
 305   SCM_ENTER_SUBR("sys-cfgetispeed");
 306   term_scm = SCM_ARGREF(0);
 307   if (!SCM_SYS_TERMIOS_P(term_scm)) Scm_Error("<sys-termios> required, but got %S", term_scm);
 308   term = SCM_SYS_TERMIOS(term_scm);
 309   {
 310   speed_t s;
 311   s = cfgetispeed(&term->term);
 312   SCM_RETURN(Scm_MakeInteger(s));
 313   }
 314 }
 315 
 316 static SCM_DEFINE_STRING_CONST(termiolib_sys_cfgetispeed__NAME, "sys-cfgetispeed", 15, 15);
 317 static SCM_DEFINE_SUBR(termiolib_sys_cfgetispeed__STUB, 1, 0, SCM_OBJ(&termiolib_sys_cfgetispeed__NAME), termiolib_sys_cfgetispeed, NULL, NULL);
 318 
 319 #endif /*!defined(__MINGW32__)*/
 320 #if !defined(__MINGW32__)
 321 static ScmObj termiolib_sys_cfsetispeed(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 322 {
 323   ScmObj term_scm;
 324   ScmSysTermios* term;
 325   ScmObj speed_scm;
 326   int speed;
 327   SCM_ENTER_SUBR("sys-cfsetispeed");
 328   term_scm = SCM_ARGREF(0);
 329   if (!SCM_SYS_TERMIOS_P(term_scm)) Scm_Error("<sys-termios> required, but got %S", term_scm);
 330   term = SCM_SYS_TERMIOS(term_scm);
 331   speed_scm = SCM_ARGREF(1);
 332   if (!SCM_EXACTP(speed_scm)) Scm_Error("C integer required, but got %S", speed_scm);
 333   speed = Scm_GetInteger(speed_scm);
 334   {
 335 if (cfsetispeed(&term->term, speed) < 0) Scm_SysError("cfsetispeed");
 336 SCM_RETURN(SCM_UNDEFINED);
 337   }
 338 }
 339 
 340 static SCM_DEFINE_STRING_CONST(termiolib_sys_cfsetispeed__NAME, "sys-cfsetispeed", 15, 15);
 341 static SCM_DEFINE_SUBR(termiolib_sys_cfsetispeed__STUB, 2, 0, SCM_OBJ(&termiolib_sys_cfsetispeed__NAME), termiolib_sys_cfsetispeed, NULL, NULL);
 342 
 343 #endif /*!defined(__MINGW32__)*/
 344 #if !defined(__MINGW32__)
 345 static ScmObj termiolib_sys_cfgetospeed(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 346 {
 347   ScmObj term_scm;
 348   ScmSysTermios* term;
 349   SCM_ENTER_SUBR("sys-cfgetospeed");
 350   term_scm = SCM_ARGREF(0);
 351   if (!SCM_SYS_TERMIOS_P(term_scm)) Scm_Error("<sys-termios> required, but got %S", term_scm);
 352   term = SCM_SYS_TERMIOS(term_scm);
 353   {
 354   speed_t s;
 355   s = cfgetospeed(&term->term);
 356   SCM_RETURN(Scm_MakeInteger(s));
 357   }
 358 }
 359 
 360 static SCM_DEFINE_STRING_CONST(termiolib_sys_cfgetospeed__NAME, "sys-cfgetospeed", 15, 15);
 361 static SCM_DEFINE_SUBR(termiolib_sys_cfgetospeed__STUB, 1, 0, SCM_OBJ(&termiolib_sys_cfgetospeed__NAME), termiolib_sys_cfgetospeed, NULL, NULL);
 362 
 363 #endif /*!defined(__MINGW32__)*/
 364 #if !defined(__MINGW32__)
 365 static ScmObj termiolib_sys_cfsetospeed(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 366 {
 367   ScmObj term_scm;
 368   ScmSysTermios* term;
 369   ScmObj speed_scm;
 370   int speed;
 371   SCM_ENTER_SUBR("sys-cfsetospeed");
 372   term_scm = SCM_ARGREF(0);
 373   if (!SCM_SYS_TERMIOS_P(term_scm)) Scm_Error("<sys-termios> required, but got %S", term_scm);
 374   term = SCM_SYS_TERMIOS(term_scm);
 375   speed_scm = SCM_ARGREF(1);
 376   if (!SCM_EXACTP(speed_scm)) Scm_Error("C integer required, but got %S", speed_scm);
 377   speed = Scm_GetInteger(speed_scm);
 378   {
 379 if (cfsetospeed(&term->term, speed) < 0) Scm_SysError("cfsetispeed");
 380 SCM_RETURN(SCM_UNDEFINED);
 381   }
 382 }
 383 
 384 static SCM_DEFINE_STRING_CONST(termiolib_sys_cfsetospeed__NAME, "sys-cfsetospeed", 15, 15);
 385 static SCM_DEFINE_SUBR(termiolib_sys_cfsetospeed__STUB, 2, 0, SCM_OBJ(&termiolib_sys_cfsetospeed__NAME), termiolib_sys_cfsetospeed, NULL, NULL);
 386 
 387 #endif /*!defined(__MINGW32__)*/
 388 #if defined(HAVE_OPENPTY)
 389 static ScmObj termiolib_sys_openpty(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 390 {
 391   ScmObj term_scm;
 392   ScmObj term;
 393   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 394   SCM_ENTER_SUBR("sys-openpty");
 395   if (Scm_Length(SCM_OPTARGS) > 1)
 396     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 397   if (SCM_NULLP(SCM_OPTARGS)) term_scm = SCM_UNBOUND;
 398   else {
 399     term_scm = SCM_CAR(SCM_OPTARGS);
 400     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 401   }
 402   term = (term_scm);
 403   {
 404 {
 405 ScmObj SCM_RESULT;
 406 SCM_RESULT = Scm_Openpty(term);
 407 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 408 }
 409   }
 410 }
 411 
 412 static SCM_DEFINE_STRING_CONST(termiolib_sys_openpty__NAME, "sys-openpty", 11, 11);
 413 static SCM_DEFINE_SUBR(termiolib_sys_openpty__STUB, 0, 1, SCM_OBJ(&termiolib_sys_openpty__NAME), termiolib_sys_openpty, NULL, NULL);
 414 
 415 #endif /*defined(HAVE_OPENPTY)*/
 416 #if defined(HAVE_FORKPTY)
 417 static ScmObj termiolib_sys_forkpty(ScmObj *SCM_FP, int SCM_ARGCNT, void *data_)
 418 {
 419   ScmObj term_scm;
 420   ScmObj term;
 421   ScmObj SCM_OPTARGS = SCM_ARGREF(SCM_ARGCNT-1);
 422   SCM_ENTER_SUBR("sys-forkpty");
 423   if (Scm_Length(SCM_OPTARGS) > 1)
 424     Scm_Error("too many arguments: up to 1 is expected, %d given.", Scm_Length(SCM_OPTARGS));
 425   if (SCM_NULLP(SCM_OPTARGS)) term_scm = SCM_UNBOUND;
 426   else {
 427     term_scm = SCM_CAR(SCM_OPTARGS);
 428     SCM_OPTARGS = SCM_CDR(SCM_OPTARGS);
 429   }
 430   term = (term_scm);
 431   {
 432 {
 433 ScmObj SCM_RESULT;
 434 SCM_RESULT = Scm_Forkpty(term);
 435 SCM_RETURN(SCM_OBJ_SAFE(SCM_RESULT));
 436 }
 437   }
 438 }
 439 
 440 static SCM_DEFINE_STRING_CONST(termiolib_sys_forkpty__NAME, "sys-forkpty", 11, 11);
 441 static SCM_DEFINE_SUBR(termiolib_sys_forkpty__STUB, 0, 1, SCM_OBJ(&termiolib_sys_forkpty__NAME), termiolib_sys_forkpty, NULL, NULL);
 442 
 443 #endif /*defined(HAVE_FORKPTY)*/
 444 void Scm_Init_termiolib(ScmModule *module)
 445 {
 446 
 447 #if defined(HAVE_FORKPTY)
 448   SCM_DEFINE(module, "sys-forkpty", SCM_OBJ(&termiolib_sys_forkpty__STUB));
 449 #endif /* defined(HAVE_FORKPTY) */
 450 #if defined(HAVE_OPENPTY)
 451   SCM_DEFINE(module, "sys-openpty", SCM_OBJ(&termiolib_sys_openpty__STUB));
 452 #endif /* defined(HAVE_OPENPTY) */
 453 #if !defined(__MINGW32__)
 454   SCM_DEFINE(module, "sys-cfsetospeed", SCM_OBJ(&termiolib_sys_cfsetospeed__STUB));
 455 #endif /* !defined(__MINGW32__) */
 456 #if !defined(__MINGW32__)
 457   SCM_DEFINE(module, "sys-cfgetospeed", SCM_OBJ(&termiolib_sys_cfgetospeed__STUB));
 458 #endif /* !defined(__MINGW32__) */
 459 #if !defined(__MINGW32__)
 460   SCM_DEFINE(module, "sys-cfsetispeed", SCM_OBJ(&termiolib_sys_cfsetispeed__STUB));
 461 #endif /* !defined(__MINGW32__) */
 462 #if !defined(__MINGW32__)
 463   SCM_DEFINE(module, "sys-cfgetispeed", SCM_OBJ(&termiolib_sys_cfgetispeed__STUB));
 464 #endif /* !defined(__MINGW32__) */
 465 #if !defined(__MINGW32__)
 466   SCM_DEFINE(module, "sys-tcsetpgrp", SCM_OBJ(&termiolib_sys_tcsetpgrp__STUB));
 467 #endif /* !defined(__MINGW32__) */
 468 #if !defined(__MINGW32__)
 469   SCM_DEFINE(module, "sys-tcgetpgrp", SCM_OBJ(&termiolib_sys_tcgetpgrp__STUB));
 470 #endif /* !defined(__MINGW32__) */
 471 #if !defined(__MINGW32__)
 472   SCM_DEFINE(module, "sys-tcflow", SCM_OBJ(&termiolib_sys_tcflow__STUB));
 473 #endif /* !defined(__MINGW32__) */
 474 #if !defined(__MINGW32__)
 475   SCM_DEFINE(module, "sys-tcflush", SCM_OBJ(&termiolib_sys_tcflush__STUB));
 476 #endif /* !defined(__MINGW32__) */
 477 #if !defined(__MINGW32__)
 478   SCM_DEFINE(module, "sys-tcdrain", SCM_OBJ(&termiolib_sys_tcdrain__STUB));
 479 #endif /* !defined(__MINGW32__) */
 480 #if !defined(__MINGW32__)
 481   SCM_DEFINE(module, "sys-tcsendbreak", SCM_OBJ(&termiolib_sys_tcsendbreak__STUB));
 482 #endif /* !defined(__MINGW32__) */
 483 #if !defined(__MINGW32__)
 484   SCM_DEFINE(module, "sys-tcsetattr", SCM_OBJ(&termiolib_sys_tcsetattr__STUB));
 485 #endif /* !defined(__MINGW32__) */
 486 #if !defined(__MINGW32__)
 487   SCM_DEFINE(module, "sys-tcgetattr", SCM_OBJ(&termiolib_sys_tcgetattr__STUB));
 488 #endif /* !defined(__MINGW32__) */
 489 #if !defined(__MINGW32__)
 490   termiolib_B38400__VAR = Scm_Intern(&termiolib_B38400__VAR__NAME);
 491   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B38400__VAR)), SCM_OBJ(Scm_MakeInteger(B38400)));
 492 #endif /* !defined(__MINGW32__) */
 493 #if !defined(__MINGW32__)
 494   termiolib_B19200__VAR = Scm_Intern(&termiolib_B19200__VAR__NAME);
 495   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B19200__VAR)), SCM_OBJ(Scm_MakeInteger(B19200)));
 496 #endif /* !defined(__MINGW32__) */
 497 #if !defined(__MINGW32__)
 498   termiolib_B9600__VAR = Scm_Intern(&termiolib_B9600__VAR__NAME);
 499   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B9600__VAR)), SCM_OBJ(Scm_MakeInteger(B9600)));
 500 #endif /* !defined(__MINGW32__) */
 501 #if !defined(__MINGW32__)
 502   termiolib_B4800__VAR = Scm_Intern(&termiolib_B4800__VAR__NAME);
 503   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B4800__VAR)), SCM_OBJ(Scm_MakeInteger(B4800)));
 504 #endif /* !defined(__MINGW32__) */
 505 #if !defined(__MINGW32__)
 506   termiolib_B2400__VAR = Scm_Intern(&termiolib_B2400__VAR__NAME);
 507   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B2400__VAR)), SCM_OBJ(Scm_MakeInteger(B2400)));
 508 #endif /* !defined(__MINGW32__) */
 509 #if !defined(__MINGW32__)
 510   termiolib_B1800__VAR = Scm_Intern(&termiolib_B1800__VAR__NAME);
 511   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B1800__VAR)), SCM_OBJ(Scm_MakeInteger(B1800)));
 512 #endif /* !defined(__MINGW32__) */
 513 #if !defined(__MINGW32__)
 514   termiolib_B1200__VAR = Scm_Intern(&termiolib_B1200__VAR__NAME);
 515   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B1200__VAR)), SCM_OBJ(Scm_MakeInteger(B1200)));
 516 #endif /* !defined(__MINGW32__) */
 517 #if !defined(__MINGW32__)
 518   termiolib_B600__VAR = Scm_Intern(&termiolib_B600__VAR__NAME);
 519   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B600__VAR)), SCM_OBJ(Scm_MakeInteger(B600)));
 520 #endif /* !defined(__MINGW32__) */
 521 #if !defined(__MINGW32__)
 522   termiolib_B300__VAR = Scm_Intern(&termiolib_B300__VAR__NAME);
 523   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B300__VAR)), SCM_OBJ(Scm_MakeInteger(B300)));
 524 #endif /* !defined(__MINGW32__) */
 525 #if !defined(__MINGW32__)
 526   termiolib_B200__VAR = Scm_Intern(&termiolib_B200__VAR__NAME);
 527   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B200__VAR)), SCM_OBJ(Scm_MakeInteger(B200)));
 528 #endif /* !defined(__MINGW32__) */
 529 #if !defined(__MINGW32__)
 530   termiolib_B150__VAR = Scm_Intern(&termiolib_B150__VAR__NAME);
 531   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B150__VAR)), SCM_OBJ(Scm_MakeInteger(B150)));
 532 #endif /* !defined(__MINGW32__) */
 533 #if !defined(__MINGW32__)
 534   termiolib_B134__VAR = Scm_Intern(&termiolib_B134__VAR__NAME);
 535   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B134__VAR)), SCM_OBJ(Scm_MakeInteger(B134)));
 536 #endif /* !defined(__MINGW32__) */
 537 #if !defined(__MINGW32__)
 538   termiolib_B110__VAR = Scm_Intern(&termiolib_B110__VAR__NAME);
 539   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B110__VAR)), SCM_OBJ(Scm_MakeInteger(B110)));
 540 #endif /* !defined(__MINGW32__) */
 541 #if !defined(__MINGW32__)
 542   termiolib_B75__VAR = Scm_Intern(&termiolib_B75__VAR__NAME);
 543   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B75__VAR)), SCM_OBJ(Scm_MakeInteger(B75)));
 544 #endif /* !defined(__MINGW32__) */
 545 #if !defined(__MINGW32__)
 546   termiolib_B50__VAR = Scm_Intern(&termiolib_B50__VAR__NAME);
 547   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B50__VAR)), SCM_OBJ(Scm_MakeInteger(B50)));
 548 #endif /* !defined(__MINGW32__) */
 549 #if !defined(__MINGW32__)
 550   termiolib_B0__VAR = Scm_Intern(&termiolib_B0__VAR__NAME);
 551   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_B0__VAR)), SCM_OBJ(Scm_MakeInteger(B0)));
 552 #endif /* !defined(__MINGW32__) */
 553 #if !defined(__MINGW32__)
 554   termiolib_TCION__VAR = Scm_Intern(&termiolib_TCION__VAR__NAME);
 555   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCION__VAR)), SCM_OBJ(Scm_MakeInteger(TCION)));
 556 #endif /* !defined(__MINGW32__) */
 557 #if !defined(__MINGW32__)
 558   termiolib_TCIOFF__VAR = Scm_Intern(&termiolib_TCIOFF__VAR__NAME);
 559   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCIOFF__VAR)), SCM_OBJ(Scm_MakeInteger(TCIOFF)));
 560 #endif /* !defined(__MINGW32__) */
 561 #if !defined(__MINGW32__)
 562   termiolib_TCOON__VAR = Scm_Intern(&termiolib_TCOON__VAR__NAME);
 563   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCOON__VAR)), SCM_OBJ(Scm_MakeInteger(TCOON)));
 564 #endif /* !defined(__MINGW32__) */
 565 #if !defined(__MINGW32__)
 566   termiolib_TCOOFF__VAR = Scm_Intern(&termiolib_TCOOFF__VAR__NAME);
 567   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCOOFF__VAR)), SCM_OBJ(Scm_MakeInteger(TCOOFF)));
 568 #endif /* !defined(__MINGW32__) */
 569 #if !defined(__MINGW32__)
 570   termiolib_TCIOFLUSH__VAR = Scm_Intern(&termiolib_TCIOFLUSH__VAR__NAME);
 571   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCIOFLUSH__VAR)), SCM_OBJ(Scm_MakeInteger(TCIOFLUSH)));
 572 #endif /* !defined(__MINGW32__) */
 573 #if !defined(__MINGW32__)
 574   termiolib_TCOFLUSH__VAR = Scm_Intern(&termiolib_TCOFLUSH__VAR__NAME);
 575   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCOFLUSH__VAR)), SCM_OBJ(Scm_MakeInteger(TCOFLUSH)));
 576 #endif /* !defined(__MINGW32__) */
 577 #if !defined(__MINGW32__)
 578   termiolib_TCIFLUSH__VAR = Scm_Intern(&termiolib_TCIFLUSH__VAR__NAME);
 579   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCIFLUSH__VAR)), SCM_OBJ(Scm_MakeInteger(TCIFLUSH)));
 580 #endif /* !defined(__MINGW32__) */
 581 #if !defined(__MINGW32__)
 582   termiolib_TCSAFLUSH__VAR = Scm_Intern(&termiolib_TCSAFLUSH__VAR__NAME);
 583   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCSAFLUSH__VAR)), SCM_OBJ(Scm_MakeInteger(TCSAFLUSH)));
 584 #endif /* !defined(__MINGW32__) */
 585 #if !defined(__MINGW32__)
 586   termiolib_TCSADRAIN__VAR = Scm_Intern(&termiolib_TCSADRAIN__VAR__NAME);
 587   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCSADRAIN__VAR)), SCM_OBJ(Scm_MakeInteger(TCSADRAIN)));
 588 #endif /* !defined(__MINGW32__) */
 589 #if !defined(__MINGW32__)
 590   termiolib_TCSANOW__VAR = Scm_Intern(&termiolib_TCSANOW__VAR__NAME);
 591   Scm_DefineConst(module, SCM_SYMBOL(SCM_OBJ(termiolib_TCSANOW__VAR)), SCM_OBJ(Scm_MakeInteger(TCSANOW)));
 592 #endif /* !defined(__MINGW32__) */
 593 }

/* [<][>][^][v][top][bottom][index][help] */