1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-01 09:41:44 +02:00

45583/0004: internal: Add some comments around wordcodes. No functional change.

This commit is contained in:
Daniel Shahaf 2020-03-19 21:15:54 +00:00
parent 4960699de2
commit 338a4a299a
3 changed files with 16 additions and 2 deletions

View file

@ -1,5 +1,8 @@
2020-03-22 Daniel Shahaf <d.s@daniel.shahaf.name>
* 45583/0004: Src/parse.c, Src/zsh.h: internal: Add some comments
around wordcodes. No functional change.
* 45583/0003: Src/parse.c, Src/zsh.h: internal: Add some comments
around Eccstr. No functional change.

View file

@ -102,6 +102,13 @@ struct heredocs *hdocs;
* The parser now produces word code, reducing memory consumption compared
* to the nested structs we had before.
*
* Word codes are represented by the "wordcode" type.
*
* Each wordcode variable consists of a "code", in the least-significant bits
* of the value, and "data" in the other bits. The macros wc_code() and wc_data()
* access the "code" and "data" parts of a wordcode. The macros wc_bdata() and
* wc_bld() build wordcodes from code and data.
*
* Word code layout:
*
* WC_END

View file

@ -866,8 +866,8 @@ struct eccstr {
#define EC_DUP 1
#define EC_DUPTOK 2
/* See comment at the top of Src/parse.c for details. */
#define WC_CODEBITS 5
#define wc_code(C) ((C) & ((wordcode) ((1 << WC_CODEBITS) - 1)))
#define wc_data(C) ((C) >> WC_CODEBITS)
#define wc_bdata(D) ((D) << WC_CODEBITS)
@ -896,7 +896,11 @@ struct eccstr {
#define WC_AUTOFN 20
#define WC_TRY 21
/* increment as necessary */
/*
* Increment as necessary.
*
* If this exceeds 31, increment WC_CODEBITS.
*/
#define WC_COUNT 22
#define WCB_END() wc_bld(WC_END, 0)