emacs 源码分析(二)

<2023-11-02 Thu>

emacs源码分析(二)

看这行代码:

struct Lisp_String *s = pure_alloc (sizeof *s, Lisp_String);

这里需要注意的是:

  1. Lisp_String有两种类型,它们的名字是一样的,一个是结构体,一个是枚举。
  2. gdb是查看变量时要么是p struct Lisp_Symbol;要么是p (int)Lisp_Symbol
  3. 类似的还有Lisp_Symbol,详细看结构体Lisp_Type的定义,如下:
enum Lisp_Type
  {
    /* Symbol.  XSYMBOL (object) points to a struct Lisp_Symbol.  */
    Lisp_Symbol = 0,

    /* Type 1 is currently unused.  */
    Lisp_Type_Unused0 = 1,

    /* Fixnum.  XFIXNUM (obj) is the integer value.  */
    Lisp_Int0 = 2,
    Lisp_Int1 = USE_LSB_TAG ? 6 : 3,

    /* String.  XSTRING (object) points to a struct Lisp_String.
       The length of the string, and its contents, are stored therein.  */
    Lisp_String = 4,

    /* Vector of Lisp objects, or something resembling it.
       XVECTOR (object) points to a struct Lisp_Vector, which contains
       the size and contents.  The size field also contains the type
       information, if it's not a real vector object.  */
    Lisp_Vectorlike = 5,

    /* Cons.  XCONS (object) points to a struct Lisp_Cons.  */
    Lisp_Cons = USE_LSB_TAG ? 3 : 6,

    /* Must be last entry in Lisp_Type enumeration.  */
    Lisp_Float = 7
  };
  1. staticpro()这个函数是用来向Lisp_Object const *staticvec[2048]数组中添加成员,让它们不要被gc给回收掉。staticpro表示static+pro(tect)

<2023-10-31 Tue>

dot绘制的emacs的数据结构

非常可惜呀,上次边学边画了elisp的数据结构,现在只剩下了导出的.svg图片,原始代码.dot文件已经找不到了。CSDN不支持.svg图片上传,转化后附上:
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值