📄 lists.hhf
字号:
#if( ! @defined( list_hhf ))?list_hhf := true;#include( "hla.hhf" )namespace linux; @fast; type list_head_pt: pointer to list_head; list_head:record; next :list_head_pt; prev :list_head_pt; endrecord; // The following creates an initialized list_head constant. #macro list_head_init(__name); @global:linux.list_head:[ &__name, &__name ] #endmacro; // The following is an approximation of the LIST_HEAD macro defined // in C. The name and usage are quite different because of namespace // pollution and features that HLA provides. In C, you'd declare an // initialized list head object by LIST_HEAD(var_name), in HLA you // do the following: // // var_name:list_head_t; // // Note that this declaration is only legal in static, storage, and readonly // declaration sections. Also note that this is not legal inside a namespace. #macro list_head_t:var_name; forward(var_name); var_name: @global:linux.list_head := @global:linux.list_head:[ &var_name, &var_name] #endmacro; // Run-time initialization of a list_head (useful for var objects!) // lvar must be a list_head variable (this is slightly different than // the C macro, which expects a pointer to a list_head variable). #macro init_list_head(__lvar); returns ({ #if( @class( __lvar ) = @global:hla.cStatic ) mov( &__lvar, __lvar.next ); mov( &__lvar, __lvar.prev ); #else push( eax ); lea( eax, __lvar ); mov( eax, __lvar.next ); mov( eax, __lvar.prev ); pop( eax ); #endif }, "") #endmacro; // Note: no macros for list manipulation for two reasons: // (1) the discrete code to do it is trivial // (2) the generalized code would extremely long and inefficient. end linux;#endif //list_hhf
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -