ae6ca955fd591a9d6b650f4847d6742da0b10cf5
1 /* Copyright (C) 1995,1996,1997,1998, 2000, 2001, 2006 Free Software Foundation, Inc.
3 * This library is free software; you can redistribute it and/or
4 * modify it under the terms of the GNU Lesser General Public
5 * License as published by the Free Software Foundation; either
6 * version 2.1 of the License, or (at your option) any later version.
8 * This library is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 * Lesser General Public License for more details.
13 * You should have received a copy of the GNU Lesser General Public
14 * License along with this library; if not, write to the Free Software
15 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
20 /* Defining Scheme functions implemented by C functions --- subrs. */
22 #include "libguile/gh.h"
24 #if SCM_ENABLE_DEPRECATED
26 /* allows you to define new scheme primitives written in C */
28 gh_new_procedure (const char *proc_name
, SCM (*fn
) (),
29 int n_required_args
, int n_optional_args
, int varp
)
31 return scm_c_define_gsubr (proc_name
, n_required_args
, n_optional_args
,
36 gh_new_procedure0_0 (const char *proc_name
, SCM (*fn
) ())
38 return gh_new_procedure (proc_name
, fn
, 0, 0, 0);
42 gh_new_procedure0_1 (const char *proc_name
, SCM (*fn
) ())
44 return gh_new_procedure (proc_name
, fn
, 0, 1, 0);
48 gh_new_procedure0_2 (const char *proc_name
, SCM (*fn
) ())
50 return gh_new_procedure (proc_name
, fn
, 0, 2, 0);
54 gh_new_procedure1_0 (const char *proc_name
, SCM (*fn
) ())
56 return gh_new_procedure (proc_name
, fn
, 1, 0, 0);
60 gh_new_procedure1_1 (const char *proc_name
, SCM (*fn
) ())
62 return gh_new_procedure (proc_name
, fn
, 1, 1, 0);
66 gh_new_procedure1_2 (const char *proc_name
, SCM (*fn
) ())
68 return gh_new_procedure (proc_name
, fn
, 1, 2, 0);
72 gh_new_procedure2_0 (const char *proc_name
, SCM (*fn
) ())
74 return gh_new_procedure (proc_name
, fn
, 2, 0, 0);
78 gh_new_procedure2_1 (const char *proc_name
, SCM (*fn
) ())
80 return gh_new_procedure (proc_name
, fn
, 2, 1, 0);
84 gh_new_procedure2_2 (const char *proc_name
, SCM (*fn
) ())
86 return gh_new_procedure (proc_name
, fn
, 2, 2, 0);
90 gh_new_procedure3_0 (const char *proc_name
, SCM (*fn
) ())
92 return gh_new_procedure (proc_name
, fn
, 3, 0, 0);
96 gh_new_procedure4_0 (const char *proc_name
, SCM (*fn
) ())
98 return gh_new_procedure (proc_name
, fn
, 4, 0, 0);
102 gh_new_procedure5_0 (const char *proc_name
, SCM (*fn
) ())
104 return gh_new_procedure (proc_name
, fn
, 5, 0, 0);
107 /* some (possibly most) Scheme functions available from C */
109 gh_define (const char *name
, SCM val
)
111 scm_c_define (name
, val
);
112 return SCM_UNSPECIFIED
;
116 /* Calling Scheme functions from C. */
119 gh_apply (SCM proc
, SCM args
)
121 return scm_apply (proc
, args
, SCM_EOL
);
127 return scm_apply (proc
, SCM_EOL
, SCM_EOL
);
131 gh_call1 (SCM proc
, SCM arg
)
133 return scm_apply (proc
, arg
, scm_listofnull
);
137 gh_call2 (SCM proc
, SCM arg1
, SCM arg2
)
139 return scm_apply (proc
, arg1
, scm_cons (arg2
, scm_listofnull
));
143 gh_call3 (SCM proc
, SCM arg1
, SCM arg2
, SCM arg3
)
145 return scm_apply (proc
, arg1
, scm_cons2 (arg2
, arg3
, scm_listofnull
));
148 #endif /* SCM_ENABLE_DEPRECATED */