]> ncurses.scripts.mit.edu Git - ncurses.git/blob - ncurses/MKexpanded.sh
5362444908558bf2e134cd0f158e8743ca841d16
[ncurses.git] / ncurses / MKexpanded.sh
1 #!/bin/sh
2 ################################################################################
3 # Copyright 1997 by Thomas E. Dickey <dickey@clark.net>                        #
4 # All Rights Reserved.                                                         #
5 #                                                                              #
6 # Permission to use, copy, modify, and distribute this software and its        #
7 # documentation for any purpose and without fee is hereby granted, provided    #
8 # that the above copyright notice appear in all copies and that both that      #
9 # copyright notice and this permission notice appear in supporting             #
10 # documentation, and that the name of the above listed copyright holder(s) not #
11 # be used in advertising or publicity pertaining to distribution of the        #
12 # software without specific, written prior permission. THE ABOVE LISTED        #
13 # COPYRIGHT HOLDER(S) DISCLAIM ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,    #
14 # INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT #
15 # SHALL THE ABOVE LISTED COPYRIGHT HOLDER(S) BE LIABLE FOR ANY SPECIAL,        #
16 # INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM   #
17 # LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE   #
18 # OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR    #
19 # PERFORMANCE OF THIS SOFTWARE.                                                #
20 ################################################################################
21 # $Id: MKexpanded.sh,v 1.4 1997/05/10 20:21:58 tom Exp $
22 #
23 # Script to generate 'expanded.c', a dummy source that contains functions
24 # corresponding to complex macros used in this library.  By making functions,
25 # we simplify analysis and debugging.
26
27 if test $# != 0; then
28 preprocessor="$1"
29 else
30 preprocessor="cc -E"
31 fi
32 shift
33 if test $# != 0 ; then
34         preprocessor="$preprocessor $*"
35 else
36         preprocessor="$preprocessor -DHAVE_CONFIG_H -I. -I../include"
37 fi
38
39 TMP=gen$$.c
40 trap "rm -f $TMP" 0 1 2 5 15
41
42 cat >expanded.c <<EOF
43 /* generated by MKexpanded.sh */
44 #include <curses.priv.h>
45 #include <term.h>
46 #ifdef NCURSES_EXPANDED
47 EOF
48
49 cat >$TMP <<EOF
50 #include <ncurses_cfg.h>
51 #undef NCURSES_EXPANDED /* this probably is set in ncurses_cfg.h */
52 #include <curses.priv.h>
53 /* these are names we'd like to see */
54 #undef ALL_BUT_COLOR
55 #undef PAIR_NUMBER
56 #undef TRUE
57 #undef FALSE
58 /* this is a marker */
59 IGNORE
60 chtype _nc_ch_or_attr(chtype ch, attr_t at)
61 {
62         return ch_or_attr(ch,at);
63 }
64 void _nc_toggle_attr_on(attr_t *S, attr_t at)
65 {
66         toggle_attr_on(*S,at);
67 }
68 void _nc_toggle_attr_off(attr_t *S, attr_t at) 
69 {
70         toggle_attr_off(*S,at);
71 }
72 int _nc_can_clear_with(chtype ch)
73 {
74         return can_clear_with(ch);
75 }
76 int _nc_DelCharCost(int count)
77 {
78         return DelCharCost(count);
79 }
80 int _nc_InsCharCost(int count)
81 {
82         return InsCharCost(count);
83 }
84 void _nc_UpdateAttrs(chtype c)
85 {
86         UpdateAttrs(c);
87 }
88 EOF
89
90 $preprocessor $TMP 2>/dev/null | sed -e '1,/^IGNORE$/d' >>expanded.c
91
92 cat >>expanded.c <<EOF
93 #else /* ! NCURSES_EXPANDED */
94 void _nc_expanded(void) { }
95 #endif /* NCURSES_EXPANDED */
96 EOF