comparison src/globals.h @ 32118:04d9dff67d99 v9.0.1390

patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected file Commit: https://github.com/vim/vim/commit/14113fdf9cb3d588c0d1c3a210246b981cf5aad3 Author: Yegappan Lakshmanan <yegappan@yahoo.com> Date: Tue Mar 7 17:13:51 2023 +0000 patch 9.0.1390: FOR_ALL_ macros are defined in an unexpected file Problem: FOR_ALL_ macros are defined in an unexpected file. Solution: Move FOR_ALL_ macros to macros.h. Add FOR_ALL_HASHTAB_ITEMS. (Yegappan Lakshmanan, closes #12109)
author Bram Moolenaar <Bram@vim.org>
date Tue, 07 Mar 2023 18:15:04 +0100
parents ef644af2c330
children c1f730c2b51e
comparison
equal deleted inserted replaced
32117:0741cc777264 32118:04d9dff67d99
871 /* 871 /*
872 * While defining the system menu, sys_menu is TRUE. This avoids 872 * While defining the system menu, sys_menu is TRUE. This avoids
873 * overruling of menus that the user already defined. 873 * overruling of menus that the user already defined.
874 */ 874 */
875 EXTERN int sys_menu INIT(= FALSE); 875 EXTERN int sys_menu INIT(= FALSE);
876
877 #define FOR_ALL_MENUS(m) for ((m) = root_menu; (m) != NULL; (m) = (m)->next)
878 #define FOR_ALL_CHILD_MENUS(p, c) \
879 for ((c) = (p)->children; (c) != NULL; (c) = (c)->next)
880 #endif 876 #endif
881 877
882 #ifdef FEAT_GUI 878 #ifdef FEAT_GUI
883 # ifdef FEAT_MENU 879 # ifdef FEAT_MENU
884 // Menu item just selected, set by check_termcode() 880 // Menu item just selected, set by check_termcode()
966 EXTERN win_T *firstwin; // first window 962 EXTERN win_T *firstwin; // first window
967 EXTERN win_T *lastwin; // last window 963 EXTERN win_T *lastwin; // last window
968 EXTERN win_T *prevwin INIT(= NULL); // previous window 964 EXTERN win_T *prevwin INIT(= NULL); // previous window
969 #define ONE_WINDOW (firstwin == lastwin) 965 #define ONE_WINDOW (firstwin == lastwin)
970 #define W_NEXT(wp) ((wp)->w_next) 966 #define W_NEXT(wp) ((wp)->w_next)
971 #define FOR_ALL_WINDOWS(wp) for ((wp) = firstwin; (wp) != NULL; (wp) = (wp)->w_next)
972 #define FOR_ALL_FRAMES(frp, first_frame) \
973 for ((frp) = first_frame; (frp) != NULL; (frp) = (frp)->fr_next)
974 #define FOR_ALL_TABPAGES(tp) for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next)
975 #define FOR_ALL_WINDOWS_IN_TAB(tp, wp) \
976 for ((wp) = ((tp) == NULL || (tp) == curtab) \
977 ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
978 /*
979 * When using this macro "break" only breaks out of the inner loop. Use "goto"
980 * to break out of the tabpage loop.
981 */
982 #define FOR_ALL_TAB_WINDOWS(tp, wp) \
983 for ((tp) = first_tabpage; (tp) != NULL; (tp) = (tp)->tp_next) \
984 for ((wp) = ((tp) == curtab) \
985 ? firstwin : (tp)->tp_firstwin; (wp); (wp) = (wp)->w_next)
986
987 #define FOR_ALL_POPUPWINS(wp) \
988 for ((wp) = first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
989 #define FOR_ALL_POPUPWINS_IN_TAB(tp, wp) \
990 for ((wp) = (tp)->tp_first_popupwin; (wp) != NULL; (wp) = (wp)->w_next)
991
992 967
993 EXTERN win_T *curwin; // currently active window 968 EXTERN win_T *curwin; // currently active window
994 969
995 // When executing autocommands for a buffer that is not in any window, a 970 // When executing autocommands for a buffer that is not in any window, a
996 // special window is created to handle the side effects. When autocommands 971 // special window is created to handle the side effects. When autocommands
1047 * 'lastbuf' to the last entry and 'curbuf' to the currently active buffer. 1022 * 'lastbuf' to the last entry and 'curbuf' to the currently active buffer.
1048 */ 1023 */
1049 EXTERN buf_T *firstbuf INIT(= NULL); // first buffer 1024 EXTERN buf_T *firstbuf INIT(= NULL); // first buffer
1050 EXTERN buf_T *lastbuf INIT(= NULL); // last buffer 1025 EXTERN buf_T *lastbuf INIT(= NULL); // last buffer
1051 EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer 1026 EXTERN buf_T *curbuf INIT(= NULL); // currently active buffer
1052
1053 #define FOR_ALL_BUFFERS(buf) \
1054 for ((buf) = firstbuf; (buf) != NULL; (buf) = (buf)->b_next)
1055
1056 #define FOR_ALL_BUF_WININFO(buf, wip) \
1057 for ((wip) = (buf)->b_wininfo; (wip) != NULL; (wip) = (wip)->wi_next)
1058
1059 // Iterate through all the signs placed in a buffer
1060 #define FOR_ALL_SIGNS_IN_BUF(buf, sign) \
1061 for ((sign) = (buf)->b_signlist; (sign) != NULL; (sign) = (sign)->se_next)
1062 1027
1063 // Flag that is set when switching off 'swapfile'. It means that all blocks 1028 // Flag that is set when switching off 'swapfile'. It means that all blocks
1064 // are to be loaded into memory. Shouldn't be global... 1029 // are to be loaded into memory. Shouldn't be global...
1065 EXTERN int mf_dont_release INIT(= FALSE); // don't release blocks 1030 EXTERN int mf_dont_release INIT(= FALSE); // don't release blocks
1066 1031
1872 1837
1873 #ifdef FEAT_SPELL 1838 #ifdef FEAT_SPELL
1874 // Line in which spell checking wasn't highlighted because it touched the 1839 // Line in which spell checking wasn't highlighted because it touched the
1875 // cursor position in Insert mode. 1840 // cursor position in Insert mode.
1876 EXTERN linenr_T spell_redraw_lnum INIT(= 0); 1841 EXTERN linenr_T spell_redraw_lnum INIT(= 0);
1877
1878 #define FOR_ALL_SPELL_LANGS(slang) \
1879 for ((slang) = first_lang; (slang) != NULL; (slang) = (slang)->sl_next)
1880 #endif 1842 #endif
1881 1843
1882 #ifdef FEAT_CONCEAL 1844 #ifdef FEAT_CONCEAL
1883 // Set when the cursor line needs to be redrawn. 1845 // Set when the cursor line needs to be redrawn.
1884 EXTERN int need_cursor_line_redraw INIT(= FALSE); 1846 EXTERN int need_cursor_line_redraw INIT(= FALSE);
2013 # endif 1975 # endif
2014 ; 1976 ;
2015 1977
2016 // Whether a redraw is needed for appending a line to a buffer. 1978 // Whether a redraw is needed for appending a line to a buffer.
2017 EXTERN int channel_need_redraw INIT(= FALSE); 1979 EXTERN int channel_need_redraw INIT(= FALSE);
2018
2019 # define FOR_ALL_CHANNELS(ch) \
2020 for ((ch) = first_channel; (ch) != NULL; (ch) = (ch)->ch_next)
2021 # define FOR_ALL_JOBS(job) \
2022 for ((job) = first_job; (job) != NULL; (job) = (job)->jv_next)
2023 #endif 1980 #endif
2024 1981
2025 #ifdef FEAT_EVAL 1982 #ifdef FEAT_EVAL
2026 // This flag is set when outputting a terminal control code and reset in 1983 // This flag is set when outputting a terminal control code and reset in
2027 // out_flush() when characters have been written. 1984 // out_flush() when characters have been written.
2029 1986
2030 EXTERN int did_repeated_msg INIT(= 0); 1987 EXTERN int did_repeated_msg INIT(= 0);
2031 # define REPEATED_MSG_LOOKING 1 1988 # define REPEATED_MSG_LOOKING 1
2032 # define REPEATED_MSG_SAFESTATE 2 1989 # define REPEATED_MSG_SAFESTATE 2
2033 #endif 1990 #endif
2034
2035 #if defined(FEAT_DIFF)
2036 #define FOR_ALL_DIFFBLOCKS_IN_TAB(tp, dp) \
2037 for ((dp) = (tp)->tp_first_diff; (dp) != NULL; (dp) = (dp)->df_next)
2038 #endif
2039
2040 #define FOR_ALL_LIST_ITEMS(l, li) \
2041 for ((li) = (l) == NULL ? NULL : (l)->lv_first; (li) != NULL; (li) = (li)->li_next)
2042 1991
2043 // While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this 1992 // While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this
2044 // overrules p_magic. Otherwise set to OPTION_MAGIC_NOT_SET. 1993 // overrules p_magic. Otherwise set to OPTION_MAGIC_NOT_SET.
2045 EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET); 1994 EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET);
2046 1995