- 论坛徽章:
- 0
|
本帖最后由 zunhuakq 于 2012-07-21 16:18 编辑
看了好多源代码,发现开源很可怕,很难通过源代码去理解作者的意图啊……即便用各种代码分析工具去处理,仍然是 ,很多情况下,一点都看不懂。不理解,为何要把程序如此层层包装起来?
就拿GNU Guile的源代码举例吧,用GNU Global把它处理成HTML,看到有个地方用了scm_from_latin1_string
便点链接去跟踪:
scm_from_latin1_string (const char *str)
{
return scm_from_latin1_stringn (str, -1);
}
继续跟踪:
scm_from_latin1_stringn (const char *str, size_t len)
{
char *buf;
SCM result;
if (len == (size_t) -1)
len = strlen (str);
/* Make a narrow string and copy STR as is. */
result = scm_i_make_string (len, &buf, 0);
memcpy (buf, str, len);
return result;
}
还有!!继续:
scm_i_make_string (size_t len, char **charsp, int read_only_p)
{
SCM buf = make_stringbuf (len);
SCM res;
if (charsp)
*charsp = (char *) STRINGBUF_CHARS (buf);
res = scm_double_cell (read_only_p ? RO_STRING_TAG : STRING_TAG,
SCM_UNPACK (buf),
(scm_t_bits) 0, (scm_t_bits) len);
return res;
}
看不下去了,让人崩溃的级别呀…… |
|