当前位置: 首页 > news >正文

毕业设计做网站选题seo内部优化包括哪些内容

毕业设计做网站选题,seo内部优化包括哪些内容,电子商务网络平台建设,临沂建设局网站文章目录 emacs源码分析&#xff08;七&#xff09;自己动手把emacs的DEFUN宏抠出来 <2024-01-07 周日> emacs源码分析&#xff08;七&#xff09; 这DEFUN宏就像胶水一样&#xff0c;它把c代码和emacs-lisp代码给联系起来。但是DEFUN宏看着怪恐怖的有没有&#xff01;…

文章目录

  • `emacs`源码分析(七)
    • 自己动手把`emacs`的`DEFUN`宏抠出来

<2024-01-07 周日>

emacs源码分析(七)

DEFUN宏就像胶水一样,它把c代码和emacs-lisp代码给联系起来。但是DEFUN宏看着怪恐怖的有没有!

/* This version of DEFUN declares a function prototype with the rightarguments, so we can catch errors with maxargs at compile-time.  */
#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \SUBR_SECTION_ATTRIBUTE                                            \static union Aligned_Lisp_Subr sname =                            \{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },                     \{ .a ## maxargs = fnname },                                  \minargs, maxargs, lname, {intspec}, 0}};                     \Lisp_Object fnname

自己动手把emacsDEFUN宏抠出来

为了方便理解,我把DEFUN宏给抠了出来,放在一个单独的工程里:ysouyno/t_emacs_defun,如果不想下载工程,本篇结尾会附上所有源码(仅一个文件,不到300行代码)。

关于这个工程要注意:

  1. 仅适用于windows平台,为了编译方便,很多辅助宏能省略则省略。
  2. 设置C++ Language StandardISO C++20 Standard (/std:c++20)

挑了一个最简单的emacs-lisp函数eq

DEFUN ("eq", Feq, Seq, 2, 2, 0,doc: /* Return t if the two args are the same Lisp object.  */attributes: const)(Lisp_Object obj1, Lisp_Object obj2)
{if (EQ (obj1, obj2))return Qt;return Qnil;
}

展开后的eq代码是:

static union Aligned_Lisp_Subr Seq =
{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, // struct Lisp_Subr::header{.a2 = Feq },                            // struct Lisp_Subr::function2,                                       // struct Lisp_Subr::min_args2,                                       // struct Lisp_Subr::max_args"eq",                                    // struct Lisp_Subr::symbol_name{0},                                     // struct Lisp_Subr::intspec0                                        // struct Lisp_Subr::doc}
};Lisp_Object Feq(Lisp_Object obj1, Lisp_Object obj2)
{if (EQ(obj1, obj2))return Qt;return Qnil;
}

从上可得,DEFUN有两个任务以(eq函数为例):

  1. 声明一个静态变量Seq,它应该会将要用于emacs-lisp代码中的某些地方,目前我还不清楚细节。
  2. 定义一个c函数Feq

我照着DEFUN宏展开后样子定义了一个没有使用DEFUN宏来定义的函数my-eq,它可以正常工作:

// DEFUN("my-eq", ...)
static union Aligned_Lisp_Subr Smy_eq =
{ {{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },{.a2 = Fmy_eq },2, 2, "my-eq", {0}, 0} };
Lisp_Object Fmy_eq(Lisp_Object obj1, Lisp_Object obj2)
{if (EQ(obj1, obj2))return Qt;return Qnil;
}

备注:

  1. 有一个EXFUN宏要关注一下,这个代码我也抠出来了,它是用于声明Feq,否则编译器要报怨的:
error C2065: 'Feq': undeclared identifier
  1. emacs源代码中,大量EXFUN的函数声明在globals.h文件中。该文件的生成方法见:“emacs源码分析(一)”。

附完整代码:

// t_emacs_defun.cpp : This file contains the 'main' function. Program execution begins and ends there.
//#include <stddef.h> // for ptrdiff_t
#include <stdio.h>typedef long long EMACS_INT;
typedef EMACS_INT Lisp_Word;#define SUBR_SECTION_ATTRIBUTE/* Minimum alignment requirement for Lisp objects, imposed by theinternal representation of tagged pointers.  It is 2**GCTYPEBITS ifUSE_LSB_TAG, 1 otherwise.  It must be a literal integer constant,for older versions of GCC (through at least 4.9).  */
#if USE_LSB_TAG
# define GCALIGNMENT 8
# if GCALIGNMENT != 1 << GCTYPEBITS
#  error "GCALIGNMENT and GCTYPEBITS are inconsistent"
# endif
#else
# define GCALIGNMENT 1
#endif#define GCALIGNED_UNION_MEMBER char alignas (GCALIGNMENT) gcaligned;#if HAVE_STRUCT_ATTRIBUTE_ALIGNED
# define GCALIGNED_STRUCT __attribute__ ((aligned (GCALIGNMENT)))
#else
# define GCALIGNED_STRUCT
#endifunion vectorlike_header
{/* The main member contains various pieces of information:- The MSB (ARRAY_MARK_FLAG) holds the gcmarkbit.- The next bit (PSEUDOVECTOR_FLAG) indicates whether this is a plainvector (0) or a pseudovector (1).- If PSEUDOVECTOR_FLAG is 0, the rest holds the size (numberof slots) of the vector.- If PSEUDOVECTOR_FLAG is 1, the rest is subdivided into three fields:- a) pseudovector subtype held in PVEC_TYPE_MASK field;- b) number of Lisp_Objects slots at the beginning of the objectheld in PSEUDOVECTOR_SIZE_MASK field.  These objects are alwaystraced by the GC;- c) size of the rest fields held in PSEUDOVECTOR_REST_MASK andmeasured in word_size units.  Rest fields may also includeLisp_Objects, but these objects usually needs some special treatmentduring GC.There are some exceptions.  For PVEC_FREE, b) is always zero.  ForPVEC_BOOL_VECTOR and PVEC_SUBR, both b) and c) are always zero.Current layout limits the pseudovectors to 63 PVEC_xxx subtypes,4095 Lisp_Objects in GC-ed area and 4095 word-sized other slots.  */ptrdiff_t size;
};/* A Lisp_Object is a tagged pointer or integer.  Ordinarily it is aLisp_Word.  However, if CHECK_LISP_OBJECT_TYPE, it is a wrapperaround Lisp_Word, to help catch thinkos like 'Lisp_Object x = 0;'.LISP_INITIALLY (W) initializes a Lisp object with a tagged valuethat is a Lisp_Word W.  It can be used in a static initializer.  */#ifdef CHECK_LISP_OBJECT_TYPE
typedef struct Lisp_Object { Lisp_Word i; } Lisp_Object;
# define LISP_OBJECT_IS_STRUCT
# define LISP_INITIALLY(w) {w}
# undef CHECK_LISP_OBJECT_TYPE
enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = true };
#else
typedef Lisp_Word Lisp_Object;
# define LISP_INITIALLY(w) (w)
enum CHECK_LISP_OBJECT_TYPE { CHECK_LISP_OBJECT_TYPE = false };
#endif/* This structure describes a built-in function.It is generated by the DEFUN macro only.defsubr makes it into a Lisp object.  */struct Lisp_Subr
{union vectorlike_header header;union {Lisp_Object(*a0) (void);Lisp_Object(*a1) (Lisp_Object);Lisp_Object(*a2) (Lisp_Object, Lisp_Object);Lisp_Object(*a3) (Lisp_Object, Lisp_Object, Lisp_Object);Lisp_Object(*a4) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);Lisp_Object(*a5) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);Lisp_Object(*a6) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);Lisp_Object(*a7) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);Lisp_Object(*a8) (Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object);Lisp_Object(*aUNEVALLED) (Lisp_Object args);Lisp_Object(*aMANY) (ptrdiff_t, Lisp_Object*);} function;short min_args, max_args;const char* symbol_name;union {const char* intspec;Lisp_Object native_intspec;};EMACS_INT doc;
#ifdef HAVE_NATIVE_COMPLisp_Object native_comp_u;char* native_c_name;Lisp_Object lambda_list;Lisp_Object type;
#endif
} GCALIGNED_STRUCT;union Aligned_Lisp_Subr
{struct Lisp_Subr s;GCALIGNED_UNION_MEMBER
};enum pvec_type
{PVEC_NORMAL_VECTOR, /* Should be first, for sxhash_obj.  */PVEC_FREE,PVEC_BIGNUM,PVEC_MARKER,PVEC_OVERLAY,PVEC_FINALIZER,PVEC_MISC_PTR,PVEC_USER_PTR,PVEC_PROCESS,PVEC_FRAME,PVEC_WINDOW,PVEC_BOOL_VECTOR,PVEC_BUFFER,PVEC_HASH_TABLE,PVEC_TERMINAL,PVEC_WINDOW_CONFIGURATION,PVEC_SUBR,PVEC_OTHER, /* Should never be visible to Elisp code.  */PVEC_XWIDGET,PVEC_XWIDGET_VIEW,PVEC_THREAD,PVEC_MUTEX,PVEC_CONDVAR,PVEC_MODULE_FUNCTION,PVEC_NATIVE_COMP_UNIT,/* These should be last, for internal_equal and sxhash_obj.  */PVEC_COMPILED,PVEC_CHAR_TABLE,PVEC_SUB_CHAR_TABLE,PVEC_RECORD,PVEC_FONT /* Should be last because it's used for range checking.  */
};enum More_Lisp_Bits
{/* For convenience, we also store the number of elements in these bits.Note that this size is not necessarily the memory-footprint size, butonly the number of Lisp_Object fields (that need to be traced by GC).The distinction is used, e.g., by Lisp_Process, which places extranon-Lisp_Object fields at the end of the structure.  */PSEUDOVECTOR_SIZE_BITS = 12,PSEUDOVECTOR_SIZE_MASK = (1 << PSEUDOVECTOR_SIZE_BITS) - 1,/* To calculate the memory footprint of the pseudovector, it's usefulto store the size of non-Lisp area in word_size units here.  */PSEUDOVECTOR_REST_BITS = 12,PSEUDOVECTOR_REST_MASK = (((1 << PSEUDOVECTOR_REST_BITS) - 1)<< PSEUDOVECTOR_SIZE_BITS),/* Used to extract pseudovector subtype information.  */PSEUDOVECTOR_AREA_BITS = PSEUDOVECTOR_SIZE_BITS + PSEUDOVECTOR_REST_BITS,PVEC_TYPE_MASK = 0x3f << PSEUDOVECTOR_AREA_BITS
};/* This version of DEFUN declares a function prototype with the rightarguments, so we can catch errors with maxargs at compile-time.  */
#define DEFUN(lname, fnname, sname, minargs, maxargs, intspec, doc) \SUBR_SECTION_ATTRIBUTE                                            \static union Aligned_Lisp_Subr sname =                            \{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },                     \{ .a ## maxargs = fnname },                                  \minargs, maxargs, lname, {intspec}, 0}};                     \Lisp_Object fnnameenum maxargs
{MANY = -2,UNEVALLED = -1
};#define EXFUN(fnname, maxargs) \extern Lisp_Object fnname DEFUN_ARGS_ ## maxargs/* Note that the weird token-substitution semantics of ANSI C makesthis work for MANY and UNEVALLED.  */
#define DEFUN_ARGS_MANY		(ptrdiff_t, Lisp_Object *)
#define DEFUN_ARGS_UNEVALLED	(Lisp_Object)
#define DEFUN_ARGS_0	(void)
#define DEFUN_ARGS_1	(Lisp_Object)
#define DEFUN_ARGS_2	(Lisp_Object, Lisp_Object)
#define DEFUN_ARGS_3	(Lisp_Object, Lisp_Object, Lisp_Object)
#define DEFUN_ARGS_4	(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)
#define DEFUN_ARGS_5	(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \Lisp_Object)
#define DEFUN_ARGS_6	(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \Lisp_Object, Lisp_Object)
#define DEFUN_ARGS_7	(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \Lisp_Object, Lisp_Object, Lisp_Object)
#define DEFUN_ARGS_8	(Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object, \Lisp_Object, Lisp_Object, Lisp_Object, Lisp_Object)EXFUN(Feq, 2); // for error C2065: 'Feq': undeclared identifier
EXFUN(Fmy_eq, 2);#define lisp_h_XLI(o) (o)
#define XLI(o) lisp_h_XLI (o)
#define lisp_h_EQ(x, y) (XLI (x) == XLI (y))
#define EQ(x, y) lisp_h_EQ (x, y)#define Qt (Lisp_Object)1
#define Qnil (Lisp_Object)0/*
static union Aligned_Lisp_Subr Seq =
{{{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS }, // struct Lisp_Subr::header{.a2 = Feq },                            // struct Lisp_Subr::function2,                                       // struct Lisp_Subr::min_args2,                                       // struct Lisp_Subr::max_args"eq",                                    // struct Lisp_Subr::symbol_name{0},                                     // struct Lisp_Subr::intspec0                                        // struct Lisp_Subr::doc}
};Lisp_Object Feq(Lisp_Object obj1, Lisp_Object obj2)
{if (EQ(obj1, obj2))return Qt;return Qnil;
}
*/// error C7555: use of designated initializers requires at least '/std:c++20'
DEFUN("eq", Feq, Seq, 2, 2, 0,doc: /* Return t if the two args are the same Lisp object.  */
attributes: const)
(Lisp_Object obj1, Lisp_Object obj2)
{if (EQ(obj1, obj2))return Qt;return Qnil;
}// DEFUN("my-eq", ...)
static union Aligned_Lisp_Subr Smy_eq =
{ {{ PVEC_SUBR << PSEUDOVECTOR_AREA_BITS },{.a2 = Fmy_eq },2, 2, "my-eq", {0}, 0} };
Lisp_Object Fmy_eq(Lisp_Object obj1, Lisp_Object obj2)
{if (EQ(obj1, obj2))return Qt;return Qnil;
}int main() {printf("Feq(0, 0): %s\n", Feq(0, 0) ? "true" : "false");printf("Feq(0, 1): %s\n", Feq(0, 1) ? "true" : "false");printf("Fmy_eq(11, 11): %s\n", Fmy_eq(0, 0) ? "true" : "false");printf("Fmy_eq(10, 11): %s\n", Fmy_eq(0, 1) ? "true" : "false");
}

程序输出:

Feq(0, 0): true
Feq(0, 1): false
Fmy_eq(11, 11): true
Fmy_eq(10, 11): false

文章转载自:
http://dirtwagon.bfmq.cn
http://tangerine.bfmq.cn
http://clientele.bfmq.cn
http://fucoxanthin.bfmq.cn
http://recondite.bfmq.cn
http://killock.bfmq.cn
http://inextirpable.bfmq.cn
http://thrombokinase.bfmq.cn
http://jollily.bfmq.cn
http://impeccable.bfmq.cn
http://lunabase.bfmq.cn
http://applicability.bfmq.cn
http://washman.bfmq.cn
http://lona.bfmq.cn
http://androgynous.bfmq.cn
http://theolog.bfmq.cn
http://wassat.bfmq.cn
http://hunky.bfmq.cn
http://injury.bfmq.cn
http://sequentially.bfmq.cn
http://drayage.bfmq.cn
http://saucebox.bfmq.cn
http://mischance.bfmq.cn
http://dandify.bfmq.cn
http://inducer.bfmq.cn
http://underhanded.bfmq.cn
http://pietistic.bfmq.cn
http://argentic.bfmq.cn
http://development.bfmq.cn
http://wherever.bfmq.cn
http://civil.bfmq.cn
http://garp.bfmq.cn
http://defile.bfmq.cn
http://flying.bfmq.cn
http://sombrero.bfmq.cn
http://montanist.bfmq.cn
http://puszta.bfmq.cn
http://humpery.bfmq.cn
http://impersonator.bfmq.cn
http://confusedly.bfmq.cn
http://oven.bfmq.cn
http://cinerarium.bfmq.cn
http://encroachment.bfmq.cn
http://discountable.bfmq.cn
http://shoofly.bfmq.cn
http://stew.bfmq.cn
http://kinesis.bfmq.cn
http://pro.bfmq.cn
http://unshakable.bfmq.cn
http://arthromeric.bfmq.cn
http://finlandization.bfmq.cn
http://practicer.bfmq.cn
http://nebulosity.bfmq.cn
http://pa.bfmq.cn
http://rejoneo.bfmq.cn
http://nightingale.bfmq.cn
http://unshutter.bfmq.cn
http://predaceous.bfmq.cn
http://myrrhy.bfmq.cn
http://demobilise.bfmq.cn
http://faucial.bfmq.cn
http://seakindly.bfmq.cn
http://voroshilovgrad.bfmq.cn
http://loyal.bfmq.cn
http://taxis.bfmq.cn
http://electrodynamic.bfmq.cn
http://pupate.bfmq.cn
http://whetstone.bfmq.cn
http://fantabulous.bfmq.cn
http://engarb.bfmq.cn
http://treenware.bfmq.cn
http://bahada.bfmq.cn
http://semiagricultural.bfmq.cn
http://gratuity.bfmq.cn
http://scottish.bfmq.cn
http://unilluminating.bfmq.cn
http://amotivational.bfmq.cn
http://plasmodium.bfmq.cn
http://starred.bfmq.cn
http://phylloclad.bfmq.cn
http://heifer.bfmq.cn
http://czech.bfmq.cn
http://metaphorist.bfmq.cn
http://roofer.bfmq.cn
http://prehistoric.bfmq.cn
http://stablish.bfmq.cn
http://cornhusker.bfmq.cn
http://saprobiology.bfmq.cn
http://infirmation.bfmq.cn
http://paymaster.bfmq.cn
http://tabourine.bfmq.cn
http://insemination.bfmq.cn
http://victualer.bfmq.cn
http://cenacle.bfmq.cn
http://lithia.bfmq.cn
http://ciceroni.bfmq.cn
http://supersession.bfmq.cn
http://vituperatory.bfmq.cn
http://unmusicality.bfmq.cn
http://hydremic.bfmq.cn
http://www.dt0577.cn/news/62597.html

相关文章:

  • 响应式网站模板下载免费百度商业平台官网
  • 有了网站源码可以做网站吗建站abc
  • 网站建设明细报价表做网站用什么软件好
  • 做网站竞品分析无锡seo关键词排名
  • jsp做手机网站天津百度seo排名优化
  • php做教育网站seo赚钱培训
  • 网站建设硬件设置360搜索引擎下载
  • 自己做图网站最近的新闻热点时事
  • 兰州网站建设cheng三个关键词介绍自己
  • web设计网站网络营销做得比较好的企业
  • 天辰工程信息网官网深圳网络优化公司
  • 济南网站建设多少钱西安网站推广
  • 网络品牌营销案例武汉seo优化
  • 武汉 外贸网站建设最新战争新闻事件今天
  • 企业网站内容管理北京网站外包
  • 益阳 网站制作维护手机百度2022年新版本下载
  • 如何自己建网站企业网站惠州百度seo在哪
  • 网站 优化线上营销手段
  • 国内网站不备案百度网页版电脑版
  • 国外做任务赚钱网站长春疫情最新情况
  • 后台网站设计建网站用什么工具
  • 北京好的做网站的公司哪家好南昌网优化seo公司
  • 汝阳网站建设哪里有正规的电商培训班
  • 网站建站网站299266co上海网站快速排名优化
  • 我想给企业做网站怎么做香港seo公司
  • 十四冶建设集团技工学校网站优化大师win7官方免费下载
  • 湘潭做网站产品推广计划方案模板
  • 仿魔酷阁网站源码google推广及广告优缺点
  • 运城做网站公司今天高清视频免费播放
  • 个人网站怎么挣钱关键词优化价格