202 lines
5.7 KiB
C
202 lines
5.7 KiB
C
/* This is an Scheme48/C interface file,
|
|
** automatically generated by a hacked version of cig 3.0.
|
|
step 4
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h> /* For malloc. */
|
|
#include "libcig.h"
|
|
|
|
#include <sys/signal.h>
|
|
#include <sys/types.h>
|
|
#include <sys/times.h>
|
|
#include <sys/time.h>
|
|
#include <fcntl.h> /* for O_RDWR */
|
|
#include <sys/stat.h>
|
|
#include <netdb.h>
|
|
#include <pwd.h>
|
|
#include <unistd.h>
|
|
|
|
/* Make sure foreign-function stubs interface to the C funs correctly: */
|
|
#include "dirstuff1.h"
|
|
#include "select1.h"
|
|
#include "syscalls1.h"
|
|
#include "userinfo1.h"
|
|
|
|
extern int errno;
|
|
|
|
#define errno_on_zero_or_false(x) ((x) ? S48_FALSE : s48_enter_fixnum(errno))
|
|
#define errno_or_false(x) (((x) == -1) ? s48_enter_fixnum(errno) : S48_FALSE)
|
|
#define False_on_zero(x) ((x) ? s48_enter_fixnum(x) : S48_FALSE)
|
|
|
|
s48_value df_char_ready_fdes(s48_value g1)
|
|
{
|
|
extern s48_value char_ready_fdes(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = char_ready_fdes(s48_extract_fixnum(g1));
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_read_fdes_char(s48_value g1)
|
|
{
|
|
extern s48_value read_fdes_char(int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = read_fdes_char(s48_extract_fixnum(g1));
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_write_fdes_char(s48_value g1, s48_value g2)
|
|
{
|
|
extern int write_fdes_char(char , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
int r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = write_fdes_char(s48_extract_char(g1), s48_extract_fixnum(g2));
|
|
ret1 = errno_or_false(r1);
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_read_fdes_substring(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value mv_vec)
|
|
{
|
|
extern ssize_t read_fdes_substring(s48_value , size_t , size_t , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
ssize_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = read_fdes_substring(g1, s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_write_fdes_substring(s48_value g1, s48_value g2, s48_value g3, s48_value g4, s48_value mv_vec)
|
|
{
|
|
extern ssize_t write_fdes_substring(s48_value , size_t , size_t , int );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(2);
|
|
ssize_t r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_2(mv_vec,ret1);
|
|
r1 = write_fdes_substring(g1, s48_extract_fixnum(g2), s48_extract_fixnum(g3), s48_extract_fixnum(g4));
|
|
ret1 = errno_or_false(r1);
|
|
S48_VECTOR_SET(mv_vec,0,s48_enter_fixnum(r1));
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
s48_value df_sleep_until(s48_value g1)
|
|
{
|
|
extern s48_value sleep_until(time_t );
|
|
s48_value ret1 = S48_FALSE;
|
|
S48_DECLARE_GC_PROTECT(1);
|
|
s48_value r1;
|
|
|
|
|
|
|
|
S48_GC_PROTECT_1(ret1);
|
|
r1 = sleep_until(s48_extract_integer(g1));
|
|
ret1 = r1;
|
|
S48_GC_UNPROTECT();
|
|
return ret1;
|
|
}
|
|
|
|
void s48_init_syscalls(void)
|
|
{
|
|
S48_EXPORT_FUNCTION(scheme_exec);
|
|
S48_EXPORT_FUNCTION(scsh_exit);
|
|
S48_EXPORT_FUNCTION(scsh__exit);
|
|
S48_EXPORT_FUNCTION(scsh_fork);
|
|
S48_EXPORT_FUNCTION(wait_pid);
|
|
S48_EXPORT_FUNCTION(scsh_chdir);
|
|
S48_EXPORT_FUNCTION(scheme_cwd);
|
|
S48_EXPORT_FUNCTION(scsh_getgid);
|
|
S48_EXPORT_FUNCTION(scsh_getegid);
|
|
S48_EXPORT_FUNCTION(scsh_setgid);
|
|
S48_EXPORT_FUNCTION(scsh_setegid);
|
|
S48_EXPORT_FUNCTION(get_groups);
|
|
S48_EXPORT_FUNCTION(scsh_getuid);
|
|
S48_EXPORT_FUNCTION(scsh_geteuid);
|
|
S48_EXPORT_FUNCTION(scsh_setuid);
|
|
S48_EXPORT_FUNCTION(scsh_seteuid);
|
|
S48_EXPORT_FUNCTION(scsh_getpid);
|
|
S48_EXPORT_FUNCTION(scsh_getppid);
|
|
S48_EXPORT_FUNCTION(scsh_getpgrp);
|
|
S48_EXPORT_FUNCTION(setpgid);
|
|
S48_EXPORT_FUNCTION(scsh_setsid);
|
|
S48_EXPORT_FUNCTION(scsh_umask);
|
|
S48_EXPORT_FUNCTION(process_times);
|
|
S48_EXPORT_FUNCTION(cpu_clock_ticks_per_sec);
|
|
S48_EXPORT_FUNCTION(scsh_chmod);
|
|
S48_EXPORT_FUNCTION(scsh_fchmod);
|
|
S48_EXPORT_FUNCTION(scsh_chown);
|
|
S48_EXPORT_FUNCTION(scsh_fchown);
|
|
S48_EXPORT_FUNCTION(scsh_access);
|
|
S48_EXPORT_FUNCTION(scsh_link);
|
|
S48_EXPORT_FUNCTION(scsh_mkfifo);
|
|
S48_EXPORT_FUNCTION(scsh_mkdir);
|
|
S48_EXPORT_FUNCTION(scsh_readlink);
|
|
S48_EXPORT_FUNCTION(scsh_rename);
|
|
S48_EXPORT_FUNCTION(scsh_rmdir);
|
|
S48_EXPORT_FUNCTION(scm_utime);
|
|
S48_EXPORT_FUNCTION(scm_utime_now);
|
|
S48_EXPORT_FUNCTION(scheme_stat);
|
|
S48_EXPORT_FUNCTION(scheme_fstat);
|
|
S48_EXPORT_FUNCTION(scsh_symlink);
|
|
S48_EXPORT_FUNCTION(scsh_truncate);
|
|
S48_EXPORT_FUNCTION(scsh_ftruncate);
|
|
S48_EXPORT_FUNCTION(scsh_unlink);
|
|
S48_EXPORT_FUNCTION(scsh_fsync);
|
|
S48_EXPORT_FUNCTION(scsh_sync);
|
|
S48_EXPORT_FUNCTION(scsh_close);
|
|
S48_EXPORT_FUNCTION(scsh_dup);
|
|
S48_EXPORT_FUNCTION(scsh_dup2);
|
|
S48_EXPORT_FUNCTION(scsh_lseek);
|
|
S48_EXPORT_FUNCTION(df_char_ready_fdes);
|
|
S48_EXPORT_FUNCTION(scsh_open);
|
|
S48_EXPORT_FUNCTION(scheme_pipe);
|
|
S48_EXPORT_FUNCTION(df_read_fdes_char);
|
|
S48_EXPORT_FUNCTION(df_write_fdes_char);
|
|
S48_EXPORT_FUNCTION(df_read_fdes_substring);
|
|
S48_EXPORT_FUNCTION(df_write_fdes_substring);
|
|
S48_EXPORT_FUNCTION(scsh_kill);
|
|
S48_EXPORT_FUNCTION(open_dir);
|
|
S48_EXPORT_FUNCTION(scm_envvec);
|
|
S48_EXPORT_FUNCTION(create_env);
|
|
S48_EXPORT_FUNCTION(align_env);
|
|
S48_EXPORT_FUNCTION(free_envvec);
|
|
S48_EXPORT_FUNCTION(set_cloexec);
|
|
S48_EXPORT_FUNCTION(fcntl_read);
|
|
S48_EXPORT_FUNCTION(fcntl_write);
|
|
S48_EXPORT_FUNCTION(df_sleep_until);
|
|
S48_EXPORT_FUNCTION(scm_gethostname);
|
|
S48_EXPORT_FUNCTION(errno_msg);
|
|
S48_EXPORT_FUNCTION(scm_crypt);
|
|
}
|