Malfunctioning Attempt to Make Scheme-lists in C added by teutonicpigeon on Thu Apr 21 10:49:56 2016
;I know, because I have done tests, that mail_lengths = {9,0} and letters = {"\0x03\0x03\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00",NULL} ;I think there is something wrong with my attempts to construct a list ;The output should be ("\0x03\0x03\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00\0x00") (define read-mail (foreign-lambda* scheme-object ((c-pointer box)) "size_t * mail_lengths = read_mail_lengths(box); char ** letters = read_mail(box); C_word rtn = C_SCHEME_END_OF_LIST; C_word * temp; C_word str; int i = 0; size_t str_len = mail_lengths[i]; while(mail_lengths[i] != 0) { len_int = str_len; temp = C_alloc(C_SIZEOF_PAIR + C_SIZEOF_STRING(str_len)); str = C_string(&temp, str_len, letters[i]); rtn = C_pair(&temp, str, rtn); i++; str_len = mail_lengths[i]; } C_return(rtn);"))