List building fail added by danly|home on Sun Oct 16 02:51:17 2011

C_word build_string_list(char **data)
{
    std::list<C_word> scm_data;

    char **data_ptr = data;
    for (;*data_ptr != NULL; data_ptr++)
    {
	C_word *str_ptr = C_alloc(C_SIZEOF_STRING(strlen(*data_ptr)));
	C_word str = C_string2(&str_ptr, *data_ptr);
	scm_data.push_back(str);
    }

    if (!scm_data.empty())
    {
	C_word *ptr = C_alloc(C_SIZEOF_PAIR);
   	C_word list = C_list(&ptr, 1, scm_data.back());
	scm_data.pop_back();

    	for (std::list<C_word>::reverse_iterator iter = scm_data.rbegin(); iter != scm_data.rend(); ++iter)
	{
	    ptr = C_alloc(C_SIZEOF_PAIR);
    	    C_word current = C_pair(&ptr, *iter, list);
	    list = current;
	}

    	return list;
    }
    else
    	return C_SCHEME_FALSE;
}