Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 1 | #! /bin/sh |
| 2 | ############################################################################## |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 3 | # Copyright 2019-2020,2021 Thomas E. Dickey # |
| 4 | # Copyright 1998-2015,2017 Free Software Foundation, Inc. # |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 5 | # # |
| 6 | # Permission is hereby granted, free of charge, to any person obtaining a # |
| 7 | # copy of this software and associated documentation files (the "Software"), # |
| 8 | # to deal in the Software without restriction, including without limitation # |
| 9 | # the rights to use, copy, modify, merge, publish, distribute, distribute # |
| 10 | # with modifications, sublicense, and/or sell copies of the Software, and to # |
| 11 | # permit persons to whom the Software is furnished to do so, subject to the # |
| 12 | # following conditions: # |
| 13 | # # |
| 14 | # The above copyright notice and this permission notice shall be included in # |
| 15 | # all copies or substantial portions of the Software. # |
| 16 | # # |
| 17 | # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # |
| 18 | # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # |
| 19 | # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL # |
| 20 | # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # |
| 21 | # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # |
| 22 | # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER # |
| 23 | # DEALINGS IN THE SOFTWARE. # |
| 24 | # # |
| 25 | # Except as contained in this notice, the name(s) of the above copyright # |
| 26 | # holders shall not be used in advertising or otherwise to promote the sale, # |
| 27 | # use or other dealings in this Software without prior written # |
| 28 | # authorization. # |
| 29 | ############################################################################## |
| 30 | # |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 31 | # Author: Thomas E. Dickey, 1997-on |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 32 | # |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 33 | # $Id: MKexpanded.sh,v 1.24 2022/02/05 17:27:18 tom Exp $ |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 34 | # |
| 35 | # Script to generate 'expanded.c', a dummy source that contains functions |
| 36 | # corresponding to complex macros used in this library. By making functions, |
| 37 | # we simplify analysis and debugging. |
| 38 | |
| 39 | if test $# != 0; then |
| 40 | preprocessor="$1" |
| 41 | else |
| 42 | preprocessor="cc -E" |
| 43 | fi |
| 44 | shift |
| 45 | if test $# != 0 ; then |
| 46 | preprocessor="$preprocessor $*" |
| 47 | else |
| 48 | preprocessor="$preprocessor -DHAVE_CONFIG_H -I. -I../include" |
| 49 | fi |
| 50 | |
| 51 | TMP=gen$$.c |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 52 | trap "rm -f $TMP; exit 1" 1 2 3 15 |
| 53 | trap "rm -f $TMP" 0 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 54 | |
| 55 | cat <<EOF |
| 56 | /* generated by MKexpanded.sh */ |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 57 | #define NEED_NCURSES_CH_T 1 |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 58 | #include <curses.priv.h> |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 59 | |
| 60 | #ifndef CUR |
| 61 | #define CUR SP_TERMTYPE |
| 62 | #endif |
| 63 | |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 64 | #if NCURSES_EXPANDED |
| 65 | EOF |
| 66 | |
| 67 | cat >$TMP <<EOF |
| 68 | #include <ncurses_cfg.h> |
| 69 | #undef NCURSES_EXPANDED /* this probably is set in ncurses_cfg.h */ |
| 70 | #include <curses.priv.h> |
| 71 | /* these are names we'd like to see */ |
| 72 | #undef ALL_BUT_COLOR |
| 73 | #undef PAIR_NUMBER |
| 74 | #undef TRUE |
| 75 | #undef FALSE |
| 76 | /* this is a marker */ |
| 77 | IGNORE |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 78 | NCURSES_EXPORT(void) |
| 79 | _nc_toggle_attr_on (attr_t *S, attr_t at) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 80 | { |
| 81 | toggle_attr_on(*S,at); |
| 82 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 83 | |
| 84 | NCURSES_EXPORT(void) |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 85 | _nc_toggle_attr_off (attr_t *S, attr_t at) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 86 | { |
| 87 | toggle_attr_off(*S,at); |
| 88 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 89 | |
| 90 | NCURSES_EXPORT(int) |
| 91 | NCURSES_SP_NAME(_nc_DelCharCost) (NCURSES_SP_DCLx int count) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 92 | { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 93 | return DelCharCost(SP_PARM, count); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 94 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 95 | |
| 96 | NCURSES_EXPORT(int) |
| 97 | NCURSES_SP_NAME(_nc_InsCharCost) (NCURSES_SP_DCLx int count) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 98 | { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 99 | return InsCharCost(SP_PARM, count); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 100 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 101 | |
| 102 | NCURSES_EXPORT(void) |
| 103 | NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx CARG_CH_T c) |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 104 | { |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 105 | UpdateAttrs(SP_PARM, CHDEREF(c)); |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 106 | } |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 107 | |
| 108 | @if_NCURSES_SP_FUNCS |
| 109 | NCURSES_EXPORT(int) |
| 110 | _nc_DelCharCost (int count) |
| 111 | { |
| 112 | return NCURSES_SP_NAME(_nc_DelCharCost) (CURRENT_SCREEN, count); |
| 113 | } |
| 114 | |
| 115 | NCURSES_EXPORT(int) |
| 116 | _nc_InsCharCost (int count) |
| 117 | { |
| 118 | return NCURSES_SP_NAME(_nc_InsCharCost)(CURRENT_SCREEN, count); |
| 119 | } |
| 120 | |
| 121 | NCURSES_EXPORT(void) |
| 122 | _nc_UpdateAttrs (CARG_CH_T c) |
| 123 | { |
| 124 | NCURSES_SP_NAME(_nc_UpdateAttrs)(CURRENT_SCREEN,c); |
| 125 | } |
| 126 | @endif |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 127 | EOF |
| 128 | |
Steve Kondik | ae271bc | 2015-11-15 02:50:53 +0100 | [diff] [blame] | 129 | $preprocessor $TMP 2>/dev/null | \ |
micky387 | 9b9f5e7 | 2025-07-08 18:04:53 -0400 | [diff] [blame] | 130 | sed -e '1,/^IGNORE$/d' -e 's/^@/#/' -e 's/^#[ ]*if_/#if /' -e "s,$TMP,expanded.c," |
Amit Daniel Kachhap | e6a01f5 | 2011-07-20 11:45:59 +0530 | [diff] [blame] | 131 | |
| 132 | cat <<EOF |
| 133 | #else /* ! NCURSES_EXPANDED */ |
| 134 | NCURSES_EXPORT(void) _nc_expanded (void) { } |
| 135 | #endif /* NCURSES_EXPANDED */ |
| 136 | EOF |