blob: 7a5f5993c48777a03833cdd7c81b0560fd999223 [file] [log] [blame]
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05301#! /bin/sh
2##############################################################################
Steve Kondikae271bc2015-11-15 02:50:53 +01003# Copyright (c) 1998-2009,2010 Free Software Foundation, Inc. #
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +05304# #
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#
Steve Kondikae271bc2015-11-15 02:50:53 +010030# Author: Thomas E. Dickey, 1997-on
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053031#
Steve Kondikae271bc2015-11-15 02:50:53 +010032# $Id: MKexpanded.sh,v 1.17 2010/01/23 17:57:43 tom Exp $
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053033#
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
38if test $# != 0; then
39preprocessor="$1"
40else
41preprocessor="cc -E"
42fi
43shift
44if test $# != 0 ; then
45 preprocessor="$preprocessor $*"
46else
47 preprocessor="$preprocessor -DHAVE_CONFIG_H -I. -I../include"
48fi
49
50TMP=gen$$.c
51trap "rm -f $TMP" 0 1 2 5 15
52
53cat <<EOF
54/* generated by MKexpanded.sh */
Steve Kondikae271bc2015-11-15 02:50:53 +010055#define NEED_NCURSES_CH_T 1
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053056#include <curses.priv.h>
Steve Kondikae271bc2015-11-15 02:50:53 +010057
58#ifndef CUR
59#define CUR SP_TERMTYPE
60#endif
61
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053062#if NCURSES_EXPANDED
63EOF
64
65cat >$TMP <<EOF
66#include <ncurses_cfg.h>
67#undef NCURSES_EXPANDED /* this probably is set in ncurses_cfg.h */
68#include <curses.priv.h>
69/* these are names we'd like to see */
70#undef ALL_BUT_COLOR
71#undef PAIR_NUMBER
72#undef TRUE
73#undef FALSE
74/* this is a marker */
75IGNORE
Steve Kondikae271bc2015-11-15 02:50:53 +010076NCURSES_EXPORT(void)
77_nc_toggle_attr_on (attr_t *S, attr_t at)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053078{
79 toggle_attr_on(*S,at);
80}
Steve Kondikae271bc2015-11-15 02:50:53 +010081
82NCURSES_EXPORT(void)
83_nc_toggle_attr_off (attr_t *S, attr_t at)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053084{
85 toggle_attr_off(*S,at);
86}
Steve Kondikae271bc2015-11-15 02:50:53 +010087
88NCURSES_EXPORT(int)
89NCURSES_SP_NAME(_nc_DelCharCost) (NCURSES_SP_DCLx int count)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053090{
Steve Kondikae271bc2015-11-15 02:50:53 +010091 return DelCharCost(SP_PARM, count);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053092}
Steve Kondikae271bc2015-11-15 02:50:53 +010093
94NCURSES_EXPORT(int)
95NCURSES_SP_NAME(_nc_InsCharCost) (NCURSES_SP_DCLx int count)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053096{
Steve Kondikae271bc2015-11-15 02:50:53 +010097 return InsCharCost(SP_PARM, count);
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +053098}
Steve Kondikae271bc2015-11-15 02:50:53 +010099
100NCURSES_EXPORT(void)
101NCURSES_SP_NAME(_nc_UpdateAttrs) (NCURSES_SP_DCLx CARG_CH_T c)
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530102{
Steve Kondikae271bc2015-11-15 02:50:53 +0100103 UpdateAttrs(SP_PARM, CHDEREF(c));
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530104}
Steve Kondikae271bc2015-11-15 02:50:53 +0100105
106@if_NCURSES_SP_FUNCS
107NCURSES_EXPORT(int)
108_nc_DelCharCost (int count)
109{
110 return NCURSES_SP_NAME(_nc_DelCharCost) (CURRENT_SCREEN, count);
111}
112
113NCURSES_EXPORT(int)
114_nc_InsCharCost (int count)
115{
116 return NCURSES_SP_NAME(_nc_InsCharCost)(CURRENT_SCREEN, count);
117}
118
119NCURSES_EXPORT(void)
120_nc_UpdateAttrs (CARG_CH_T c)
121{
122 NCURSES_SP_NAME(_nc_UpdateAttrs)(CURRENT_SCREEN,c);
123}
124@endif
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530125EOF
126
Steve Kondikae271bc2015-11-15 02:50:53 +0100127$preprocessor $TMP 2>/dev/null | \
128 sed -e '1,/^IGNORE$/d' -e 's/^@/#/' -e 's/^#if_/#if /'
Amit Daniel Kachhape6a01f52011-07-20 11:45:59 +0530129
130cat <<EOF
131#else /* ! NCURSES_EXPANDED */
132NCURSES_EXPORT(void) _nc_expanded (void) { }
133#endif /* NCURSES_EXPANDED */
134EOF