[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Chicken-users] foreign-declare
From: |
F. Wittenberger |
Subject: |
[Chicken-users] foreign-declare |
Date: |
Sat, 26 Mar 2005 20:51:45 +0100 |
I have some old chicken code, which used to compile about half a year
ago. Now it strangely fails. The fragment:
(declare
(unit util)
(uses posix library extras regex tcp format srfi-13 srfi-18 srfi-19)
(fixnum)
(export
....
)
(foreign-declare #<<EOF
static void A_addstr5(C_word c, C_word self, C_word k,
C_word s_buf, C_word s_i, C_word s_str, C_word
s_j,
C_word s_flush)
{
int i = C_unfix(s_i), j = C_unfix(s_j);
/* string-length coded inline */
unsigned int buf_max = C_header_size(s_buf) - i;
unsigned int str_max = C_header_size(s_str) - j;
unsigned int n = buf_max < str_max ? buf_max : str_max;
register C_char *buf = (C_char *)C_data_pointer(s_buf) + i;
register C_char *str = (C_char *)C_data_pointer(s_str) + j;
register C_char *end = str + n;
while(str != end) *buf++=*str++;
i += n;
if( n == buf_max )
/* end recursive call of s_flush; self is the current closure */
((C_proc7)C_retrieve_proc(s_flush))
(7, s_flush, k, s_buf, C_fix(i), s_str, C_fix(j + n), self);
C_kontinue(k, C_fix(i)); /* call the current continuation */
}
EOF
)
)
the problem: instead that this becomes a C function which I'm calling
elsewhere, it creates a literal string constant with the functions text
as string value. like this:
lf[445]=C_string(C_heaptop,1094,"static void A_addstr5(C_word c, C_word
self, C_word k,\012 "
" C_word s_buf, C_word s_i, C_word s_str, C_word s_j,
\012 "
" C_word s_flush) C_noret;\012\012static void A_addstr5(C_word
c, C_wo
....
Not quite the expeced thing.
What am I missing?
thanks
/Jörg
- [Chicken-users] foreign-declare,
F. Wittenberger <=