]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/MKexpanded.sh
ncurses 4.2
[ncurses.git] / ncurses / MKexpanded.sh
1 #! /bin/sh
2 ##############################################################################
3 # Copyright (c) 1998 Free Software Foundation, Inc.                          #
4 #                                                                            #
5 # Permission is hereby granted, free of charge, to any person obtaining a    #
6 # copy of this software and associated documentation files (the "Software"), #
7 # to deal in the Software without restriction, including without limitation  #
8 # the rights to use, copy, modify, merge, publish, distribute, distribute    #
9 # with modifications, sublicense, and/or sell copies of the Software, and to #
10 # permit persons to whom the Software is furnished to do so, subject to the  #
11 # following conditions:                                                      #
12 #                                                                            #
13 # The above copyright notice and this permission notice shall be included in #
14 # all copies or substantial portions of the Software.                        #
15 #                                                                            #
16 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR #
17 # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,   #
18 # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL    #
19 # THE ABOVE COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER      #
20 # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING    #
21 # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER        #
22 # DEALINGS IN THE SOFTWARE.                                                  #
23 #                                                                            #
24 # Except as contained in this notice, the name(s) of the above copyright     #
25 # holders shall not be used in advertising or otherwise to promote the sale, #
26 # use or other dealings in this Software without prior written               #
27 # authorization.                                                             #
28 ##############################################################################
29 #
30 # Author: Thomas E. Dickey <dickey@clark.net> 1997
31 #
32 # $Id: MKexpanded.sh,v 1.6 1998/02/11 12:13:54 tom Exp $
33 #
34 # Script to generate 'expanded.c', a dummy source that contains functions
35 # corresponding to complex macros used in this library.  By making functions,
36 # we simplify analysis and debugging.
37
38 if test $# != 0; then
39 preprocessor="$1"
40 else
41 preprocessor="cc -E"
42 fi
43 shift
44 if test $# != 0 ; then
45         preprocessor="$preprocessor $*"
46 else
47         preprocessor="$preprocessor -DHAVE_CONFIG_H -I. -I../include"
48 fi
49
50 TMP=gen$$.c
51 trap "rm -f $TMP" 0 1 2 5 15
52
53 cat >expanded.c <<EOF
54 /* generated by MKexpanded.sh */
55 #include <curses.priv.h>
56 #include <term.h>
57 #ifdef NCURSES_EXPANDED
58 EOF
59
60 cat >$TMP <<EOF
61 #include <ncurses_cfg.h>
62 #undef NCURSES_EXPANDED /* this probably is set in ncurses_cfg.h */
63 #include <curses.priv.h>
64 /* these are names we'd like to see */
65 #undef ALL_BUT_COLOR
66 #undef PAIR_NUMBER
67 #undef TRUE
68 #undef FALSE
69 /* this is a marker */
70 IGNORE
71 void _nc_toggle_attr_on(attr_t *S, attr_t at)
72 {
73         toggle_attr_on(*S,at);
74 }
75 void _nc_toggle_attr_off(attr_t *S, attr_t at) 
76 {
77         toggle_attr_off(*S,at);
78 }
79 int _nc_can_clear_with(chtype ch)
80 {
81         return can_clear_with(ch);
82 }
83 int _nc_DelCharCost(int count)
84 {
85         return DelCharCost(count);
86 }
87 int _nc_InsCharCost(int count)
88 {
89         return InsCharCost(count);
90 }
91 void _nc_UpdateAttrs(chtype c)
92 {
93         UpdateAttrs(c);
94 }
95 EOF
96
97 $preprocessor $TMP 2>/dev/null | sed -e '1,/^IGNORE$/d' >>expanded.c
98
99 cat >>expanded.c <<EOF
100 #else /* ! NCURSES_EXPANDED */
101 void _nc_expanded(void) { }
102 #endif /* NCURSES_EXPANDED */
103 EOF