c-r.rep

来自「Object-Oriented Programming With ANSI-C这」· REP 代码 · 共 41 行

REP
41
字号
// differences from c.rep://	`metaroot_ctor() does not call super_ctor() -- no need to, we hope//	first arguments to ctor are copied to struct in order of declaration//	then argumentlist is shared with other `meta_ctor()s//	memcpy() performs binary inheritance//	there is no way to generate `root and `metaroot descriptions and init()//// note that 'ctor' and its calling convention are burnt into this file//% init			// implement %init request for root class`{dcl  `{if `class `root    `%selectors    static  void  *  `metaroot _ctor  (void  *  _self,  va_list  *  app)  { `n	`t	struct  `metaroot  *  self  =  _self; `n	`t	const  size_t  offset  =  offsetof(struct  `metaroot ,  ctor); `n	`t	typedef  void  (*  voidf)  (); `n	`t	voidf  selector; `n	`t	va_list  ap; `n `n		`{struct `metaroot		`t	self  ->  `name  =  va_arg(*  app,  `type ); `n		`}n	`t	assert(self  ->  super); `n `n	`t	memcpy((char  *)  self  +  offset,  ` \			(char  *)  self  ->  super  +  offset, `n	`t	`t	sizeOf(self  ->  super)  -  offset); `n `n	`t	ap  =  *  app; `n	`%meta-ctor-loop	`t	return  self; `n    } `n `n  `}fi`}dcl

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?