scsh-0.5/scsh/tty.c

109 lines
3.2 KiB
C
Raw Normal View History

/* This is an Scheme48/C interface file,
** automatically generated by cig.
*/
#include <stdio.h>
#include <stdlib.h> /* For malloc. */
#include "libcig.h"
#include <termios.h>
/* Make sure foreign-function stubs interface to the C funs correctly: */
#include "tty1.h"
extern int errno;
#define errno_or_false(x) (((x) == -1) ? ENTER_FIXNUM(errno) : SCHFALSE)
scheme_value df_scheme_tcgetattr(long nargs, scheme_value *args)
{
extern int scheme_tcgetattr(int , char *, int *, int *, int *, int *, int *, int *, int *, int *, int *, int *);
scheme_value ret1;
int r1;
int r2;
int r3;
int r4;
int r5;
int r6;
int r7;
int r8;
int r9;
int r10;
int r11;
cig_check_nargs(3, nargs, "scheme_tcgetattr");
r1 = scheme_tcgetattr(EXTRACT_FIXNUM(args[2]), cig_string_body(args[1]), &r2, &r3, &r4, &r5, &r6, &r7, &r8, &r9, &r10, &r11);
ret1 = errno_or_false(r1);
VECTOR_REF(*args,0) = ENTER_FIXNUM(r2);
VECTOR_REF(*args,1) = ENTER_FIXNUM(r3);
VECTOR_REF(*args,2) = ENTER_FIXNUM(r4);
VECTOR_REF(*args,3) = ENTER_FIXNUM(r5);
VECTOR_REF(*args,4) = ENTER_FIXNUM(r6);
VECTOR_REF(*args,5) = ENTER_FIXNUM(r7);
VECTOR_REF(*args,6) = ENTER_FIXNUM(r8);
VECTOR_REF(*args,7) = ENTER_FIXNUM(r9);
VECTOR_REF(*args,8) = ENTER_FIXNUM(r10);
VECTOR_REF(*args,9) = ENTER_FIXNUM(r11);
return ret1;
}
scheme_value df_scheme_tcsetattr(long nargs, scheme_value *args)
{
extern int scheme_tcsetattr(int , int , const char *, int , int , int , int , int , int , int , int , int , int , int , int );
scheme_value ret1;
int r1;
cig_check_nargs(15, nargs, "scheme_tcsetattr");
r1 = scheme_tcsetattr(EXTRACT_FIXNUM(args[14]), EXTRACT_FIXNUM(args[13]), cig_string_body(args[12]), EXTRACT_FIXNUM(args[11]), EXTRACT_FIXNUM(args[10]), EXTRACT_FIXNUM(args[9]), EXTRACT_FIXNUM(args[8]), EXTRACT_FIXNUM(args[7]), EXTRACT_FIXNUM(args[6]), EXTRACT_FIXNUM(args[5]), EXTRACT_FIXNUM(args[4]), EXTRACT_FIXNUM(args[3]), EXTRACT_FIXNUM(args[2]), EXTRACT_FIXNUM(args[1]), EXTRACT_FIXNUM(args[0]));
ret1 = errno_or_false(r1);
return ret1;
}
scheme_value df_tcsendbreak(long nargs, scheme_value *args)
{
extern int tcsendbreak(int , int );
scheme_value ret1;
int r1;
cig_check_nargs(2, nargs, "tcsendbreak");
r1 = tcsendbreak(EXTRACT_FIXNUM(args[1]), EXTRACT_FIXNUM(args[0]));
ret1 = errno_or_false(r1);
return ret1;
}
scheme_value df_tcdrain(long nargs, scheme_value *args)
{
extern int tcdrain(int );
scheme_value ret1;
int r1;
cig_check_nargs(1, nargs, "tcdrain");
r1 = tcdrain(EXTRACT_FIXNUM(args[0]));
ret1 = errno_or_false(r1);
return ret1;
}
scheme_value df_tcflush(long nargs, scheme_value *args)
{
extern int tcflush(int , int );
scheme_value ret1;
int r1;
cig_check_nargs(2, nargs, "tcflush");
r1 = tcflush(EXTRACT_FIXNUM(args[1]), EXTRACT_FIXNUM(args[0]));
ret1 = errno_or_false(r1);
return ret1;
}
scheme_value df_tcflow(long nargs, scheme_value *args)
{
extern int tcflow(int , int );
scheme_value ret1;
int r1;
cig_check_nargs(2, nargs, "tcflow");
r1 = tcflow(EXTRACT_FIXNUM(args[1]), EXTRACT_FIXNUM(args[0]));
ret1 = errno_or_false(r1);
return ret1;
}